linwei
2024-01-20 16eb81672eaa55decd4472f391a74d50580ba045
物业公司调整
6 files modified
1 files added
3633 ■■■■■ changed files
src/views/property/propertyCompany.vue 64 ●●●●● patch | view | raw | blame | history
src/views/property/propertyCompanyDistrict.vue 736 ●●●● patch | view | raw | blame | history
src/views/propertySupervision/propertyCompanyDistrict.vue 398 ●●●●● patch | view | raw | blame | history
src/views/propertySupervision/propertyEvaluation.vue 600 ●●●●● patch | view | raw | blame | history
src/views/publicSecurity/components/userHouseList.vue 4 ●●●● patch | view | raw | blame | history
src/views/publicSecurity/keynotePersonnelManage.vue 4 ●●●● patch | view | raw | blame | history
src/views/system/user.vue 1827 ●●●● patch | view | raw | blame | history
src/views/property/propertyCompany.vue
@@ -117,7 +117,7 @@
              search: true,
              span: 18,
              row: true,
              width: 260,
              width: 200,
              rules: [{
                required: true,
                message: "请输入物业公司名称",
@@ -166,7 +166,7 @@
              prop: 'area',
              type: 'select',
              span: 6,
              labelWidth: 60,
              width: 260,
              props: {
                label: 'name',
                value: 'code'
@@ -185,10 +185,68 @@
              prop: "address",
              span: 18,
              row: true,
              width: 160,
            },
            {
              label: "社会信用代码",
              prop: "socialCreditCode",
              searchSpan: 5,
              // searchLabelWidth: 124,
              search: true,
              span: 18,
              row: true,
              width: 100,
            },
            {
              label: "基础信息分",
              prop: "baseInfoScore",
              display: false,
            },
            {
              label: "经营信息分",
              prop: "operateinfoScore",
              display: false,
            },
            {
              label: "纳税信息分",
              prop: "taxInfoScore",
              display: false,
            },
            {
              label: "党建信息分",
              prop: "partyBuildingInfoScore",
              display: false,
            },
            {
              label: "企业良好信息分",
              prop: "goodCorporateScore",
              display: false,
            },
            {
              label: "项目良好信息分",
              prop: "goodCorporateScore",
              display: false,
            },
            {
              label: "违法违规行为分",
              prop: "goodCorporateScore",
              display: false,
            },
            {
              label: "评价平均分",
              prop: "evaluateScore",
              display: false,
            },
            {
              label: "街道社区分",
              prop: "streetScore",
              display: false,
            },
            {
              label: "总分",
              prop: "allScore",
              display: false,
            },
            {
@@ -545,4 +603,4 @@
  .avue-upload__icon {
    line-height: 6;
  }
</style>
</style>
src/views/property/propertyCompanyDistrict.vue
@@ -1,397 +1,403 @@
<!-- 物业公司管理 -->
<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">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.propertyCompanyDistrict_delete"
                    @click="handleDelete">删 除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
  <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">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.propertyCompanyDistrict_delete"
          @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
import {
  import {
    getList,
    remove,
    update,
    add,
    getPropertyCompanyDistrict
} from "@/api/property/propertyCompanyDistrict"
import {
  } from "@/api/property/propertyCompanyDistrict"
  import {
    mapGetters
} from "vuex"
import website from '@/config/website'
import func from "@/util/func"
export default {
    data () {
        //手机号格式校验
        let validatorPhone = function (rule, value, callback) {
            if (value) {
                if (!/^1[3456789]\d{9}$/.test(value)) {
                    callback(new Error('手机号格式有误!'))
                } else {
                    callback()
                }
            }
  } from "vuex"
  import website from '@/config/website'
  import func from "@/util/func"
  export default {
    data() {
      //手机号格式校验
      let validatorPhone = function(rule, value, callback) {
        if (value) {
          if (!/^1[3456789]\d{9}$/.test(value)) {
            callback(new Error('手机号格式有误!'))
          } else {
            callback()
          }
        }
        callback()
      }
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        option: {
          labelWidth: 120,
          searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 210,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 1150,
          tip: false,
          border: true,
          //stripe:true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [{
              overHidden: true,
              label: '小区名称',
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              prop: "districtName",
              search: true,
              searchSpan: 4,
              rules: [{
                required: true,
                message: "请输入小区名称",
                trigger: "blur",
              }],
            },
            datetime: "",
            selectionList: [],
            option: {
                labelWidth: 120,
                searchLabelWidth: 96,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 210,
                height: "auto",
                calcHeight: 54,
                dialogWidth: 1150,
                tip: false,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [
                    {
                        overHidden: true,
                        label: '小区名称',
                        addDisplay: false,
                        editDisplay: false,
                        viewDisplay: false,
                        prop: "districtName",
                        search: true,
                        searchSpan: 4,
                        rules: [{
                            required: true,
                            message: "请输入小区名称",
                            trigger: "blur",
                        }],
                    },
                    {
                        hide: true,
                        parent: false,
                        label: "小区",
                        prop: "districtId",
                        search: false,
                        type: 'tree',
                        dicUrl: `/api/blade-district/district/getDistrictTree`,
                        props: {
                            label: "name",
                            value: "id"
                        },
                        defaultExpandedKeys: ["361102003"],
                        span: 12,
                        width: 260,
                        rules: [{
                            required: true,
                            message: "请选择小区",
                            trigger: "blur",
                        },],
                    },
                    {
                        overHidden: true,
                        label: "物业公司",
                        addDisplay: false,
                        editDisplay: false,
                        viewDisplay: false,
                        prop: "propertyCompanyName",
                        search: true,
                        searchSpan: 4,
                        rules: [{
                            required: true,
                            message: "请输入物业公司",
                            trigger: "blur",
                        }],
                    },
                    {
                        hide: true,
                        label: '物业公司',
                        prop: 'propertyCompanyId',
                        type: 'tree',
                        span: 12,
                        dicUrl: `/api/blade-propertyCompany/propertyCompany/getPropertyCompanyList`,
                        cascader: ['userId'],
                        props: {
                            label: "name",
                            value: "id"
                        },
                        rules: [{
                            required: true,
                            message: '请选择物业公司',
                            trigger: 'blur'
                        }]
                    },
                    {
                        width: 110,
                        label: '项目经理',
                        prop: 'principal',
                        span: 12,
                        search: true,
                        searchSpan: 4,
                        rules: [{
                            required: true,
                            message: "请输入项目经理",
                            trigger: "blur",
                        },],
                    },
                    {
                        width: 120,
                        label: '联系方式',
                        prop: 'principalPhone',
                        span: 12,
                        rules: [{
                            required: true,
                            message: "请输入联系方式",
                            trigger: "blur",
                        },
                        {
                            validator: validatorPhone,
                            trigger: 'blur'
                        }],
                    },
                    {
                        label: "物业成员",
                        prop: "userId",
                        span: 12,
                        type: "tree",
                        multiple: true,
                        remote: true,
                        props: {
                            label: 'name',
                            value: 'id'
                        },
                        hide: true,
                        dicUrl: `/api/blade-propertyCompany/propertyCompany/getUserByPropertyCompany?id={{propertyCompanyId}}`,
                    },
                    {
                        width: 100,
                        label: "物业阶段",
                        span: 12,
                        prop: "propertyStage",
                        type: "select",
                        search: true,
                        searchSpan: 4,
                        dataType: "number",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=propertyStage",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        width: 100,
                        label: "合同开始时间",
                        prop: "startTime",
                        span: 12,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        rules: [{
                            required: true,
                            message: "请选择合同开始时间",
                            trigger: "blur",
                        },],
                    },
                    {
                        width: 100,
                        label: "合同结束时间",
                        prop: "endTime",
                        span: 12,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        rules: [{
                            required: true,
                            message: "请选择合同结束时间",
                            trigger: "blur",
                        },],
                    },
                ],
            {
              hide: true,
              parent: false,
              label: "小区",
              prop: "districtId",
              search: false,
              type: 'tree',
              dicUrl: `/api/blade-district/district/getDistrictTree`,
              props: {
                label: "name",
                value: "id"
              },
              defaultExpandedKeys: ["361102003"],
              span: 12,
              width: 260,
              rules: [{
                required: true,
                message: "请选择小区",
                trigger: "blur",
              }, ],
            },
            data: [],
        }
            {
              overHidden: true,
              label: "物业公司",
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              prop: "propertyCompanyName",
              search: true,
              searchSpan: 4,
              rules: [{
                required: true,
                message: "请输入物业公司",
                trigger: "blur",
              }],
            },
            {
              hide: true,
              label: '物业公司',
              prop: 'propertyCompanyId',
              type: 'tree',
              span: 12,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getPropertyCompanyList`,
              cascader: ['userId', 'principal'],
              props: {
                label: "name",
                value: "id"
              },
              rules: [{
                required: true,
                message: '请选择物业公司',
                trigger: 'blur'
              }]
            },
            {
              width: 110,
              label: '项目经理',
              prop: 'principal',
              span: 12,
              type: "tree",
              multiple: true,
              remote: true,
              props: {
                label: 'name',
                value: 'id'
              },
              hide: true,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getUserByPropertyCompany?id={{propertyCompanyId}}`,
              rules: [{
                required: true,
                message: "请输入项目经理",
                trigger: "blur",
              }, ],
            },
            {
              width: 120,
              label: '联系方式',
              prop: 'principalPhone',
              span: 12,
              rules: [{
                  required: true,
                  message: "请输入联系方式",
                  trigger: "blur",
                },
                {
                  validator: validatorPhone,
                  trigger: 'blur'
                }
              ],
            },
            {
              label: "物业成员",
              prop: "userId",
              span: 12,
              type: "tree",
              multiple: true,
              remote: true,
              props: {
                label: 'name',
                value: 'id'
              },
              hide: true,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getUserByPropertyCompany?id={{propertyCompanyId}}`,
            },
            {
              width: 100,
              label: "物业阶段",
              span: 12,
              prop: "propertyStage",
              type: "select",
              search: true,
              searchSpan: 4,
              dataType: "number",
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=propertyStage",
              props: {
                label: "dictValue",
                value: "dictKey",
              },
            },
            {
              width: 100,
              label: "合同开始时间",
              prop: "startTime",
              span: 12,
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [{
                required: true,
                message: "请选择合同开始时间",
                trigger: "blur",
              }, ],
            },
            {
              width: 100,
              label: "合同结束时间",
              prop: "endTime",
              span: 12,
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [{
                required: true,
                message: "请选择合同结束时间",
                trigger: "blur",
              }, ],
            },
          ],
        },
        data: [],
      }
    },
    watch: {},
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.propertyCompanyDistrict_add, true),
                viewBtn: this.vaildData(this.permission.propertyCompanyDistrict_view, true),
                delBtn: this.vaildData(this.permission.propertyCompanyDistrict_delete, true),
                editBtn: this.vaildData(this.permission.propertyCompanyDistrict_edit, true),
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.propertyCompanyDistrict_add, true),
          viewBtn: this.vaildData(this.permission.propertyCompanyDistrict_view, true),
          delBtn: this.vaildData(this.permission.propertyCompanyDistrict_delete, true),
          editBtn: this.vaildData(this.permission.propertyCompanyDistrict_edit, true),
        }
      },
      ids() {
        let ids = []
        this.selectionList.forEach((ele) => {
          ids.push(ele.id)
        })
        return ids.join(",")
      },
    },
    methods: {
        rowSave (row, done, loading) {
            row.userId = func.join(row.userId)
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            row.userId = func.join(row.userId)
            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.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
      rowSave(row, done, loading) {
        row.userId = func.join(row.userId)
        add(row).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.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            this.$message({
              type: "success",
              message: "操作成功!",
            })
                .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)) {
                getPropertyCompanyDistrict(this.form.id).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.loading = false
                this.selectionClear()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      rowUpdate(row, index, done, loading) {
        row.userId = func.join(row.userId)
        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.id)
          })
          .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()
      },
      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)) {
          getPropertyCompanyDistrict(this.form.id).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.loading = false
          this.selectionClear()
        })
      }
    }
}
  }
</script>
<style>
.avue-upload__icon {
  .avue-upload__icon {
    line-height: 6;
}
</style>
  }
</style>
src/views/propertySupervision/propertyCompanyDistrict.vue
New file
@@ -0,0 +1,398 @@
<!-- 物业公司管理 -->
<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">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.propertyCompanyDistrict_delete"
          @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {
    getList,
    remove,
    update,
    add,
    getPropertyCompanyDistrict
  } from "@/api/property/propertyCompanyDistrict"
  import {
    mapGetters
  } from "vuex"
  import website from '@/config/website'
  import func from "@/util/func"
  export default {
    data() {
      //手机号格式校验
      let validatorPhone = function(rule, value, callback) {
        if (value) {
          if (!/^1[3456789]\d{9}$/.test(value)) {
            callback(new Error('手机号格式有误!'))
          } else {
            callback()
          }
        }
        callback()
      }
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        option: {
          labelWidth: 120,
          searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 210,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 1150,
          tip: false,
          border: true,
          delBtn: false,
          editBtn: false,
          //stripe:true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [{
              overHidden: true,
              label: '小区名称',
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              prop: "districtName",
              search: true,
              searchSpan: 4,
              rules: [{
                required: true,
                message: "请输入小区名称",
                trigger: "blur",
              }],
            },
            {
              hide: true,
              parent: false,
              label: "小区",
              prop: "districtId",
              search: false,
              type: 'tree',
              dicUrl: `/api/blade-district/district/getDistrictTree`,
              props: {
                label: "name",
                value: "id"
              },
              defaultExpandedKeys: ["361102003"],
              span: 12,
              width: 260,
              rules: [{
                required: true,
                message: "请选择小区",
                trigger: "blur",
              }, ],
            },
            {
              overHidden: true,
              label: "物业公司",
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              prop: "propertyCompanyName",
              search: true,
              searchSpan: 4,
              rules: [{
                required: true,
                message: "请输入物业公司",
                trigger: "blur",
              }],
            },
            {
              hide: true,
              label: '物业公司',
              prop: 'propertyCompanyId',
              type: 'tree',
              span: 12,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getPropertyCompanyList`,
              cascader: ['userId'],
              props: {
                label: "name",
                value: "id"
              },
              rules: [{
                required: true,
                message: '请选择物业公司',
                trigger: 'blur'
              }]
            },
            {
              width: 110,
              label: '项目经理',
              prop: 'principal',
              span: 12,
              search: true,
              searchSpan: 4,
              rules: [{
                required: true,
                message: "请输入项目经理",
                trigger: "blur",
              }, ],
            },
            {
              width: 120,
              label: '联系方式',
              prop: 'principalPhone',
              span: 12,
              rules: [{
                  required: true,
                  message: "请输入联系方式",
                  trigger: "blur",
                },
                {
                  validator: validatorPhone,
                  trigger: 'blur'
                }
              ],
            },
            {
              label: "物业成员",
              prop: "userId",
              span: 12,
              type: "tree",
              multiple: true,
              remote: true,
              props: {
                label: 'name',
                value: 'id'
              },
              hide: true,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getUserByPropertyCompany?id={{propertyCompanyId}}`,
            },
            {
              width: 100,
              label: "物业阶段",
              span: 12,
              prop: "propertyStage",
              type: "select",
              search: true,
              searchSpan: 4,
              dataType: "number",
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=propertyStage",
              props: {
                label: "dictValue",
                value: "dictKey",
              },
            },
            {
              width: 100,
              label: "合同开始时间",
              prop: "startTime",
              span: 12,
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [{
                required: true,
                message: "请选择合同开始时间",
                trigger: "blur",
              }, ],
            },
            {
              width: 100,
              label: "合同结束时间",
              prop: "endTime",
              span: 12,
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              rules: [{
                required: true,
                message: "请选择合同结束时间",
                trigger: "blur",
              }, ],
            },
          ],
        },
        data: [],
      }
    },
    watch: {},
    computed: {
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.propertyCompanyDistrict_add, true),
          viewBtn: this.vaildData(this.permission.propertyCompanyDistrict_view, true),
          delBtn: this.vaildData(this.permission.propertyCompanyDistrict_delete, true),
          editBtn: this.vaildData(this.permission.propertyCompanyDistrict_edit, true),
        }
      },
      ids() {
        let ids = []
        this.selectionList.forEach((ele) => {
          ids.push(ele.id)
        })
        return ids.join(",")
      },
    },
    methods: {
      rowSave(row, done, loading) {
        row.userId = func.join(row.userId)
        add(row).then(
          () => {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            done()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
      rowUpdate(row, index, done, loading) {
        row.userId = func.join(row.userId)
        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.id)
          })
          .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()
      },
      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)) {
          getPropertyCompanyDistrict(this.form.id).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.loading = false
          this.selectionClear()
        })
      }
    }
  }
</script>
<style>
  .avue-upload__icon {
    line-height: 6;
  }
</style>
src/views/propertySupervision/propertyEvaluation.vue
@@ -1,8 +1,606 @@
<!-- 物业公司管理 -->
<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">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.propertyCompany_delete"
          @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="{row, size, index}" slot="menu">
        <el-button :size="size" v-if="permission.payInfo" type="text" icon="el-icon-circle-plus-outline"
          @click="openPayConfig(row)">商户配置
        </el-button>
        <el-button :size="size" v-if="permission.property_evaluation" icon="el-icon-circle-plus-outline" type="text"
          @click="addProperty(row)">物业评定
        </el-button>
      </template>
    </avue-crud>
    <el-dialog title="商户配置" append-to-body :visible.sync="payInfoVisible" top="10vh" width="70%">
      <el-tabs v-model="currentTab">
        <el-tab-pane label="微信商户配置" name="wxInfo">
          <avue-form ref="wxForm" :option="wxPayOption" v-model="wxPayForm" @submit="wxSubmit">
          </avue-form>
        </el-tab-pane>
        <el-tab-pane label="支付宝商户配置" name="second">
          <avue-form ref="aliForm" :option="aliPayOption" v-model="aliPayForm" @submit="aliSubmit">
          </avue-form>
        </el-tab-pane>
      </el-tabs>
      <!--      <div slot="footer" class="dialog-footer">-->
      <!--        <el-button @click="payInfoVisible = false">取 消</el-button>-->
      <!--        <el-button type="primary"@click="submit">提 交</el-button>-->
      <!--      </div>-->
    </el-dialog>
    <!-- <propertyEdit ref="propertyEdit"></propertyEdit> -->
  </basic-container>
</template>
<script>
  import {
    getList,
    remove,
    update,
    add,
    getPropertyCompany,
    getPayConfig,
    saveOrUpdateWx,
    saveOrUpdateAli
  } from "@/api/property/propertyCompany"
  import {
    mapGetters
  } from "vuex"
  import website from '@/config/website'
  import func from "@/util/func"
  // import propertyEdit from './components/propertyEdit.vue'
  const labelWidth = 120
  export default {
    components: {
      // propertyEdit
    },
    data() {
      return {
        currentTab: "wxInfo",
        payInfoVisible: false,
        currentRow: {},
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        option: {
          labelWidth: 120,
          searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 280,
          menu: false,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 1150,
          tip: false,
          border: true,
          //stripe:true,
          index: true,
          // viewBtn: true,
          delBtn: false,
          selection: true,
          dialogClickModal: false,
          column: [{
              overHidden: true,
              label: "物业公司名称",
              prop: "name",
              searchSpan: 5,
              searchLabelWidth: 124,
              search: true,
              span: 18,
              row: true,
              width: 200,
              rules: [{
                required: true,
                message: "请输入物业公司名称",
                trigger: "blur",
              }, ],
            },
            {
              label: '省份',
              prop: 'province',
              type: 'select',
              props: {
                label: 'name',
                value: 'code'
              },
              hide: true,
              span: 6,
              cascader: ['city'],
              dicUrl: `/api/blade-system/region/select`,
              rules: [{
                required: true,
                message: '请选择省份',
                trigger: 'blur'
              }]
            },
            {
              label: '城市',
              prop: 'city',
              type: 'select',
              span: 6,
              labelWidth: 60,
              cascader: ['area'],
              props: {
                label: 'name',
                value: 'code'
              },
              hide: true,
              dicUrl: `/api/blade-system/region/select?code={{key}}`,
              rules: [{
                required: true,
                message: '请选择城市',
                trigger: 'blur'
              }]
            },
            {
              label: '地区',
              prop: 'area',
              type: 'select',
              span: 6,
              width: 260,
              props: {
                label: 'name',
                value: 'code'
              },
              hide: true,
              dicUrl: `/api/blade-system/region/select?code={{key}}`,
              rules: [{
                required: true,
                message: '请选择地区',
                trigger: 'blur'
              }]
            },
            {
              overHidden: true,
              label: "地址",
              prop: "address",
              span: 18,
              row: true,
              width: 160,
            },
            {
              label: "社会信用代码",
              prop: "socialCreditCode",
              searchSpan: 5,
              // searchLabelWidth: 124,
              search: true,
              span: 18,
              row: true,
              width: 100,
            },
            {
              label: "基础信息分",
              prop: "baseInfoScore",
              display: false,
            },
            {
              label: "经营信息分",
              prop: "operateinfoScore",
              display: false,
            },
            {
              label: "纳税信息分",
              prop: "taxInfoScore",
              display: false,
            },
            {
              label: "党建信息分",
              prop: "partyBuildingInfoScore",
              display: false,
            },
            {
              label: "企业良好信息分",
              prop: "goodCorporateScore",
              display: false,
            },
            {
              label: "项目良好信息分",
              prop: "goodCorporateScore",
              display: false,
            },
            {
              label: "违法违规行为分",
              prop: "goodCorporateScore",
              display: false,
            },
            {
              label: "评价平均分",
              prop: "evaluateScore",
              display: false,
            },
            {
              label: "街道社区分",
              prop: "streetScore",
              display: false,
            },
            {
              label: "总分",
              prop: "allScore",
              display: false,
            },
            {
              label: "简介",
              prop: "remark",
              component: "AvueUeditor",
              options: {
                action: "/api/blade-resource/oss/endpoint/put-file-attach",
                props: {
                  res: "data",
                  url: "link",
                },
              },
              hide: true,
              minRows: 6,
              span: 24,
            },
          ],
        },
        data: [],
        wxPayForm: {},
        wxPayOption: {
          emptyBtn: false,
          height: "auto",
          calcHeight: 180,
          //stripe:true,
          column: [{
              label: "appId",
              labelWidth: labelWidth,
              prop: "appId",
              span: 24,
              rules: [{
                required: true,
                message: "请输入appId",
                trigger: ["blur", "change"]
              }, ],
            },
            {
              label: "mch-id",
              labelWidth: labelWidth,
              prop: "mchId",
              span: 24,
              rules: [{
                required: true,
                message: "请输入mch-id",
                trigger: ["blur", "change"]
              }, ],
            },
            {
              label: "mchKey",
              labelWidth: labelWidth,
              prop: "mchKey",
              rules: [{
                required: true,
                message: "请输入mchKey",
                trigger: ["blur", "change"]
              }, ],
              span: 24,
            },
            {
              label: "appSecret",
              labelWidth: labelWidth,
              prop: "appSecret",
              rules: [{
                required: true,
                message: "请输入appSecret",
                trigger: ["blur", "change"]
              }, ],
              span: 24,
            },
            {
              label: '安全证书',
              labelWidth: labelWidth,
              prop: 'keyPath',
              type: 'upload',
              drag: true,
              limit: 1,
              loadText: '上传中,请稍等',
              span: 24,
              action: "/api/blade-resource/oss/endpoint/put-file",
              propsHttp: {
                res: "data",
                name: 'name',
                url: "link",
              },
              rules: [{
                required: true,
                message: "请上传安全证书",
                trigger: ["blur", "change"]
              }, ],
            },
          ],
        },
        aliPayForm: {},
        aliPayOption: {
          emptyBtn: false,
          height: "auto",
          calcHeight: 180,
          //stripe:true,
          column: [{
              label: "appId",
              labelWidth: labelWidth,
              prop: "appId",
              span: 24,
              rules: [{
                required: true,
                message: "请输入appId",
                trigger: ["blur", "change"]
              }, ],
            },
            {
              label: "privateKey",
              labelWidth: labelWidth,
              prop: "privateKey",
              span: 24,
              rules: [{
                required: true,
                message: "请输入privateKey",
                trigger: ["blur", "change"]
              }, ],
            },
            {
              label: "publicKey",
              labelWidth: labelWidth,
              prop: "publicKey",
              span: 24,
              rules: [{
                required: true,
                message: "请输入publicKey",
                trigger: ["blur", "change"]
              }, ],
            },
          ],
        }
      }
    },
    watch: {},
    computed: {
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.propertyCompany_add, true),
          viewBtn: this.vaildData(this.permission.propertyCompany_view, true),
          delBtn: this.vaildData(this.permission.propertyCompany_delete, true),
          editBtn: this.vaildData(this.permission.propertyCompany_edit, true),
        }
      },
      ids() {
        let ids = []
        this.selectionList.forEach((ele) => {
          ids.push(ele.id)
        })
        return ids.join(",")
      },
    },
    created() {},
    methods: {
      addProperty(row) {
        this.$refs.propertyEdit.init(row);
      },
      aliSubmit(form, done) {
        console.log("支付宝商户配置", this.aliPayForm)
        this.aliPayForm.propertyCompanyId = this.currentRow.id
        saveOrUpdateAli(this.aliPayForm).then(res => {
          this.$message({
            type: "success",
            message: "操作成功!",
          })
          done()
        })
      },
      wxSubmit(form, done) {
        this.wxPayForm.propertyCompanyId = this.currentRow.id
        this.wxPayForm.keyPath = func.join(this.wxPayForm.keyPath)
        if (this.wxPayForm.keyPath.length > 0) {
          var urls = []
          var split = this.wxPayForm.keyPath.split(",")
          split.forEach(url => {
            var names = url.split("jczz/")
            urls.push(names[1])
          })
          this.wxPayForm.keyPath = urls.join(",")
        }
        console.log("微信商户配置", this.wxPayForm)
        saveOrUpdateWx(this.wxPayForm).then(res => {
          this.$message({
            type: "success",
            message: "操作成功!",
          })
          done()
        })
      },
      openPayConfig(row) {
        this.currentRow = row
        //调接口获取商户数据
        getPayConfig(row.id).then(res => {
          let data = res.data.data
          this.wxPayForm = data.wxPayInfo ? data.wxPayInfo : {}
          this.aliPayForm = data.aliPayInfo ? data.aliPayInfo : {}
        })
        this.payInfoVisible = !this.payInfoVisible
      },
      rowSave(row, done, loading) {
        row.userid = this.userInfo.user_id
        add(row).then(
          () => {
            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.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.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()
          })
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getPropertyCompany(this.form.id).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.loading = false
          this.selectionClear()
        })
      }
    }
  }
</script>
<style>
</style>
  .avue-upload__icon {
    line-height: 6;
  }
</style>
src/views/publicSecurity/components/userHouseList.vue
@@ -840,7 +840,7 @@
    methods: {
      init(row) {
        if (row.regionCode) {
          this.query.regionCode = row.regionCode
          this.query.regionCode = row.regionCode.slice(0, 10)
        }
        if (row.communityCode) {
          this.query.regionCode = row.communityCode
@@ -1126,4 +1126,4 @@
  .box .el-scrollbar__wrap {
    overflow: scroll;
  }
</style>
</style>
src/views/publicSecurity/keynotePersonnelManage.vue
@@ -110,7 +110,7 @@
          dialogClickModal: false,
          column: [{
              span: 12,
              label: "所属街道",
              label: "行政区域",
              prop: "regionName",
              searchSpan: 4,
              align: 'center',
@@ -470,4 +470,4 @@
      justify-content: center;
    }
  }
</style>
</style>
src/views/system/user.vue
@@ -1,82 +1,82 @@
<template>
    <el-row>
        <el-col :span="5">
            <div class="box">
                <el-scrollbar>
                    <basic-container>
                        <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
                    </basic-container>
                </el-scrollbar>
            </div>
        </el-col>
        <el-col :span="19">
            <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="menuLeft">
                        <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.user_delete"
                            @click="handleDelete">删 除
                        </el-button>
                        <el-button type="info" size="small" plain v-if="permission.user_role" icon="el-icon-user"
                            @click="handleGrant">角色配置
                        </el-button>
                        <el-button type="info" size="small" plain v-if="permission.user_reset" icon="el-icon-refresh"
                            @click="handleReset">密码重置
                        </el-button>
                        <!-- <el-button type="info"
  <el-row>
    <el-col :span="5">
      <div class="box">
        <el-scrollbar>
          <basic-container>
            <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
          </basic-container>
        </el-scrollbar>
      </div>
    </el-col>
    <el-col :span="19">
      <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="menuLeft">
            <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.user_delete"
              @click="handleDelete">删 除
            </el-button>
            <el-button type="info" size="small" plain v-if="permission.user_role" icon="el-icon-user"
              @click="handleGrant">角色配置
            </el-button>
            <el-button type="info" size="small" plain v-if="permission.user_reset" icon="el-icon-refresh"
              @click="handleReset">密码重置
            </el-button>
            <!-- <el-button type="info"
                       size="small"
                       plain
                       v-if="userInfo.role_name.includes('admin')"
                       icon="el-icon-setting"
                       @click="handlePlatform">平台配置
            </el-button> -->
                        <el-button type="info" size="small" plain v-if="userInfo.role_name.includes('admin')"
                            icon="el-icon-coordinate" @click="handleLock">账号解封
                        </el-button>
                        <el-button type="success" size="small" plain v-if="userInfo.role_name.includes('admin')"
                            icon="el-icon-upload2" @click="handleImport">导入
                        </el-button>
                        <el-button type="warning" size="small" plain v-if="userInfo.role_name.includes('admin')"
                            icon="el-icon-download" @click="handleExport">导出
                        </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>
                <el-dialog title="用户角色配置" append-to-body :visible.sync="roleBox" width="345px">
            <el-button type="info" size="small" plain v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-coordinate" @click="handleLock">账号解封
            </el-button>
            <el-button type="success" size="small" plain v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-upload2" @click="handleImport">导入
            </el-button>
            <el-button type="warning" size="small" plain v-if="userInfo.role_name.includes('admin')"
              icon="el-icon-download" @click="handleExport">导出
            </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>
        <el-dialog title="用户角色配置" append-to-body :visible.sync="roleBox" width="345px">
                    <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id"
                        ref="treeRole" :default-checked-keys="roleTreeObj" :props="props">
                    </el-tree>
          <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id" ref="treeRole"
            :default-checked-keys="roleTreeObj" :props="props">
          </el-tree>
                    <span slot="footer" class="dialog-footer">
                        <el-button @click="roleBox = false">取 消</el-button>
                        <el-button type="primary" @click="submitRole">确 定</el-button>
                    </span>
                </el-dialog>
                <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>
                <!-- <el-dialog title="用户平台配置"
          <span slot="footer" class="dialog-footer">
            <el-button @click="roleBox = false">取 消</el-button>
            <el-button type="primary" @click="submitRole">确 定</el-button>
          </span>
        </el-dialog>
        <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>
        <!-- <el-dialog title="用户平台配置"
                   append-to-body
                   :visible.sync="platformBox">
          <avue-crud :option="platformOption"
@@ -105,13 +105,13 @@
            </template>
          </avue-crud>
        </el-dialog> -->
            </basic-container>
        </el-col>
    </el-row>
      </basic-container>
    </el-col>
  </el-row>
</template>
<script>
import {
  import {
    getList,
    getUser,
    getUserPlatform,
@@ -120,870 +120,889 @@
    updatePlatform,
    add,
    grant,
    resetPassword, unlock
} from "@/api/system/user"
import { exportBlob } from "@/api/common"
import { getDeptTree, getDeptLazyTree } from "@/api/system/dept"
import { getRoleTree } from "@/api/system/role"
import { getPostList } from "@/api/system/post"
import { mapGetters } from "vuex"
import website from '@/config/website'
import { getToken } from '@/util/auth'
import { downloadXls } from "@/util/util"
import { dateNow } from "@/util/date"
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import func from "@/util/func"
    resetPassword,
    unlock
  } from "@/api/system/user"
  import {
    exportBlob
  } from "@/api/common"
  import {
    getDeptTree,
    getDeptLazyTree
  } from "@/api/system/dept"
  import {
    getRoleTree
  } from "@/api/system/role"
  import {
    getPostList
  } from "@/api/system/post"
  import {
    mapGetters
  } from "vuex"
  import website from '@/config/website'
  import {
    getToken
  } from '@/util/auth'
  import {
    downloadXls
  } from "@/util/util"
  import {
    dateNow
  } from "@/util/date"
  import NProgress from 'nprogress'
  import 'nprogress/nprogress.css'
  import func from "@/util/func"
export default {
    data () {
        const validatePass = (rule, value, callback) => {
            if (value === '') {
                callback(new Error('请输入密码'))
            } else {
                callback()
            }
  export default {
    data() {
      const validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入密码'))
        } else {
          callback()
        }
        const validatePass2 = (rule, value, callback) => {
            if (value === '') {
                callback(new Error('请再次输入密码'))
            } else if (value !== this.form.password) {
                callback(new Error('两次输入密码不一致!'))
            } else {
                callback()
            }
      }
      const validatePass2 = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请再次输入密码'))
        } else if (value !== this.form.password) {
          callback(new Error('两次输入密码不一致!'))
        } else {
          callback()
        }
        return {
            form: {},
            search: {},
            roleBox: false,
            excelBox: false,
            platformBox: false,
            initFlag: true,
            selectionList: [],
            query: {},
            loading: true,
            platformLoading: false,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            platformPage: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            init: {
                roleTree: [],
                deptTree: [],
            },
            props: {
                label: "title",
                value: "key"
            },
            roleGrantList: [],
            roleTreeObj: [],
            treeDeptId: '',
            treeData: [],
            treeOption: {
                nodeKey: 'id',
                lazy: true,
                treeLoad: function (node, resolve) {
                    const parentId = (node.level === 0) ? 0 : node.data.id
                    getDeptLazyTree(parentId).then(res => {
                        resolve(res.data.data.map(item => {
                            return {
                                ...item,
                                leaf: !item.hasChildren
                            }
                        }))
                    })
                },
                addBtn: false,
                menu: false,
                size: 'small',
                props: {
                    labelText: '标题',
                    label: 'title',
                    value: 'value',
                    children: 'children'
      }
      return {
        form: {},
        search: {},
        roleBox: false,
        excelBox: false,
        platformBox: false,
        initFlag: true,
        selectionList: [],
        query: {},
        loading: true,
        platformLoading: false,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        platformPage: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        init: {
          roleTree: [],
          deptTree: [],
        },
        props: {
          label: "title",
          value: "key"
        },
        roleGrantList: [],
        roleTreeObj: [],
        treeDeptId: '',
        treeData: [],
        treeOption: {
          nodeKey: 'id',
          lazy: true,
          treeLoad: function(node, resolve) {
            const parentId = (node.level === 0) ? 0 : node.data.id
            getDeptLazyTree(parentId).then(res => {
              resolve(res.data.data.map(item => {
                return {
                  ...item,
                  leaf: !item.hasChildren
                }
              }))
            })
          },
          addBtn: false,
          menu: false,
          size: 'small',
          props: {
            labelText: '标题',
            label: 'title',
            value: 'value',
            children: 'children'
          }
        },
        option: {
          height: 'auto',
          calcHeight: 80,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          viewBtn: true,
          dialogType: 'drawer',
          dialogClickModal: false,
          column: [{
              label: "登录账号",
              prop: "account",
              search: true,
              display: false
            },
            option: {
                height: 'auto',
                calcHeight: 80,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                viewBtn: true,
                dialogType: 'drawer',
                dialogClickModal: false,
                column: [
                    {
                        label: "登录账号",
                        prop: "account",
                        search: true,
                        display: false
                    },
                    // {
                    //   label: "所属租户",
                    //   prop: "tenantName",
                    //   slot: true,
                    //   display: false
                    // },
                    {
                        label: "用户姓名",
                        prop: "realName",
                        search: true,
                        display: false
                    },
                    {
                        label: "所属角色",
                        prop: "roleName",
                        slot: true,
                        display: false
                    },
                    {
                        label: "所属部门",
                        prop: "deptName",
                        slot: true,
                        display: false
                    },
                    // {
                    //   label: "用户平台",
                    //   prop: "userTypeName",
                    //   slot: true,
                    //   display: false
                    // },
                    // {
                    //   label: "用户平台",
                    //   type: "select",
                    //   dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
                    //   props: {
                    //     label: "dictValue",
                    //     value: "dictKey"
                    //   },
                    //   dataType: "number",
                    //   search: true,
                    //   hide: true,
                    //   display: false,
                    //   prop: "userType",
                    //   rules: [{
                    //     required: true,
                    //     message: "请选择用户平台",
                    //     trigger: "blur"
                    //   }]
                    // },
                ],
                group: [
                    {
                        label: '基础信息',
                        prop: 'baseInfo',
                        icon: 'el-icon-user-solid',
                        column: [
                            // {
                            //   label: "所属租户",
                            //   prop: "tenantId",
                            //   type: "tree",
                            //   dicUrl: "/api/blade-system/tenant/select",
                            //   props: {
                            //     label: "tenantName",
                            //     value: "tenantId"
                            //   },
                            //   hide: !website.tenantMode,
                            //   addDisplay: website.tenantMode,
                            //   editDisplay: website.tenantMode,
                            //   viewDisplay: website.tenantMode,
                            //   rules: [{
                            //     required: true,
                            //     message: "请输入所属租户",
                            //     trigger: "click"
                            //   }],
                            //   span: 24,
                            // },
                            {
                                label: "登录账号",
                                prop: "account",
                                rules: [{
                                    required: true,
                                    message: "请输入登录账号",
                                    trigger: "blur"
                                }],
                            },
                            // {
                            //   label: "用户平台",
                            //   type: "select",
                            //   dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
                            //   props: {
                            //     label: "dictValue",
                            //     value: "dictKey"
                            //   },
                            //   dataType: "number",
                            //   slot: true,
                            //   prop: "userType",
                            //   rules: [{
                            //     required: true,
                            //     message: "请选择用户平台",
                            //     trigger: "blur"
                            //   }]
                            // },
                            {
                                label: '密码',
                                prop: 'password',
                                hide: true,
                                editDisplay: false,
                                viewDisplay: false,
                                rules: [{ required: true, validator: validatePass, trigger: 'blur' }]
                            },
                            {
                                label: '确认密码',
                                prop: 'password2',
                                hide: true,
                                editDisplay: false,
                                viewDisplay: false,
                                rules: [{ required: true, validator: validatePass2, trigger: 'blur' }]
                            },
                        ]
                    },
                    {
                        label: '详细信息',
                        prop: 'detailInfo',
                        icon: 'el-icon-s-order',
                        column: [
                            {
                                label: "用户昵称",
                                prop: "name",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请输入用户昵称",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "用户姓名",
                                prop: "realName",
                                rules: [{
                                    required: true,
                                    message: "请输入用户姓名",
                                    trigger: "blur"
                                }, {
                                    min: 2,
                                    max: 5,
                                    message: '姓名长度在2到5个字符'
                                }]
                            },
                            {
                                label: "手机号码",
                                prop: "phone",
                                overHidden: true
                            },
                            {
                                label: "电子邮箱",
                                prop: "email",
                                hide: true,
                                overHidden: true
                            },
                            {
                                label: "用户性别",
                                prop: "sex",
                                type: "select",
                                dicData: [
                                    {
                                        label: "男",
                                        value: 1
                                    },
                                    {
                                        label: "女",
                                        value: 2
                                    },
                                    {
                                        label: "未知",
                                        value: 3
                                    }
                                ],
                                hide: true
                            },
                            {
                                label: "用户生日",
                                type: "date",
                                prop: "birthday",
                                format: "yyyy-MM-dd hh:mm:ss",
                                valueFormat: "yyyy-MM-dd hh:mm:ss",
                                hide: true
                            },
                            {
                                label: "账号状态",
                                prop: "statusName",
                                hide: true,
                                display: false
                            }
                        ]
                    },
                    {
                        label: '职责信息',
                        prop: 'dutyInfo',
                        icon: 'el-icon-s-custom',
                        column: [
                            // {
                            //   label: "用户编号",
                            //   prop: "code",
                            // },
                            {
                                label: "所属角色",
                                prop: "roleId",
                                multiple: true,
                                type: "tree",
                                dicData: [],
                                props: {
                                    label: "title"
                                },
                                checkStrictly: true,
                                slot: true,
                                rules: [{
                                    required: true,
                                    message: "请选择所属角色",
                                    trigger: "click"
                                }]
                            },
                            {
                                label: "所属部门",
                                prop: "deptId",
                                type: "tree",
                                // multiple: true,
                                dicData: [],
                                dataType:"string",
                                props: {
                                    label: "title"
                                },
                                // checkStrictly: true,
                                slot: true,
                                span: 12,
                                rules: [{
                                    required: true,
                                    message: "请选择所属部门",
                                    trigger: "click"
                                }]
                            },
                            // {
                            //   label: "所属岗位",
                            //   prop: "postId",
                            //   type: "tree",
                            //   multiple: true,
                            //   dicData: [],
                            //   props: {
                            //     label: "postName",
                            //     value: "id"
                            //   },
                            //   rules: [{
                            //     required: true,
                            //     message: "请选择所属岗位",
                            //     trigger: "click"
                            //   }],
                            // },
                        ]
                    },
                ]
            // {
            //   label: "所属租户",
            //   prop: "tenantName",
            //   slot: true,
            //   display: false
            // },
            {
              label: "用户姓名",
              prop: "realName",
              search: true,
              display: false
            },
            data: [],
            platformQuery: {},
            platformSelectionList: [],
            platformData: [],
            platformForm: {},
            platformOption: {
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                viewBtn: true,
                dialogClickModal: false,
                menuWidth: 120,
                editBtnText: '配置',
                column: [
                    {
                        label: "登录账号",
                        prop: "account",
                        search: true,
                        display: false
                    },
                    {
                        label: "所属租户",
                        prop: "tenantName",
                        slot: true,
                        display: false
                    },
                    {
                        label: "用户姓名",
                        prop: "realName",
                        search: true,
                        display: false
                    },
                    {
                        label: "用户平台",
                        prop: "userTypeName",
                        slot: true,
                        display: false
                    },
                    {
                        label: "用户平台",
                        type: "select",
                        dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        search: true,
                        hide: true,
                        display: false,
                        prop: "userType",
                        rules: [{
                            required: true,
                            message: "请选择用户平台",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "用户拓展",
                        prop: "userExt",
                        type: "textarea",
                        minRows: 8,
                        span: 24,
                        overHidden: true,
                        row: true,
                        hide: true,
                    },
                ],
            {
              label: "所属角色",
              prop: "roleName",
              slot: true,
              display: false
            },
            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: "deptName",
              slot: true,
              display: false
            },
            // {
            //   label: "用户平台",
            //   prop: "userTypeName",
            //   slot: true,
            //   display: false
            // },
            // {
            //   label: "用户平台",
            //   type: "select",
            //   dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
            //   props: {
            //     label: "dictValue",
            //     value: "dictKey"
            //   },
            //   dataType: "number",
            //   search: true,
            //   hide: true,
            //   display: false,
            //   prop: "userType",
            //   rules: [{
            //     required: true,
            //     message: "请选择用户平台",
            //     trigger: "blur"
            //   }]
            // },
          ],
          group: [{
              label: '基础信息',
              prop: 'baseInfo',
              icon: 'el-icon-user-solid',
              column: [
                // {
                //   label: "所属租户",
                //   prop: "tenantId",
                //   type: "tree",
                //   dicUrl: "/api/blade-system/tenant/select",
                //   props: {
                //     label: "tenantName",
                //     value: "tenantId"
                //   },
                //   hide: !website.tenantMode,
                //   addDisplay: website.tenantMode,
                //   editDisplay: website.tenantMode,
                //   viewDisplay: website.tenantMode,
                //   rules: [{
                //     required: true,
                //     message: "请输入所属租户",
                //     trigger: "click"
                //   }],
                //   span: 24,
                // },
                {
                  label: "登录账号",
                  prop: "account",
                  rules: [{
                    required: true,
                    message: "请输入登录账号",
                    trigger: "blur"
                  }],
                },
                // {
                //   label: "用户平台",
                //   type: "select",
                //   dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
                //   props: {
                //     label: "dictValue",
                //     value: "dictKey"
                //   },
                //   dataType: "number",
                //   slot: true,
                //   prop: "userType",
                //   rules: [{
                //     required: true,
                //     message: "请选择用户平台",
                //     trigger: "blur"
                //   }]
                // },
                {
                  label: '密码',
                  prop: 'password',
                  hide: true,
                  editDisplay: false,
                  viewDisplay: false,
                  rules: [{
                    required: true,
                    validator: validatePass,
                    trigger: 'blur'
                  }]
                },
                {
                  label: '确认密码',
                  prop: 'password2',
                  hide: true,
                  editDisplay: false,
                  viewDisplay: false,
                  rules: [{
                    required: true,
                    validator: validatePass2,
                    trigger: 'blur'
                  }]
                },
              ]
            },
            {
              label: '详细信息',
              prop: 'detailInfo',
              icon: 'el-icon-s-order',
              column: [{
                  label: "用户昵称",
                  prop: "name",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请输入用户昵称",
                    trigger: "blur"
                  }]
                },
                {
                  label: "用户姓名",
                  prop: "realName",
                  rules: [{
                    required: true,
                    message: "请输入用户姓名",
                    trigger: "blur"
                  }, {
                    min: 2,
                    max: 5,
                    message: '姓名长度在2到5个字符'
                  }]
                },
                {
                  label: "手机号码",
                  prop: "phone",
                  overHidden: true
                },
                {
                  label: "电子邮箱",
                  prop: "email",
                  hide: true,
                  overHidden: true
                },
                {
                  label: "用户性别",
                  prop: "sex",
                  type: "select",
                  dicData: [{
                      label: "男",
                      value: 1
                    },
                    {
                        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: "女",
                      value: 2
                    },
                    {
                        label: '模板下载',
                        prop: 'excelTemplate',
                        formslot: true,
                        span: 24,
                      label: "未知",
                      value: 3
                    }
                ]
                  ],
                  hide: true
                },
                {
                  label: "用户生日",
                  type: "date",
                  prop: "birthday",
                  format: "yyyy-MM-dd hh:mm:ss",
                  valueFormat: "yyyy-MM-dd hh:mm:ss",
                  hide: true
                },
                {
                  label: "账号状态",
                  prop: "statusName",
                  hide: true,
                  display: false
                }
              ]
            },
            {
              label: '职责信息',
              prop: 'dutyInfo',
              icon: 'el-icon-s-custom',
              column: [
                // {
                //   label: "用户编号",
                //   prop: "code",
                // },
                {
                  label: "所属角色",
                  prop: "roleId",
                  multiple: true,
                  type: "tree",
                  dicData: [],
                  props: {
                    label: "title"
                  },
                  checkStrictly: true,
                  slot: true,
                  rules: [{
                    required: true,
                    message: "请选择所属角色",
                    trigger: "click"
                  }]
                },
                {
                  label: "所属部门",
                  prop: "deptId",
                  type: "tree",
                  // multiple: true,
                  dicData: [],
                  dataType: "string",
                  props: {
                    label: "title"
                  },
                  // checkStrictly: true,
                  slot: true,
                  span: 12,
                  rules: [{
                    required: true,
                    message: "请选择所属部门",
                    trigger: "click"
                  }]
                },
                // {
                //   label: "所属岗位",
                //   prop: "postId",
                //   type: "tree",
                //   multiple: true,
                //   dicData: [],
                //   props: {
                //     label: "postName",
                //     value: "id"
                //   },
                //   rules: [{
                //     required: true,
                //     message: "请选择所属岗位",
                //     trigger: "click"
                //   }],
                // },
              ]
            },
          ]
        },
        data: [],
        platformQuery: {},
        platformSelectionList: [],
        platformData: [],
        platformForm: {},
        platformOption: {
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          viewBtn: true,
          dialogClickModal: false,
          menuWidth: 120,
          editBtnText: '配置',
          column: [{
              label: "登录账号",
              prop: "account",
              search: true,
              display: false
            },
            {
              label: "所属租户",
              prop: "tenantName",
              slot: true,
              display: false
            },
            {
              label: "用户姓名",
              prop: "realName",
              search: true,
              display: false
            },
            {
              label: "用户平台",
              prop: "userTypeName",
              slot: true,
              display: false
            },
            {
              label: "用户平台",
              type: "select",
              dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              search: true,
              hide: true,
              display: false,
              prop: "userType",
              rules: [{
                required: true,
                message: "请选择用户平台",
                trigger: "blur"
              }]
            },
            {
              label: "用户拓展",
              prop: "userExt",
              type: "textarea",
              minRows: 8,
              span: 24,
              overHidden: true,
              row: true,
              hide: true,
            },
          ],
        },
        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: {
        'form.tenantId' () {
            if (this.form.tenantId !== '' && this.initFlag) {
                this.initData(this.form.tenantId)
            }
        },
        'excelForm.isCovered' () {
            if (this.excelForm.isCovered !== '') {
                const column = this.findObject(this.excelOption.column, "excelFile")
                column.action = `/api/blade-system/user/import-user?isCovered=${this.excelForm.isCovered}`
            }
      'form.tenantId'() {
        if (this.form.tenantId !== '' && this.initFlag) {
          this.initData(this.form.tenantId)
        }
      },
      'excelForm.isCovered'() {
        if (this.excelForm.isCovered !== '') {
          const column = this.findObject(this.excelOption.column, "excelFile")
          column.action = `/api/blade-system/user/import-user?isCovered=${this.excelForm.isCovered}`
        }
      }
    },
    computed: {
        ...mapGetters(["userInfo", "permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.user_add, false),
                viewBtn: this.vaildData(this.permission.user_view, false),
                delBtn: this.vaildData(this.permission.user_delete, false),
                editBtn: this.vaildData(this.permission.user_edit, false)
            }
        },
        platformPermissionList () {
            return {
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                editBtn: this.vaildData(this.permission.user_edit, false)
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    mounted () {
        // 非租户模式默认加载管理组数据
        if (!website.tenantMode) {
            this.initData(website.tenantId)
      ...mapGetters(["userInfo", "permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.user_add, false),
          viewBtn: this.vaildData(this.permission.user_view, false),
          delBtn: this.vaildData(this.permission.user_delete, false),
          editBtn: this.vaildData(this.permission.user_edit, false)
        }
      },
      platformPermissionList() {
        return {
          addBtn: false,
          viewBtn: false,
          delBtn: false,
          editBtn: this.vaildData(this.permission.user_edit, false)
        }
      },
      ids() {
        let ids = []
        this.selectionList.forEach(ele => {
          ids.push(ele.id)
        })
        return ids.join(",")
      },
    },
    created () {
    mounted() {
      // 非租户模式默认加载管理组数据
      if (!website.tenantMode) {
        this.initData(website.tenantId)
      }
    },
    created() {
      this.initData(website.tenantId)
    },
    methods: {
        nodeClick (data) {
            this.treeDeptId = data.id
            this.page.currentPage = 1
      nodeClick(data) {
        this.treeDeptId = data.id
        this.page.currentPage = 1
        this.onLoad(this.page)
      },
      initData(tenantId) {
        getRoleTree(tenantId).then(res => {
          const column = this.findObject(this.option.group, "roleId")
          column.dicData = res.data.data
        })
        getDeptTree(tenantId).then(res => {
          const column = this.findObject(this.option.group, "deptId")
          column.dicData = res.data.data
        })
        // getPostList(tenantId).then(res => {
        //   const column = this.findObject(this.option.group, "postId");
        //   column.dicData = res.data.data;
        // });
      },
      submitRole() {
        const roleList = this.$refs.treeRole.getCheckedKeys().join(",")
        grant(this.ids, roleList).then(() => {
          this.roleBox = false
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          this.onLoad(this.page)
        })
      },
      rowSave(row, done, loading) {
        row['tenantId'] = "000000"
        row['userType'] = 1
        row.deptId = func.join(row.deptId)
        row.roleId = func.join(row.roleId)
        row.postId = func.join(row.postId);
        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) {
        row['tenantId'] = "000000"
        row['userType'] = 1
        row.deptId = func.join(row.deptId)
        row.roleId = func.join(row.roleId)
        row.postId = func.join(row.postId);
        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)
        },
        initData (tenantId) {
            getRoleTree(tenantId).then(res => {
                const column = this.findObject(this.option.group, "roleId")
                column.dicData = res.data.data
            this.$message({
              type: "success",
              message: "操作成功!"
            })
            getDeptTree(tenantId).then(res => {
                const column = this.findObject(this.option.group, "deptId")
                column.dicData = res.data.data
            })
            // getPostList(tenantId).then(res => {
            //   const column = this.findObject(this.option.group, "postId");
            //   column.dicData = res.data.data;
            // });
        },
        submitRole () {
            const roleList = this.$refs.treeRole.getCheckedKeys().join(",")
            grant(this.ids, roleList).then(() => {
                this.roleBox = false
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                this.onLoad(this.page)
            })
        },
        rowSave (row, done, loading) {
            row['tenantId'] = "000000"
            row['userType'] = 1
            row.deptId = func.join(row.deptId)
            row.roleId = func.join(row.roleId)
            row.postId = func.join(row.postId);
            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) {
            row['tenantId'] = "000000"
            row['userType'] = 1
            row.deptId = func.join(row.deptId)
            row.roleId = func.join(row.roleId)
            row.postId = func.join(row.postId);
            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()
                })
        },
        handleReset () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择账号密码重置为123456?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return resetPassword(this.ids)
                })
                .then(() => {
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        handleGrant () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.roleTreeObj = []
            if (this.selectionList.length === 1) {
                this.roleTreeObj = this.selectionList[0].roleId.split(",")
            }
            getRoleTree().then(res => {
                this.roleGrantList = res.data.data
                this.roleBox = true
            })
        },
        handlePlatform () {
            this.platformBox = true
        },
        handleLock () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择账号解封?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return unlock(this.ids)
                })
                .then(() => {
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        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()
                exportBlob(`/api/blade-system/user/export-user?${this.website.tokenHeader}=${getToken()}&account=${account}&realName=${realName}`).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)) {
                getUser(this.form.id).then(res => {
                    this.form = res.data.data
                    if (this.form.hasOwnProperty("deptId")) {
                        this.form.deptId = this.form.deptId.split(",")
                    }
                    if (this.form.hasOwnProperty("roleId")) {
                        this.form.roleId = this.form.roleId.split(",")
                    }
                    if (this.form.hasOwnProperty("postId")) {
                        this.form.postId = this.form.postId.split(",")
                    }
                })
            }
            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), this.treeDeptId).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        },
        platformRowUpdate (row, index, done, loading) {
            updatePlatform(row.id, row.userType, row.userExt).then(() => {
                this.platformOnLoad(this.platformPage)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        platformBeforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getUserPlatform(this.platformForm.id).then(res => {
                    this.platformForm = res.data.data
                })
            }
            done()
        },
        platformSearchReset () {
            this.platformQuery = {}
            this.platformOnLoad(this.platformPage)
        },
        platformSearchChange (params, done) {
            this.platformQuery = params
            this.platformPage.currentPage = 1
            this.platformOnLoad(this.platformPage, params)
            done()
        },
        platformSelectionChange (list) {
            this.platformSelectionList = list
        },
        platformSelectionClear () {
            this.platformSelectionList = []
            this.$refs.platformCrud.toggleSelection()
        },
        platformCurrentChange (currentPage) {
            this.platformPage.currentPage = currentPage
        },
        platformSizeChange (pageSize) {
            this.platformPage.pageSize = pageSize
        },
        platformRefreshChange () {
            this.platformOnLoad(this.platformPage, this.platformQuery)
        },
        platformOnLoad (page, params = {}) {
            this.platformLoading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
                const data = res.data.data
                this.platformPage.total = data.total
                this.platformData = data.records
                this.platformLoading = false
                this.selectionClear()
            })
          })
      },
      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()
          })
      },
      handleReset() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据")
          return
        }
        this.$confirm("确定将选择账号密码重置为123456?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return resetPassword(this.ids)
          })
          .then(() => {
            this.$message({
              type: "success",
              message: "操作成功!"
            })
            this.$refs.crud.toggleSelection()
          })
      },
      handleGrant() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据")
          return
        }
        this.roleTreeObj = []
        if (this.selectionList.length === 1) {
          this.roleTreeObj = this.selectionList[0].roleId.split(",")
        }
        getRoleTree().then(res => {
          this.roleGrantList = res.data.data
          this.roleBox = true
        })
      },
      handlePlatform() {
        this.platformBox = true
      },
      handleLock() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据")
          return
        }
        this.$confirm("确定将选择账号解封?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return unlock(this.ids)
          })
          .then(() => {
            this.$message({
              type: "success",
              message: "操作成功!"
            })
          })
      },
      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()
          exportBlob(
            `/api/blade-system/user/export-user?${this.website.tokenHeader}=${getToken()}&account=${account}&realName=${realName}`
            ).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)) {
          getUser(this.form.id).then(res => {
            this.form = res.data.data
            if (this.form.hasOwnProperty("deptId")) {
              this.form.deptId = this.form.deptId.split(",")
            }
            if (this.form.hasOwnProperty("roleId")) {
              this.form.roleId = this.form.roleId.split(",")
            }
            if (this.form.hasOwnProperty("postId")) {
              this.form.postId = this.form.postId.split(",")
            }
          })
        }
        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), this.treeDeptId).then(res => {
          const data = res.data.data
          this.page.total = data.total
          this.data = data.records
          this.loading = false
          this.selectionClear()
        })
      },
      platformRowUpdate(row, index, done, loading) {
        updatePlatform(row.id, row.userType, row.userExt).then(() => {
          this.platformOnLoad(this.platformPage)
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          done()
        }, error => {
          window.console.log(error)
          loading()
        })
      },
      platformBeforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getUserPlatform(this.platformForm.id).then(res => {
            this.platformForm = res.data.data
          })
        }
        done()
      },
      platformSearchReset() {
        this.platformQuery = {}
        this.platformOnLoad(this.platformPage)
      },
      platformSearchChange(params, done) {
        this.platformQuery = params
        this.platformPage.currentPage = 1
        this.platformOnLoad(this.platformPage, params)
        done()
      },
      platformSelectionChange(list) {
        this.platformSelectionList = list
      },
      platformSelectionClear() {
        this.platformSelectionList = []
        this.$refs.platformCrud.toggleSelection()
      },
      platformCurrentChange(currentPage) {
        this.platformPage.currentPage = currentPage
      },
      platformSizeChange(pageSize) {
        this.platformPage.pageSize = pageSize
      },
      platformRefreshChange() {
        this.platformOnLoad(this.platformPage, this.platformQuery)
      },
      platformOnLoad(page, params = {}) {
        this.platformLoading = true
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
          const data = res.data.data
          this.platformPage.total = data.total
          this.platformData = data.records
          this.platformLoading = false
          this.selectionClear()
        })
      }
    }
}
  }
</script>
<style>
.box {
  .box {
    height: 800px;
}
  }
.el-scrollbar {
  .el-scrollbar {
    height: 100%;
}
  }
.box .el-scrollbar__wrap {
  .box .el-scrollbar__wrap {
    overflow: scroll;
}
  }
</style>