祖安之光
20 小时以前 dd2bdb18a8394d2f2a13534a98bcadb8020e3668
修改新增
已修改2个文件
77 ■■■■■ 文件已修改
src/store/modules/user.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js
@@ -12,6 +12,7 @@
      id: '',
      name: '',
      companyId: null,
      companyName: '',
      avatar: '',
      roles: [],
      permissions: []
@@ -49,6 +50,7 @@
            this.id = user.userId
            this.name = user.userName
            this.companyId = user.companyId
            this.companyName = user.companyName
            this.avatar = avatar
            Cookies.set('userInfo',JSON.stringify(user))
            resolve(res)
src/views/build/conpanyFunctionConsult/orgStructure/departManage/index.vue
@@ -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>
@@ -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>