Browse Source

前端添加生成对比查询表单

master
wanggang 1 year ago
parent
commit
84e6647bef
  1. 93
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  2. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/layouts/menu-item.js

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

@ -227,12 +227,27 @@ export default {
/> />
</template> </template>
<template v-else-if="editFormMode==='export'"> <template v-else-if="editFormMode==='export'">
<el-form :model="exportModel"> <el-form :model="exportModel" style="height:100%;">
<el-form-item :label="$t('全部')"> <el-form-item label="选择期间" label-width="100px">
<el-switch v-model="exportModel.includeAll" /> <el-select v-model="exportModel.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="100px">
<el-date-picker v-model="exportModel.date1" value-format="YYYY-MM-DD" />
<span style="margin:0 .5em;">-</span>
<el-date-picker v-model="exportModel.date2" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="下线日期" label-width="100px">
<el-date-picker v-model="exportModel.date3" value-format="YYYY-MM-DD" />
<span style="margin:0 .5em;">-</span>
<el-date-picker v-model="exportModel.date4" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="通用码" label-width="100px">
<el-input type="textarea" v-model="exportModel.pn" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('已删除')"> <el-form-item label="客户零件号" label-width="100px">
<el-switch v-model="exportModel.includeDeleted" /> <el-input type="textarea" v-model="exportModel.lu" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
@ -391,16 +406,22 @@ export default {
const editFormTitle = ref(""); const editFormTitle = ref("");
const editFormSchema = ref(null); const editFormSchema = ref(null);
const editFormModel = ref(null); const editFormModel = ref(null);
const exportModel = reactive({ const defaultExportModel = {
includeAll: false, version: "",
includeDeleted: false, date1: "",
}); date2: "",
const importModel = reactive({ date3: "",
// partial: true, date4: "",
// replace: false, ln: "",
pn: "",
enumBusinessType: route.meta.enumBusinessType,
};
const exportModel = ref(defaultExportModel);
const defaultImportModel = {
factory: "", factory: "",
version: "", version: "",
}); };
const importModel = ref(defaultExportModel);
const factories = ref([]); const factories = ref([]);
const versions = ref([]); const versions = ref([]);
const fileList = ref([]); const fileList = ref([]);
@ -550,7 +571,7 @@ export default {
await load(); await load();
} else if (item.path === "export") { } else if (item.path === "export") {
//export //export
if ((item.pattern = "paged")) { if (item.pattern === "paged") {
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();
@ -558,13 +579,21 @@ export default {
if (!response.errors) { if (!response.errors) {
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`));
} }
} else { } else if (item.meta.isTop) {
editFormTitle.value = `${t(item.path)}${querySchema.value?.title}`; exportModel.value = defaultExportModel;
versions.value = (
await request("settleaccount/centralized-control/get-all", null, { method: "POST" })
).data.items.map((o) => ({
value: o.version,
label: o.version,
}));
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`;
dialogVisible.value = true; dialogVisible.value = true;
} }
} else if (item.path === "import") { } else if (item.path === "import") {
//import //import
try { try {
importModel.value = Object.assign({}, defaultImportModel);
editFormloading.value = true; editFormloading.value = true;
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`; editFormTitle.value = `${t(item.path)}${config.query.schema.title}`;
fileList.value = []; fileList.value = [];
@ -624,20 +653,22 @@ export default {
dialogVisible.value = false; dialogVisible.value = false;
editFormMode.value = null; editFormMode.value = null;
} else if (editFormMode.value === "export") { } else if (editFormMode.value === "export") {
const postData = JSON.parse(JSON.stringify(queryModel.value)); // const postData = JSON.parse(JSON.stringify(queryModel.value));
postData.filters = filterList.value.filter((o) => o.property && o.value); // postData.filters = filterList.value.filter((o) => o.property && o.value);
delete postData.query["items"]; // delete postData.query["items"];
delete postData.query["id"]; // delete postData.query["id"];
const url = `${baseUrl}/${editFormMode.value}?${qs.stringify(exportModel)}`; // const url = `${baseUrl}/${editFormMode.value}?${qs.stringify(exportModel)}`;
const response = await post(url, postData); // const response = await post(url, postData);
download(response); // download(response);
const url = config.edit.exportUrl;
await request(url, exportModel.value, { method: config.edit.exportMethod });
dialogVisible.value = false; dialogVisible.value = false;
} else if (editFormMode.value === "import") { } else if (editFormMode.value === "import") {
editFormloading.value = true; editFormloading.value = true;
const url = config.edit.importUrl; const url = config.edit.importUrl;
const formData = new FormData(); const formData = new FormData();
formData.append("version", importModel.version); formData.append("version", importModel.value.version);
formData.append("factory", importModel.factory); formData.append("factory", importModel.value.factory);
for (let i = 0; i < fileList.value.length; i++) { for (let i = 0; i < fileList.value.length; i++) {
formData.append(`files`, fileList.value[i].raw); formData.append(`files`, fileList.value[i].raw);
} }
@ -788,18 +819,6 @@ export default {
queryModel.value = schemaToModel(config.query.schema); queryModel.value = schemaToModel(config.query.schema);
getSortModel(queryModel.value); getSortModel(queryModel.value);
filterList.value = queryModel.value?.filters ?? []; filterList.value = queryModel.value?.filters ?? [];
//pushfilterList();
// if (!querySchema.value) {
// const vm = (await get(indexUrl)).data;
// querySchema.value = vm.schema.properties.query;
// tableSchema.value = vm.schema.properties.items.items;
// data.value = vm.model ?? schemaToModel(vm.schema);
// if (props.query) {
// Object.assign(data.value.query, props.query);
// }
// getSortModel(data.value);
// getColumns(vm.schema.properties.query);
// }
getColumns(config.table.schema); getColumns(config.table.schema);
if (props.query) { if (props.query) {
Object.assign(queryModel.value.query, props.query); Object.assign(queryModel.value.query, props.query);

8
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/layouts/menu-item.js

@ -1,6 +1,8 @@
import html from "html"; import html from "html";
import { defineAsyncComponent, reactive, watch } from "vue"; import { defineAsyncComponent, reactive, watch } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useAppStore } from "../store/index.js";
import { ElMessageBox } from "element-plus";
export default { export default {
name: "menuItem", name: "menuItem",
@ -33,6 +35,7 @@ export default {
}, },
}, },
setup(props, context) { setup(props, context) {
const appStore = useAppStore();
const router = useRouter(); const router = useRouter();
const model = reactive(props.modelValue); const model = reactive(props.modelValue);
watch( watch(
@ -45,6 +48,11 @@ export default {
// //
const click = (route) => { const click = (route) => {
if (!route.meta.isExternal) { if (!route.meta.isExternal) {
// if (appStore.routes.length >= 10) {
// ElMessageBox.alert(`已经页签数量`, `提示`);
// } else {
// router.push(route.meta.path);
// }
router.push(route.meta.path); router.push(route.meta.path);
} else { } else {
window.open(route.path); window.open(route.path);

Loading…
Cancel
Save