Browse Source

update

master
wanggang 1 year ago
parent
commit
b4ae9c8745
  1. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
  2. 132
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  3. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/role.js
  4. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/user.js
  5. 0
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/version.js
  6. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/fa-yun.js
  7. 46
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js
  8. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js
  9. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/user.js
  10. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/version.js

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js

@ -29,7 +29,6 @@ export default {
<el-tab-pane key="all" label="全部" :value="null" /> <el-tab-pane key="all" label="全部" :value="null" />
<el-tab-pane v-for="item in options" :key="item.key" :label="item.label" :name="item.value" /> <el-tab-pane v-for="item in options" :key="item.key" :label="item.label" :name="item.value" />
</el-tabs> </el-tabs>
<br />
</template> </template>
<template v-else-if="getInput(schema)==='month'||getInput(schema)==='datetime'||getInput(schema)==='datetimerange'"> <template v-else-if="getInput(schema)==='month'||getInput(schema)==='datetime'||getInput(schema)==='datetimerange'">
<el-date-picker v-model="model[prop]" :type="schema.input" :value-format="schema.format??'YYYY-MM-DD HH:mm:ss'" /> <el-date-picker v-model="model[prop]" :type="schema.input" :value-format="schema.format??'YYYY-MM-DD HH:mm:ss'" />

132
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js

@ -60,7 +60,7 @@ export default {
fit fit
style="width:calc(100% - 26px);" style="width:calc(100% - 26px);"
> >
<el-table-column fixed="left" type="selection" :selectable="config.table.selectable" /> <el-table-column v-if="!config.table.schema.disableSelection" fixed="left" type="selection" :selectable="config.table.selectable" />
<el-table-column type="index" :label="$t('rowIndex')"> <el-table-column type="index" :label="$t('rowIndex')">
<template #default="scope"> {{ (pageModel.pageIndex - 1) * pageModel.pageSize + scope.$index + 1 }} </template> <template #default="scope"> {{ (pageModel.pageIndex - 1) * pageModel.pageSize + scope.$index + 1 }} </template>
</el-table-column> </el-table-column>
@ -186,7 +186,7 @@ export default {
</span> </span>
</template> </template>
</el-drawer> </el-drawer>
<el-dialog v-model="dialogVisible" align-center destroy-on-close :close-on-click-modal="false" style="width:auto;min-width:500px;max-width:1000px;"> <el-dialog v-model="dialogVisible" align-center destroy-on-close :close-on-click-modal="false" style="width:auto;width:700px;">
<template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template> <template #header> <span class="el-dialog__title"> {{editFormTitle}} </span> </template>
<el-row v-loading="editFormloading"> <el-row v-loading="editFormloading">
<el-col style="max-height:calc(100% - 180px );min-height:100%;"> <el-col style="max-height:calc(100% - 180px );min-height:100%;">
@ -399,6 +399,39 @@ export default {
const defaultImportModel = schemaToModel(config.import.schema); const defaultImportModel = schemaToModel(config.import.schema);
const importModel = ref(null); const importModel = ref(null);
const versions = ref([]); const versions = ref([]);
const onClick = async (method, confirMmessage = "确认操作吗?", reload = true) => {
try {
if (confirMmessage) {
await ElMessageBox.confirm(confirMmessage, "提示", {
type: "warning",
});
}
tableLoading.value = true;
let result = null;
if (method.constructor.name == "AsyncFunction") {
result = await method();
} else {
result = method();
}
if (!result.errors) {
if (!result.data?.code || result.data.code === 200) {
if (reload) {
pageModel.pageIndex = 1;
await load();
}
}
}
} catch (error) {
if (error === "cancel") {
ElMessage({
type: "info",
message: "操作取消",
});
}
} finally {
tableLoading.value = false;
}
};
const getSortModel = (model) => { const getSortModel = (model) => {
(model.sorting ?? "") (model.sorting ?? "")
.split(",") .split(",")
@ -469,11 +502,14 @@ export default {
tableLoading.value = false; tableLoading.value = false;
} }
}; };
const onPageIndexChange = async () => await load(); const reload = async () => {
const onPageSizeChange = async () => {
pageModel.pageIndex = 1; pageModel.pageIndex = 1;
await load(); await load();
}; };
const onPageIndexChange = async () => await load();
const onPageSizeChange = async () => {
await reload();
};
const click = async (item, rows) => { const click = async (item, rows) => {
editFormloading.value = true; editFormloading.value = true;
editFormMode.value = item.path ?? item; editFormMode.value = item.path ?? item;
@ -504,11 +540,16 @@ export default {
type: "warning", type: "warning",
}); });
tableLoading.value = true; tableLoading.value = true;
const response = await request( const result = await request(
url, url,
rows.map((o) => o.id), rows.map((o) => o.id),
{ method: config.edit.deleteMethod } { method: config.edit.deleteMethod },
true
); );
if (!result.data?.code || result.data.code === 200) {
pageModel.pageIndex = 1;
await reload();
}
} catch (error) { } catch (error) {
if (error === "cancel") { if (error === "cancel") {
ElMessage({ ElMessage({
@ -525,7 +566,8 @@ export default {
await ElMessageBox.confirm(format("确认删除当前行数据吗?", rows[0]), "提示", { await ElMessageBox.confirm(format("确认删除当前行数据吗?", rows[0]), "提示", {
type: "warning", type: "warning",
}); });
await request(url, null, { method: config.edit.deleteMethod }); await request(url, null, { method: config.edit.deleteMethod }, true);
await reload();
} catch (error) { } catch (error) {
if (error === "cancel") { if (error === "cancel") {
ElMessage({ ElMessage({
@ -541,10 +583,12 @@ export default {
const url = config.edit.exportUrl; const url = config.edit.exportUrl;
const method = config.edit.exportMethod; const method = config.edit.exportMethod;
const postData = buildQuery(); const postData = buildQuery();
const response = await request(url, postData, { method }); await onClick(async () => {
if (!response.errors) { const response = await request(url, postData, { method });
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); if (!response.errors) {
} window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`));
}
}, "确认导出?");
} else if (item.meta.pattern === "file") { } else if (item.meta.pattern === "file") {
window.open(getUrl(`settleaccount/getblobfile/download/${rows[0]["downFileName"]}`)); window.open(getUrl(`settleaccount/getblobfile/download/${rows[0]["downFileName"]}`));
} else if ((item.meta.pattern = "row")) { } else if ((item.meta.pattern = "row")) {
@ -585,21 +629,23 @@ export default {
try { try {
const valid = await editFormRef.value.validate(); const valid = await editFormRef.value.validate();
if (valid) { if (valid) {
editFormloading.value = true; await onClick(
let url = (editFormMode.value === "create" ? config.edit.createUrl : config.edit.updateUrl) ?? config.query.url; async () => {
if (editFormMode.value === "update") { let url = (editFormMode.value === "create" ? config.edit.createUrl : config.edit.updateUrl) ?? config.query.url;
url = format(url, editFormModel.value.id); if (editFormMode.value === "update") {
} url = format(url, editFormModel.value.id);
const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod; }
const response = await request(url, editFormModel.value, { method }); const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod;
if (response.errors) { const result = await request(url, editFormModel.value, { method }, true);
ElMessageBox.alert(`错误:${response.errors?.error?.message}`, `代码:${response.errors?.error?.code}`); if (!result.errors) {
//model.errors = response.errors; //?? dialogVisible.value = false;
} else { editFormMode.value = null;
await load(); await reload();
editFormMode.value = null; }
dialogVisible.value = false; },
} null,
true
);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -783,37 +829,6 @@ export default {
} }
return postData; return postData;
} }
const action = async (method, confirMmessage = "确认操作吗?", successMessage = "操作成功", reload = true) => {
try {
await ElMessageBox.confirm(confirMmessage, "提示", {
type: "warning",
});
tableLoading.value = true;
let result = null;
if (method.constructor.name == "AsyncFunction") {
result = await method();
} else {
result = method();
}
if (!result.errors) {
if (!result.data?.code || result.data.code === 200) {
if (reload) {
pageModel.pageIndex = 1;
await load();
}
}
}
} catch (error) {
if (error === "cancel") {
ElMessage({
type: "info",
message: "操作取消",
});
}
} finally {
tableLoading.value = false;
}
};
onMounted(async () => { onMounted(async () => {
if (route.meta.children?.length) { if (route.meta.children?.length) {
for (const item of route.meta.children) { for (const item of route.meta.children) {
@ -836,7 +851,8 @@ export default {
return { return {
listScrollbarRef, listScrollbarRef,
load, load,
action, reload,
onClick,
config, config,
queryModel, queryModel,
buildQuery, buildQuery,

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/role.js

@ -1,6 +1,7 @@
const schema = { const schema = {
title: "角色", title: "角色",
type: "object", type: "object",
disableSelection: true,
properties: { properties: {
name: { name: {
title: "角色名", title: "角色名",

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/user.js

@ -1,6 +1,7 @@
const schema = { const schema = {
title: "用户", title: "用户",
type: "object", type: "object",
disableSelection: true,
properties: { properties: {
userName: { userName: {
title: "用户名", title: "用户名",
@ -59,10 +60,7 @@ const schema = {
title: "邮箱", title: "邮箱",
type: "string", type: "string",
showForList: true, showForList: true,
rules: [ rules: [{ required: true }, { pattern: "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z]{2,4})+$", message: "%s必须是正确的格式" }],
{ required: true },
{ pattern: "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z]{2,4})+$", message: "%s必须是正确的格式" },
],
}, },
roleNames: { roleNames: {
title: "角色", title: "角色",

0
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/centralized-control.js → code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/version.js

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/fa-yun.js

@ -313,10 +313,10 @@ export default function (businessType) {
let schema = null; let schema = null;
let service = null; let service = null;
const syncService = "hand-se-sync/sync"; const syncService = "hand-se-sync/sync";
if (businessType === "JisBBAC") { if (businessType === "JisBBAC" || businessType === "MaiDanJianBBAC") {
schema = schema1; schema = schema1;
service = "bbac_se_detail_service"; service = "bbac_se_detail_service";
} else if (businessType === "JisHBPO") { } else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") {
schema = schema1; schema = schema1;
service = "hbpo_se_detail_service"; service = "hbpo_se_detail_service";
} else { } else {

46
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js

@ -9,23 +9,23 @@ import { ElMessage, ElMessageBox } from "element-plus";
// baseURL: "/api", // baseURL: "/api",
// }; // };
const addToken = async (options) => { async function addToken(options) {
if (await isLogin()) { if (await isLogin()) {
const appStore = useAppStore(); const appStore = useAppStore();
options.headers ??= {}; options.headers ??= {};
options.headers.Authorization = `Bearer ${appStore.token}`; options.headers.Authorization = `Bearer ${appStore.token}`;
} }
}; }
const getUrl = (url) => { function getUrl(url) {
if (url.startsWith("http")) { if (url.startsWith("http")) {
return url; return url;
} }
let result = settings.baseURL; let result = settings.baseURL;
return (result += `/${url}`); return (result += `/${url}`);
}; }
const getResult = async (response) => { async function getResult(response) {
const messages = new Map([ const messages = new Map([
[200, "操作成功"], [200, "操作成功"],
[201, "已创建"], [201, "已创建"],
@ -59,9 +59,9 @@ const getResult = async (response) => {
ElMessageBox.alert(`${result.errors?.error?.message ?? messages.get(response.status) ?? result.status}`, `${result.errors?.error?.code ?? "错误"}`); ElMessageBox.alert(`${result.errors?.error?.message ?? messages.get(response.status) ?? result.status}`, `${result.errors?.error?.code ?? "错误"}`);
} }
return result; return result;
}; }
async function request(url, data, options, withoutToken = false) { async function request(url, data, options, notify = false) {
url = getUrl(url); url = getUrl(url);
let defaultOptions = { let defaultOptions = {
method: "POST", method: "POST",
@ -87,18 +87,28 @@ async function request(url, data, options, withoutToken = false) {
defaultOptions.body = JSON.stringify(data); defaultOptions.body = JSON.stringify(data);
} }
} }
if (!withoutToken) { await addToken(defaultOptions);
await addToken(defaultOptions);
}
const response = await fetch(url, defaultOptions); const response = await fetch(url, defaultOptions);
// if (!result.data?.code || result.data.code === 200) { const result = await getResult(response);
// ElMessage({ if (!result.errors && notify && (!result.data?.code || result.data.code === 200)) {
// type: "success", ElMessage({
// message: "操作成功", type: "success",
// }); message: "操作成功",
// } });
return getResult(response); }
if (result.data?.code && result.data.code !== 200) {
result.errors = result.data.message;
}
return result;
}
async function get(url, data, notify = false) {
return await request(url, data, { method: "GET" }, notify);
}
async function post(url, data, notify = false) {
return await request(url, data, { method: "POST" }, notify);
} }
export default request; export default request;
export { getUrl }; export { getUrl, get, post };

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js

@ -23,7 +23,7 @@ export default [
children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
}, },
{ {
...createPage("centralized-control", "title=期间设置"), ...createPage("version", "title=期间设置"),
children: [ children: [
createButton("query", "title=查询&isTop=true"), createButton("query", "title=查询&isTop=true"),
createButton("create", "title=新建&isTop=true"), createButton("create", "title=新建&isTop=true"),

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/user.js

@ -13,11 +13,7 @@ export default {
const onCommand = async (item, rows) => { const onCommand = async (item, rows) => {
if (item.path === "reset-password") { if (item.path === "reset-password") {
const url = `base/user/${rows[0].id}/${item.path}`; const url = `base/user/${rows[0].id}/${item.path}`;
await appListRef.value.action( await appListRef.value.onClick(async () => await request(url, null, { method: item.meta.method }, true), `是否重置用户${rows[0].userName}密码?`, false);
async () => await request(url, null, { method: item.meta.method }),
`是否重置用户${rows[0].userName}密码?`,
`${rows[0].userName}密码已经重置为123456`
);
} }
}; };
return { appListRef, config, onCommand }; return { appListRef, config, onCommand };

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/centralized-control.js → code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/base-data/version.js

@ -2,9 +2,8 @@ import html from "html";
import { ref } from "vue"; import { ref } from "vue";
import request from "../../request/index.js"; import request from "../../request/index.js";
import AppList from "../../components/list/index.js"; import AppList from "../../components/list/index.js";
import useConfig from "../../models/base-data/centralized-control.js"; import useConfig from "../../models/base-data/version.js";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { format } from "../../utils/index.js";
export default { export default {
components: { AppList }, components: { AppList },
Loading…
Cancel
Save