<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="用户名称" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入用户名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户编号" prop="userNumber">
        <el-input
          v-model="queryParams.userNumber"
          placeholder="请输入用户编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户类型" prop="userType">
        <el-select v-model="queryParams.userType" placeholder="请选择用户类型" clearable size="small">
          <el-option  v-for="dict in dict.type.users_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="队伍" >
        <el-select v-model="queryParams.team" clearable placeholder="请选择队伍" >
          <el-option
            v-for="item in postOptions"
            :key="item.postId"
            :label="item.postName"
            :value="item.postId"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="上报人" prop="userId">
        <el-select v-model="queryParams.userId" placeholder="请选择巡查人员" clearable size="small">
          <el-option
            v-for="item in workerList"
            :key="item.id"
            :label="item.name"
            :value="item.id"/>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @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="['system:pipelineGasUser:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:pipelineGasUser:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:pipelineGasUser:remove']"
        >删除</el-button>
      </el-col>
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          :loading="exportLoading"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['system:pipelineGasUser:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="pipelineGasUserList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
<!--      <el-table-column label="主键id" align="center" prop="id" v-if="true"/>-->
      <el-table-column label="序号" width="70">
        <template slot-scope="scope">
          {{(queryParams.pageNum-1)*queryParams.pageSize+scope.$index+1}}
        </template>
      </el-table-column>
<!--      <el-table-column  label="编号" type="index" width="50"></el-table-column>-->
      <el-table-column label="用户名称" align="center" prop="userName" />
      <el-table-column label="用户编号" align="center" prop="userNumber" />
      <el-table-column label="用户类型" align="center" prop="userType" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.users_type" :value="scope.row.userType"/>
        </template>
      </el-table-column>
<!--      <el-table-column label="阀门外观" align="center" prop="valveAppearance" />-->
<!--      <el-table-column label="开关是否灵敏有效" align="center" prop="sensitives" />-->
<!--      <el-table-column label="类型" align="center" prop="type" />-->
<!--      <el-table-column label="箱体外观" align="center" prop="cabinetAppearance" />-->
<!--      <el-table-column label="锅炉外观" align="center" prop="boilerAppearance" />-->
<!--      <el-table-column label="锅炉运行情况" align="center" prop="boilerExterior" />-->
<!--      <el-table-column label="管道" align="center" prop="pipeline" />-->
<!--      <el-table-column label="计量表具" align="center" prop="measuringInstruments" />-->
<!--      <el-table-column label="餐饮设备运行情况" align="center" prop="cateringStatus" />-->
<!--      <el-table-column label="餐饮设备外观" align="center" prop="cateringExterior" />-->
<!--      <el-table-column label="连接管" align="center" prop="connectingPipe" />-->
<!--      <el-table-column label="凝水杠" align="center" prop="condensateBar" />-->
<!--      <el-table-column label="有无私接私改" align="center" prop="receptionModification" />-->
<!--      <el-table-column label="压力表运行情况" align="center" prop="pressureStatus" />-->
<!--      <el-table-column label="可燃气体报警器装置" align="center" prop="combustibleGas" />-->
<!--      <el-table-column label="紧急切断阀" align="center" prop="emergencyShut" />-->
<!--      <el-table-column label="安全阀" align="center" prop="safetyValve" />-->
<!--      <el-table-column label="流向标识label" align="center" prop="flowDirectionLabel" />-->
<!--      <el-table-column label="流向标识" align="center" prop="flowDirection" />-->
<!--      <el-table-column label="有无易燃物" align="center" prop="flammableMaterials" />-->
<!--      <el-table-column label="有无占压" align="center" prop="pressure" />-->
<!--      <el-table-column label="两气混用" align="center" prop="mixingGases" />-->
<!--      <el-table-column label="重物搭挂" align="center" prop="heavyHanging" />-->
<!--      <el-table-column label="电线缠绕" align="center" prop="wireTangle" />-->
<!--      <el-table-column label="其他" align="center" prop="other" />-->
<!--      <el-table-column label="安检情况1" align="center" prop="securityCheckOne" />-->
<!--      <el-table-column label="安检情况2" align="center" prop="securityCheckTwo" />-->
<!--      <el-table-column label="安检员签字" align="center" prop="securityCheckUser" />-->
      <el-table-column label="安检时间" align="center" prop="securityCheckTime" width="180"/>
        <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
          <el-table-column label="上报人" align="center" prop="createByName" width="180"/>
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.securityCheckTime, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="用户代表签字" align="center" prop="representative" />-->
<!--      <el-table-column label="联系电话" align="center" prop="phone" />-->
<!--      <el-table-column label="有无易燃物label" align="center" prop="flammableMaterialsLabel" />-->
<!--      <el-table-column label="有无占压label" align="center" prop="pressureLabel" />-->
<!--      <el-table-column label="两气混用label" align="center" prop="mixingGasesLabel" />-->
<!--      <el-table-column label="重物搭挂label" align="center" prop="heavyHangingLabel" />-->
<!--      <el-table-column label="电线缠绕label" align="center" prop="wireTangleLabel" />-->
      <el-table-column label="照片" align="center">
        <template slot-scope="scope">
          <el-image
            style="width: 50px; height: 50px"
            :src="scope.row.photoList!=null?scope.row.photoList[0]:''"
            :preview-src-list="scope.row.photoList">
          </el-image>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:pipelineGasUser:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:pipelineGasUser:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改非居民巡查对话框 -->
    <el-dialog :title="title" :visible.sync="open"  width="700px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" :inline="true" label-width="170px">
        <el-form-item label="用户名称" prop="userName">
          <el-input v-model="form.userName" placeholder="请输入用户名称" />
        </el-form-item>
        <el-form-item label="用户编号" prop="userNumber">
          <el-input v-model="form.userNumber" placeholder="请输入用户编号" />
        </el-form-item>
        <el-form-item label="用户类型" prop="userType">
<!--          <el-select v-model="form.userType" placeholder="请选择用户类型">-->
<!--            <el-option label="请选择字典生成" value="" />-->
<!--          </el-select>-->
          <el-radio-group v-model="form.userType"  v-for="dict in dict.type.users_type" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>

        </el-form-item>
        <el-form-item label="阀门外观" prop="valveAppearance">
<!--          <el-select v-model="form.valveAppearance" placeholder="请选择阀门外观" clearable size="small">-->
<!--            <el-option  v-for="dict in dict.type.exterior"-->
<!--                        :key="dict.value"-->
<!--                        :label="dict.label"-->
<!--                        :value="dict.value" />-->
<!--          </el-select>-->
          <el-radio-group v-model="form.valveAppearance"  v-for="dict in dict.type.exterior" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="开关是否灵敏有效" prop="sensitives">
<!--          <el-input v-model="form.sensitives" placeholder="请输入开关是否灵敏有效" />-->
<!--          <el-select v-model="form.sensitives" placeholder="请选择阀门外观" clearable size="small">-->
<!--            <el-option  v-for="dict in dict.type.sensitives"-->
<!--                        :key="dict.value"-->
<!--                        :label="dict.label"-->
<!--                        :value="dict.value" />-->
<!--          </el-select>-->
          <el-radio-group v-model="form.sensitives"  v-for="dict in dict.type.sensitive" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="调压箱类型" prop="type">
<!--          <el-select v-model="form.type" placeholder="请选择类型">-->
<!--            <el-option label="请选择字典生成" value="" />-->
<!--          </el-select>-->
          <el-radio-group v-model="form.type"  v-for="dict in dict.type.box_type" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="调压箱箱体外观" prop="cabinetAppearance">
<!--          <el-input v-model="form.cabinetAppearance" placeholder="请输入箱体外观" />-->
          <el-radio-group v-model="form.cabinetAppearance"  v-for="dict in dict.type.exterior" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="锅炉外观" prop="boilerAppearance">
<!--          <el-input v-model="form.boilerAppearance" placeholder="请输入锅炉外观" />-->
          <el-radio-group v-model="form.boilerAppearance"  v-for="dict in dict.type.exterior" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="锅炉运行情况" prop="boilerExterior">
          <el-radio-group v-model="form.boilerExterior"  v-for="dict in dict.type.catering_status" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="管道" prop="pipeline">

<!--          <el-input v-model="form.pipeline" placeholder="请输入管道" />-->
          <el-radio-group v-model="form.pipeline"  v-for="dict in dict.type.pipeline_type" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="管道详情" prop="pipeline">

          <!--          <el-input v-model="form.pipeline" placeholder="请输入管道" />-->
          <el-input v-model="form.pipelineLabel" placeholder="请输入管道详情"/>
        </el-form-item>
        <el-form-item label="计量表具" prop="measuringInstruments">
<!--          <el-input v-model="form.measuringInstruments" placeholder="请输入计量表具" />-->
          <el-radio-group v-model="form.measuringInstruments"  v-for="dict in dict.type.measuring_instruments" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="餐饮设备运行情况">
<!--          <el-radio-group v-model="form.cateringStatus">-->
<!--            <el-radio label="1">请选择字典生成</el-radio>-->
<!--          </el-radio-group>-->
          <el-radio-group v-model="form.cateringStatus"  v-for="dict in dict.type.catering_status" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="餐饮设备外观" prop="cateringExterior">
<!--          <el-input v-model="form.cateringExterior" placeholder="请输入餐饮设备外观" />-->
          <el-radio-group v-model="form.cateringExterior"  v-for="dict in dict.type.exterior" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="连接管-金属软管" prop="connectingPipe">
<!--          <el-input v-model="form.connectingPipe" placeholder="请输入连接管" />-->
          <el-radio-group v-model="form.connectingPipe"  v-for="dict in dict.type.connecting_pipe_metal_hose" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="连接管-胶管,点火棒" prop="connectingPipeB">
          <!--          <el-input v-model="form.connectingPipe" placeholder="请输入连接管" />-->
          <el-radio-group v-model="form.connectingPipeB"  v-for="dict in dict.type.connecting_pipe_metal_hose" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="凝水杠-外观" prop="condensateBar">
<!--          <el-input v-model="form.condensateBar" placeholder="请输入凝水杠" />-->
          <el-radio-group v-model="form.condensateBar"  v-for="dict in dict.type.condensate_rod_appearance" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="有无私接私改" prop="receptionModification">
<!--          <el-input v-model="form.receptionModification" placeholder="请输入有无私接私改" />-->
          <el-radio-group v-model="form.receptionModification"  v-for="dict in dict.type.there_is_selflessness_and_private_reform" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="压力表运行情况">
<!--          <el-radio-group v-model="form.pressureStatus">-->
<!--            <el-radio label="1">请选择字典生成</el-radio>-->
<!--          </el-radio-group>-->
          <el-radio-group v-model="form.pressureStatus"  v-for="dict in dict.type.pressure_gauge_operation" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="可燃气体报警器装置-安装情况" prop="combustibleGas">

<!--          <el-input v-model="form.combustibleGas" placeholder="请输入可燃气体报警器装置" />-->
          <el-radio-group v-model="form.combustibleGas"  v-for="dict in dict.type.alarm_operation_a" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="可燃气体报警器装置-原因" prop="combustibleGas">
          <!--          <el-input v-model="form.combustibleGas" placeholder="请输入可燃气体报警器装置" />-->
          <el-radio-group v-model="form.pressureStatusB"  v-for="dict in dict.type.alarm_operation_b" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="紧急切断阀-外观" prop="emergencyShut">
<!--          <el-input v-model="form.emergencyShut" placeholder="请输入紧急切断阀" />-->

          <el-radio-group v-model="form.emergencyShut"  v-for="dict in dict.type.emergency_shutoff_valve_appearance" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="紧急切断阀-运行情况" prop="emergencyShut">
<!--          <el-input v-model="form.emergencyShutB" placeholder="请输入紧急切断阀" />-->
          <el-radio-group v-model="form.emergencyShutB"  v-for="dict in dict.type.emergency_shutdown_valve_operation" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="安全阀-外观" prop="safetyValve">
<!--          <el-input v-model="form.safetyValve" placeholder="请输入安全阀" />-->
          <el-radio-group v-model="form.safetyValve"  v-for="dict in dict.type.safety_valve_appearance" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="流向标识" prop="flowDirection">
<!--          <el-input v-model="form.flowDirection" placeholder="请输入流向标识" />-->
          <el-radio-group v-model="form.flowDirection"  v-for="dict in dict.type.yes_and_no" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="流向标识详情" prop="flowDirectionLabel">
          <el-input v-model="form.flowDirectionLabel" placeholder="" />
        </el-form-item>
        <el-form-item label="有无易燃物" prop="flammableMaterials">
<!--          <el-input v-model="form.flammableMaterials" placeholder="请输入有无易燃物" />-->
          <el-radio-group v-model="form.flammableMaterials"  v-for="dict in dict.type.yes_and_no" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="有无易燃物详情" prop="flammableMaterialsLabel">
          <el-input v-model="form.flammableMaterialsLabel" placeholder="" />
        </el-form-item>
        <el-form-item label="有无占压" prop="pressure">
<!--          <el-input v-model="form.pressure" placeholder="请输入有无占压" />-->
          <el-radio-group v-model="form.pressure"  v-for="dict in dict.type.yes_and_no" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="有无占压详情" prop="pressureLabel">
          <el-input v-model="form.pressureLabel" placeholder="" />
        </el-form-item>
        <el-form-item label="两气混用" prop="mixingGases">
<!--          <el-input v-model="form.mixingGases" placeholder="请输入两气混用" />-->
          <el-radio-group v-model="form.mixingGases"  v-for="dict in dict.type.yes_and_no" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="两气混用详情" prop="mixingGasesLabel">
          <el-input v-model="form.mixingGasesLabel" placeholder="" />
        </el-form-item>
        <el-form-item label="重物搭挂" prop="heavyHanging">
<!--          <el-input v-model="form.heavyHanging" placeholder="请输入重物搭挂" />-->
          <el-radio-group v-model="form.heavyHanging"  v-for="dict in dict.type.yes_and_no" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="重物搭挂详情" prop="heavyHangingLabel">
          <el-input v-model="form.heavyHangingLabel" placeholder="" />
        </el-form-item>
        <el-form-item label="电线缠绕" prop="wireTangle">
<!--          <el-input v-model="form.wireTangle" placeholder="请输入电线缠绕" />-->
          <el-radio-group v-model="form.wireTangle"  v-for="dict in dict.type.yes_and_no" >
            <el-radio :label="dict.value">{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="电线缠绕详情" prop="wireTangleLabel">
          <el-input v-model="form.wireTangleLabel" placeholder="" />
        </el-form-item>
        <el-form-item label="其他" prop="other">
          <el-input v-model="form.other" placeholder="" type="textarea" />
        </el-form-item>
<!--        <el-form-item label="安检情况1" prop="securityCheckOne">-->
<!--          <el-input v-model="form.securityCheckOne" placeholder="请输入安检情况1" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="安检情况2" prop="securityCheckTwo">-->
<!--          <el-input v-model="form.securityCheckTwo" placeholder="请输入安检情况2" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="安检员签字" prop="securityCheckUser">-->
<!--          <el-input v-model="form.securityCheckUser" placeholder="请输入安检员签字" />-->
<!--        </el-form-item>-->
        <el-form-item label="安检时间" prop="securityCheckTime">
          <el-date-picker clearable size="small"
            v-model="form.securityCheckTime"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择安检时间">
          </el-date-picker>
        </el-form-item>
<!--        <el-form-item label="用户代表签字" prop="representative">-->
<!--          <el-input v-model="form.representative" placeholder="请输入用户代表签字" />-->
<!--        </el-form-item>-->
        <el-form-item label="联系电话" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入联系电话" />
        </el-form-item>
        <el-form-item label="照片" prop="photoList">
          <imageUpload v-model="form.photoList" :disabled="disabled"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listPipelineGasUser, getPipelineGasUser, delPipelineGasUser, addPipelineGasUser, updatePipelineGasUser } from "@/api/gas/pipelineGasUser";
import {getWorker} from "@/api/gas/user";
import {listPostAll} from "@/api/system/post";
import Cookies from "js-cookie";
export default {
  dicts:['yes_and_no','exterior','sensitive','box_type','pipeline_type','measuring_instruments',
    'catering_status','other_operating_conditions','other_appearance','pressure_gauge_operation','alarm_operation_a','alarm_operation_b',
    'emergency_shutoff_valve_appearance','emergency_shutdown_valve_operation','safety_valve_appearance','users_type','pressure_regulator_check_type'
  ,'pipelines_include_public_pipelines','measuring_instrument','connecting_pipe_metal_hose','connect_the_tube_the_glue_tube_ignition_rod','condensate_rod_appearance'
  ,'there_is_selflessness_and_private_reform'],
  name: "PipelineGasUser",
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      postName:Cookies.get("postName"),
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      postOptions: [],
      workerList: [],
      // 非居民巡查表格数据
      pipelineGasUserList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        userNumber: undefined,
        userType: undefined,
        valveAppearance: undefined,
        sensitives: undefined,
        type: undefined,
        cabinetAppearance: undefined,
        boilerAppearance: undefined,
        boilerExterior: undefined,
        pipeline: undefined,
        measuringInstruments: undefined,
        cateringStatus: undefined,
        cateringExterior: undefined,
        connectingPipe: undefined,
        condensateBar: undefined,
        receptionModification: undefined,
        pressureStatus: undefined,
        combustibleGas: undefined,
        emergencyShut: undefined,
        safetyValve: undefined,
        flowDirectionLabel: undefined,
        flowDirection: undefined,
        flammableMaterials: undefined,
        pressure: undefined,
        mixingGases: undefined,
        heavyHanging: undefined,
        wireTangle: undefined,
        other: undefined,
        securityCheckOne: undefined,
        securityCheckTwo: undefined,
        securityCheckUser: undefined,
        securityCheckTime: undefined,
        representative: undefined,
        phone: undefined,
        flammableMaterialsLabel: undefined,
        pressureLabel: undefined,
        mixingGasesLabel: undefined,
        heavyHangingLabel: undefined,
        wireTangleLabel: undefined
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {

        userName: [
          { required: true, message: "用户名称不能为空", trigger: "blur" }
        ],
        userNumber: [
          { required: true, message: "用户编号不能为空", trigger: "blur" }
        ],
        userType: [
          { required: true, message: "用户类型不能为空", trigger: "change" }
        ],
      //   valveAppearance: [
      //     { required: true, message: "阀门外观不能为空", trigger: "blur" }
      //   ],
      //   sensitives: [
      //     { required: true, message: "开关是否灵敏有效不能为空", trigger: "blur" }
      //   ],
      //   type: [
      //     { required: true, message: "类型不能为空", trigger: "change" }
      //   ],
      //   cabinetAppearance: [
      //     { required: true, message: "箱体外观不能为空", trigger: "blur" }
      //   ],
      //   boilerAppearance: [
      //     { required: true, message: "锅炉外观不能为空", trigger: "blur" }
      //   ],
      //   boilerExterior: [
      //     { required: true, message: "锅炉运行情况不能为空", trigger: "blur" }
      //   ],
      //   pipeline: [
      //     { required: true, message: "管道不能为空", trigger: "blur" }
      //   ],
      //   measuringInstruments: [
      //     { required: true, message: "计量表具不能为空", trigger: "blur" }
      //   ],
      //   cateringStatus: [
      //     { required: true, message: "餐饮设备运行情况不能为空", trigger: "blur" }
      //   ],
      //   cateringExterior: [
      //     { required: true, message: "餐饮设备外观不能为空", trigger: "blur" }
      //   ],
      //   connectingPipe: [
      //     { required: true, message: "连接管不能为空", trigger: "blur" }
      //   ],
      //   condensateBar: [
      //     { required: true, message: "凝水杠不能为空", trigger: "blur" }
      //   ],
      //   receptionModification: [
      //     { required: true, message: "有无私接私改不能为空", trigger: "blur" }
      //   ],
      //   pressureStatus: [
      //     { required: true, message: "压力表运行情况不能为空", trigger: "blur" }
      //   ],
      //   combustibleGas: [
      //     { required: true, message: "可燃气体报警器装置不能为空", trigger: "blur" }
      //   ],
      //   emergencyShut: [
      //     { required: true, message: "紧急切断阀不能为空", trigger: "blur" }
      //   ],
      //   safetyValve: [
      //     { required: true, message: "安全阀不能为空", trigger: "blur" }
      //   ],
      //   flowDirectionLabel: [
      //     { required: true, message: "流向标识label不能为空", trigger: "blur" }
      //   ],
      //   flowDirection: [
      //     { required: true, message: "流向标识不能为空", trigger: "blur" }
      //   ],
      //   flammableMaterials: [
      //     { required: true, message: "有无易燃物不能为空", trigger: "blur" }
      //   ],
      //   pressure: [
      //     { required: true, message: "有无占压不能为空", trigger: "blur" }
      //   ],
      //   mixingGases: [
      //     { required: true, message: "两气混用不能为空", trigger: "blur" }
      //   ],
      //   heavyHanging: [
      //     { required: true, message: "重物搭挂不能为空", trigger: "blur" }
      //   ],
      //   wireTangle: [
      //     { required: true, message: "电线缠绕不能为空", trigger: "blur" }
      //   ],
      //   other: [
      //     { required: true, message: "其他不能为空", trigger: "blur" }
      //   ],
      //   securityCheckOne: [
      //     { required: true, message: "安检情况1不能为空", trigger: "blur" }
      //   ],
      //   securityCheckTwo: [
      //     { required: true, message: "安检情况2不能为空", trigger: "blur" }
      //   ],
      //   securityCheckUser: [
      //     { required: true, message: "安检员签字不能为空", trigger: "blur" }
      //   ],
      //   securityCheckTime: [
      //     { required: true, message: "安检时间不能为空", trigger: "blur" }
      //   ],
      //   representative: [
      //     { required: true, message: "用户代表签字不能为空", trigger: "blur" }
      //   ],
      //   phone: [
      //     { required: true, message: "联系电话不能为空", trigger: "blur" }
      //   ],
      //   flammableMaterialsLabel: [
      //     { required: true, message: "有无易燃物label不能为空", trigger: "blur" }
      //   ],
      //   pressureLabel: [
      //     { required: true, message: "有无占压label不能为空", trigger: "blur" }
      //   ],
      //   mixingGasesLabel: [
      //     { required: true, message: "两气混用label不能为空", trigger: "blur" }
      //   ],
      //   heavyHangingLabel: [
      //     { required: true, message: "重物搭挂label不能为空", trigger: "blur" }
      //   ],
      //   wireTangleLabel: [
      //     { required: true, message: "电线缠绕label不能为空", trigger: "blur" }
      //   ]
       }
    };
  },
  created() {
    this.getPostList()
    this.getWorker()
    this.getList();
  },
  methods: {
    getPostList(){
      listPostAll({remark:'ranks'}).then(response => {
        this.postOptions = response.data;
      });
    },
    getWorker() {
      getWorker().then(req => this.workerList = req.data)
    },
    /** 查询非居民巡查列表 */
    getList() {
      this.loading = true;
      listPipelineGasUser(this.queryParams).then(response => {
        this.pipelineGasUserList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        userName: undefined,
        userNumber: undefined,
        userType: undefined,
        valveAppearance: undefined,
        sensitives: undefined,
        type: undefined,
        cabinetAppearance: undefined,
        boilerAppearance: undefined,
        boilerExterior: undefined,
        pipeline: undefined,
        measuringInstruments: undefined,
        cateringStatus: undefined,
        cateringExterior: undefined,
        connectingPipe: undefined,
        condensateBar: undefined,
        receptionModification: undefined,
        pressureStatus: undefined,
        combustibleGas: undefined,
        emergencyShut: undefined,
        safetyValve: undefined,
        flowDirectionLabel: undefined,
        flowDirection: undefined,
        flammableMaterials: undefined,
        pressure: undefined,
        mixingGases: undefined,
        heavyHanging: undefined,
        wireTangle: undefined,
        other: undefined,
        securityCheckOne: undefined,
        securityCheckTwo: undefined,
        securityCheckUser: undefined,
        securityCheckTime: undefined,
        representative: undefined,
        phone: undefined,
        flammableMaterialsLabel: undefined,
        pressureLabel: undefined,
        mixingGasesLabel: undefined,
        heavyHangingLabel: undefined,
        wireTangleLabel: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加非居民巡查";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getPipelineGasUser(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改非居民巡查";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            if (typeof this.form.photoList === 'string') {
              this.form.photoList = this.form.photoList.split(',')
            }
            updatePipelineGasUser(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addPipelineGasUser(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除非居民巡查编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delPipelineGasUser(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
        this.$download.excel('/system/pipelineGasUser/export', this.queryParams);
    }
  }
};
</script>
