master
xy 1 year ago
parent b0744d1357
commit 119f2d3fb0

@ -8,7 +8,7 @@ import { Loading, Message } from "element-ui";
*/ */
let loading; let loading;
export async function download(url, method = "get", info, filename) { export async function download(url, method = "get", info, filename, paramsSerializer) {
loading = Loading.service({ loading = Loading.service({
lock: true, lock: true,
background: "rgba(0,0,0,0.4)", background: "rgba(0,0,0,0.4)",
@ -27,6 +27,7 @@ export async function download(url, method = "get", info, filename) {
withCredentials: true, withCredentials: true,
Authorization: "Bearer " + getToken(), Authorization: "Bearer " + getToken(),
}, },
paramsSerializer
}; };
if (method === "get") { if (method === "get") {
Object.defineProperty(options, "params", { Object.defineProperty(options, "params", {

@ -194,3 +194,42 @@ export function download(url) {
// 清理下载链接 // 清理下载链接
document.body.removeChild(downloadLink); document.body.removeChild(downloadLink);
} }
export function paramsSerializer(params) {
const parts = [];
// 递归处理嵌套对象
const serialize = (obj, parentKey) => {
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const value = obj[key];
const fullKey = parentKey ? `${parentKey}[${key}]` : key;
if (value && typeof value === 'object' && !Array.isArray(value)) {
// 如果是嵌套对象,递归处理
serialize(value, fullKey);
} else if (Array.isArray(value)) {
// 如果是数组,遍历数组并处理每个元素
value.forEach((item, index) => {
if (item && typeof item === 'object') {
// 如果数组元素是对象,递归处理
serialize(item, `${fullKey}[${index}]`);
} else {
// 如果数组元素是普通值,直接序列化
parts.push(`${encodeURIComponent(`${fullKey}[${index}]`)}=${encodeURIComponent(item)}`);
}
});
} else {
// 如果是普通键值对,直接序列化
parts.push(`${encodeURIComponent(fullKey)}=${encodeURIComponent(value)}`);
}
}
}
};
// 开始序列化
serialize(params, '');
// 将部分拼接为查询字符串
return parts.join('&');
}

@ -182,7 +182,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/area/area"; import { destroy, index, save } from "@/api/area/area";
import AddArea from "./components/AddArea.vue"; import AddArea from "./components/AddArea.vue";
@ -254,13 +254,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -331,7 +331,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save, clone } from "@/api/aspiration/aspiration"; import { destroy, index, save, clone } from "@/api/aspiration/aspiration";
import AddAspiration from "./components/AddAspiration.vue"; import AddAspiration from "./components/AddAspiration.vue";
@ -442,13 +442,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -326,7 +326,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/batch/batch"; import { destroy, index, save } from "@/api/batch/batch";
import { save as batchSubSave } from "@/api/batch-sub/batch-sub"; import { save as batchSubSave } from "@/api/batch-sub/batch-sub";
@ -439,13 +439,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -14,6 +14,17 @@
></vxe-button> ></vxe-button>
</template> </template>
<template #buttons> <template #buttons>
<el-input style="width: 100px;" clearable size="small" v-model="select.name" placeholder="姓名.."></el-input>
<el-input style="width: 120px;" clearable size="small" v-model="select.mobile" placeholder="联系电话.."></el-input>
<el-date-picker style="width: 120px;" clearable size="small" v-model="select.year" value-format="yyyy" type="year" placeholder="年份.."></el-date-picker>
<el-cascader v-model="select['filter[0][value]']"
placeholder="填报表.."
size="small"
clearable
:options="groupAspiration"
:props="{
emitPath: false
}"></el-cascader>
<el-button <el-button
v-if="isHasAuth('search')" v-if="isHasAuth('search')"
icon="el-icon-search" icon="el-icon-search"
@ -159,12 +170,13 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/batch-data/batch-data"; import { destroy, index, save } from "@/api/batch-data/batch-data";
import ShowBatchData from "./components/ShowBatchData.vue"; import ShowBatchData from "./components/ShowBatchData.vue";
import axios from "axios"; import axios from "axios";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import {index as aspirationIndex} from "@/api/aspiration/aspiration";
export default { export default {
name: "BatchData", name: "BatchData",
@ -185,6 +197,12 @@ export default {
page_size: 20, page_size: 20,
keyword: "", keyword: "",
show_relation: ["aspiration", "user"], show_relation: ["aspiration", "user"],
name: "",
mobile: "",
year: "",
"filter[0][key]": 'aspiration_id',
"filter[0][op]": 'eq',
"filter[0][value]": ''
}, },
total: 0, total: 0,
allAlign: null, allAlign: null,
@ -193,9 +211,34 @@ export default {
id: "", id: "",
}, },
validRules: {}, validRules: {},
aspiration: [],
}; };
}, },
computed: { computed: {
groupAspiration() {
const yearMap = {};
//
this.aspiration.forEach(item => {
if (!yearMap[item.year]) {
yearMap[item.year] = {
value: item.year,
label: `${item.year}`,
children: []
};
}
yearMap[item.year].children.push({
value: item.id,
label: item.name
//
});
});
//
return Object.values(yearMap);
},
isActiveStatus() { isActiveStatus() {
return function (row) { return function (row) {
if (this.$refs["table"]) { if (this.$refs["table"]) {
@ -210,6 +253,7 @@ export default {
}, },
}, },
created() { created() {
this.getAspiration();
this.getList(); this.getList();
}, },
mounted() { mounted() {
@ -224,13 +268,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {
@ -278,6 +327,20 @@ export default {
default: default:
} }
}, },
async getAspiration() {
try {
const res = await aspirationIndex(
{
page: 1,
page_size: 999,
},
false
);
this.aspiration = res.data;
} catch (err) {
console.error(err);
}
},
async detail(row) { async detail(row) {
await this.$refs["ShowBatchData"].getDetail(row.id); await this.$refs["ShowBatchData"].getDetail(row.id);
this.isShowDetail = true; this.isShowDetail = true;
@ -407,6 +470,9 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .vxe-buttons--wrapper > * + * {
margin-left: 10px;
}
::v-deep .el-card__header { ::v-deep .el-card__header {
padding: 6px 20px; padding: 6px 20px;
} }

@ -331,7 +331,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/batch-sub/batch-sub"; import { destroy, index, save } from "@/api/batch-sub/batch-sub";
import AddBatchSub from "./components/AddBatchSub.vue"; import AddBatchSub from "./components/AddBatchSub.vue";
@ -462,13 +462,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -302,7 +302,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/batch-sub-school/batch-sub-school"; import { destroy, index, save } from "@/api/batch-sub-school/batch-sub-school";
import AddBatchSubSchool from "./components/AddBatchSubSchool.vue"; import AddBatchSubSchool from "./components/AddBatchSubSchool.vue";
@ -427,13 +427,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -326,7 +326,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { import {
destroy, destroy,
@ -465,13 +465,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -316,7 +316,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import {deepCopy, download as downloadByTA} from "@/utils"; import {deepCopy, download as downloadByTA, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { import {
destroy, destroy,
@ -416,13 +416,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -259,7 +259,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/recommend/recommend"; import { destroy, index, save } from "@/api/recommend/recommend";
import AddRecommend from "./components/AddRecommend.vue"; import AddRecommend from "./components/AddRecommend.vue";
@ -357,13 +357,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -378,7 +378,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/recommend-form/recommend-form"; import { destroy, index, save } from "@/api/recommend-form/recommend-form";
import AddRecommendForm from "./components/AddRecommendForm.vue"; import AddRecommendForm from "./components/AddRecommendForm.vue";
@ -466,13 +466,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -397,7 +397,7 @@ import RichTextModal from "@/components/RichTextModal/index.vue";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy, download as downloadByTA } from "@/utils"; import {deepCopy, download as downloadByTA, paramsSerializer} from "@/utils";
import { destroy, index, save } from "@/api/school/school"; import { destroy, index, save } from "@/api/school/school";
import AddSchool from "./components/AddSchool.vue"; import AddSchool from "./components/AddSchool.vue";
import ShowSchool from "./components/ShowSchool.vue"; import ShowSchool from "./components/ShowSchool.vue";
@ -524,20 +524,27 @@ export default {
this.$confirm("请选择导出方式", "提示", { this.$confirm("请选择导出方式", "提示", {
confirmButtonText: "全量导出", confirmButtonText: "全量导出",
cancelButtonText: "部分导出", cancelButtonText: "部分导出",
distinguishCancelAndClose: true distinguishCancelAndClose: true,
}).then(_ => { })
download('/api/admin/school/index', 'get', { .then((_) => {
...this.select, const tableColumns = this.$refs['table'].getFullColumns()
page: 1, let export_fields = {}
page_size: 9999, Object.keys(this.form).forEach(key => {
is_export: 1, export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
export_fields: Object.keys(this.form) })
download("/api/admin/school/index", "get", {
...this.select,
page: 1,
page_size: 9999,
is_export: 1,
export_fields
}, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
}).catch(action => { .catch((action) => {
if (action === 'cancel' && this.$refs['table']) { if (action === "cancel" && this.$refs["table"]) {
this.$refs['table'].openExport() this.$refs["table"].openExport();
} }
}); });
}, },
calcTableHeight() { calcTableHeight() {
let clientHeight = document.documentElement.clientHeight; let clientHeight = document.documentElement.clientHeight;

@ -294,7 +294,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import {deepCopy, download as downloadByTA} from "@/utils"; import {deepCopy, download as downloadByTA, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/score/score"; import { destroy, index, save } from "@/api/score/score";
import AddScore from "./components/AddScore.vue"; import AddScore from "./components/AddScore.vue";
@ -406,13 +406,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -258,7 +258,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import {deepCopy, download as downloadByTA, download as downloadByA} from "@/utils"; import {deepCopy, download as downloadByTA, download as downloadByA, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/specialty/specialty"; import { destroy, index, save } from "@/api/specialty/specialty";
import AddSpecialty from "./components/AddSpecialty.vue"; import AddSpecialty from "./components/AddSpecialty.vue";
@ -361,13 +361,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -326,7 +326,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import { deepCopy, paramsSerializer } from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/user/user"; import { destroy, index, save } from "@/api/user/user";
import AddUser from "./components/AddUser.vue"; import AddUser from "./components/AddUser.vue";
@ -446,13 +446,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

@ -243,7 +243,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"; import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings"; import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils"; import {deepCopy, paramsSerializer} from "@/utils";
import { download } from "@/utils/downloadRequest"; import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/user-follow/user-follow"; import { destroy, index, save } from "@/api/user-follow/user-follow";
import AddUserFollow from "./components/AddUserFollow.vue"; import AddUserFollow from "./components/AddUserFollow.vue";
@ -329,13 +329,18 @@ export default {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}) })
.then((_) => { .then((_) => {
const tableColumns = this.$refs['table'].getFullColumns()
let export_fields = {}
Object.keys(this.form).forEach(key => {
export_fields[key] = tableColumns.find(col => col.field === key)?.title || key
})
download("/api/admin/school/index", "get", { download("/api/admin/school/index", "get", {
...this.select, ...this.select,
page: 1, page: 1,
page_size: 9999, page_size: 9999,
is_export: 1, is_export: 1,
export_fields: Object.keys(this.form), export_fields
}); }, `${this.$route.meta.title}_${this.$moment().valueOf()}.xlsx`,paramsSerializer);
}) })
.catch((action) => { .catch((action) => {
if (action === "cancel" && this.$refs["table"]) { if (action === "cancel" && this.$refs["table"]) {

Loading…
Cancel
Save