From 311c2f13742aa71e7b16b76cd6f68175ee8a21a2 Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期一, 02 二月 2026 17:41:04 +0800
Subject: [PATCH] 修改

---
 ui/admin-ui3/src/views/cwgl/voucherSubjectFee/index.vue |   97 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 66 insertions(+), 31 deletions(-)

diff --git a/ui/admin-ui3/src/views/cwgl/voucherSubjectFee/index.vue b/ui/admin-ui3/src/views/cwgl/voucherSubjectFee/index.vue
index 6710319..a21d90c 100644
--- a/ui/admin-ui3/src/views/cwgl/voucherSubjectFee/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/voucherSubjectFee/index.vue
@@ -20,8 +20,8 @@
           v-hasPermi="['cwgl:voucherSubjectFee:export']">瀵煎嚭
         </el-button>
       </template>
-          <template #menu="{ row, index, size }">
-    
+      <template #menu="{ row, index, size }">
+
         <el-button type="text" icon="View" @click="handleFlow(row)"
           v-hasPermi="['cwgl:voucherSubjectFee:flow']">鏃ュ織</el-button>
       </template>
@@ -33,7 +33,7 @@
 
 <script setup name="voucherSubjectFee" lang="ts">
 import { listVoucherSubjectSetting } from "@/api/cwgl/voucherSubjectSetting";
-  import { listVoucherSubjectFeeLog, } from "@/api/cwgl/voucherSubjectFeeLog";
+import { listVoucherSubjectFeeLog, } from "@/api/cwgl/voucherSubjectFeeLog";
 
 import { VoucherSubjectFeeI, addVoucherSubjectFee, delVoucherSubjectFee, exportVoucherSubjectFee, getVoucherSubjectFee, listVoucherSubjectFee, updateVoucherSubjectFee } from "@/api/cwgl/voucherSubjectFee";
 import useCurrentInstance from "@/utils/useCurrentInstance";
