一些issue修复
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<span class="yellow" @click="filterVerifyResult(0)">{{ noNum }}</span>
|
||||
</div>
|
||||
<div class="left-btn">
|
||||
<a v-if="isLogin" class="cursor-pointer" href="/static/软件存在及可信校验模版.xlsx" download
|
||||
<a v-if="isLogin" class="cursor-pointer" href="/file/软件存在及可信校验模版.xlsx" download
|
||||
><i class="icon icon-download-2"></i>下载excel模板</a
|
||||
>
|
||||
<span v-if="isLogin" style="height: 14px" class="split"></span>
|
||||
@@ -148,6 +148,25 @@ import { releasePage, repoImport } from '@/api/jyh';
|
||||
import NoData from '@/components/NoData/NoData.vue';
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
const downloadTemplate = async () => {
|
||||
try {
|
||||
const response = await fetch('/static/软件存在及可信校验模版.xlsx');
|
||||
const blob = await response.blob();
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = '软件存在及可信校验模版.xlsx';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
} catch (error) {
|
||||
console.error('下载失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const useNum = computed(() => {
|
||||
if (tableData.value.length > 0) {
|
||||
return tableData.value.filter((item) => item.validStatus === 1).length;
|
||||
@@ -174,7 +193,14 @@ const noNum = computed(() => {
|
||||
|
||||
// 处理文件上传
|
||||
const handleFileUpload = async (file) => {
|
||||
console.log('选择的文件:', file.name);
|
||||
// 1. 校验文件类型
|
||||
const allowedExtensions = ['.xlsx'];
|
||||
const fileExtension = file.name.slice(file.name.lastIndexOf('.')).toLowerCase();
|
||||
|
||||
if (!allowedExtensions.includes(fileExtension)) {
|
||||
Message.error('仅支持上传 .xlsx 格式的Excel文件');
|
||||
return Promise.reject(new Error('文件格式不正确'));
|
||||
}
|
||||
|
||||
const { data, error } = await repoImport({ file });
|
||||
if (!error && data) {
|
||||
|
||||
Reference in New Issue
Block a user