Browse Source

前端:期间设置和通用代码开发

master
wanggang 1 year ago
parent
commit
c226243c40
  1. 37
      code/WebApp/vanilla/components/form/form-input.js
  2. 10
      code/WebApp/vanilla/components/form/index.js
  3. 237
      code/WebApp/vanilla/components/list/index.js
  4. 136
      code/WebApp/vanilla/models/centralized-control.js
  5. 14
      code/WebApp/vanilla/models/code-setting.js
  6. 8
      code/WebApp/vanilla/request/index.js
  7. 93
      code/WebApp/vanilla/router/routes.js
  8. 27
      code/WebApp/vanilla/views/base-data/centralized-control.js
  9. 13
      code/WebApp/vanilla/views/base-data/code-setting.js
  10. 4
      code/WebApp/vanilla/views/login.js
  11. BIN
      docs/ui.rp

37
code/WebApp/vanilla/components/form/form-input.js

@ -2,14 +2,16 @@ import html from "html";
import { ref, reactive, watch, onMounted } from "vue";
import { dayjs } from "element-plus";
import request, { post } from "../../request/index.js";
import { importFunction } from "../../utils/index.js";
export default {
template: html`
<template v-if="getDisabled()">
<template v-if="model[prop]!==null">
<el-switch disabled v-model="model[prop]" type="checked" v-if="schema.type==='boolean'" />
<template v-else-if="schema.input==='datetime'">{{dayjs(model[prop]).format('YYYY-MM-DD HH:mm:ss')}}</template>
<template v-else-if="schema.input==='year'">{{dayjs(model[prop]).format('YYYY')}}</template>
<template v-else-if="schema.input==='date'">{{dayjs(model[prop]).format('YYYY-MM-DD')}}</template>
<template v-else-if="schema.input==='datetime'">{{dayjs(model[prop]).format('YYYY-MM-DD HH:mm:ss')}}</template>
<template v-else-if="schema.input==='password'">******</template>
<template v-else>{{model[prop]}}</template>
</template>
@ -27,21 +29,24 @@ export default {
<el-option v-for="item in options" :key="item.key" :label="item.label" :value="item.value" />
</el-select>
</template>
<template v-if="getInput(schema)==='month'">
<el-date-picker v-model="model[prop]" :type="schema.input" :value-format="schema.format" />
</template>
<el-input
:disabled="getDisabled()"
:placeholder="schema.title"
v-model="model[prop]"
type="number"
v-else-if="schema.type==='number'"
v-else-if="getInput(schema)==='number'"
/>
<el-input-number
:disabled="getDisabled()"
:placeholder="schema.title"
v-model="model[prop]"
:precision="0"
v-else-if="schema.type==='integer'"
v-else-if="getInput(schema)==='integer'"
/>
<template v-else-if="schema.type==='boolean'">
<template v-else-if="getInput(schema)==='boolean'">
<el-select :disabled="getDisabled()" v-model="model[prop]" :placeholder="schema.title" v-if="schema.nullable">
<el-option prop="select" value="" :label="$t('select')" />
<el-option prop="true" :value="true" :label="$t('true')" />
@ -58,7 +63,13 @@ export default {
show-password
v-if="schema.input==='password'"
/>
<el-input :disabled="getDisabled()" :placeholder="schema.title" v-model="model[prop]" type="text" v-else />
<el-input
:disabled="getDisabled()"
:placeholder="schema.title"
v-model="model[prop]"
:type="schema.input??'text'"
v-else
/>
</template>
</template>
`,
@ -87,6 +98,22 @@ export default {
const selectProps = ref({});
const selectValues = ref([]);
const options = ref([]);
//watch
watch(
() => model[props.prop],
async (value) => {
if (props.schema.watch) {
console.log(value);
if (props.schema.watch?.constructor === String) {
props.schema.watch = await importFunction(props.schema.watch);
}
if (props.schema.watch?.constructor === Function) {
props.schema.watch(model, value);
}
}
}
);
onMounted(async () => {
if (props.schema.options) {
options.value = props.schema.options;

10
code/WebApp/vanilla/components/form/index.js

@ -5,7 +5,7 @@ export default {
components: { AppFormItem: defineAsyncComponent(() => import("./form-item.js")) },
name: "AppForm",
template: html`<div v-loading="loading">
<el-form ref="formRef" :model="model" label-width="auto">
<el-form ref="formRef" :model="model" label-width="auto" :inline="inline">
<template v-for="(value, prop) in schema.properties">
<app-form-item
:parentSchema="schema"
@ -16,14 +16,16 @@ export default {
:errors="errors"
/>
</template>
<slot name="items"></slot>
<slot></slot>
<el-form-item v-if="!hideButton">
<template #label></template>
<el-button type="primary" @click="submit" :disabled="loading"><slot>$t('confirm')</slot></el-button>
<el-button type="primary" @click="submit" :disabled="loading">
<slot name="submitText">$t('confirm')</slot>
</el-button>
</el-form-item>
</el-form>
</div>`,
props: ["modelValue", "schema", "action", "hideButton", "isQueryForm", "mode"],
props: ["modelValue", "inline", "schema", "action", "hideButton", "isQueryForm", "mode"],
emits: ["update:modelValue", "submit"],
setup(props, context) {
// init

237
code/WebApp/vanilla/components/list/index.js

@ -14,6 +14,7 @@ export default {
name: "AppList",
components: {
AppForm: defineAsyncComponent(() => import("../form/index.js")),
AppFormInput: defineAsyncComponent(() => import("../../components/form/form-input.js")),
SvgIcon: defineAsyncComponent(() => import("../../components/icon/index.js")),
AppFormInput: defineAsyncComponent(() => import("../form/form-input.js")),
VueOfficeExcel,
@ -26,13 +27,18 @@ export default {
inline
mode="query"
label-position="left"
:schema="querySchema"
:schema="config.query.schema"
v-model="queryModel"
@submit="load"
:hideButton="true"
:isQueryForm="true"
v-if="querySchema"
/>
>
<template v-for="item in filterList.filter(o=>o.readOnly)">
<el-form-item :label="config.edit.schema.properties[item.column].title">
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" />
</el-form-item>
</template>
</app-form>
</el-col>
</el-row>
<el-row style="padding-bottom:20px;">
@ -231,23 +237,26 @@ export default {
</el-form>
</template>
<template v-else-if="editFormMode==='import'">
<el-form :model="importModel" inline>
<el-form-item :label="$t('部分成功')">
<el-switch v-model="importModel.partial" />
</el-form-item>
<el-form-item :label="$t('全部替换')">
<el-switch v-model="importModel.replace" />
</el-form-item>
<el-form :model="importModel" style="height:100%;">
<el-form-item :label="$t('导入模板')">
<el-link type="primary" @click="getImportTemplate">{{$t('下载')}}</el-link>
</el-form-item>
<el-form-item :label="$t('文件')">
<el-form-item label="选择工厂" label-width="80px">
<el-select v-model="importModel.version">
<el-option v-for="item in versions" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item label="选择版本" label-width="80px">
<el-select v-model="importModel.factory">
<el-option v-for="item in versions" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('文件')" label-width="80px">
<el-upload
ref="uploadRef"
class="upload"
drag
accept=".xlsx"
:disabled="fileList.length===1"
:limit="1"
:auto-upload="false"
:on-change="handleChange"
>
@ -257,37 +266,33 @@ export default {
</el-form>
</template>
<template v-else-if="editFormMode==='filter'">
<el-form :model="queryList" inline class="filter">
<el-row v-for="(item,index) in queryList">
<el-form :model="filterList" inline class="filter">
<el-row v-for="(item,index) in filterList">
<el-col :span="6">
<el-select v-model="item.property" :placeholder="$t('字段')">
<el-option v-for="(value, prop) in querySchema.properties" :value="prop" :label="value.title" />
<el-select v-model="item.column" :placeholder="$t('字段')">
<el-option
v-for="(value, prop) in config.edit.schema.properties"
:value="prop"
:label="value.title"
/>
</el-select>
</el-col>
<el-col :span="6">
<el-select v-model="item.operator" :placeholder="$t('操作符')">
<el-option value="{0}=@0" :label="$t('等于')" />
<el-option value="{0}!=@0" :label="$t('不等于')" />
<el-option value="{0}>@0" :label="$t('大于')" />
<el-option value="{0}>=@0" :label="$t('大于等于')" />
<el-option value="{0}<@0" :label="$t('小于')" />
<el-option value="{0}<=@0" :label="$t('小于等于')" />
<el-option value="{0}.Contains(@0)" :label="$t('包含')" />
<el-option value="{0}.StartsWith(@0)" :label="$t('开始于')" />
<el-option value="{0}.StartsWith(@0)" :label="$t('结束于')" />
<template v-if="item.column">
<el-option
v-for="item in getOperators(config.edit.schema.properties[item.column])"
value="item.value"
:label="item.label"
/>
</template>
</el-select>
</el-col>
<el-col :span="6">
<el-input v-model="item.value" :placeholder="$t('值')" />
<el-col :span="6" v-if="item.column">
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" />
</el-col>
<!-- <el-col :span="4">
<el-select v-model="item.logic" :placeholder="$t('关系')">
<el-option value="and" :label="$t('且')" />
<el-option value="or" :label="$t('或')" />
</el-select>
</el-col> -->
<el-col :span="2">
<el-button circle @click="queryList.splice(index, 1)">
<el-button circle @click="filterList.splice(index, 1)" v-if="!item.readOnly">
<template #icon>
<ep-close />
</template>
@ -296,7 +301,7 @@ export default {
</el-row>
<el-row>
<el-col>
<el-button circle @click="pushQueryList">
<el-button circle @click="pushfilterList">
<template #icon>
<ep-plus />
</template>
@ -322,6 +327,22 @@ export default {
.el-form.filter .el-col {
padding: 5px;
}
dl.upload {
min-height: 100%;
}
dl.upload dt {
font-weight: bold;
line-height: 3em;
}
dl.upload dd {
line-height: 2em;
}
dl.upload .el-form-item {
width: 300px;
}
div.upload {
width: 100%;
}
</style>`,
props: ["modelValue", "config", "querySchema", "controller", "query", "buttons"],
emits: ["command"],
@ -361,7 +382,7 @@ export default {
const queryModel = ref({});
const sortColumns = ref(new Map());
const querySchema = ref(props.querySchema);
const queryList = ref([]);
const filterList = ref([]);
const tableSchema = ref({});
const tableData = ref([]);
const editFormRef = ref(null);
@ -375,9 +396,13 @@ export default {
includeDeleted: false,
});
const importModel = reactive({
partial: true,
replace: false,
// partial: true,
// replace: false,
factory: "",
version: "",
});
const factories = ref([]);
const versions = ref([]);
const fileList = ref([]);
const getSortModel = (model) => {
model.orderBy
@ -415,6 +440,9 @@ export default {
await load();
};
const showColumn = (item, prop) => {
if (item.showForList === true) {
return true;
}
return (
item.type !== "object" &&
item.type !== "array" &&
@ -430,12 +458,11 @@ export default {
const url = config.query.url;
const method = config.query.method;
//
queryModel.value = schemaToModel(config.query.schema);
queryModel.value.maxResultCount = pageModel.pageSize;
queryModel.value.skipCount = (pageModel.pageIndex - 1) * pageModel.pageSize;
//
const postData = JSON.parse(JSON.stringify(queryModel.value));
postData.filters = queryList.value.filter((o) => o.property && o.value);
postData.filters = filterList.value.filter((o) => o.property && o.value);
if (postData.items) {
delete postData["items"];
}
@ -462,8 +489,7 @@ export default {
const click = async (item, rows) => {
editFormloading.value = true;
editFormMode.value = item.path ?? item;
context.emit("command", item, rows);
if (item.path === "index") {
if (item.path === "query") {
//list
await load();
} else if (item.path === "details") {
@ -485,13 +511,39 @@ export default {
editFormTitle.value = `${t(item.path)}${config.edit.schema.title}`;
dialogVisible.value = true;
} else if (item.path === "delete") {
if (!rows.length) {
return;
}
//delete
const url = format(config.edit.deleteUrl, rows[0].id);
if (item.meta.isTop) {
// 批量删除
return;
try {
await ElMessageBox.confirm("删除", "提示", {
type: "warning",
message: format("确认删除选中的%s行数据吗?", rows.length),
});
const response = await request(
url,
rows.map((o) => o.id),
{ method: config.edit.deleteMethod }
);
if (!response.errors) {
ElMessage({
type: "info",
message: "操作完毕",
});
}
} catch (error) {
if (error === "cancel") {
ElMessage({
type: "info",
message: "删除取消",
});
}
}
} else {
// 单个删除
const url = format(config.edit.deleteUrl, rows[0].id);
try {
await ElMessageBox.confirm("删除", "提示", {
type: "warning",
@ -511,7 +563,6 @@ export default {
}
}
}
const url = `${baseUrl}/${item.path}`;
// await post(
// url,
// rows.map((o) => o.id)
@ -523,13 +574,33 @@ export default {
dialogVisible.value = true;
} else if (item.path === "import") {
//import
const url = `${baseUrl}/${item.path}`;
editFormTitle.value = `${t(item.path)}${querySchema.value?.title}`;
fileList.value = [];
dialogVisible.value = true;
try {
editFormloading.value = true;
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`;
fileList.value = [];
dialogVisible.value = true;
versions.value = (
await request("settleaccount/centralized-control/get-all", null, { method: "POST" })
).data.items.map((o) => ({
value: o.version,
label: o.version,
}));
factories.value = (
await request("settleaccount/code-setting/get-all", null, { method: "POST" })
).data.items.map((o) => ({
value: o.project,
label: o.project,
}));
} catch (e) {
console.log(e);
} finally {
editFormloading.value = false;
}
} else if (item === "filter") {
editFormTitle.value = t("自定义查询");
dialogVisible.value = true;
} else {
context.emit("command", item, rows, load);
}
editFormloading.value = false;
};
@ -545,10 +616,10 @@ export default {
url = format(url, editFormModel.value.id);
}
const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod;
const result = await request(url, editFormModel.value, { method });
if (result.errors) {
model.errors = result.errors; //??
} else {
const response = await request(url, editFormModel.value, { method });
if (!response.errors) {
ElMessageBox.alert(`错误:${response.errors?.error?.message}`, `代码:${response.errors?.error?.code}`);
//model.errors = response.errors; //??
await load();
editFormMode.value = null;
dialogVisible.value = false;
@ -564,7 +635,7 @@ export default {
editFormMode.value = null;
} else if (editFormMode.value === "export") {
const postData = JSON.parse(JSON.stringify(queryModel.value));
postData.filters = queryList.value.filter((o) => o.property && o.value);
postData.filters = filterList.value.filter((o) => o.property && o.value);
delete postData.query["items"];
delete postData.query["id"];
const url = `${baseUrl}/${editFormMode.value}?${qs.stringify(exportModel)}`;
@ -573,13 +644,14 @@ export default {
dialogVisible.value = false;
} else if (editFormMode.value === "import") {
editFormloading.value = true;
const url = `${baseUrl}/${editFormMode.value}`;
const url = config.edit.importUrl;
const formData = new FormData();
formData.append("partial", importModel.partial);
formData.append("replace", importModel.replace);
formData.append("file", fileList.value[0]?.raw);
console.log(uploadRef.value);
const response = await post(url, formData);
formData.append("version", importModel.version);
formData.append("factory", importModel.factory);
for (let i = 0; i < fileList.value.length; i++) {
formData.append(`files`, fileList.value[i].raw);
}
await post(url, formData);
editFormloading.value = false;
dialogVisible.value = false;
await load();
@ -610,14 +682,6 @@ export default {
subDrawer.value = true;
}
};
const pushQueryList = () => {
queryList.value.push({
property: "",
operator: "{0}=@0",
value: "",
logic: "and",
});
};
const download = (response) => {
const downloadUrl = window.URL.createObjectURL(response.data);
const filename = response.filename;
@ -642,6 +706,24 @@ export default {
}
return false;
};
const pushfilterList = () => {
filterList.value.push({
logic: "",
column: "",
action: "",
value: "",
});
};
const getOperators = (schema) => {
if (schema.type === "int") {
}
return [
{
value: 0,
label: "等于",
},
];
};
onMounted(async () => {
if (route.meta.children?.length) {
for (const item of route.meta.children) {
@ -650,7 +732,10 @@ export default {
}
}
}
pushQueryList();
//
queryModel.value = schemaToModel(config.query.schema);
filterList.value = queryModel.value.filters;
//pushfilterList();
// if (!querySchema.value) {
// const vm = (await get(indexUrl)).data;
// querySchema.value = vm.schema.properties.query;
@ -662,9 +747,6 @@ export default {
// getSortModel(data.value);
// getColumns(vm.schema.properties.query);
// }
if (!config) {
//
}
getColumns(config.table.schema);
if (props.query) {
Object.assign(queryModel.value.query, props.query);
@ -673,7 +755,9 @@ export default {
// getColumns(vm.schema.properties.query);
await load();
});
context.expose({ load });
return {
load,
config,
queryModel,
pageModel,
@ -689,7 +773,7 @@ export default {
dialogVisible,
selectedRows,
querySchema,
queryList,
filterList,
tableSchema,
buttons,
tableData,
@ -713,10 +797,13 @@ export default {
submit,
showList,
subListQuery,
pushQueryList,
fileList,
handleChange,
getButtonDisabled,
factories,
versions,
pushfilterList,
getOperators,
};
},
};

136
code/WebApp/vanilla/models/centralized-control.js

@ -0,0 +1,136 @@
const schema = {
title: "期间设置",
type: "object",
properties: {
year: {
title: "年度",
type: "string",
hidden: true,
showForList: true,
rules: [
{
required: true,
},
],
},
period: {
title: "期间",
type: "string",
hidden: true,
showForList: true,
rules: [
{
required: true,
},
],
},
version: {
title: "版本",
type: "string",
input: "month",
format: "YYYYMM",
showForList: true,
watch: "(model,value)=>{model.year=value.substr(0,4);model.period=value.substr(4,2);}",
rules: [
{
required: true,
trigger: "blur",
},
],
},
state: {
title: "状态",
type: "boolean",
showForList: true,
default: true,
rules: [
{
required: true,
},
],
},
},
};
const baseUrl = "settleaccount/centralized-control";
const queryUrl = `${baseUrl}/get-list`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
export default function () {
return {
baseUrl,
query: {
url: queryUrl,
method: queryMethod,
schema: {
title: "通用代码",
type: "object",
properties: {
filters: {
type: "array",
hidden: true,
items: {
type: "object",
properties: {
logic: {
type: "int",
},
column: {
type: "string",
},
action: {
type: "int",
},
value: {
type: "string",
},
},
},
default: [
{
logic: 0,
column: "year",
action: 6,
value: "",
readOnly: true,
},
],
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
sorting: {
hidden: true,
},
},
},
},
table: {
schema: schema,
},
edit: {
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
schema: schema,
},
};
}

14
code/WebApp/vanilla/models/code-setting.js

@ -27,11 +27,13 @@ const schema = {
description: {
title: "描述",
type: "string",
input: "textarea",
showForList: true,
rules: [
{
required: true,
},
{ max: 60 },
],
},
},
@ -39,15 +41,17 @@ const schema = {
const baseUrl = "settleaccount/code-setting";
const queryUrl = `${baseUrl}/get-list`;
const detailsUrl = `${baseUrl}/GET/%s`;
const createUrl = `${baseUrl}/Create`;
const updateUrl = `${baseUrl}/Update/%s`;
const deleteUrl = `${baseUrl}/DeleteList`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/code-setting-upload-excel-import`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
export default function () {
return {
@ -110,10 +114,12 @@ export default function () {
createUrl,
updateUrl,
deleteUrl,
importUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
schema: schema,
},
};

8
code/WebApp/vanilla/request/index.js

@ -3,6 +3,7 @@ import { isLogin } from "../api/user.js";
import { useAppStore } from "../store/index.js";
import { getFileName } from "../utils/index.js";
import settings from "../config/settings.js";
import { ElMessageBox } from "element-plus";
// const requestSettings = {
// baseURL: "/api",
@ -47,7 +48,7 @@ const getResult = async (response) => {
status: response.status,
message: messages.get(response.status),
};
if (response.status == 200) {
if (response.status === 200 || response.status === 204) {
const contentType = response.headers.get("Content-Type");
if (contentType.indexOf("application/json") > -1) {
result.data = await response.json();
@ -55,8 +56,11 @@ const getResult = async (response) => {
result.data = await response.blob();
result.filename = getFileName(response.headers.get("Content-Disposition"));
}
} else if (response.status === 400 || response.status === 500) {
} /*if (response.status === 400 || response.status === 500) */ else {
result.errors = await response.json();
if (result.errors) {
ElMessageBox.alert(`错误:${result.errors?.error?.message}`, `代码:${result.errors?.error?.code}`);
}
}
return result;
};

93
code/WebApp/vanilla/router/routes.js

@ -25,6 +25,15 @@ export default [
permission: "AbpIdentity.Users",
},
children: [
{
path: "query",
meta: {
type: "button",
title: "查询",
icon: "file",
isTop: true,
},
},
{
path: "create",
meta: {
@ -109,12 +118,96 @@ export default [
// },
// ],
// },
{
path: "centralized-control",
meta: {
type: "page",
title: "期间设置",
icon: "file",
children: [
{
path: "query",
meta: {
type: "button",
title: "查询",
icon: "file",
isTop: true,
},
},
{
path: "create",
meta: {
type: "button",
title: "新建",
icon: "file",
isTop: true,
},
},
{
path: "open-version",
meta: {
type: "button",
title: "启用",
icon: "file",
isTop: true,
},
},
{
path: "closed-version",
meta: {
type: "button",
title: "停用",
icon: "file",
isTop: true,
},
},
{
path: "delete",
meta: {
type: "button",
title: "删除",
icon: "file",
isTop: true,
},
},
],
},
},
{
path: "code-setting",
meta: {
type: "page",
title: "通用代码",
icon: "file",
children: [
{
path: "create",
meta: {
type: "button",
title: "新建",
icon: "file",
isTop: true,
},
},
{
path: "delete",
meta: {
type: "button",
title: "删除",
icon: "file",
isTop: true,
},
},
{
path: "import",
meta: {
type: "button",
title: "导入",
icon: "file",
isTop: true,
},
},
],
},
},
],

27
code/WebApp/vanilla/views/base-data/centralized-control.js

@ -0,0 +1,27 @@
import html from "html";
import { ref } from "vue";
import request from "../../request/index.js";
import AppList from "../../components/list/index.js";
import useConfig from "../../models/centralized-control.js";
export default {
components: { AppList },
template: html`<app-list ref="listRef" :config="config" @command="onCommand" />`,
setup(props, context) {
const listRef = ref(null);
const config = useConfig();
const onCommand = async (item, rows, load) => {
if (item.path === "open-version" || item.path === "closed-version") {
const url = `${config.baseUrl}/${item.path}`;
await request(
url,
rows.map((o) => o.id),
{ method: "POST" }
);
console.log(context);
await load();
}
};
return { config, onCommand };
},
};

13
code/WebApp/vanilla/views/base-data/code-setting.js

@ -1,27 +1,14 @@
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 };
},

4
code/WebApp/vanilla/views/login.js

@ -20,7 +20,9 @@ export default {
<layout-locale />
</div>
<el-card class="box-card" style="width:400px;">
<app-form :schema="schema" v-model="model" :action="action" @submit="submit">{{$t('login')}}</app-form>
<app-form :schema="schema" v-model="model" :action="action" @submit="submit">
<template #submitText>{{$t('login')}}</template>
</app-form>
</el-card>
<layout-footer />
</div>

BIN
docs/ui.rp

Binary file not shown.
Loading…
Cancel
Save