chore(地区管理): 🚸 地区管理改树形
This commit is contained in:
@@ -6,7 +6,7 @@ export function GetList(query: PageQuery) {
|
|||||||
return request({
|
return request({
|
||||||
url: apiPrefix,
|
url: apiPrefix,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: query,
|
params: query,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export function GetObj(id: InfoReq) {
|
export function GetObj(id: InfoReq) {
|
||||||
|
|||||||
@@ -20,6 +20,18 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
|
|||||||
const addRequest = async ({ form }: AddReq) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 懒加载
|
||||||
|
* @param row
|
||||||
|
* @returns {Promise<unknown>}
|
||||||
|
*/
|
||||||
|
const loadContentMethod = (tree: any, treeNode: any, resolve: any) => {
|
||||||
|
api.GetList({ pcode: tree.code }).then((res: any) => {
|
||||||
|
resolve(res.data);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
@@ -28,47 +40,50 @@ export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExp
|
|||||||
editRequest,
|
editRequest,
|
||||||
delRequest,
|
delRequest,
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
rowKey: 'id',
|
||||||
|
lazy: true,
|
||||||
|
load: loadContentMethod,
|
||||||
|
treeProps: { children: 'children', hasChildren: 'hasChild' },
|
||||||
|
},
|
||||||
columns: {
|
columns: {
|
||||||
_index: {
|
_index: {
|
||||||
title: '序号',
|
title: '序号',
|
||||||
form: { show: false },
|
form: { show: false },
|
||||||
column: {
|
column: {
|
||||||
//type: 'index',
|
type: 'index',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: '70px',
|
width: '70px',
|
||||||
columnSetDisabled: true, //禁止在列设置中选择
|
columnSetDisabled: true, //禁止在列设置中选择
|
||||||
formatter: (context) => {
|
|
||||||
//计算序号,你可以自定义计算规则,此处为翻页累加
|
|
||||||
let index = context.index ?? 1;
|
|
||||||
let pagination = crudExpose.crudBinding.value.pagination;
|
|
||||||
return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
pcode: {
|
|
||||||
title: '父级地区',
|
|
||||||
show: false,
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
},
|
|
||||||
type: 'dict-tree',
|
|
||||||
form: {
|
|
||||||
component: {
|
|
||||||
showAllLevels: false, // 仅显示最后一级
|
|
||||||
props: {
|
|
||||||
elProps: {
|
|
||||||
clearable: true,
|
|
||||||
showAllLevels: false, // 仅显示最后一级
|
|
||||||
props: {
|
|
||||||
checkStrictly: true, // 可以不需要选到最后一级
|
|
||||||
emitPath: false,
|
|
||||||
clearable: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// pcode: {
|
||||||
|
// title: '父级地区',
|
||||||
|
// show: false,
|
||||||
|
// search: {
|
||||||
|
// show: true,
|
||||||
|
// },
|
||||||
|
// type: 'dict-tree',
|
||||||
|
// form: {
|
||||||
|
// component: {
|
||||||
|
// showAllLevels: false, // 仅显示最后一级
|
||||||
|
// props: {
|
||||||
|
// elProps: {
|
||||||
|
// clearable: true,
|
||||||
|
// showAllLevels: false, // 仅显示最后一级
|
||||||
|
// props: {
|
||||||
|
// checkStrictly: true, // 可以不需要选到最后一级
|
||||||
|
// emitPath: false,
|
||||||
|
// clearable: true,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
name: {
|
name: {
|
||||||
title: '名称',
|
title: '名称',
|
||||||
search: {
|
search: {
|
||||||
|
|||||||
Reference in New Issue
Block a user