linwe
2024-05-29 27a5e47675c12d5faa9a99cd324aeac5d243d6c0
E呼即办优化
2 files modified
2 files added
2373 ■■■■■ changed files
src/api/task/eCallEventTwo.js 6 ●●●●● patch | view | raw | blame | history
src/views/cGovernance/assessmentIndicators/index.vue 379 ●●●●● patch | view | raw | blame | history
src/views/cGovernance/statisticalAnalysis/index.vue 367 ●●●●● patch | view | raw | blame | history
src/views/userHouse/hireInfoList.vue 1621 ●●●● patch | view | raw | blame | history
src/api/task/eCallEventTwo.js
@@ -21,6 +21,12 @@
    }
  })
}
export const getUnitAssessmentIndicators = () => {
  return request({
    url: '/api/blade-eCallEventTwo/eCallEventTwo/getUnitAssessmentIndicators',
    method: 'get',
  })
}
export const remove = (ids) => {
  return request({
src/views/cGovernance/assessmentIndicators/index.vue
New file
@@ -0,0 +1,379 @@
<!-- e 呼即办 -->
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
    </avue-crud>
  </basic-container>
</template>
<script>
  import {
    setToken,
    setRefreshToken,
    removeToken,
    removeRefreshToken,
  } from "@/util/auth";
  import {
    getUnitAssessmentIndicators
  } from "@/api/task/eCallEventTwo"
  import {
    add as circleAdd,
  } from "@/api/circle/circle"
  import {
    getList as getHouseList,
    getDetatil as getHouseDetail
  } from "@/api/doorplateAddress/doorplateAddress.js"
  import {
    mapGetters
  } from "vuex"
  import website from '@/config/website'
  export default {
    data() {
      return {
        editPopup: false,
        form: {},
        editForm: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        sharePopup: false,
        circleRadio: 0,
        shareCircleRow: {},
        option: {
          labelWidth: 130,
          // searchShow: true,
          // searchMenuSpan: 3,
          // menuWidth: 310,
          menu: false,
          delBtn: false,
          editBtn: false,
          addBtn: false,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          border: true,
          index: true,
          // viewBtn: true,
          // selection: true,
          dialogClickModal: false,
          column: [{
              label: "单位",
              prop: "acpt_org_name",
              span: 12,
              searchSpan: 4,
              // width: 160,
              overHidden: true,
              // search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            },
            {
              label: "及时签收率%",
              prop: "accept_perc",
              span: 12,
              searchSpan: 4,
              // width: 160,
              overHidden: true,
              // search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            }, {
              label: "按时响应率%",
              prop: "feedback_perc",
              span: 12,
              searchSpan: 4,
              // width: 160,
              overHidden: true,
              // search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            }, {
              label: "按时反馈率%",
              prop: "complete_perc",
              span: 12,
              searchSpan: 4,
              // width: 160,
              overHidden: true,
              // search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            }, {
              label: "首次答复率%",
              prop: "satisfied_perc",
              span: 12,
              searchSpan: 4,
              // width: 160,
              overHidden: true,
              // search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            }, {
              label: "限时办结率%",
              prop: "response_perc",
              span: 12,
              searchSpan: 4,
              // width: 160,
              overHidden: true,
              // search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            },
          ],
        },
        data: [],
      }
    },
    computed: {
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.eCallEvent_add, true),
          viewBtn: this.vaildData(this.permission.eCallEvent_view, true),
          delBtn: this.vaildData(this.permission.eCallEvent_delete, true),
          editBtn: this.vaildData(this.permission.eCallEvent_edit, true),
        }
      },
      ids() {
        let ids = []
        this.selectionList.forEach((ele) => {
          ids.push(ele.id)
        })
        return ids.join(",")
      },
      textDispose() {
        return (row, flag, type) => {
          if (row[flag] || row[type] == null) {
            return row[type]
          } else {
            if (type == 'principalIdCard') {
              return row[type].replace(/^(.{6})(?:\d+)(.{4})$/, "$1******$2")
            } else {
              return row[type].replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
            }
          }
        }
      }
    },
    methods: {
      openMap() {
        this.$refs.avueInputMap.box = true
        console.log(this.$refs.avueInputMap)
      },
      openMapTwo() {
        this.$refs.avueInputMapTwo.box = true
        console.log(this.$refs.avueInputMap)
      },
      showStringDispose(row, type) {
        row[type] = !row[type]
      },
      locationDispose(data) {
        return {
          longitude: data[0],
          latitude: data[1],
          sceneAddr: data[2]
        }
      },
      rowSave(row, done, loading) {
        add(row).then(
          () => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      handleSubmit(form, done) {
        update(form).then(
          () => {
            this.onLoad(this.page)
            this.editPopup = false
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(
          () => {
            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.orderId)
          })
          .then(() => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
          })
      },
      searchReset() {
        this.query = {}
        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()
      },
      share(row) {
        console.table(row)
        this.shareCircleRow = row
        this.sharePopup = true
      },
      // 分享圈子
      shareCircle() {
        this.sharePopup = false
        let param = {}
        param.circleType = this.circleRadio
        param.houseCode = this.shareCircleRow.addressCode
        param.circleImages = this.shareCircleRow.imageUrls
        param.communityCode = this.shareCircleRow.communityCode
        param.circleText = this.shareCircleRow.remark
        param.evenType = 2
        param.eventId = this.shareCircleRow.id
        circleAdd(param).then(
          () => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      popupClose() {
        this.sharePopup = false
      },
      handleEdit(row) {
        getDetail(row.orderId).then((res) => {
          this.editForm = res.data.data
          this.editPopup = true
        })
      },
      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()
          })
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.orderId).then((res) => {
            this.form = res.data.data
          })
        }
        // con
        done()
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize
      },
      refreshChange() {
        this.onLoad(this.page, this.query)
      },
      onLoad(page, params = {}) {
        this.loading = true
        getUnitAssessmentIndicators().then((res) => {
          const data = res.data
          console.table(res.data)
          // this.page.total = data.total
          this.data = res.data.data
          // this.data.forEach(item => {})
          this.loading = false
          this.selectionClear()
        })
      }
    },
  }
</script>
<style>
  .avue-upload__icon {
    line-height: 6;
  }
</style>
src/views/cGovernance/statisticalAnalysis/index.vue
New file
@@ -0,0 +1,367 @@
<!-- e 呼即办 -->
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
    </avue-crud>
  </basic-container>
</template>
<script>
  import {
    setToken,
    setRefreshToken,
    removeToken,
    removeRefreshToken,
  } from "@/util/auth";
  import {
    getList,
    remove,
    update,
    add,
    getDetail
  } from "@/api/task/eCallEventTwo"
  import {
    add as circleAdd,
  } from "@/api/circle/circle"
  import {
    getList as getHouseList,
    getDetatil as getHouseDetail
  } from "@/api/doorplateAddress/doorplateAddress.js"
  import {
    mapGetters
  } from "vuex"
  import website from '@/config/website'
  //   import AvueMap from "avue-plugin-map";
  export default {
    data() {
      return {
        editPopup: false,
        form: {},
        editForm: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        sharePopup: false,
        circleRadio: 0,
        shareCircleRow: {},
        option: {
          labelWidth: 130,
          // searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 310,
          delBtn: false,
          editBtn: false,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          border: true,
          //stripe:true,
          index: true,
          viewBtn: true,
          selection: true,
          // excelBtn: true,
          dialogClickModal: false,
          column: [{
              label: "工单号",
              prop: "orderCode",
              span: 12,
              searchSpan: 4,
              width: 160,
              overHidden: true,
              search: true,
              searchLabelWidth: 76,
              addDisplay: false,
            },
          ],
        },
        data: [],
      }
    },
    computed: {
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.eCallEvent_add, true),
          viewBtn: this.vaildData(this.permission.eCallEvent_view, true),
          delBtn: this.vaildData(this.permission.eCallEvent_delete, true),
          editBtn: this.vaildData(this.permission.eCallEvent_edit, true),
        }
      },
      ids() {
        let ids = []
        this.selectionList.forEach((ele) => {
          ids.push(ele.id)
        })
        return ids.join(",")
      },
      textDispose() {
        return (row, flag, type) => {
          if (row[flag] || row[type] == null) {
            return row[type]
          } else {
            if (type == 'principalIdCard') {
              return row[type].replace(/^(.{6})(?:\d+)(.{4})$/, "$1******$2")
            } else {
              return row[type].replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
            }
          }
        }
      }
    },
    methods: {
      openMap() {
        this.$refs.avueInputMap.box = true
        console.log(this.$refs.avueInputMap)
      },
      openMapTwo() {
        this.$refs.avueInputMapTwo.box = true
        console.log(this.$refs.avueInputMap)
      },
      showStringDispose(row, type) {
        row[type] = !row[type]
      },
      locationDispose(data) {
        return {
          longitude: data[0],
          latitude: data[1],
          sceneAddr: data[2]
        }
      },
      rowSave(row, done, loading) {
        console.log("777777777777777777777" + JSON.stringify(row))
        // let local = this.locationDispose(row.sceneAddr)
        // row.sceneAddr = local.sceneAddr
        // row.sceneGeoLat = local.latitude
        // row.sceneGeoLng = local.longitude
        console.log("88888888888888888888888888" + JSON.stringify(row))
        add(row).then(
          () => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      handleSubmit(form, done) {
        update(form).then(
          () => {
            this.onLoad(this.page)
            this.editPopup = false
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(
          () => {
            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.orderId)
          })
          .then(() => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
          })
      },
      searchReset() {
        this.query = {}
        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()
      },
      share(row) {
        console.table(row)
        this.shareCircleRow = row
        this.sharePopup = true
      },
      // 分享圈子
      shareCircle() {
        this.sharePopup = false
        let param = {}
        param.circleType = this.circleRadio
        param.houseCode = this.shareCircleRow.addressCode
        param.circleImages = this.shareCircleRow.imageUrls
        param.communityCode = this.shareCircleRow.communityCode
        param.circleText = this.shareCircleRow.remark
        param.evenType = 2
        param.eventId = this.shareCircleRow.id
        circleAdd(param).then(
          () => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      popupClose() {
        this.sharePopup = false
      },
      handleEdit(row) {
        getDetail(row.orderId).then((res) => {
          this.editForm = res.data.data
          this.editPopup = true
        })
      },
      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()
          })
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.orderId).then((res) => {
            this.form = res.data.data
          })
        }
        // con
        done()
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize
      },
      refreshChange() {
        this.onLoad(this.page, this.query)
      },
      onLoad(page, params = {}) {
        const {
          dateTime
        } = this.query
        let values = {
          ...params,
        }
        if (dateTime) {
          values = {
            ...params,
            startTime: dateTime[0],
            endTime: dateTime[1],
            ...this.query,
          }
          values.dateTime = null
        }
        this.loading = true
        getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data
          this.page.total = data.total
          this.data = data.records
          this.data.forEach(item => {
            // this.$set(item, 'phoneflag', false)
            // if (item.imageUrls) {
            //   if (item.imageUrls.length > 0) {
            //     var urls = []
            //     var names = item.imageUrls.split(",")
            //     names.forEach(name => {
            //       urls.push(website.minioUrl + name)
            //     })
            //     item.imageUrls = urls.join(",")
            //   }
            // }
          })
          this.loading = false
          this.selectionClear()
        })
      }
    },
  }
