<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="100px"
    >
      <el-form-item label="单位名称" prop="orgName">
        <el-input
          v-model="queryParams.orgName"
          placeholder="请输入单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!-- <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
          <el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label"
            :value="parseInt(dict.value)" />
        </el-select>
      </el-form-item> -->
      <el-form-item label="单位地址" prop="dwdz">
        <el-input
          v-model="queryParams.dwdz"
          placeholder="请输入单位地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="监管单位类别" prop="dwlx">
        <el-select
          v-model="queryParams.dwlx"
          placeholder="请选择监管单位类别"
          style="width: 100%"
        >
          <el-option
            v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_ORG_TYPE)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="单位类型" prop="dwxz">
        <el-select v-model="queryParams.dwxz" placeholder="请选择单位类型" style="width: 100%">
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_ORG_TYPE)" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <el-form-item label="行政区域" prop="xzqy">
        <el-input
          v-model="queryParams.xzqy"
          placeholder="请输入行政区域"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="负责人" prop="orgCharge">
        <el-input
          v-model="queryParams.orgCharge"
          placeholder="请输入负责人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="负责人电话" prop="frdbdh">
        <el-input
          v-model="queryParams.frdbdh"
          placeholder="请输入负责人电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位电话" prop="dwdh">
        <el-input
          v-model="queryParams.dwdh"
          placeholder="请输入单位电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!-- <el-form-item label="上级消防管辖单位" prop="sjxfgxdw">
        <treeselect v-model="queryParams.sjxfgxdw" :options="deptOptions" :show-count="true" :clearable="false"
          placeholder="请选择上级消防管辖单位" :normalizer="normalizer" />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['backend:org:create']">新增</el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          :loading="exportLoading"
          v-hasPermi="['backend:org:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          @click="handleInit"
          :loading="exportLoading"
          >单位信息初始化</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <!-- 列表 -->
    <el-table
      highlight-current-row
      v-loading="loading"
      :data="list"
      @row-click="tableRowClick"
      :height="tableHeight"
      style="width: 100%; overflow: auto"
    >
      <!-- <el-table-column type="expand">
        <template slot-scope="props">
          <el-form ref="form" label-width="180px" label-position="left">
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="单位名称:" prop="orgName">
                  <strong>{{ props.row.orgName }}</strong>
                </el-form-item></el-col>
              <el-col :span="6">
                <el-form-item label="单位地址:" prop="dwdz">
                  <strong>{{ props.row.dwdz }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位拼音简称:" prop="dwpyjc">
                  <strong>{{ props.row.dwpyjc }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="监管单位类别:" prop="dwlx">
                  <strong>
                    <dict-tag :type="DICT_TYPE.BACKEND_EMP_DWLX" :value="props.row.dwlx" /></strong>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="经济所有制:" prop="jjsyz">
                  <strong>{{ props.row.jjsyz }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位成立时间:" prop="dwclsj">
                  <strong>{{ parseTime(props.row.dwclsj) }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位等级:" prop="dwdj">
                  <strong>
                    <dict-tag :type="DICT_TYPE.DICT_IMPORTTANT_ORG_LEVEL" :value="props.row.dwdj" />
                  </strong>
                </el-form-item>
              </el-col>
              <el-col :span="6"><el-form-item label="单位类型:" prop="dwxz">
                  <strong>
                    <dict-tag :type="DICT_TYPE.BACKEND_ORG_TYPE" :value="props.row.dwxz" /></strong>
                </el-form-item></el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6"><el-form-item label="其他情况:" prop="qtqk">
                  <strong>{{ props.row.qtqk }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="行政区域:" prop="xzqy">
                  <strong>{{ props.row.xzqy }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="组织结构代码:" prop="zzjgdm">
                  <strong>{{ props.row.zzjgdm }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="负责人:" prop="orgCharge">
                  <strong>{{ props.row.orgCharge }}</strong>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="负责人身份证:" prop="frdbsfz">
                  <strong>{{ props.row.frdbsfz }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="负责人电话:" prop="frdbdh">
                  <strong>{{ props.row.frdbdh }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="消防安全负责人:" prop="aqzrr">
                  <strong>{{ props.row.aqzrr }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="消防安全负责人身份证:" prop="aqzrrsfz">
                  <strong>{{ props.row.aqzrrsfz }}</strong>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="消防安全负责人电话:" prop="aqzrrdh">
                  <strong>{{ props.row.aqzrrdh }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位电子邮箱:" prop="dwdzyx">
                  <strong>{{ props.row.dwdzyx }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="消防安全管理人:" prop="aqglr">
                  <strong>{{ props.row.aqglr }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="消防安全管理人身份证:" prop="aqglrsfz">
                  <strong>{{ props.row.aqglrsfz }}</strong>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="消防安全管理人电话:" prop="aqglrdh">
                  <strong>{{ props.row.aqglrdh }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="专兼职消防管理人:" prop="zjzxfglr">
                  <strong>{{ props.row.zjzxfglr }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="专兼职消防管理人身份证:" prop="zjzxfglrsfz">
                  <strong>{{ props.row.zjzxfglrsfz }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="专兼职消防管理人电话:" prop="zjzxfglrdh">
                  <strong>{{ props.row.zjzxfglrdh }}</strong>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="单位电话:" prop="dwdh">
                  <strong>{{ props.row.dwdh }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位传真:" prop="dwcz">
                  <strong>{{ props.row.dwcz }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="单位邮政编码:" prop="yzbm">
                  <strong>{{ props.row.yzbm }}</strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="上级消防管辖单位:" prop="sjxfgxdw">
                  <strong>{{ deptOptionsTrans(props.row.sjxfgxdw) }}</strong>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="确认重点单位时间:" prop="qrsj">
                  <strong>{{ parseTime(props.row.qrsj) }} </strong>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="取消重点单位时间:" prop="qxsj">
                  <strong>{{ parseTime(props.row.qxsj) }} </strong>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </template>
      </el-table-column> -->
      <el-table-column label="ID" align="center" prop="id" width="80" />
      <el-table-column
        label="单位名称"
        align="center"
        prop="orgName"
        width="200"
      >
        <template v-slot="scope">
          <span style="color: forestgreen" @click="opentabs = true">{{
            scope.row.orgName
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="单位地址"
        align="center"
        prop="dwdz"
        width="260"
      />
      <!-- <el-table-column label="单位拼音简称" align="center" prop="dwpyjc" /> -->
      <el-table-column
        label="监管单位类别"
        align="center"
        prop="dwlx"
        width="100"
      >
        <template v-slot="scope">
          <dict-tag
            :type="DICT_TYPE.BACKEND_ORG_TYPE"
            :value="scope.row.dwlx"
          />
        </template>
      </el-table-column>
      <!-- <el-table-column label="经济所有制" align="center" prop="jjsyz" /> -->
      <!-- <el-table-column label="单位成立时间" align="center" prop="dwclsj" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.dwclsj) }}</span>
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="单位等级" align="center" prop="dwdj" /> -->
      <el-table-column label="单位类型" align="center" prop="dwxz">
        <template v-slot="scope">
          <dict-tag
            :type="DICT_TYPE.BACKEND_ORG_TYPE"
            :value="scope.row.dwxz"
          />
        </template>
      </el-table-column>
      <!-- <el-table-column label="其他情况" align="center" prop="qtqk" /> -->
      <el-table-column
        label="行政区域"
        align="center"
        prop="xzqy"
        width="80px"
      />
      <!-- <el-table-column label="组织结构代码" align="center" prop="zzjgdm" /> -->
      <el-table-column label="负责人" align="center" prop="orgCharge" />
      <!-- <el-table-column label="负责人身份证" align="center" prop="frdbsfz" /> -->
      <el-table-column
        label="负责人电话"
        align="center"
        prop="frdbdh"
        width="120px"
      />
      <!-- <el-table-column label="消防安全负责人" align="center" prop="aqzrr" /> -->
      <!-- <el-table-column label="消防安全负责人身份证" align="center" prop="aqzrrsfz" /> -->
      <!-- <el-table-column label="消防安全负责人电话" align="center" prop="aqzrrdh" /> -->
      <!-- <el-table-column label="单位电子邮箱" align="center" prop="dwdzyx" /> -->
      <!-- <el-table-column label="消防安全管理人" align="center" prop="aqglr" /> -->
      <!-- <el-table-column label="消防安全管理人身份证" align="center" prop="aqglrsfz" /> -->
      <!-- <el-table-column label="消防安全管理人电话" align="center" prop="aqglrdh" /> -->
      <!-- <el-table-column label="专兼职消防管理人" align="center" prop="zjzxfglr" /> -->
      <!-- <el-table-column label="专兼职消防管理人身份证" align="center" prop="zjzxfglrsfz" /> -->
      <!-- <el-table-column label="专兼职消防管理人电话" align="center" prop="zjzxfglrdh" /> -->
      <el-table-column
        label="单位电话"
        align="center"
        prop="dwdh"
        width="120px"
      />
      <!-- <el-table-column label="单位传真" align="center" prop="dwcz" /> -->
      <!-- <el-table-column label="单位邮政编码" align="center" prop="yzbm" /> -->
      <el-table-column
        label="上级消防管辖单位"
        align="center"
        prop="sjxfgxdw"
        width="130px"
      >
        <template v-slot="scope">
          <span>{{ deptOptionsTrans(scope.row.sjxfgxdw) }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="确认重点单位时间" align="center" prop="qrsj" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.qrsj) }}</span>
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="取消重点单位时间" align="center" prop="qxsj" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.qxsj) }}</span>
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="状态" align="center" prop="status">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="260">
        <template v-slot="scope">
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleSee(scope.row)">查看</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['backend:org:update']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['backend:org:delete']">删除</el-button>
          <el-button size="mini" type="text" icon="el-icon-download" @click="handleExportMsg(scope.row)"
            v-hasPermi="['backend:org:delete']">导出</el-button>
        </template>
      </el-table-column> -->
      <el-table-column
        label="操作"
        align="center"
        width="160"
        class-name="small-padding fixed-width"
      >
        <template v-slot="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleSee(scope.row)"
            >查看</el-button
          >
          <el-dropdown
            @command="
              (command) => handleCommand(command, scope.$index, scope.row)
            "
            v-hasPermi="['backend:org:update', 'backend:org:delete']"
          >
            <el-button size="mini" type="text" icon="el-icon-d-arrow-right"
              >更多</el-button
            >
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                command="handleUpdate"
                size="mini"
                type="text"
                icon="el-icon-edit"
                v-hasPermi="['backend:org:update']"
                >修改</el-dropdown-item
              >
              <el-dropdown-item
                command="handleDelete"
                size="mini"
                type="text"
                icon="el-icon-delete"
                v-hasPermi="['backend:org:delete']"
                >删除</el-dropdown-item
              >
              <el-dropdown-item
                command="handleExportMsg"
                size="mini"
                type="text"
                icon="el-icon-download"
                v-hasPermi="['backend:org:delete']"
                >导出二维码</el-dropdown-item
              >
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 对话框(添加 / 修改) -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="80%"
      v-dialogDrag
      append-to-body
      class="details"
    >
      <el-form
        ref="form"
        :model="form"
        label-width="auto"
        label-position="left"
        :rules="rules"
        style="min-width: 900px"
      >
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="单位名称" prop="orgName" required>
              <el-input
                v-model="form.orgName"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="上级消防管辖单位" prop="sjxfgxdw" required>
              <treeselect
                v-model="form.sjxfgxdw"
                :options="deptOptions"
                :show-count="true"
                :clearable="false"
                placeholder="请选择"
                :normalizer="normalizer"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="单位地址" prop="dwdz">
              <el-input
                v-model="form.dwdz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>

          <el-col :span="12">
            <el-form-item label="监管单位类别" prop="dwlx">
              <el-select
                v-model="form.dwlx"
                placeholder="请选择"
                clearable
                size="small"
                style="width: 100%"
              >
                <!-- <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_EMP_DWLX)" :key="dict.value"
                  :label="dict.label" :value="dict.value" /> -->
                <el-option
                  v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_ORG_TYPE)"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="行政区域" prop="xzqy">
              <el-input v-model="form.xzqy" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="负责人" prop="orgCharge">
              <el-input
                v-model="form.orgCharge"
                placeholder="请输入"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="负责人电话" prop="frdbdh">
              <el-input v-model="form.frdbdh" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="单位电话" prop="dwdh">
              <el-input v-model="form.dwdh" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10"
            ><el-form-item label="负责人身份证" prop="frdbsfz">
              <el-input
                v-model="form.frdbsfz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="单位邮政编码" prop="yzbm">
              <el-input
                v-model="form.yzbm"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <!--  <el-form-item label="单位等级" prop="dwdj">
              <el-select v-model="form.dwdj" placeholder="请选择" clearable size="small" style="width: 100%">
                <el-option v-for="dict in this.getDictDatas(
                  DICT_TYPE.DICT_IMPORTTANT_ORG_LEVEL
                )" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select> </el-form-item></el-col> -->
        </el-row>

        <!-- 
           <el-col :span="10"><el-form-item label="负责人身份证" prop="frdbsfz">
            <el-input v-model="form.frdbsfz" placeholder="请输入" clearable /> </el-form-item></el-col>
        <el-col :span="12">
          <el-form-item label="负责人电话" prop="frdbdh">
            <el-input v-model="form.frdbdh" placeholder="请输入" clearable /> </el-form-item></el-col> -->
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全负责人" prop="aqzrr">
              <el-input
                v-model="form.aqzrr"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="消防安全负责人身份证" prop="aqzrrsfz">
              <el-input
                v-model="form.aqzrrsfz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全管理人" prop="aqglr">
              <el-input
                v-model="form.aqglr"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="消防安全管理人身份证" prop="aqglrsfz">
              <el-input
                v-model="form.aqglrsfz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全负责人电话" prop="aqzrrdh">
              <el-input
                v-model="form.aqzrrdh"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="单位电子邮箱" prop="dwdzyx">
              <el-input
                v-model="form.dwdzyx"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="专兼职消防管理人身份证" prop="zjzxfglrsfz">
              <el-input
                v-model="form.zjzxfglrsfz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="专兼职消防管理人电话" prop="zjzxfglrdh">
              <el-input
                v-model="form.zjzxfglrdh"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
        </el-row>

        <!-- <el-row :gutter="20">
          <el-col :span="10"
            ><el-form-item label="组织结构代码" prop="zzjgdm">
              <el-input
                v-model="form.zzjgdm"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
         
        </el-row> -->
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="单位类型" prop="dwxz">
              <el-select
                v-model="form.dwxz"
                placeholder="请选择"
                clearable
                size="small"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in this.getDictDatas(DICT_TYPE.BACKEND_ORG_TYPE)"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="经济所有制" prop="jjsyz">
              <el-input
                v-model="form.jjsyz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="其他情况" prop="qtqk">
              <el-input v-model="form.qtqk" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="单位传真" prop="dwcz">
              <el-input
                v-model="form.dwcz"
                placeholder="请输入"
                clearable
              /> </el-form-item
          ></el-col>
        </el-row>
        <!-- <el-row :gutter="20">
          <el-col :span="10">
           
              <el-col :span="12">
            <el-form-item label="单位拼音简称" prop="dwpyjc">
              <el-input v-model="form.dwpyjc" placeholder="请输入" clearable /> </el-form-item></el-col>
        </el-row> -->
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="确认重点单位时间" prop="qrsj">
              <el-date-picker
                clearable
                v-model="form.qrsj"
                type="date"
                value-format="timestamp"
                placeholder="请选择"
                style="width: 100%"
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="取消重点单位时间" prop="qxsj">
              <el-date-picker
                clearable
                v-model="form.qxsj"
                type="date"
                value-format="timestamp"
                placeholder="请选择"
                style="width: 100%"
              /> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <!-- <el-col :span="10">
            <el-form-item label="单位序号" prop="dwid">
              <el-input
                v-model="form.dwid"
                placeholder="请输入"
                clearable /></el-form-item
          ></el-col> -->
          <el-col :span="10"
            ><el-form-item label="单位成立时间" prop="dwclsj">
              <el-date-picker
                clearable
                v-model="form.dwclsj"
                type="datetime"
                value-format="timestamp"
                placeholder="请选择"
                style="width: 100%"
              /> </el-form-item
          ></el-col>
          <el-col :span="12">
            <el-form-item label="单位排序" prop="roleSort">
              <el-input
                v-model="form.sort"
                placeholder="请输入"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <!-- <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="状态" prop="status">
              <el-radio-group v-model="form.status" style="width: 100%;">
                <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="dict.value"
                  :label="parseInt(dict.value)">{{ dict.label }}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12"></el-col>
        </el-row> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- tabs -->
    <el-dialog
      :visible.sync="opentabs"
      width="85vw"
      append-to-body
      v-if="opentabs"
    >
      <el-tabs
        type="border-card"
        v-model.trim="selectedTab"
        @tab-click="clickTab"
      >
        <el-tab-pane label="单位建筑信息 " name="buildingInfo">
          <buildingInfo :orgId="orgId"></buildingInfo>
        </el-tab-pane>
        <el-tab-pane label="单位人员管理 " name="emp">
          <emp :sjjg="orgId"></emp>
        </el-tab-pane>
        <el-tab-pane label="单位设施管理" name="fpd">
          <fpd :orgId="orgId"></fpd>
        </el-tab-pane>
        <!-- <el-tab-pane label="隐患管理" name="hiddenDanger">
                <hiddenDanger :orgId="orgId"></hiddenDanger>
              </el-tab-pane> -->
        <el-tab-pane label="微型消防站管理" name="microStation">
          <microStation :orgId="orgId"></microStation>
        </el-tab-pane>
        <el-tab-pane label="培训演练" name="orgDrill">
          <orgDrill :orgId="orgId"></orgDrill>
        </el-tab-pane>
        <el-tab-pane label="维保报告" name="orgReport">
          <orgReport :orgId="orgId"></orgReport>
        </el-tab-pane>
        <!-- <el-tab-pane label="主动检查" name="inspectHis1">
          <inspectHis :orgId="orgId" :taskType="inspectHis1"></inspectHis>
        </el-tab-pane>
        <el-tab-pane label="主动巡查" name="inspectHis2">
          <inspectHis :orgId="orgId" :taskType="inspectHis2"></inspectHis>
        </el-tab-pane>
        <el-tab-pane label="每日检查" name="inspectHis3">
          <inspectHis :orgId="orgId" :taskType="inspectHis3"></inspectHis>
        </el-tab-pane> -->
      </el-tabs>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="opentabs = false">关 闭</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="详细信息查看"
      :visible.sync="openSeedialog"
      width="85vw"
      class="detail detail-style"
    >
      <el-form
        ref="form"
        :model="form"
        label-width="auto"
        label-position="left"
      >
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="单位名称:" prop="orgName">
              <div>{{ form.orgName }}</div>
            </el-form-item></el-col
          >
          <el-col :span="14">
            <el-form-item label="单位地址:" prop="dwdz">
              <div>{{ form.dwdz }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <!-- <el-form-item label="单位拼音简称:" prop="dwpyjc">
              <div>{{ form.dwpyjc }}</div>
            </el-form-item> -->
            <el-form-item label="上级消防管辖单位:" prop="sjxfgxdw">
              <div>{{ deptOptionsTrans(form.sjxfgxdw) }}</div>
            </el-form-item>
          </el-col>

          <el-col :span="14">
            <el-form-item label="监管单位类别:" prop="dwlx">
              <div>
                <dict-tag
                  :type="DICT_TYPE.BACKEND_EMP_DWLX"
                  :value="form.dwlx"
                />
              </div>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="经济所有制:" prop="jjsyz">
              <div>{{ form.jjsyz }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="单位成立时间:" prop="dwclsj">
              <div>{{ parseTime(form.dwclsj) }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <!-- <el-form-item label="单位等级:" prop="dwdj">
              <div>
                <dict-tag
                  :type="DICT_TYPE.DICT_IMPORTTANT_ORG_LEVEL"
                  :value="form.dwdj"
                />
              </div>
            </el-form-item> -->
            <el-form-item label="负责人:" prop="orgCharge">
              <div>{{ form.orgCharge }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14"
            ><el-form-item label="单位类型:" prop="dwxz">
              <div>
                <dict-tag
                  :type="DICT_TYPE.BACKEND_ORG_TYPE"
                  :value="form.dwxz"
                />
              </div> </el-form-item
          ></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10"
            ><el-form-item label="其他情况:" prop="qtqk">
              <div>{{ form.qtqk }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="行政区域:" prop="xzqy">
              <div>{{ form.xzqy }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- <el-row :gutter="20">
          <el-col :span="10">
             <el-form-item label="组织结构代码:" prop="zzjgdm">
              <div>{{ form.zzjgdm }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="负责人:" prop="orgCharge">
              <div>{{ form.orgCharge }}</div>
            </el-form-item>
          </el-col>
        </el-row> -->
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="负责人身份证:" prop="frdbsfz">
              <div>{{ form.frdbsfz }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="负责人电话:" prop="frdbdh">
              <div>{{ form.frdbdh }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全负责人:" prop="aqzrr">
              <div>{{ form.aqzrr }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="消防安全负责人身份证:" prop="aqzrrsfz">
              <div>{{ form.aqzrrsfz }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全负责人电话:" prop="aqzrrdh">
              <div>{{ form.aqzrrdh }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="单位电子邮箱:" prop="dwdzyx">
              <div>{{ form.dwdzyx }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全管理人:" prop="aqglr">
              <div>{{ form.aqglr }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="消防安全管理人身份证:" prop="aqglrsfz">
              <div>{{ form.aqglrsfz }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="消防安全管理人电话:" prop="aqglrdh">
              <div>{{ form.aqglrdh }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="专兼职消防管理人:" prop="zjzxfglr">
              <div>{{ form.zjzxfglr }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="专兼职消防管理人身份证:" prop="zjzxfglrsfz">
              <div>{{ form.zjzxfglrsfz }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="专兼职消防管理人电话:" prop="zjzxfglrdh">
              <div>{{ form.zjzxfglrdh }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="单位电话:" prop="dwdh">
              <div>{{ form.dwdh }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="单位传真:" prop="dwcz">
              <div>{{ form.dwcz }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="确认重点单位时间:" prop="qrsj">
              <div>{{ parseTime(form.qrsj) }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <el-form-item label="取消重点单位时间:" prop="qxsj">
              <div>{{ parseTime(form.qxsj) }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
            <el-form-item label="单位邮政编码:" prop="yzbm">
              <div>{{ form.yzbm }}</div>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="14">
            <el-form-item label="上级消防管辖单位:" prop="sjxfgxdw">
              <div>{{ deptOptionsTrans(form.sjxfgxdw) }}</div>
            </el-form-item>
          </el-col> -->
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="openSeedialog = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
import { listSimpleDepts } from "@/api/system/dept";
import {
  createOrg,
  updateOrg,
  deleteOrg,
  getOrg,
  getOrgPage,
  exportOrgExcel,
  exportOrgCode,
} from "@/api/backend/org";
import dept from "@/views/system/dept/index";
import emp from "@/views/unitorg/emp/index";
import fpd from "@/views/unitorg/fpd/index";
import buildingInfo from "@/views/unitorg/buildingInfo/index";
import hiddenDanger from "@/views/backend/hiddenDanger/index";
import microStation from "@/views/unitorg/microStation/index";
import inspectHis from "@/views/backend/inspectHis/index";
import orgDrill from "@/views/backend/orgDrill/index";
import orgReport from "@/views/backend/orgReport/index";
import { getTableHeight } from "@/utils/ruoyi.js";

import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "Org",
  components: {
    Treeselect,
    dept,
    emp,
    buildingInfo,
    fpd,
    hiddenDanger,
    microStation,
    inspectHis,
    orgDrill,
    orgReport,
  },
  data() {
    return {
      // 格式化部门的下拉框
      normalizer(node) {
        return {
          id: node.id,
          label: node.name,
          children: node.children,
        };
      },
      deptOptionsList: {},
      // 部门树选项
      deptOptions: undefined,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 单位信息管理列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        orgName: null,
        dwdz: null,
        dwlx: null,
        dwxz: null,
        xzqy: null,
        orgCharge: null,
        frdbdh: null,
        dwdh: null,
        sjxfgxdw: null,
        status: null,
        userId: this.$store.state.user.id,
      },
      // 表单参数
      form: {
        status: 0,
      },
      // 表单校验
      rules: {
        status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
        orgName: [
          { required: true, message: "单位名称不能为空", trigger: "blur" },
        ],
        sjxfgxdw: [
          { required: true, message: "上级管辖单位不能为空", trigger: "blur" },
        ],
        dwdzyx: [
          {
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: ["blur", "change"],
          },
        ],
        aqzrrsfz: [
          { required: true, message: "请输入消防安全负责人", trigger: "blur" },
        ],
        aqglr: [
          { required: true, message: "请输入消防安全管理人", trigger: "blur" },
        ],
        dwdz: [{ required: true, message: "请输入单位地址", trigger: "blur" }],
        dwlx: [
          { required: true, message: "请选择监管单位类别", trigger: "blur" },
        ],
        orgCharge: [
          { required: true, message: "请输入负责人", trigger: "blur" },
        ],
        xzqy: [
          { required: true, message: "请输入消防安全负责人", trigger: "blur" },
        ],
        aqzrr: [{ required: true, message: "请输入行政区域", trigger: "blur" }],
        // aqzrrsfz:[{ required: true, message: "请输入消防安全负责人身份证", trigger: "blur" }],
        // aqglrsfz:[{ required: true, message: "请输入消防安全管理人身份证", trigger: "blur" }],
        frdbdh: [
          {
            required: true,
            pattern:
              /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur",
          },
        ],
        dwdh: [
          {
            required: true,
            pattern:
              /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur",
          },
        ],
        // 手机号
        // frdbdh: [
        //   // 这个只能验证手机号
        //   // { pattern:/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/, message: "请输入合法手机号", trigger: "blur" }
        //   { pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/, message: "请输入合法手机号/电话号", trigger: ['blur', 'change'] }
        // ],
        // aqzrrdh: [
        //   // 这个只能验证手机号
        //   // { pattern:/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/, message: "请输入合法手机号", trigger: "blur" }
        //   { pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/, message: "请输入合法手机号/电话号", trigger: ['blur', 'change'] }
        // ],
        // zjzxfglrdh: [
        //   // 这个只能验证手机号
        //   // { pattern:/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/, message: "请输入合法手机号", trigger: "blur" }
        //   { pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/, message: "请输入合法手机号/电话号", trigger: ['blur', 'change'] }
        // ],
        // aqglrdh: [
        //   // 这个只能验证手机号
        //   // { pattern:/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/, message: "请输入合法手机号", trigger: "blur" }
        //   { pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/, message: "请输入合法手机号/电话号", trigger: ['blur', 'change'] }
        // ],
        // dwdh: [
        //   // 这个只能验证手机号
        //   // { pattern:/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/, message: "请输入合法手机号", trigger: "blur" }
        //   { pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/, message: "请输入合法手机号/电话号", trigger: ['blur', 'change'] }
        // ],
        // 身份证
        frdbsfz: [
          {
            required: true,
            pattern:
              /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
            message: "请输入合法身份证号",
            trigger: ["blur", "change"],
          },
        ],
        aqzrrsfz: [
          {
            required: true,
            required: true,
            pattern:
              /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
            message: "请输入合法身份证号",
            trigger: ["blur", "change"],
          },
        ],
        aqglrsfz: [
          {
            required: true,
            pattern:
              /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
            message: "请输入合法身份证号",
            trigger: ["blur", "change"],
          },
        ],
        zjzxfglrsfz: [
          {
            pattern:
              /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,
            message: "请输入合法身份证号",
            trigger: ["blur", "change"],
          },
        ],
      },

      selectedTab: "buildingInfo",
      // 数据字典
      statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS), //状态

      dwlxDictDatas: getDictDatas(DICT_TYPE.BACKEND_ORG_TYPE), //请选择监管单位类别

      dwxzDictDatas: getDictDatas(DICT_TYPE.BACKEND_ORG_TYPE), //状态
      orgId: null,
      opentabs: false,
      tableHeight: "",
      resizeFlag: null,
      inspectHis1: "",
      inspectHis2: "",
      inspectHis3: "",
      openSeedialog: false,
    };
  },
  mounted() {
    this.getDictDatas(DICT_TYPE.TASK_TYPE).map((i) => {
      if (i.label == "主动检查") {
        this.inspectHis1 = i.value;
      } else if (i.label == "主动巡查") {
        this.inspectHis2 = i.value;
      } else if (i.label == "每日检查") {
        this.inspectHis3 = i.value;
      } else {
      }
    });
    window.addEventListener("resize", () => {
      // resizeHeight()
      this.tableHeight = getTableHeight(280);
    });
  },
  created() {
    this.getTreeselect();
    this.tableHeight = getTableHeight(280);
  },
  methods: {
    // 更多操作
    handleCommand(command, index, row) {
      switch (command) {
        case "handleUpdate":
          this.handleUpdate(row);
          break;
        case "handleDelete":
          this.handleDelete(row);
          break;
        case "handleExportMsg":
          this.handleExportMsg(row);
          break;
        default:
          break;
      }
    },
    deptOptionsTrans(val) {
      return this.deptOptionsList[val];
    },
    handleInit() {
      //单位信息初始化按钮
      this.getList();
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 执行查询
      getOrgPage(this.queryParams).then((response) => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 查询部门下拉树结构 + 岗位下拉 */
    getTreeselect() {
      listSimpleDepts().then((response) => {
        // 处理 deptOptions 参数
        this.deptOptions = [];
        this.deptOptions.push(...this.handleTree(response.data, "id"));
        var list = response.data;
        list.map((i) => {
          this.deptOptionsList[i.id] = i.name;
        });
        this.getList();
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        orgName: undefined,
        dwdz: undefined,
        dwpyjc: undefined,
        dwlx: undefined,
        jjsyz: undefined,
        dwclsj: undefined,
        dwdj: undefined,
        dwxz: undefined,
        qtqk: undefined,
        xzqy: undefined,
        zzjgdm: undefined,
        orgCharge: undefined,
        frdbsfz: undefined,
        frdbdh: undefined,
        aqzrr: undefined,
        aqzrrsfz: undefined,
        aqzrrdh: undefined,
        dwdzyx: undefined,
        aqglr: undefined,
        aqglrsfz: undefined,
        aqglrdh: undefined,
        zjzxfglr: undefined,
        zjzxfglrsfz: undefined,
        zjzxfglrdh: undefined,
        dwdh: undefined,
        dwcz: undefined,
        yzbm: undefined,
        sjxfgxdw: undefined,
        qrsj: undefined,
        qxsj: undefined,
        status: 0,
        dwid: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
      console.log(this.list, "lisilist");
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加单位信息管理";
    },
    /** 查看按钮操作 */
    handleSee(row) {
      this.reset();
      const id = row.id;
      getOrg(id).then((response) => {
        this.form = response.data;
        this.openSeedialog = true;
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getOrg(id).then((response) => {
        this.form = response.data;
        this.form.qrsj = new Date(response.data.qrsj).getTime();
        this.form.qxsj = new Date(response.data.qxsj).getTime();

        this.open = true;
        this.title = "修改单位信息管理";
      });
    },
    /** 提交按钮 */
    submitForm() {
      if (this.form.qrsj > this.form.qxsj) {
        this.$message.error("取消重点单位时间不能小于确定重点单位时间");
        return;
      }
      this.form.userId = this.$store.getters.userId;
      this.$refs["form"].validate((valid) => {
        if (!valid) {
          return;
        }
        // 修改的提交
        if (this.form.id != null) {
          updateOrg(this.form).then((response) => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        createOrg(this.form).then((response) => {
          this.$modal.msgSuccess("新增成功");
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
      this.$modal
        .confirm('是否确认删除单位为"' + row.orgName + '"的数据项?')
        .then(function () {
          return deleteOrg(id);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    handleExport() {
      // 处理查询参数
      let params = { ...this.queryParams };
      params.pageNo = undefined;
      params.pageSize = undefined;
      // 执行导出
      this.$modal
        .confirm("是否确认导出消防单位信息?")
        .then(() => {
          this.exportLoading = true;
          return exportOrgExcel(params);
        })
        .then((response) => {
          this.$download.excel(response, "消防单位信息.xls");
          this.exportLoading = false;
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExportMsg(row) {
      const id = row.dwid;
      // 执行导出
      this.$modal
        .confirm("是否确认导出消防二维码?")
        .then(() => {
          this.exportLoading = true;
          return exportOrgCode({ orgId: id }).then((response) => {
            this.$download.zip(response.data, "消防二维码.zip");
            this.exportLoading = false;
          });
        })
        .catch(() => {});
    },
    tableRowClick(row) {
      console.log("row, column, event :>> ", row);
      this.orgId = row.dwid;
    },
    clickTab(e) {
      // console.log("e :>> ", e);
    },
  },
};
</script>
<style lang="scss" scoped>
@import "~@/assets/styles/dialog.scss";
::v-deep .el-dialog__body {
  margin-left: 60px !important;
}

::v-deep .el-form-item__label-wrap {
  margin-left: 0 !important;
}


</style>
