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