Files
vue3-element-admin/src/views/demo/curd/config/search.ts
Ray.Hao 7c8a149bcf refactor: ♻️ 优化CURD组件权限处理
将权限属性名从 auth 统一修改为 perm,保持命名一致性
更新 permPrefix 替代 pageName 作为权限前缀标识
优化权限检查逻辑,未设置权限标识的按钮默认显示
2025-04-18 23:58:38 +08:00

68 lines
1.7 KiB
TypeScript

import DeptAPI from "@/api/system/dept.api";
import type { ISearchConfig } from "@/components/CURD/types";
const searchConfig: ISearchConfig = {
permPrefix: "sys:user",
formItems: [
{
tips: "支持模糊搜索",
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: "200px" },
},
async initFn(formItem) {
formItem.attrs.data = await DeptAPI.getOptions();
// 注意:如果initFn函数不是箭头函数,this会指向此配置项对象,那么也就可以用this来替代形参formItem
// this.attrs!.data = await DeptAPI.getOptions();
},
},
{
type: "select",
label: "状态",
prop: "status",
attrs: {
placeholder: "全部",
clearable: true,
style: { width: "200px" },
},
options: [
{ label: "启用", value: 1 },
{ label: "禁用", value: 0 },
],
},
{
type: "date-picker",
label: "创建时间",
prop: "createTime",
attrs: {
type: "daterange",
"range-separator": "~",
"start-placeholder": "开始时间",
"end-placeholder": "截止时间",
"value-format": "YYYY-MM-DD",
style: { width: "200px" },
},
},
],
};
export default searchConfig;