@@ -69,7 +69,7 @@
 const option = ref({
   pageKey: 'VoucherSubjectFee',
   rowKey: 'id',
-    viewBtn: false,
+  viewBtn: false,
   column: {
     // id: {
     //   label: 'ID',
@@ -89,28 +89,29 @@
     },
     subjectName: {
       label: '绉戠洰鍚嶇О',
-      type: 'select', // 濡傛灉闇�瑕佹爲褰㈠彲浠ユ敼涓� 'tree'
+      type: 'tree',
       search: true,
       props: {
-        label: 'subjectName',
-        value: 'subjectName' // 寤鸿缁戝畾 ID 浣滀负 value
+        label: 'subjectName', // 涓嬫媺鏍戦噷渚濈劧鍙樉绀哄崟鍚嶏紙濡傦細宸梾璐癸級
+        value: 'subjectName'
       },
-      // 鍏抽敭锛氱洃鍚�変腑鍊肩殑鍙樺寲
-    change: ({ value, column, item }) => {
-  // 鍏抽敭锛氬彧鏈夋槑纭湁閫変腑鐨勫璞� item 鏃舵墠鎵ц璧嬪��
-  if (item && Object.keys(item).length > 0) {
-    form.value.subjectCode = item.subjectCode;
-    form.value.subjectType = item.subjectType;
-    form.value.feeName = item.expenseName;
-  } 
-  // 鍙湁褰撶敤鎴锋墜鍔ㄦ竻闄ら�夋嫨锛坴alue 涓虹┖锛夋椂锛屾墠娓呯┖鍏朵粬瀛楁
-  else if (!value) { 
-    form.value.subjectCode = '';
-    form.value.subjectType = '';
-    form.value.feeName = '';
-  }
-  // 濡傛灉鏄湁 value 浣嗘病 item锛堥�氬父鏄洖鏄剧灛闂达級锛屼粈涔堥兘涓嶅仛锛屼繚鎶ゅ凡鏈夋暟鎹�
-},
+      change: ({ value, column, item }) => {
+        if (item && Object.keys(item).length > 0) {
+          form.value.subjectCode = item.subjectCode;
+          form.value.subjectType = item.subjectType;
+          form.value.feeName = item.expenseName;
+
+          // 銆愪慨鏀圭偣銆戝湪閫変腑鏃讹紝鑾峰彇闅愯棌鐨� fullName锛堝甫 / 鐨勫叏璺緞锛�
+          // 濡傛灉娌℃湁 fullName锛堥《绾э級锛屽垯浣跨敤鍘熷鍚嶇О
+          form.value.fullPathName = item.fullName || item.subjectName;
+        }
+        else if (!value) {
+          form.value.subjectCode = '';
+          form.value.subjectType = '';
+          form.value.feeName = '';
+          form.value.fullPathName = '';
+        }
+      },
       rules: [{ required: true, message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "change" }],
     },
 
@@ -236,26 +237,60 @@
       selectionList.value = selection;
     },
     // --- 鍏抽敭淇敼锛氬鐞嗗脊绐楁墦寮�鍓嶇殑閫昏緫 ---
+    // --- 鏍稿績閫昏緫 1锛氫繚瀛樺墠鎷︽埅 ---
+    // 鍦� usePagePlus 鐨勯厤缃璞′腑
+    rowSaveBegin: (row, done) => {
+      // 鎻愪氦鏃讹紝灏� subjectName 鏇挎崲涓烘垜浠湪 change 鏃舵嬁鍒扮殑鍏ㄨ矾寰�
+      if (row.fullPathName) {
+        row.subjectName = row.fullPathName;
+      }
+      delete row.fullPathName; // 娓呯悊涓存椂鍙橀噺
+      done(row);
+    },
+
+    rowUpdateBegin: (row, done) => {
+      if (row.fullPathName) {
+        row.subjectName = row.fullPathName;
+      }
+      delete row.fullPathName;
+      done(row);
+    },
+
+    // --- 鏍稿績閫昏緫 3锛氭墦寮�寮圭獥鍓嶅姞杞藉苟澶勭悊瀛楀吀 ---
     handleBeforeOpenFunc: (type: string) => {
       if (type === 'add') {
         form.value.accountSet = activeAccountSet.value;
         form.value.type = activeAccountSet.value;
       }
+
       listVoucherSubjectSetting({ type: activeAccountSet.value }).then(res => {
         const subjectNameCol = option.value.column.subjectName;
         if (subjectNameCol) {
-          // 鍋囪鎺ュ彛杩斿洖鐨勬暟鎹湪 res.data 鎴� res.rows 涓�
-          const listData = res.rows  || [];
+          const listData = res.rows || [];
 
-          // 濡傛灉浣犻渶瑕佹爲褰㈠睍绀猴紝鍙互浣跨敤 handleTree 杞崲
-          subjectNameCol.type = 'tree'; 
-          subjectNameCol.dicData = proxy.handleTree(listData, "id");
+          // 閫掑綊鍑芥暟锛氳绠楀叏璺緞锛屼娇鐢� / 鍒嗛殧
+          const injectFullPath = (list: any[], parentPath = '') => {
+            return list.map(item => {
+              // 銆愭牳蹇冧慨鏀圭偣銆戝皢鎷兼帴绗︽敼涓� /
+              const currentPath = parentPath ? `${parentPath}/${item.subjectName}` : item.subjectName;
+              const newItem = {
+                ...item,
+                fullName: currentPath // 姝ゆ椂 fullName 鏍煎紡涓� "绠$悊璐圭敤/宸梾璐�"
+              };
+              if (newItem.children && newItem.children.length > 0) {
+                newItem.children = injectFullPath(newItem.children, currentPath);
+              }
+              return newItem;
+            });
+          };
 
-      
+          const treeData = proxy.handleTree(listData, "id");
+          subjectNameCol.dicData = injectFullPath(treeData);
         }
       });
-
     },
+
+    // ... 鍏朵粬閽╁瓙濡� handleUpdateFunc, getBeginListFunc 淇濇寔涓嶅彉 ...
   })
 const activeAccountSet = ref('0');
 
@@ -280,7 +315,7 @@
   // 绀轰緥妯℃嫙鏁版嵁
   listVoucherSubjectFeeLog({ subjectId: row.id }).then((res) => {
     if (res.code == 200) {
-      logModalRef.value.open(res.rows,'payable');
+      logModalRef.value.open(res.rows, 'payable');
 
     }
   });

--
Gitblit v1.8.0