From 731d07b73a4d311b62d72fe1b8b9d0c4acc2b25c Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 05 十二月 2025 16:42:11 +0800
Subject: [PATCH] 1.海川开心-附件模块无法删除,增加删除选项,附件存在突然多出文件的bug
---
src/views/procurementManagement/invoiceEntry/components/Modal.vue | 131 +++++++++++++++++++++++++++----------------
1 files changed, 83 insertions(+), 48 deletions(-)
diff --git a/src/views/procurementManagement/invoiceEntry/components/Modal.vue b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
index 41a0745..7a752f8 100644
--- a/src/views/procurementManagement/invoiceEntry/components/Modal.vue
+++ b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
@@ -33,16 +33,7 @@
/>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="椤圭洰鍚嶇О锛�" prop="projectName">
- <el-input
- v-model="form.projectName"
- placeholder="鑷姩濉厖"
- clearable
- disabled
- />
- </el-form-item>
- </el-col>
+
<el-col :span="12">
<el-form-item label="鍙戠エ鍙凤細" prop="invoiceNumber">
<el-input
@@ -54,10 +45,7 @@
</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
@@ -71,7 +59,6 @@
v-model="form.issUer"
placeholder="璇疯緭鍏�"
clearable
- disabled
/>
</el-form-item>
</el-col>
@@ -81,40 +68,57 @@
style="width: 100%"
v-model="form.entryDate"
type="date"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="涓婁紶闄勪欢">
- <FileUpload
- :showTip="false"
- accept="*"
- :autoUpload="true"
- :action="action"
- :headers="{
- Authorization: 'Bearer ' + getToken(),
- }"
- :limit="10"
- @success="uploadSuccess"
- @remove="removeFile"
+ <el-form-item label="褰曞叆鏃ユ湡锛�" prop="enterDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.enterDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
/>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="涓婁紶闄勪欢">
+ <FileUpload
+ :showTip="false"
+ accept="*"
+ :autoUpload="true"
+ :action="action"
+ :headers="{
+ Authorization: 'Bearer ' + getToken(),
+ }"
+ :limit="10"
+ @success="uploadSuccess"
+ @remove="removeFile"
+ />
+ </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"
+ :precision="2"
clearable
style="width: 100%"
@change="invoiceNumBlur(row)"
@@ -123,8 +127,9 @@
<template #ticketsAmountRef="{ row }">
<el-input-number
v-model="row.ticketsAmount"
- placeholder="璇烽�夋嫨"
+ placeholder="璇疯緭鍏�"
:min="0"
+ :precision="2"
:step="0.1"
clearable
style="width: 100%"
@@ -134,16 +139,17 @@
</PIMTable>
</el-form>
<template #footer>
+ <el-button type="primary" :loading="modalLoading" @click="submitForm">
+ {{ modalOptions.confirmText }}
+ </el-button>
<el-button @click="closeModal">{{ modalOptions.cancelText }}</el-button>
- <el-button type="primary" :loading="modalLoading" @click="submitForm">
- {{ modalOptions.confirmText }}
- </el-button>
</template>
</el-dialog>
</template>
<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 +161,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: "鏉ョエ鐧昏妯℃�佹",
@@ -168,13 +175,13 @@
purchaseLedgerNo: undefined, // 閲囪喘鍚堝悓鍙�
salesContractNo: undefined, // 閿�鍞悎鍚屽彿
supplierName: undefined, // 渚涘簲鍟嗗悕绉�
- projectName: undefined, // 椤圭洰鍚嶇О
invoiceNumber: undefined, // 鍙戠エ鍙�
invoiceAmount: undefined, // 鍙戠エ閲戦(鍏�)
issUerId: userStore.id, // 褰曞叆浜�
issUer: userStore.nickName, // 褰曞叆浜�
entryDate: undefined, // 寮�绁ㄦ棩鏈�
salesContractNoId: undefined, // 寮�绁ㄦ棩鏈�
+ enterDate: dayjs().format("YYYY-MM-DD"),
productData: [], // 琛ㄦ牸
tempFileIds: [], // 鏂囦欢
});
@@ -187,6 +194,8 @@
invoiceAmount: [
{ required: true, message: "璇疯緭鍏ュ彂绁ㄩ噾棰�", trigger: "blur" },
],
+ entryDate: [{ required: true, message: "璇烽�夋嫨寮�绁ㄦ棩鏈�", trigger: "change" }],
+ enterDate: [{ required: true, message: "璇烽�夋嫨褰曞叆鏃ユ湡", trigger: "change" }],
});
const {
@@ -201,14 +210,18 @@
title: "鏉ョエ鐧昏",
});
+const emit = defineEmits(['refreshList']);
+
const columns = [
{
label: "浜у搧澶х被",
prop: "productCategory",
+ width: 120,
},
{
label: "瑙勬牸鍨嬪彿",
prop: "specificationModel",
+ width: 120,
},
{
label: "鍗曚綅",
@@ -235,7 +248,7 @@
prop: "taxInclusiveUnitPrice",
width: 150,
formatData: (val) => {
- return parseFloat(val).toFixed(2) ?? 0;
+ return val ? parseFloat(val).toFixed(2) : 0;
},
},
{
@@ -273,10 +286,12 @@
{
label: "鏈潵绁ㄦ暟",
prop: "futureTickets",
+ width: 100,
},
{
label: "鏈潵绁ㄩ噾棰�(鍏�)",
prop: "futureTicketsAmount",
+ width: 200,
},
];
@@ -291,7 +306,6 @@
const { data: infoData } = await getInfo({ id });
form.salesContractNo = infoData.salesContractNo;
- form.projectName = infoData.projectName;
form.supplierName = infoData.supplierName;
form.productData = infoData.productData;
} else if (type == "edit") {
@@ -300,13 +314,24 @@
form.invoiceAmount = data.invoiceAmount;
form.invoiceNumber = data.invoiceNumber;
form.salesContractNo = data.salesContractNo;
- form.projectName = data.projectName;
form.supplierName = data.supplierName;
form.entryDate = data.entryDate;
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 +343,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 +366,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 +376,7 @@
let invoiceAmountTotal = 0;
form.productData.forEach((item) => {
if (item.ticketsAmount) {
- invoiceAmountTotal += item.ticketsAmount;
+ invoiceAmountTotal += Number(item.ticketsAmount);
}
});
form.invoiceAmount = invoiceAmountTotal.toFixed(2);
@@ -373,34 +398,44 @@
form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId);
};
+const closeAndRefresh = () => {
+ closeModal();
+ emit('refreshList');
+};
+
const submitForm = () => {
formRef.value.validate(async (valid, fields) => {
if (valid) {
- modalLoading.value = true;
+ // modalLoading.value = true;
const { code } = await addOrUpdateRegistration({
purchaseLedgerId: id.value,
purchaseContractNumber: form.purchaseLedgerNo,
invoiceNumber: form.invoiceNumber,
invoiceAmount: form.invoiceAmount,
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