123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <template>
- <div>
- <el-dialog title="京东退货质检" v-model="visible" width="1200px" destroy-on-close :loading="loading">
- <el-button type="primary" @click="handleOpen" style="margin-bottom: 10px">
- 选择产品
- </el-button>
- <!-- <el-button type="primary" @click="openExcel" style="margin-bottom: 10px">-->
- <!-- 导入Excel-->
- <!-- </el-button>-->
- <el-table :data="list">
- <el-table-column prop="productCustomCode" label="物品编码"/>
- <el-table-column prop="productName" label="物品名称"/>
- <el-table-column prop="productSpec" label="规格"/>
- <el-table-column prop="productUnit" label="单位"/>
- <el-table-column prop="quantity" label="待质检数量"/>
- <el-table-column label="良品数量" width="120">
- <template #default="{ row, $index }">
- <el-input-number
- v-model="row.qualifiedCount"
- :controls="false"
- :precision="0"
- :min="0"
- style="width: 80px"
- />
- </template>
- </el-table-column>
- <el-table-column label="次品数量" width="120">
- <template #default="{ row, $index }">
- <el-input-number
- v-model="row.defectiveCount"
- :controls="false"
- :precision="0"
- :min="0"
- style="width: 80px"
- />
- </template>
- </el-table-column>
- <el-table-column label="报废数量" width="120">
- <template #default="{ row, $index }">
- <el-input-number
- v-model="row.scrappedCount"
- :controls="false"
- :precision="0"
- :min="0"
- style="width: 80px"
- />
- </template>
- </el-table-column>
- <el-table-column
- prop="zip"
- label="操作"
- width="100"
- fixed="right"
- align="center"
- >
- <template #default="{ $index }">
- <el-button type="primary" link @click="list.splice($index,1)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <template #footer>
- <el-button @click="visible = false" size="large">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm()"
- size="large"
- :loading="submitLoading"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- v-model="productVisible"
- title="选择产品"
- width="70%"
- append-to-body
- >
- <byTable
- :hideSearch="true"
- :source="productSource"
- :pagination="productPagination"
- :config="productConfig"
- :loading="productLoading"
- @get-list="getProductSource"
- highlight-current-row
- :selectConfig="[]"
- :table-events="{}"
- :action-list="[]"
- >
- </byTable>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="productVisible = false">取消</el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byTable from "@/components/byTable/index";
- import {computed, getCurrentInstance, ref} from "vue";
- import {ElMessage} from "element-plus";
- const {proxy} = getCurrentInstance();
- const emits = defineEmits(['submit'])
- const submitLoading = ref(false);
- const list = ref([])
- const visible = ref(false)
- const loading = ref(false)
- const productVisible = ref(false)
- const productLoading = ref(false)
- const productSource = ref([])
- const productPagination = ref({
- total: 0,
- pageNum: 1,
- pageSize: 10,
- })
- const productConfig = computed(() => {
- return [
- {
- attrs: {
- label: "物品编码",
- prop: "productCustomCode",
- },
- },
- {
- attrs: {
- label: "物品名称",
- prop: "productName",
- },
- },
- {
- attrs: {
- label: "规格",
- prop: "productSpec",
- },
- },
- {
- attrs: {
- label: "单位",
- prop: "productUnit",
- },
- },
- {
- attrs: {
- label: "待质检数量",
- prop: "quantity",
- },
- },
- {
- attrs: {
- label: "操作",
- },
- renderHTML(row) {
- if (!list.value.map(item => item.productCustomCode).includes(row.productCustomCode)) {
- return [
- {
- attrs: {
- label: "选择",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- list.value.push({
- ...row,
- qualifiedCount: row.quantity,
- defectiveCount: 0,
- scrappedCount: 0
- })
- },
- },
- ]
- } else {
- return []
- }
- },
- },
- ];
- });
- const open = () => {
- visible.value = true
- }
- const handleOpen = () => {
- productVisible.value = true
- getProductSource()
- }
- const getProductSource = (req) => {
- productPagination.value = {...productPagination.value, ...req}
- productLoading.value = true
- proxy.post("/jdRefundNotQualityCheck/page", productPagination.value)
- .then((data) => {
- productSource.value = data.rows;
- productPagination.value.total = data.total;
- })
- .finally(_ => {
- productLoading.value = false;
- })
- }
- const submitForm = () => {
- for (let item of list.value) {
- item.qualifiedCount = item.qualifiedCount ?? 0
- item.defectiveCount = item.defectiveCount ?? 0
- item.scrappedCount = item.scrappedCount ?? 0
- if (item.qualifiedCount + item.defectiveCount + item.scrappedCount > item.quantity) {
- ElMessage.error(`物品【${item.productCustomCode}】 良品数量+次品数量+报废数量 大于 质检数量`)
- return
- }
- }
- loading.value = true
- proxy.post("/jdRefundNotQualityCheck/submitQualityCheck", list.value)
- .then(() => {
- emits('submit')
- ElMessage.success(`质检成功`)
- visible.value = false
- list.value = []
- })
- .finally(_ => {
- loading.value = false;
- })
- }
- defineExpose({open})
- </script>
|