From fbd0e0ee3708b76d2cdb3605dec0cc5eba63de26 Mon Sep 17 00:00:00 2001
From: mk <2403457699@qq.com>
Date: Fri, 20 Oct 2023 17:45:17 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E5=91=98=E5=AF=BC=E5=85=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../communityParty/members/memberList.vue | 116 ++++++++++--------
1 file changed, 63 insertions(+), 53 deletions(-)
diff --git a/src/views/modules/communityParty/members/memberList.vue b/src/views/modules/communityParty/members/memberList.vue
index dd875e435..3b7b20e58 100644
--- a/src/views/modules/communityParty/members/memberList.vue
+++ b/src/views/modules/communityParty/members/memberList.vue
@@ -165,7 +165,7 @@
:http-request="uploadHttpRequest"
style="display: inline-block;margin:0px 10px"
>
- 导入
@@ -577,35 +577,26 @@ export default {
})
},
- /**
- * 更新按钮点击
- * @param row
- */
- handleExcelSuccess(res) {
- this.epmetResultResolver.success((data) => {
- this.$message.success('上传完成,正在导入,请到导入记录中查看导入情况。');
- }).fail(() => {
- this.$message.error('导入失败');
- }).parse(res);
- },
-
/**
* 文件上传前的处理
* @param file
* @returns {boolean}
*/
beforeExcelUpload(file) {
- // console.log('file', file);
- const isXlsx = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
- const isLt1M = file.size / 1024 / 1024 < 10;
- if (!isXlsx) {
- this.$message.error('上传文件只能是xlsx格式!');
- }
-
- if (!isLt1M) {
- this.$message.error('上传文件大小不能超过 10MB!');
- }
- return isXlsx && isLt1M;
+ const isType = file.type === "application/vnd.ms-excel";
+ const isTypeComputer =
+ file.type ===
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ const fileType = isType || isTypeComputer;
+ const isLt1M = file.size / 1024 / 1024 < 10;
+ if (!fileType) {
+ this.$message.error("上传文件只能是xls/xlsx格式!");
+ }
+
+ if (!isLt1M) {
+ this.$message.error("上传文件大小不能超过 10MB!");
+ }
+ return fileType && isLt1M;
},
/**
@@ -613,39 +604,58 @@ export default {
* @param file
* @returns {Promise}
*/
- async uploadHttpRequest(file) {
- this.importLoading = true;
- this.importBtnTitle = '正在上传中...';
- // this.$message({
- // showClose: true,
- // dangerouslyUseHTMLString: true,
- // message: "导入中,请到系统管理-导入记录中查看进度",
- // duration: 3000
- // });
- // let than = this;
- // document.getElementById('clickA').addEventListener('click', function() {
- // than.$router.replace('/main/importRecord-index');
- // });
- const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加
- formData.append('file', file.file); //添加文件对象
- // formData.append('code', ''); //添加文件对象
- await this.$http
- .post('/actual/base/party/member/import', formData)
- .then(res => {
- debugger
- this.epmetResultResolver.success((data) => {
- this.$message.success('上传成功,正在导入,请到"系统管理-导入记录"中查看导入情况。');
- }).parse(res.data);
+
+ async uploadHttpRequest(file) {
+ this.$message({
+ showClose: true,
+ dangerouslyUseHTMLString: true,
+ message:
+ "导入中,请到系统管理-导入记录中查看进度",
+ duration: 3000,
+ });
+ let than = this;
+ document.getElementById("clickA").addEventListener("click", function () {
+ than.$router.replace("/main/importRecord-index");
+ });
+ const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加
+ formData.append("file", file.file); //添加文件对象
+ formData.append("fileMode",'PARTYINFO');
+ await this.$http
+ .post("/actual/base/importExcelData/extractExcelHead", formData)
+ .then((res) => {
+ const { fileCode, msg } = res.data.data;
+ this.dataList = {"所属网格":"所属网格","所属小区":"所属小区","所属楼栋":"所属楼栋","所属单元":"所属单元","所属房屋":"所属房屋","本地户籍":"本地户籍","居民姓名":"居民姓名","联系电话":"联系电话","国籍":"国籍","证件类型":"证件类型","证件号":"证件号","民族":"民族","备注":"备注","文化程度":"文化程度","户籍地址":"户籍所在地","居住地址":"现居住地址","所属支部":"所属支部","入党时间":"入党时间","转正时间":"转正时间","流动党员":"流动党员","流动党员活动证号":"流动党员活动证号","党组织职务":"党组织职务","是否退休":"是否退休","党员中心户":"党员中心户","入党时所在党支部":"入党时所在党支部","组织关系转入社区时间":"组织关系转入社区时间","免学习":"免学习","工作职责":"职责"};
+ this.importCode = fileCode;
+ this.handleComfirmUpload()
})
- .catch(err => {
- console.log('失败', err);
+ .catch((err) => {
+ console.log("失败", err);
file.onError(); //上传失败的文件会从文件列表中删除
// this.$message.error('导入失败')
});
- this.importLoading = false;
- this.importBtnTitle = '导入';
- this.$refs.upload.clearFiles();
- },
+ },
+ async handleComfirmUpload () {
+ this.importLoading = true;
+ this.importBtnTitle = "正在上传中...";
+ const { importOption, importCode, dataList } = this;
+ const formData = new FormData();
+ formData.append("columnMateJson", JSON.stringify(dataList));
+ formData.append("fileCode", importCode);
+ await this.$http
+ .post("/actual/base/importExcelData/importResiHouseExcel", formData)
+ .then((res) => {
+ console.log("res-up", res);
+ if (res.data.code == 0 && res.data.msg == "success") {
+ this.getTableData();
+ } else this.$message.error(res.data.msg);
+ })
+ .catch((err) => {
+ console.log("失败", err);
+ file.onError(); //上传失败的文件会从文件列表中删除
+ });
+ this.importLoading = false;
+ this.importBtnTitle = "导入";
+ },
/**
* 单个删除