From 0c4bdf3dca76f9b8c348f2f7e48f9a6319dee4e1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 17 四月 2026 17:09:22 +0800
Subject: [PATCH] 进销存升级 1.销售台账不能删除和编辑别人维护的数据 2.产品维护固定产品大类为:成品、半成品、原材料。

---
 src/views/basicData/product/index.vue                        |   17 +++++++++++++++++
 src/views/salesManagement/returnOrder/components/formDia.vue |   19 +++++++++----------
 src/store/modules/permission.js                              |   13 +++++++++----
 src/views/salesManagement/salesLedger/index.vue              |    6 ++++++
 4 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index 6a16d9d..911a0f4 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -1,5 +1,5 @@
 import auth from '@/plugins/auth'
-import router, { constantRoutes, dynamicRoutes } from '@/router'
+import router, { constantRoutes, dynamicRoutes, financialRoutes } from '@/router'
 import { getRouters } from '@/api/menu'
 import Layout from '@/layout/index'
 import ParentView from '@/components/ParentView'
@@ -45,9 +45,14 @@
             const asyncRoutes = filterDynamicRoutes(dynamicRoutes)
             asyncRoutes.forEach(route => { router.addRoute(route) })
             this.setRoutes(rewriteRoutes)
-            this.setSidebarRouters(constantRoutes.concat(sidebarRoutes))
-            this.setDefaultRoutes(sidebarRoutes)
-            this.setTopbarRoutes(defaultRoutes)
+            // 灏嗚储鍔$鐞嗚矾鐢卞悎骞跺埌渚ц竟鏍�
+            this.setSidebarRouters(constantRoutes.concat(sidebarRoutes).concat(financialRoutes))
+            this.setDefaultRoutes(sidebarRoutes.concat(financialRoutes))
+            this.setTopbarRoutes(defaultRoutes.concat(financialRoutes))
+            // 娣诲姞璐㈠姟绠$悊妯″潡璺敱
+            financialRoutes.forEach(route => {
+              router.addRoute(route)
+            })
             resolve(rewriteRoutes)
           })
         })
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index 3b86b37..10b51bf 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -12,6 +12,7 @@
           prefix-icon="Search"
         />
         <el-button
+          v-if="false"
           type="primary"
           @click="openProDia('addOne')"
           style="margin-left: 10px"
@@ -49,6 +50,7 @@
                 <el-button
                   type="primary"
                   link
+                  :disabled="isTopLevelNode(data, node)"
                   @click="openProDia('edit', data)"
                 >
                   缂栬緫
@@ -61,6 +63,7 @@
                   style="margin-left: 4px"
                   type="danger"
                   link
+                  :disabled="isTopLevelNode(data, node)"
                   @click="remove(node, data)"
                 >
                   鍒犻櫎
@@ -375,8 +378,18 @@
 const searchFilter = () => {
   proxy.$refs.tree.filter(search.value);
 };
+const isTopLevelNode = (data, node) => {
+  if (node?.level !== undefined) {
+    return node.level === 1;
+  }
+  return [null, undefined, "", 0, "0"].includes(data?.parentId);
+};
 // 鎵撳紑浜у搧寮规
 const openProDia = (type, data) => {
+  if (data && type === "edit" && isTopLevelNode(data)) {
+    proxy.$modal.msgWarning("涓�绾ц妭鐐逛笉鑳界紪杈戞垨鍒犻櫎");
+    return;
+  }
   operationType.value = type;
   productDia.value = true;
   form.value.productName = "";
@@ -425,6 +438,10 @@
 
 // 鍒犻櫎浜у搧
 const remove = (node, data) => {
+  if (isTopLevelNode(data, node)) {
+    proxy.$modal.msgWarning("涓�绾ц妭鐐逛笉鑳界紪杈戞垨鍒犻櫎");
+    return;
+  }
   let ids = [];
   ids.push(data.id);
   ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
diff --git a/src/views/salesManagement/returnOrder/components/formDia.vue b/src/views/salesManagement/returnOrder/components/formDia.vue
index 9f1bb9a..27bbb0d 100644
--- a/src/views/salesManagement/returnOrder/components/formDia.vue
+++ b/src/views/salesManagement/returnOrder/components/formDia.vue
@@ -168,10 +168,10 @@
 <script setup>
 import { reactive, ref, toRefs, getCurrentInstance } from "vue";
 import { returnManagementAdd, returnManagementUpdate, returnManagementGetByShippingId, getSalesLedger, returnManagementGetById } from "@/api/salesManagement/returnOrder.js";
-import { getAllCustomerList } from "@/api/customerService/index.js";
 import useUserStore from "@/store/modules/user.js";
 import { userListNoPageByTenantId } from "@/api/system/user.js";
 import { listProject } from "@/api/oaSystem/projectManagement.js";
+import {listCustomerPrivatePool} from "@/api/basicData/customerFile.js";
 
 const { proxy } = getCurrentInstance();
 const emit = defineEmits(['close'])
@@ -354,15 +354,14 @@
 };
 
 const initCustomers = async () => {
-  const res = await getAllCustomerList({});
-  if (res?.records) {
-    customerNameOptions.value = res.records.map(item => ({
-      label: item.customerName,
-      value: item.customerName, // Keep value as name if needed for other logic, but request says customerId
-      id: item.id,
-      code: item.customerCode
-    }));
-  }
+	listCustomerPrivatePool({current: -1,size:-1}).then((res) => {
+		customerNameOptions.value = res.data.records.map(item => ({
+			label: item.customerName,
+			value: item.customerName, // Keep value as name if needed for other logic, but request says customerId
+			id: item.id,
+			code: item.customerCode
+		}));
+	});
 };
 
 const initUsers = async () => {
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 1f6f315..7c9ebf8 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -961,6 +961,7 @@
 	return true;
 };
 const canEditLedger = (row) => isCurrentUserMaintainer(row);
+const canDeleteLedger = (row) => isCurrentUserMaintainer(row);
 const sensitiveAmountFormatter = (row, column, cellValue) => {
 	if (!isCurrentUserMaintainer(row)) {
 		return "*****";
@@ -1489,6 +1490,11 @@
 		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);
 
 	// 妫�鏌ユ槸鍚︽湁宸茶繘琛屽彂璐ф垨鍙戣揣瀹屾垚鐨勯攢鍞鍗曪紝鑻ユ湁鍒欎笉鍏佽鍒犻櫎

--
Gitblit v1.9.3