| src/api/inventoryManagement/stockIn.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/dispatchLog/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/issueManagement/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/receiptManagement/components/formDia.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/receiptManagement/components/formDiaProduct.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/receiptManagement/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/stockManagement/components/FormDiaManual.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/inventoryManagement/stockManagement/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
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
@@ -442,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; }) @@ -994,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 />--> @@ -157,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
@@ -79,8 +79,7 @@ import { ref, reactive, toRefs, getCurrentInstance } from 'vue' import useUserStore from '@/store/modules/user' import { addStockInCustom, updateStockInCustom, addStockInCustom, updateProduct } from "@/api/inventoryManagement/stockIn.js"; const userStore = useUserStore() @@ -199,10 +198,6 @@ proxy.$modal.msgError(`第${i + 1}è¡äº§åæ°æ®æªå¡«å宿´ï¼äº§å大类ãè§æ ¼åå·ãåä½ä¸ºå¿ å¡«ï¼`) return } if (!product.itemType) { proxy.$modal.msgError(`第${i + 1}è¡è¯·éæ©ç©åç±»å`) return } if (!product.inboundDate) { proxy.$modal.msgError(`第${i + 1}è¡è¯·éæ©å ¥åºæ¥æ`) return @@ -226,12 +221,11 @@ taxRate: Number(product.taxRate || 0), taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0), unitPrice: Number(product.unitPrice || 0), totalPrice: Number(product.totalPrice || 0), })); loading.value = true if (operationType.value === 'edit') { const editPayload = payloadList[0] await updateStockInCustom(editPayload) await updateProduct(editPayload) } else { await addStockInCustom(payloadList) } @@ -294,7 +288,6 @@ inboundDate: row?.inboundDate ?? row?.createTime ?? '', taxRate: Number(row?.taxRate ?? 0), unitPrice: Number(row?.unitPrice ?? 0), totalPrice: Number(row?.totalPrice ?? 0), taxExclusiveTotalPrice: Number(row?.taxExclusiveTotalPrice ?? 0), }] } 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,7 +106,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="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 />–>--> @@ -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 />--> @@ -275,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 @@ -386,3 +409,5 @@ <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
@@ -43,9 +43,9 @@ <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 />--> @@ -102,18 +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="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="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="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> <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" :page="page.current" :limit="page.size" @pagination="paginationChange" /> @@ -163,9 +156,9 @@ <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="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="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 />--> @@ -184,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"> <!-- æååºåå¼¹æ¡ --> <FormDiaProduction v-model:dialogFormVisible="productionDialogVisible" :operationType="operationType" :formData="form" @submit="submitForm" @close="closeDia" /> <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> <!-- åæåºåå¼¹æ¡ --> <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> @@ -307,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() @@ -331,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: '', @@ -351,6 +273,7 @@ model: '', unit: '', productrecordId: null, unitPrice: '', // æ·»å æååºåçåä»·åæ®µ taxInclusiveUnitPrice: '', taxInclusiveTotalPrice: '', taxRate: '', @@ -368,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' }], @@ -419,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(); @@ -483,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) { const submitForm = (submittedData) => { console.log('åç»ä»¶æäº¤çæ°æ®:', submittedData) updateManagement(form.value).then(res => { // 使ç¨åç»ä»¶æäº¤çæ°æ®ï¼è䏿¯ç¶ç»ä»¶ç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("æäº¤å¤±è´¥ï¼è¯·éè¯") }) } // æ£æ¥åºåå¹¶å建请è´å @@ -527,7 +517,9 @@ // å ³éå¼¹æ¡ const closeDia = () => { proxy.resetForm("formRef") dialogFormVisible.value = false productionDialogVisible.value = false purchaseDialogVisible.value = false manualDialogVisible.value = false } // 导åº