<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="89px">
      <el-form-item label="登记部门" prop="deptId" v-show="deptShow">
        <el-select v-model="queryParams.deptId" filterable placeholder="请选择部门" clearable>
          <el-option
            v-for="dict in allDeptList"
            :key="dict.deptId"
            :label="dict.deptName"
            :value="dict.deptId"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="风险点等级" prop="riskGrade">
        <el-select v-model="queryParams.riskGrade" placeholder="请选择风险点等级" clearable>
          <el-option
            v-for="dict in dict.type.risk_grade"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="风险点类型" prop="reportAddressType">
        <el-select v-model="queryParams.reportAddressType" placeholder="请选择风险点类型" clearable>
          <el-option
            v-for="dict in dict.type.risk_report_address_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--<el-form-item label="风险点位置" prop="riskLocation">
        <el-input
          v-model="queryParams.riskLocation"
          placeholder="请输入风险点位置"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="涉及群众数量" prop="peopleQuantity">
        <el-input
          v-model="queryParams.peopleQuantity"
          placeholder="请输入涉及群众数量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="抢险救援物资保障地点" prop="materialsAddr">
        <el-input
          v-model="queryParams.materialsAddr"
          placeholder="请输入抢险救援物资保障地点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="预备物资数量" prop="materialsQuantity">
        <el-input
          v-model="queryParams.materialsQuantity"
          placeholder="请输入预备物资数量"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生活物资保障地点" prop="lifeAddr">
        <el-input
          v-model="queryParams.lifeAddr"
          placeholder="请输入生活物资保障地点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="人员转移安置点" prop="resettleAddr">
        <el-input
          v-model="queryParams.resettleAddr"
          placeholder="请输入人员转移安置点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="乡级责任人姓名" prop="villageName">
        <el-input
          v-model="queryParams.villageName"
          placeholder="请输入乡级责任人姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="乡级责任人职务" prop="villageDuties">
        <el-input
          v-model="queryParams.villageDuties"
          placeholder="请输入乡级责任人职务"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="乡级责任人联系电话" prop="villageTel">
        <el-input
          v-model="queryParams.villageTel"
          placeholder="请输入乡级责任人联系电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="村级责任人姓名" prop="villageName1">
        <el-input
          v-model="queryParams.villageName1"
          placeholder="请输入村级责任人姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="村级责任人职务" prop="villageDuties1">
        <el-input
          v-model="queryParams.villageDuties1"
          placeholder="请输入村级责任人职务"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="村级责任人联系电话" prop="villageTel1">
        <el-input
          v-model="queryParams.villageTel1"
          placeholder="请输入村级责任人联系电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建者部门" prop="deptId">
        <el-input
          v-model="queryParams.deptId"
          placeholder="请输入创建者部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建者id" prop="createUserId">
        <el-input
          v-model="queryParams.createUserId"
          placeholder="请输入创建者id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="修改着id" prop="updateUserId">
        <el-input
          v-model="queryParams.updateUserId"
          placeholder="请输入修改着id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="巡查责任人姓名" prop="inspectionName">
        <el-input
          v-model="queryParams.inspectionName"
          placeholder="请输入巡查责任人姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="巡查责任人职务" prop="inspectionDuties">
        <el-input
          v-model="queryParams.inspectionDuties"
          placeholder="请输入巡查责任人职务"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="巡查责任人电话" prop="inspectionTel">
        <el-input
          v-model="queryParams.inspectionTel"
          placeholder="请输入巡查责任人电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </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="['ehsRisk:ehsRisk: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="['ehsRisk:ehsRisk: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="['ehsRisk:ehsRisk:remove']"
        >删除</el-button>
      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['ehsRisk:ehsRisk:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['ehsRisk:ehsRisk:import']"
        >导入</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="ehsRiskList" @selection-change="handleSelectionChange" max-height="750" style="width: 100%">
      <el-table-column type="selection" width="55" align="center" />
<!--      <el-table-column label="" align="center" prop="riskId" />-->
      <el-table-column label="上报部门" align="center" prop="deptName"  v-if="this.$store.state.user.parentId==0"/>
      <el-table-column label="风险点等级" align="center" prop="riskGrade">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.risk_grade" :value="scope.row.riskGrade"/>
        </template>
      </el-table-column>
      <el-table-column label="风险点类型" align="center" prop="reportAddressType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.risk_report_address_type" :value="scope.row.reportAddressType"/>
        </template>
      </el-table-column>
      <el-table-column label="风险点位置" align="center" prop="riskLocation" >
      <template slot-scope="scope">
        <span>{{toStr(scope.row.riskLocation,1)}}</span>
      </template>
      </el-table-column>
      <el-table-column label="风险点概况" align="center" prop="riskDesc" />
      <el-table-column label="涉及群众数量" align="center" prop="peopleQuantity" >
      <template slot-scope="scope">
        <span>{{toStr(scope.row.peopleQuantity,2)}}</span>
      </template>
      </el-table-column>
      <el-table-column label="抢险救援物资保障地点" align="center" prop="materialsAddr" />
      <el-table-column label="预备物资数量" align="center" prop="materialsQuantity" />
      <el-table-column label="生活物资保障地点" align="center" prop="lifeAddr" />
      <el-table-column label="人员转移安置点" align="center" prop="resettleAddr" />
      <el-table-column align="center" label="巡检责任人">
        <el-table-column label="姓名" align="center" prop="inspectionName" />
        <el-table-column label="职务" align="center" prop="inspectionDuties" />
        <el-table-column label="电话" align="center" prop="inspectionTel" />
      </el-table-column>
      <el-table-column align="center" label="村级责任人">
        <el-table-column label="姓名" align="center" prop="villageName" />
        <el-table-column label="职务" align="center" prop="villageDuties" />
        <el-table-column label="电话" align="center" prop="villageTel" />
      </el-table-column>
      <el-table-column align="center" label="乡级责任人">
        <el-table-column label="姓名" align="center" prop="villageName1" />
        <el-table-column label="职务" align="center" prop="villageDuties1" />
        <el-table-column label="电话" align="center" prop="villageTel1" />
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
      <!--<el-table-column label="创建者部门" align="center" prop="deptId" />-->
      <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="['ehsRisk:ehsRisk:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['ehsRisk:ehsRisk: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="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="风险点等级" prop="riskGrade">
              <el-select v-model="form.riskGrade" placeholder="请选择风险点等级">
                <el-option
                  v-for="dict in dict.type.risk_grade"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="风险点类型" prop="reportAddressType">
              <el-select v-model="form.reportAddressType" placeholder="请选择风险点类型">
                <el-option
                  v-for="dict in dict.type.risk_report_address_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="风险点位置" prop="riskLocation1">
              <el-input v-model="form.riskLocation1" placeholder="请输入村(社区)" style="width: 200px;"/>村(社区)
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item  label-width="0px" prop="riskLocation2">
              <el-input v-model="form.riskLocation2" placeholder="请输入详细位置"  style="width: 200px;"/>位置
            </el-form-item>
          </el-col>
        </el-row>
<!--        <el-form-item label="风险点位置" prop="riskLocation">
          <el-input v-model="form.riskLocation1" placeholder="请输入风险点位置" style="width: 200px;"/>村（社区）
          <el-input v-model="form.riskLocation2" placeholder="请输入风险点位置"  style="width: 200px;"/>位置
        </el-form-item>-->

        <el-form-item label="风险点概况" prop="riskDesc">
          <el-input v-model="form.riskDesc" type="textarea" placeholder="请输入内容" />
        </el-form-item>

<!--        <el-form-item label="涉及群众数量" prop="peopleQuantity">
          <el-input v-model="form.peopleQuantity1" placeholder="请输入涉及群众数量" style="width: 200px;"/>户
          <el-input v-model="form.peopleQuantity2" placeholder="请输入涉及群众数量" style="width: 200px;"/>人
        </el-form-item>-->
        <el-row>
          <el-col :span="12">
            <el-form-item label="涉及群众数量" prop="peopleQuantity1">
              <el-input v-model="form.peopleQuantity1" placeholder="请输入户数" style="width: 200px;"/>户
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item  label-width="0px" prop="peopleQuantity2">
              <el-input v-model="form.peopleQuantity2" placeholder="请输入人数"  style="width: 200px;"/>人
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="抢险救援物资保障地点" prop="materialsAddr">
          <el-input v-model="form.materialsAddr" placeholder="请输入抢险救援物资保障地点" />
        </el-form-item>
        <el-form-item label="预备物资数量" prop="materialsQuantity">
          <el-input v-model="form.materialsQuantity" placeholder="请输入预备物资数量" />
        </el-form-item>
        <el-form-item label="生活物资保障地点" prop="lifeAddr">
          <el-input v-model="form.lifeAddr" placeholder="请输入生活物资保障地点" />
        </el-form-item>
        <el-form-item label="人员转移安置点" prop="resettleAddr">
          <el-input v-model="form.resettleAddr" placeholder="请输入人员转移安置点" />
        </el-form-item>
        <el-form-item label="巡查责任人" prop="region">
        </el-form-item>
        <el-row>
          <el-col :span="8">
            <el-form-item label="姓名" prop="inspectionName">
              <el-input v-model="form.inspectionName" placeholder="请输入巡查责任人姓名" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职务" prop="inspectionDuties">
              <el-input v-model="form.inspectionDuties" placeholder="请输入巡查责任人职务" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电话" prop="inspectionTel">
              <el-input v-model="form.inspectionTel" placeholder="请输入巡查责任人电话" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="村级责任人" prop="region"> </el-form-item>
        <el-row>
          <el-col :span="8">
            <el-form-item label="姓名" prop="villageName">
              <el-input v-model="form.villageName" placeholder="请输入村级责任人姓名" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职务" prop="villageDuties">
              <el-input v-model="form.villageDuties" placeholder="请输入村级责任人职务" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电话" prop="villageTel">
              <el-input v-model="form.villageTel" placeholder="请输入村级责任人联系电话" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="乡级责任人" prop="region"> </el-form-item>
        <el-row>
          <el-col :span="8">
            <el-form-item label="姓名" prop="villageName1">
              <el-input v-model="form.villageName1" placeholder="请输入乡级责任人姓名" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职务" prop="villageDuties1">
              <el-input v-model="form.villageDuties1" placeholder="请输入乡级责任人职务" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电话" prop="villageTel1">
              <el-input v-model="form.villageTel1" placeholder="请输入乡级责任人联系电话" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </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>
    <!-- 导入 -->
    <importUpload
      ref="uploadRef"
      @ok="upLoadOk"
      downUrl="/ehsRisk/ehsRisk/importTemplate"
      temName="风险信息导入模板"
    ></importUpload>
  </div>
</template>

<script>
  import { listEhsRisk, getEhsRisk, delEhsRisk, addEhsRisk, updateEhsRisk } from "@/api/ehs/ehsRisk";
  import {listAllDept } from "@/api/system/dept";
  import importUpload from "@/components/upload/upload";
  export default {
    name: "EhsRisk",
    dicts: ['risk_grade', 'risk_report_address_type'],
    components: {
      importUpload,
    },
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 风险信息表格数据
        ehsRiskList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        //是否显示部门列表查询条件
        deptShow: false,
        curDeptId:null,//登录用户的部门id
        //所有部门列表字典
        allDeptList: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          riskGrade: null,
          reportAddressType: null,
          riskLocation: null,
          riskDesc: null,
          peopleQuantity: null,
          materialsAddr: null,
          materialsQuantity: null,
          lifeAddr: null,
          resettleAddr: null,
          villageName: null,
          villageDuties: null,
          villageTel: null,
          villageName1: null,
          villageDuties1: null,
          villageTel1: null,
          deptId: null,
          createUserId: null,
          updateUserId: null,
          inspectionName: null,
          inspectionDuties: null,
          inspectionTel: null
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          riskGrade: [
            { required: true, message: "风险点等级不能为空", trigger: "change" }
          ],
          /* riskLocation: [
            { required: true, message: "风险点位置不能为空", trigger: "change" }
          ], */
          riskLocation1: [
            { required: true, message: "位置不能为空", trigger: "change" }
          ],
          riskLocation2: [
            { required: true, message: "位置不能为空", trigger: "change" }
          ],
         /*  peopleQuantity: [
            { required: true, message: "涉及群众数量不能为空", trigger: "change" }
          ], */
          peopleQuantity1: [
            { required: true, message: "涉及群众数量不能为空", trigger: "change" }
          ],
          peopleQuantity2: [
            { required: true, message: "涉及群众数量不能为空", trigger: "change" }
          ],
          reportAddressType: [
            { required: true, message: "风险点类型不能为空", trigger: "change" }
          ],
          villageName: [
            { required: true, message: "乡级责任人姓名不能为空", trigger: "blur" }
          ],
          villageTel: [
            { required: true, message: "乡级责任人联系电话不能为空", trigger: "blur" },
           /* { pattern:/^((0\d{2,3}-\d{7,8})|(1[345678]\d{9}))$/, message: "联系电话必须是手机或固话(区号-固话)", trigger: "change" }*/
          ],
          villageName1: [
            { required: true, message: "村级责任人姓名不能为空", trigger: "blur" }
          ],
          villageTel1: [
            { required: true, message: "村级责任人联系电话不能为空", trigger: "blur" },
            /*{ pattern:/^((0\d{2,3}-\d{7,8})|(1[345678]\d{9}))$/, message: "联系电话必须是手机或固话(区号-固话)", trigger: "change" }*/
          ],
          inspectionName: [
            { required: true, message: "巡查责任人姓名不能为空", trigger: "blur" }
          ],
          inspectionTel: [
            { required: true, message: "巡查责任人电话不能为空", trigger: "blur" },
            /*{ pattern:/^((0\d{2,3}-\d{7,8})|(1[345678]\d{9}))$/, message: "联系电话必须是手机或固话(区号-固话)", trigger: "change" }*/
          ]
        }
      };
    },
    created() {
      this.getList();
      this.getListAllDept();
      this.deptShow = this.$store.state.user.parentId==0 ?true :false;
      this.curDeptId = this.$store.state.user.deptId;
    },
    methods: {
      /** 查询风险信息列表 */
      getList() {
        this.loading = true;
        listEhsRisk(this.queryParams).then(response => {
          this.ehsRiskList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      /** 单位信息列表 */
      getListAllDept() {
        console.log(this.$store.state.user.deptId);
        this.loading = true;
        listAllDept().then(response => {
          this.allDeptList = response.data;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          riskId: null,
          riskGrade: null,
          reportAddressType: null,
          riskLocation: null,
          riskLocation1: "",
          riskLocation2: "",
          riskDesc: null,
          peopleQuantity: null,
          peopleQuantity1: "",
          peopleQuantity2: "",
          materialsAddr: null,
          materialsQuantity: null,
          lifeAddr: null,
          resettleAddr: null,
          villageName: null,
          villageDuties: null,
          villageTel: null,
          villageName1: null,
          villageDuties1: null,
          villageTel1: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          remark: null,
          deptId: null,
          createUserId: null,
          updateUserId: null,
          inspectionName: null,
          inspectionDuties: null,
          inspectionTel: null
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.riskId)
        this.single = selection.length!==1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加风险信息";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const riskId = row.riskId || this.ids
        getEhsRisk(riskId).then(response => {
          this.open = true;
          this.title = "修改风险信息";
          this.form = response.data;
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            this.form.riskLocation = this.form.riskLocation1+";"+this.form.riskLocation2;
            this.form.peopleQuantity = this.form.peopleQuantity1+";"+this.form.peopleQuantity2
            if (this.form.riskId != null) {
              updateEhsRisk(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            } else {
              addEhsRisk(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const riskIds = row.riskId || this.ids;
        this.$modal.confirm('是否确认删除风险信息编号为"' + riskIds + '"的数据项？').then(function() {
          return delEhsRisk(riskIds);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('ehsRisk/ehsRisk/export', {
          ...this.queryParams
        }, `风险信息_${new Date().getTime()}.xlsx`)
      },
      toStr(v,t) {
        if(v!=null){
          let s = v.split(";");
          if(s.length>1){
            if(t==1){//位置
              return s[0]+"村（社区）"+s[1]+"位置"
            }else {
              return s[0]+"户"+s[1]+"人"
            }
          }else
            return  v;
        }else
          return  ""
      },
      /** 批量导入 */
      handleImport() {
        console.log(this.$refs.uploadRef.upload);
        this.$refs.uploadRef.upload.open = true;
        this.$refs.uploadRef.upload.title = "风险信息导入";
        this.$refs.uploadRef.upload.url =
          process.env.VUE_APP_BASE_API + "/ehsRisk/ehsRisk/importData";
      },
      /** 导入成功 */
      upLoadOk() {
        // console.log("导入成功")
        this.getList();
      },
    }
  };
</script>

<style>
  .color-red{
    color: white;
    border-color: red;
    background-color: red;
    border-radius: 50px;
  }

  .color-orange{
    color: white;
    background-color: orange;
    border-radius: 50px;
  }

  .color-yellow{
    background-color: yellow;
    color: black;
    border-radius: 50px;
  }

  .color-blue{
    color: white;
    background-color: blue;
    border-radius: 50px;
  }
</style>
