!75 feat(excel): BgPartymatter/BgTakepulse 前端适配 Excel 导入导出
* feat(excel): BgPartymatter/BgTakepulse 前端适配 Excel 导入导出
This commit is contained in:
@@ -12,6 +12,10 @@ enum Api {
|
|||||||
deleteBatch = '/bgpartymatter/bgPartymatter/deleteBatch',
|
deleteBatch = '/bgpartymatter/bgPartymatter/deleteBatch',
|
||||||
importExcel = '/bgpartymatter/bgPartymatter/importExcel',
|
importExcel = '/bgpartymatter/bgPartymatter/importExcel',
|
||||||
exportXls = '/bgpartymatter/bgPartymatter/exportXls',
|
exportXls = '/bgpartymatter/bgPartymatter/exportXls',
|
||||||
|
importExcelByEasyExcel = '/bgpartymatter/bgPartymatter/importExcelByEasyExcel',
|
||||||
|
checkExcelByEasyExcel = '/bgpartymatter/bgPartymatter/checkExcelByEasyExcel',
|
||||||
|
exportXlsByEasyExcel = '/bgpartymatter/bgPartymatter/exportXlsByEasyExcel',
|
||||||
|
exportXlsHeaders = '/bgpartymatter/bgPartymatter/exportXlsHeaders',
|
||||||
saveBpmForm = '/bgpartymatter/bgPartymatter/saveBpmForm',
|
saveBpmForm = '/bgpartymatter/bgPartymatter/saveBpmForm',
|
||||||
setProcessVariable = '/act/process/setProcessVariable',
|
setProcessVariable = '/act/process/setProcessVariable',
|
||||||
bgPartymatterFeedbackList = '/bgpartymatter/bgPartymatter/listBgPartymatterFeedbackByMainId',
|
bgPartymatterFeedbackList = '/bgpartymatter/bgPartymatter/listBgPartymatterFeedbackByMainId',
|
||||||
@@ -31,6 +35,26 @@ export const getExportUrl = Api.exportXls;
|
|||||||
*/
|
*/
|
||||||
export const getImportUrl = Api.importExcel;
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EasyExcel 导入 api
|
||||||
|
*/
|
||||||
|
export const getImportExcelByEasyExcelUrl = Api.importExcelByEasyExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EasyExcel 校验 api
|
||||||
|
*/
|
||||||
|
export const getCheckExcelByEasyExcelUrl = Api.checkExcelByEasyExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EasyExcel 导出 api
|
||||||
|
*/
|
||||||
|
export const getExportXlsByEasyExcelUrl = Api.exportXlsByEasyExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EasyExcel 仅导出表头 api(模板下载)
|
||||||
|
*/
|
||||||
|
export const getExportXlsHeadersUrl = Api.exportXlsHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表接口
|
* 列表接口
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
@@ -45,7 +45,9 @@
|
|||||||
<template #tableTitle>
|
<template #tableTitle>
|
||||||
<a-button type="primary" v-auth="actionAuth.add" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
<a-button type="primary" v-auth="actionAuth.add" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||||
<a-button type="primary" v-auth="actionAuth.exportXls" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
<a-button type="primary" v-auth="actionAuth.exportXls" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
<!-- <j-upload-button type="primary" v-auth="actionAuth.importExcel" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>-->
|
<a-button type="primary" v-auth="actionAuth.exportXls" preIcon="ant-design:download-outlined" @click="handleDownloadTemplate">下载模板</a-button>
|
||||||
|
<j-upload-button type="primary" v-auth="actionAuth.importExcel" preIcon="ant-design:check-outlined" @click="handleCheckExcel">模板校验</j-upload-button>
|
||||||
|
<j-upload-button type="primary" v-auth="actionAuth.importExcel" preIcon="ant-design:import-outlined" @click="handleImportByTemplate">模板导入</j-upload-button>
|
||||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu>
|
<a-menu>
|
||||||
@@ -141,7 +143,10 @@
|
|||||||
import FlowScheduleStartModalForBG from '/src/components/semri/process/FlowScheduleStartModalForBG.vue';
|
import FlowScheduleStartModalForBG from '/src/components/semri/process/FlowScheduleStartModalForBG.vue';
|
||||||
import SUploadFile from '/@/components/semri/fileComponent/SUploadFile.vue';
|
import SUploadFile from '/@/components/semri/fileComponent/SUploadFile.vue';
|
||||||
import { columns, superQuerySchema, bgPartymatterFeedbackColumns } from './BgPartymatter.data';
|
import { columns, superQuerySchema, bgPartymatterFeedbackColumns } from './BgPartymatter.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, bgPartymatterFeedbackList, saveOrUpdate } from './BgPartymatter.api';
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getImportExcelByEasyExcelUrl, getCheckExcelByEasyExcelUrl, getExportXlsHeadersUrl, bgPartymatterFeedbackList, saveOrUpdate } from './BgPartymatter.api';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { showImportValidationErrors } from '/@/utils/helper/importError';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -600,6 +605,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
/* ----------------------以下为原生查询需要添加的-------------------------- */
|
/* ----------------------以下为原生查询需要添加的-------------------------- */
|
||||||
|
const { createMessage } = useMessage();
|
||||||
const toggleSearchStatus = ref<boolean>(false);
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
const labelCol = reactive({
|
const labelCol = reactive({
|
||||||
xs:24,
|
xs:24,
|
||||||
@@ -612,6 +618,60 @@
|
|||||||
sm: 20,
|
sm: 20,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function handleDownloadTemplate() {
|
||||||
|
const data = await defHttp.get({ url: getExportXlsHeadersUrl, params: {}, responseType: 'blob', timeout: 60000 }, { isTransformResponse: false });
|
||||||
|
if (!data) {
|
||||||
|
createMessage.warning('文件下载失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const blob = new Blob([data]);
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = URL.createObjectURL(blob);
|
||||||
|
link.download = '党建议题-导入模板.xls';
|
||||||
|
link.click();
|
||||||
|
URL.revokeObjectURL(link.href);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCheckExcel(data) {
|
||||||
|
const isReturn = (fileInfo) => {
|
||||||
|
try {
|
||||||
|
if (fileInfo.code === 500 || fileInfo.code === 510) {
|
||||||
|
if (fileInfo.result && Array.isArray(fileInfo.result) && fileInfo.result.length > 0) {
|
||||||
|
showImportValidationErrors(fileInfo.message || `${data.file.name} 校验失败`, fileInfo.result);
|
||||||
|
} else {
|
||||||
|
createMessage.error(fileInfo.message || `${data.file.name} 校验失败`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
createMessage.success(fileInfo.message || `${data.file.name} 校验通过`);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await defHttp.uploadFile({ url: getCheckExcelByEasyExcelUrl }, { file: data.file }, { success: isReturn });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleImportByTemplate(data) {
|
||||||
|
const isReturn = (fileInfo) => {
|
||||||
|
try {
|
||||||
|
if (fileInfo.code === 500 || fileInfo.code === 510) {
|
||||||
|
if (fileInfo.result && Array.isArray(fileInfo.result) && fileInfo.result.length > 0) {
|
||||||
|
showImportValidationErrors(fileInfo.message || `${data.file.name} 导入失败`, fileInfo.result);
|
||||||
|
} else {
|
||||||
|
createMessage.error(fileInfo.message || `${data.file.name} 导入失败`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
createMessage.success(fileInfo.message || `${data.file.name} 导入成功`);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
} finally {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await defHttp.uploadFile({ url: getImportExcelByEasyExcelUrl }, { file: data.file }, { success: isReturn });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置
|
* 重置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ enum Api {
|
|||||||
deleteBatch = '/bqtakepulse/bgTakepulse/deleteBatch',
|
deleteBatch = '/bqtakepulse/bgTakepulse/deleteBatch',
|
||||||
importExcel = '/bqtakepulse/bgTakepulse/importExcel',
|
importExcel = '/bqtakepulse/bgTakepulse/importExcel',
|
||||||
exportXls = '/bqtakepulse/bgTakepulse/exportXls',
|
exportXls = '/bqtakepulse/bgTakepulse/exportXls',
|
||||||
|
importExcelByEasyExcel = '/bqtakepulse/bgTakepulse/importExcelByEasyExcel',
|
||||||
|
checkExcelByEasyExcel = '/bqtakepulse/bgTakepulse/checkExcelByEasyExcel',
|
||||||
|
exportXlsByEasyExcel = '/bqtakepulse/bgTakepulse/exportXlsByEasyExcel',
|
||||||
|
exportXlsHeaders = '/bqtakepulse/bgTakepulse/exportXlsHeaders',
|
||||||
queryDataById = '/bqtakepulse/bgTakepulse/queryById',
|
queryDataById = '/bqtakepulse/bgTakepulse/queryById',
|
||||||
bgTakepulseFeedbackList = '/bqtakepulse/bgTakepulse/queryBgTakepulseFeedbackByMainId',
|
bgTakepulseFeedbackList = '/bqtakepulse/bgTakepulse/queryBgTakepulseFeedbackByMainId',
|
||||||
saveBpmForm = '/bqtakepulse/bgTakepulse/saveBpmForm',
|
saveBpmForm = '/bqtakepulse/bgTakepulse/saveBpmForm',
|
||||||
@@ -32,6 +36,11 @@ export const getExportUrl = Api.exportXls;
|
|||||||
*/
|
*/
|
||||||
export const getImportUrl = Api.importExcel;
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
export const getImportExcelByEasyExcelUrl = Api.importExcelByEasyExcel;
|
||||||
|
export const getCheckExcelByEasyExcelUrl = Api.checkExcelByEasyExcel;
|
||||||
|
export const getExportXlsByEasyExcelUrl = Api.exportXlsByEasyExcel;
|
||||||
|
export const getExportXlsHeadersUrl = Api.exportXlsHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询子表数据
|
* 查询子表数据
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
<template #tableTitle>
|
<template #tableTitle>
|
||||||
<a-button type="primary" v-auth="'bqtakepulse:bg_takepulse:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
<a-button type="primary" v-auth="'bqtakepulse:bg_takepulse:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||||
<a-button type="primary" v-auth="'bqtakepulse:bg_takepulse:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
<a-button type="primary" v-auth="'bqtakepulse:bg_takepulse:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
<!-- <j-upload-button type="primary" v-auth="'bqtakepulse:bg_takepulse:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>-->
|
<a-button type="primary" v-auth="'bqtakepulse:bg_takepulse:exportXls'" preIcon="ant-design:download-outlined" @click="handleDownloadTemplate">下载模板</a-button>
|
||||||
|
<j-upload-button type="primary" v-auth="'bqtakepulse:bg_takepulse:importExcel'" preIcon="ant-design:check-outlined" @click="handleCheckExcel">模板校验</j-upload-button>
|
||||||
|
<j-upload-button type="primary" v-auth="'bqtakepulse:bg_takepulse:importExcel'" preIcon="ant-design:import-outlined" @click="handleImportByTemplate">模板导入</j-upload-button>
|
||||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu>
|
<a-menu>
|
||||||
@@ -143,7 +145,10 @@
|
|||||||
import {useModal} from '/@/components/Modal';
|
import {useModal} from '/@/components/Modal';
|
||||||
import BgTakepulseModal from './components/BgTakepulseModal.vue'
|
import BgTakepulseModal from './components/BgTakepulseModal.vue'
|
||||||
import {columns, superQuerySchema} from './BgTakepulse.data';
|
import {columns, superQuerySchema} from './BgTakepulse.data';
|
||||||
import {list, deleteOne, getImportUrl, getExportUrl, saveOrUpdate, bgTakepulseFeedbackList} from './BgTakepulse.api';
|
import {list, deleteOne, getImportUrl, getExportUrl, getImportExcelByEasyExcelUrl, getCheckExcelByEasyExcelUrl, getExportXlsHeadersUrl, saveOrUpdate, bgTakepulseFeedbackList} from './BgTakepulse.api';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { showImportValidationErrors } from '/@/utils/helper/importError';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
||||||
import SzSelectDept from '/@/components/Form/src/jeecg/components/SzSelectDept.vue';
|
import SzSelectDept from '/@/components/Form/src/jeecg/components/SzSelectDept.vue';
|
||||||
import Icon from '/@/components/Icon/index';
|
import Icon from '/@/components/Icon/index';
|
||||||
@@ -553,6 +558,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* ----------------------以下为原生查询需要添加的-------------------------- */
|
/* ----------------------以下为原生查询需要添加的-------------------------- */
|
||||||
|
const { createMessage } = useMessage();
|
||||||
const toggleSearchStatus = ref<boolean>(false);
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
const labelCol = reactive({
|
const labelCol = reactive({
|
||||||
xs:24,
|
xs:24,
|
||||||
@@ -567,6 +573,60 @@
|
|||||||
/**
|
/**
|
||||||
* 重置
|
* 重置
|
||||||
*/
|
*/
|
||||||
|
async function handleDownloadTemplate() {
|
||||||
|
const data = await defHttp.get({ url: getExportXlsHeadersUrl, params: {}, responseType: 'blob', timeout: 60000 }, { isTransformResponse: false });
|
||||||
|
if (!data) {
|
||||||
|
createMessage.warning('文件下载失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const blob = new Blob([data]);
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = URL.createObjectURL(blob);
|
||||||
|
link.download = '把把脉-导入模板.xls';
|
||||||
|
link.click();
|
||||||
|
URL.revokeObjectURL(link.href);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCheckExcel(data) {
|
||||||
|
const isReturn = (fileInfo) => {
|
||||||
|
try {
|
||||||
|
if (fileInfo.code === 500 || fileInfo.code === 510) {
|
||||||
|
if (fileInfo.result && Array.isArray(fileInfo.result) && fileInfo.result.length > 0) {
|
||||||
|
showImportValidationErrors(fileInfo.message || `${data.file.name} 校验失败`, fileInfo.result);
|
||||||
|
} else {
|
||||||
|
createMessage.error(fileInfo.message || `${data.file.name} 校验失败`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
createMessage.success(fileInfo.message || `${data.file.name} 校验通过`);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await defHttp.uploadFile({ url: getCheckExcelByEasyExcelUrl }, { file: data.file }, { success: isReturn });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleImportByTemplate(data) {
|
||||||
|
const isReturn = (fileInfo) => {
|
||||||
|
try {
|
||||||
|
if (fileInfo.code === 500 || fileInfo.code === 510) {
|
||||||
|
if (fileInfo.result && Array.isArray(fileInfo.result) && fileInfo.result.length > 0) {
|
||||||
|
showImportValidationErrors(fileInfo.message || `${data.file.name} 导入失败`, fileInfo.result);
|
||||||
|
} else {
|
||||||
|
createMessage.error(fileInfo.message || `${data.file.name} 导入失败`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
createMessage.success(fileInfo.message || `${data.file.name} 导入成功`);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
} finally {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await defHttp.uploadFile({ url: getImportExcelByEasyExcelUrl }, { file: data.file }, { success: isReturn });
|
||||||
|
}
|
||||||
|
|
||||||
function searchReset() {
|
function searchReset() {
|
||||||
formRef.value.resetFields();
|
formRef.value.resetFields();
|
||||||
selectedRowKeys.value = [];
|
selectedRowKeys.value = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user