diff --git a/code/WebApp/vanilla/components/form/form-input.js b/code/WebApp/vanilla/components/form/form-input.js
index 87d16b3d..f4b0e543 100644
--- a/code/WebApp/vanilla/components/form/form-input.js
+++ b/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`
- {{dayjs(model[prop]).format('YYYY-MM-DD HH:mm:ss')}}
+ {{dayjs(model[prop]).format('YYYY')}}
{{dayjs(model[prop]).format('YYYY-MM-DD')}}
+ {{dayjs(model[prop]).format('YYYY-MM-DD HH:mm:ss')}}
******
{{model[prop]}}
@@ -27,21 +29,24 @@ export default {
+
+
+
-
+
@@ -58,7 +63,13 @@ export default {
show-password
v-if="schema.input==='password'"
/>
-
+
`,
@@ -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;
diff --git a/code/WebApp/vanilla/components/form/index.js b/code/WebApp/vanilla/components/form/index.js
index df07298f..9e876e63 100644
--- a/code/WebApp/vanilla/components/form/index.js
+++ b/code/WebApp/vanilla/components/form/index.js
@@ -5,7 +5,7 @@ export default {
components: { AppFormItem: defineAsyncComponent(() => import("./form-item.js")) },
name: "AppForm",
template: html`
-
+
-
+
- $t('confirm')
+
+ $t('confirm')
+
`,
- props: ["modelValue", "schema", "action", "hideButton", "isQueryForm", "mode"],
+ props: ["modelValue", "inline", "schema", "action", "hideButton", "isQueryForm", "mode"],
emits: ["update:modelValue", "submit"],
setup(props, context) {
// init
diff --git a/code/WebApp/vanilla/components/list/index.js b/code/WebApp/vanilla/components/list/index.js
index 802dee6b..b8b7247f 100644
--- a/code/WebApp/vanilla/components/list/index.js
+++ b/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"
- />
+ >
+
+
+
+
+
+
@@ -231,23 +237,26 @@ export default {
-
-
-
-
-
-
-
+
{{$t('下载')}}
-
+
+
+
+
+
+
+
+
+
+
+
@@ -257,37 +266,33 @@ export default {
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
-
+
@@ -296,7 +301,7 @@ export default {
-
+
@@ -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%;
+ }
`,
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,
};
},
};
diff --git a/code/WebApp/vanilla/models/centralized-control.js b/code/WebApp/vanilla/models/centralized-control.js
new file mode 100644
index 00000000..b32e730f
--- /dev/null
+++ b/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,
+ },
+ };
+}
diff --git a/code/WebApp/vanilla/models/code-setting.js b/code/WebApp/vanilla/models/code-setting.js
index 1951c934..aabb1858 100644
--- a/code/WebApp/vanilla/models/code-setting.js
+++ b/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,
},
};
diff --git a/code/WebApp/vanilla/request/index.js b/code/WebApp/vanilla/request/index.js
index dc9e51e3..efd5bcf8 100644
--- a/code/WebApp/vanilla/request/index.js
+++ b/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;
};
diff --git a/code/WebApp/vanilla/router/routes.js b/code/WebApp/vanilla/router/routes.js
index 3ed7a755..319f4187 100644
--- a/code/WebApp/vanilla/router/routes.js
+++ b/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,
+ },
+ },
+ ],
},
},
],
diff --git a/code/WebApp/vanilla/views/base-data/centralized-control.js b/code/WebApp/vanilla/views/base-data/centralized-control.js
new file mode 100644
index 00000000..d96b18c0
--- /dev/null
+++ b/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``,
+ 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 };
+ },
+};
diff --git a/code/WebApp/vanilla/views/base-data/code-setting.js b/code/WebApp/vanilla/views/base-data/code-setting.js
index bab632ca..d69aaabe 100644
--- a/code/WebApp/vanilla/views/base-data/code-setting.js
+++ b/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``,
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 };
},
diff --git a/code/WebApp/vanilla/views/login.js b/code/WebApp/vanilla/views/login.js
index 0f1c2a05..a8d3c28a 100644
--- a/code/WebApp/vanilla/views/login.js
+++ b/code/WebApp/vanilla/views/login.js
@@ -20,7 +20,9 @@ export default {
- {{$t('login')}}
+
+ {{$t('login')}}
+
diff --git a/docs/ui.rp b/docs/ui.rp
index b66d9440..dbf10740 100644
Binary files a/docs/ui.rp and b/docs/ui.rp differ