From fb1f8c8bc14bf113645a9558218930bdd0109903 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 24 四月 2026 09:51:56 +0800
Subject: [PATCH] 进销存new 1.协同审批管理不再需要选择审批人 2.审批管理添加审批流联调 3.销售发货、采购台账、销售报价不再需要选择审批人

---
 src/views/salesManagement/salesLedger/index.vue |  163 +++++++++++++++++++++++++++---------------------------
 1 files changed, 82 insertions(+), 81 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 16fde49..6b2cfcf 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -42,7 +42,7 @@
         <el-table-column align="center" type="selection" width="55" fixed="left"/>
         <el-table-column type="expand" width="60" fixed="left">
           <template #default="props">
-            <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable">
+            <el-table :data="props.row.children" border show-summary :summary-method="(param) => summarizeChildrenTable(param, props.row)">
               <el-table-column align="center" label="搴忓彿" type="index"/>
               <el-table-column label="浜у搧澶х被" prop="productCategory" />
               <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
@@ -89,9 +89,9 @@
               </el-table-column>
               <el-table-column label="鏁伴噺" prop="quantity" />
               <el-table-column label="绋庣巼(%)" prop="taxRate" />
-              <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
-              <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
-              <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
+              <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="sensitiveAmountFormatter" />
+              <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="sensitiveAmountFormatter" />
+              <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="sensitiveAmountFormatter" />
             <!--鎿嶄綔-->
               <el-table-column Width="60px" label="鎿嶄綔" align="center">
                 <template #default="scope">
@@ -122,7 +122,7 @@
         <el-table-column label="澶囨敞" prop="remarks" width="200" show-overflow-tooltip />
         <el-table-column fixed="right" label="鎿嶄綔" width="130" align="center">
           <template #default="scope">
-            <el-button link type="primary" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit">缂栬緫</el-button>
+            <el-button link type="primary" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫</el-button>
             <el-button link type="primary" @click="downLoadFile(scope.row)">闄勪欢</el-button>
           </template>
         </el-table-column>
@@ -149,7 +149,7 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="涓氬姟鍛橈細" prop="salesman">
-              <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'">
+              <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'" filterable>
                 <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
                   :value="item.nickName" />
               </el-select>
@@ -159,7 +159,7 @@
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerId">
-              <el-select v-model="form.customerId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'">
+              <el-select v-model="form.customerId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'" filterable>
                 <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id">
                   {{
                     item.customerName + "鈥斺��" + item.taxpayerIdentificationNumber
@@ -343,11 +343,8 @@
 				<el-row :gutter="30">
 					<el-col :span="24">
 						<el-form-item label="浜у搧澶х被锛�" prop="productCategory">
-							<!-- <el-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable>
-								<el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
-							</el-select> -->
-							<el-tree-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable check-strictly
-															@change="getModels" :data="productOptions" :render-after-expand="false" style="width: 100%" />
+							<el-tree-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable filterable check-strictly
+							                @change="getModels" :data="productOptions" :render-after-expand="false" style="width: 100%" />
 						</el-form-item>
 					</el-col>
 				</el-row>
@@ -596,49 +593,7 @@
 					</el-col>
 				</el-row>
 
-        <!-- 瀹℃壒浜洪�夋嫨锛堜豢鍗忓悓瀹℃壒閲岀殑瀹℃壒浜鸿妭鐐归�夋嫨锛� -->
-        <el-row>
-          <el-col :span="24">
-            <el-form-item>
-              <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: 20px; text-align: center; margin-bottom: 10px;"
-                >
-                  <div>
-                    <span>瀹℃壒浜�</span>
-                    鈫�
-                  </div>
-                  <el-select
-                    v-model="node.userId"
-                    placeholder="閫夋嫨浜哄憳"
-                    filterable
-                    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"
-                      @click="removeApproverNode(index)"
-                      v-if="approverNodes.length > 1"
-                    >鍒犻櫎</el-button>
-                  </div>
-                </div>
-              </div>
-            </el-form-item>
-          </el-col>
-        </el-row>
+
 			</el-form>
 			<template #footer>
 				<div class="dialog-footer">
@@ -677,6 +632,7 @@
 import useFormData from "@/hooks/useFormData.js";
 import dayjs from "dayjs";
 import { getCurrentDate } from "@/utils/index.js";
+import {listCustomerPrivatePool} from "@/api/basicData/customerFile.js";
 
 const userStore = useUserStore();
 const { proxy } = getCurrentInstance();
@@ -717,6 +673,7 @@
 		maintenanceTime: "",
 		productData: [],
 		executionDate: "",
+    hasProductionRecord: false,
 	},
 	rules: {
 		salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -809,16 +766,6 @@
   },
 });
 const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
