From 4afb93773e63aa00bd86ae9d27b0ce5721f95a6d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Wed, 15 May 2024 14:40:53 +0800
Subject: [PATCH] 住户导入导出批量删除优化调整

---
 src/views/userHouse/houseHoldList.vue |   72 ++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/src/views/userHouse/houseHoldList.vue b/src/views/userHouse/houseHoldList.vue
index b642cc8..7ed2b10 100644
--- a/src/views/userHouse/houseHoldList.vue
+++ b/src/views/userHouse/houseHoldList.vue
@@ -7,17 +7,17 @@
       :before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset"
       @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
       @refresh-change="refreshChange" @on-load="onLoad">
-      <!-- <template slot="menuLeft"> -->
-      <!-- <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete"
-                            @click="handleDelete">删 除
-                        </el-button>
-                        <el-button type="success" size="small" plain v-if="permission.household_import"
-                            icon="el-icon-upload2" @click="handleImport">导入
-                        </el-button>
-                        <el-button type="warning" size="small" plain v-if="permission.household_export"
-                            icon="el-icon-download" @click="handleExport">导出
-                        </el-button> -->
-      <!-- </template> -->
+      <template slot="menuLeft">
+        <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete"
+          @click="handleDelete">删 除
+        </el-button>
+        <el-button type="success" size="small" plain v-if="permission.household_import" icon="el-icon-upload2"
+          @click="handleImport">导入
+        </el-button>
+        <el-button type="warning" size="small" plain v-if="permission.household_export" icon="el-icon-download"
+          @click="handleExport">导出
+        </el-button>
+      </template>
 
       <template slot-scope="{row, size}" slot="menu">
         <el-button :size="size" type="text" icon="el-icon-circle-plus-outline" v-if="permission.household_manager"
@@ -37,18 +37,6 @@
         {{ labelDispose(row.householdLabelList) }}
       </template>
     </avue-crud>
-    <el-dialog title="用户角色配置" append-to-body :visible.sync="roleBox" width="345px" center>
-
-      <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id" ref="treeRole"
-        :default-checked-keys="roleTreeObj" :props="props">
-      </el-tree>
-
-      <span slot="footer" class="dialog-footer">
-        <el-button size="small" @click="roleBox = false">取 消</el-button>
-        <el-button size="small" type="primary" @click="submitRole">确 定</el-button>
-      </span>
-    </el-dialog>
-
     <el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
       <div v-for="(item, index) in  labelData " :key="index">
         <el-row>
@@ -69,9 +57,6 @@
             </div>
           </el-collapse-item>
         </el-collapse>
-
-
-
         <div class="grid-container2" v-else>
           <div class="grid-item" :style="{ backgroundColor: getColor(item2.color) }"
             v-for="( item2, index2 ) in  item.children " @click="changLabel(item2)" :key="index2">
@@ -95,7 +80,7 @@
       </span>
     </el-dialog>
 
-    <el-dialog title="用户数据导入" append-to-body :visible.sync="excelBox" width="555px">
+    <el-dialog title="住户数据导入" append-to-body :visible.sync="excelBox" width="555px">
       <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
         <template slot="excelTemplate">
           <el-button size="small" type="primary" @click="handleTemplate">
@@ -684,7 +669,8 @@
       },
       data: [],
 
-      excelForm: {},
+      excelForm: {
+      },
       labelForm: {},
       labelOption: {
         submitBtn: false,
@@ -734,7 +720,7 @@
             res: 'data'
           },
           tip: '请上传 .xls,.xlsx 标准格式文件',
-          action: "/api/blade-system/user/import-user"
+          action: "/api/blade-household/household/import-household"
         },
         {
           label: "数据覆盖",
@@ -794,7 +780,6 @@
         }
       },
     },
-
     'form.cardType': {
       handler(newData) {
         let idCardColumn = this.findObject(
@@ -816,7 +801,6 @@
         }
       },
     },
-
     'form.healthStatus': {
       handler(newData) {
         let diseaseNameColumn = this.findObject(
@@ -829,8 +813,14 @@
         } else {
           diseaseNameColumn.disabled = true
         }
-      },
+      }
     },
+    'excelForm.isCovered'() {
+      if (this.excelForm.isCovered !== '') {
+        const column = this.findObject(this.excelOption.column, "excelFile")
+        column.action = `/api/blade-household/household/import-household?isCovered=${this.excelForm.isCovered}`
+      }
+    }
   },
   computed: {
     ...mapGetters(["userInfo", "permission"]),
@@ -869,7 +859,14 @@
       return (data) => {
         return setLabelColor(data)
       }
-    }
+    },
+    ids() {
+      let ids = []
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id)
+      })
+      return ids.join(",")
+    },
   },
   mounted() { },
   methods: {
@@ -1054,7 +1051,12 @@
     },
     uploadAfter(res, done, loading, column) {
       this.excelBox = false
-      this.refreshChange()
+      this.onLoad(this.page)
+      this.$message({
+        type: "success",
+        message: res
+      })
+      this.$refs.crud.toggleSelection()
       done()
     },
     handleExport() {
@@ -1077,7 +1079,7 @@
       })
     },
     handleTemplate() {
-      exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
+      exportBlob(`/api/blade-household/household/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
         downloadXls(res.data, "住户数据模板.xlsx")
       })
     },

--
Gitblit v1.9.3