From 89fd2cf7202c321512c2ea699a3a220a7138ed44 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期四, 09 四月 2026 10:40:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/cwxt_master' into cwxt_master

---
 ui/admin-ui3/src/views/cwgl/voucherSubjectSetting/index.vue |  403 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 272 insertions(+), 131 deletions(-)

diff --git a/ui/admin-ui3/src/views/cwgl/voucherSubjectSetting/index.vue b/ui/admin-ui3/src/views/cwgl/voucherSubjectSetting/index.vue
index 019080b..1234ff4 100644
--- a/ui/admin-ui3/src/views/cwgl/voucherSubjectSetting/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/voucherSubjectSetting/index.vue
@@ -10,30 +10,39 @@
       @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
       @size-change="sizeChange" @on-load="onLoad">
       <template #menu-left>
-        <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:voucherSubjectSetting:edit']"
+        <!-- <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:voucherSubjectSetting:edit']"
           @click="handleUpdate">淇敼
         </el-button>
         <el-button type="danger" icon="Delete" :disabled="pageF.multiple" @click="handleDelete"
           v-hasPermi="['cwgl:voucherSubjectSetting:remove']">鍒犻櫎
-        </el-button>
+        </el-button> -->
         <el-button type="warning" plain icon="Download" @click="handleExport"
           v-hasPermi="['cwgl:voucherSubjectSetting:export']">瀵煎嚭
         </el-button>
       </template>
       <template #menu="{ row, index, size }">
-        <el-button type="primary" text icon="Plus" @click="handleRowAdd(row)">鏂板瀛愰」</el-button>
+        <el-button type="primary" text icon="Plus" v-hasPermi="['cwgl:voucherSubjectSetting:addz']"
+          @click="handleRowAdd(row)">鏂板瀛愰」</el-button>
+        <el-button type="text" icon="View" @click="handleFlow(row)"
+          v-hasPermi="['cwgl:voucherSubjectSetting:flow']">鏃ュ織</el-button>
       </template>
     </avue-crud>
   </basicContainer>
+
+  <OperationLogModal ref="logModalRef" />
+
 </template>
 
 <script setup name="voucherSubjectSetting" lang="ts">
+import { listVoucherSubjectSettingLog, } from "@/api/cwgl/voucherSubjectSettingLog";
+
 import { VoucherSubjectSettingI, addVoucherSubjectSetting, delVoucherSubjectSetting, exportVoucherSubjectSetting, getVoucherSubjectSetting, listVoucherSubjectSetting, updateVoucherSubjectSetting } from "@/api/cwgl/voucherSubjectSetting";
 import useCurrentInstance from "@/utils/useCurrentInstance";
 import { computed, reactive, ref, toRefs } from "vue";
 import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface";
 import { usePagePlus } from "@/hooks/usePagePlus";
 import { hasPermission } from "@/utils/permissionUtils";
+import OperationLogModal from '@/components/OperationLogModal/index.vue';
 
 const { proxy } = useCurrentInstance();
 const crudRef = ref();
