92 lines
2.2 KiB
TypeScript
92 lines
2.2 KiB
TypeScript
import API, { type editRequest } from "@/api/system/miniAppPages";
|
||
import type { IModalConfig } from "@/components/CURD/types";
|
||
|
||
const modalConfig: IModalConfig<editRequest> = {
|
||
pageName: "sys:user",
|
||
dialog: {
|
||
title: "编辑小程序页面",
|
||
width: 800,
|
||
draggable: true,
|
||
},
|
||
form: {
|
||
labelWidth: 140,
|
||
},
|
||
formAction: function (data) {
|
||
if (data.icon) {
|
||
data.icon = typeof data.icon === "string" ? data.icon : data.icon[0]
|
||
}
|
||
return API.edit(data);
|
||
},
|
||
beforeSubmit(data) {
|
||
console.log("提交之前处理", data);
|
||
},
|
||
formItems: [
|
||
|
||
{
|
||
type: "UpImage",
|
||
label: "图标",
|
||
prop: "icon",
|
||
rules: [{ required: false, message: "请上传图标", trigger: "blur" }],
|
||
attrs: {
|
||
placeholder: "请上传图标",
|
||
},
|
||
},
|
||
{
|
||
type: "input",
|
||
label: "小程序页面名称",
|
||
prop: "name",
|
||
rules: [{ required: true, message: "请输入小程序页面名称", trigger: "blur" }],
|
||
attrs: {
|
||
placeholder: "请输入小程序页面名称",
|
||
},
|
||
},
|
||
{
|
||
type: "input",
|
||
label: "小程序页面路径",
|
||
prop: "path",
|
||
rules: [{ required: true, message: "请输入小程序页面路径", trigger: "blur" }],
|
||
attrs: {
|
||
placeholder: "请输入小程序页面路径",
|
||
},
|
||
},
|
||
{
|
||
type: "textarea",
|
||
label: "页面描述",
|
||
prop: "description",
|
||
rules: [{ required: false, message: "请输入页面描述", trigger: "blur" }],
|
||
attrs: {
|
||
placeholder: "请输入页面描述",
|
||
},
|
||
},
|
||
{
|
||
type: "input-number",
|
||
label: "排序",
|
||
prop: "sort",
|
||
rules: [{ required: false, message: "请输入排序", trigger: "blur" }],
|
||
attrs: {
|
||
placeholder: "请输入排序",
|
||
},
|
||
initialValue: 0,
|
||
},
|
||
{
|
||
type: "radio-button",
|
||
label: "小程序页面状态",
|
||
prop: "status",
|
||
options: [
|
||
{
|
||
label: "启用",
|
||
value: 1,
|
||
},
|
||
{
|
||
label: "禁用",
|
||
value: 0,
|
||
},
|
||
],
|
||
initialValue: 1,
|
||
}
|
||
],
|
||
};
|
||
|
||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||
export default reactive(modalConfig);
|