From ae8b1dd6499d030b3edff10dba660c7ba918bb5b Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Mon, 19 Feb 2024 17:44:41 +0800
Subject: [PATCH] 业委会成员

---
 src/views/gzll/components/ownersMemberManager.vue | 1057 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 529 insertions(+), 528 deletions(-)

diff --git a/src/views/gzll/components/ownersMemberManager.vue b/src/views/gzll/components/ownersMemberManager.vue
index 70a52aa..f5ec5b8 100644
--- a/src/views/gzll/components/ownersMemberManager.vue
+++ b/src/views/gzll/components/ownersMemberManager.vue
@@ -1,569 +1,570 @@
 <template>
-    <basic-container>
-        <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud" v-model="form"
-            :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
-            :before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset"
-            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
-            @refresh-change="refreshChange">
-            <template slot="menuLeft">
-                <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete"
-                    @click="handleDelete">删 除
-                </el-button>
-            </template>
-            <template slot-scope="{row}" slot="tenantName">
-                <el-tag>{{ row.tenantName }}</el-tag>
-            </template>
-            <template slot-scope="{row}" slot="roleName">
-                <el-tag>{{ row.roleName }}</el-tag>
-            </template>
-            <template slot-scope="{row}" slot="deptName">
-                <el-tag>{{ row.deptName }}</el-tag>
-            </template>
-            <template slot-scope="{row}" slot="userTypeName">
-                <el-tag>{{ row.userTypeName }}</el-tag>
-            </template>
-        </avue-crud>
-    </basic-container>
+  <basic-container>
+    <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud" v-model="form"
+      :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
+      :before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset"
+      @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+      @refresh-change="refreshChange">
+      <template slot="menuLeft">
+        <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete"
+          @click="handleDelete">删 除
+        </el-button>
+      </template>
+      <template slot-scope="{row}" slot="tenantName">
+        <el-tag>{{ row.tenantName }}</el-tag>
+      </template>
+      <template slot-scope="{row}" slot="roleName">
+        <el-tag>{{ row.roleName }}</el-tag>
+      </template>
+      <template slot-scope="{row}" slot="deptName">
+        <el-tag>{{ row.deptName }}</el-tag>
+      </template>
+      <template slot-scope="{row}" slot="userTypeName">
+        <el-tag>{{ row.userTypeName }}</el-tag>
+      </template>
+    </avue-crud>
+  </basic-container>
 </template>
 
 <script>
-import {
+  import {
     getList,
     remove,
     add,
     update,
     getDetail
-} from "@/api/owners/ownersCommittee.js"
+  } from "@/api/owners/ownersCommittee.js"
 
-import {
+  import {
     getUserByDistrictId
-} from "@/api/system/user.js"
+  } from "@/api/system/user.js"
 
-// import {
-//     update as committeeUpdate,
-//   } from "@/api/owners_committee"
+  // import {
+  //     update as committeeUpdate,
+  //   } from "@/api/owners_committee"
 
-import {
+  import {
     mapGetters
-} from "vuex"
-import {
+  } from "vuex"
+  import {
     getToken
-} from '@/util/auth'
-import {
+  } from '@/util/auth'
+  import {
     downloadXls
-} from "@/util/util"
-import {
+  } from "@/util/util"
+  import {
     dateNow
-} from "@/util/date"
-import NProgress from 'nprogress'
-import 'nprogress/nprogress.css'
-import Qs from "qs"
+  } from "@/util/date"
+  import NProgress from 'nprogress'
+  import 'nprogress/nprogress.css'
+  import Qs from "qs"
 