-
-// 鍙戣揣瀹℃壒浜鸿妭鐐癸紙浠垮崗鍚屽鎵� infoFormDia.vue锛�
-const approverNodes = ref([{ id: 1, userId: null }]);
-let nextApproverId = 2;
-const addApproverNode = () => {
-  approverNodes.value.push({ id: nextApproverId++, userId: null });
-};
-const removeApproverNode = (index) => {
-  approverNodes.value.splice(index, 1);
-};
 
 // 瀵煎叆鐩稿叧
 const importUploadRef = ref(null);
@@ -925,7 +872,49 @@
 	});
 };
 const formattedNumber = (row, column, cellValue) => {
+	if (cellValue === undefined || cellValue === null || cellValue === "") {
+		return "0.00";
+	}
 	return parseFloat(cellValue).toFixed(2);
+};
+const findLedgerRecordByRow = (row) => {
+	if (!row) return null;
+	if (
+		row.maintainer !== undefined ||
+		row.maintainerName !== undefined ||
+		row.entryPerson !== undefined ||
+		row.entryPersonName !== undefined
+	) {
+		return row;
+	}
+	if (row.salesLedgerId !== undefined && row.salesLedgerId !== null) {
+		return tableData.value.find((item) => String(item.id) === String(row.salesLedgerId)) || null;
+	}
+	return null;
+};
+const isCurrentUserMaintainer = (row) => {
+	const ledgerRecord = findLedgerRecordByRow(row);
+	if (!ledgerRecord) return true;
+	const currentUserId = String(userStore.id ?? "");
+	const currentNickName = String(userStore.nickName ?? "").trim();
+	const maintainerId = ledgerRecord.maintainerId ?? ledgerRecord.entryPerson;
+	const maintainerName =
+		ledgerRecord.maintainerName ?? ledgerRecord.maintainer ?? ledgerRecord.entryPersonName;
+	if (maintainerId !== undefined && maintainerId !== null && String(maintainerId) !== "") {
+		return String(maintainerId) === currentUserId;
+	}
+	if (maintainerName !== undefined && maintainerName !== null && String(maintainerName).trim() !== "") {
+		return String(maintainerName).trim() === currentNickName;
+	}
+	return true;
+};
+const canEditLedger = (row) => isCurrentUserMaintainer(row);
+const canDeleteLedger = (row) => isCurrentUserMaintainer(row);
+const sensitiveAmountFormatter = (row, column, cellValue) => {
+	if (!isCurrentUserMaintainer(row)) {
+		return "*****";
+	}
+	return formattedNumber(row, column, cellValue);
 };
 // 鑾峰彇tree瀛愭暟鎹�
 const getModels = (value) => {
@@ -1040,7 +1029,19 @@
 	]);
 };
 // 瀛愯〃鍚堣鏂规硶