@@ -53,6 +62,7 @@
   form: <VoucherSubjectSettingI>{},
   queryParams: <VoucherSubjectSettingI & PageQueryInterface>{
     type: "0",
+    accountingItemsContains: [], // 蹇呴』鍒濆鍖栦负鏁扮粍
   },
   page: <PagesInterface>{
     pageSize: 10,
@@ -65,6 +75,10 @@
 const option = ref({
   pageKey: 'VoucherSubjectSetting',
   rowKey: 'id',
+  tree: true,           // 寮�鍚爲褰㈣〃鏍兼ā寮�
+  childrenHandler: 'children', // 鎸囧畾瀛愯妭鐐瑰瓧娈靛悕锛岄粯璁や负 children
+  expandAll: true,     // 鏄惁榛樿灞曞紑鎵�鏈夎
+  viewBtn: false,
   searchSpan: 5,
   labelWidth: 150,
   searchLabelWidth: 120,
@@ -91,10 +105,10 @@
     //     }
     //   ],
     // },
-    accountSet: {
+
+    type: {
       label: '璐﹀',
-      search: true,
-      minWidth: 120,
+      minWidth: 220,
       addDisabled: true,
       editDisabled: true,
       type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/sys_accounting_type',
@@ -106,62 +120,49 @@
       ],
     },
     // parentSubjectName: {
-
-
-    //   label: '涓婄骇绉戠洰鍚嶇О',
-    //   prop: 'parentSubjectCode',
-    //   type: 'cascader',      // 绾ц仈閫夋嫨鍣�
-    //   dataType: 'string',
-    //   // dicUrl: '/api/cwgl/subject/tree', 
-    //   placeholder: '璇烽�夋嫨涓婄骇绉戠洰鍚嶇О',
-
-    //   // --- 鎺у埗鏄剧ず閫昏緫 ---
-    //   hide: true,            // 鍦ㄨ〃鏍煎垪涓殣钘�
-    //   search: false,         // 鍦ㄦ悳绱㈡爮涓殣钘�
-    //   display: true,         // 鍦ㄦ柊澧�/淇敼寮圭獥涓樉绀猴紙榛樿涓簍rue锛�
-    //   // --------------------
-
-    //   filterable: true,      // 寮�鍚悳绱㈣繃婊�
-    //   checkStrictly: true,   // 鍏佽閫夋嫨浠绘剰涓�绾э紙鍙�夌埗绾э級
-    //   emitPath: false,       // 鎻愪氦鏃跺彧淇濈暀鏈�鍚庝竴绾х殑鍊�
-    //   props: {
-    //     label: 'name',
-    //     value: 'code',
-    //     children: 'children'
-    //   },
+    //   label: '涓婄骇绉戠洰鍚嶇О2',
     //   minWidth: 150,
-    //   // rules: [
-    //   //   {
-    //   //     required: true,
-    //   //     message: "涓婄骇绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
-    //   //   }
-    //   // ],
-    //   /*  */
 
+    //   search: true,
+    //   rules: [
+    //     {
+    //       required: true,
+    //       message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
+    //     }
+    //   ],
     // },
-    parentSubjectName: {
+    parentId: {
       label: '涓婄骇绉戠洰鍚嶇О',
-      minWidth: 150,
-
-      search: true,
+      prop: 'parentId',
+      type: 'tree',
+      hide: true,
+      dicData: [],
+      props: {
+        label: 'fullName', // 鍏抽敭鐐癸細缁戝畾鎴戜滑棰勫鐞嗗ソ鐨勫叏璺緞瀛楁
+        value: 'id'
+      },
+      addDisabled: true,
+      editDisabled: true,
       rules: [
-        {
-          required: true,
-          message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
-        }
-      ],
+        { required: true, message: "涓婄骇绉戠洰涓嶈兘涓虹┖", trigger: "change" }
+      ]
     },
     parentSubjectCode: {
       label: '涓婄骇绉戠洰浠g爜',
       minWidth: 150,
-
-      search: true,
-      rules: [
-        {
-          required: true,
-          message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
-        }
-      ],
+      disabled: true, // 璁剧疆涓虹鐢紝浠呬緵鏌ョ湅
+      // 濡傛灉甯屾湜鍦ㄨ〃鏍间篃鏄剧ず锛岃繖閲屼笉瑕佸啓 hide: true
+    },
+    parentSubjectCode: {
+      label: '涓婄骇绉戠洰浠g爜',
+      minWidth: 150,
+      hide: true,
+      // rules: [
+      //   {
+      //     required: true,
+      //     message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
+      //   }
+      // ],
     },
     // parentSubjectCode: {
     //   label: '涓婄骇绉戠洰浠g爜',
@@ -180,16 +181,21 @@
     //   //   }
     //   // ],
     // },
+    // 鍦� option.value.column 涓壘鍒� subjectName
+    // 鎵惧埌 option 閲岀殑 subjectName 鍒�
     subjectName: {
       label: '绉戠洰鍚嶇О',
-      minWidth: 150,
-
+      prop: 'subjectName', // 淇濇寔鍘熷 prop锛岃繖鏍峰脊绐楅噷鐨勮緭鍏ユ鎵嶆槸骞插噣鐨勫悕绉�
+      minWidth: 250,       // 鎷兼帴鍚庝細寰堥暱锛屽缓璁皟澶у搴�
       search: true,
+      overHidden: true,
+      // --- 浣跨敤 formatter 鏉ユ帶鍒惰〃鏍肩晫闈㈢殑鏄剧ず ---
+      formatter: (row: any) => {
+        // 浼樺厛鏄剧ず鎴戜滑閫掑綊鐢熸垚鐨勬嫾鎺ュ瓧娈碉紝濡傛灉娌℃湁锛堟瘮濡傚垰鏂板杩樻病鍒锋柊鐨勬暟鎹級锛屾樉绀哄師濮嬪悕绉�
+        return row.subjectNameWithParent || row.subjectName;
+      },
       rules: [
-        {
-          required: true,
-          message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
-        }
+        { required: true, message: "绉戠洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
       ],
     },
     subjectCode: {
@@ -235,7 +241,7 @@
       editDisplay: false,
     },
     accountingItemsContains: {
-      label: '鏍哥畻椤圭洰1',
+      label: '鏍哥畻椤圭洰',
       minWidth: 150,
       search: true,
       type: 'select', // 纭繚绫诲瀷涓� select
@@ -252,11 +258,10 @@
       }
     },
     accountingItems: {
-      label: '鏍哥畻椤圭洰2',
+      label: '鏍哥畻椤圭洰',
       minWidth: 150,
       type: 'select',
       multiple: true,
-      dataType: 'string',
       dicUrl: '/system/dict/data/type/sys_accounting_item_name',
       placeholder: '璇烽�夋嫨鏍哥畻椤圭洰锛堝彲澶氶�夛級',
       props: {
@@ -390,7 +395,7 @@
   }
 })
 // sys_accounting_type
-
+// listVoucherSubjectSetting
 const { tableData, pageF, rowSave, rowUpdate, rowDel, beforeOpen, searchChange,
   searchReset, selectionChange, onLoad, currentChange, sizeChange, handleDelete, handleExport, handleUpdate, refreshChange } = usePagePlus({
     form: form,
@@ -400,10 +405,77 @@
     page: page.value,
     getListApi: listVoucherSubjectSetting,
     getDetailApi: getVoucherSubjectSetting,
+    // 銆愬叧閿慨澶嶇偣銆戯細鎷︽埅璇︽儏鎺ュ彛锛屽湪鏁版嵁杩涘叆 form 涔嬪墠瀹屾垚鏍煎紡鍖�
+    getDetailApi: (id: any) => {
+      return getVoucherSubjectSetting(id).then((res: any) => {
+        console.log(res);
+
+        if (res.code === 200 && res.data) {
+          // 1. 澶勭悊 accountingItems 鏁板瓧杞暟缁�
+          // 1. 濡傛灉 accountSet 鏄暟瀛楋紝杞负瀛楃涓�
+          res.data.accountSet = res.data.accountSet ? String(res.data.accountSet) : "0";
+
+          if (typeof res.data.accountingItems === 'number') {
+            res.data.accountingItems = decomposeAccountingItems(res.data.accountingItems);
+          } else if (!res.data.accountingItems) {
+            res.data.accountingItems = [];
+          }
+
+          // 2. 澶勭悊 accountingItemsContains 纭繚鏄暟缁�
+          if (!Array.isArray(res.data.accountingItemsContains)) {
+            res.data.accountingItemsContains = [];
+          }
+
+
+        }
+        return res;
+      });
+    },
     exportApi: exportVoucherSubjectSetting,
     deleteApi: delVoucherSubjectSetting,
     addApi: addVoucherSubjectSetting,
     updateApi: updateVoucherSubjectSetting,
+    getListFunc: (res: any) => {
+      // 1. 杞崲鏍戠粨鏋�
+      const tree = proxy.handleTree(res.rows, "id");
+
+      // 2. 閫掑綊鎷兼帴鍚嶇О鍑芥暟 (鏍稿績淇敼)
+      const recursionFormatName = (list: any[], pName = '') => {
+        list.forEach(item => {
+          // 杩欓噷鐨勯�昏緫锛氬鏋滄湁鐖剁骇鍚嶇О锛屾嫾鍦ㄤ竴璧凤紱鍚﹀垯鍙樉绀鸿嚜宸�
+          item.subjectNameWithParent = pName ? `${pName} / ${item.subjectName}` : item.subjectName;
+
+          // 濡傛灉鏈夊瓙鑺傜偣锛岀户缁�掑綊锛屾妸褰撳墠鐨勬嫾鎺ョ粨鏋滀紶缁欏瓙鑺傜偣浣滀负 pName
+          if (item.children && item.children.length > 0) {
+            recursionFormatName(item.children, item.subjectNameWithParent);
+          }
+        });
+      };
+
+      // 鎵ц閫掑綊
+      recursionFormatName(tree);
+
+      // 3. 璧嬪�肩粰琛ㄦ牸鏁版嵁
+      tableData.value = tree;
+
+      // 4. 閫掑綊灞曞紑鎵�鏈夊眰绾� (浣犲師鏈夌殑閫昏緫)
+      nextTick(() => {
+        if (crudRef.value) {
+          const tableMethods = crudRef.value.$refs.table;
+          if (tableMethods && tableData.value) {
+            const expandAllNodes = (list: any[]) => {
+              list.forEach(row => {
+                if (row.children && row.children.length > 0) {
+                  tableMethods.toggleRowExpansion(row, true);
+                  expandAllNodes(row.children);
+                }
+              });
+            };
+            expandAllNodes(tableData.value);
+          }
+        }
+      });
+    },
     handleUpdateFunc: () => {
       isFromRow.value = true; // 淇敼鎿嶄綔涔熻涓虹鐢ㄤ笂绾х鐩�
       crudRef.value.rowEdit(selectionList.value[0]);
@@ -440,75 +512,132 @@
       queryParams.value = newParams;
       return newParams;
     },
-   handleBeforeOpenFunc: (type: string) => {
-  if (!option.value?.column) return;
 
-  const nameCol = option.value.column.parentSubjectName;
-  const codeCol = option.value.column.parentSubjectCode;
+    handleBeforeOpenFunc: (type: string) => {
+      if (!option.value?.column) return;
 
-  // --- 1. 鏂板閫昏緫淇敼 ---
-  if (type === 'add') {
-    if (isFromRow.value) {
-      // 琛屽唴鈥滄柊澧炲瓙椤光�濈偣鍑�
-      nameCol.disabled = true;
-      codeCol.disabled = true;
-      option.value.saveBtnText = '鏂板';
-      
-      // 璧嬪�煎綋鍓嶉〉绛剧殑璐﹀锛堣櫧鐒惰鍐呮柊澧為�氬父浼氬甫鍏ョ埗绾ц处濂楋紝浣嗚繖閲屾樉寮忓悓姝ヤ竴娆★級
-      form.value.accountSet = activeAccountSet.value; 
-    } else {
-      // 椤堕儴鈥滄柊澧炩�濇寜閽偣鍑�
-      nameCol.disabled = false;
-      codeCol.disabled = false;
-      option.value.saveBtnText = '淇� 瀛�';
-      
-      // 銆愬叧閿慨澶嶃�戝厛娓呯┖鍙兘娈嬬暀鐨勬棫鏁版嵁锛堝 ID銆佺鐩唬鐮佺瓑锛�
-      Object.keys(form.value).forEach(key => delete form.value[key]);
-      
-      // 銆愭牳蹇冭姹傘�戝皢椤电鐨勫�艰祴鍊肩粰琛ㄥ崟璐﹀瀛楁
-      form.value.accountSet = activeAccountSet.value; 
-      form.value.type = activeAccountSet.value; 
+      const codeCol = option.value.column.parentSubjectCode;
+      const parentIdCol = option.value.column.parentId;
 
-      
-      // 鍒濆鍖栧叾浠栧繀瑕佸瓧娈�
-      form.value.accountingItems = []; 
-      form.value.enabled = "1"; // 榛樿鍚敤
-    }
-  } 
+      // --- 1. 瀹氫箟鍚嶇О閫掑綊澶勭悊鍣� ---
+      const formatTreeData = (list: any[], parentName = '') => {
+        return list.map(item => {
+          // 鎷兼帴鍏ㄨ矾寰勶細鐖剁骇鍚嶇О > 褰撳墠鍚嶇О
+          const currentFullName = parentName ? `${parentName} > ${item.subjectName}` : item.subjectName;
+          const newItem = {
+            ...item,
+            fullName: currentFullName
+          };
+          // 濡傛灉鏈夊瓙鑺傜偣锛岀户缁�掑綊
+          if (newItem.children && newItem.children.length > 0) {
+            newItem.children = formatTreeData(newItem.children, currentFullName);
+          }
+          return newItem;
+        });
+      };
 
-  // --- 2. 淇敼/鏌ョ湅閫昏緫锛堜繚鎸佸師鏍凤級 ---
-  else if (type === 'edit' || type === 'view') {
-    nameCol.disabled = true;
-    codeCol.disabled = true;
-    option.value.updateBtnText = '淇� 鏀�';
+      // --- 2. 鍔犺浇骞跺鐞嗗瓧鍏告暟鎹� ---
+      listVoucherSubjectSetting({ type: activeAccountSet.value }).then(res => {
+        // 灏嗘墎骞虫暟鎹浆涓烘爲缁撴瀯 (proxy.handleTree 鏄� Ruoyi 甯哥敤宸ュ叿)
+        const treeData = proxy.handleTree(res.rows, "id", "parentId");
+        // 鎵ц鍏ㄨ矾寰勬嫾鎺�
+        const fullPathTree = formatTreeData(treeData);
 
-    if (typeof form.value.accountingItems === 'number') {
-      form.value.accountingItems = decomposeAccountingItems(form.value.accountingItems);
-    } else if (!form.value.accountingItems) {
-      form.value.accountingItems = [];
-    }
-  }
+        // 缁勫悎鏈�缁堝瓧鍏革紝鍔犲叆鈥滈《绾р�濋�夐」
+        const fullDic = [
+          {
+            id: 0,
+            subjectName: '椤剁骇绉戠洰',
+            fullName: '椤剁骇绉戠洰',
+            children: fullPathTree
+          }
+        ];
+        if (parentIdCol) parentIdCol.dicData = fullDic;
 
-  nextTick(() => {
-    isFromRow.value = false;
-  });
-},
+        // 寮傛鍥炶皟涓啀娆$‘淇濅唬鐮佸瓧娈垫樉绀�
+        if (String(form.value.parentId) === "0" || !form.value.parentId) {
+          form.value.parentSubjectCode = "椤剁骇绉戠洰浠g爜";
+        }
+      });
+
+      // --- 3. 澶勭悊涓嶅悓妯″紡涓嬬殑鏄剧ず閫昏緫 ---
+      if (type !== 'add') {
+        // 銆愪慨鏀�/鏌ョ湅銆�
+        if (String(form.value.parentId) === "0" || !form.value.parentId) {
+          form.value.parentSubjectCode = "椤剁骇绉戠洰浠g爜";
+        }
+        if (parentIdCol) { parentIdCol.display = true; parentIdCol.disabled = true; }
+        if (codeCol) { codeCol.display = true; codeCol.disabled = true; }
+      } else {
+        // 銆愭柊澧炪��
+        if (isFromRow.value) {
+          // 琛屽唴鏂板瀛愰」
+          if (parentIdCol) { parentIdCol.display = true; parentIdCol.disabled = true; }
+          if (codeCol) { codeCol.display = true; codeCol.disabled = true; }
+        } else {
+          // 椤堕儴鏂板 (榛樿鏄《绾х鐩�)
+          if (parentIdCol) parentIdCol.display = false;
+          if (codeCol) codeCol.display = false;
+
+          const currentSet = activeAccountSet.value;
+          Object.assign(form.value, {
+            id: undefined,
+            parentId: 0,
+            parentSubjectCode: "鏃�",
+            accountSet: currentSet,
+            type: currentSet,
+            accountingItems: [],
+            enabled: "1"
+          });
+        }
+      }
+
+      // --- 4. 鏍煎紡鍖栧閫夊瓧娈� ---
+      const fieldsToFix = ['accountingItems', 'accountingItemsContains'];
+      fieldsToFix.forEach(field => {
+        const val = form.value[field];
+        if (typeof val === 'number') {
+          form.value[field] = decomposeAccountingItems(val);
+        } else if (!Array.isArray(val)) {
+          form.value[field] = [];
+        }
+      });
+
+      nextTick(() => {
+        isFromRow.value = false;
+      });
+    },
 
     // 鏂板淇濆瓨鍓嶇殑閫昏緫
     rowSaveBegin: (row: any, done: any, loading: any) => {
       processAccountingItems(row);
       delete row.accountingItemsContains;
-      // 濡傛灉 row 瀵硅薄閲屽甫浜� id锛屾柊澧炴帴鍙e彲鑳戒細鎶ラ敊鎴栧彉鎴愪慨鏀癸紝濡傛灉鏄《閮ㄦ柊澧烇紝纭繚娌℃湁 id
+
+      // --- 鏍稿績閫昏緫寮�濮� ---
       if (!isFromRow.value) {
+        // 1. 纭繚娌℃湁 ID锛堥槻姝㈣鎿嶄綔锛�
         delete row.id;
+
+        // 2. 濡傛灉鏄《绾х鐩紙parentId 涓� 0 鎴� 鏃狅級
+        if (row.parentId === 0 || !row.parentId) {
+          // 灏嗕笂绾х鐩唬鐮佽缃负褰撳墠濉啓鐨勭鐩唬鐮�
+          row.parentSubjectCode = row.subjectCode;
+        }
+      } else {
+        // 濡傛灉鏄鍐呮柊澧烇紝parentId 宸茬粡鏄埗鑺傜偣鐨� ID
       }
-      done(row); // 蹇呴』璋冪敤 done 骞朵紶鍏ュ鐞嗗悗鐨� row 鎵嶄細缁х画璇锋眰鎺ュ彛
+      // --- 鏍稿績閫昏緫缁撴潫 ---
+
+      done(row);
     },
 
     // 淇敼淇濆瓨鍓嶇殑閫昏緫
     rowUpdateBegin: (row: any, done: any, loading: any) => {
       processAccountingItems(row);
       delete row.accountingItemsContains;
+      if (row.parentSubjectCode == "椤剁骇绉戠洰浠g爜") {
+        row.parentSubjectCode = row.subjectCode;
+      }
       done(row); // 鍚岀悊
     },
   })
@@ -539,17 +668,14 @@
 };
 const handleTabClick = (tab: any) => {
   const selectedTabName = tab.props.name;
-  console.log("Tab鐐瑰嚮鐨勫��:", selectedTabName);
   activeAccountSet.value = selectedTabName;
-  queryParams.value.type = selectedTabName;
-  const nextParams = {
-    ...queryParams.value,
-    type: selectedTabName
-  };
 
-  // 4. 閲嶇疆鍒嗛〉骞跺姞杞�
+  // 鍏堟竻绌哄綋鍓嶆暟鎹紝闃叉鏃ф暟鎹殑鏍戠粨鏋勫奖鍝嶆柊鏁版嵁鐨勬覆鏌�
+  tableData.value = [];
+
+  queryParams.value.type = selectedTabName;
   page.value.currentPage = 1;
-  onLoad(page.value, nextParams);
+  onLoad(page.value, { type: selectedTabName });
 }
 
 /**
@@ -567,22 +693,37 @@
   return result;
 }
 
+
 /**
- * 澶勭悊琛屽唴鈥滄柊澧炩�濈偣鍑�
+ * 澶勭悊琛屽唴鈥滄柊澧炲瓙椤光�濈偣鍑�
  */
 const handleRowAdd = (row: any) => {
   isFromRow.value = true;
-  getVoucherSubjectSetting(row.id).then((res: any) => {
+
+  // 1. 鍏堣Е鍙戞柊澧炲姩浣滐紝杩欎細寮瑰嚭绐楀彛骞跺垵濮嬪寲 form
+  crudRef.value.rowAdd();
+
+  // 2. 鍦� DOM 鏇存柊鍚庣殑涓嬩竴娆″惊鐜腑寮哄埗璧嬪��
+  nextTick(() => {
+    // 纭繚璧嬪�肩粰 data 鍝嶅簲寮忓璞′腑鐨� form
+    form.value.parentId = row.id;
+    form.value.parentSubjectCode = row.subjectCode;
+    form.value.accountSet = row.accountSet;
+    form.value.type = row.accountSet;
+    form.value.enabled = "1";
+    form.value.accountingItems = [];
+  });
+};
+
+const logModalRef = ref(null);
+const handleFlow = (row: any) => {
+  // 杩欓噷鍙互浠� row 涓洿鎺ヨ幏鍙栨棩蹇楋紝鎴栬�呰皟鐢ㄥ悗绔帴鍙f煡璇�
+  // 绀轰緥妯℃嫙鏁版嵁
+  listVoucherSubjectSettingLog({ subjectId: row.id }).then((res) => {
     if (res.code == 200) {
-      form.value = res.data;
-      form.value.parentId = form.value.id;
-      const num = form.value.accountingItems;
-      form.value.accountingItems = decomposeAccountingItems(num);
-      // 瑙﹀彂 Avue 鐨勫唴缃柊澧炲脊绐�
-      crudRef.value.rowAdd();
+      logModalRef.value.open(res.rows, 'payable');
+
     }
   });
-
-
-};
+}
 </script>

--
Gitblit v1.8.0