diff --git a/src/views/work/components/MailCheck.vue b/src/views/work/components/MailCheck.vue
index ee5e599..77dced9 100644
--- a/src/views/work/components/MailCheck.vue
+++ b/src/views/work/components/MailCheck.vue
@@ -43,11 +43,15 @@
信件核对
-
+
数据核对无误
+
+ 以下数据共 {{ form.length }} 条,数据不匹配
+ 下载不匹配数据
+
@@ -100,10 +104,11 @@ import { ref, defineProps } from 'vue'
import { watch } from 'vue'
import { formatTimeText, getDictLable, getFlowTagType } from "@/utils/util";
import { useDictData } from "@/hooks/useDictOptions";
-import { ElTable } from "element-plus";
+import { ElMessage, ElTable } from "element-plus";
import { genFileId } from 'element-plus'
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus'
import axios from 'axios';
+import request from "@/utils/request";
const { dictData } = useDictData(["mail_source", "mail_level", "mail_state"]);
const props = defineProps({
show: {
@@ -139,21 +144,39 @@ const fileList = ref([])
const handleUpload: UploadProps['httpRequest'] = (file) => {
const formData = new FormData(); // 创建表单数据对象
formData.append("file", file.file); // 将文件添加到表单数据中
- return axios.post("/lan-api/api/work/import", formData) // 使用 axios 发送 post 请求到后端
- .then((response) => {
+ return axios.post("/lan-api/api/work/check", formData) // 使用 axios 发送 post 请求到后端
+ .then((res) => {
// 处理成功的响应
- console.log(response.data);
+ console.log('checkMsg', res.data);
+ if (res.data[0]) {
+ result.value = false
+ ifShow.value = true
+ form.value = res.data.data
+ } else {
+ ifShow.value = true
+ result.value = true
+ }
upload.value.clearFiles(); // 清空文件列表
})
.catch((error) => {
// 处理失败的响应
console.error(error);
+ ElMessage.error('上传失败')
});
}
const handleCheck = () => {
upload.value!.submit()
console.log(query.value)
}
+const handleImport = () => {
+ request.post({ url: '/work/import', body: form.value }).then((data: any) => {
+ ElMessage.success('下载成功')
+ resetView()
+ }).catch((error: any) => {
+ console.error(error);
+ ElMessage.error('下载失败')
+ })
+}
const handleExceed: UploadProps['onExceed'] = (files) => {
upload.value!.clearFiles()
@@ -162,6 +185,9 @@ const handleExceed: UploadProps['onExceed'] = (files) => {
upload.value!.handleStart(file)
}
+function resetView(){
+ ifShow.value = false
+}