-const summarizeChildrenTable = (param) => {
+const summarizeChildrenTable = (param, parentRow) => {
+	if (!isCurrentUserMaintainer(parentRow)) {
+		const { columns } = param;
+		return columns.map((column, index) => {
+			if (index === 0) {
+				return "鍚堣";
+			}
+			if (["taxInclusiveUnitPrice", "taxInclusiveTotalPrice", "taxExclusiveTotalPrice"].includes(column.property)) {
+				return "*****";
+			}
+			return "";
+		});
+	}
 	return proxy.summarizeTable(param, [
 		"taxInclusiveUnitPrice",
 		"taxInclusiveTotalPrice",
@@ -1049,14 +1050,18 @@
 };
 // 鎵撳紑寮规
 const openForm = async (type, row) => {
+	if (type === "edit" && row && !canEditLedger(row)) {
+		proxy.$modal.msgWarning("褰撳墠绯荤粺鐧诲綍浜轰笉鏄淮鎶や汉锛屼笉鑳界紪杈戞暟鎹�");
+		return;
+	}
 	operationType.value = type;
 	form.value = {};
 	productData.value = [];
 	selectedQuotation.value = null;
 	let userLists = await userListNoPage();
 	userList.value = userLists.data;
-	customerList().then((res) => {
-		customerOption.value = res;
+	listCustomerPrivatePool({current: -1,size:-1}).then((res) => {
+		customerOption.value = res.data.records;
 	});
 	form.value.entryPerson = userStore.id;
 	if (type === "add") {
@@ -1092,8 +1097,9 @@
 	// 鍏堢‘淇濆鎴峰垪琛ㄥ凡鍔犺浇锛屼究浜庡悗缁洖濉� customerId
 	if (!customerOption.value || customerOption.value.length === 0) {
 		try {
-			const res = await customerList();
-			customerOption.value = res;
+			listCustomerPrivatePool({current: -1,size:-1}).then((res) => {
+				customerOption.value = res.data.records;
+			});
 		} catch (e) {
 			// ignore锛屽厑璁哥敤鎴峰悗缁墜鍔ㄩ�夋嫨瀹㈡埛
 		}
@@ -1237,6 +1243,7 @@
 			addOrUpdateSalesLedger(form.value).then((res) => {
 				proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
 				closeDia();
+				expandedRowKeys.value = [];
 				getList();
 			});
 		}
@@ -1429,6 +1436,11 @@
 const handleDelete = async () => {
 	if (selectedRows.value.length === 0) {
 		proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+		return;
+	}
+	const unauthorizedRows = selectedRows.value.filter((row) => !canDeleteLedger(row));
+	if (unauthorizedRows.length > 0) {
+		proxy.$modal.msgWarning("褰撳墠鐧诲綍鐢ㄦ埛涓嶆槸褰曞叆浜猴紝涓嶈兘鍒犻櫎璇ユ暟鎹�");
 		return;
 	}
 	const ids = selectedRows.value.map((item) => item.id);
@@ -2114,9 +2126,6 @@
   deliveryForm.value = {
     type: "璐ц溅",
   };
-  // 閲嶇疆瀹℃壒浜鸿妭鐐癸紙榛樿涓�涓┖鑺傜偣锛�
-  approverNodes.value = [{ id: 1, userId: null }];
-  nextApproverId = 2;
 	deliveryFormVisible.value = true;
 };
 
@@ -2124,13 +2133,6 @@
 const submitDelivery = () => {
   proxy.$refs["deliveryFormRef"].validate((valid) => {
     if (valid) {
-      // 瀹℃壒浜哄繀濉牎楠岋紙鎵�鏈夎妭鐐归兘瑕侀�変汉锛�
-      const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
-      if (hasEmptyApprover) {
-        proxy.$modal.msgError("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜猴紒");
-        return;
-      }
-      const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
       // 淇濆瓨褰撳墠灞曞紑鐨勮ID锛屼互渚垮彂璐у悗閲嶆柊鍔犺浇瀛愯〃鏍兼暟鎹�
       const currentExpandedKeys = [...expandedRowKeys.value];
       const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
@@ -2138,7 +2140,6 @@
         salesLedgerId: salesLedgerId,
         salesLedgerProductId: currentDeliveryRow.value.id,
         type: deliveryForm.value.type,
-				approveUserIds,
       })
         .then(() => {
           proxy.$modal.msgSuccess("鍙戣揣鎴愬姛");

--
Gitblit v1.9.3