| | |
| | | <el-table-column label="煤质" align="center" v-if="activeTab=== 'officialInventory'" width="600"> |
| | | <el-table-column v-for="col in columnTitle" :key="col.prop" :prop="col.prop" :label="col.label" align="center" sortable min-width="200"/> |
| | | </el-table-column> |
| | | <el-table-column prop="registrant" label="登记人" width="180"/> |
| | | <el-table-column prop="registrationTime" label="登记日期" width="180"/> |
| | | <el-table-column prop="registrantId" label="登记人" width="180"/> |
| | | <el-table-column prop="registrationDate" label="登记日期" width="180"/> |
| | | <el-table-column fixed="right" label="操作" min-width="60" align="center" v-if="activeTab !== 'officialInventory'"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="reviewDia(scope.row)">审核</el-button> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="库存数量" prop="inventoryQuantity"> |
| | | <el-input v-model="form.inventoryQuantity" placeholder="请输入库存数量" maxlength="30" /> |
| | | <el-input v-model="form.inventoryQuantity" placeholder="请输入库存数量" :max="inventoryQuantity" type="number"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="煤质方案" prop="qualityPlan"> |
| | | <el-select v-model="form.qualityPlan" placeholder="请选择" @change="coalFieldListOption" clearable> |
| | | <el-select v-model="form.qualityPlan" placeholder="请选择" @change="coalPlanByIdList" clearable> |
| | | <el-option |
| | | v-for="dict in qualityPlanOption" |
| | | :key="dict.id" |
| | |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import { |
| | | addOrEditCoalValue, |
| | | coalFieldList, |
| | | coalFieldList, coalPlanById, |
| | | coalPlanList, officialInventoryList, |
| | | pendingInventoryList |
| | | } from "@/api/warehouseManagement/index.js"; |
| | |
| | | const total = ref(0); |
| | | const pageNum = ref(1); |
| | | const pageSize = ref(10); |
| | | const inventoryQuantity = ref(0); |
| | | // 审核弹框 |
| | | const reviewVisible = ref(false); |
| | | // 合并弹框 |
| | |
| | | totalPriceIncludingTax: '', |
| | | costPerUnit: '', |
| | | qualityPlan: '', |
| | | planId: '', |
| | | pId: '', |
| | | }, |
| | | rules: { |
| | | supplierName: [{ required: true, message: "请输入供应商名称", trigger: "blur" }], |
| | |
| | | }) |
| | | const columnTitle = ref([]) |
| | | onMounted(() => { |
| | | handleTabClick({ props: { name: "supplier" } }); |
| | | handleTabClick({ props: { name: "pendingInbound" } }); |
| | | }); |
| | | // 标签页点击 |
| | | const handleTabClick = (tab) => { |
| | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | // 赋值煤质表头展示字段 |
| | | columnTitle.value = [ |
| | | {prop: 'value1', label: '百分比1'}, |
| | | {prop: 'value2', label: '百分比2'}, |
| | | {prop: 'value3', label: '百分比3'}, |
| | | ] |
| | | if (tabName.value === "pendingInbound") { |
| | | pendingInventoryList({ ...queryParams }).then(res => { |
| | | pendingInventoryList({ ...queryParams, current: pageNum.value, size: pageSize.value }).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | }) |
| | | } else { |
| | | officialInventoryList({ ...queryParams }).then(res => { |
| | | officialInventoryList({ ...queryParams, current: pageNum.value, size: pageSize.value }).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | const result = flattenFields(res.data.records); |
| | | tableData.value = result; |
| | | total.value = res.data.total; |
| | | coalFieldListOption() |
| | | }) |
| | | } |
| | | }; |
| | | // 扁平化处理函数 |
| | | const flattenFields = (data) => { |
| | | return data.map(item => { |
| | | const mergedFields = item.fields.reduce((acc, obj) => { |
| | | const key = Object.keys(obj)[0]; |
| | | acc[key] = obj[key]; |
| | | return acc; |
| | | }, {}); |
| | | |
| | | // 合并主对象与提取出的 fields 字段 |
| | | return { |
| | | ...item, |
| | | ...mergedFields |
| | | }; |
| | | }); |
| | | }; |
| | | // 重置查询 |
| | | const resetQuery = () => { |
| | |
| | | const reviewDia = (row) => { |
| | | reviewVisible.value = true |
| | | form.value = {...row} |
| | | form.value.planId = form.value.id |
| | | form.value.pId = row.id |
| | | inventoryQuantity.value = row.inventoryQuantity |
| | | coalPlanListOptions() |
| | | } |
| | | // 查询煤质方案下拉框 |
| | |
| | | }) |
| | | } |
| | | // 查询煤质方案字段 |
| | | const coalFieldListOption = (id) => { |
| | | coalFieldList({id: id}).then(res => { |
| | | const coalPlanByIdList = (id) => { |
| | | coalPlanById({id: id}).then(res => { |
| | | filteredList.value = res.data |
| | | if (!id) { |
| | | if(!id) { |
| | | filteredList.value = [] |
| | | } |
| | | }) |
| | | } |
| | | // 查询煤质字段 |
| | | const coalFieldListOption = () => { |
| | | coalFieldList().then(res => { |
| | | filteredList.value = res.data |
| | | columnTitle.value = res.data.map(item => { |
| | | return { |
| | | prop: item.fields, |
| | | label: item.fieldName // 使用 fieldName 作为 label |
| | | }; |
| | | }); |
| | | }) |
| | | } |
| | | // 合并库存数据方法 |
| | |
| | | delete form.value.registrationTime |
| | | delete form.value.createTime |
| | | delete form.value.updateTime |
| | | delete form.value.id |
| | | form.value.fieldValue = filteredList.value.map(item => ({ |
| | | [item.fields]: form.value[item.fields] |
| | | })) |