From 550525734289a34a85b35de09ed41d0c5eabeed2 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 25 三月 2026 13:23:47 +0800
Subject: [PATCH] fix: 新增销售台账需要发起审批
---
src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue | 90 +++++++++++++++++
src/views/procurementManagement/procurementLedger/index.vue | 25 +++++
src/api/salesManagement/salesLedger.js | 9 +
src/views/salesManagement/salesLedger/index.vue | 127 +++++++++++++++++++++++++
4 files changed, 250 insertions(+), 1 deletions(-)
diff --git a/src/api/salesManagement/salesLedger.js b/src/api/salesManagement/salesLedger.js
index 6548927..4b74259 100644
--- a/src/api/salesManagement/salesLedger.js
+++ b/src/api/salesManagement/salesLedger.js
@@ -116,4 +116,13 @@
method: "get",
params: query,
});
+}
+
+// 鏍规嵁閿�鍞悎鍚屽彿鏌ヨ閿�鍞鎯�
+export function getSalesByCode(query) {
+ return request({
+ url: "/sales/ledger/getSalesByCode",
+ method: "get",
+ params: query,
+ });
}
\ No newline at end of file
diff --git a/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue b/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
index 7d34424..f0c43ae 100644
--- a/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
+++ b/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
@@ -49,7 +49,7 @@
</el-form-item>
</el-col>
</el-row>
- <el-row v-if="!isPurchaseApproval">
+ <el-row v-if="!isPurchaseApproval && !isSalesApproval">
<el-col :span="24">
<el-form-item label="瀹℃壒浜嬬敱锛�" prop="approveReason">
<el-input v-model="form.approveReason" placeholder="璇疯緭鍏�" clearable type="textarea" disabled/>
@@ -119,6 +119,53 @@
<div style="margin-top: 20px;">
<h4>浜у搧鏄庣粏</h4>
<el-table :data="purchaseProducts" border style="width: 100%">
+ <el-table-column prop="productCategory" label="浜у搧鍚嶇О" />
+ <el-table-column prop="specificationModel" label="瑙勬牸鍨嬪彿" />
+ <el-table-column prop="unit" label="鍗曚綅" />
+ <el-table-column prop="quantity" label="鏁伴噺" />
+ <el-table-column prop="taxInclusiveUnitPrice" label="鍚◣鍗曚环">
+ <template #default="scope">楼{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ <el-table-column prop="taxInclusiveTotalPrice" label="鍚◣鎬讳环">
+ <template #default="scope">楼{{ Number(scope.row.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </template>
+ </template>
+ </el-skeleton>
+ </div>
+ <div v-if="isSalesApproval" style="margin: 10px 0 18px;">
+ <el-divider content-position="left">閿�鍞鎯�</el-divider>
+ <el-skeleton :loading="salesLoading" animated>
+ <template #template>
+ <el-skeleton-item variant="h3" style="width: 30%" />
+ <el-skeleton-item variant="text" style="width: 100%" />
+ <el-skeleton-item variant="text" style="width: 100%" />
+ </template>
+ <template #default>
+ <el-empty v-if="!salesDetail || !salesDetail.salesContractNo" description="鏈煡璇㈠埌瀵瑰簲閿�鍞鎯�" />
+ <template v-else>
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="閿�鍞悎鍚屽彿">{{ salesDetail.salesContractNo }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚堝悓鍙�">{{ salesDetail.customerContractNo }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ salesDetail.customerName }}</el-descriptions-item>
+ <el-descriptions-item label="涓氬姟鍛�">{{ salesDetail.salesman }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鍚嶇О">{{ salesDetail.projectName }}</el-descriptions-item>
+ <el-descriptions-item label="浠樻鏂瑰紡">{{ salesDetail.paymentMethod }}</el-descriptions-item>
+ <el-descriptions-item label="褰曞叆浜�">{{ salesEntryPersonDisplay }}</el-descriptions-item>
+ <el-descriptions-item label="褰曞叆鏃ユ湡">{{ salesDetail.entryDate }}</el-descriptions-item>
+ <el-descriptions-item label="绛捐鏃ユ湡">{{ salesDetail.executionDate }}</el-descriptions-item>
+ <el-descriptions-item label="鍚堝悓閲戦" :span="2">
+ <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
+ 楼{{ Number(salesDetail.contractAmount ?? 0).toFixed(2) }}
+ </span>
+ </el-descriptions-item>
+ </el-descriptions>
+
+ <div style="margin-top: 20px;">
+ <h4>浜у搧鏄庣粏</h4>
+ <el-table :data="salesProducts" border style="width: 100%">
<el-table-column prop="productCategory" label="浜у搧鍚嶇О" />
<el-table-column prop="specificationModel" label="瑙勬牸鍨嬪彿" />
<el-table-column prop="unit" label="鍗曚綅" />
@@ -216,6 +263,7 @@
updateApproveNode
} from "@/api/collaborativeApproval/approvalProcess.js";
import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js";
+import { getSalesByCode } from "@/api/salesManagement/salesLedger.js";
import useUserStore from "@/store/modules/user.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import { WarningFilled, Edit, Check, MoreFilled } from '@element-plus/icons-vue'
@@ -233,10 +281,34 @@
const purchaseLoading = ref(false)
const currentPurchase = ref({})
const isPurchaseApproval = computed(() => Number(props.approveType) === 5)
+const salesLoading = ref(false)
+const currentSales = ref({})
+const isSalesApproval = computed(() => Number(props.approveType) === 6)
const purchaseDetail = computed(() => currentPurchase.value?.data || currentPurchase.value || {})
const purchaseProducts = computed(() => {
const detail = purchaseDetail.value || {}
return detail.productData || detail.products || detail.children || []
+})
+const salesDetail = computed(() => currentSales.value?.data || currentSales.value || {})
+const salesProducts = computed(() => {
+ const detail = salesDetail.value || {}
+ return detail.productData || detail.products || detail.children || []
+})
+/** 閿�鍞鎯咃細褰曞叆浜猴紙鎺ュ彛鍙兘鍙繑 entryPerson 鐢ㄦ埛ID锛岄渶鐢� userList 鍙嶆煡鏄电О锛� */
+const salesEntryPersonDisplay = computed(() => {
+ const d = salesDetail.value || {}
+ if (d.entryPersonName) return d.entryPersonName
+ if (d.recorderName) return d.recorderName
+ if (d.createByName) return d.createByName
+ if (d.createUserName) return d.createUserName
+ const id = d.entryPerson
+ if (id != null && id !== "" && userList.value?.length) {
+ const u = userList.value.find(
+ (x) => x.userId == id || String(x.userId) === String(id)
+ )
+ if (u) return u.nickName
+ }
+ return id != null && id !== "" ? String(id) : "-"
})
const data = reactive({
form: {
@@ -297,6 +369,7 @@
operationType.value = type;
dialogFormVisible.value = true;
currentPurchase.value = {}
+ currentSales.value = {}
userListNoPageByTenantId().then((res) => {
userList.value = res.data;
});
@@ -313,6 +386,19 @@
proxy.$modal.msgError("鏌ヨ閲囪喘璇︽儏澶辫触")
}).finally(() => {
purchaseLoading.value = false
+ })
+ }
+ }
+ if (isSalesApproval.value) {
+ const salesContractNo = row?.approveReason
+ if (salesContractNo) {
+ salesLoading.value = true
+ getSalesByCode({ salesContractNo }).then((res) => {
+ currentSales.value = res || {}
+ }).catch(() => {
+ proxy.$modal.msgError("鏌ヨ閿�鍞鎯呭け璐�")
+ }).finally(() => {
+ salesLoading.value = false
})
}
}
@@ -424,6 +510,8 @@
dialogFormVisible.value = false;
purchaseLoading.value = false
currentPurchase.value = {}
+ salesLoading.value = false
+ currentSales.value = {}
emit('close')
};
defineExpose({
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index bb53a6b..7e8c39d 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -118,6 +118,31 @@
width="420"
show-overflow-tooltip
/>
+ <el-table-column label="瀹℃壒鐘舵��" width="140">
+ <template #default="scope">
+ <el-tag
+ v-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 0"
+ type="warning"
+ >寰呭鏍�</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 1"
+ type="primary"
+ >瀹℃牳涓�</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 2"
+ type="success"
+ >瀹℃牳瀹屾垚</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 3"
+ type="danger"
+ >瀹℃牳鏈�氳繃</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 4"
+ type="info"
+ >宸查噸鏂版彁浜�</el-tag>
+ <el-tag v-else type="info">-</el-tag>
+ </template>
+ </el-table-column>
<el-table-column
label="浠樻鏂瑰紡"
width="100"
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index d4fbe20..f57ce0f 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -70,6 +70,40 @@
<el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" width="300" show-overflow-tooltip />
<el-table-column label="涓氬姟鍛�" prop="salesman" width="100" show-overflow-tooltip />
<el-table-column label="椤圭洰鍚嶇О" prop="projectName" width="180" show-overflow-tooltip />
+ <el-table-column label="瀹℃牳鐘舵��" width="140">
+ <template #default="scope">
+ <template v-if="scope.row.salesType !== '绱ф��'">
+ <el-tag
+ v-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 0"
+ type="warning"
+ >寰呭鏍�</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 1"
+ type="primary"
+ >瀹℃牳涓�</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 2"
+ type="success"
+ >瀹℃牳瀹屾垚</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 3"
+ type="danger"
+ >瀹℃牳鏈�氳繃</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 4"
+ type="info"
+ >宸查噸鏂版彁浜�</el-tag>
+ <el-tag v-else type="info">-</el-tag>
+ </template>
+ </template>
+ </el-table-column>
+ <el-table-column label="閿�鍞被鍨�" width="120">
+ <template #default="scope">
+ <el-tag
+ :type="scope.row.salesType === '绱ф��' ? 'danger' : 'info'"
+ >{{ scope.row.salesType || '-' }}</el-tag>
+ </template>
+ </el-table-column>
<el-table-column label="浠樻鏂瑰紡" prop="paymentMethod" show-overflow-tooltip />
<el-table-column label="鍚堝悓閲戦(鍏�)" prop="contractAmount" width="220" show-overflow-tooltip
:formatter="formattedNumber" />
@@ -156,6 +190,62 @@
<el-col :span="12">
<el-form-item label="浠樻鏂瑰紡">
<el-input v-model="form.paymentMethod" placeholder="璇疯緭鍏�" clearable :disabled="operationType === 'view'" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="閿�鍞被鍨嬶細" prop="salesType">
+ <el-select
+ v-model="form.salesType"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ style="width: 100%"
+ >
+ <el-option label="鏅��" value="鏅��" />
+ <el-option label="绱ф��" value="绱ф��" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item v-if="operationType !== 'view'">
+ <template #label>
+ <span>瀹℃壒浜洪�夋嫨锛�</span>
+ <el-button type="primary" @click="addApproverNode" style="margin-left: 8px;">鏂板鑺傜偣</el-button>
+ </template>
+ <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
+ <div
+ v-for="(node, index) in approverNodes"
+ :key="node.id"
+ style="margin-right: 30px; text-align: center; margin-bottom: 10px;"
+ >
+ <div>
+ <span>瀹℃壒浜�</span>
+ 鈫�
+ </div>
+ <el-select
+ v-model="node.userId"
+ placeholder="閫夋嫨浜哄憳"
+ style="width: 140px; margin-bottom: 8px;"
+ >
+ <el-option
+ v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId"
+ />
+ </el-select>
+ <div>
+ <el-button
+ type="danger"
+ size="small"
+ @click="removeApproverNode(index)"
+ v-if="approverNodes.length > 1"
+ >鍒犻櫎</el-button>
+ </div>
+ </div>
+ </div>
</el-form-item>
</el-col>
</el-row>
@@ -505,6 +595,8 @@
});
const total = ref(0);
const fileList = ref([]);
+const approverNodes = ref([{ id: 1, userId: null }]);
+let nextApproverId = 2;
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const operationType = ref("");
@@ -531,8 +623,10 @@
productData: [],
executionDate: "",
paymentMethod: "",
+ salesType: "鏅��",
},
rules: {
+ salesType: [{ required: true, message: "璇烽�夋嫨閿�鍞被鍨�", trigger: "change" }],
salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
customerContractNo: [
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
@@ -546,6 +640,12 @@
});
const { form, rules } = toRefs(data);
const { form: searchForm } = useFormData(data.searchForm);
+const addApproverNode = () => {
+ approverNodes.value.push({ id: nextApproverId++, userId: null });
+};
+const removeApproverNode = (index) => {
+ approverNodes.value.splice(index, 1);
+};
// 浜у搧琛ㄥ崟寮规鏁版嵁
const productFormVisible = ref(false);
const productOperationType = ref("");
@@ -759,6 +859,8 @@
operationType.value = type;
form.value = {};
productData.value = [];
+ approverNodes.value = [{ id: 1, userId: null }];
+ nextApproverId = 2;
let userLists = await userListNoPage();
userList.value = userLists.data;
customerList().then((res) => {
@@ -770,8 +872,22 @@
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
form.value = { ...res };
form.value.entryPerson = Number(res.entryPerson);
+ if (!form.value.salesType) {
+ form.value.salesType = "鏅��";
+ }
productData.value = form.value.productData;
fileList.value = form.value.salesLedgerFiles;
+ const approveUserIds = form.value.approveUserIds || form.value.approverIds;
+ if (approveUserIds) {
+ const ids = String(approveUserIds)
+ .split(",")
+ .map((id) => Number(id.trim()))
+ .filter((id) => !Number.isNaN(id));
+ if (ids.length > 0) {
+ approverNodes.value = ids.map((id, idx) => ({ id: idx + 1, userId: id }));
+ nextApproverId = ids.length + 1;
+ }
+ }
});
}
// let userAll = await userStore.getInfo()
@@ -781,6 +897,9 @@
// }
// });
form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
+ if (type === "add") {
+ form.value.salesType = "鏅��";
+ }
dialogFormVisible.value = true;
};
function changs(val) {
@@ -826,6 +945,14 @@
const submitForm = () => {
proxy.$refs["formRef"].validate((valid) => {
if (valid) {
+ if (operationType.value !== "view") {
+ const hasEmptyApprover = approverNodes.value.some((node) => !node.userId);
+ if (hasEmptyApprover) {
+ proxy.$modal.msgWarning("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜�");
+ return;
+ }
+ form.value.approveUserIds = approverNodes.value.map((node) => node.userId).join(",");
+ }
console.log('productData.value--', productData.value)
if (productData.value !== null && productData.value.length > 0) {
form.value.productData = proxy.HaveJson(productData.value);
--
Gitblit v1.9.3