wanggang
2 years ago
17 changed files with 259 additions and 105 deletions
@ -0,0 +1,86 @@ |
|||||
|
const schema = { |
||||
|
title: "通用代码", |
||||
|
type: "object", |
||||
|
properties: { |
||||
|
userName: { |
||||
|
title: "项目", |
||||
|
type: "string", |
||||
|
readOnly: true, |
||||
|
showForList: true, |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
userName: { |
||||
|
title: "值", |
||||
|
type: "string", |
||||
|
readOnly: true, |
||||
|
showForList: true, |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
name: { |
||||
|
title: "描述", |
||||
|
type: "string", |
||||
|
showForList: true, |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
const url = "base/code-settings"; |
||||
|
const createUrl = url; |
||||
|
const updateUrl = url; |
||||
|
const deleteUrl = url; |
||||
|
const method = "GET"; |
||||
|
const createMethod = "POST"; |
||||
|
const updateMethod = "PUT"; |
||||
|
const deleteMethod = "DELETE"; |
||||
|
|
||||
|
export default function () { |
||||
|
return { |
||||
|
query: { |
||||
|
url, |
||||
|
method, |
||||
|
schema: { |
||||
|
title: "通用代码", |
||||
|
type: "object", |
||||
|
properties: { |
||||
|
filter: { |
||||
|
title: "项目", |
||||
|
type: "string", |
||||
|
}, |
||||
|
skipCount: { |
||||
|
hidden: true, |
||||
|
default: 0, |
||||
|
}, |
||||
|
maxResultCount: { |
||||
|
hidden: true, |
||||
|
default: 10, |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
table: { |
||||
|
schema: schema, |
||||
|
}, |
||||
|
edit: { |
||||
|
createUrl, |
||||
|
updateUrl, |
||||
|
deleteUrl, |
||||
|
createMethod, |
||||
|
updateMethod, |
||||
|
deleteMethod, |
||||
|
schema: schema, |
||||
|
}, |
||||
|
}; |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
import AppList from "../../components/list/index.js"; |
||||
|
import html from "html"; |
||||
|
import useConfig from "../../models/code-setting.js"; |
||||
|
import request from "../../request/index.js"; |
||||
|
import { format } from "../../utils/index.js"; |
||||
|
import { ElMessage } from "element-plus"; |
||||
|
|
||||
|
export default { |
||||
|
components: { AppList }, |
||||
|
template: html`<app-list :config="config" @command="onCommand" />`, |
||||
|
setup() { |
||||
|
// 变量定义
|
||||
|
const config = useConfig(); |
||||
|
// 函数定义
|
||||
|
const onCommand = async (item, rows) => { |
||||
|
console.log(item.path, item, rows); |
||||
|
if (item.path === "%s/reset-password") { |
||||
|
const url = format(item.path, rows[0].id); |
||||
|
await request(`base/user/${url}`, null, { method: item.meta.method }); |
||||
|
ElMessage({ |
||||
|
type: "info", |
||||
|
message: format("用户%s的密码已经成功重置为123456", rows[0].userName), |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
return { config, onCommand }; |
||||
|
}, |
||||
|
}; |
Binary file not shown.
Loading…
Reference in new issue