import UserAPI from "@/api/product/index"; import RoleAPI from "@/api/system/role"; import type { UserPageQuery } from "@/api/system/user"; import type { IContentConfig } from "@/components/CURD/types"; import { id } from "element-plus/es/locale"; const contentConfig: IContentConfig = { pageName: "sys:user", table: { border: true, highlightCurrentRow: true, expandRowKeys: [], rowKey: 'id', treeProps: { children: 'skuList' // 指定子节点存储的字段为 customChildren }, selectOnIndeterminate: false, }, pagination: { background: true, layout: "prev,pager,next,jumper,total,sizes", pageSize: 20, pageSizes: [10, 20, 30, 50], }, indexActionData: {}, indexAction: async function (params) { let obj = { ...params, ...params.times } obj.createBeginTime = obj['0'] obj.createEndTime = obj['1'] const res = await UserAPI.getPage(obj); res.records.forEach((element: any) => { if (element.type != "sku") { delete element.skuList } }); return new Promise(function (resolve, reject) { return resolve({ ...res }) }) }, // modifyAction: function (data) { // let obj = { // type: data.isGrounding ? 'sku' : 'product', // id: data.id, // isSale: data.value // } // return null // }, deleteAction: UserAPI.deleteByIds, importsAction(data) { // 模拟导入数据 // console.log("importsAction", data); // return Promise.resolve(); }, exportsAction: async function (params) { // 模拟获取到的是全量数据 // const res = await UserAPI.getPage(params); // return res.list; }, pk: "id", toolbar: [ { icon: "plus", text: "新增", type: "primary", name: "add", auth: "import", }, { icon: "refresh", text: "同步", type: "danger", name: "sync", auth: "import", }, // { // icon: "edit", // text: "库存预警", // type: "danger", // name: "custom1", // auth: "import", // }, { icon: "Download", text: "导出", type: "", name: "export", auth: "import", } ], cols: [ { type: "selection", width: 50, align: "center", selectable: (row) => !row.barCode, }, { label: "封面图", align: "center", prop: "coverImg", templet: "image" }, { label: "商品名称", align: "center", prop: "name", }, { label: "分类", align: "center", prop: "categoryName", }, { label: "售价", align: "center", prop: "lowPrice" }, { label: "商品规格", align: "center", prop: "type", templet: "custom", slotName: "type", }, // { label: "库存", align: "center", prop: "stockNumber" }, // { label: "库存", align: "center", slotName: "kucunedit", templet: "custom", prop: "stockNumber" }, { label: "耗材信息", align: "center", prop: "consName", slotName: "consumables", templet: "custom", }, // { // label: "库存开关", // align: "center", // prop: "isStock", // templet: "custom", // slotName: "isStock", // }, { label: "上架", align: "center", prop: "isSale", templet: "custom", slotName: "shangjia", }, { label: "售罄", align: "center", prop: "isSoldStock", templet: "custom", slotName: "sellOut", }, { label: "自动售罄", align: "center", prop: "isAutoSoldStock", templet: "custom", slotName: "autoSellOut", }, { label: "退菜退库存", align: "center", prop: "refundMode", templet: "custom", slotName: "tuikuantuihui", }, { label: "操作", align: "center", fixed: "right", width: 280, templet: "tool", operat: [ { text: "报损", icon: '', name: 'cons' }, { text: "报损记录", name: 'consRecord' }, { text: "编辑", icon: 'edit', name: "edit" }, { text: "删除", icon: 'delete', type: 'danger', name: "delete" }], }, ], }; export default contentConfig;