|
|
@@ -1,10 +1,10 @@
|
|
|
<template>
|
|
|
- <div v-if="props.modelValue">
|
|
|
- <el-card v-if="cardVisible" class="pop-card">
|
|
|
+ <div>
|
|
|
+ <el-card v-if="cardVisible">
|
|
|
<template #header>
|
|
|
<div class="flex justify-between items-center pop-head">
|
|
|
<div style="font-size: 16px; font-weight: 600">批量导入</div>
|
|
|
- <el-icon :size="18" class="mr-3" @click="updateValue(false)" style="cursor: pointer;">
|
|
|
+ <el-icon :size="18" class="mr-3" @click="() => { emits('close'); }" style="cursor: pointer;">
|
|
|
<Close />
|
|
|
</el-icon>
|
|
|
</div>
|
|
|
@@ -37,8 +37,7 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
|
|
|
- <el-dialog v-model="DialogVisibleErr" title="Warning" width="50%" align-center
|
|
|
- @close="() => { emits('update:modelValue', false); }">
|
|
|
+ <el-dialog v-model="DialogVisibleErr" title="Warning" width="50%" align-center @close="() => { emits('update'); }">
|
|
|
<template #header>
|
|
|
<el-icon :size="24" color="#f2b20a" style="margin: 0 5px 2px">
|
|
|
<WarnTriangleFilled />
|
|
|
@@ -59,10 +58,11 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, onMounted } from 'vue';
|
|
|
+import { ref } from 'vue';
|
|
|
import axios, { AxiosRequestConfig } from 'axios';
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
import { genFileId, ElMessage } from 'element-plus';
|
|
|
@@ -70,9 +70,7 @@ import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
|
|
import { Close, Document, WarnTriangleFilled, Download } from '@element-plus/icons-vue';
|
|
|
import { useGlobSetting } from '@/hooks/setting';
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- cardVisible.value = props.modelValue;
|
|
|
-});
|
|
|
+const emits = defineEmits(['close', 'update']);
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
const headers = {
|
|
|
@@ -88,13 +86,6 @@ const sucCount = ref<number>(0);
|
|
|
const errCount = ref<number>(0);
|
|
|
const errDetail = ref<string[]>([]);
|
|
|
|
|
|
-const props = defineProps<{ modelValue: boolean }>();
|
|
|
-const emits = defineEmits(['update:modelValue', 'change']);
|
|
|
-
|
|
|
-const updateValue = (value) => {
|
|
|
- emits('update:modelValue', value);
|
|
|
-};
|
|
|
-
|
|
|
const { urlPrefix } = useGlobSetting()
|
|
|
|
|
|
// 下载场景code信息查询表
|
|
|
@@ -188,6 +179,7 @@ const handleUploadSuccess = (response, _file, _fileList) => {
|
|
|
message: '添加成功', // 1.全部添加成功 —— failCount === 0
|
|
|
type: 'success',
|
|
|
});
|
|
|
+ emits('update');
|
|
|
} else {
|
|
|
DialogVisibleErr.value = true; // 2.有错误 —— 显示错误dialog
|
|
|
};
|
|
|
@@ -197,14 +189,13 @@ const handleUploadSuccess = (response, _file, _fileList) => {
|
|
|
message: '系统错误',
|
|
|
type: 'error',
|
|
|
});
|
|
|
- emits('update:modelValue', false);
|
|
|
+ emits('update');
|
|
|
};
|
|
|
};
|
|
|
|
|
|
const handleErrComfirm = () => {
|
|
|
DialogVisibleErr.value = false;
|
|
|
- emits('update:modelValue', false);
|
|
|
- emits('change');
|
|
|
+ emits('update');
|
|
|
};
|
|
|
|
|
|
// 当超出只能上传一个文件的限制时,自动替换上一个文件
|