<template>
  <div class="meta-container">
    <div class="head-container">
      <!-- <el-button type="primary" style="margin-left:6px" @click="openBatch">批量绘制</el-button> -->
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input
          v-model="query.name"
          clearable
          size="small"
          placeholder="输入设备名称"
          style="width: 200px;"
          class="filter-item"
          @keyup.enter.native="crud.toQuery"
        />
        <el-select
          v-model="query.personInChargeDepartmentId"
          clearable
          size="small"
          placeholder="责任部门"
          class="filter-item"
          style="width: 120px"
          @change="crud.toQuery"
        >
          <el-option
            v-for="item of optionsObj.Department"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation />
      </div>
      <crudOperation :permission="permission" />
    </div>
    <!-- 批量绘制 -->
    <!-- <batch-map title="批量绘制" width="1350px" ref="batchMap" :crudDraw="crud"></batch-map> -->
    <!-- 选择部门 -->
    <select-department title="选择部门" ref='selectDepartment' @getData="selectDept"/>
    <!-- 选择负责人 -->
    <select-user title="选择负责人" ref='selectUser' @getData="selectPersonInCharge" />
    <!-- 选择区域 -->
    <select-area title="选择区域" ref='selectArea' @getData="selectAreaD" />
    <!-- 选择负责人部门 -->
    <select-department title="选择负责人部门" ref='selectInDepartment' @getData="selectDepartmentInCharge"/>
    <!-- 选择重大危险源 -->
    <select-view title="选择重大危险源" ref='selectDangerOrigin' dataType="dangerOrigin"/>
    <!--表单渲染-->
    <el-dialog
      append-to-body
      :close-on-click-modal="false"
      :before-close="crud.cancelCU"
      :visible.sync="crudCU"
      :title="crud.status.title"
      width="1350px"
    >
    <!-- 布局1 -->
    <el-row>
      <el-col :span="13">
        <el-row>
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
          <el-col :span="12">
            <el-form-item label="设备编号" prop="code">
              <el-input v-model="form.code" size="small" class="filter-item" />
            </el-form-item>
            <el-form-item label="设备型号" prop="equipmentModel">
              <el-input v-model="form.equipmentModel" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="设备位号" prop="tagNumber">
              <el-input v-model="form.tagNumber" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="维修状态" prop="repairState">
              <el-select
                v-model="form.repairState"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="用途" prop="productionAbility">
              <el-input v-model="form.productionAbility" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="位置" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item" disabled />
            </el-form-item>
            <el-form-item label="负责人" prop="personInChargeName">
              <el-input v-model="form.personInChargeName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectUser">选择</el-button>
            </el-form-item>
            <el-form-item label="重大危险源单元" prop="personInChargeDepartmentId">
              <el-input v-model="form.personInChargeDepartmentId" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectDangerOrigin">选择</el-button>
            </el-form-item>
            <el-form-item label="装置位置" prop="deviceLocation">
              <el-input v-model="form.deviceLocation" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="投用日期" prop="putIntoUserDate">
              <el-date-picker
                v-model="form.putIntoUserDate"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width:204px"
                >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="到期日期" prop="scrapDate">
              <el-input v-model="form.scrapDate" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="检查周期" prop="inspectionDays">
              <el-input v-model="form.inspectionDays" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="生命周期" prop="lifecycle">
              <el-input v-model="form.lifecycle" size="small" class="filter-item"  />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="设备名称" prop="name">
              <el-input v-model="form.name" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="设备类型" prop="type">
              <el-select
                v-model="form.type"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="供应商" prop="supplier">
              <el-input v-model="form.supplier" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="责任部门" prop="departmentName">
              <el-input v-model="form.departmentName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectDepartment">选择</el-button>
            </el-form-item>
            <el-form-item label="停用状态" prop="state">
              <el-select
                v-model="form.state"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="所属区域" prop="areaName">
              <el-input v-model="form.areaName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectArea">选择</el-button>
            </el-form-item>
            <el-form-item label="负责人部门" prop="personInChargeDepartmentName">
              <el-input v-model="form.personInChargeDepartmentName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectInDepartment">选择</el-button>
            </el-form-item>
            <el-form-item label="重大危险源单元编号" prop="majorHazardUnitCode">
              <el-input v-model="form.majorHazardUnitCode" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="生产日期" prop="manufactureDate">
              <el-date-picker
                v-model="form.manufactureDate"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width:204px"
                >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="使用期限(月)" prop="serviceLifeMonths">
              <el-input v-model="form.serviceLifeMonths" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="保养周期(天)" prop="maintainPeriodDays">
              <el-input v-model="form.maintainPeriodDays" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="检测周期(天)" prop="detectDays">
              <el-input v-model="form.detectDays" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="是否安全装置" prop="safeStatus">
              <el-select
                v-model="form.safeStatus"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-form>
        </el-row>
        <el-row>
          业务记录
          <el-tabs tab-position="top">
            <el-tab-pane 
              v-for="(item,index) in tabPaneOptions"
              :key="index"
              :label="item.label"
            >
              <el-table
                v-loading="crud.loading"
              >
                <el-table-column
                  v-for="ite in tabPaneOptions[index].TableOptions"
                  :key="ite.prop"
                  :label="ite.label"
                  :prop="ite.prop"
                  :width="ite.width"
                  :align="ite.align"
                  :fixed="ite.fixed"
                  :sortable="ite.sortable"
                >
                </el-table-column>
              </el-table>
            </el-tab-pane>
          </el-tabs>
        </el-row>
      </el-col>
      <el-col :span="11">
        <div style="margin-left:10px">
          <visual-map 
            v-if="crudCU" 
            ref="visualMap" 
            v-model="mapData"
            :drawShow=true
            drawMode="Point"
            width="100%"/>
        </div>
      </el-col>
    </el-row>
    <!-- 布局2 -->
      <!-- <el-row :gutter="40">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
          <el-col :span="7">
            <el-form-item label="设备编号" prop="code">
              <el-input v-model="form.code" size="small" class="filter-item" />
            </el-form-item>
            <el-form-item label="设备型号" prop="name">
              <el-input v-model="form.name" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="设备位号" prop="name">
              <el-input v-model="form.name" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="维修状态" prop="name">
              <el-select
                v-model="form.name"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="用途" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="位置" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="负责人" prop="personInChargeName">
              <el-input v-model="form.personInChargeName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectUser">选择</el-button>
            </el-form-item>
            <el-form-item label="重大危险源单元" prop="personInChargeDepartmentId">
              <el-input v-model="form.personInChargeDepartmentId" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectDangerOrigin">选择</el-button>
            </el-form-item>
            <el-form-item label="装置位置" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="投用日期" prop="location">
              <el-date-picker
                v-model="form.dateTime"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width:204px"
                >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="到期日期" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="检查周期" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="生命周期" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="设备名称" prop="name">
              <el-input v-model="form.name" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="设备类型" prop="code">
              <el-select
                v-model="form.name"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="供应商" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="责任部门" prop="departmentName">
              <el-input v-model="form.departmentName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectDepartment">选择</el-button>
            </el-form-item>
            <el-form-item label="停用状态" prop="location">
              <el-select
                v-model="form.name"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="所属区域" prop="areaName">
              <el-input v-model="form.areaName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectArea">选择</el-button>
            </el-form-item>
            <el-form-item label="负责人部门" prop="personInChargeDepartmentName">
              <el-input v-model="form.personInChargeDepartmentName" disabled style="width:140px"/>
              <el-button type="primary" style="margin-left:6px" @click="openSelectInDepartment">选择</el-button>
            </el-form-item>
            <el-form-item label="重大危险源单元编号" prop="name">
              <el-input v-model="form.name" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="生产日期" prop="code">
              <el-date-picker
                v-model="form.dateTime"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width:204px"
                >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="使用期限(月)" prop="location">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="保养周期(天)" prop="personInChargeDepartmentId">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="检测周期(天)" prop="personInChargeDepartmentId">
              <el-input v-model="form.location" size="small" class="filter-item"  />
            </el-form-item>
            <el-form-item label="是否安全装置" prop="location">
              <el-select
                v-model="form.name"
                clearable
                size="small"
                placeholder=""
                class="filter-item"
              >
                <el-option
                  v-for="item of statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-form>
        <el-col :span="10">
          <visual-map 
            v-if="crudCU" 
            ref="visualMap" 
            v-model="mapData"
            :drawShow=true
            drawMode="Point"  />
        </el-col>
      </el-row>
      <el-row>
        业务记录
        <el-tabs tab-position="top">
          <el-tab-pane 
             v-for="(item,index) in tabPaneOptions"
            :key="index"
            :label="item.label"
          >
            <el-table
              v-loading="crud.loading"
            >
              <el-table-column
                v-for="ite in tabPaneOptions[index].TableOptions"
                :key="ite.prop"
                :label="ite.label"
                :prop="ite.prop"
                :width="ite.width"
                :align="ite.align"
                :fixed="ite.fixed"
                :sortable="ite.sortable"
              >
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-row> -->
      <div slot="footer" class="dialog-footer">
        <el-button type="text" @click="crud.cancelCU">取消</el-button>
        <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
      </div>
    </el-dialog>
    <el-table
      ref="table"
      v-loading="crud.loading"
      :data="crud.data"
      style="width: 100%;"
      @selection-change="crud.selectionChangeHandler"
    >
      <el-table-column :selectable="checkboxT" type="selection" width="55" align="center" />
      <el-table-column
        v-for="item in deviceManageTableOptions"
        :key="item.prop"
        :label="item.label"
        :prop="item.prop"
        :width="item.width"
        :align="item.align"
        :fixed="item.fixed"
        :sortable="item.sortable"/>
      <el-table-column
        v-if="checkPer(['admin', 'deviceManage:edit', 'deviceManage:del'])"
        label="操作"
        width="230"
        align="center"
        fixed="right"
      >
        <template slot-scope="scope">
          <div style="display:flex">
            <udOperation :data="scope.row" :permission="permission" />
            <el-button type="text" size="mini" @click="handleMethod" style="margin-left:10px">保养</el-button>
            <el-button type="text" size="mini" @click="handleMethod">维修</el-button>
            <el-tooltip :disabled="disabled" placement="bottom" effect="light">
             <div slot="content">
              <el-button type='text' size='mini' @click='handleMethod'>检查</el-button>
              <el-button type='text' size='mini' @click='handleMethod'>检测</el-button>
              <el-button type='text' size='mini' @click='handleMethod'>停用</el-button>
              <el-button type='text' size='mini' @click='handleMethod'>恢复</el-button>
              <el-button type='text' size='mini' @click='handleMethod'>报废</el-button>
             </div>
              <el-button type="text" size="mini" @click="handleMethod">更多</el-button>
            </el-tooltip>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!--分页组件-->
    <pagination />
  </div>
