src/api/inventoryManagement/stockIn.js
@@ -61,6 +61,14 @@ data, }); }; // ä¿®æ¹ææåºåä¿¡æ¯ export const updateManagementByCustom = (data) => { return request({ url: "/stockin/updateManagementByCustom ", method: "post", data, }); }; // æ°å¢ååå ¥åºä¿¡æ¯ export function addSutockIn(data) { @@ -88,6 +96,14 @@ data: data }) } // ç¼è¾æåå ¥åºä¿¡æ¯ export function updateProduct(data) { return request({ url: '/stockin/update', method: 'post', data: data }) } // å é¤å ¥åºä¿¡æ¯ export function delStockIn(ids) { src/views/inventoryManagement/dispatchLog/index.vue
@@ -59,6 +59,8 @@ <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> <el-table-column label="åºåºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="åä»·(å )" prop="unitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="totalPrice" width="150"></el-table-column> <!-- <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip />--> @@ -134,10 +136,8 @@ <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> <el-table-column label="åºåºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <!--<!– <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />–>--> <!--<!– <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />–>--> <!--<!– <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip />–>--> <!--<!– <el-table-column label="ä¸å«ç¨æ»ä»·(å )" prop="taxExclusiveTotalPrice" width="180" show-overflow-tooltip />–>--> <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> <el-table-column label="åºåºäºº" prop="createBy" width="80" show-overflow-tooltip /> </el-table> <pagination @@ -210,6 +210,8 @@ <el-table-column label="åä½" prop="unit" show-overflow-tooltip /> <el-table-column label="ç©åç±»å" prop="itemType" show-overflow-tooltip /> <el-table-column label="åºåºæ°é" prop="inboundNum" show-overflow-tooltip /> <el-table-column label="åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> <!-- <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip />--> @@ -440,6 +442,17 @@ tableData.value = res.data.records; tableData.value.map((item) => { item.children = []; // åç«¯è®¡ç®æ»ä»· const inboundNum = Number(item.inboundNum) || 0; if (activeTab.value === 'production') { // æååºåºï¼æ»ä»· = unitPrice à inboundNum const unitPrice = Number(item.unitPrice) || 0; item.totalPrice = (unitPrice * inboundNum).toFixed(2); } else { // åæåææåºåºï¼æ»ä»· = taxInclusiveUnitPrice à inboundNum const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0; item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * inboundNum).toFixed(2); } }); total.value = res.data.total; }) @@ -992,3 +1005,5 @@ } } </style> src/views/inventoryManagement/issueManagement/index.vue
@@ -42,6 +42,7 @@ <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> <el-table-column label="å©ä½åºå" prop="inboundNum0" width="90" show-overflow-tooltip /> <!-- <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip />--> @@ -100,11 +101,9 @@ <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> <!-- <!– <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />–> <!– <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />–> <!– <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip />–> <!– <el-table-column label="ä¸å«ç¨æ»ä»·" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip />–> --> <!-- <el-table-column label="å ¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> --> <el-table-column label="å©ä½åºå" prop="inboundNum0" width="90" show-overflow-tooltip /> <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> <el-table-column fixed="right" label="æä½" min-width="60" align="center"> <template #default="scope"> <el-button link type="primary" size="small" @click="openForm(scope.row);">é¢ç¨</el-button> @@ -159,6 +158,7 @@ <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> <el-table-column label="ç©åç±»å" prop="itemType" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" show-overflow-tooltip /> <el-table-column label="å©ä½åºå" prop="inboundNum0" width="90" show-overflow-tooltip /> <!-- <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip />--> src/views/inventoryManagement/receiptManagement/components/formDia.vue
@@ -46,15 +46,15 @@ </template> </el-table-column> <el-table-column label="ç¨ç(%)" prop="taxRate" width="120" /> <el-table-column label="åä»·(å )" prop="unitPrice" width="150"> <el-table-column label="åä»·(å )" prop="taxInclusiveUnitPrice" width="150"> <template #default="scope"> <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" /> <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" :disabled="operationType === 'edit'"/> </template> </el-table-column> <el-table-column label="æ»ä»·(å )" :formatter="formattedNumber" prop="totalPrice" prop="taxInclusiveTotalPrice" width="150" > </el-table-column> @@ -194,12 +194,12 @@ // è®¡ç®æ»ä»· const calculateTotalPrice = (row) => { const quantityStock = Number(row?.quantityStock ?? 0); const unitPrice = Number(row?.unitPrice ?? 0); const taxInclusiveUnitPrice = Number(row?.taxInclusiveUnitPrice ?? 0); if (Number.isFinite(quantityStock) && Number.isFinite(unitPrice)) { row.totalPrice = quantityStock * unitPrice; if (Number.isFinite(quantityStock) && Number.isFinite(taxInclusiveUnitPrice)) { row.taxInclusiveTotalPrice = quantityStock * taxInclusiveUnitPrice; } else { row.totalPrice = 0; row.taxInclusiveTotalPrice = 0; } }; @@ -221,8 +221,8 @@ productList.value = productRes.data.map(item => ({ ...item, quantityStock: 0, unitPrice: Number(item?.unitPrice ?? 0), totalPrice: 0, taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0), taxInclusiveTotalPrice: 0, originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? 0), })) } catch (error) { @@ -290,8 +290,8 @@ details: selectedRows.value.map(product => ({ id: product.id, inboundQuantity: Number(product.quantityStock), unitPrice: Number(product.unitPrice), totalPrice: Number(product.totalPrice) taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice), taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice) })), }; loading.value = true @@ -373,8 +373,8 @@ productList.value = res.data.map(item => ({ ...item, quantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0), unitPrice: Number(item?.unitPrice ?? 0), totalPrice: Number(item?.quantityStock ?? 0) * Number(item?.unitPrice ?? 0), taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0), taxInclusiveTotalPrice: Number(item?.quantityStock ?? 0) * Number(item?.taxInclusiveUnitPrice ?? 0), originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0), })) selectedRows.value = productList.value @@ -395,3 +395,5 @@ <style scoped lang="scss"></style> src/views/inventoryManagement/receiptManagement/components/formDiaProduct.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,302 @@ <template> <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢èªå®ä¹å ¥åº' : 'ç¼è¾èªå®ä¹å ¥åº'" width="70%" @close="closeDia"> <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <div style="margin-bottom: 10px;" v-if="operationType === 'add'"> <el-button type="primary" @click="addProductRow">æ°å¢</el-button> </div> <el-table :data="productList" border v-loading="loadingProducts" > <el-table-column align="center" label="åºå·" type="index" width="60" /> <el-table-column label="产å大类" prop="productCategory" width="200"> <template #default="scope"> <el-input v-model="scope.row.productCategory" placeholder="请è¾å ¥äº§å大类" /> </template> </el-table-column> <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200"> <template #default="scope"> <el-input v-model="scope.row.specificationModel" placeholder="请è¾å ¥è§æ ¼åå·" /> </template> </el-table-column> <el-table-column label="åä½" prop="unit" width="100"> <template #default="scope"> <el-input v-model="scope.row.unit" placeholder="请è¾å ¥åä½" /> </template> </el-table-column> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="150"> <template #default="scope"> <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" /> </template> </el-table-column> <el-table-column label="å ¥åºæ¥æ" prop="inboundDate" width="180"> <template #default="scope"> <el-date-picker v-model="scope.row.inboundDate" type="date" placeholder="è¯·éæ©å ¥åºæ¥æ" value-format="YYYY-MM-DD" format="YYYY-MM-DD" style="width: 100%" /> </template> </el-table-column> <el-table-column label="åä»·(å )" prop="unitPrice" width="150"> <template #default="scope"> <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" /> </template> </el-table-column> <el-table-column label="æ»ä»·(å )" prop="totalPrice" width="150" > </el-table-column> <el-table-column label="æä½" width="80" v-if="operationType === 'add'"> <template #default="scope"> <el-button type="danger" size="small" @click="removeProductRow(scope.$index)">å é¤</el-button> </template> </el-table-column> </el-table> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm">确认</el-button> <el-button @click="closeDia">åæ¶</el-button> </div> </template> </el-dialog> </template> <script setup> import { ref, reactive, toRefs, getCurrentInstance } from 'vue' import useUserStore from '@/store/modules/user' import { addStockInCustom, updateProduct } from "@/api/inventoryManagement/stockIn.js"; const userStore = useUserStore() const { proxy } = getCurrentInstance() const emit = defineEmits(['close', 'success']) const operationType = ref('')// æä½ç±»å: 'add' æ 'edit' const dialogFormVisible = ref(false)// å¼¹æ¡æ¾ç¤ºç¶æ const productList = ref([]);// 产ååè¡¨æ°æ® const loadingProducts = ref(false);// 产åå è½½ç¶æ const loading = ref(false); function formatDateTime(date = new Date(), includeTime = true) { const d = new Date(date); const year = d.getFullYear(); const month = String(d.getMonth() + 1).padStart(2, '0'); const day = String(d.getDate()).padStart(2, '0'); if (!includeTime) { return `${year}-${month}-${day}`; } const hours = String(d.getHours()).padStart(2, '0'); const minutes = String(d.getMinutes()).padStart(2, '0'); const seconds = String(d.getSeconds()).padStart(2, '0'); return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; } function getCurrentDate() { return formatDateTime(new Date(), false); } const itemTypeOptions = [ { label: 'ç©æ', value: 'ç©æ' }, { label: 'åæ', value: 'åæ' }, { label: 'æå', value: 'æå' }, { label: 'å ¶ä»', value: 'å ¶ä»' }, ] const taxRateOptions = [ { label: '1', value: 1 }, { label: '6', value: 6 }, { label: '13', value: 13 }, ] const data = reactive({ form: { id: null, supplierId: null, // ä¾åºåID supplierName: '', // ä¾åºååç§° recorderId: userStore.userId, // å½å ¥äººID recorderName: userStore.name, // å½å ¥äººå§å entryDate: getCurrentDate(), // å½å ¥æ¥æ remark: '', // 夿³¨ }, rules: { supplierName: [{ required: true, message: "请è¾å ¥ä¾åºååç§°", trigger: "blur" }] } }) const { form, rules } = toRefs(data) // æ°å¢äº§åè¡ const addProductRow = () => { productList.value.push({ id: null, productCategory: '', specificationModel: '', unit: '', supplierName: form.value.supplierName || '', itemType: '', inboundNum: 0, inboundDate: '', quantityStock: 0, unitPrice: 0, totalPrice: 0, taxRate: null, taxExclusiveTotalPrice: 0, }); }; // å é¤äº§åè¡ const removeProductRow = (index) => { productList.value.splice(index, 1); }; // è®¡ç®æ»ä»·ï¼æ ¹æ®æ°éãåä»·åå«ç¨åä»·ï¼ const calculateTotalPrice = (row) => { // è®¡ç®æ®éæ»ä»·ï¼inboundNum * unitPrice const quantity = Number(row.inboundNum || 0); const unitPrice = Number(row.unitPrice || 0); row.totalPrice = quantity * unitPrice; calculateExclusivePrice(row); }; // 计ç®ä¸å«ç¨æ»ä»·ï¼æ ¹æ®å«ç¨æ»ä»·åç¨çï¼ const calculateExclusivePrice = (row) => { const totalPrice = Number(row.totalPrice || 0); const taxRate = Number(row.taxRate || 0); row.taxExclusiveTotalPrice = totalPrice / (1 + taxRate / 100); }; const submitForm = async () => { try { await proxy.$refs.formRef.validate() if (!productList.value.length) { proxy.$modal.msgError('请è³å°æ·»å 䏿¡äº§åæ°æ®') return } // éªè¯èªå®ä¹æ·»å çæ°æ®å¿ å¡«åæ®µ for (let i = 0; i < productList.value.length; i++) { const product = productList.value[i]; if (!product.productCategory || !product.specificationModel || !product.unit) { proxy.$modal.msgError(`第${i + 1}è¡äº§åæ°æ®æªå¡«å宿´ï¼äº§å大类ãè§æ ¼åå·ãåä½ä¸ºå¿ å¡«ï¼`) return } if (!product.inboundDate) { proxy.$modal.msgError(`第${i + 1}è¡è¯·éæ©å ¥åºæ¥æ`) return } const stock = Number(product?.inboundNum ?? 0); if (!Number.isFinite(stock) || stock <= 0) { proxy.$modal.msgError(`第${i + 1}è¡æ¬æ¬¡å ¥åºæ°éé大äº0`) return } } const payloadList = productList.value.map(product => ({ id: product.id ?? null, inboundNum: Number(product.inboundNum), productCategory: product.productCategory, specificationModel: product.specificationModel, unit: product.unit, supplierName: product.supplierName || form.value.supplierName, itemType: product.itemType, inboundDate: formatDateTime(product.inboundDate, false), taxRate: Number(product.taxRate || 0), taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0), unitPrice: Number(product.unitPrice || 0), })); loading.value = true if (operationType.value === 'edit') { const editPayload = payloadList[0] await updateProduct(editPayload) } else { await addStockInCustom(payloadList) } proxy.$modal.msgSuccess(operationType.value === 'edit' ? 'ç¼è¾èªå®ä¹å ¥åºæå' : 'æ°å¢èªå®ä¹å ¥åºæå') closeDia() emit('success') } catch (error) { console.error('æäº¤å¤±è´¥:', error) if (!error.errors) { proxy.$modal.msgError('æä½å¤±è´¥ï¼è¯·éè¯') } } finally { loading.value = false } } const closeDia = () => { proxy.$refs.formRef.resetFields() dialogFormVisible.value = false productList.value = [] emit('close') } const openDialog = async (type, row) => { operationType.value = type dialogFormVisible.value = true if (type === 'add') { form.value = { id: null, supplierId: null, supplierName: '', recorderId: userStore.userId, recorderName: userStore.name, entryDate: getCurrentDate(), remark: '' } productList.value = [] } else { // ç¼è¾æ¨¡å¼ï¼å°è¡æ°æ®å¡«å å°è¡¨æ ¼ä¸ä»¥æ¯æä¿®æ¹ form.value = { id: row?.id ?? null, supplierId: row?.supplierId ?? null, supplierName: row?.supplierName ?? '', recorderId: userStore.userId, recorderName: userStore.name, entryDate: getCurrentDate(), remark: row?.remark ?? '' } productList.value = [{ id: row?.id ?? null, productCategory: row?.productCategory ?? '', specificationModel: row?.specificationModel ?? '', unit: row?.unit ?? '', supplierName: row?.supplierName ?? '', itemType: row?.itemType ?? '', inboundNum: Number(row?.inboundNum ?? row?.inboundQuantity ?? 0), inboundDate: row?.inboundDate ?? row?.createTime ?? '', taxRate: Number(row?.taxRate ?? 0), unitPrice: Number(row?.unitPrice ?? 0), taxExclusiveTotalPrice: Number(row?.taxExclusiveTotalPrice ?? 0), }] } } defineExpose({ openDialog, }) </script> <style scoped lang="scss"></style> src/views/inventoryManagement/receiptManagement/index.vue
@@ -43,7 +43,8 @@ <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip /> <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <!-- <el-table-column label="å©ä½åºå" prop="inboundNum0" show-overflow-tooltip />--> <el-table-column label="åä»·(å )" prop="unitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="totalPrice" width="150"></el-table-column> <!-- <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> @@ -105,9 +106,10 @@ <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip /> <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="90" show-overflow-tooltip /> <el-table-column label="åä»·(å )" prop="unitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="totalPrice" width="150"></el-table-column> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <!-- <el-table-column label="å©ä½åºå" prop="inboundNum0" show-overflow-tooltip />--> <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> <!--<!– <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />–>--> <!--<!– <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />–>--> <!--<!– <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" show-overflow-tooltip />–>--> @@ -168,7 +170,8 @@ <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="70" show-overflow-tooltip /> <el-table-column label="ç©åç±»å" prop="itemType" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <!-- <el-table-column label="å©ä½åºå" prop="inboundNum0" show-overflow-tooltip />--> <el-table-column label="åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> <!-- <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> @@ -190,6 +193,7 @@ <form-dia ref="formDia" @close="handleQuery" @success="handleQuery"></form-dia> <form-dia-manual ref="formDiaManual" @close="handleQuery" @success="handleQuery"></form-dia-manual> <form-dia-product ref="formDiaProduct" @close="handleQuery" @success="handleQuery"></form-dia-product> </div> </template> @@ -202,19 +206,18 @@ import { getStockInPage, getStockInPageByProduction, getStockInPageByCustom, delStockIn, delStockInCustom, getInPageByCustom, } from "@/api/inventoryManagement/stockIn.js"; import FormDia from './components/formDia.vue' import FormDiaManual from './components/formDiaManual.vue' import FormDiaProduct from './components/formDiaProduct.vue' // è·åå½åæ¥æ function getCurrentDate() { return dayjs().format('YYYY-MM-DD') } const userStore = useUserStore() const { proxy } = getCurrentInstance() const tableData = ref([]) @@ -222,6 +225,7 @@ const tableLoading = ref(false) const formDia = ref() const formDiaManual = ref() const formDiaProduct = ref() const activeTab = ref('production') // å½åæ¿æ´»ç tab const page = reactive({ @@ -274,6 +278,26 @@ apiCall.then(res => { tableLoading.value = false tableData.value = res.data.records // åç«¯è®¡ç®æ»ä»·ï¼æ»ä»· = unitPrice * inboundNum tableData.value = tableData.value.map(item => { // 使ç¨å ¥åºæ°éè®¡ç®æ»ä»· const inboundNum = Number(item.inboundNum) || 0 const unitPrice = Number(item.unitPrice) || 0 const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0 // æ ¹æ®æ ç¾é¡µç±»å计ç®ä¸åçæ»ä»· if (activeTab.value === 'production') { // æååºåï¼æ»ä»· = unitPrice * å ¥åºæ°é item.totalPrice = (unitPrice * inboundNum).toFixed(2) } else { // åæåææåºåï¼å«ç¨æ»ä»· = taxInclusiveUnitPrice * å ¥åºæ°é item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * inboundNum).toFixed(2) } return item }) total.value = res.data.total }).catch(() => { tableLoading.value = false @@ -297,7 +321,9 @@ await nextTick(() => { if (currentTab === 'manual') { formDiaManual.value?.openDialog(type, row) } else { } else if (currentTab === 'production') { formDiaProduct.value?.openDialog(type, row) }else { formDia.value?.openDialog(type, row) } }) @@ -382,3 +408,6 @@ </script> <style scoped lang="scss"></style> src/views/inventoryManagement/stockManagement/components/FormDiaManual.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,154 @@ <template> <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢ææåºå' : 'ç¼è¾ææåºå'" width="70%" @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia"> <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="产å大类ï¼" prop="productCategory"> <el-input disabled v-model="form.productCategory" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> <el-input disabled v-model="form.specificationModel" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åä½ï¼" prop="unit"> <el-input disabled v-model="form.unit" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="ç©åç±»åï¼" prop="itemType"> <el-input disabled v-model="form.itemType" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="å ¥åºæ¶é´ï¼" prop="createTime"> <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="åºåæ°éï¼" prop="inboundNum"> <el-input v-model="form.inboundNum" placeholder="请è¾å ¥" clearable @input="calculateTotalPrice" /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="å·²åºåºæ°éï¼" prop="totalInboundNum"> <el-input disabled v-model="form.totalInboundNum" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å¾ åºåºæ°éï¼" prop="inboundNum0"> <el-input disabled v-model="form.inboundNum0" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åä»·(å )ï¼" prop="taxInclusiveUnitPrice"> <el-input v-model="form.taxInclusiveUnitPrice" placeholder="请è¾å ¥" clearable @input="calculateTotalPrice" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="æ»ä»·(å )ï¼" prop="taxInclusiveTotalPrice"> <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="èªå¨è®¡ç®" clearable /> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm">确认</el-button> <el-button @click="closeDia">åæ¶</el-button> </div> </template> </el-dialog> </template> <script setup> import { ref, reactive, toRefs, watch } from 'vue' const props = defineProps({ dialogFormVisible: Boolean, operationType: String, formData: Object }) const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close']) const formRef = ref() const data = reactive({ form: { productCategory: '', specificationModel: '', unit: '', itemType: '', createTime: '', inboundNum: '', totalInboundNum: '', inboundNum0: '', taxInclusiveUnitPrice: '', taxInclusiveTotalPrice: '' }, rules: { productCategory: [{ required: true, message: '请è¾å ¥äº§å大类', trigger: 'blur' }], specificationModel: [{ required: true, message: '请è¾å ¥è§æ ¼åå·', trigger: 'blur' }], unit: [{ required: true, message: '请è¾å ¥åä½', trigger: 'blur' }], itemType: [{ required: true, message: '请è¾å ¥ç©åç±»å', trigger: 'blur' }], createTime: [{ required: true, message: 'è¯·éæ©å ¥åºæ¶é´', trigger: 'change' }], inboundNum: [{ required: true, message: '请è¾å ¥åºåæ°é', trigger: 'blur' }], taxInclusiveUnitPrice: [{ required: true, message: '请è¾å ¥åä»·', trigger: 'blur' }] } }) const { form, rules } = toRefs(data) // è®¡ç®æ»ä»·ï¼æ»ä»· = åä»· à å©ä½åºå const calculateTotalPrice = () => { const unitPrice = parseFloat(form.value.taxInclusiveUnitPrice) || 0 const stockQuantity = parseFloat(form.value.inboundNum) || 0 // åºåæ°é const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // å·²åºåºæ°é const remainingStock = stockQuantity - outboundQuantity // å©ä½åºå form.value.taxInclusiveTotalPrice = (unitPrice * remainingStock).toFixed(2) } // çå¬formDataåå watch(() => props.formData, (newVal) => { if (newVal) { form.value = { ...newVal } // æ°æ®åååéæ°è®¡ç®æ»ä»· calculateTotalPrice() } }, { immediate: true }) // æäº¤è¡¨å const submitForm = () => { formRef.value.validate(valid => { if (valid) { emit('submit', form.value) } }) } // å ³éå¼¹æ¡ const closeDia = () => { emit('close') emit('update:dialogFormVisible', false) } </script> <style scoped lang="scss"> .dialog-footer { text-align: center; } </style> src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,147 @@ <template> <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢æååºå' : 'ç¼è¾æååºå'" width="70%" @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia"> <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="产å大类ï¼" prop="productCategory"> <el-input disabled v-model="form.productCategory" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> <el-input disabled v-model="form.specificationModel" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åä½ï¼" prop="unit"> <el-input disabled v-model="form.unit" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å ¥åºæ¶é´ï¼" prop="createTime"> <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åºåæ°éï¼" prop="inboundNum"> <el-input v-model="form.inboundNum" placeholder="请è¾å ¥" clearable @input="calculateTotalPrice" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å·²åºåºæ°éï¼" prop="totalInboundNum"> <el-input disabled v-model="form.totalInboundNum" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="å¾ åºåºæ°éï¼" prop="inboundNum0"> <el-input disabled v-model="form.inboundNum0" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="åä»·(å )ï¼" prop="unitPrice"> <el-input v-model="form.unitPrice" placeholder="请è¾å ¥" clearable @input="calculateTotalPrice" /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="æ»ä»·(å )ï¼" prop="totalPrice"> <el-input disabled v-model="form.totalPrice" placeholder="èªå¨è®¡ç®" clearable /> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm">确认</el-button> <el-button @click="closeDia">åæ¶</el-button> </div> </template> </el-dialog> </template> <script setup> import { ref, reactive, toRefs, watch } from 'vue' const props = defineProps({ dialogFormVisible: Boolean, operationType: String, formData: Object }) const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close']) const formRef = ref() const data = reactive({ form: { productCategory: '', specificationModel: '', unit: '', createTime: '', inboundNum: '', totalInboundNum: '', inboundNum0: '', unitPrice: '', totalPrice: '' }, rules: { productCategory: [{ required: true, message: '请è¾å ¥äº§å大类', trigger: 'blur' }], specificationModel: [{ required: true, message: '请è¾å ¥è§æ ¼åå·', trigger: 'blur' }], unit: [{ required: true, message: '请è¾å ¥åä½', trigger: 'blur' }], createTime: [{ required: true, message: 'è¯·éæ©å ¥åºæ¶é´', trigger: 'change' }], inboundNum: [{ required: true, message: '请è¾å ¥åºåæ°é', trigger: 'blur' }], unitPrice: [{ required: true, message: '请è¾å ¥åä»·', trigger: 'blur' }] } }) const { form, rules } = toRefs(data) // è®¡ç®æ»ä»·ï¼æ»ä»· = åä»· à å©ä½åºå const calculateTotalPrice = () => { const unitPrice = parseFloat(form.value.unitPrice) || 0 const stockQuantity = parseFloat(form.value.inboundNum) || 0 // åºåæ°é const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // å·²åºåºæ°é const remainingStock = stockQuantity - outboundQuantity // å©ä½åºå form.value.totalPrice = (unitPrice * remainingStock).toFixed(2) } // çå¬formDataåå watch(() => props.formData, (newVal) => { if (newVal) { form.value = { ...newVal } // æ°æ®åååéæ°è®¡ç®æ»ä»· calculateTotalPrice() } }, { immediate: true }) // æäº¤è¡¨å const submitForm = () => { formRef.value.validate(valid => { if (valid) { emit('submit', form.value) } }) } // å ³éå¼¹æ¡ const closeDia = () => { emit('close') emit('update:dialogFormVisible', false) } </script> <style scoped lang="scss"> .dialog-footer { text-align: center; } </style> src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,147 @@ <template> <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢åæåºå' : 'ç¼è¾åæåºå'" width="70%" @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia"> <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="产å大类ï¼" prop="productCategory"> <el-input disabled v-model="form.productCategory" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> <el-input disabled v-model="form.specificationModel" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åä½ï¼" prop="unit"> <el-input disabled v-model="form.unit" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å ¥åºæ¶é´ï¼" prop="createTime"> <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åºåæ°éï¼" prop="inboundNum"> <el-input v-model="form.inboundNum" placeholder="请è¾å ¥" clearable @input="calculateTotalPrice" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å·²åºåºæ°éï¼" prop="totalInboundNum"> <el-input disabled v-model="form.totalInboundNum" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="å¾ åºåºæ°éï¼" prop="inboundNum0"> <el-input disabled v-model="form.inboundNum0" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å«ç¨åä»·(å )ï¼" prop="taxInclusiveUnitPrice"> <el-input v-model="form.taxInclusiveUnitPrice" placeholder="请è¾å ¥" clearable @input="calculateTotalPrice" /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="å«ç¨æ»ä»·(å )ï¼" prop="taxInclusiveTotalPrice"> <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="èªå¨è®¡ç®" clearable /> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm">确认</el-button> <el-button @click="closeDia">åæ¶</el-button> </div> </template> </el-dialog> </template> <script setup> import { ref, reactive, toRefs, watch } from 'vue' const props = defineProps({ dialogFormVisible: Boolean, operationType: String, formData: Object }) const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close']) const formRef = ref() const data = reactive({ form: { productCategory: '', specificationModel: '', unit: '', createTime: '', inboundNum: '', totalInboundNum: '', inboundNum0: '', taxInclusiveUnitPrice: '', taxInclusiveTotalPrice: '' }, rules: { productCategory: [{ required: true, message: '请è¾å ¥äº§å大类', trigger: 'blur' }], specificationModel: [{ required: true, message: '请è¾å ¥è§æ ¼åå·', trigger: 'blur' }], unit: [{ required: true, message: '请è¾å ¥åä½', trigger: 'blur' }], createTime: [{ required: true, message: 'è¯·éæ©å ¥åºæ¶é´', trigger: 'change' }], inboundNum: [{ required: true, message: '请è¾å ¥åºåæ°é', trigger: 'blur' }], taxInclusiveUnitPrice: [{ required: true, message: '请è¾å ¥å«ç¨åä»·', trigger: 'blur' }] } }) const { form, rules } = toRefs(data) // è®¡ç®æ»ä»·ï¼å«ç¨æ»ä»· = å«ç¨åä»· à å©ä½åºå const calculateTotalPrice = () => { const unitPrice = parseFloat(form.value.taxInclusiveUnitPrice) || 0 const stockQuantity = parseFloat(form.value.inboundNum) || 0 // åºåæ°é const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // å·²åºåºæ°é const remainingStock = stockQuantity - outboundQuantity // å©ä½åºå form.value.taxInclusiveTotalPrice = (unitPrice * remainingStock).toFixed(2) } // çå¬formDataåå watch(() => props.formData, (newVal) => { if (newVal) { form.value = { ...newVal } // æ°æ®åååéæ°è®¡ç®æ»ä»· calculateTotalPrice() } }, { immediate: true }) // æäº¤è¡¨å const submitForm = () => { formRef.value.validate(valid => { if (valid) { emit('submit', form.value) } }) } // å ³éå¼¹æ¡ const closeDia = () => { emit('close') emit('update:dialogFormVisible', false) } </script> <style scoped lang="scss"> .dialog-footer { text-align: center; } </style> src/views/inventoryManagement/stockManagement/index.vue
@@ -17,18 +17,18 @@ clearable @change="handleQuery" /> <span class="search_title ml10">产å大类ï¼</span> <el-input v-model="searchForm.productCategory" style="width: 240px" placeholder="请è¾å ¥" clearable /> <span class="search_title ml10">产å大类ï¼</span> <el-input v-model="searchForm.productCategory" style="width: 240px" placeholder="请è¾å ¥" clearable /> <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> </div> <div> <el-button @click="handleOut">导åº</el-button> <el-button type="danger" plain @click="handleDelete">å é¤</el-button> <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button>--> </div> </div> <div class="table_list"> @@ -43,9 +43,11 @@ <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip /> <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> <el-table-column label="åºåæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å·²åºåºæ°é" prop="totalInboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å¾ åºåºæ°é" prop="inboundNum0" width="100" show-overflow-tooltip /> <el-table-column label="å©ä½åºå" prop="inboundNum0" width="100" show-overflow-tooltip /> <el-table-column label="åä»·(å )" prop="unitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="totalPrice" width="150"></el-table-column> <!-- <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip />--> @@ -75,18 +77,18 @@ clearable @change="handleQuery" /> <span class="search_title ml10">产å大类ï¼</span> <el-input v-model="searchForm.productCategory" style="width: 240px" placeholder="请è¾å ¥" clearable /> <span class="search_title ml10">产å大类ï¼</span> <el-input v-model="searchForm.productCategory" style="width: 240px" placeholder="请è¾å ¥" clearable /> <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> </div> <div> <el-button @click="handleOut">导åº</el-button> <el-button type="danger" plain @click="handleDelete">å é¤</el-button> <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button>--> </div> </div> <div class="table_list"> @@ -100,16 +102,11 @@ <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip /> <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> <el-table-column label="åºåæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å·²åºåºæ°é" prop="totalInboundNum" show-overflow-tooltip /> <el-table-column label="å¾ åºåºæ°é" prop="inboundNum0" show-overflow-tooltip /> <!-- <el-table-column label="åºåé¢è¦æ°é" prop="warnNum" width="130" show-overflow-tooltip /> <el-table-column label="å ¥åºäºº" prop="createBy" width="80" show-overflow-tooltip /> --> <el-table-column fixed="right" label="æä½" min-width="60" align="center"> <template #default="scope"> <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">ç¼è¾</el-button> </template> </el-table-column> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å·²åºåºæ°é" prop="totalInboundNum" show-overflow-tooltip /> <el-table-column label="å©ä½åºå" prop="inboundNum0" show-overflow-tooltip /> <el-table-column label="å«ç¨åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="å«ç¨æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> </el-table> <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" :page="page.current" :limit="page.size" @pagination="paginationChange" /> @@ -132,18 +129,18 @@ clearable @change="handleQuery" /> <span class="search_title ml10">产å大类ï¼</span> <el-input v-model="searchForm.productCategory" style="width: 240px" placeholder="请è¾å ¥" clearable /> <span class="search_title ml10">产å大类ï¼</span> <el-input v-model="searchForm.productCategory" style="width: 240px" placeholder="请è¾å ¥" clearable /> <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> </div> <div> <el-button @click="handleOut">导åº</el-button> <el-button type="danger" plain @click="handleDelete">å é¤</el-button> <!-- <el-button type="danger" plain @click="handleDelete">å é¤</el-button>--> </div> </div> <div class="table_list"> @@ -159,9 +156,11 @@ <el-table-column label="è§æ ¼åå·" prop="specificationModel" show-overflow-tooltip /> <el-table-column label="åä½" prop="unit" width="80" show-overflow-tooltip /> <el-table-column label="ç©åç±»å" prop="itemType" width="120" show-overflow-tooltip /> <el-table-column label="åºåæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å·²åºåºæ°é" prop="totalInboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å¾ åºåºæ°é" prop="inboundNum0" width="100" show-overflow-tooltip /> <el-table-column label="å ¥åºæ°é" prop="inboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å·²åºåºæ°é" prop="totalInboundNum" width="100" show-overflow-tooltip /> <el-table-column label="å©ä½åºå" prop="inboundNum0" width="100" show-overflow-tooltip /> <el-table-column label="åä»·(å )" prop="taxInclusiveUnitPrice" width="150"></el-table-column> <el-table-column label="æ»ä»·(å )" prop="taxInclusiveTotalPrice" width="150"></el-table-column> <!-- <el-table-column label="å«ç¨åä»·" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="å«ç¨æ»ä»·" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />--> <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="100" show-overflow-tooltip />--> @@ -178,112 +177,33 @@ </div> </el-tab-pane> </el-tabs> <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢åºå' : 'ç¼è¾åºå'" width="70%" @close="closeDia"> <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <el-row :gutter="30"> <!-- <el-col :span="12"> <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> <el-input disabled v-model="form.supplierName" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> --> <el-col :span="12"> <el-form-item label="产å大类ï¼" prop="productId"> <el-select disabled v-model="form.productCategory" placeholder="è¯·éæ©" clearable filterable> <el-option v-for="item in productList" :key="item.id" :label="item.productName" :value="item.productName" /> </el-select> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="åºåºäººï¼" prop="entryPerson"> <el-select v-model="form.createUser" filterable default-first-option :reserve-keyword="false" placeholder="è¯·éæ©" clearable> <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> </el-select> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="è§æ ¼åå·ï¼" prop="productManageId"> <el-select disabled v-model="form.specificationModel" placeholder="请å éæ©äº§å大类" clearable filterable :disabled="!form.productCategory"> <el-option v-for="item in productModelList" :key="item.id" :label="item.model" :value="item.id" /> </el-select> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="åä½ï¼" prop="customerId"> <el-input disabled v-model="form.unit" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åºåæ¶é´ï¼" prop="projectName"> <el-date-picker style="width: 100%" v-model="form.updateTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å ¥åºæ¶é´ï¼" prop="projectName"> <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="å«ç¨åä»·ï¼" prop="customerId"> <el-input disabled v-model="form.taxInclusiveUnitPrice" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="å«ç¨æ»ä»·ï¼" prop="customerContractNo"> <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="ç¨çï¼" prop="customerId"> <el-input disabled v-model="form.taxRate" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="ä¸å«ç¨æ»ä»·ï¼" prop="entryDate"> <el-input disabled v-model="form.taxExclusiveTotalPrice" placeholder="请è¾å ¥" clearable /> </el-form-item> </el-col> </el-row> <!-- <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="åºåºäººï¼" prop="entryPerson"> <el-select v-model="form.createUser" filterable default-first-option :reserve-keyword="false" placeholder="è¯·éæ©" clearable> <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> </el-select> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="åºåé¢è¦æ°éï¼" prop="warnNum"> <el-input v-model="form.warnNum" placeholder="请è¾å ¥æä½åºå" clearable /> </el-form-item> </el-col> </el-row> --> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm">确认</el-button> <el-button @click="closeDia">åæ¶</el-button> </div> </template> </el-dialog> <!-- æååºåå¼¹æ¡ --> <FormDiaProduction v-model:dialogFormVisible="productionDialogVisible" :operationType="operationType" :formData="form" @submit="submitForm" @close="closeDia" /> <!-- åæåºåå¼¹æ¡ --> <FormDiaPurchase v-model:dialogFormVisible="purchaseDialogVisible" :operationType="operationType" :formData="form" @submit="submitForm" @close="closeDia" /> <!-- ææåºåå¼¹æ¡ --> <FormDiaManual v-model:dialogFormVisible="manualDialogVisible" :operationType="operationType" :formData="form" @submit="submitForm" @close="closeDia" /> </div> </template> @@ -301,10 +221,13 @@ delStockManage, } from "@/api/inventoryManagement/stockManage.js"; import { updateManagement,updateStockIn updateManagement, updateManagementByCustom, updateStockIn } from "@/api/inventoryManagement/stockIn.js"; // å¯¼å ¥ä¸ä¸ªç¬ç«çå¼¹æ¡ç»ä»¶ import FormDiaProduction from './components/FormDiaProduction.vue' import FormDiaPurchase from './components/FormDiaPurchase.vue' import FormDiaManual from './components/FormDiaManual.vue' const userStore = useUserStore() const { proxy } = getCurrentInstance() @@ -325,8 +248,13 @@ const loading = ref(false); // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® const operationType = ref('') const dialogFormVisible = ref(false) const activeTab = ref('production') // ä¸ä¸ªç¬ç«çå¼¹æ¡æ¾ç¤ºç¶æ const productionDialogVisible = ref(false) const purchaseDialogVisible = ref(false) const manualDialogVisible = ref(false) const data = reactive({ searchForm: { // supplierName: '', @@ -345,6 +273,7 @@ model: '', unit: '', productrecordId: null, unitPrice: '', // æ·»å æååºåçåä»·åæ®µ taxInclusiveUnitPrice: '', taxInclusiveTotalPrice: '', taxRate: '', @@ -362,6 +291,7 @@ specificationModel: [{ required: true, message: '请è¾å ¥è§æ ¼åå·', trigger: 'blur' }], unit: [{ required: true, message: '请è¾å ¥åä½', trigger: 'blur' }], stockQuantity: [{ required: true, message: '请è¾å ¥åºåºæ°é', trigger: 'blur' }], unitPrice: [{ required: true, message: '请è¾å ¥åä»·', trigger: 'blur' }], // æ·»å æååºååä»·çéªè¯è§å taxInclusiveUnitPrice: [{ required: true, message: '请è¾å ¥å«ç¨åä»·', trigger: 'blur' }], taxInclusiveTotalPrice: [{ required: true, message: '请è¾å ¥å«ç¨æ»ä»·', trigger: 'blur' }], taxRate: [{ required: true, message: '请è¾å ¥ç¨ç', trigger: 'blur' }], @@ -413,6 +343,32 @@ apiCall.then(res => { tableLoading.value = false tableData.value = res.data.records // ä¸ºè¡¨æ ¼æ°æ®èªå¨è®¡ç®æ»ä»· tableData.value = tableData.value.map(item => { // 计ç®å©ä½åºå const stockQuantity = parseFloat(item.inboundNum) || 0 const outboundQuantity = parseFloat(item.totalInboundNum) || 0 const remainingStock = Math.max(stockQuantity - outboundQuantity, 0) // æ ¹æ®æ ç¾é¡µç±»åè®¡ç®æ»ä»· if (activeTab.value === 'production') { // æååºåï¼æ»ä»· = åä»· à å©ä½åºå const unitPrice = parseFloat(item.unitPrice) || 0 item.totalPrice = (unitPrice * remainingStock).toFixed(2) } else if (activeTab.value === 'purchase') { // åæåºåï¼å«ç¨æ»ä»· = å«ç¨åä»· à å©ä½åºå const taxInclusiveUnitPrice = parseFloat(item.taxInclusiveUnitPrice) || 0 item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * remainingStock).toFixed(2) } else if (activeTab.value === 'manual') { // ææåºåï¼å«ç¨æ»ä»· = å«ç¨åä»· à å©ä½åºå const taxInclusiveUnitPrice = parseFloat(item.taxInclusiveUnitPrice) || 0 item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * remainingStock).toFixed(2) } return item }) total.value = res.data.total // æ°æ®å è½½å®æåæ£æ¥åºå // checkStockAndCreatePurchase(); @@ -477,23 +433,63 @@ }) } form.value.entryDate = getCurrentDate() // 设置é»è®¤å½å ¥æ¥æä¸ºå½åæ¥æ dialogFormVisible.value = true // æ ¹æ®å½åæ ç¾é¡µæ¾ç¤ºå¯¹åºçå¼¹æ¡ if (activeTab.value === 'production') { productionDialogVisible.value = true } else if (activeTab.value === 'purchase') { purchaseDialogVisible.value = true } else if (activeTab.value === 'manual') { manualDialogVisible.value = true } } // æäº¤è¡¨å const submitForm = () => { console.log(form.value) proxy.$refs["formRef"].validate(valid => { if (valid) { updateManagement(form.value).then(res => { proxy.$modal.msgSuccess("æäº¤æå") closeDia() getList() // æäº¤åæ£æ¥åºåå¹¶å°è¯å建请è´å // checkStockAndCreatePurchase(); }) } const submitForm = (submittedData) => { console.log('åç»ä»¶æäº¤çæ°æ®:', submittedData) // 使ç¨åç»ä»¶æäº¤çæ°æ®ï¼è䏿¯ç¶ç»ä»¶çform对象 const submitData = { ...submittedData } // æ ¹æ®å½åæ ç¾é¡µç§»é¤å¯¹åºçæ»ä»·å段 if (activeTab.value === 'production') { // æååºåï¼ç§»é¤æ»ä»·å段 delete submitData.totalPrice } else if (activeTab.value === 'purchase') { // åæåºåï¼ç§»é¤å«ç¨æ»ä»·å段 delete submitData.taxInclusiveTotalPrice } else if (activeTab.value === 'manual') { // ææåºåï¼ç§»é¤å«ç¨æ»ä»·å段 delete submitData.taxInclusiveTotalPrice } // ç§»é¤å ¶ä»å¯è½çæ»ä»·å段 delete submitData.taxExclusiveTotalPrice console.log('æäº¤ç»åç«¯çæ°æ®ï¼å·²ç§»é¤æ»ä»·å段ï¼:', submitData) // æ ¹æ®å½åæ ç¾é¡µè°ç¨ä¸åçæäº¤æ¥å£ let apiCall if (activeTab.value === 'production') { // æååºåä½¿ç¨ updateManagement æ¥å£ apiCall = updateManagement(submitData) } else if (activeTab.value === 'manual') { // ææåºåä½¿ç¨ updateManagementByCustom æ¥å£ apiCall = updateManagementByCustom(submitData) } else { // åæåºåä½¿ç¨ updateManagementByCustom æ¥å£ apiCall = updateManagementByCustom(submitData) } apiCall.then(res => { proxy.$modal.msgSuccess("æäº¤æå") closeDia() getList() // æäº¤åæ£æ¥åºåå¹¶å°è¯å建请è´å // checkStockAndCreatePurchase(); }).catch(error => { console.error('æäº¤å¤±è´¥:', error) proxy.$modal.msgError("æäº¤å¤±è´¥ï¼è¯·éè¯") }) } // æ£æ¥åºåå¹¶å建请è´å @@ -521,7 +517,9 @@ // å ³éå¼¹æ¡ const closeDia = () => { proxy.resetForm("formRef") dialogFormVisible.value = false productionDialogVisible.value = false purchaseDialogVisible.value = false manualDialogVisible.value = false } // å¯¼åº @@ -602,4 +600,4 @@ :deep(.row-low-stock:hover > td) { background-color: #fcd4d4; } </style> </style> src/views/productionManagement/productionDispatching/components/autoDispatchDia.vue
@@ -18,7 +18,7 @@ <el-table-column label="åºå·" type="index" width="60" align="center" /> <el-table-column label="ååå·" prop="salesContractNo" width="200" /> <el-table-column label="客æ·åç§°" prop="customerName" width="200" /> <el-table-column label="项ç®åç§°" prop="projectName" width="250" /> <!-- <el-table-column label="项ç®åç§°" prop="projectName" width="250" /> --> <el-table-column label="产å大类" prop="productCategory" width="150" /> <el-table-column label="è§æ ¼åå·" prop="specificationModel" width="200" /> <el-table-column label="ç»å®æºå¨" prop="speculativeTradingName" width="120" /> src/views/productionManagement/productionDispatching/components/formDia.vue
@@ -7,7 +7,7 @@ @close="closeDia" > <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <el-row :gutter="30"> <!-- <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="项ç®åç§°ï¼" prop="projectName"> <el-input v-model="form.projectName" placeholder="请è¾å ¥" clearable disabled/> @@ -18,7 +18,7 @@ <el-input v-model="form.productCategory" placeholder="请è¾å ¥" clearable disabled/> </el-form-item> </el-col> </el-row> </el-row> --> <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="è§æ ¼åå·ï¼" prop="specificationModel"> @@ -58,6 +58,11 @@ /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="产å大类ï¼" prop="productCategory"> <el-input v-model="form.productCategory" placeholder="请è¾å ¥" clearable disabled/> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> src/views/salesManagement/receiptPayment/index.vue
@@ -150,12 +150,12 @@ </el-tag> </template> </el-table-column> <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip width="100" /> <!-- <el-table-column--> <!-- label="产å大类"--> <!-- prop="productCategory"--> <!-- show-overflow-tooltip--> <!-- width="100"--> <!-- />--> <el-table-column label="å票å·" prop="invoiceNo"