From 835c429a8c556e1af13beff919e7164bfccf7c6f Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期一, 01 九月 2025 15:52:15 +0800
Subject: [PATCH] 新增 的接口
---
Web/src/views/Customer/fBS_EnterpriseType/index.vue | 86 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/Web/src/views/Customer/fBS_EnterpriseType/index.vue b/Web/src/views/Customer/fBS_EnterpriseType/index.vue
index 557979f..468bbef 100644
--- a/Web/src/views/Customer/fBS_EnterpriseType/index.vue
+++ b/Web/src/views/Customer/fBS_EnterpriseType/index.vue
@@ -33,26 +33,69 @@
tableData: [],
tableDataCopy:[] //鎷疯礉
});
+const hasChildren = (data: any[]) => {
+ data.forEach(item => {
+ if (item.child) {
+ item.hasChildren = true;
+ }
+ });
+
+};
+const processNodesWithChildrenCheck = (nodes: any[]) => {
+
+ // 纭繚杈撳叆鏄暟缁�
+ if (!Array.isArray(nodes)) {
+ return [];
+ }
+
+ // 娣辨嫹璐濇暟缁勯伩鍏嶄慨鏀瑰師鏁版嵁
+ return nodes.map(node => {
+ // 澶嶅埗鑺傜偣
+ const newNode = { ...node };
+
+ // 妫�鏌ユ槸鍚︽湁瀛愯妭鐐�
+ const hasChild = Array.isArray(newNode.child) && newNode.child.length > 0;
+ newNode.hasChildren = hasChild;
+
+ // 濡傛灉鏈夊瓙鑺傜偣锛岄�掑綊澶勭悊瀛愯妭鐐�
+ if (hasChild) {
+ newNode.child = processNodesWithChildrenCheck(newNode.child);
+ }
+
+ return newNode;
+ });
+};
+const load = (node:any, treeNode:any,resolve:any) => {
+ console.log(node, treeNode,'node, resolve');
+
+ if( node.child) {
+ hasChildren(node.child);
+ return resolve(node.child);
+ } else {
+ return resolve([]);
+ }
+
+};
// 椤甸潰鍔犺浇鏃�
onMounted(async () => {
});
// 鏌ヨ鎿嶄綔
const handleQuery = async (params: any = {}) => {
-
const result = await fBS_EnterpriseTypeApi.tree().then(res => res.data.result);
state.tableParams.total = result?.total;
state.tableData = result ?? [];
+ // hasChildren(state.tableData)
state.tableLoading = false;
};
handleQuery();
const treeProps = reactive({
- checkStrictly: false,
+ // checkStrictly: false,
children: 'child',
-
+ hasChildren: 'hasChildren'
})
// 鍒犻櫎
@@ -73,7 +116,12 @@
<div class="fBS_EnterpriseType-container" v-loading="state.exportLoading">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="state.tableQueryParams" ref="queryForm" labelWidth="90">
- <el-row>
+ <el-row>
+ <!-- <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
+ <el-form-item label="鍚嶇О">
+ <el-input v-model="state.tableQueryParams.keyword" clearable placeholder="璇疯緭鍏ュ悕绉�"/>
+ </el-form-item>
+ </el-col> -->
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item>
<el-button-group style="display: flex; align-items: center;">
@@ -86,10 +134,30 @@
</el-row>
</el-form>
</el-card>
-
- <el-card>
- <el-table :data="state.tableData" :tree-props="treeProps" lazy row-key="id"
- >
+ <el-card class="full-table" shadow="hover" style="margin-top: 5px">
+ <el-table
+ :data="state.tableData"
+ style="width: 100%"
+ row-key="id"
+ border
+ lazy
+ :load="load"
+ :tree-props="treeProps"
+ >
+ <el-table-column type="selection" width="55" />
+ <el-table-column prop="name" label="鍚嶇О" />
+ <el-table-column prop="code" label="缂栫爜" />
+ <el-table-column prop="description" label="鎻忚堪" />
+ <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right" show-overflow-tooltip v-if="auth('fBS_EnterpriseType:update') || auth('fBS_EnterpriseType:delete')">
+ <template #default="scope">
+ <el-button icon="ele-Edit" size="small" text type="primary" @click="editDialogRef.openDialog(scope.row, state.tableData,'缂栬緫')" v-auth="'fBS_EnterpriseType:update'"> 缂栬緫 </el-button>
+ <el-button icon="ele-Delete" size="small" text type="primary" @click="delFBS_ExRole(scope.row)" v-auth="'fBS_EnterpriseType:delete'"> 鍒犻櫎 </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-card>
+ <!-- <el-card>
+ <el-table :data="state.tableData" lazy :tree-props="treeProps" row-key="id" :load="load">
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="鍚嶇О" />
<el-table-column prop="code" label="缂栫爜" />
@@ -103,7 +171,7 @@
</el-table>
<editDialog ref="editDialogRef" @reloadTable="handleQuery" />
- </el-card>
+ </el-card> -->
</div>
</template>
--
Gitblit v1.9.1