</template>

<script>
import permission from '@/directive/permission'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
// import { crudOperation, rrOperation, udOperation, pagination } from '@crud'
import crudComps from '@crud'
import { getOptions } from '@/api/system/public'
import DateRangePicker from '@/components/DateRangePicker'
import crudElement from '@/api/visual/element'
import { deviceManageTableOptions } from '../tableConfig'
import BatchMap from '@/views/common/batchMap'
import SelectUser from '@/views/common/selectUser'
import SelectArea from '@/views/common/selectArea'
import SelectDepartment from '@/views/common/selectDepartment'
import SelectView from '@/views/common/selectView'
import VisualMap from '@/components/RelativeMap'
import { initData } from '@/api/data'
import { 
  monitoringPointTableOptions,
  checkRecordTableOptions,
  detectRecordTableOptions,
  maintainRecordTableOptions,
  repairRecordTableOptions,
  stopRecordTableOptions,
  patrolRecordTableOptions,
  attachmentDescTableOptions } from "./tableConfig";
const defaultForm = {
  id:'',//主键id
  name: '',//装置名称
  code: '',//装置编号
  equipmentModel:'',//设备型号
  type:'',//装置类型
  location:'',//
  areaId:'',
  areaName:'',
  personInChargeDepartmentId: '',
  personInChargeDepartmentName: '',
  personInChargeId: '',
  personInChargeName: '',
  layerID: '',
  desc:'',
  dateTime:'',
  points:[],
  tagNumber:'',	//设备装置位号
  supplier:'',//供应商
  keyEquipment:'',//是否关键装置
  departmentId: '',
  departmentName: '',//所属部门
  functions:'',//	装置功能
  state:'',//	装置状态
  productionAbility:'',//	装置生产能力
  technicalCondition:'',//	装置技术条件
  majorHazardId:'',//	所属重大危险源单元id
  Craft_id:'',// 	所属危险化工工艺
  major_hazard_unit:'',//	所属重大危险源单元
  majorHazardUnitCode:'',//	所属重大危险源单元编号
  automatic_control_method:'',//	自动控制方法
  repairState:'',//	维修状态
  maintain_state:'',//	保养状态：1完好；2保养中
  deviceLocation:'',//	所在部位
  risk_district_id:'',//	所属区域
  person_in_charge_id:'',//	负责人
  pic_depart_id:'',//	负责人部门
  manufactureDate:'',//生产日期
  putIntoUserDate:'',//投用日期
  serviceLifeMonths:'',//	使用期限 月
  maintainPeriodDays:'',//	保养周期 天
  remind_ahead_days:'',//	提前提醒 天
  lifecycle:'',//生命周期
  scrapDate:'',//到期日期
  scrap_register_user_id:'',//	登记人
  scrap_register_time:'',//
  scrap_attachment_id:'',//	附件
  scrap_description:'',//
  ref_id:'',//	外部接口关联ID
  ref_url:'',//	外部关联URL
  validity_date:'',//
  safeStatus:'',//	是否安全装置
  repair_amount:'',//
  maintenance_amount:'',//
  inspectionDays:'',//	检查周期
  detectDays:'',//	监测周期
}
export default {
  name: 'deviceManage',
  directives: { permission },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  components: {
    ...crudComps,
    DateRangePicker,
    VisualMap,
    SelectUser,
    SelectArea,
    SelectDepartment,
    SelectView,
    BatchMap,
  },
  cruds() {
    return CRUD({
      title: '设备',
      url: 'system/person/getPageListJson',
      crudMethod: { ...crudElement },
      optShow: { add: true, edit: true, del: true, reset: true, import: true, export: true, draw:true },
    })
  },
  data() {
    return {
      mapData:[],
      permission: {
        add: ['admin', 'deviceManage:add'],
        edit: ['admin', 'deviceManage:edit'],
        del: ['admin', 'deviceManage:del']
      },
      deviceManageTableOptions,
      monitoringPointTableOptions,
      checkRecordTableOptions,
      detectRecordTableOptions,
      maintainRecordTableOptions,
      repairRecordTableOptions,
      stopRecordTableOptions,
      patrolRecordTableOptions,
      attachmentDescTableOptions,
      rules: {
        name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
        code: [{ required: true, message: '请输入设备编号', trigger: 'blur' }],
      },
      shapeOptions: [
        // { label: '图片', value: 0, shapeType: 'image', mode: 'Point', max: 1, min: 1 },
        { label: '点', value: 2, shapeType: 'point', mode: 'Point', max: 1, min: 1 },
        // { label: '线', value: 3, shapeType: 'line', mode: 'LineString', max: 999, min: 2 },
        // // { label: '三角形', value: 4, shapeType: 'triangle', mode: 'Polygon', max: 3, min: 3 },
        // { label: '矩形', value: 5, shapeType: 'rectangle', mode: 'Rectangle', max: 4, min: 4 },
        // // { label: '正方形', value: 6, shapeType: 'square', mode: 'Rectangle', max: 4, min: 4 },
        // { label: '圆形', value: 7, shapeType: 'round', mode: 'Circle', max: 1, min: 1 },
        // { label: '多边形', value: 8, shapeType: 'polygon', mode: 'Polygon', max: 999, min: 3 }
      ],
      drawToolOption: [
        'Point',
        // 'LineString',
        // 'Polygon',
        // 'Circle',
        // 'Ellipse',
        // 'Rectangle',
        // 'FreeHandLineString',
        // 'FreeHandPolygon'
      ],
      disabled:false,
      selectUser:false,
      selectDepartment:false,
      selectArea:false,
      iconOptions: [],
      optionsObj: {
        Area: [],
        Person: [],
        Department: [
          {label:"11",value:"1"},
          {label:"21",value:"2"},],
      },
      statusList:[
        {label:"11",value:"1"},
        {label:"21",value:"2"},
        {label:"31",value:"3"},
        {label:"41",value:"4"},
      ],
      tabPaneOptions:[
        {label:"关联监测点",TableOptions:monitoringPointTableOptions},
        {label:"检查记录",TableOptions:checkRecordTableOptions},
        {label:"检测记录",TableOptions:detectRecordTableOptions},
        {label:"保养记录",TableOptions:maintainRecordTableOptions},
        {label:"维修记录",TableOptions:repairRecordTableOptions},
        {label:"停用记录",TableOptions:stopRecordTableOptions},
        {label:"巡检记录",TableOptions:patrolRecordTableOptions},
        {label:"附件说明",TableOptions:attachmentDescTableOptions},
      ],
    }
  },
  computed: {
    crudCU() {
      return this.crud.status.cu > 0
    },
    VUE_APP_BASE_API() {
      return process.env.VUE_APP_BASE_API
    }
  },
  created() {
    // this.getIcons()
  },
  watch:{
    mapData(newValue, oldValue) {
      this.form.points = this.mapData[0].geometries[0]
      this.form.location = JSON.stringify(this.form.points)
    },
  },
  methods: {
    // 新增与编辑前做的操作
    [CRUD.HOOK.beforeToAdd](crud, form) {
      if (!crud.query.layerID) {
        this.$message.warning('请先选择类型！')
        return false
      } else {
        form.layerID = crud.query.layerID
      }
    },
    [CRUD.HOOK.beforeToEdit]() {
      this.mapData = [
        {
          buildId: this.form.buildId,
          floorNo: this.form.floorNo,
          geometries: [
            {
              type: 'Point',
              points: this.form.location,
            },
          ],
        },
      ]
      // console.log(this.form)
    },
    // 提交前做的操作
    [CRUD.HOOK.afterValidateCU](crud) {
      
    },
    checkboxT(row, rowIndex) {
      return true
      // return row.id !== this.userInfo.id
    },
    // async getIcons() {
    //   try {
    //     const res = await initData('system/icon/getListJson')
    //     this.iconOptions = res.data.content
    //   } catch (err) {
    //     console.log(err)
    //   }
    // },
    getOptions() {
      Object.keys(this.optionsObj).forEach(async (key) => {
        try {
          let res = await getOptions(key)
          if (res.code === 20000) this.optionsObj[key] = res.data.content
        } catch (error) {
          console.log(error)
        }
      })
    },
    openSelectUser(){
      this.$refs.selectUser.openOrClose = true
    },
    openSelectArea(){
      this.$refs.selectArea.openOrClose = true
    },
    openSelectDepartment(){
      this.$refs.selectDepartment.openOrClose = true
    },
    openSelectInDepartment(){
      this.$refs.selectInDepartment.openOrClose = true
    },
    openSelectDangerOrigin(){
      this.$refs.selectDangerOrigin.openOrClose = true
    },
    openBatch(){
      this.$refs.batchMap.openOrClose = true
    },
    selectPersonInCharge(list){
      console.log(list)
      this.form.personInChargeId = list[0].id
      this.form.personInChargeName = list[0].name
    },
    selectDept(list){
      console.log(list)
      this.form.departmentId = list[0].id
      this.form.departmentName= list[0].departmentName
    },
    selectDangerOrigin(list){
      console.log(list)
      this.form.id = list[0].id
      this.form.name = list[0].name
    },
    selectAreaD(list){
      console.log(list)
      this.form.areaId = list[0].id
      this.form.areaName = list[0].areaName
    },
    selectDepartmentInCharge(list){
      console.log(list)
      this.form.personInChargeDepartmentId = list[0].id
      this.form.personInChargeDepartmentName = list[0].departmentName
    },
    handleMethod(){},
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .vue-treeselect__control,
::v-deep .vue-treeselect__placeholder,
::v-deep .vue-treeselect__single-value {
  height: 30px;
  line-height: 30px;
}
</style>
