|
|
@@ -31,14 +31,18 @@
|
|
|
></div
|
|
|
>
|
|
|
</el-upload>
|
|
|
- <div style="margin-top: 52px; margin-left: 288px; display: flex">
|
|
|
+ <div style="margin-top: 52px; display: flex">
|
|
|
+ <el-button @click="handleDownloadInfoForm" style="margin-right: 10px; margin-left: auto"
|
|
|
+ >组织/用户id信息</el-button
|
|
|
+ >
|
|
|
<el-button @click="handleDownload" style="margin-right: 10px">下载模板</el-button>
|
|
|
<el-button type="primary" @click="handleImport">导入</el-button></div
|
|
|
></div
|
|
|
>
|
|
|
</el-card>
|
|
|
+ <!-- 新的需求里面将上传成功和上传失败窗口合并了 -->
|
|
|
<!-- //上传成功 -->
|
|
|
- <el-dialog
|
|
|
+ <!-- <el-dialog
|
|
|
v-model="DialogVisibleSuc"
|
|
|
title="Warning"
|
|
|
width="30%"
|
|
|
@@ -63,10 +67,10 @@
|
|
|
<el-button type="primary" @click="handleRightComfirm"> 确定 </el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
- </el-dialog>
|
|
|
+ </el-dialog> -->
|
|
|
|
|
|
<!-- 上传失败 -->
|
|
|
- <el-dialog
|
|
|
+ <!-- <el-dialog
|
|
|
v-model="DialogVisibleErr"
|
|
|
title="Warning"
|
|
|
width="30%"
|
|
|
@@ -97,13 +101,52 @@
|
|
|
<el-button type="primary" @click="handleErrComfirm"> 确定 </el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
- </el-dialog></div
|
|
|
- >
|
|
|
+ </el-dialog> -->
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="DialogVisible"
|
|
|
+ title="Warning"
|
|
|
+ width="50%"
|
|
|
+ align-center
|
|
|
+ @close="
|
|
|
+ () => {
|
|
|
+ emits('update:modelValue', false);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <template #header>
|
|
|
+ <el-icon :size="24" color="#f2b20a" style="margin: 0 5px 2px">
|
|
|
+ <WarnTriangleFilled />
|
|
|
+ </el-icon>
|
|
|
+ <div class="header-text">添加提示</div>
|
|
|
+ </template>
|
|
|
+ <!-- <div class="sum-count">
|
|
|
+ 成功上传 <span class="succ-sum">{{ sucCount }}</span> 条,
|
|
|
+ 失败 <span class="err-sum">{{ errCount }}</span> 条
|
|
|
+ </div> -->
|
|
|
+ <div class="sum-count">
|
|
|
+ 成功上传 <span class="succ-sum">{{ successCount }}</span> 条, 失败
|
|
|
+ <span class="err-sum">{{ errorCount }}</span> 条
|
|
|
+ </div>
|
|
|
+ <div class="err-info">
|
|
|
+ <!-- <div v-if="errCount === 0">未检测到相机数据</div> -->
|
|
|
+ <div>
|
|
|
+ <ul v-for="(item, index) in errDetail" :key="index">
|
|
|
+ <li v-html="item"></li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <el-button type="primary" @click="handleErrComfirm"> 确定 </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { Close, Document, CircleCheck, Warning } from '@element-plus/icons-vue';
|
|
|
- import { computed, ref } from 'vue';
|
|
|
+ // import { Close, Document, CircleCheck, Warning } from '@element-plus/icons-vue';
|
|
|
+ import { Close, Document } from '@element-plus/icons-vue';
|
|
|
+ import { ref } from 'vue';
|
|
|
import { genFileId, ElMessage } from 'element-plus';
|
|
|
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
@@ -130,16 +173,20 @@
|
|
|
const cardVisible = ref<boolean>(true);
|
|
|
|
|
|
//对话框
|
|
|
- const DialogVisibleSuc = ref<boolean>(false);
|
|
|
- const DialogVisibleErr = ref<boolean>(false);
|
|
|
+ // const DialogVisibleSuc = ref<boolean>(false);
|
|
|
+ // const DialogVisibleErr = ref<boolean>(false);
|
|
|
+ const DialogVisible = ref<boolean>(false);
|
|
|
|
|
|
//更多
|
|
|
- const showMore = ref(false);
|
|
|
+ // const showMore = ref(false);
|
|
|
|
|
|
const isSuc = ref<boolean>(true);
|
|
|
+ // const errDetail = ref<string[]>([]);
|
|
|
const errDetail = ref<string[]>([]);
|
|
|
- const sucCount = ref<number>(0);
|
|
|
- const { urlPrefix } = useGlobSetting();
|
|
|
+ // const sucCount = ref<number>(0);
|
|
|
+ const successCount = ref<number>(0);
|
|
|
+ // const sucCount = ref<number>(0);
|
|
|
+ const errorCount = ref<number>(0);
|
|
|
|
|
|
const props = defineProps<{ modelValue: boolean }>();
|
|
|
const emits = defineEmits(['update:modelValue', 'change']);
|
|
|
@@ -149,9 +196,7 @@
|
|
|
};
|
|
|
const upload = ref<UploadInstance>();
|
|
|
|
|
|
- const importUrl = computed(() => {
|
|
|
- return urlJoin(urlPrefix, `/user/import`);
|
|
|
- });
|
|
|
+ const { urlPrefix } = useGlobSetting();
|
|
|
|
|
|
const handleDownload = async () => {
|
|
|
//调用后端接口
|
|
|
@@ -178,6 +223,31 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const handleDownloadInfoForm = async () => {
|
|
|
+ //调用后端接口
|
|
|
+ try {
|
|
|
+ const config: AxiosRequestConfig = {
|
|
|
+ headers,
|
|
|
+ responseType: 'blob',
|
|
|
+ };
|
|
|
+ const response = await axios.get(urlPrefix + '/user/downloadInfoForm', config);
|
|
|
+ const blob = new Blob([response.data], {
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
|
+ });
|
|
|
+ // 创建下载链接
|
|
|
+ let downloadLink: HTMLAnchorElement | null = document.createElement('a');
|
|
|
+ const url = window.URL.createObjectURL(blob);
|
|
|
+ downloadLink.href = url;
|
|
|
+ downloadLink.download = '组织/用户id信息模板.xlsm';
|
|
|
+ downloadLink.click();
|
|
|
+ // 移除下载链接
|
|
|
+ window.URL.revokeObjectURL(url);
|
|
|
+ downloadLink = null;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('Error downloading file:', error);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const handleImport = async () => {
|
|
|
upload.value!.submit();
|
|
|
};
|
|
|
@@ -197,26 +267,30 @@
|
|
|
|
|
|
const handleUploadSuccess = (response, _file, _fileList) => {
|
|
|
isSuc.value = response.data.isSuc;
|
|
|
- errDetail.value = response.data.failedInfo;
|
|
|
- sucCount.value = response.data.sucCount || 0;
|
|
|
-
|
|
|
- if (isSuc.value) {
|
|
|
- DialogVisibleSuc.value = true;
|
|
|
- DialogVisibleErr.value = false;
|
|
|
- } else {
|
|
|
- DialogVisibleSuc.value = false;
|
|
|
- DialogVisibleErr.value = true;
|
|
|
- }
|
|
|
+ errDetail.value = response.data.errorList;
|
|
|
+ successCount.value = response.data.successCount || 0;
|
|
|
+ errorCount.value = response.data.errorCount || 0;
|
|
|
+
|
|
|
+ DialogVisible.value = true;
|
|
|
+
|
|
|
+ // if (isSuc.value) {
|
|
|
+ // DialogVisibleSuc.value = true;
|
|
|
+ // DialogVisibleErr.value = false;
|
|
|
+ // } else {
|
|
|
+ // DialogVisibleSuc.value = false;
|
|
|
+ // DialogVisibleErr.value = true;
|
|
|
+ // }
|
|
|
cardVisible.value = false;
|
|
|
};
|
|
|
|
|
|
- const handleRightComfirm = () => {
|
|
|
- DialogVisibleSuc.value = false;
|
|
|
- emits('update:modelValue', false);
|
|
|
- emits('change');
|
|
|
- };
|
|
|
+ // const handleRightComfirm = () => {
|
|
|
+ // DialogVisibleSuc.value = false;
|
|
|
+ // emits('update:modelValue', false);
|
|
|
+ // emits('change');
|
|
|
+ // };
|
|
|
const handleErrComfirm = () => {
|
|
|
- DialogVisibleErr.value = false;
|
|
|
+ // DialogVisibleErr.value = false;
|
|
|
+ DialogVisible.value = false;
|
|
|
emits('update:modelValue', false);
|
|
|
emits('change');
|
|
|
};
|
|
|
@@ -258,4 +332,56 @@
|
|
|
font-size: 14px;
|
|
|
margin-bottom: 2px;
|
|
|
}
|
|
|
+
|
|
|
+ :deep(.el-dialog) {
|
|
|
+ padding: 0px;
|
|
|
+ border-radius: 5px;
|
|
|
+
|
|
|
+ .el-dialog__header {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-end;
|
|
|
+ height: 70px;
|
|
|
+ padding: 0px 0px 10px 10px;
|
|
|
+ border-bottom: 1px solid #e7e7e7;
|
|
|
+
|
|
|
+ .header-text {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-dialog__headerbtn {
|
|
|
+ top: 22px;
|
|
|
+
|
|
|
+ .el-dialog__close {
|
|
|
+ color: black;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-dialog__body {
|
|
|
+ padding: 20px;
|
|
|
+
|
|
|
+ .sum-count {
|
|
|
+ margin: 10px 0 20px 20px;
|
|
|
+ font-size: 20px;
|
|
|
+
|
|
|
+ .succ-sum {
|
|
|
+ color: #52c41a;
|
|
|
+ }
|
|
|
+
|
|
|
+ .err-sum {
|
|
|
+ color: #ff4d4f;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .err-info {
|
|
|
+ height: 200px;
|
|
|
+ margin-left: 20px;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-dialog__footer {
|
|
|
+ margin: 0 20px 20px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|