chore(部门管理): 🚸 部门管理优化添加子级

This commit is contained in:
猿小天
2023-03-20 10:40:48 +08:00
parent 020150fd54
commit 8f1be39f27

View File

@@ -49,6 +49,20 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
load: loadContentMethod, load: loadContentMethod,
treeProps: { children: 'children', hasChildren: 'hasChild' }, treeProps: { children: 'children', hasChildren: 'hasChild' },
}, },
rowHandle:{
fiexd:'right',
width:310,
buttons:{
addChildren:{
text: "添加子级",
type:"warning",
click(context){
const rowId =context.row.id
crudExpose.openAdd({ row: { parent: rowId } })
}
}
}
},
columns: { columns: {
_index: { _index: {
title: '序号', title: '序号',
@@ -83,38 +97,38 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
} }
}, },
}, },
parent: { // parent: {
column: { // column: {
show: false // show: false
}, // },
title: '上级部门', // title: '上级部门',
type: 'dict-tree', // type: 'dict-tree',
dict: dict({ // dict: dict({
url: '/api/system/dept/all_dept/', // url: '/api/system/dept/all_dept/',
value: 'id', // value: 'id',
label: 'name', // label: 'name',
isTree: true, // isTree: true,
getData: async ({ url }: { url: string }) => { // getData: async ({ url }: { url: string }) => {
return request({ // return request({
url: url, // url: url,
}).then((ret: any) => { // }).then((ret: any) => {
return ret.data // return ret.data
}) // })
} // }
}), // }),
form: { // form: {
helper: '默认留空为创建者的部门', // helper: '默认留空为创建者的部门',
component: { // component: {
span: 12, // span: 12,
props: { // props: {
props: { // props: {
value: "id", // value: "id",
label: "name", // label: "name",
} // }
} // }
} // }
} // }
}, // },
name: { name: {
title: '部门名称', title: '部门名称',
sortable: true, sortable: true,