From 28cf6fc4ded0524afc5e363cd717bf7a1d26ba7f Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期三, 17 九月 2025 16:04:36 +0800
Subject: [PATCH] 修改
---
src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue | 77 ++++++++++++++++++++++++++++++++++++--
1 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue b/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
index 76cb20a..abb24d7 100644
--- a/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
+++ b/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
@@ -19,12 +19,13 @@
<el-button v-if="isAdmin" type="primary" @click="getList">查询</el-button>
<el-button v-if="isAdmin" type="primary" plain @click="reset">重置</el-button>
<el-button type="primary" @click="initDistribute">生成职能分配表</el-button>
+ <el-button type="primary" @click="generateMap">生成组织机构图</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="dataList" border row-key="deptId" :default-expand-all="true" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
- <el-table-column label="部门名称" prop="deptName" align="center" width="220"/>
+ <el-table-column label="组织机构名称" prop="deptName" align="center" width="220"/>
<el-table-column label="排序" prop="orderNum" align="center" width="60"/>
<el-table-column label="负责人" prop="leaderName" align="center" width="80"/>
<!-- <el-table-column label="主要负责部门" prop="parentName" align="center">-->
@@ -63,6 +64,26 @@
<!-- />-->
<depart-dialog ref="dialogRef" @getList=getList></depart-dialog>
<duty-dialog ref="dutyDialogRef" @getList=getList></duty-dialog>
+ <el-dialog
+ v-model="dialogVisible"
+ title="组织机构图"
+ width="75%"
+ center
+ :before-close="handleClose"
+ :close-on-press-escape="false"
+ :close-on-click-modal="false"
+ >
+ <div class="deptTreeBox">
+ <vue3-tree-org
+ :data="deptList"
+ :horizontal="false"
+ :props="treeProps"
+ :toolBar="tools"
+ :label-style="labelStyle"
+ center
+ />
+ </div>
+ </el-dialog>
</div>
</template>
@@ -92,10 +113,27 @@
},
total: 0,
dataList: [],
+ deptList: {
+ id: 0,
+ deptName: "",
+ children:[]
+ },
companyList: [],
- isAdmin: false
+ companyName: '',
+ isAdmin: false,
+ dialogVisible: false,
+ treeProps: {
+ label: 'deptName'
+ },
+ tools: {
+ scale: true, restore: true, expand: false, zoom: false, fullscreen: false
+ },
+ labelStyle: {
+ border: '1px solid #ccc',
+ background: 'rgba(0,0,0,0)'
+ }
});
-const { queryParams, total, dataList, companyList, isAdmin } = toRefs(data);
+const { queryParams, total, dataList, companyList, isAdmin, dialogVisible, deptList, treeProps, tools, labelStyle } = toRefs(data);
const userInfo = ref()
onMounted(async ()=>{
if(userStore.roles.includes('admin')){
@@ -112,12 +150,37 @@
})
+const generateMap = async ()=>{
+ if(!data.queryParams.companyId){
+ ElMessage.warning('请先选择企业')
+ }else{
+ data.deptList.deptName = data.companyList?.find(i=>i.id == data.queryParams.companyId)?.name || userStore.companyName
+ const res = await getDepart(data.queryParams)
+ if(res.code == 200){
+ const list = proxy.handleTree(res.data, "deptId")
+ data.deptList.children = list
+ }else{
+ ElMessage.warning(res.message)
+ }
+ data.dialogVisible = true
+ }
+}
+
+const handleClose = ()=>{
+ data.deptList = {
+ id: 0,
+ deptName: "",
+ children:[]
+ }
+ data.dialogVisible = false
+}
+
const getList = async () => {
loading.value = true
const res = await getDepart(data.queryParams)
if(res.code == 200){
data.dataList = proxy.handleTree(res.data, "deptId")
- console.log(data.dataList,'list')
+ data.deptList.children = data.dataList
// data.total = res.data.total
}else{
ElMessage.warning(res.message)
@@ -288,3 +351,9 @@
}
</script>
+<style scoped lang="scss">
+.deptTreeBox{
+ width: 100%;
+ height: 800px;
+}
+</style>
--
Gitblit v1.9.2