feat(xispeak): 新增Excel校验按钮,调整按钮布局将下载模板/模板导入移出下拉菜单
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,9 @@
|
||||
<a-button type="primary" v-auth="'bg.xispeak:bg_xi_speak:exportXls'" preIcon="ant-design:download-outlined" @click="handleDownloadTemplate"
|
||||
>下载模板</a-button
|
||||
>
|
||||
<j-upload-button type="primary" v-auth="'bg.xispeak:bg_xi_speak:importExcel'" preIcon="ant-design:check-outlined" @click="handleCheckExcel"
|
||||
>模板校验</j-upload-button
|
||||
>
|
||||
<j-upload-button type="primary" v-auth="'bg.xispeak:bg_xi_speak:importExcel'" preIcon="ant-design:import-outlined" @click="handleImportByTemplate"
|
||||
>模板导入</j-upload-button
|
||||
>
|
||||
@@ -123,6 +126,7 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
getImportUrl,
|
||||
getExportXlsHeadersUrl,
|
||||
getImportExcelByEasyExcelUrl,
|
||||
getCheckExcelByEasyExcelUrl,
|
||||
getChildList,
|
||||
getChildListBatch,
|
||||
updateLaunchType,
|
||||
@@ -802,6 +806,25 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
await defHttp.uploadFile({ url: getImportExcelByEasyExcelUrl }, { file: data.file }, { success: isReturn });
|
||||
}
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
function clearQueryParams() {
|
||||
Object.keys(queryParam.value).forEach((key) => {
|
||||
delete queryParam.value[key];
|
||||
|
||||
Reference in New Issue
Block a user