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

45 lines
1.1 KiB
TypeScript

import DeptAPI from "@/api/system/dept";
import type { ISearchConfig } from "@/components/CURD/types";
const searchConfig: ISearchConfig = {
pageName: "sys:user",
formItems: [
{
type: "input",
label: "设备名称",
prop: "keywords",
attrs: {
placeholder: "请输入设备名称",
clearable: true,
style: {
width: "200px",
},
},
},
{
type: "tree-select",
label: "设备类型",
prop: "deptId",
attrs: {
placeholder: "请选择设备类型",
data: [],
filterable: true,
"check-strictly": true,
"render-after-expand": false,
clearable: true,
style: {
width: "150px",
},
},
async initFn(formItem) {
formItem.attrs.data = await DeptAPI.getOptions();
// 注意:如果initFn函数不是箭头函数,this会指向此配置项对象,那么也就可以用this来替代形参formItem
// this.attrs!.data = await DeptAPI.getOptions();
},
},
],
};
export default searchConfig;