-export default {
-    data () {
-        return {
-            owners: {},
-            userList: [],
-            form: {},
-            search: {},
-            excelBox: false,
-            selectionList: [],
-            query: {},
-            loading: true,
-            page: {
-                pageSize: 10,
-                currentPage: 1,
-                total: 0
-            },
-            option: {
-                height: 680,
-                // calcHeight: 80,
-                tip: false,
-                searchShow: true,
-                searchMenuSpan: 8,
-                border: true,
-                index: true,
-                // selection: true,
-                viewBtn: true,
-                addBtn: true,
-                dialogType: 'dialog',
-                dialogClickModal: false,
-                column: [{
-                    label: "业委会成员",
-                    prop: "userId",
-                    span: 12,
-                    labelWidth: 120,
-                    type: "tree",
-                    remote: true,
-                    hide: true,
-                    // dicUrl: `/api/blade-system/user/searchUserByDistrictId?districtId={{key}}`,
-                    dicData: [],
-                    props: {
-                        label: 'name',
-                        value: 'id'
-                    },
-                    defaultExpandedKeys: [],
-                    change: ({
-                        value,
-                        column,
-                        item,
-                        dic
-                    }) => {
-                        this.form.mobile = ''
+  export default {
+    data() {
+      return {
+        owners: {},
+        userList: [],
+        form: {},
+        search: {},
+        excelBox: false,
+        selectionList: [],
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        option: {
+          height: 680,
+          // calcHeight: 80,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 8,
+          border: true,
+          index: true,
+          // selection: true,
+          viewBtn: true,
+          addBtn: true,
+          dialogType: 'dialog',
+          dialogClickModal: false,
+          column: [{
+              label: "业委会成员",
+              prop: "userId",
+              span: 12,
+              labelWidth: 120,
+              type: "tree",
+              remote: true,
+              hide: true,
+              // dicUrl: `/api/blade-system/user/searchUserByDistrictId?districtId={{key}}`,
+              dicData: [],
+              props: {
+                label: 'name',
+                value: 'id'
+              },
+              defaultExpandedKeys: [],
+              change: ({
+                value,
+                column,
+                item,
+                dic
+              }) => {
+                this.form.mobile = ''
 
-                        if (value) {
-                            this.form.mobile = item.phone
-                        }
-                    },
-                    rules: [{
-                        required: true,
-                        message: "请选择业委会成员",
-                        trigger: "blur",
-                    }]
-                }, {
-                    label: "名称",
-                    prop: "name",
-                    search: true,
-                    labelWidth: 120,
-                    display: false,
-                    // hide: true,
-                    rules: [{
-                        required: true,
-                        message: "请输入名称",
-                        trigger: "blur",
-                    },],
-                }, {
-                    label: "手机号",
-                    prop: "mobile",
-                    labelWidth: 120,
-                    hide: true,
-                    rules: [{
-                        required: true,
-                        message: "请输入手机号",
-                        trigger: "blur",
-                    },],
-                },
-                {
-                    label: "小区",
-                    prop: "areaId",
-                    searchSpan: 5,
-                    type: 'tree',
-                    dicUrl: `/api/blade-district/district/getDistrictTree`,
-                    props: {
-                        label: "name",
-                        value: "id"
-                    },
-                    defaultExpandedKeys: ["361102003"],
-                    span: 12,
-                    labelWidth: 120,
-                    width: 220,
-                    overHidden: true,
-                    rules: [{
-                        required: true,
-                        message: "请选择小区",
-                        trigger: "blur",
-                    },],
-                    display: false,
-                },
-                {
-                    label: "性别",
-                    prop: "sex",
-                    type: "select",
-                    hide: true,
-                    labelWidth: 120,
-                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=sex",
-                    dataType: "number",
-                    props: {
-                        label: "dictValue",
-                        value: "dictKey",
-                    },
-                    rules: [{
-                        required: true,
-                        message: "请选择性别",
-                        trigger: "blur",
-                    },],
-                },
-                {
-                    label: "职务",
-                    prop: "post",
-                    type: 'select',
-                    labelWidth: 120,
-                    // hide: true,
-                    // 职务:1主任,2副主任,3秘书长,4委员
-                    dicData: [{
-                        label: "主任",
-                        value: 1
-                    },
-                    {
-                        label: "副主任",
-                        value: 2
-                    },
-                    {
-                        label: "秘书长",
-                        value: 3
-                    },
-                    {
-                        label: "委员",
-                        value: 4
-                    }
-                    ],
-                    rules: [{
-                        required: true,
-                        message: "请选择职务",
-                        trigger: "blur",
-                    },],
-                },
-                {
-                    label: "加入时间",
-                    prop: "joinTime",
-                    type: "date",
-                    labelWidth: 120,
-                    format: "yyyy-MM-dd",
-                    valueFormat: "yyyy-MM-dd",
-                    // hide: true,
-                    rules: [{
-                        required: true,
-                        message: "请选择加入时间",
-                        trigger: "blur",
-                    },],
-                },
-                {
-                    label: "身份证",
-                    prop: "identityNum",
-                    // type: "date",
-                    labelWidth: 120,
-                    // hide: true,
-                },
-                {
-                    label: "民族",
-                    prop: "ethnicity",
-                    type: "select",
-                    hide: true,
-                    labelWidth: 120,
-                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
-                    dataType: "number",
-                    props: {
-                        label: "dictValue",
-                        value: "dictKey",
-                    },
-                },
-                {
-                    label: "学历",
-                    prop: "education",
-                    type: "select",
-                    hide: true,
-                    labelWidth: 120,
-                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
-                    dataType: "number",
-                    props: {
-                        label: "dictValue",
-                        value: "dictKey",
-                    },
-                },
-
-                // {
-                //   label: "工作状态",
-                //   prop: "workStatus",
-                //   type: "select",
-                //   labelWidth: 120,
-                //   hide: true,
-                //   dicUrl: "/api/blade-system/dict-biz/dictionary?code=workStatusType",
-                //   dataType: "number",
-                //   props: {
-                //     label: "dictValue",
-                //     value: "dictKey",
-                //   },
-                // },
-
-                // {
-                //   label: "婚姻状态",
-                //   prop: "maritalStatus",
-                //   type: "select",
-                //   labelWidth: 120,
-                //   hide: true,
-                //   dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
-                //   dataType: "number",
-                //   props: {
-                //     label: "dictValue",
-                //     value: "dictKey",
-                //   },
-                // },
-
-
-                {
-                    label: "排序",
-                    prop: "sort",
-                    labelWidth: 120,
-                    hide: true,
-                },
-                {
-                    label: "简介",
-                    prop: "profile",
-                    component: "AvueUeditor",
-                    options: {
-                        action: "/api/blade-resource/oss/endpoint/put-file",
-                        props: {
-                            res: "data",
-                            url: "link",
-                        },
-                    },
-                    hide: true,
-                    minRows: 6,
-                    span: 24,
-                },
-                    // {
-                    //   label: "简介",
-                    //   prop: "profile",
-                    //   labelWidth: 120,
-                    //   hide: true,
-                    // },
-                ]
-            },
-            ownersId: "",
-            data: [],
-            excelForm: {},
-            excelOption: {
-                submitBtn: false,
-                emptyBtn: false,
-                column: [{
-                    label: '模板上传',
-                    prop: 'excelFile',
-                    type: 'upload',
-                    drag: true,
-                    loadText: '模板上传中,请稍等',
-                    span: 24,
-                    propsHttp: {
-                        res: 'data'
-                    },
-                    tip: '请上传 .xls,.xlsx 标准格式文件',
-                    action: "/api/blade-system/user/import-user"
-                },
-                {
-                    label: "数据覆盖",
-                    prop: "isCovered",
-                    type: "switch",
-                    align: "center",
-                    width: 80,
-                    dicData: [{
-                        label: "否",
-                        value: 0
-                    },
-                    {
-                        label: "是",
-                        value: 1
-                    }
-                    ],
-                    value: 0,
-                    slot: true,
-                    rules: [{
-                        required: true,
-                        message: "请选择是否覆盖",
-                        trigger: "blur"
-                    }]
-                },
-                {
-                    label: '模板下载',
-                    prop: 'excelTemplate',
-                    formslot: true,
-                    span: 24,
+                if (value) {
+                  this.form.mobile = item.phone
+                  this.form.name = item.name
                 }
-                ]
+              },
+              rules: [{
+                required: true,
+                message: "请选择业委会成员",
+                trigger: "blur",
+              }]
+            }, {
+              label: "名称",
+              prop: "name",
+              search: true,
+              labelWidth: 120,
+              display: false,
+              // hide: true,
+              rules: [{
+                required: true,
+                message: "请输入名称",
+                trigger: "blur",
+              }, ],
+            }, {
+              label: "手机号",
+              prop: "mobile",
+              labelWidth: 120,
+              hide: true,
+              rules: [{
+                required: true,
+                message: "请输入手机号",
+                trigger: "blur",
+              }, ],
+            },
+            {
+              label: "小区",
+              prop: "areaId",
+              searchSpan: 5,
+              type: 'tree',
+              dicUrl: `/api/blade-district/district/getDistrictTree`,
+              props: {
+                label: "name",
+                value: "id"
+              },
+              defaultExpandedKeys: ["361102003"],
+              span: 12,
+              labelWidth: 120,
+              width: 220,
+              overHidden: true,
+              rules: [{
+                required: true,
+                message: "请选择小区",
+                trigger: "blur",
+              }, ],
+              display: false,
+            },
+            {
+              label: "性别",
+              prop: "sex",
+              type: "select",
+              hide: true,
+              labelWidth: 120,
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=sex",
+              dataType: "number",
+              props: {
+                label: "dictValue",
+                value: "dictKey",
+              },
+              rules: [{
+                required: true,
+                message: "请选择性别",
+                trigger: "blur",
+              }, ],
+            },
+            {
+              label: "职务",
+              prop: "post",
+              type: 'select',
+              labelWidth: 120,
+              // hide: true,
+              // 职务:1主任,2副主任,3秘书长,4委员
+              dicData: [{
+                  label: "主任",
+                  value: 1
+                },
+                {
+                  label: "副主任",
+                  value: 2
+                },
+                {
+                  label: "秘书长",
+                  value: 3
+                },
+                {
+                  label: "委员",
+                  value: 4
+                }
+              ],
+              rules: [{
+                required: true,
+                message: "请选择职务",
+                trigger: "blur",
+              }, ],
+            },
+            {
+              label: "加入时间",
+              prop: "joinTime",
+              type: "date",
+              labelWidth: 120,
+              format: "yyyy-MM-dd",
+              valueFormat: "yyyy-MM-dd",
+              // hide: true,
+              rules: [{
+                required: true,
+                message: "请选择加入时间",
+                trigger: "blur",
+              }, ],
+            },
+            {
+              label: "身份证",
+              prop: "identityNum",
+              // type: "date",
+              labelWidth: 120,
+              // hide: true,
+            },
+            {
+              label: "民族",
+              prop: "ethnicity",
+              type: "select",
+              hide: true,
+              labelWidth: 120,
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
+              dataType: "number",
+              props: {
+                label: "dictValue",
+                value: "dictKey",
+              },
+            },
+            {
+              label: "学历",
+              prop: "education",
+              type: "select",
+              hide: true,
+              labelWidth: 120,
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
+              dataType: "number",
+              props: {
+                label: "dictValue",
+                value: "dictKey",
+              },
+            },
+
+            // {
+            //   label: "工作状态",
+            //   prop: "workStatus",
+            //   type: "select",
+            //   labelWidth: 120,
+            //   hide: true,
+            //   dicUrl: "/api/blade-system/dict-biz/dictionary?code=workStatusType",
+            //   dataType: "number",
+            //   props: {
+            //     label: "dictValue",
+            //     value: "dictKey",
+            //   },
+            // },
+
+            // {
+            //   label: "婚姻状态",
+            //   prop: "maritalStatus",
+            //   type: "select",
+            //   labelWidth: 120,
+            //   hide: true,
+            //   dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
+            //   dataType: "number",
+            //   props: {
+            //     label: "dictValue",
+            //     value: "dictKey",
+            //   },
+            // },
+
+
+            {
+              label: "排序",
+              prop: "sort",
+              labelWidth: 120,
+              hide: true,
+            },
+            {
+              label: "简介",
+              prop: "profile",
+              component: "AvueUeditor",
+              options: {
+                action: "/api/blade-resource/oss/endpoint/put-file",
+                props: {
+                  res: "data",
+                  url: "link",
+                },
+              },
+              hide: true,
+              minRows: 6,
+              span: 24,
+            },
+            // {
+            //   label: "简介",
+            //   prop: "profile",
+            //   labelWidth: 120,
+            //   hide: true,
+            // },
+          ]
+        },
+        ownersId: "",
+        data: [],
+        excelForm: {},
+        excelOption: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [{
+              label: '模板上传',
+              prop: 'excelFile',
+              type: 'upload',
+              drag: true,
+              loadText: '模板上传中,请稍等',
+              span: 24,
+              propsHttp: {
+                res: 'data'
+              },
+              tip: '请上传 .xls,.xlsx 标准格式文件',
+              action: "/api/blade-system/user/import-user"
+            },
+            {
+              label: "数据覆盖",
+              prop: "isCovered",
+              type: "switch",
+              align: "center",
+              width: 80,
+              dicData: [{
+                  label: "否",
+                  value: 0
+                },
+                {
+                  label: "是",
+                  value: 1
+                }
+              ],
+              value: 0,
+              slot: true,
+              rules: [{
+                required: true,
+                message: "请选择是否覆盖",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: '模板下载',
+              prop: 'excelTemplate',
+              formslot: true,
+              span: 24,
             }
+          ]
         }
+      }
     },
     watch: {},
     computed: {
-        ...mapGetters(["userInfo", "permission"]),
-        permissionList () {
-            return {
-                addBtn: this.vaildData(this.permission.household_add, true),
-                viewBtn: this.vaildData(this.permission.household_view, true),
-                delBtn: this.vaildData(this.permission.household_delete, true),
-                editBtn: this.vaildData(this.permission.household_edit, true)
-            }
+      ...mapGetters(["userInfo", "permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.household_add, true),
+          viewBtn: this.vaildData(this.permission.household_view, true),
+          delBtn: this.vaildData(this.permission.household_delete, true),
+          editBtn: this.vaildData(this.permission.household_edit, true)
         }
+      }
     },
-    mounted () { },
+    mounted() {},
     methods: {
-        init (data) {
-            this.ownersId = data.id
-            this.owners = data
-            const column = this.findObject(this.option.column, "userId")
-            let arr = []
-            arr.push(this.owners.areaId)
-            column.defaultExpandedKeys = arr
+      init(data) {
+        this.ownersId = data.id
+        this.owners = data
+        const column = this.findObject(this.option.column, "userId")
+        let arr = []
+        arr.push(this.owners.areaId)
+        column.defaultExpandedKeys = arr
+        this.onLoad(this.page)
+      },
+      rowSave(row, done, loading) {
+        row['ownersId'] = this.ownersId
+        row['areaId'] = this.owners.areaId
+        add(row).then(() => {
+          this.initFlag = false
+          this.onLoad(this.page)
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          })
+          done()
+        }, error => {
+          // window.console.log(error);
+          loading()
+        })
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.initFlag = false
+          this.onLoad(this.page)
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          })
+          done()
+        }, error => {
+          // window.console.log(error);
+          loading()
+        })
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id)
+          })
+          .then(() => {
             this.onLoad(this.page)
-        },
-        rowSave (row, done, loading) {
-            row['ownersId'] = this.ownersId
-            row['areaId'] = this.owners.areaId
-            add(row).then(() => {
-                this.initFlag = false
-                this.onLoad(this.page)
-                this.$message({
-                    type: "success",
-                    message: "操作成功!"
-                })
-                done()
-            }, error => {
-                // window.console.log(error);
-                loading()
+            this.$message({
+              type: "success",
+              message: "操作成功!"
             })
-        },
-        rowUpdate (row, index, done, loading) {
-            update(row).then(() => {
-                this.initFlag = false
-                this.onLoad(this.page)
-                this.$message({
-                    type: "success",
-                    message: "操作成功!"
-                })
-                done()
-            }, error => {
-                // window.console.log(error);
-                loading()
-            })
-        },
-        rowDel (row) {
-            this.$confirm("确定将选择数据删除?", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-            })
-                .then(() => {
-                    return remove(row.id)
-                })
-                .then(() => {
-                    this.onLoad(this.page)
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!"
-                    })
-                })
-        },
-        searchReset () {
-            this.query = {}
-            this.treeDeptId = ''
-            this.onLoad(this.page)
-        },
-        searchChange (params, done) {
-            this.query = params
-            this.page.currentPage = 1
-            this.onLoad(this.page, params)
-            done()
-        },
-        selectionChange (list) {
-            this.selectionList = list
-        },
-        selectionClear () {
-            this.selectionList = []
-            // this.$refs.crud.toggleSelection();
-        },
-        handleDelete () {
-            if (this.selectionList.length === 0) {
-                this.$message.warning("请选择至少一条数据")
-                return
-            }
-            this.$confirm("确定将选择数据删除?", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-            })
-                .then(() => {
-                    return remove(this.ids)
-                })
-                .then(() => {
-                    this.onLoad(this.page)
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!"
-                    })
-                    this.$refs.crud.toggleSelection()
-                })
-        },
-        handleImport () {
-            this.excelBox = true
-        },
-        uploadAfter (res, done, loading, column) {
-            this.excelBox = false
-            this.refreshChange()
-            done()
-        },
-        handleExport () {
-            this.$confirm("是否导出住户数据?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-            }).then(() => {
-                NProgress.start()
-                var data = {
-                    ...this.query
-                }
-                data = Qs.stringify(data)
-                exportBlob(
-                    `/api/blade-household/household/export-household?${this.website.tokenHeader}=${getToken()}&` + data
-                ).then(res => {
-                    downloadXls(res.data, `住户数据表${dateNow()}.xlsx`)
-                    NProgress.done()
-                })
-            })
-        },
-        handleTemplate () {
-            exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
-                downloadXls(res.data, "住户数据模板.xlsx")
-            })
-        },
-        beforeOpen (done, type) {
-            if (["edit", "view"].includes(type)) {
-                getDetail(this.form.id).then(res => {
-                    this.form = res.data.data
-                    const column = this.findObject(this.option.column, "userId")
-                    console.table(this.userList)
-                    column.dicData = this.userList
-                })
-            }
-            this.initFlag = true
-            done()
-        },
-        currentChange (currentPage) {
-            this.page.currentPage = currentPage
-        },
-        sizeChange (pageSize) {
-            this.page.pageSize = pageSize
-        },
-        refreshChange () {
-            this.onLoad(this.page, this.query)
-        },
-        onLoad (page, params = {}) {
-            params['ownersId'] = this.ownersId
-            this.loading = true
-            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-                const data = res.data.data
-                this.page.total = data.total
-                this.data = data.records
-                this.loading = false
-                this.selectionClear()
-            })
-            getUserByDistrictId(this.owners.areaId).then(res => {
-                const column = this.findObject(this.option.column, "userId")
-                this.userList = res.data.data
-                column.dicData = res.data.data
-            })
+          })
+      },
+      searchReset() {
+        this.query = {}
+        this.treeDeptId = ''
+        this.onLoad(this.page)
+      },
+      searchChange(params, done) {
+        this.query = params
+        this.page.currentPage = 1
+        this.onLoad(this.page, params)
+        done()
+      },
+      selectionChange(list) {
+        this.selectionList = list
+      },
+      selectionClear() {
+        this.selectionList = []
+        // this.$refs.crud.toggleSelection();
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据")
+          return
         }
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(this.ids)
+          })
+          .then(() => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+            this.$refs.crud.toggleSelection()
+          })
+      },
+      handleImport() {
+        this.excelBox = true
+      },
+      uploadAfter(res, done, loading, column) {
+        this.excelBox = false
+        this.refreshChange()
+        done()
+      },
+      handleExport() {
+        this.$confirm("是否导出住户数据?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          NProgress.start()
+          var data = {
+            ...this.query
+          }
+          data = Qs.stringify(data)
+          exportBlob(
+            `/api/blade-household/household/export-household?${this.website.tokenHeader}=${getToken()}&` + data
+          ).then(res => {
+            downloadXls(res.data, `住户数据表${dateNow()}.xlsx`)
+            NProgress.done()
+          })
+        })
+      },
+      handleTemplate() {
+        exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
+          downloadXls(res.data, "住户数据模板.xlsx")
+        })
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data
+            const column = this.findObject(this.option.column, "userId")
+            console.table(this.userList)
+            column.dicData = this.userList
+          })
+        }
+        this.initFlag = true
+        done()
+      },
+      currentChange(currentPage) {
+        this.page.currentPage = currentPage
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query)
+      },
+      onLoad(page, params = {}) {
+        params['ownersId'] = this.ownersId
+        this.loading = true
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data
+          this.page.total = data.total
+          this.data = data.records
+          this.loading = false
+          this.selectionClear()
+        })
+        getUserByDistrictId(this.owners.areaId).then(res => {
+          const column = this.findObject(this.option.column, "userId")
+          this.userList = res.data.data
+          column.dicData = res.data.data
+        })
+      }
     }
-}
+  }
 </script>
 
 <style>
-.box {
+  .box {
     height: 800px;
-}
+  }
 
-.el-scrollbar {
+  .el-scrollbar {
     height: 100%;
-}
+  }
 
-.box .el-scrollbar__wrap {
+  .box .el-scrollbar__wrap {
     overflow: scroll;
-}
+  }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3