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 v-else-if="editFormMode==='export'">
<el-form :model="exportModel">
<el-form-item :label="$t('全部')">
<el-switch v-model="exportModel.includeAll" />
<el-form :model="exportModel" style="height:100%;">
<el-form-item label="选择期间" label-width="100px">
<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 :label="$t('已删除')">
<el-switch v-model="exportModel.includeDeleted" />
<el-form-item label="客户零件号" label-width="100px">
<el-input type="textarea" v-model="exportModel.lu" />
</el-form-item>
</el-form>
</template>
@ -391,16 +406,22 @@ export default {
const editFormTitle = ref("");
const editFormSchema = ref(null);
const editFormModel = ref(null);
const exportModel = reactive({
includeAll: false,
includeDeleted: false,
});
const importModel = reactive({
// partial: true,
// replace: false,
const defaultExportModel = {
version: "",
date1: "",
date2: "",
date3: "",
date4: "",
ln: "",
pn: "",
enumBusinessType: route.meta.enumBusinessType,
};
const exportModel = ref(defaultExportModel);
const defaultImportModel = {
factory: "",
version: "",
});
};
const importModel = ref(defaultExportModel);
const factories = ref([]);
const versions = ref([]);
const fileList = ref([]);
@ -550,7 +571,7 @@ export default {
await load();
} else if (item.path === "export") {
//export
if ((item.pattern = "paged")) {
if (item.pattern === "paged") {
const url = config.edit.exportUrl;
const method = config.edit.exportMethod;
const postData = buildQuery();
@ -558,13 +579,21 @@ export default {
if (!response.errors) {
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`));
}
} else {
editFormTitle.value = `${t(item.path)}${querySchema.value?.title}`;
} else if (item.meta.isTop) {
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;
}
} else if (item.path === "import") {
//import
try {
importModel.value = Object.assign({}, defaultImportModel);
editFormloading.value = true;
editFormTitle.value = `${t(item.path)}${config.query.schema.title}`;
fileList.value = [];
@ -624,20 +653,22 @@ export default {
dialogVisible.value = false;
editFormMode.value = null;
} else if (editFormMode.value === "export") {
const postData = JSON.parse(JSON.stringify(queryModel.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)}`;
const response = await post(url, postData);
download(response);
// const postData = JSON.parse(JSON.stringify(queryModel.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)}`;
// const response = await post(url, postData);
// download(response);
const url = config.edit.exportUrl;
await request(url, exportModel.value, { method: config.edit.exportMethod });
dialogVisible.value = false;
} else if (editFormMode.value === "import") {
editFormloading.value = true;
const url = config.edit.importUrl;
const formData = new FormData();
formData.append("version", importModel.version);
formData.append("factory", importModel.factory);
formData.append("version", importModel.value.version);
formData.append("factory", importModel.value.factory);
for (let i = 0; i < fileList.value.length; i++) {
formData.append(`files`, fileList.value[i].raw);
}
@ -788,18 +819,6 @@ export default {
queryModel.value = schemaToModel(config.query.schema);
getSortModel(queryModel.value);
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);
if (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 { defineAsyncComponent, reactive, watch } from "vue";
import { useRouter } from "vue-router";
import { useAppStore } from "../store/index.js";
import { ElMessageBox } from "element-plus";
export default {
name: "menuItem",
@ -33,6 +35,7 @@ export default {
},
},
setup(props, context) {
const appStore = useAppStore();
const router = useRouter();
const model = reactive(props.modelValue);
watch(
@ -45,6 +48,11 @@ export default {
//
const click = (route) => {
if (!route.meta.isExternal) {
// if (appStore.routes.length >= 10) {
// ElMessageBox.alert(`已经页签数量`, `提示`);
// } else {
// router.push(route.meta.path);
// }
router.push(route.meta.path);
} else {
window.open(route.path);

Loading…
Cancel
Save