</script>
<style>
  .avue-upload__icon {
    line-height: 6;
  }
</style>
src/views/userHouse/hireInfoList.vue
@@ -1,883 +1,882 @@
<template>
    <el-row>
        <el-col :span="24">
            <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" @on-load="onLoad">
                    <template slot-scope="{row, size}" slot="auditStatus">
                        <el-tag :size="size" :type="showConfirmFlag(row.auditStatus).type">
                            {{ showConfirmFlag(row.auditStatus).text }}
                        </el-tag>
                    </template>
  <el-row>
    <el-col :span="24">
      <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" @on-load="onLoad">
          <template slot-scope="{row, size}" slot="auditStatus">
            <el-tag :size="size" :type="showConfirmFlag(row.auditStatus).type">
              {{ showConfirmFlag(row.auditStatus).text }}
            </el-tag>
          </template>
                    <template slot="menuLeft">
                        <el-button type="primary" size="small" plain icon="el-icon-plus"
                            v-if="permission.houseRental_add" @click="showEditMoel(1)">新 增
                        </el-button>
                        <el-button type="danger" size="small" plain icon="el-icon-delete"
                            v-if="permission.houseRental_delete" @click="handleDelete">删 除
                        </el-button>
          <template slot="menuLeft">
            <el-button type="primary" size="small" plain icon="el-icon-plus" v-if="permission.houseRental_add"
              @click="showEditMoel(1)">新 增
            </el-button>
            <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.houseRental_delete"
              @click="handleDelete">删 除
            </el-button>
                    </template>
          </template>
                    <template slot-scope="{row, size}" slot="menu">
                        <el-button type="text" :size="size" icon="el-icon-edit" v-if="permission.houseRental_edit"
                            @click="showEditMoel(2, row)">编 辑
                        </el-button>
          <template slot-scope="{row, size}" slot="menu">
            <el-button type="text" :size="size" icon="el-icon-edit" v-if="permission.houseRental_edit"
              @click="showEditMoel(2, row)">编 辑
            </el-button>
                        <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
                            v-if="permission.househould_manager" @click="ManageTenants(row)">管理租户
                        </el-button>
            <el-button :size="size" type="text" icon="el-icon-circle-plus-outline" v-if="permission.househould_manager"
              @click="ManageTenants(row)">管理租户
            </el-button>
                        <!-- <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
            <!-- <el-button :size="size" type="text" icon="el-icon-circle-plus-outline"
                             @click="ManageTenants(row)">管理租户
                        </el-button> -->
                        <!--  <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入
            <!--  <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入
            </el-button>
            <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
            </el-button> -->
                    </template>
                </avue-crud>
          </template>
        </avue-crud>
                <el-dialog title="租户管理" append-to-body :visible.sync="roleBox">
                    <avue-crud :option="houseHoldOption" :search.sync="search" :table-loading="loading"
                        :data="houseHold" ref="crud" v-model="houseHoldForm" :permission="permissionList"
                        @row-del="houseHoldRowDel" @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave"
                        :page.sync="holdPage" @search-change="searchChange" @search-reset="searchReset"
                        @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
                        @refresh-change="refreshChange"></avue-crud>
                </el-dialog>
        <el-dialog title="租户管理" append-to-body :visible.sync="roleBox">
          <avue-crud :option="houseHoldOption" :search.sync="search" :table-loading="loading" :data="houseHold"
            ref="crud" v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel"
            @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave" :page.sync="holdPage"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"></avue-crud>
        </el-dialog>
                <el-dialog title="用户数据导入" append-to-body :visible.sync="excelBox" width="555px">
                    <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
        <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 type="primary" @click="handleTemplate">
                                点击下载<i class="el-icon-download el-icon--right"></i>
                            </el-button>
                        </template>
                    </avue-form>
                </el-dialog>
            <template slot="excelTemplate">
              <el-button type="primary" @click="handleTemplate">
                点击下载<i class="el-icon-download el-icon--right"></i>
              </el-button>
            </template>
          </avue-form>
        </el-dialog>
                <retalInfo ref="RetalInfo"></retalInfo>
        <retalInfo ref="RetalInfo"></retalInfo>
            </basic-container>
        </el-col>
    </el-row>
      </basic-container>
    </el-col>
  </el-row>
