Browse Source

fix: 部门

wanggaokun 1 year ago
parent
commit
e13d9aab63
2 changed files with 10 additions and 13 deletions
  1. 1 1
      src/utils/index.ts
  2. 9 12
      src/views/system/dept/index.vue

+ 1 - 1
src/utils/index.ts

@@ -294,7 +294,7 @@ export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNam
 
   // 判断是否输出的结果为 tag 类型
   if (type == 'tag') {
-    return filterData?.tagType ? filterData.tagType : ''
+    return filterData?.listClass ? filterData.listClass : 'primary'
   } else {
     return filterData ? filterData[label] : '--'
   }

+ 9 - 12
src/views/system/dept/index.vue

@@ -38,7 +38,7 @@ import FormDialog from '@/components/FormDialog/index.vue'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
 import { Delete, EditPen, CirclePlus } from '@element-plus/icons-vue'
 import { handleTree } from '@/utils/common'
-import { listDeptApi, delDeptApi, addDeptApi, updateDeptApi, getDeptApi } from '@/api/modules/system/dept'
+import { listDeptApi, delDeptApi, addDeptApi, updateDeptApi } from '@/api/modules/system/dept'
 import { getDictsApi } from '@/api/modules/system/dictData'
 
 // ProTable 实例
@@ -64,11 +64,6 @@ const deleteDept = async (params: any) => {
 const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
 // 打开弹框的功能
 const openDialog = async (type: number, title: string, row?: any) => {
-  let res = { data: {} }
-  if (row?.deptId) {
-    res = await getDeptApi(row?.deptId || null)
-  }
-
   // 重置表单项
   setItemsOptions()
   if (row?.parentId == 0 && type == 2) {
@@ -76,16 +71,16 @@ const openDialog = async (type: number, title: string, row?: any) => {
   }
   // 增加子节点
   if (type == 4 && row?.parentId) {
-    res.data = {
-      parentId: row?.parentId
-    }
+    row.parentId = row?.deptId
   }
+  console.log('row', row)
+
   const params = {
     title,
     width: 700,
     isEdit: type !== 3,
     itemsOptions: itemsOptions,
-    model: type == 1 ? {} : res.data,
+    model: type == 1 ? {} : row,
     api: type == 1 || type == 4 ? addDeptApi : updateDeptApi,
     getTableList: proTable.value?.getTableList
   }
@@ -94,7 +89,6 @@ const openDialog = async (type: number, title: string, row?: any) => {
 
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
-  // { type: 'selection', fixed: 'left', width: 70 },
   {
     prop: 'deptName',
     label: '部门名称',
@@ -139,7 +133,10 @@ const setItemsOptions = () => {
         enum: deptOptions.value,
         elTagName: 'tree-select',
         valueKey: 'deptId',
-        labelKey: 'deptName',
+        props: {
+          value: 'deptId',
+          label: 'deptName'
+        },
         placeholder: '请输入上级部门'
       }
     },