You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
2.6 KiB

const schema = {
title: "用户",
type: "object",
properties: {
userName: {
title: "用户名",
type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
},
{
max: 64,
1 year ago
},
{
min: 4,
},
],
},
password: {
title: "密码",
type: "string",
readOnly: true,
input: "password",
1 year ago
rules: [
{
required: true,
},
{
min: 6,
},
],
},
name: {
title: "姓名",
type: "string",
showForList: true,
rules: [
{
required: true,
},
1 year ago
{ pattern: "^[\u4e00-\u9fa5]+$", message: "%s必须是正确的格式" },
],
},
phoneNumber: {
title: "电话",
type: "string",
showForList: true,
rules: [
{
required: true,
},
1 year ago
{ pattern: "^\\d{11}$", message: "%s必须是正确的格式" },
],
},
email: {
title: "邮箱",
type: "string",
showForList: true,
rules: [
1 year ago
{ required: true },
{ pattern: "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$", message: "%s必须是正确的格式" },
],
},
// roleNames: {
// title: "角色",
// type: "array",
// input: "select",
// multiple: true,
// url: "identity/roles/all",
// value: "name",
// label: "name",
// items: {
// type: "string",
// },
// },
},
};
1 year ago
const baseUrl = "base/user";
const queryUrl = `${baseUrl}`;
const detailsUrl = `${baseUrl}/%s`;
const createUrl = `${baseUrl}`;
const updateUrl = `${baseUrl}/%s`;
const deleteUrl = "identity/users/%s";
const queryMethod = "GET";
const detailsMethod = "GET";
const createMethod = "POST";
const updateMethod = "PUT";
const deleteMethod = "DELETE";
export default function () {
return {
query: {
1 year ago
url: queryUrl,
method: queryMethod,
schema: {
title: "用户",
type: "object",
properties: {
filter: {
title: "用户名",
type: "string",
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
},
},
},
table: {
schema: schema,
selectable: (o) => o.name !== "admin",
},
edit: {
1 year ago
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
1 year ago
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
schema: schema,
},
};
}