feat: 添加更多文件类型支持,添加全部通过功能
This commit is contained in:
parent
ffdb1d07a3
commit
b21510f8a9
@ -44,6 +44,7 @@ buttons:Deselect: Deselect
|
||||
buttons:DeleteInBatches: Delete In Batches
|
||||
buttons:ExportInBatches: Export In Batches
|
||||
buttons:AgressInBatches: Agress In Batches
|
||||
buttons:AgressAll: Agress All
|
||||
buttons:DisagressInBatches: Disagress In Batches
|
||||
buttons:ExitInBatches: Exit In Batches
|
||||
buttons:ExportAll: Export All
|
||||
@ -55,7 +56,7 @@ buttons:ForceToExit: Force Exit
|
||||
buttons:DataAdmin: Data Admin
|
||||
buttons:Audit: Audit
|
||||
buttons:Feedback: Feedback
|
||||
buttons:ErrorRecovery: Error Recovery
|
||||
buttons:ErrorRecovery: Report Code Error
|
||||
search:Total: Total
|
||||
search:History: History
|
||||
search:Collect: Collect
|
||||
@ -125,8 +126,8 @@ menus:CodeQueryCount: Query Statistics
|
||||
menus:QueryCodedetails: Log Detail
|
||||
menus:DataQuality: Data Quality
|
||||
menus:DataImport: Data Import
|
||||
menus:DataFeedback: Data Feedback
|
||||
menus:DataMaintain: Data Export
|
||||
menus:DataFeedback: Data Review
|
||||
menus:DataMaintain: Data Maintenance
|
||||
status:Load: Loading...
|
||||
status:Message: Message
|
||||
status:Notify: Notify
|
||||
|
||||
@ -44,6 +44,7 @@ buttons:Deselect: 取消选择
|
||||
buttons:DeleteInBatches: 批量删除
|
||||
buttons:ExportInBatches: 批量导出
|
||||
buttons:AgressInBatches: 批量通过
|
||||
buttons:AgressAll: 全部通过
|
||||
buttons:DisagressInBatches: 批量驳回
|
||||
buttons:ExportAll: 全部导出
|
||||
buttons:UploadAvatar: 上传头像
|
||||
|
||||
@ -11,8 +11,8 @@ import { filterEmptyObject } from "./utils";
|
||||
/**
|
||||
* 获取编码模版
|
||||
*/
|
||||
export const getCodeTemplateAPI = () => {
|
||||
return http.request<Blob>("get", "/api/code/template", {
|
||||
export const getCodeTemplateAPI = (type: string) => {
|
||||
return http.request<Blob>("get", `/api/code/template/${type}`, {
|
||||
responseType: "blob" // 设置响应类型为 blob
|
||||
});
|
||||
};
|
||||
@ -20,8 +20,8 @@ export const getCodeTemplateAPI = () => {
|
||||
/**
|
||||
* 获取查询模版
|
||||
*/
|
||||
export const getQueryTemplateAPI = () => {
|
||||
return http.request<Blob>("get", "/api/code/queryTemplate", {
|
||||
export const getQueryTemplateAPI = (type: string) => {
|
||||
return http.request<Blob>("get", `/api/code/queryTemplate/${type}`, {
|
||||
responseType: "blob" // 设置响应类型为 blob
|
||||
});
|
||||
};
|
||||
@ -326,3 +326,8 @@ export const putCodeFeedbackAuditAPI = (data: {
|
||||
}) => {
|
||||
return http.request<null>("put", `/api/code/feedbackAudit`, { data });
|
||||
};
|
||||
|
||||
/**全部审核通过 */
|
||||
export const putCodeFeedbackAuditAllAPI = () => {
|
||||
return http.request<null>("put", `/api/codeImportAudit/all`);
|
||||
};
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<el-form-item label="查询文本" prop="query_text" class="w-[50%]">
|
||||
<el-input
|
||||
v-model="form.query_text"
|
||||
placeholder="请输入查询文本~"
|
||||
placeholder="请输入商品文本描述~"
|
||||
class="w-full"
|
||||
clearable
|
||||
type="textarea"
|
||||
@ -57,7 +57,6 @@
|
||||
<IconifyIconOffline
|
||||
:icon="UploadIcon"
|
||||
width="26"
|
||||
:limit="1"
|
||||
class="m-auto mb-2"
|
||||
/>
|
||||
可点击或拖拽上传
|
||||
@ -67,9 +66,24 @@
|
||||
<div class="flex items-center justify-center">
|
||||
<el-button
|
||||
class="w-full my-2"
|
||||
:disabled="hasAuth('code:btn:queryTemplate')"
|
||||
@click="onDownloadTemplate"
|
||||
>{{ t("buttons:DownLodedTemplate") }}</el-button
|
||||
type="success"
|
||||
:disabled="!hasAuth('code:btn:queryTemplate')"
|
||||
@click="onDownloadTemplate('xlsx')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.xlsx)</el-button
|
||||
>
|
||||
<el-button
|
||||
class="w-full my-2"
|
||||
type="warning"
|
||||
:disabled="!hasAuth('code:btn:queryTemplate')"
|
||||
@click="onDownloadTemplate('csv')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.csv)</el-button
|
||||
>
|
||||
<el-button
|
||||
class="w-full my-2"
|
||||
type="info"
|
||||
:disabled="!hasAuth('code:btn:queryTemplate')"
|
||||
@click="onDownloadTemplate('xls')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.xls)</el-button
|
||||
>
|
||||
<el-popconfirm title="是否确认上传?" @confirm="handleUpload">
|
||||
<template #reference>
|
||||
|
||||
@ -161,9 +161,9 @@ export const useIndex = (tableRef: Ref) => {
|
||||
tableRef.value.getTableRef().clearSelection();
|
||||
};
|
||||
/**下载模版文件 */
|
||||
const onDownloadTemplate = async () => {
|
||||
const onDownloadTemplate = async (type: string) => {
|
||||
try {
|
||||
const blob = await getQueryTemplateAPI();
|
||||
const blob = await getQueryTemplateAPI(type);
|
||||
|
||||
// 生成下载链接
|
||||
// @ts-ignore
|
||||
@ -172,7 +172,7 @@ export const useIndex = (tableRef: Ref) => {
|
||||
// 创建 <a> 元素并触发下载
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "上传模版.xlsx"; // 设置下载文件名,确保后缀名正确
|
||||
link.download = `上传模版.${type}`; // 设置下载文件名,确保后缀名正确
|
||||
document.body.appendChild(link); // 将 <a> 元素添加到 DOM 中
|
||||
link.click(); // 模拟点击下载
|
||||
|
||||
@ -184,13 +184,16 @@ export const useIndex = (tableRef: Ref) => {
|
||||
}
|
||||
};
|
||||
/** 上传文件前 */
|
||||
/** 上传文件前 */
|
||||
const beforeUpload = async file => {
|
||||
const isExcel =
|
||||
file.type ===
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || // xlsx
|
||||
file.type === "application/vnd.ms-excel" || // xls
|
||||
file.type === "text/csv" ||
|
||||
file.name.endsWith(".xlsx") || // 兼容部分浏览器
|
||||
file.name.endsWith(".xls"); // 兼容部分浏览器
|
||||
file.name.endsWith(".xls") || // 兼容部分浏览器
|
||||
file.name.endsWith(".csv"); // 兼容部分浏览器
|
||||
|
||||
// const maxSize = 20 * 1024 * 1024; // 20MB 限制
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
'纠错',
|
||||
row.result_text[0],
|
||||
row.query_text,
|
||||
row.result_text[0].code ?? ''
|
||||
row.result_text[0]?.code ?? ''
|
||||
)
|
||||
"
|
||||
>
|
||||
|
||||
@ -118,6 +118,7 @@
|
||||
v-model:file-list="fileList"
|
||||
drag
|
||||
action="#"
|
||||
:limit="10"
|
||||
class="w-full"
|
||||
:auto-upload="false"
|
||||
:before-upload="beforeUpload"
|
||||
@ -127,7 +128,6 @@
|
||||
<IconifyIconOffline
|
||||
:icon="UploadIcon"
|
||||
width="26"
|
||||
:limit="1"
|
||||
class="m-auto mb-2"
|
||||
/>
|
||||
可点击或拖拽上传
|
||||
@ -138,9 +138,26 @@
|
||||
<el-button
|
||||
v-if="hasAuth('code:btn:uploadTemplate')"
|
||||
class="w-full my-2"
|
||||
type="success"
|
||||
:disabled="!hasAuth('code:btn:uploadTemplate')"
|
||||
@click="onDownloadTemplate"
|
||||
>{{ t("buttons:DownLodedTemplate") }}</el-button
|
||||
@click="onDownloadTemplate('xlsx')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.xlsx)</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasAuth('code:btn:uploadTemplate')"
|
||||
class="w-full my-2"
|
||||
type="warning"
|
||||
:disabled="!hasAuth('code:btn:uploadTemplate')"
|
||||
@click="onDownloadTemplate('csv')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.csv)</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasAuth('code:btn:uploadTemplate')"
|
||||
class="w-full my-2"
|
||||
type="info"
|
||||
:disabled="!hasAuth('code:btn:uploadTemplate')"
|
||||
@click="onDownloadTemplate('csv')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.xls)</el-button
|
||||
>
|
||||
<el-popconfirm
|
||||
v-if="hasAuth('code:btn:import')"
|
||||
@ -175,6 +192,24 @@
|
||||
{{ t("buttons:Deselect") }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-popconfirm
|
||||
v-if="hasAuth('code:btn:codeImportAuditAll')"
|
||||
title="是否确认通过审核?"
|
||||
@confirm="onbatchAgreeAll"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button
|
||||
type="success"
|
||||
text
|
||||
class="mr-1"
|
||||
:disabled="
|
||||
selectedNum < 0 || !hasAuth('code:btn:codeImportAuditAll')
|
||||
"
|
||||
>
|
||||
{{ t("buttons:AgressAll") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-popconfirm
|
||||
v-if="hasAuth('code:btn:codeImportAudit')"
|
||||
title="是否确认通过审核?"
|
||||
@ -350,7 +385,8 @@ const {
|
||||
onDownloadTemplate,
|
||||
handleAudit,
|
||||
onbatchDisagree,
|
||||
onbatchAgree
|
||||
onbatchAgree,
|
||||
onbatchAgreeAll
|
||||
} = useCode(tableRef);
|
||||
</script>
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import {
|
||||
getCodeImportListAPI,
|
||||
getCodeTemplateAPI,
|
||||
postAddCodeAPI,
|
||||
putCodeFeedbackAuditAllAPI,
|
||||
putCodeImportAuditAPI,
|
||||
putUpdateCodeImportAPI
|
||||
} from "@/api/code";
|
||||
@ -358,9 +359,9 @@ export const useCode = (tableRef: Ref) => {
|
||||
});
|
||||
};
|
||||
/**下载模版文件 */
|
||||
const onDownloadTemplate = async () => {
|
||||
const onDownloadTemplate = async (type: string) => {
|
||||
try {
|
||||
const blob = await getCodeTemplateAPI();
|
||||
const blob = await getCodeTemplateAPI(type);
|
||||
|
||||
// 生成下载链接
|
||||
// @ts-ignore
|
||||
@ -369,7 +370,7 @@ export const useCode = (tableRef: Ref) => {
|
||||
// 创建 <a> 元素并触发下载
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "上传模版.xlsx"; // 设置下载文件名,确保后缀名正确
|
||||
link.download = `上传模版.${type}`; // 设置下载文件名,确保后缀名正确
|
||||
document.body.appendChild(link); // 将 <a> 元素添加到 DOM 中
|
||||
link.click(); // 模拟点击下载
|
||||
|
||||
@ -386,8 +387,10 @@ export const useCode = (tableRef: Ref) => {
|
||||
file.type ===
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || // xlsx
|
||||
file.type === "application/vnd.ms-excel" || // xls
|
||||
file.type === "text/csv" ||
|
||||
file.name.endsWith(".xlsx") || // 兼容部分浏览器
|
||||
file.name.endsWith(".xls"); // 兼容部分浏览器
|
||||
file.name.endsWith(".xls") || // 兼容部分浏览器
|
||||
file.name.endsWith(".csv"); // 兼容部分浏览器
|
||||
|
||||
// const maxSize = 20 * 1024 * 1024; // 20MB 限制
|
||||
|
||||
@ -414,11 +417,12 @@ export const useCode = (tableRef: Ref) => {
|
||||
uploadStatus.value = true;
|
||||
for (const file of fileList.value) {
|
||||
if (file.status === "success") {
|
||||
const data = await getAddCodeAPI(fileId.value);
|
||||
if (data.success) {
|
||||
message("导入成功!", { type: "success" });
|
||||
await onSearch();
|
||||
}
|
||||
// const data =
|
||||
await getAddCodeAPI(fileId.value);
|
||||
// if (data.success) {
|
||||
// message("导入成功", { type: "success" });
|
||||
// await onSearch();
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@ -430,11 +434,12 @@ export const useCode = (tableRef: Ref) => {
|
||||
fileId.value = res.data.id;
|
||||
message(`${res.data.name}上传成功!`, { type: "success" });
|
||||
fileIds.value.push(res.data);
|
||||
const data = await getAddCodeAPI(fileId.value);
|
||||
if (data.success) {
|
||||
message(`导入成功!`, { type: "success" });
|
||||
await onSearch();
|
||||
}
|
||||
// const data =
|
||||
await getAddCodeAPI(fileId.value);
|
||||
// if (data.success) {
|
||||
// message(`导入成功!`, { type: "success" });
|
||||
// await onSearch();
|
||||
// }
|
||||
} else {
|
||||
file.status = "fail";
|
||||
}
|
||||
@ -605,6 +610,18 @@ export const useCode = (tableRef: Ref) => {
|
||||
message(res.msg, { type: "error", duration: 5000 });
|
||||
}
|
||||
};
|
||||
/**全部通过 */
|
||||
const onbatchAgreeAll = async () => {
|
||||
const res = await putCodeFeedbackAuditAllAPI();
|
||||
if (res.success) {
|
||||
message(res.msg, {
|
||||
type: "success"
|
||||
});
|
||||
onSearch();
|
||||
} else {
|
||||
message(res.msg, { type: "error", duration: 5000 });
|
||||
}
|
||||
};
|
||||
/**批量驳回 */
|
||||
const onbatchDisagree = async () => {
|
||||
// 返回当前选中的行
|
||||
@ -654,6 +671,7 @@ export const useCode = (tableRef: Ref) => {
|
||||
onDownloadTemplate,
|
||||
handleAudit,
|
||||
onbatchDisagree,
|
||||
onbatchAgree
|
||||
onbatchAgree,
|
||||
onbatchAgreeAll
|
||||
};
|
||||
};
|
||||
|
||||
@ -118,6 +118,7 @@
|
||||
v-model:file-list="fileList"
|
||||
drag
|
||||
action="#"
|
||||
:limit="10"
|
||||
class="w-full"
|
||||
:auto-upload="false"
|
||||
:before-upload="beforeUpload"
|
||||
@ -127,7 +128,6 @@
|
||||
<IconifyIconOffline
|
||||
:icon="UploadIcon"
|
||||
width="26"
|
||||
:limit="1"
|
||||
class="m-auto mb-2"
|
||||
/>
|
||||
可点击或拖拽上传
|
||||
@ -138,9 +138,26 @@
|
||||
<el-button
|
||||
v-if="hasAuth('code:btn:uploadTemplate')"
|
||||
class="w-full my-2"
|
||||
type="success"
|
||||
:disabled="!hasAuth('code:btn:uploadTemplate')"
|
||||
@click="onDownloadTemplate"
|
||||
>{{ t("buttons:DownLodedTemplate") }}</el-button
|
||||
@click="onDownloadTemplate('xlsx')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.xlsx)</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasAuth('code:btn:uploadTemplate')"
|
||||
class="w-full my-2"
|
||||
type="warning"
|
||||
:disabled="!hasAuth('code:btn:uploadTemplate')"
|
||||
@click="onDownloadTemplate('csv')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.csv)</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasAuth('code:btn:uploadTemplate')"
|
||||
class="w-full my-2"
|
||||
type="info"
|
||||
:disabled="!hasAuth('code:btn:uploadTemplate')"
|
||||
@click="onDownloadTemplate('xls')"
|
||||
>{{ t("buttons:DownLodedTemplate") }}(.xls)</el-button
|
||||
>
|
||||
<el-popconfirm
|
||||
v-if="hasAuth('code:btn:import')"
|
||||
|
||||
@ -298,9 +298,9 @@ export const useCode = (tableRef: Ref) => {
|
||||
});
|
||||
};
|
||||
/**下载模版文件 */
|
||||
const onDownloadTemplate = async () => {
|
||||
const onDownloadTemplate = async (type: string) => {
|
||||
try {
|
||||
const blob = await getCodeTemplateAPI();
|
||||
const blob = await getCodeTemplateAPI(type);
|
||||
|
||||
// 生成下载链接
|
||||
// @ts-ignore
|
||||
@ -326,8 +326,10 @@ export const useCode = (tableRef: Ref) => {
|
||||
file.type ===
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || // xlsx
|
||||
file.type === "application/vnd.ms-excel" || // xls
|
||||
file.type === "text/csv" ||
|
||||
file.name.endsWith(".xlsx") || // 兼容部分浏览器
|
||||
file.name.endsWith(".xls"); // 兼容部分浏览器
|
||||
file.name.endsWith(".xls") || // 兼容部分浏览器
|
||||
file.name.endsWith(".csv"); // 兼容部分浏览器
|
||||
|
||||
// const maxSize = 20 * 1024 * 1024; // 20MB 限制
|
||||
|
||||
@ -354,11 +356,12 @@ export const useCode = (tableRef: Ref) => {
|
||||
uploadStatus.value = true;
|
||||
for (const file of fileList.value) {
|
||||
if (file.status === "success") {
|
||||
const data = await getAddCodeAPI(fileId.value);
|
||||
if (data.success) {
|
||||
message("导入成功!", { type: "success" });
|
||||
await onSearch();
|
||||
}
|
||||
// const data =
|
||||
await getAddCodeAPI(fileId.value);
|
||||
// if (data.success) {
|
||||
// message("导入成功!", { type: "success" });
|
||||
// await onSearch();
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@ -370,11 +373,12 @@ export const useCode = (tableRef: Ref) => {
|
||||
fileId.value = res.data.id;
|
||||
message(`${res.data.name}上传成功!`, { type: "success" });
|
||||
fileIds.value.push(res.data);
|
||||
const data = await getAddCodeAPI(fileId.value);
|
||||
if (data.success) {
|
||||
message(`导入成功!`, { type: "success" });
|
||||
await onSearch();
|
||||
}
|
||||
// const data =
|
||||
await getAddCodeAPI(fileId.value);
|
||||
// if (data.success) {
|
||||
// message(`导入成功!`, { type: "success" });
|
||||
// await onSearch();
|
||||
// }
|
||||
} else {
|
||||
file.status = "fail";
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import { transformI18n } from "@/plugins/i18n";
|
||||
import { IconSelect } from "@/components/ReIcon";
|
||||
import Segmented, { OptionsType } from "@/components/ReSegmented";
|
||||
import ReAnimateSelector from "@/components/ReAnimateSelector";
|
||||
import { hasAuth } from "@/utils/auth";
|
||||
|
||||
import type { FormRules } from "element-plus";
|
||||
const menuTypeOptions: Array<OptionsType> = [
|
||||
@ -433,7 +434,12 @@ defineExpose({ getRef });
|
||||
/>
|
||||
</el-form-item>
|
||||
</re-col>
|
||||
<re-col v-if="newFormInline.menu_type < 3" :value="12" :xs="24" :sm="24">
|
||||
<re-col
|
||||
v-if="hasAuth('permission:btn:admin')"
|
||||
:value="12"
|
||||
:xs="24"
|
||||
:sm="24"
|
||||
>
|
||||
<el-form-item label="管理专属">
|
||||
<Segmented
|
||||
:modelValue="newFormInline.is_admin ? 0 : 1"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user