From b95f47dc46951561f36980ca4bae17a752eab8c4 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期六, 12 七月 2025 13:38:44 +0800 Subject: [PATCH] 1.采购管理-优化:不是本条数据录入人不可修改数据。表格展示优化、来票操作后,不能再次编辑。未进行开票、来票操作的台账可以进行编辑 --- src/views/procurementManagement/invoiceEntry/components/Modal.vue | 78 ++++++++++++++++++++++++++++++--------- 1 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/views/procurementManagement/invoiceEntry/components/Modal.vue b/src/views/procurementManagement/invoiceEntry/components/Modal.vue index 41a0745..f4f3045 100644 --- a/src/views/procurementManagement/invoiceEntry/components/Modal.vue +++ b/src/views/procurementManagement/invoiceEntry/components/Modal.vue @@ -54,14 +54,10 @@ </el-col> <el-col :span="12"> <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceAmount"> - <el-input - type="number" - :step="0.01" - :min="0" + <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.invoiceAmount" placeholder="鑷姩濉厖" clearable - :disabled="true" /> </el-form-item> </el-col> @@ -101,18 +97,30 @@ /> </el-form-item> </el-col> + <el-col :span="12"> + <el-form-item label="褰曞叆鏃ユ湡锛�" prop="enterDate"> + <el-date-picker + style="width: 100%" + v-model="form.enterDate" + type="date" + clearable + /> + </el-form-item> + </el-col> </el-row> - <el-form-item label="浜у搧淇℃伅锛�" prop="entryDate"> </el-form-item> + <el-form-item label="浜у搧淇℃伅锛�"> </el-form-item> <PIMTable rowKey="id" :column="columns" :tableData="form.productData" + :summaryMethod="summarizeChildrenTable" + :isShowSummary="true" height="auto" > <template #ticketsNumRef="{ row }"> <el-input-number v-model="row.ticketsNum" - placeholder="璇烽�夋嫨" + placeholder="璇疯緭鍏�" :min="0" :step="0.1" clearable @@ -123,7 +131,7 @@ <template #ticketsAmountRef="{ row }"> <el-input-number v-model="row.ticketsAmount" - placeholder="璇烽�夋嫨" + placeholder="璇疯緭鍏�" :min="0" :step="0.1" clearable @@ -144,6 +152,7 @@ <script setup> import { ref, getCurrentInstance } from "vue"; +import { defineEmits } from 'vue'; import { useModal } from "@/hooks/useModal"; import useFormData from "@/hooks/useFormData"; import FileUpload from "@/components/Upload/FileUpload.vue"; @@ -155,6 +164,7 @@ import { getPurchaseById } from "@/api/procurementManagement/procurementLedger.js"; import { getToken } from "@/utils/auth"; import useUserStore from "@/store/modules/user"; +import dayjs from "dayjs"; defineOptions({ name: "鏉ョエ鐧昏妯℃�佹", @@ -175,6 +185,7 @@ issUer: userStore.nickName, // 褰曞叆浜� entryDate: undefined, // 寮�绁ㄦ棩鏈� salesContractNoId: undefined, // 寮�绁ㄦ棩鏈� + enterDate: dayjs().format("YYYY-MM-DD"), productData: [], // 琛ㄦ牸 tempFileIds: [], // 鏂囦欢 }); @@ -187,6 +198,8 @@ invoiceAmount: [ { required: true, message: "璇疯緭鍏ュ彂绁ㄩ噾棰�", trigger: "blur" }, ], + entryDate: [{ required: true, message: "璇烽�夋嫨寮�绁ㄦ棩鏈�", trigger: "change" }], + enterDate: [{ required: true, message: "璇烽�夋嫨褰曞叆鏃ユ湡", trigger: "change" }], }); const { @@ -201,14 +214,18 @@ title: "鏉ョエ鐧昏", }); +const emit = defineEmits(['refreshList']); + const columns = [ { label: "浜у搧澶х被", prop: "productCategory", + width: 120, }, { label: "瑙勬牸鍨嬪彿", prop: "specificationModel", + width: 120, }, { label: "鍗曚綅", @@ -235,7 +252,7 @@ prop: "taxInclusiveUnitPrice", width: 150, formatData: (val) => { - return parseFloat(val).toFixed(2) ?? 0; + return val ? parseFloat(val).toFixed(2) : 0; }, }, { @@ -273,10 +290,12 @@ { label: "鏈潵绁ㄦ暟", prop: "futureTickets", + width: 100, }, { label: "鏈潵绁ㄩ噾棰�(鍏�)", prop: "futureTicketsAmount", + width: 200, }, ]; @@ -306,7 +325,19 @@ form.productData = data.productData; } }; - +// 瀛愯〃鍚堣鏂规硶 +const summarizeChildrenTable = (param) => { + return proxy.summarizeTable(param, [ + "taxInclusiveUnitPrice", + "taxInclusiveTotalPrice", + "taxExclusiveTotalPrice", + "ticketsNum", + "ticketsAmount", + "ticketsAmountRef", + "futureTickets", + "futureTicketsAmount", + ]); +}; //鏈鏉ョエ鏁板け鐒︽搷浣� const invoiceNumBlur = (row) => { if (!row.ticketsNum || row.ticketsNum === "") { @@ -318,11 +349,11 @@ return; } // 璁$畻鏈鏉ョエ閲戦 - row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice; + row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2) // 璁$畻鏈潵绁ㄦ暟 - row.futureTickets = row.tempFutureTickets - row.ticketsNum; + row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) // 璁$畻鏈潵绁ㄩ噾棰� - row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; + row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) calculateinvoiceAmount(); }; @@ -341,9 +372,9 @@ (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) ); // 璁$畻鏈潵绁ㄦ暟 - row.futureTickets = row.tempFutureTickets - row.ticketsNum; + row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) // 璁$畻鏈潵绁ㄩ噾棰� - row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; + row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) calculateinvoiceAmount(); }; @@ -351,7 +382,7 @@ let invoiceAmountTotal = 0; form.productData.forEach((item) => { if (item.ticketsAmount) { - invoiceAmountTotal += item.ticketsAmount; + invoiceAmountTotal += Number(item.ticketsAmount); } }); form.invoiceAmount = invoiceAmountTotal.toFixed(2); @@ -373,6 +404,11 @@ form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId); }; +const closeAndRefresh = () => { + closeModal(); + emit('refreshList'); +}; + const submitForm = () => { formRef.value.validate(async (valid, fields) => { if (valid) { @@ -385,22 +421,28 @@ salesContractNo: form.salesContractNo, projectName: form.projectName, productData: form.productData, - issUerId: form.issUerId, // 褰曞叆浜� + issueDate: form.entryDate, + issUerId: form.issUerId, // 褰曞叆浜篿d issUer: form.issUer, // 褰曞叆浜� salesContractNoId: form.salesContractNoId, supplierName: form.supplierName, tempFileIds: form.tempFileIds, + enterDate: form.enterDate, + type: 4, }); modalLoading.value = false; if (code == 200) { - closeModal(); + closeAndRefresh(); } + } else { + modalLoading.value = false; } }); }; defineExpose({ open, + closeAndRefresh, }); </script> -- Gitblit v1.9.3