</template>
<script>
import {
  import {
    getList as getHouseholdList,
    remove as householdDel,
    add as householdAdd,
    update as householdUpdate,
    getDetatil as getHouseholdDetatil
} from "@/api/userHouse/list/houseHold.js"
import {
  } from "@/api/userHouse/list/houseHold.js"
  import {
    getList,
    getPageList,
    remove,
    add,
    update,
    getDetatil
} from "@/api/userHouse/list/houseRental.js"
import {
  } from "@/api/userHouse/list/houseRental.js"
  import {
    getList as getHouseList,
    getDetatil as getHouseDetail
} from "@/api/userHouse/list/house.js"
import {
  } from "@/api/userHouse/list/house.js"
  import {
    exportBlob
} from "@/api/common"
import {
  } from "@/api/common"
  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 func from "@/util/func"
import Qs from "qs"
import website from '@/config/website'
  } from "@/util/date"
  import NProgress from 'nprogress'
  import 'nprogress/nprogress.css'
  import func from "@/util/func"
  import Qs from "qs"
  import website from '@/config/website'
import retalInfo from './components/retalInfo'
export default {
    components: { retalInfo },
  import retalInfo from './components/retalInfo'
  export default {
    components: {
      retalInfo
    },
    data() {
        return {
            roleBox: false,
            form: {},
            search: {},
            excelBox: false,
            selectionList: [],
            query: {},
            loading: true,
            page: {
      return {
        roleBox: false,
        form: {},
        search: {},
        excelBox: false,
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        rowHouseHold: {},
        houseHoldForm: {
          relationship: 18,
          roleType: 2,
        },
        houseHold: [],
        holdPage: {
          pageSize: 100,
          currentPage: 1,
          total: 0
        },
        houseHoldOption: {
          height: '500',
          calcHeight: 80,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          // selection: true,
          viewBtn: true,
          addBtn: true,
          dialogType: 'drawer',
          dialogClickModal: false,
          column: [{
              label: "姓名",
              prop: "name",
              // search: true,
              searchSpan: 4,
            },
            {
              label: "电话",
              prop: "phoneNumber",
              width: 100,
              // search: true,
              searchSpan: 4,
            },
            {
              label: "身份证号",
              prop: "idCard",
              width: 160,
              // search: true,
              searchSpan: 4,
            },
            {
              label: "性别",
              prop: "gender",
              type: "select",
              dicData: [{
                  label: "男",
                  value: 1
                },
                {
                  label: "女",
                  value: 0
                },
                {
                  label: "未知",
                  value: 1
                }
              ],
            },
            // {
            //     label: "关系",
            //     prop: "relationship",
            //     type: "select",
            //     dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
            //     dataType: "number",
            //     props: {
            //         label: "dictValue",
            //         value: "dictKey",
            //     },
            //     display: false
            // },
            {
              label: "民族",
              prop: "ethnicity",
              type: "select",
              // hide: true,
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
              dataType: "number",
              props: {
                label: "dictValue",
                value: "dictKey",
              },
            },
            {
              width: 220,
              overHidden: true,
              label: '小区名称',
              prop: "aoiName",
              // search: true,
              searchSpan: 4,
              display: false
            },
            // {
            //     label: "地址",
            //     prop: "address",
            //     minWidth: 160,
            //     overHidden: true,
            //     display: false
            // },
            {
              label: "户籍地址",
              prop: "hukouRegistration",
              // hide: true,
              minWidth: 150,
              overHidden: true,
            },
            {
              label: "工作单位",
              prop: "employer",
              // editDisplay:false,
              // hide: true,
            },
          ]
        },
        option: {
          labelWidth: 120,
          searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 280,
          height: 'auto',
          calcHeight: 80,
          tip: false,
          border: true,
          index: true,
          selection: true,
          viewBtn: true,
          addBtn: false,
          editBtn: false,
          dialogType: 'drawer',
          dialogClickModal: false,
          column: [{
              label: "房屋",
              prop: "houseName",
              display: false,
              minWidth: 150,
              overHidden: true,
            },
            {
              label: "房屋",
              prop: "houseCode",
              hide: true,
              type: "table",
              children: {
                border: true,
                height: 400,
                searchShow: true,
                searchMenuSpan: 6,
                submitText: "确定",
                column: [
                  // {
                  //     width: 220,
                  //     overHidden: true,
                  //     label: '小区名称',
                  //     prop: "districtName",
                  //     search: true,
                  //     searchSpan: 4,
                  //     rules: [{
                  //         required: true,
                  //         message: "请输入小区名称",
                  //         trigger: "blur",
                  //     },],
                  // },
                  {
                    label: "地址",
                    prop: "address",
                    minWidth: 180,
                    display: false
                  },
                ],
              },
              page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            rowHouseHold: {},
            houseHoldForm: {
                relationship: 18,
                roleType: 2,
            },
            houseHold: [],
            holdPage: {
                pageSize: 100,
                currentPage: 1,
                total: 0
            },
            houseHoldOption: {
                height: '500',
                calcHeight: 80,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                // selection: true,
                viewBtn: true,
                addBtn: true,
                dialogType: 'drawer',
                dialogClickModal: false,
                column: [{
                    label: "姓名",
                    prop: "name",
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "电话",
                    prop: "phoneNumber",
                    width: 100,
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "身份证号",
                    prop: "idCard",
                    width: 160,
                    // search: true,
                    searchSpan: 4,
                },
                {
                    label: "性别",
                    prop: "gender",
                    type: "select",
                    dicData: [{
                        label: "男",
                        value: 1
                    },
                    {
                        label: "女",
                        value: 0
                    },
                    {
                        label: "未知",
                        value: 1
                    }
                    ],
                },
                // {
                //     label: "关系",
                //     prop: "relationship",
                //     type: "select",
                //     dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                //     dataType: "number",
                //     props: {
                //         label: "dictValue",
                //         value: "dictKey",
                //     },
                //     display: false
                // },
                {
                    label: "民族",
                    prop: "ethnicity",
                    type: "select",
                    // hide: true,
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                {
                    width: 220,
                    overHidden: true,
                    label: '小区名称',
                    prop: "aoiName",
                    // search: true,
                    searchSpan: 4,
                    display: false
                },
                // {
                //     label: "地址",
                //     prop: "address",
                //     minWidth: 160,
                //     overHidden: true,
                //     display: false
                // },
                {
                    label: "户籍地址",
                    prop: "hukouRegistration",
                    // hide: true,
                    minWidth: 150,
                    overHidden: true,
                },
                {
                    label: "工作单位",
                    prop: "employer",
                    // editDisplay:false,
                    // hide: true,
                },
                ]
            },
            option: {
                labelWidth: 120,
                searchLabelWidth: 96,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                height: 'auto',
                calcHeight: 80,
                tip: false,
                border: true,
                index: true,
                selection: true,
                viewBtn: true,
                addBtn: false,
                editBtn: false,
                dialogType: 'drawer',
                dialogClickModal: false,
                column: [
                    {
                        label: "房屋",
                        prop: "houseName",
                        display: false,
                        minWidth: 150,
                        overHidden: true,
                    },
                    {
                        label: "房屋",
                        prop: "houseCode",
                        hide: true,
                        type: "table",
                        children: {
                            border: true,
                            height: 400,
                            searchShow: true,
                            searchMenuSpan: 6,
                            submitText: "确定",
                            column: [
                                // {
                                //     width: 220,
                                //     overHidden: true,
                                //     label: '小区名称',
                                //     prop: "districtName",
                                //     search: true,
                                //     searchSpan: 4,
                                //     rules: [{
                                //         required: true,
                                //         message: "请输入小区名称",
                                //         trigger: "blur",
                                //     },],
                                // },
                                {
                                    label: "地址",
                                    prop: "address",
                                    minWidth: 180,
                                    display: false
                                },
                            ],
                        },
                        page: {
                            pageSize: 10,
                            currentPage: 1,
                            total: 0
                        },
                        formatter: (row) => {
                            return row.houseName
                        },
                        onLoad: ({
                            page,
                            value,
                            data
                        }, callback) => {
                            //首次加载去查询对应的值
                            if (value) {
                                getHouseDetail({
                                    houseCode: value
                                }).then(res => {
                                    var resData = res.data.data
                                    // 查询对应行数据
                                    callback(resData)
                                    return
                                })
                            }
                            if (page) {
                                this.loading = true
                                getHouseList(page.currentPage, page.pageSize, Object.assign(data)).then(res => {
                                    const resData = res.data.data
                                    var total = resData.total
                                    var data = resData.records
                                    this.loading = false
                                    this.selectionClear()
                                    //分页查询信息
                                    callback({
                                        total: total,
                                        data: data
                                    })
                                })
                            }
                        },
                        props: {
                            label: 'address',
                            value: 'houseCode'
                        }
                    },
                    {
                        label: "关系",
                        prop: "tenantRelationship",
                        search: true,
                        searchSpan: 3,
                        searchLabelWidth: 46,
                        width: 100,
                        type: "select",
                        dicData: [{
                            label: "同一户",
                            value: 1
                        },
                        {
                            label: "不同一户",
                            value: 2
                        }
                        ],
                        rules: [{
                            required: true,
                            message: "请选择关系",
                            trigger: "blur",
                        },],
                    },
                    {
                        label: "房屋状态",
                        prop: "houseStatus",
                        search: true,
                        searchSpan: 4,
                        width: 100,
                        type: "select",
                        dicData: [{
                            label: "部分出租",
                            value: 1
                        },
                        {
                            label: "全部出租",
                            value: 2
                        }
                        ],
                        rules: [{
                            required: true,
                            message: "请选择房屋状态",
                            trigger: "blur",
                        },],
                    },
                    {
                        label: "用途",
                        prop: "rentalUse",
                        type: "select",
                        searchSpan: 3,
                        searchLabelWidth: 66,
                        search: true,
                        dataType: "number",
                        width: 100,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=rentalUseType",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        rules: [{
                            required: true,
                            message: "请选择用途",
                            trigger: "blur",
                        },],
                    },
                    {
                        width: 100,
                        label: "租房时间",
                        prop: "rentalTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        rules: [{
                            required: true,
                            message: "请选择租房时间",
                            trigger: "blur",
                        },],
                    },
                    {
                        label: "到期时间",
                        prop: "dueTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        width: 100,
                        rules: [{
                            required: true,
                            message: "请选择到期时间",
                            trigger: "blur",
                        },],
                    },
                    {
                        label: "租赁期限",
                        prop: "dldType",
                        width: 100,
                        display: false,
                        search: true,
                        searchSpan: 4,
                        type: "select",
                        dicData: [{
                            label: "长期",
                            value: 1
                        },
                        {
                            label: "中期",
                            value: 2
                        },
                        {
                            label: "短期",
                            value: 3
                        }
                        ],
                    },
                    {
                        width: 80,
                        label: "审核状态",
                        prop: "auditStatus",
                        type: "select",
                        search: true,
                        searchSpan: 4,
                        display: false,
                        slot: true,
                        dicData: [
                            {
                                label: "已确认",
                                value: 1
                            },
                            {
                                label: "待确认",
                                value: 0
                            }
                        ],
                    },
                    {
                        width: 144,
                        label: "创建时间",
                        prop: "createTime",
                        display: false,
                    },
                    {
                        label: "合同",
                        prop: "fileUrls",
                        // align:'center',
                        width: 80,
                        type: "upload",
                        listType: "picture-img",
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            url: "link",
                        },
                        hide: true,
                        span: 24,
                    },
                ]
            },
            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,
              },
              formatter: (row) => {
                return row.houseName
              },
              onLoad: ({
                page,
                value,
                data
              }, callback) => {
                //首次加载去查询对应的值
                if (value) {
                  getHouseDetail({
                    houseCode: value
                  }).then(res => {
                    var resData = res.data.data
                    // 查询对应行数据
                    callback(resData)
                    return
                  })
                }
                ]
                if (page) {
                  this.loading = true
                  getHouseList(page.currentPage, page.pageSize, Object.assign(data)).then(res => {
                    const resData = res.data.data
                    var total = resData.total
                    var data = resData.records
                    this.loading = false
                    this.selectionClear()
                    //分页查询信息
                    callback({
                      total: total,
                      data: data
                    })
                  })
                }
              },
              props: {
                label: 'address',
                value: 'houseCode'
              }
            },
            {
              label: "关系",
              prop: "tenantRelationship",
              search: true,
              searchSpan: 3,
              searchLabelWidth: 46,
              width: 100,
              type: "select",
              dicData: [{
                  label: "同一户",
                  value: 1
                },
                {
                  label: "不同一户",
                  value: 2
                }
              ],
              rules: [{
                required: true,
                message: "请选择关系",
                trigger: "blur",
              }, ],
            },
            {
              label: "房屋状态",
              prop: "houseStatus",
              search: true,
              searchSpan: 4,
              width: 100,
              type: "select",
              dicData: [{
                  label: "部分出租",
                  value: 1
                },
                {
                  label: "全部出租",
                  value: 2
                }
              ],
              rules: [{
                required: true,
                message: "请选择房屋状态",
                trigger: "blur",
              }, ],
            },
            {
              label: "用途",
              prop: "rentalUse",
              type: "select",
              searchSpan: 3,
              searchLabelWidth: 66,
              search: true,
              dataType: "number",
              width: 100,
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=rentalUseType",
              props: {
                label: "dictValue",
                value: "dictKey",
              },
              rules: [{
                required: true,
                message: "请选择用途",
                trigger: "blur",
              }, ],
            },
            {
              width: 100,
              label: "租房时间",
              prop: "rentalTime",
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [{
                required: true,
                message: "请选择租房时间",
                trigger: "blur",
              }, ],
            },
            {
              label: "到期时间",
              prop: "dueTime",
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              width: 100,
              rules: [{
                required: true,
                message: "请选择到期时间",
                trigger: "blur",
              }, ],
            },
            {
              label: "租赁期限",
              prop: "dldType",
              width: 100,
              display: false,
              search: true,
              searchSpan: 4,
              type: "select",
              dicData: [{
                  label: "长期",
                  value: 1
                },
                {
                  label: "中期",
                  value: 2
                },
                {
                  label: "短期",
                  value: 3
                }
              ],
            },
            {
              width: 80,
              label: "审核状态",
              prop: "auditStatus",
              type: "select",
              search: true,
              searchSpan: 4,
              display: false,
              slot: true,
              dicData: [{
                  label: "已确认",
                  value: 1
                },
                {
                  label: "待确认",
                  value: 0
                }
              ],
            },
            {
              width: 144,
              label: "创建时间",
              prop: "createTime",
              display: false,
            },
            {
              label: "合同",
              prop: "fileUrls",
              // align:'center',
              width: 80,
              type: "upload",
              listType: "picture-img",
              action: "/api/blade-resource/oss/endpoint/put-file",
              propsHttp: {
                res: "data",
                url: "link",
              },
              hide: true,
              span: 24,
            },
          ]
        },
        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.houseRental_add, true),
                viewBtn: this.vaildData(this.permission.houseRental_view, true),
                delBtn: this.vaildData(this.permission.houseRental_delete, true),
                editBtn: this.vaildData(this.permission.houseRental_edit, true)
            }
        },
        showConfirmFlag() {
            return (data) => {
                let tags = {}
                if (data == 0) {
                    tags = {
                        type: 'warning',
                        text: '待处理'
                    }
                } else if (data == 1) {
                    tags = {
                        type: 'success',
                        text: '已处理'
                    }
                }
                return tags
            }
      ...mapGetters(["userInfo", "permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.houseRental_add, true),
          viewBtn: this.vaildData(this.permission.houseRental_view, true),
          delBtn: this.vaildData(this.permission.houseRental_delete, true),
          editBtn: this.vaildData(this.permission.houseRental_edit, true)
        }
      },
      showConfirmFlag() {
        return (data) => {
          let tags = {}
          if (data == 0) {
            tags = {
              type: 'warning',
              text: '待处理'
            }
          } else if (data == 1) {
            tags = {
              type: 'success',
              text: '已处理'
            }
          }
          return tags
        }
      }
    },
    mounted() { },
    mounted() {},
    methods: {
        ManageTenants(item) {
            this.roleBox = true
            this.rowHouseHold = item
      ManageTenants(item) {
        this.roleBox = true
        this.rowHouseHold = item
        this.onLoadHouseHold()
      },
      onLoadHouseHold() {
        let params = {
          housingRentalId: this.rowHouseHold.id,
        }
        getHouseholdList(this.holdPage.currentPage, this.holdPage.pageSize, Object.assign(params)).then(res => {
          const data = res.data.data
          this.houseHold = data.records
          this.loading = false
          this.selectionClear()
        })
      },
      houseHoldRowSave(row, done, loading) {
        row.aoiName = this.rowHouseHold.aoiName
        row.address = this.rowHouseHold.address
        row.housingRentalId = this.rowHouseHold.id
        row.houseCode = this.rowHouseHold.houseCode
        if (row.idCard) {
          row.cardType = 111
        }
        householdAdd(row).then(() => {
          this.initFlag = false
          this.onLoadHouseHold()
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          done()
        }, error => {
          window.console.log(error)
          loading()
        })
      },
      rowSave(row, done, loading) {
        if (row.fileUrls.length > 0) {
          var urls = []
          var split = row.fileUrls.split(",")
          split.forEach(url => {
            var names = url.split("jczz/")
            urls.push(names[1])
          })
          row.fileUrls = urls.join(",")
        }
        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) {
        if (row.fileUrls.length > 0) {
          var urls = []
          var split = row.fileUrls.split(",")
          split.forEach(url => {
            var names = url.split("jczz/")
            urls.push(names[1])
          })
          row.fileUrls = urls.join(",")
        }
        update(row).then(() => {
          this.initFlag = false
          this.onLoad(this.page)
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          done()
        }, error => {
          window.console.log(error)
          loading()
        })
      },
      houseHoldRowUpdate(row, index, done, loading) {
        if (row.idCard) {
          row.cardType = 111
        }
        householdUpdate(row).then(() => {
          this.initFlag = false
          this.onLoadHouseHold()
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          done()
        }, error => {
          window.console.log(error)
          loading()
        })
      },
      houseHoldRowDel(row) {
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return householdDel(row.id)
          })
          .then(() => {
            this.onLoadHouseHold()
        },
        onLoadHouseHold() {
            let params = {
                housingRentalId: this.rowHouseHold.id,
            }
            getHouseholdList(this.holdPage.currentPage, this.holdPage.pageSize, Object.assign(params)).then(res => {
                const data = res.data.data
                this.houseHold = data.records
                this.loading = false
                this.selectionClear()
            this.$message({
              type: "success",
              message: "操作成功!"
            })
        },
        houseHoldRowSave(row, done, loading) {
            row.aoiName = this.rowHouseHold.aoiName
            row.address = this.rowHouseHold.address
            row.housingRentalId = this.rowHouseHold.id
            row.houseCode = this.rowHouseHold.houseCode
            if (row.idCard) {
                row.cardType = 111
            }
            householdAdd(row).then(() => {
                this.initFlag = false
                this.onLoadHouseHold()
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        rowSave(row, done, loading) {
            if (row.fileUrls.length > 0) {
                var urls = []
                var split = row.fileUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.fileUrls = urls.join(",")
            }
            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) {
            if (row.fileUrls.length > 0) {
                var urls = []
                var split = row.fileUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.fileUrls = urls.join(",")
            }
            update(row).then(() => {
                this.initFlag = false
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        houseHoldRowUpdate(row, index, done, loading) {
            if (row.idCard) {
                row.cardType = 111
            }
            householdUpdate(row).then(() => {
                this.initFlag = false
                this.onLoadHouseHold()
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        houseHoldRowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return householdDel(row.id)
                })
                .then(() => {
                    this.onLoadHouseHold()
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        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 = ''
          })
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return remove(row.id)
          })
          .then(() => {
            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.$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) {
        window.console.log(column)
        this.excelBox = false
        this.refreshChange()
        done()
      },
      handleExport() {
        const account = func.toStr(this.search.account)
        const realName = func.toStr(this.search.realName)
        this.$confirm("是否导出出租信息数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          NProgress.start()
          var data = {
            ...this.query
          }
          data = Qs.stringify(data)
          exportBlob(
            `/api/blade-houseRental/houseRental/export-houseRental?${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)) {
          getDetatil(this.form.id).then(res => {
            this.form = res.data.data
            if (this.form.fileUrls.length > 0) {
              var urls = []
              var names = this.form.fileUrls.split(",")
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              this.form.fileUrls = urls.join(",")
            }
            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) {
            window.console.log(column)
            this.excelBox = false
            this.refreshChange()
            done()
        },
        handleExport() {
            const account = func.toStr(this.search.account)
            const realName = func.toStr(this.search.realName)
            this.$confirm("是否导出出租信息数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                NProgress.start()
                var data = {
                    ...this.query
                }
                data = Qs.stringify(data)
                exportBlob(
                    `/api/blade-houseRental/houseRental/export-houseRental?${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)) {
                getDetatil(this.form.id).then(res => {
                    this.form = res.data.data
                    if (this.form.fileUrls.length > 0) {
                        var urls = []
                        var names = this.form.fileUrls.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        this.form.fileUrls = urls.join(",")
                    }
                })
          })
        }
        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 = {}) {
        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.data.forEach(item => {
            if (item.fileUrls && item.fileUrls.length > 0) {
              var urls = []
              var names = item.fileUrls.split(",")
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              item.fileUrls = urls.join(",")
            }
            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 = {}) {
            this.loading = true
          })
          this.loading = false
          this.selectionClear()
        })
      },
            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.data.forEach(item => {
                    if (item.fileUrls.length > 0) {
                        var urls = []
                        var names = item.fileUrls.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        item.fileUrls = urls.join(",")
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        },
      showEditMoel(type, item) {
        if (type == 1) {
          this.$refs.RetalInfo.initOpen(type)
        } else {
          this.$refs.RetalInfo.initOpen(type, item.id)
        }
        showEditMoel(type, item) {
            if (type == 1) {
                this.$refs.RetalInfo.initOpen(type)
            } else {
                this.$refs.RetalInfo.initOpen(type, item.id)
            }
        },
      },
    }
}
  }
</script>
<style>
.box {
  .box {
    height: 800px;
}
  }
.el-scrollbar {
  .el-scrollbar {
    height: 100%;
}
  }
.box .el-scrollbar__wrap {
  .box .el-scrollbar__wrap {
    overflow: scroll;
}
</style>
  }
</style>