From c56e5d01939c67e3e7abdc0ff9d369719cd26f25 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 17 四月 2026 15:38:23 +0800
Subject: [PATCH] 进销存升级 1.客户档案分为公海和私海 2.销售所有模块查询客户数据接口更改

---
 src/views/salesManagement/salesLedger/index.vue |   92 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 75 insertions(+), 17 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 16fde49..1f6f315 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>
@@ -677,6 +674,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 +715,7 @@
 		maintenanceTime: "",
 		productData: [],
 		executionDate: "",
+    hasProductionRecord: false,
 	},
 	rules: {
 		salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -925,7 +924,48 @@
 	});
 };
 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 sensitiveAmountFormatter = (row, column, cellValue) => {
+	if (!isCurrentUserMaintainer(row)) {
+		return "*****";
+	}
+	return formattedNumber(row, column, cellValue);
 };
 // 鑾峰彇tree瀛愭暟鎹�
 const getModels = (value) => {
@@ -1040,7 +1080,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 +1101,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 +1148,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 +1294,7 @@
 			addOrUpdateSalesLedger(form.value).then((res) => {
 				proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
 				closeDia();
+				expandedRowKeys.value = [];
 				getList();
 			});
 		}

--
Gitblit v1.9.3