From ff1169ac5114c68e96c5686a0caa5d69d8a60b8a Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期五, 12 十二月 2025 16:55:39 +0800
Subject: [PATCH] 修改
---
src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue | 85 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 8 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue b/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
index 3d8929b..7164f35 100644
--- a/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
+++ b/src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
@@ -3,9 +3,9 @@
<div style="display: flex;justify-content: space-between">
<el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" >
<el-form-item>
- <el-button type="primary" plain icon="Plus" @click="openDialog('add',{})">新增</el-button>
+ <el-button type="primary" plain icon="Plus" @click="openDialog('add',{})" v-hasPermi="['orgStructure:departManage:add']">新增</el-button>
</el-form-item>
- <el-form-item v-if="isAdmin" label="企业:" >
+ <el-form-item v-if="isAdmin" label="单位:" >
<el-select v-model="data.queryParams.companyId" placeholder="请选择" clearable>
<el-option
v-for="item in companyList"
@@ -19,6 +19,7 @@
<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>
@@ -47,9 +48,9 @@
</el-table-column>
<el-table-column label="操作" align="center" width="160">
<template #default="scope">
- <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
- <el-button link type="primary" @click="openDialog('add',scope.row)">新增</el-button>
- <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
+ <el-button link type="primary" @click="openDialog('edit',scope.row)" v-hasPermi="['orgStructure:departManage:edit']">编辑</el-button>
+ <el-button link type="primary" @click="openDialog('add',scope.row)" v-hasPermi="['orgStructure:departManage:add']">新增</el-button>
+ <el-button link type="danger" @click="handleDelete(scope.row)" v-hasPermi="['orgStructure:departManage:del']">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -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