mirror of
https://github.com/certd/certd.git
synced 2026-05-18 06:17:31 +08:00
🔱: [client] sync upgrade with 9 commits [trident-sync]
perf: 完善文档,完善部分types perf: 优化d.ts类型 perf: 日期增加week、month、year、quarter类型 feat: resetCrudOptions 示例 feat: tabs快捷查询组件 fix: 行编辑支持多级表头 https://github.com/fast-crud/fast-crud/issues/143 perf: antdv 增加自定义表头示例 https://github.com/fast-crud/fast-crud/issues/141 perf: 表单下方按钮支持context https://github.com/fast-crud/fast-crud/issues/142
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import * as api from "./api";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
const statusRef = dict({
|
||||
url: "/mock/dicts/OpenStatusEnum?single"
|
||||
});
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
radio: null
|
||||
},
|
||||
buttons: {
|
||||
custom: {
|
||||
text: "自定义",
|
||||
show: true,
|
||||
order: 3,
|
||||
icon: {
|
||||
icon: "ant-design:search",
|
||||
style: {
|
||||
"font-size": "16px"
|
||||
}
|
||||
},
|
||||
click() {
|
||||
console.log("点击了自定义按钮");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tabs: {
|
||||
name: "radio",
|
||||
show: true
|
||||
//type: 'card', //tabs类型
|
||||
// defaultOptions: { //第一个tab页签显示
|
||||
// show: true,
|
||||
// value: null, //点击第一个页签,查询值
|
||||
// label: '全部', // 第一个页签的名称
|
||||
// },
|
||||
// options: computed(() => { //选项,默认从name字段的dict里面获取
|
||||
// return statusRef.data;
|
||||
// })
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 50
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
radio: {
|
||||
title: "状态",
|
||||
search: { show: true },
|
||||
type: "dict-radio",
|
||||
dict: statusRef
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user