cashier-web/src/views/devices/config/content.ts

89 lines
2.3 KiB
TypeScript

import printerApi, { type getListRequest } from "@/api/account/printer";
import type { IContentConfig } from "@/components/CURD/types";
const contentConfig: IContentConfig<getListRequest> = {
pageName: "sys:user",
table: {
border: true,
highlightCurrentRow: true,
},
indexActionData: function (data: any) {
// Add your implementation here
return Promise.resolve(data);
},
pagination: {
background: true,
layout: "prev,pager,next,jumper,total,sizes",
pageSize: 20,
pageSizes: [10, 20, 30, 50],
},
indexAction: function (params) {
return printerApi.getList(params);
},
deleteAction: function (id) {
return printerApi.delete(id)
},
modifyAction(data) {
// 模拟发起网络请求修改字段
return printerApi.edit({
id: data.id,
status: data.status
});
},
importsAction(data) {
// 模拟导入数据
console.log("importsAction", data);
return Promise.resolve();
},
exportsAction: async function (params) {
// 模拟获取到的是全量数据
// const res = await printerApi.getPage(params);
// console.log("exportsAction", res.list);
// return res.list;
},
pk: "id",
toolbar: [
"add",
],
cols: [
// { type: "selection", width: 50, align: "center" },
{ label: "设备名称", align: "center", prop: "name" },
// { label: "设备号", align: "center", prop: "username" },
{ label: "品牌", align: "center", prop: "contentType", slotName: "contentType", templet: "custom", },
// { label: "品牌", align: "center", prop: "avatar", templet: "image" },
{ label: "打印类型", align: "center", prop: "subType", slotName: "subType", templet: "custom", },
{ label: "设备类型", align: "center", prop: "connectionType" },
{
label: "状态",
align: "center",
prop: "status",
templet: "switch",
slotName: "status",
},
{ label: "创建时间", align: "center", prop: "createTime" },
// {
// label: "操作",
// align: "center",
// fixed: "right",
// width: 280,
// templet: "tool",
// operat: ["edit", "delete"],
// watch: () => { }
// },
{
label: "操作",
align: "center",
fixed: "right",
width: 150,
templet: "custom",
slotName: 'operate'
}
],
};
export default contentConfig;