web/src/pages/dev/editor/page.ejs

104 lines
2.1 KiB
Plaintext

<template>
<BreadPage>
<ani-table> </ani-table>
</BreadPage>
</template>
<script setup lang="tsx">
import { api } from "@/api";
import { createColumn, updateColumn, useAniTable } from "@/components";
const [aniTable, aniCtx] = useAniTable({
data: async (model, paging) => {
return api.<%= select.tag %>.<%= operationId %>({ ...model, ...paging });
},
columns: [
{
title: "用户描述",
dataIndex: "description",
},
createColumn,
updateColumn,
{
title: "操作",
type: "button",
width: 180,
buttons: [
{
type: "modify",
text: "修改",
},
{
type: "delete",
text: "删除",
onClick: async ({ record }) => {
return api.<%= tag %>.<%= operationId %>(record.id);
},
},
],
},
],
search: {
items: [
{
extend: "nickname",
required: false,
type: 'search',
enableLoad: true,
itemProps: {
hideLabel: true,
},
nodeProps: {
placeholder: "用户昵称",
},
},
],
},
create: {
title: "新建用户",
modalProps: {
width: 732,
maskClosable: false,
},
formProps: {
layout: "vertical",
class: "!grid grid-cols-2 gap-x-6",
},
items: [
<%_ for(const item of create.bodyParams) { _%>
{
field: "<%= item.name %>",
label: "<%= item.description %>",
type: "<%= item.type %>",
required: <%= item.required %>,
},
<%_ } _%>
],
submit: ({ model }) => {
return api.<%= create.tag %>.<%= create.operationId %>(model);
},
},
modify: {
extend: true,
title: "修改用户",
submit: ({ model }) => {
return api.<%= modify.tag %>.<%= modify.operationId %>(model.id, model);
},
},
});
</script>
<style scoped></style>
<%_ if(false) { _%>
<route lang="json">
{
"meta": {
"sort": 10301,
"title": "用户管理",
"icon": "icon-park-outline-user"
}
}
</route>
<%_ } _%>