Browse Source

导出修改提交

wangqin
Joe 10 months ago
parent
commit
63f36d6bd7
  1. 26
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/dutyOfficer/index.vue
  2. 15
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/emergencyAgencies/index.vue
  3. 15
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/index.vue
  4. 48
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/jurisdictionalManagement/index.vue
  5. 53
      ruoyi-ui/src/views/JiHeExpressway/utils/common.js

26
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/dutyOfficer/index.vue

@ -2,13 +2,13 @@
<div class='DutyOfficer'>
<div class="filter">
<div>
<ButtonGradient>
<ButtonGradient @click.native="handleExport">
<template #prefix>
<img src="@screen/images/import.svg" />
</template>
机构值班表
</ButtonGradient>
<ButtonGradient>
<ButtonGradient @click.native="handleExportTemplate">
<template #prefix>
<img src="@screen/images/import.svg" />
</template>
@ -111,7 +111,7 @@ import InputSearch from '@screen/components/InputSearch/index.vue';
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay } from "@screen/utils/common";
import { delay, exportFile } from "@screen/utils/common";
export default {
name: 'DutyOfficer',
@ -170,6 +170,26 @@ export default {
handleModifyDutyInformationTable(bool) {
this.modifyDutyInformationTableVisible = bool;
},
handleExport() {
exportFile({
url: "/business/shifts/export",
filename: "机构值班表",
data: {
...this.searchData,
...this.getPagination()
}
});
},
handleExportTemplate() {
exportFile({
url: "/business/shifts/exportModel",
filename: "机构值班表面板",
data: {
...this.searchData,
...this.getPagination()
}
});
},
handleSearch(data) {
this.searchData = data;
this.getData();

15
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/emergencyAgencies/index.vue

@ -8,7 +8,7 @@
</template>
新增
</ButtonGradient>
<ButtonGradient>
<ButtonGradient @click.native="handleExport">
<template #prefix>
<img src="@screen/images/export.svg" />
</template>
@ -54,8 +54,9 @@ import Button from '@screen/components/Buttons/Button.vue';
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay } from "@screen/utils/common";
import { delay, exportFile } from "@screen/utils/common";
//
export default {
name: 'EmergencyAgencies',
inject: ['getPagination', 'setTotal'],
@ -106,6 +107,16 @@ export default {
this.searchData = data;
this.getData();
},
handleExport() {
exportFile({
url: "/business/organization/export",
filename: "应急机构",
data: {
...this.searchData,
...this.getPagination()
}
});
},
async getData() {
const closeLoading = setLoading();

15
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/index.vue

@ -8,7 +8,7 @@
</template>
新增
</ButtonGradient>
<ButtonGradient>
<ButtonGradient @click.native="handleExport">
<template #prefix>
<img src="@screen/images/export.svg" />
</template>
@ -43,8 +43,9 @@ import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue';
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay } from "@screen/utils/common";
import { delay, exportFile } from "@screen/utils/common";
//
export default {
name: 'FirstResponders',
components: {
@ -98,6 +99,16 @@ export default {
})
},
handleExport() {
exportFile({
url: "/business/employees/export",
filename: "应急人员",
data: {
...this.searchData,
...this.getPagination()
}
});
},
handleSearch(data) {
this.searchData = data;
this.getData();

48
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/jurisdictionalManagement/index.vue

@ -8,7 +8,7 @@
</template>
新增
</ButtonGradient>
<ButtonGradient>
<ButtonGradient @click.native="handleExport">
<template #prefix>
<img src="@screen/images/export.svg" />
</template>
@ -60,8 +60,9 @@ import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue';
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay } from "@screen/utils/common";
import { delay, exportFile } from "@screen/utils/common";
//
export default {
name: 'JurisdictionalManagement',
components: {
@ -112,40 +113,15 @@ export default {
// this.getSearchOptions();
},
methods: {
getSearchOptions() {
Promise.allSettled([
//
request({
url: `/business/employees/sysPost`,
method: "post",
data: {}
}),
//
request({
url: `/business/employees/organization`,
method: "post",
data: {}
})
])
.then(([post, organization]) => {
if (post.status === 'fulfilled' && post.value.code == 200) {
this.searchFormList[0].options.options = post.value.data.map(item => ({
key: item.postId,
label: item.postName,
}))
}
if (organization.status === 'fulfilled' && organization.value.code == 200) {
this.searchFormList[1].options.options = organization.value.data.map(item => ({
key: item.id,
label: item.organizationName,
}))
}
console.log(this.searchFormList)
})
handleExport() {
// exportFile({
// url: "/business/employees/export",
// filename: "",
// data: {
// ...this.searchData,
// ...this.getPagination()
// }
// });
},
handleSearch(data) {
this.searchData = data;

53
ruoyi-ui/src/views/JiHeExpressway/utils/common.js

@ -1,3 +1,56 @@
import request from "@/utils/request";
import { Message } from "element-ui";
export function delay(ms = 240) {
return new Promise((resolve) => setTimeout(() => resolve(void 0), ms));
}
/**
*
* @param {{ method?: string; url: string; data?: string; type?: string; filename?: string; }} options
*/
export function exportFile({
url,
method = "post",
data,
type = "application/vnd.ms-excel",
filename = "download",
ext = "xlsx",
} = {}) {
if (!url) return;
const loadingMessage = Message.info({
message: `文件下载中...`,
duration: 0,
customClass: "loading-message",
iconClass: "el-icon-loading",
});
request({
url,
method,
responseType: "blob",
data: {
...data,
},
params: {
...data,
},
})
.then((result) => {
const blob = new Blob([result], { type });
const downloadElement = document.createElement("a");
const href = window.URL.createObjectURL(blob);
downloadElement.href = href;
downloadElement.download = result.filename || `${filename}.${ext}`;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
window.URL.revokeObjectURL(href);
Message.success("文件下载成功");
})
.catch((err) => {
Message.error("文件下载失败");
})
.finally(() => loadingMessage.close());
}

Loading…
Cancel
Save