修改退出登录弹框,添加数据填报预览视频和图片,添加上传轮询加载
This commit is contained in:
parent
f5e9bf6cc7
commit
fb582add0f
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onBeforeUnmount } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { UserOutlined, LogoutOutlined } from "@ant-design/icons-vue";
|
||||
// 国际化
|
||||
import { useI18n } from "vue-i18n";
|
||||
@ -20,11 +20,12 @@ const userStore = useUserStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
function logout() {
|
||||
ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
Modal.confirm({
|
||||
title: "提示?",
|
||||
content: "确定注销并退出系统吗?",
|
||||
okText: "确定",
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
onOk: async () => {
|
||||
userStore
|
||||
.logout()
|
||||
.then(() => {
|
||||
@ -33,15 +34,14 @@ function logout() {
|
||||
.then(() => {
|
||||
router.push(`/login`);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
function changePassword() {
|
||||
router.push('/changePassword');
|
||||
router.push("/changePassword");
|
||||
}
|
||||
onMounted(() => {
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
});
|
||||
onMounted(() => {});
|
||||
onBeforeUnmount(() => {});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -54,8 +54,7 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<!-- <h1 class="text-blank font-bold text-[16px]">{{ t("login.title") }}</h1> -->
|
||||
<h1 class="text-blank font-bold text-[16px]">{{ t("login.titleSjtb") }}</h1>
|
||||
</a
|
||||
>
|
||||
</a>
|
||||
</transition>
|
||||
<Sidebar />
|
||||
|
||||
|
||||
@ -271,6 +271,7 @@
|
||||
:multiple="false"
|
||||
accept=".mp4"
|
||||
:before-upload="beforeVideoUpload"
|
||||
@preview="handleVideoPreview"
|
||||
:disabled="isView"
|
||||
:maxCount="5"
|
||||
@remove="handleVideoRemove"
|
||||
@ -651,11 +652,8 @@ const handleVideoPreview = () => {
|
||||
|
||||
// 预览图片
|
||||
const handleImagePreview = async (file: any) => {
|
||||
if (!props.isView) {
|
||||
return "";
|
||||
}
|
||||
emit("preview-click", { picpthList: imageFileList.value }, "formImage", 0);
|
||||
return "";
|
||||
return Promise.reject();
|
||||
};
|
||||
// 确认操作
|
||||
const handleOk = async () => {
|
||||
@ -847,23 +845,6 @@ defineExpose({
|
||||
padding: 0;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 2px;
|
||||
|
||||
/* 删除预览按钮 */
|
||||
.ant-upload-list-item-actions {
|
||||
a {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.imgupload_hidden {
|
||||
:deep(.ant-upload-list-item) {
|
||||
/* 删除预览按钮 */
|
||||
.ant-upload-list-item-actions {
|
||||
a {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -311,7 +311,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, onMounted, h, nextTick, watch } from "vue";
|
||||
import { message, Modal } from "ant-design-vue"; // 假设使用 ant-design-vue
|
||||
import { LeftOutlined, RightOutlined, CloseCircleOutlined, ExclamationCircleOutlined } from "@ant-design/icons-vue"; // 引入图标组件
|
||||
import {
|
||||
LeftOutlined,
|
||||
RightOutlined,
|
||||
CloseCircleOutlined,
|
||||
ExclamationCircleOutlined,
|
||||
} from "@ant-design/icons-vue"; // 引入图标组件
|
||||
import BasicTable from "@/components/BasicTable/index.vue";
|
||||
import GuoYuSheShiShuJuTianBaoSearch from "./guoYuSheShiShuJuTianBaoSearch.vue";
|
||||
import GuoYuSheShiShuJuTianBaoTable from "./guoYuSheShiShuJuTianBaoTable.vue";
|
||||
@ -337,7 +342,6 @@ import { Tag } from "ant-design-vue"; // 确保导入 Tag
|
||||
import { getDictItemsByCode } from "@/api/dict";
|
||||
|
||||
const baseUrl = import.meta.env.VITE_APP_PREVIEW_URL;
|
||||
const baseUrlPreview = import.meta.env.VITE_APP_BASE_URL;
|
||||
const baseUrlApi = import.meta.env.VITE_APP_BASE_API_URL;
|
||||
// --- 类型定义 ---
|
||||
interface FormData {
|
||||
@ -747,8 +751,9 @@ const handleModalOk = () => {
|
||||
Modal.confirm({
|
||||
title: "是否提交导入数据?",
|
||||
onOk: async () => {
|
||||
try {
|
||||
let res: any = await batchSaveDraft({
|
||||
taskId: taskId.value
|
||||
taskId: taskId.value,
|
||||
});
|
||||
if (res && res?.code == 0) {
|
||||
fileTableData.value = [];
|
||||
@ -759,6 +764,9 @@ const handleModalOk = () => {
|
||||
} else {
|
||||
message.error("导入失败,请检查数据是否正确");
|
||||
}
|
||||
} catch (error) {
|
||||
message.error("导入数据失败");
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -796,17 +804,16 @@ const importBtn = async () => {
|
||||
visible.value = true;
|
||||
fileLoading.value = true;
|
||||
if (currentTask.status == "UPLOADED") {
|
||||
if (visible.value) message.warning(currentTask.statusText);
|
||||
if (visible.value) {
|
||||
// message.warning(currentTask.statusText)
|
||||
setTimeout(() => {
|
||||
if (visible.value) importBtn();
|
||||
}, 5000);
|
||||
}
|
||||
} else if (currentTask.status == "VALIDATED") {
|
||||
nextTick(async () => {
|
||||
try {
|
||||
modalTableRef.value.editingRowIndex = null;
|
||||
getFileList();
|
||||
} catch (error) {
|
||||
message.error("导入失败");
|
||||
} finally {
|
||||
fileLoading.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -818,39 +825,28 @@ const importBtn = async () => {
|
||||
};
|
||||
const getFileList = async () => {
|
||||
let res: any = await getLastImportResult();
|
||||
fileTableaAnalysis(res, "get");
|
||||
}
|
||||
fileTableaAnalysis(res);
|
||||
};
|
||||
// 上传文件
|
||||
const fileChange = (file: File) => {
|
||||
try {
|
||||
nextTick(async () => {
|
||||
visible.value = true;
|
||||
fileLoading.value = true;
|
||||
fileTableData.value = [];
|
||||
setTimeout(() => {
|
||||
if (visible.value) importBtn();
|
||||
}, 5000);
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
let res: any = await importFishZip(formData);
|
||||
const { code } = res.data || {};
|
||||
await importFishZip(formData);
|
||||
try {
|
||||
if (code == 1) {
|
||||
message.error("导入失败");
|
||||
} else {
|
||||
taskId.value = res.data.taskId;
|
||||
if (res.data.summary) {
|
||||
message.success(res.data.summary);
|
||||
} else {
|
||||
message.success("导入成功");
|
||||
}
|
||||
fileTableaAnalysis(res, "file");
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (visible.value) importBtn();
|
||||
}, 5000);
|
||||
} catch (error) {
|
||||
message.error("导入失败");
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
} finally {
|
||||
fileLoading.value = false;
|
||||
}
|
||||
};
|
||||
// 获取文件列表
|
||||
const handleFileSelect = (e: Event) => {
|
||||
@ -886,14 +882,10 @@ const resetFileInput = () => {
|
||||
fileInputRef.value.value = "";
|
||||
}
|
||||
};
|
||||
const fileTableaAnalysis = (res: any, type: string) => {
|
||||
const fileTableaAnalysis = (res: any) => {
|
||||
let data = [];
|
||||
let list = [];
|
||||
if (type == "file") {
|
||||
list = res.data.rows;
|
||||
} else {
|
||||
list = res.data.result.rows;
|
||||
}
|
||||
list.sort((a: any, b: any) => {
|
||||
const keyA =
|
||||
a.rowIndex !== undefined && a.rowIndex !== null ? Number(a.rowIndex) : -1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user