<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="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>

          <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"
                     :table-loading="platformLoading"
                     :data="platformData"
                     ref="platformCrud"
                     v-model="platformForm"
                     :before-open="platformBeforeOpen"
                     :page.sync="platformPage"
                     :permission="platformPermissionList"
                     @row-update="platformRowUpdate"
                     @search-change="platformSearchChange"
                     @search-reset="platformSearchReset"
                     @selection-change="platformSelectionChange"
                     @current-change="platformCurrentChange"
                     @size-change="platformSizeChange"
                     @refresh-change="platformRefreshChange"
                     @on-load="platformOnLoad">
            <template slot-scope="{row}"
                      slot="tenantName">
              <el-tag>{{row.tenantName}}</el-tag>
            </template>
            <template slot-scope="{row}"
                      slot="userTypeName">
              <el-tag>{{row.userTypeName}}</el-tag>
            </template>
          </avue-crud>
        </el-dialog>
      </basic-container>
    </el-col>
  </el-row>
</template>

<script>

import {
  getList,
  getUser,
  getUserPlatform,
  remove,
  update,
  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';

export default {
  data()
  {
    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,
        dialogWidth:'100%',
        column: [
          {
            label: "所属部门",
            prop: "deptName",
            slot: true,
            display: false
          },
          {
            label: "姓名",
            prop: "realName",
            search: true,
            display: false
          },
          {
            label: "出生年月",
            prop: "dataOfBirth",
            search: true,
            display: false
          },
          {
            label: "性别",
            prop: "sex",
            search: false,
            display: false
          },
          {
            label: "政治面貌",
            prop: "politicalStatus",
            search: false,
            display: false
          },
          {
            label: "现任职务",
            prop: "position ",
            search: false,
            display: false
          }
        ],
        group: [
          {
            label: '基础信息',
            prop: 'baseInfo',
            icon: 'el-icon-user-solid',
            column: [
              {
                label: "所属租户",
                prop: "tenantId",
                type: "tree",
                dicUrl: "/api/galaxy-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: "xingming",
                value:"张三",
                rules: [{
                  required: true,
                  message: "请输入姓名",
                  trigger: "blur"
                }],
                span: 4,
              },
              {
                label: "性别",
                type: "select",
                labelWidth:110,

                value:"男",
                dicUrl: "/api/galaxy-system/dict/dictionary?code=sex",
                props: {
                  label: "dictValue",
                  value: "dictKey"
                },
                dataType: "string",
                slot: true,
                prop: "xingbie",
                rules: [{
                  required: true,
                  message: "请选择性别",
                  trigger: "blur"
                }],
                span: 4,
              },
              {
                label: "民族",
                type: "select",
                value:"汉族",
                dicUrl: "/api/galaxy-system/dict/dictionary?code=minzu",
                props: {
                  label: "dictValue",
                  value: "dictKey"
                },
                dataType: "string",
                slot: true,
                prop: "minzu",
                rules: [{
                  required: true,
                  message: "请选择民族",
                  trigger: "blur"
                }],
                span: 4,
              },
              {
                label: "健康状况",
                type: "select",
                dicUrl: "/api/galaxy-system/dict/dictionary?code=jiankangzhuangkuang",
                value:"健康",
                props: {
                  label: "dictValue",
                  value: "dictKey"
                },
                dataType: "string",
                slot: true,
                prop: "jiankangzhuangkuang",
                rules: [{
                  required: true,
                  message: "请选择健康状况",
                  trigger: "blur"
                }],
                span: 4,
              },
              {
                label: "手机号码",
                prop: "shoujihaoma",
                value:"18611111111",
                overHidden: true,
                span: 4,
                rules: [{
                  required: true,
                  message: "请输入手机号码",
                  trigger: "blur"
                }],
              },
              {
                label: "籍贯",
                prop: "jiguan",
                labelWidth:110,
                overHidden: true,
                span: 4,
                value:"江苏省南京市",
                rules: [{
                  required: true,
                  message: "请输入籍贯",
                  trigger: "blur"
                }],
              },
              {
                label: "出生地",
                prop: "chushengdi",
                overHidden: true,
                span: 4,
                value:"江苏省苏州市",
                rules: [{
                  required: true,
                  message: "请输入出生地",
                  trigger: "blur"
                }],
              },
              {
                label: "政治面貌",
                type: "select",
                labelWidth:110,

                dicUrl: "/api/galaxy-system/dict/dictionary?code=zhengzhimianmao",
                props: {
                  label: "dictValue",
                  value: "dictKey"
                },
                dataType: "string",
                slot: true,
                prop: "zhengzhimianmao",
                span: 4,
              },
              {
                label: "身份证号",
                prop: "shenfenzhenghao",
                value:"410103111122223333",
                span: 4,
                rules: [{
                  required: true,
                  message: "请输入身份证号码",
                  trigger: "blur"
                }, {
                  min: 18,
                  max: 18,
                  message: '身份证号长度必须是18位'
                }]
              },
              {
                label: "出生日期",
                type: "date",
                prop: "chushengriqi",
                format: "yyyy-MM-dd",
                valueFormat: "yyyy-MM-dd",
                value:"1990-02-01",
                span: 4,
              },
              {
                label: "入党日期",
                type: "date",
                prop: "rudangriqi",
                format: "yyyy-MM-dd",
                valueFormat: "yyyy-MM-dd",
                value:"2009-02-01",
                span: 4,
              },
              {
                label: "参加工作日期",
                labelWidth:110,
                type: "date",
                prop: "canjiagongzuoriqi",
                format: "yyyy-MM-dd",
                valueFormat: "yyyy-MM-dd",
                value:"2012-07-01",
                span: 4,
              },
              {
                label: "户籍地址",
                prop: "hujidizhi",
                overHidden: true,
                value:"上海市黄浦区浦东路11号21弄",
                span: 4,
                rules: [{
                  required: true,
                  message: "请输入户籍地",
                  trigger: "blur"
                }],
              },
              {
                label: "专业技术职务",
                type: "select",
                labelWidth:110,
                value:"高级工程师",

                dicUrl: "/api/galaxy-system/dict/dictionary?code=zhuanyejishuzhiwu",
                props: {
                  label: "dictValue",
                  value: "dictKey"
                },
                dataType: "string",
                slot: true,
                prop: "zhuanyejishuzhiwu",
                span: 4,
              },
              {
                label: "有何特长",
                type: "input",
                prop: "youhetechang",
                overHidden: true,
                value:"信息技术",
                span: 4,
              },
              {
                label: "居住地址",
                prop: "juzhudizhi",
                overHidden: true,
                value:"上海市黄浦区浦东路11号21弄",
                span: 4,
              },
            ]
          },
          {
            label: '教育情况',
            prop: 'jiaoyuqingkuang',
            icon: 'el-icon-s-order',
            column: [
              {
                type: 'dynamic',
                span: 24,
                display: true,
                children: {
                  align: 'left',
                  headerAlign: 'center',
                  index: false,
                  addBtn: true,
                  delBtn: true,
                  column: [
                    {
                    type: 'select',
                    label: '学历类型',
                    dicUrl: "/api/galaxy-system/dict/dictionary?code=xuelileixing",
                    props: {
                      label: "dictValue",
                      value: "dictKey"
                    },
                    dataType: "string",
                    slot: true,
                    prop: "xuelileixing",
                    span: 2,
                    display: true,
                    cascader: [],
                    required: true,
                    rules: [{
                      required: true,
                      message: '必须选择学历类型'
                    }]
                  },
                    {
                      type: 'select',
                      label: '从学单位',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=congxuedanwei",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "congxuedanwei",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'input',
                      label: '就读院校',
                      span: 2,
                      display: true,
                      prop: 'jiuduyuanxiao',
                    },

                    {
                    type: 'date',
                    label: '入学时间',
                    span: 24,
                    display: true,
                    format: 'yyyy-MM-dd',
                    valueFormat: 'yyyy-MM-dd',
                    prop: 'ruxueshijian',
                    required: true,
                    rules: [{
                      required: true,
                      message: '入学时间必须填写'
                    }]
                    },
                    {
                    type: 'date',
                    label: '毕（肄）业时间',
                    span: 24,
                    display: true,
                    format: 'yyyy-MM-dd',
                    valueFormat: 'yyyy-MM-dd',
                    prop: 'biyiyeshijian',
                    required: true,
                    rules: [{
                      required: true,
                      message: '毕（肄）业时间必须填写'
                    }]
                    },
                    {
                      type: 'select',
                      label: '所学专业类别',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=suoxuezhuanyeleibie",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "suoxuezhuanyeleibie",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'input',
                      label: '所学专业名称',
                      span: 2,
                      display: true,
                      prop: 'suoxuezhuanyemingcheng'
                    },

                    {
                      type: 'select',
                      label: '学历',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=xueli",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "xueli",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'select',
                      label: '学位',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=xuewei",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "xuewei",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'select',
                      label: '学习完成情况',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=xuexiwanchengqingkuang",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "xuexiwanchengqingkuang",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                    type: 'checkbox',
                    label: '最高学历',
                    dicData: [{
                      label: '最高学历',
                      value: '1'
                    }],
                    span: 24,
                    display: true,
                    props: {
                      label: 'label',
                      value: 'value'
                    },
                    prop: 'zuigaoxueli',
                    title: '选择字段',
                    list: [{
                      type: 'radio',
                      label: '单选框组',
                      icon: 'icon-radio',
                      dicData: [{
                        label: '选项一',
                        value: '0'
                      }, {
                        label: '选项二',
                        value: '1'
                      }, {
                        label: '选项三',
                        value: '2'
                      }],
                      span: 24,
                      display: true,
                      dicOption: 'static',
                      props: {
                        label: 'label',
                        value: 'value'
                      }
                    },
                    {
                      type: 'checkbox',
                      label: '多选框组',
                      icon: 'icon-checkbox',
                      dicData: [{
                        label: '选项一',
                        value: '0'
                      }, {
                        label: '选项二',
                        value: '1'
                      }, {
                        label: '选项三',
                        value: '2'
                      }],
                      span: 24,
                      display: true,
                      dicOption: 'static',
                      props:
                        {
                        label: 'label',
                        value: 'value'
                        }
                      },
                      {
                      type: 'select',
                      label: '下拉选择器',
                      icon: 'icon-select',
                      dicData: [{
                        label: '选项一',
                        value: '0'
                      }, {
                        label: '选项二',
                        value: '1'
                      }, {
                        label: '选项三',
                        value: '2'
                      }],
                      cascaderItem: [],
                      span: 24,
                      display: true,
                      dicOption: 'static',
                      props: {
                        label: 'label',
                        value: 'value',
                        desc: 'desc'
                      }
                    },
                      {
                      type: 'cascader',
                      label: '级联选择器',
                      icon: 'icon-link',
                      span: 24,
                      display: true,
                      dicData: [{
                        label: '选项一',
                        value: 0,
                        children: [{
                          label: '选项1-1',
                          value: 11
                        }, {
                          label: '选项1-2',
                          value: 12
                        }]
                      }, {
                        label: '选项二',
                        value: '1'
                      }, {
                        label: '选项三',
                        value: '2'
                      }],
                      cascaderIndex: 1,
                      cascaderItem: [],
                      showAllLevels: true,
                      dicOption: 'static',
                      separator: '/',
                      props: {
                        label: 'label',
                        value: 'value',
                        desc: 'desc'
                      }
                    },
                      {
                      type: 'tree',
                      label: '树形选择器',
                      icon: 'icon-tree',
                      span: 24,
                      display: true,
                      dicOption: 'static',
                      dicData: [{
                        label: '选项一',
                        value: 0,
                        children: [{
                          label: '选项1-1',
                          value: '11'
                        }, {
                          label: '选项1-2',
                          value: '12'
                        }]
                      }, {
                        label: '选项二',
                        value: '1'
                      }, {
                        label: '选项三',
                        value: '2'
                      }],
                      parent: true,
                      cascaderItem: [],
                      props: {
                        label: 'label',
                        value: 'value',
                        desc: 'desc'
                      }
                    },
                      {
                      type: 'table',
                      label: '表格选择器',
                      icon: 'icon-table',
                      display: true,
                      span: 24,
                      children: {
                        border: true,
                        searchMenuSpan: 6,
                        searchIcon: true,
                        column: [],
                        props: {
                          url: '',
                          method: 'get',
                          rowKey: 'id',
                          needPage: true,
                          currentPageKey: 'current',
                          pageSizeKey: 'size',
                          totalKey: 'total',
                          recordsKey: 'records',
                          resKey: 'data.data',
                          auto: true
                        }
                      },
                      formatter: function(e) {
                        return e.name
                      },
                      props: {
                        label: 'name',
                        value: 'id'
                      }
                    }],
                    width: 100
                  },
                    {
                      type: 'checkbox',
                      label: '打印标志',
                      dicData: [{
                        label: '打印标志',
                        value: '1'
                      }],
                      span: 24,
                      display: true,
                      props: {
                        label: 'label',
                        value: 'value'
                      },
                      prop: 'dayinbiaozhi',
                      title: '选择字段',
                      list: [{
                        type: 'radio',
                        label: '单选框组',
                        icon: 'icon-radio',
                        dicData: [{
                          label: '选项一',
                          value: '0'
                        }, {
                          label: '选项二',
                          value: '1'
                        }, {
                          label: '选项三',
                          value: '2'
                        }],
                        span: 24,
                        display: true,
                        dicOption: 'static',
                        props: {
                          label: 'label',
                          value: 'value'
                        }
                      },
                        {
                          type: 'checkbox',
                          label: '多选框组',
                          icon: 'icon-checkbox',
                          dicData: [{
                            label: '选项一',
                            value: '0'
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          props:
                            {
                              label: 'label',
                              value: 'value'
                            }
                        },
                        {
                          type: 'select',
                          label: '下拉选择器',
                          icon: 'icon-select',
                          dicData: [{
                            label: '选项一',
                            value: '0'
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          cascaderItem: [],
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'cascader',
                          label: '级联选择器',
                          icon: 'icon-link',
                          span: 24,
                          display: true,
                          dicData: [{
                            label: '选项一',
                            value: 0,
                            children: [{
                              label: '选项1-1',
                              value: 11
                            }, {
                              label: '选项1-2',
                              value: 12
                            }]
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          cascaderIndex: 1,
                          cascaderItem: [],
                          showAllLevels: true,
                          dicOption: 'static',
                          separator: '/',
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'tree',
                          label: '树形选择器',
                          icon: 'icon-tree',
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          dicData: [{
                            label: '选项一',
                            value: 0,
                            children: [{
                              label: '选项1-1',
                              value: '11'
                            }, {
                              label: '选项1-2',
                              value: '12'
                            }]
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          parent: true,
                          cascaderItem: [],
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'table',
                          label: '表格选择器',
                          icon: 'icon-table',
                          display: true,
                          span: 24,
                          children: {
                            border: true,
                            searchMenuSpan: 6,
                            searchIcon: true,
                            column: [],
                            props: {
                              url: '',
                              method: 'get',
                              rowKey: 'id',
                              needPage: true,
                              currentPageKey: 'current',
                              pageSizeKey: 'size',
                              totalKey: 'total',
                              recordsKey: 'records',
                              resKey: 'data.data',
                              auto: true
                            }
                          },
                          formatter: function(e) {
                            return e.name
                          },
                          props: {
                            label: 'name',
                            value: 'id'
                          }
                        }],
                      width: 100
                    },

                  ]
                },
                prop: 'jiaoyuqingkuangbiaodan',

              },
            ]

          },

          {
            label: '工作经历',
            prop: 'gongzuojingli',
            icon: 'el-icon-s-order',
            column: [
              {
                type: 'dynamic',
                span: 24,
                display: true,
                children: {
                  align: 'left',
                  headerAlign: 'center',
                  index: false,
                  addBtn: true,
                  delBtn: true,
                  column: [
                    {
                      type: 'input',
                      label: '任职单位',
                      span: 2,
                      display: true,
                      prop: 'renzhidanwei'
                    },

                    {
                      type: 'input',
                      label: '任职部门',
                      span: 2,
                      display: true,
                      prop: 'renzhibumen'
                    },


                    {
                      type: 'input',
                      label: '职务',
                      span: 2,
                      display: true,
                      prop: 'zhiwu'
                    },


                    {
                      type: 'date',
                      label: '批准任职日期',
                      span: 24,
                      display: true,
                      format: 'yyyy-MM-dd',
                      valueFormat: 'yyyy-MM-dd',
                      prop: 'pizhunrenzhiriqi',
                      required: true,
                    },

                    {
                      type:'select',
                      label:'任职状态',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=renzhizhuangtai",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "renzhizhuangtai",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type:'select',
                      label:'职务类别',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=zhiwuleibie",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "zhiwuleibie",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'date',
                      label: '连续任该职起始日期',
                      span: 24,
                      display: true,
                      format: 'yyyy-MM-dd',
                      valueFormat: 'yyyy-MM-dd',
                      prop: 'lianxurengaizhiqishiriqi',
                    },

                    {
                      type: 'date',
                      label: '批准免职日期',
                      span: 24,
                      display: true,
                      format: 'yyyy-MM-dd',
                      valueFormat: 'yyyy-MM-dd',
                      prop: 'pizhunmianzhiriqi',
                    },

                    {
                      type: 'input',
                      label: '免职原因',
                      span: 2,
                      display: true,
                      prop: 'mianzhiyuanyin'
                    },


                    {
                      type:'select',
                      label:'免职原因类别',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=mianzhiyuanyinleibie",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "mianzhiyuanyinleibie",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'checkbox',
                      label: '班子标志',
                      dicData: [{
                        label: '班子标志',
                        value: '0'
                      }],
                      span: 24,
                      display: true,
                      props: {
                        label: 'label',
                        value: 'value'
                      },
                      prop: 'banzibiaozhi',
                      title: '选择字段',
                      list: [{
                        type: 'radio',
                        label: '单选框组',
                        icon: 'icon-radio',
                        dicData: [{
                          label: '选项一',
                          value: '0'
                        }, {
                          label: '选项二',
                          value: '1'
                        }, {
                          label: '选项三',
                          value: '2'
                        }],
                        span: 24,
                        display: true,
                        dicOption: 'static',
                        props: {
                          label: 'label',
                          value: 'value'
                        }
                      },
                        {
                          type: 'checkbox',
                          label: '多选框组',
                          icon: 'icon-checkbox',
                          dicData: [{
                            label: '选项一',
                            value: '0'
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          props:
                            {
                              label: 'label',
                              value: 'value'
                            }
                        },
                        {
                          type: 'select',
                          label: '下拉选择器',
                          icon: 'icon-select',
                          dicData: [{
                            label: '选项一',
                            value: '0'
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          cascaderItem: [],
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'cascader',
                          label: '级联选择器',
                          icon: 'icon-link',
                          span: 24,
                          display: true,
                          dicData: [{
                            label: '选项一',
                            value: 0,
                            children: [{
                              label: '选项1-1',
                              value: 11
                            }, {
                              label: '选项1-2',
                              value: 12
                            }]
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          cascaderIndex: 1,
                          cascaderItem: [],
                          showAllLevels: true,
                          dicOption: 'static',
                          separator: '/',
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'tree',
                          label: '树形选择器',
                          icon: 'icon-tree',
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          dicData: [{
                            label: '选项一',
                            value: 0,
                            children: [{
                              label: '选项1-1',
                              value: '11'
                            }, {
                              label: '选项1-2',
                              value: '12'
                            }]
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          parent: true,
                          cascaderItem: [],
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'table',
                          label: '表格选择器',
                          icon: 'icon-table',
                          display: true,
                          span: 24,
                          children: {
                            border: true,
                            searchMenuSpan: 6,
                            searchIcon: true,
                            column: [],
                            props: {
                              url: '',
                              method: 'get',
                              rowKey: 'id',
                              needPage: true,
                              currentPageKey: 'current',
                              pageSizeKey: 'size',
                              totalKey: 'total',
                              recordsKey: 'records',
                              resKey: 'data.data',
                              auto: true
                            }
                          },
                          formatter: function(e) {
                            return e.name
                          },
                          props: {
                            label: 'name',
                            value: 'id'
                          }
                        }],
                      width: 100
                    },

                    {
                      type: 'checkbox',
                      label: '试用期标志',
                      dicData: [{
                        label: '试用期标志',
                        value: '0'
                      }],
                      span: 24,
                      display: true,
                      props: {
                        label: 'label',
                        value: 'value'
                      },
                      prop: 'shiyongqibiaozhi',
                      title: '选择字段',
                      list: [{
                        type: 'radio',
                        label: '单选框组',
                        icon: 'icon-radio',
                        dicData: [{
                          label: '选项一',
                          value: '0'
                        }, {
                          label: '选项二',
                          value: '1'
                        }, {
                          label: '选项三',
                          value: '2'
                        }],
                        span: 24,
                        display: true,
                        dicOption: 'static',
                        props: {
                          label: 'label',
                          value: 'value'
                        }
                      },
                        {
                          type: 'checkbox',
                          label: '多选框组',
                          icon: 'icon-checkbox',
                          dicData: [{
                            label: '选项一',
                            value: '0'
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          props:
                            {
                              label: 'label',
                              value: 'value'
                            }
                        },
                        {
                          type: 'select',
                          label: '下拉选择器',
                          icon: 'icon-select',
                          dicData: [{
                            label: '选项一',
                            value: '0'
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          cascaderItem: [],
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'cascader',
                          label: '级联选择器',
                          icon: 'icon-link',
                          span: 24,
                          display: true,
                          dicData: [{
                            label: '选项一',
                            value: 0,
                            children: [{
                              label: '选项1-1',
                              value: 11
                            }, {
                              label: '选项1-2',
                              value: 12
                            }]
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          cascaderIndex: 1,
                          cascaderItem: [],
                          showAllLevels: true,
                          dicOption: 'static',
                          separator: '/',
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'tree',
                          label: '树形选择器',
                          icon: 'icon-tree',
                          span: 24,
                          display: true,
                          dicOption: 'static',
                          dicData: [{
                            label: '选项一',
                            value: 0,
                            children: [{
                              label: '选项1-1',
                              value: '11'
                            }, {
                              label: '选项1-2',
                              value: '12'
                            }]
                          }, {
                            label: '选项二',
                            value: '1'
                          }, {
                            label: '选项三',
                            value: '2'
                          }],
                          parent: true,
                          cascaderItem: [],
                          props: {
                            label: 'label',
                            value: 'value',
                            desc: 'desc'
                          }
                        },
                        {
                          type: 'table',
                          label: '表格选择器',
                          icon: 'icon-table',
                          display: true,
                          span: 24,
                          children: {
                            border: true,
                            searchMenuSpan: 6,
                            searchIcon: true,
                            column: [],
                            props: {
                              url: '',
                              method: 'get',
                              rowKey: 'id',
                              needPage: true,
                              currentPageKey: 'current',
                              pageSizeKey: 'size',
                              totalKey: 'total',
                              recordsKey: 'records',
                              resKey: 'data.data',
                              auto: true
                            }
                          },
                          formatter: function(e) {
                            return e.name
                          },
                          props: {
                            label: 'name',
                            value: 'id'
                          }
                        }],
                      width: 100
                    },

                  ]
                },
                prop: 'gongzuojinglibiaodan'
              },
            ]

          },

          {
            label: '职级信息',
            prop: 'zhijixinxi',
            icon: 'el-icon-s-order',
            column: [
              {
                type: 'dynamic',
                span: 24,
                display: true,
                children: {
                  align: 'left',
                  headerAlign: 'center',
                  index: false,
                  addBtn: true,
                  delBtn: true,
                  column: [

                    {
                      type: 'select',
                      label: '职级',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=zhiji",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "zhiji",
                      span: 2,
                      display: true,
                      cascader: [],
                    },

                    {
                      type: 'date',
                      label: '职级起始时间',
                      span: 24,
                      display: true,
                      format: 'yyyy-MM-dd',
                      valueFormat: 'yyyy-MM-dd',
                      prop: 'zhijiqishishijian',
                    },


                    {
                      type: 'input',
                      label: '级别',
                      span: 2,
                      display: true,
                      prop: 'zhijijibie'
                    },


                    {
                      type: 'input',
                      label: '审批单位',
                      span: 2,
                      display: true,
                      prop: 'shenpidanwei'
                    },
                  ]
                },
                prop: 'zhijixinxibiaodan'
              },
            ]

          },

          {
            label: '家庭主要成员及重要社会关系',
            prop: 'jiatingzhuyaochengyuan',
            icon: 'el-icon-s-order',
            column: [
              {
                type: 'dynamic',
                span: 24,
                display: true,
                children: {
                  align: 'left',
                  headerAlign: 'center',
                  index: false,
                  addBtn: true,
                  delBtn: true,
                  column: [

                    {
                      type: 'select',
                      label: '称谓',
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=chengwei",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "chengwei",
                      span: 2,
                      display: true,
                      cascader: [],
                    },



                    {
                      type: 'input',
                      label: '姓名',
                      span: 2,
                      display: true,
                      prop: 'jiatingchengyuanxingming'
                    },


                    {
                      type: 'date',
                      label: '出生年月',
                      span: 24,
                      display: true,
                      format: 'yyyy-MM-dd',
                      valueFormat: 'yyyy-MM-dd',
                      prop: 'jiatingchengyuanchushengnianyue',
                    },

                    {
                      label: "政治面貌",
                      type: "select",
                      dicUrl: "/api/galaxy-system/dict/dictionary?code=zhengzhimianmao",
                      props: {
                        label: "dictValue",
                        value: "dictKey"
                      },
                      dataType: "string",
                      slot: true,
                      prop: "jiatingchengyuanzhengzhimianmao",
                      span: 4,
                    },


                    {
                      type: 'input',
                      label: '工作单位',
                      span: 2,
                      display: true,
                      prop: 'jiatingchengyuangongzuodanwei'
                    },


                    {
                      type: 'input',
                      label: '职务',
                      span: 2,
                      display: true,
                      prop: 'jiatingchengyuanzhiwu'
                    },
                  ]
                },
                prop: 'jiatingchengyuanxinxibiaodan'
              },
            ]
          },


        ]
      },
      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/galaxy-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/galaxy-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/galaxy-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);
    }
  },
  methods: {
    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.deptId = row.deptId.join(",");
      row.roleId = row.roleId.join(",");
      row.postId = row.postId.join(",");
      add(row).then(() => {
        this.initFlag = false;
        this.onLoad(this.page);
        this.$message({
          type: "success",
          message: "操作成功!"
        });
        done();
      }, error => {
        window.console.log(error);
        loading();
      });
    },
    rowUpdate(row, index, done, loading) {
      row.deptId = row.deptId.join(",");
      row.roleId = row.roleId.join(",");
      row.postId = row.postId.join(",");
      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() {
      this.$confirm("是否导出用户数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        NProgress.start();
        exportBlob(`/api/galaxy-user/export-user?${this.website.tokenHeader}=${getToken()}&account=${this.search.account}&realName=${this.search.realName}`).then(res => {
          downloadXls(res.data, `用户数据表${dateNow()}.xlsx`);
          NProgress.done();
        })
      });
    },
    handleTemplate() {
      exportBlob(`/api/galaxy-user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
        downloadXls(res.data, "用户数据模板.xlsx");
      })
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        const jiaoyuqingkuangs = [];
        jiaoyuqingkuangs.push(
          {
            xuelileixing:"全日制",
            congxuedanwei:"省属高等院校",
            jiuduyuanxiao:"上海理工大学",
            ruxueshijian:"2012-09-01",
            biyiyeshijian:"2016-06-30",
            suoxuezhuanyeleibie:"理学",
            suoxuezhuanyemingcheng:"计算机软件",
            xueli:"大学本科",
            xuewei:"学士学位",
            xuexiwanchengqingkuang:"毕业",
          }
        );
        this.form.jiaoyuqingkuangbiaodan = jiaoyuqingkuangs;

        const gongzuojinglis = [];
        gongzuojinglis.push(
          {
            renzhidanwei:"上海市司法局",
            renzhibumen:"信息技术处",
            zhiwu:"技术工程师",
            pizhunrenzhiriqi:"2016-09-01",
            renzhizhuangtai:"在职",
            zhiwuleibie:"公务员",
            lianxurengaizhiqishiriqi:"2016-09-01",
            pizhunmianzhiriqi:"",
            mianzhiyuanyin:"",
          }
        );
        this.form.gongzuojinglibiaodan = gongzuojinglis;


        const zhijixinxis = [];
        zhijixinxis.push(
          {
            zhiji:"三级调研员",
            zhijiqishishijian:"2021-01-01",
            zhijijibie:"15",
            shenpidanwei:"上海市司法局",
          },
          {
            zhiji:"二级调研员",
            zhijiqishishijian:"2019-01-01",
            zhijijibie:"12",
            shenpidanwei:"上海市司法局",
          }

        );
        this.form.zhijixinxibiaodan = zhijixinxis;

        const jiatingchengyuanxinxis = [];
        jiatingchengyuanxinxis.push(
          {
            chengwei:"父亲",
            jiatingchengyuanxingming:"张大宝",
            jiatingchengyuanchushengnianyue:"1970-01-01",
            jiatingchengyuanzhengzhimianmao:"中共党员",
            jiatingchengyuangongzuodanwei:"上海商飞",
            jiatingchengyuanzhiwu:"首席科学家",
          },
          {
            chengwei:"配偶",
            jiatingchengyuanxingming:"李小宝",
            jiatingchengyuanchushengnianyue:"1990-01-01",
            jiatingchengyuanzhengzhimianmao:"九三学社",
            jiatingchengyuangongzuodanwei:"嘉实基金",
            jiatingchengyuanzhiwu:"投资总监",
          }
        );
        this.form.jiatingchengyuanxinxibiaodan = jiatingchengyuanxinxis;


        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 {
  height: 800px;
}

.el-scrollbar {
  height: 100%;
}

.box .el-scrollbar__wrap {
  overflow: scroll;
}
</style>
