<template>
  <div class="app-container">
    <el-row>
      <!--用户数据-->
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
          <el-form-item label="任务名称" prop="userName">
            <el-input
              v-model="queryParams.userName"
              placeholder="请输入任务名称"
              clearable
              style="width: 200px"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="模拟器型号" prop="simType">
            <el-select
              v-model="queryParams.simType"
              placeholder="模拟器型号"
              clearable
              style="width: 240px"
              @keyup.enter.native="handleQuery"
            >
              <el-option
                v-for="dict in dict.type.sim_sim_type"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>

          <el-form-item label="创建时间">
            <el-date-picker
              v-model="dateRange"
              style="width: 240px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </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"
            >新增训练任务</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
            >修改</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
            >删除</el-button>
          </el-col>

          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-view"
              size="mini"
              :disabled="single"
              @click="handleView"
            >详情</el-button>
          </el-col>
          <!-- <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              size="mini"
              :disabled="single"
              @click="handleInspect"
              v-hasPermi="['simulator:task:inspect']"
            >故障设置自检</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              size="mini"
              :disabled="multiple"
              @click="handleIssued"
              v-hasPermi="['simulator:task:issued']"
            >训练任务下发</el-button>
          </el-col> -->
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
        </el-row>

        <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column label="编号" align="center" key="taskId" prop="taskId" v-if="columns[0].visible" width="80"/>
          <el-table-column label="任务名称" align="center" key="name" prop="name" v-if="columns[1].visible" :show-overflow-tooltip="true" />
          <el-table-column label="模拟器型号" align="center" key="simType" prop="simType" v-if="columns[2].visible" :show-overflow-tooltip="true" >
            <template slot-scope="scope">
                <dict-tag class="text-navy" :options="dict.type.sim_sim_type" :value="scope.row.simType"/>
            </template>
          </el-table-column>

          <el-table-column label="故障现象数量" align="center" key="xianxiang" prop="xianxiang" v-if="columns[3].visible" :show-overflow-tooltip="true" />
          <el-table-column label="故障部位数量" align="center" key="buwei" prop="buwei" v-if="columns[4].visible" :show-overflow-tooltip="true" />
          <el-table-column label="创建者" align="center" key="createBy" prop="createBy" v-if="columns[5].visible" :show-overflow-tooltip="true" />
          <el-table-column label="备注" align="center" key="remark" prop="remark" v-if="columns[6].visible" :show-overflow-tooltip="true" />
          <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[7].visible" width="160">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            width="160"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
              >修改</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
              >删除</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-row>

    <!-- 添加或修改用户配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="模拟器型号" prop="simType">
              <el-select v-model="form.simType"  placeholder="请选择模拟器型号" @change="selectSimType" style="width: 85%;">
                <el-option
                  v-for="dict in dict.type.sim_sim_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="任务名称" prop="name">
              <el-input  placeholder="请输入任务名称" v-model="form.name"/>
            </el-form-item>
          </el-col>
          <div style="text-align: right;">
            <el-button @click="toggleSelection(tableData)">选择全部</el-button>
            <el-button @click="toggleSelection()">取消选择</el-button>
          </div>
        </el-row>

        <el-table
          :data="tableData" border ref="multipleTable" @selection-change="handleSelectionRow"
          :span-method="objectSpanMethod"
          style="width:100%;text-align:center;margin-left:10px; margin-top:10px">
          <el-table-column
            prop="xinghao"
            label="型号">
          </el-table-column>
          <el-table-column
            prop="xianxiang"
            label="故障现象">
          </el-table-column>
          <el-table-column
            prop="name"
            label="故障部位">
          </el-table-column>
          <el-table-column
          type="selection" prop="ids"
            label="ID"
          width="55"></el-table-column>
        </el-table>
      </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>

    <!-- 任务详情配置对话框 -->
    <el-dialog :title="title" :visible.sync="openview" width="70%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="模拟器型号" prop="simType">
              <el-select  v-model="form.simType" placeholder="请选择模拟器型号" style="width: 85%;" :disabled='true'>
                <el-option
                  value="请选择"
                >请选择</el-option>
                <el-option
                  v-for="dict in dict.type.sim_sim_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="任务名称" prop="name">
              <el-input  placeholder="请输入任务名称" v-model="form.name" disabled/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-table
          :data="tableData" border ref="multipleTable" @selection-change="handleSelectionRow"
          :span-method="objectSpanMethod"
          style="width:100%;text-align:center;margin-left:10px; margin-top:10px">
          <el-table-column
            prop="xinghao"
            label="型号">
          </el-table-column>
          <el-table-column
            prop="xianxiang"
            label="故障现象">
          </el-table-column>
          <el-table-column
            prop="name"
            label="故障部位">
          </el-table-column>
          <el-table-column
          type="selection" prop="ids"
            label="ID"
          width="55"></el-table-column>
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 故障设置自检 -->
    <el-dialog :title="title" :visible.sync="zijianopen" width="88%" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="型号">
              <el-select v-model="selectedZjEquip" placeholder="请选择模拟器型号">
                <el-option
                  value="请选择"
                >请选择</el-option>
                <el-option
                  v-for="dict in dict.type.sim_sim_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-button
              type="primary"
              plain
              size="mini"
              @click="clearFaultChange(row,0,'all')"
            >清除所有模拟器故障</el-button>
          </el-col>
        </el-row>
        <el-table
          :data="tableData1"
          :span-method="objectSpanMethod1"
          border
          style="width:100%;text-align:center;margin-left:10px;" @selection-change="handleSelectionChange">
          <el-table-column
            prop="gzxx"
            label="故障现象">
          </el-table-column>
          <el-table-column label-width="100px"
            prop="buwei"
            label="故障部位">
          </el-table-column>
          <el-table-column
            prop="value1"
            label="1号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value1==1">有</span>
              <span class="text-danger" v-if="scope.row.value1==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value1==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,1,'name1')"
              >清除</el-button>
            </template>
          </el-table-column>

          <el-table-column
            prop="value2"
            label="2号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value2==1">有</span>
              <span class="text-danger" v-if="scope.row.value2==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value2==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,2,'name2')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value3"
            label="3号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value3==1">有</span>
              <span class="text-danger" v-if="scope.row.value3==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value3==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,3,'name3')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value4"
            label="4号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value4==1">有</span>
              <span class="text-danger" v-if="scope.row.value4==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value4==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,4,'name4')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value5"
            label="5号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value5==1">有</span>
              <span class="text-danger" v-if="scope.row.value5==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value5==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,5,'name5')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value6"
            label="6号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value6==1">有</span>
              <span class="text-danger" v-if="scope.row.value6==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value6==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,6,'name6')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value7"
            label="7号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value7==1">有</span>
              <span class="text-danger" v-if="scope.row.value7==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value7==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,7,'name7')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value8"
            label="8号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value8==1">有</span>
              <span class="text-danger" v-if="scope.row.value8==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value8==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,8,'name8')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value9"
            label="9号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value9==1">有</span>
              <span class="text-danger" v-if="scope.row.value9==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value9==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,9,'name9')"
              >清除</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="value10"
            label="10号坐席">
            <template slot-scope="scope">
              <span class="text-navy" v-if="scope.row.value10==1">有</span>
              <span class="text-danger" v-if="scope.row.value10==2">无</span>
              <el-button
                type="primary" v-if="scope.row.value10==1"
                plain
                size="mini"
                style="margin-left:10px;"
                @click="clearFaultChange(scope.row,10,'name10')"
              >清除</el-button>
            </template>
          </el-table-column>

        </el-table>
      </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>

  </div>
</template>
<style>
  .el-table__header tr th .cell{
    text-align: center;
  }
  .el-table__row .cell {
    text-align: center;
  }
</style>
<script>
import { listTask,simTypeTask,addTask,updateTask,delTask,getTask } from "@/api/sim/task";
import { getToken } from "@/utils/auth";

export default {
  name: "Task",
  dicts: ['sim_sim_type'],
  data() {
    return {
      multipleSelection: [],
      selectedEquip: '',
      selectedZjEquip: '',
      tableData: [
        // {
        //   ids:1,
        //   xinghao: 'FZD04B型侦毒器',
        //   xianxiang: '开机无响应',
        //   name: '1.电源开关',
        // },{
        //   ids:2,
        //   name: '2.DC/DC转换芯片',
        // },{
        //   ids:3,
        //   xianxiang: '开机后按抽气开关，微电机不工作',
        //   name: '3.微电机',
        // },{
        //   ids:4,
        //   name: '4.Q2',
        // },{
        //   ids:5,
        //   xianxiang: '抽气流量不足',
        //   name: '5.滤网',
        // },{
        //   ids:6,
        //   name: '6.调速电位器',
        // },{
        //   ids:7,
        //   xianxiang: '开机后按下加热开关，加热灯不亮，也未加热',
        //   name: '7.加热指示灯',
        // },{
        //   ids:8,
        //   name: '8.热敏开关',
        // },
        // {
        //   ids:9,
        //   xianxiang: '不能正常工作',
        //   name: '9.外壳及零件',
        // },{
        //   ids:10,
        //   xianxiang: '电压低',
        //   name: '10.供电模块',
        // },{
        //   ids:11,
        //   xianxiang: '抽气指示灯不亮',
        //   name: '11.抽气指示灯',
        // },

        // {
        //   ids:21,
        //   xinghao:'FZB006型毒剂报警器',
        //   xianxiang: '仪器无法开机',
        //   name: '1.薄膜开关FPC排线',
        // },{
        //   ids:22,
        //   name: '2.主控板开机电路',
        // },
        // {
        //   ids:23,
        //   xianxiang: '蜂鸣器自检时，声音异常',
        //   name: '3.蜂鸣器出声口',
        // },{
        //   ids:24,
        //   name: '4.接口接线板',
        // },{
        //   ids:25,
        //   xianxiang: '仪器进入检测界面后，通入检测剂不报警',
        //   name: '5.检测剂',
        // },{
        //   ids:26,
        //   name: '6.主控板信号采集电路',
        // },
        // {
        //   ids:27,
        //   xianxiang: '显示屏无显示',
        //   name: '7.主控板显示屏供电电路',
        // },{
        //   ids:28,
        //   name: '8.显示屏',
        // },
        // {
        //   ids:29,
        //   xianxiang: '长时间不进入“检测中”',
        //   name: '9.干燥管',
        // },{
        //   ids:210,
        //   name: '10.维护管',
        // },
        // {
        //   ids:211,
        //   xianxiang: '不能正常工作',
        //   name: '11.外壳及零件',
        // },{
        //   ids:212,
        //   xianxiang: '电压低',
        //   name: '12.供电模块',
        // },{
        //   ids:213,
        //   xianxiang: '无法开机',
        //   name: '13.DC/DC',
        // },

        // {
        //   ids:31,
        //   xinghao: '防化兵用毒剂报警器',
        //   xianxiang: '仪器无法开机',
        //   name: '1.FFC排线',
        // },{
        //   ids:32,
        //   name: '2.汇总主控板',
        // },{
        //   ids:33,
        //   xianxiang: '开机后，显示屏无显示',
        //   name: '3.显控报警板',
        // },{
        //   ids:34,
        //   name: '4.显示屏',
        // },{
        //   ids:35,
        //   xianxiang: '检测状态下模拟剂不报警',
        //   name: '5.汇总主控板信号采集电路',
        // },{
        //   ids:36,
        //   name: '6.检测剂',
        // },{
        //   ids:37,
        //   xianxiang: '长时间不能进入检测状态',
        //   name: '7.干燥管',
        // },{
        //   ids:38,
        //   name: '8.维护管',
        // },{
        //   ids:39,
        //   xianxiang: '固液检测/气体检测模式切换失败',
        //   name: '9.固液检测单元与主控板连接线',
        // },{
        //   ids:310,
        //   name: '10.汇总主控板固液通信电路',
        // },{
        //   ids:311,
        //   name: '11.切换按键',
        // },{
        //   ids:312,
        //   xianxiang: '有毒有害气体检测模块不报警',
        //   name: '12.高压驱动板与汇总主控板连接线',
        // },{
        //   ids:313,
        //   name: '13.汇总主控板毒害模块通信电路',
        // },{
        //   ids:314,
        //   xianxiang: '不能正常工作',
        //   name: '14.外壳及零件',
        // },{
        //   ids:315,
        //   xianxiang: '电压低',
        //   name: '15.供电模块',
        // },{
        //   ids:316,
        //   xianxiang: '无法开机',
        //   name: '16.DC/DC',
        // },
      ],
      tableData1: [{
        gzxx: '开机无响应',
        buwei: '1.电源开关',
        name1:1,
        value1:1,
        name2:1,
        value2:2,
        name3:1,
        value3:1,
        name4:1,
        value4:1,
        name5:1,
        value5:1,
        name6:1,
        value6:1,
        name7:1,
        value7:1,
        name8:1,
        value8:1,
        name9:1,
        value9:1,
        name10:1,
        value10:1,
      },{
        buwei: '2.DC/DC转换芯片',
        name1:2,
        name2:2,
        name3:2,
        name4:2,
        name5:2,
        name6:2,
        name7:2,
        name8:2,
        name9:2,
        name10:2,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        gzxx: '开机后按抽气开关，微电机不工作',
        buwei: '3.微电机',
        name1:3,
        name2:3,
        name3:3,
        name4:3,
        name5:3,
        name6:3,
        name7:3,
        name8:3,
        name9:3,
        name10:3,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '4.Q2',
        name1:4,
        name2:4,
        name3:4,
        name4:4,
        name5:4,
        name6:4,
        name7:4,
        name8:4,
        name9:4,
        name10:4,
        value1:2,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:1,
        value9:1,
        value10:1,
      },{
        gzxx: '抽气流量不足',
        buwei: '5.滤网',
        name1:5,
        name2:5,
        name3:5,
        name4:5,
        name5:5,
        name6:5,
        name7:5,
        name8:5,
        name9:5,
        name10:5,
        value1:2,
        value2:2,
        value3:2,
        value4:2,
        value5:1,
        value6:1,
        value7:1,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '6.调速电位器',
        name1:6,
        name2:6,
        name3:6,
        name4:6,
        name5:6,
        name6:6,
        name7:6,
        name8:6,
        name9:6,
        name10:6,
        value1:1,
        value2:1,
        value3:1,
        value4:1,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '开机后按下加热开关，加热灯不亮，也未加热',
        buwei: '7.加热指示灯',
        name1:7,
        name2:7,
        name3:7,
        name4:7,
        name5:7,
        name6:7,
        name7:7,
        name8:7,
        name9:7,
        name10:7,
        value1:1,
        value2:1,
        value3:2,
        value4:1,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '8.热敏开关',
        name1:8,
        name2:8,
        name3:8,
        name4:8,
        name5:8,
        name6:8,
        name7:8,
        name8:8,
        name9:8,
        name10:8,
        value1:2,
        value2:1,
        value3:2,
        value4:1,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:1,
      },
      {
        gzxx: '不能正常工作',
        buwei: '9.外壳及零件',
        name1:9,
        name2:9,
        name3:9,
        name4:9,
        name5:9,
        name6:9,
        name7:9,
        name8:9,
        name9:9,
        name10:9,
        value1:1,
        value2:2,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:1,
        value9:1,
        value10:1,
      },{
        gzxx: '电压低',
        buwei: '10.供电模块',
        name1:10,
        name2:10,
        name3:10,
        name4:10,
        name5:10,
        name6:10,
        name7:10,
        name8:10,
        name9:10,
        name10:10,
        value1:2,
        value2:1,
        value3:2,
        value4:1,
        value5:1,
        value6:2,
        value7:1,
        value8:1,
        value9:1,
        value10:1,
      },{
        gzxx: '抽气指示灯不亮',
        buwei: '11.抽气指示灯',
        name1:11,
        name2:11,
        name3:11,
        name4:11,
        name5:11,
        name6:11,
        name7:11,
        name8:11,
        name9:11,
        name10:11,
        value1:2,
        value2:2,
        value3:1,
        value4:1,
        value5:1,
        value6:2,
        value7:1,
        value8:1,
        value9:2,
        value10:1,
      },



      {
        gzxx: '仪器无法开机',
        buwei: '1.薄膜开关FPC排线',
        name1:21,
        name2:21,
        name3:21,
        name4:21,
        name5:21,
        name6:21,
        name7:21,
        name8:21,
        name9:21,
        name10:21,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '2.主控板开机电路',
        name1:22,
        name2:22,
        name3:22,
        name4:22,
        name5:22,
        name6:22,
        name7:22,
        name8:22,
        name9:22,
        name10:22,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },
      {
        gzxx: '蜂鸣器自检时，声音异常',
        buwei: '3.蜂鸣器出声口',
        name1:23,
        name2:23,
        name3:23,
        name4:23,
        name5:23,
        name6:23,
        name7:23,
        name8:23,
        name9:23,
        name10:23,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '4.接口接线板',
        name1:24,
        name2:24,
        name3:24,
        name4:24,
        name5:24,
        name6:24,
        name7:24,
        name8:24,
        name9:24,
        name10:24,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        gzxx: '仪器进入检测界面后，通入检测剂不报警',
        buwei: '5.检测剂',
        name1:25,
        name2:25,
        name3:25,
        name4:25,
        name5:25,
        name6:25,
        name7:25,
        name8:25,
        name9:25,
        name10:25,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '6.主控板信号采集电路',
        name1:26,
        name2:26,
        name3:26,
        name4:26,
        name5:26,
        name6:26,
        name7:26,
        name8:26,
        name9:26,
        name10:26,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },
      {
        gzxx: '显示屏无显示',
        buwei: '7.主控板显示屏供电电路',
        name1:27,
        name2:27,
        name3:27,
        name4:27,
        name5:27,
        name6:27,
        name7:27,
        name8:27,
        name9:27,
        name10:27,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '8.显示屏',
        name1:28,
        name2:28,
        name3:28,
        name4:28,
        name5:28,
        name6:28,
        name7:28,
        name8:28,
        name9:28,
        name10:28,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },
      {
        gzxx: '长时间不进入“检测中”',
        buwei: '9.干燥管',
        name1:29,
        name2:29,
        name3:29,
        name4:29,
        name5:29,
        name6:29,
        name7:29,
        name8:29,
        name9:29,
        name10:29,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        buwei: '10.维护管',
        name1:210,
        name2:210,
        name3:210,
        name4:210,
        name5:210,
        name6:210,
        name7:210,
        name8:210,
        name9:210,
        name10:210,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },
      {
        gzxx: '不能正常工作',
        buwei: '11.外壳及零件',
        name1:211,
        name2:211,
        name3:211,
        name4:211,
        name5:211,
        name6:211,
        name7:211,
        name8:211,
        name9:211,
        name10:211,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        gzxx: '电压低',
        buwei: '12.供电模块',
        name1:212,
        name2:212,
        name3:212,
        name4:212,
        name5:212,
        name6:212,
        name7:212,
        name8:212,
        name9:212,
        name10:212,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },{
        gzxx: '无法开机',
        buwei: '13.DC/DC',
        name1:213,
        name2:213,
        name3:213,
        name4:213,
        name5:213,
        name6:213,
        name7:213,
        name8:213,
        name9:213,
        name10:213,
        value1:1,
        value2:1,
        value3:2,
        value4:2,
        value5:1,
        value6:2,
        value7:2,
        value8:2,
        value9:1,
        value10:1,
      },


      {
        gzxx: '仪器无法开机',
        buwei: '1.FFC排线',
        name1:31,
        name2:31,
        name3:31,
        name4:31,
        name5:31,
        name6:31,
        name7:31,
        name8:31,
        name9:31,
        name10:31,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '2.汇总主控板',
        name1:32,
        name2:32,
        name3:32,
        name4:32,
        name5:32,
        name6:32,
        name7:32,
        name8:32,
        name9:32,
        name10:32,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '开机后，显示屏无显示',
        buwei: '3.显控报警板',
        name1:33,
        name2:33,
        name3:33,
        name4:33,
        name5:33,
        name6:33,
        name7:33,
        name8:33,
        name9:33,
        name10:33,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '4.显示屏',
        name1:34,
        name2:34,
        name3:34,
        name4:34,
        name5:34,
        name6:34,
        name7:34,
        name8:34,
        name9:34,
        name10:34,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '检测状态下模拟剂不报警',
        buwei: '5.汇总主控板信号采集电路',
        name1:35,
        name2:35,
        name3:35,
        name4:35,
        name5:35,
        name6:35,
        name7:35,
        name8:35,
        name9:35,
        name10:35,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '6.检测剂',
        name1:36,
        name2:36,
        name3:36,
        name4:36,
        name5:36,
        name6:36,
        name7:36,
        name8:36,
        name9:36,
        name10:36,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '长时间不能进入检测状态',
        buwei: '7.干燥管',
        name1:37,
        name2:37,
        name3:37,
        name4:37,
        name5:37,
        name6:37,
        name7:37,
        name8:37,
        name9:37,
        name10:37,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '8.维护管',
        name1:38,
        name2:38,
        name3:38,
        name4:38,
        name5:38,
        name6:38,
        name7:38,
        name8:38,
        name9:38,
        name10:38,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '固液检测/气体检测模式切换失败',
        buwei: '9.固液检测单元与主控板连接线',
        name1:39,
        name2:39,
        name3:39,
        name4:39,
        name5:39,
        name6:39,
        name7:39,
        name8:39,
        name9:39,
        name10:39,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '10.汇总主控板固液通信电路',
        name1:310,
        name2:310,
        name3:310,
        name4:310,
        name5:310,
        name6:310,
        name7:310,
        name8:310,
        name9:310,
        name10:310,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '11.切换按键',
        name1:311,
        name2:311,
        name3:311,
        name4:311,
        name5:311,
        name6:311,
        name7:311,
        name8:311,
        name9:311,
        name10:311,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '有毒有害气体检测模块不报警',
        buwei: '12.高压驱动板与汇总主控板连接线',
        name1:312,
        name2:312,
        name3:312,
        name4:312,
        name5:312,
        name6:312,
        name7:312,
        name8:312,
        name9:312,
        name10:312,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        buwei: '13.汇总主控板毒害模块通信电路',
        name1:313,
        name2:313,
        name3:313,
        name4:313,
        name5:313,
        name6:313,
        name7:313,
        name8:313,
        name9:313,
        name10:313,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '不能正常工作',
        buwei: '14.外壳及零件',
        name1:314,
        name2:314,
        name3:314,
        name4:314,
        name5:314,
        name6:314,
        name7:314,
        name8:314,
        name9:314,
        name10:314,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '电压低',
        buwei: '15.供电模块',
        name1:315,
        name2:315,
        name3:315,
        name4:315,
        name5:315,
        name6:315,
        name7:315,
        name8:315,
        name9:315,
        name10:315,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },{
        gzxx: '无法开机',
        buwei: '16.DC/DC',
        name1:316,
        name2:316,
        name3:316,
        name4:316,
        name5:316,
        name6:316,
        name7:316,
        name8:316,
        name9:316,
        name10:316,
        value1:2,
        value2:1,
        value3:1,
        value4:2,
        value5:1,
        value6:2,
        value7:1,
        value8:2,
        value9:1,
        value10:2,
      },

      ],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户表格数据
      userList: null,
      // 弹出层标题
      title: "",
      // 部门树选项
      deptOptions: undefined,
      // 是否显示弹出层
      open: false,
      //自检弹出框
      zijianopen:false,
      // 详情弹出框
      openview:false,
      // 部门名称
      deptName: undefined,
      // 默认密码
      initPassword: undefined,
      // 日期范围
      dateRange: [],
      // 岗位选项
      postOptions: [],
      // 角色选项
      roleOptions: [],
      // 表单参数
      form: {
        simType:''
      },
      defaultProps: {
        children: "children",
        label: "label"
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined
      },
      // 列信息
      columns: [
        { key: 0, label: `编号`, visible: true },
        { key: 1, label: `任务名称`, visible: true },
        { key: 2, label: `模拟器型号`, visible: true },
        { key: 3, label: `故障现象数量`, visible: true },
        { key: 4, label: `故障部位数量`, visible: true },
        { key: 5, label: `创建者`, visible: true },
        { key: 6, label: `备注`, visible: true },
        { key: 7, label: `创建时间`, visible: true }
      ],
      // 表单校验
      rules: {
        name: [
          { required: true, message: "任务名称不能为空", trigger: "blur" },
        ],
        simType: [
          { required: true, message: "模拟器型号不能为空", trigger: "change"}
        ],

      }
    };
  },
  watch: {
    // 根据名称筛选部门树
    deptName(val) {
      this.$refs.tree.filter(val);
    },
    selectedZjEquip(newValue) {
      // console.log(newValue);
      // 根据newValue更新tableData
      // this.tableData = this.getNewTableData(newValue);
      // console.log(this.getNewTableData(newValue);
      if(newValue == 1){
        this.tableData1 = [{
          gzxx: '开机无响应',
          buwei: '1.电源开关',
          name1:1,
          value1:1,
          name2:1,
          value2:2,
          name3:1,
          value3:1,
          name4:1,
          value4:1,
          name5:1,
          value5:1,
          name6:1,
          value6:1,
          name7:1,
          value7:1,
          name8:1,
          value8:1,
          name9:1,
          value9:1,
          name10:1,
          value10:1,
        },{
          buwei: '2.DC/DC转换芯片',
          name1:2,
          name2:2,
          name3:2,
          name4:2,
          name5:2,
          name6:2,
          name7:2,
          name8:2,
          name9:2,
          name10:2,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          gzxx: '开机后按抽气开关，微电机不工作',
          buwei: '3.微电机',
          name1:3,
          name2:3,
          name3:3,
          name4:3,
          name5:3,
          name6:3,
          name7:3,
          name8:3,
          name9:3,
          name10:3,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '4.Q2',
          name1:4,
          name2:4,
          name3:4,
          name4:4,
          name5:4,
          name6:4,
          name7:4,
          name8:4,
          name9:4,
          name10:4,
          value1:2,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:1,
          value9:1,
          value10:1,
        },{
          gzxx: '抽气流量不足',
          buwei: '5.滤网',
          name1:5,
          name2:5,
          name3:5,
          name4:5,
          name5:5,
          name6:5,
          name7:5,
          name8:5,
          name9:5,
          name10:5,
          value1:2,
          value2:2,
          value3:2,
          value4:2,
          value5:1,
          value6:1,
          value7:1,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '6.调速电位器',
          name1:6,
          name2:6,
          name3:6,
          name4:6,
          name5:6,
          name6:6,
          name7:6,
          name8:6,
          name9:6,
          name10:6,
          value1:1,
          value2:1,
          value3:1,
          value4:1,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '开机后按下加热开关，加热灯不亮，也未加热',
          buwei: '7.加热指示灯',
          name1:7,
          name2:7,
          name3:7,
          name4:7,
          name5:7,
          name6:7,
          name7:7,
          name8:7,
          name9:7,
          name10:7,
          value1:1,
          value2:1,
          value3:2,
          value4:1,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '8.热敏开关',
          name1:8,
          name2:8,
          name3:8,
          name4:8,
          name5:8,
          name6:8,
          name7:8,
          name8:8,
          name9:8,
          name10:8,
          value1:2,
          value2:1,
          value3:2,
          value4:1,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:1,
        },
        {
          gzxx: '不能正常工作',
          buwei: '9.外壳及零件',
          name1:9,
          name2:9,
          name3:9,
          name4:9,
          name5:9,
          name6:9,
          name7:9,
          name8:9,
          name9:9,
          name10:9,
          value1:1,
          value2:2,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:1,
          value9:1,
          value10:1,
        },{
          gzxx: '电压低',
          buwei: '10.供电模块',
          name1:10,
          name2:10,
          name3:10,
          name4:10,
          name5:10,
          name6:10,
          name7:10,
          name8:10,
          name9:10,
          name10:10,
          value1:2,
          value2:1,
          value3:2,
          value4:1,
          value5:1,
          value6:2,
          value7:1,
          value8:1,
          value9:1,
          value10:1,
        },{
          gzxx: '抽气指示灯不亮',
          buwei: '11.抽气指示灯',
          name1:11,
          name2:11,
          name3:11,
          name4:11,
          name5:11,
          name6:11,
          name7:11,
          name8:11,
          name9:11,
          name10:11,
          value1:2,
          value2:2,
          value3:1,
          value4:1,
          value5:1,
          value6:2,
          value7:1,
          value8:1,
          value9:2,
          value10:1,
        }]
      }else if(newValue==2){
        this.tableData1 = [{
          gzxx: '仪器无法开机',
          buwei: '1.薄膜开关FPC排线',
          name1:21,
          name2:21,
          name3:21,
          name4:21,
          name5:21,
          name6:21,
          name7:21,
          name8:21,
          name9:21,
          name10:21,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '2.主控板开机电路',
          name1:22,
          name2:22,
          name3:22,
          name4:22,
          name5:22,
          name6:22,
          name7:22,
          name8:22,
          name9:22,
          name10:22,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },
        {
          gzxx: '蜂鸣器自检时，声音异常',
          buwei: '3.蜂鸣器出声口',
          name1:23,
          name2:23,
          name3:23,
          name4:23,
          name5:23,
          name6:23,
          name7:23,
          name8:23,
          name9:23,
          name10:23,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '4.接口接线板',
          name1:24,
          name2:24,
          name3:24,
          name4:24,
          name5:24,
          name6:24,
          name7:24,
          name8:24,
          name9:24,
          name10:24,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          gzxx: '仪器进入检测界面后，通入检测剂不报警',
          buwei: '5.检测剂',
          name1:25,
          name2:25,
          name3:25,
          name4:25,
          name5:25,
          name6:25,
          name7:25,
          name8:25,
          name9:25,
          name10:25,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '6.主控板信号采集电路',
          name1:26,
          name2:26,
          name3:26,
          name4:26,
          name5:26,
          name6:26,
          name7:26,
          name8:26,
          name9:26,
          name10:26,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },
        {
          gzxx: '显示屏无显示',
          buwei: '7.主控板显示屏供电电路',
          name1:27,
          name2:27,
          name3:27,
          name4:27,
          name5:27,
          name6:27,
          name7:27,
          name8:27,
          name9:27,
          name10:27,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '8.显示屏',
          name1:28,
          name2:28,
          name3:28,
          name4:28,
          name5:28,
          name6:28,
          name7:28,
          name8:28,
          name9:28,
          name10:28,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },
        {
          gzxx: '长时间不进入“检测中”',
          buwei: '9.干燥管',
          name1:29,
          name2:29,
          name3:29,
          name4:29,
          name5:29,
          name6:29,
          name7:29,
          name8:29,
          name9:29,
          name10:29,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          buwei: '10.维护管',
          name1:210,
          name2:210,
          name3:210,
          name4:210,
          name5:210,
          name6:210,
          name7:210,
          name8:210,
          name9:210,
          name10:210,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },
        {
          gzxx: '不能正常工作',
          buwei: '11.外壳及零件',
          name1:211,
          name2:211,
          name3:211,
          name4:211,
          name5:211,
          name6:211,
          name7:211,
          name8:211,
          name9:211,
          name10:211,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          gzxx: '电压低',
          buwei: '12.供电模块',
          name1:212,
          name2:212,
          name3:212,
          name4:212,
          name5:212,
          name6:212,
          name7:212,
          name8:212,
          name9:212,
          name10:212,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        },{
          gzxx: '无法开机',
          buwei: '13.DC/DC',
          name1:213,
          name2:213,
          name3:213,
          name4:213,
          name5:213,
          name6:213,
          name7:213,
          name8:213,
          name9:213,
          name10:213,
          value1:1,
          value2:1,
          value3:2,
          value4:2,
          value5:1,
          value6:2,
          value7:2,
          value8:2,
          value9:1,
          value10:1,
        }]
      }else if(newValue==3){
        this.tableData1 = [{
          gzxx: '仪器无法开机',
          buwei: '1.FFC排线',
          name1:31,
          name2:31,
          name3:31,
          name4:31,
          name5:31,
          name6:31,
          name7:31,
          name8:31,
          name9:31,
          name10:31,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '2.汇总主控板',
          name1:32,
          name2:32,
          name3:32,
          name4:32,
          name5:32,
          name6:32,
          name7:32,
          name8:32,
          name9:32,
          name10:32,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '开机后，显示屏无显示',
          buwei: '3.显控报警板',
          name1:33,
          name2:33,
          name3:33,
          name4:33,
          name5:33,
          name6:33,
          name7:33,
          name8:33,
          name9:33,
          name10:33,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '4.显示屏',
          name1:34,
          name2:34,
          name3:34,
          name4:34,
          name5:34,
          name6:34,
          name7:34,
          name8:34,
          name9:34,
          name10:34,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '检测状态下模拟剂不报警',
          buwei: '5.汇总主控板信号采集电路',
          name1:35,
          name2:35,
          name3:35,
          name4:35,
          name5:35,
          name6:35,
          name7:35,
          name8:35,
          name9:35,
          name10:35,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '6.检测剂',
          name1:36,
          name2:36,
          name3:36,
          name4:36,
          name5:36,
          name6:36,
          name7:36,
          name8:36,
          name9:36,
          name10:36,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '长时间不能进入检测状态',
          buwei: '7.干燥管',
          name1:37,
          name2:37,
          name3:37,
          name4:37,
          name5:37,
          name6:37,
          name7:37,
          name8:37,
          name9:37,
          name10:37,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '8.维护管',
          name1:38,
          name2:38,
          name3:38,
          name4:38,
          name5:38,
          name6:38,
          name7:38,
          name8:38,
          name9:38,
          name10:38,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '固液检测/气体检测模式切换失败',
          buwei: '9.固液检测单元与主控板连接线',
          name1:39,
          name2:39,
          name3:39,
          name4:39,
          name5:39,
          name6:39,
          name7:39,
          name8:39,
          name9:39,
          name10:39,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '10.汇总主控板固液通信电路',
          name1:310,
          name2:310,
          name3:310,
          name4:310,
          name5:310,
          name6:310,
          name7:310,
          name8:310,
          name9:310,
          name10:310,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '11.切换按键',
          name1:311,
          name2:311,
          name3:311,
          name4:311,
          name5:311,
          name6:311,
          name7:311,
          name8:311,
          name9:311,
          name10:311,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '有毒有害气体检测模块不报警',
          buwei: '12.高压驱动板与汇总主控板连接线',
          name1:312,
          name2:312,
          name3:312,
          name4:312,
          name5:312,
          name6:312,
          name7:312,
          name8:312,
          name9:312,
          name10:312,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          buwei: '13.汇总主控板毒害模块通信电路',
          name1:313,
          name2:313,
          name3:313,
          name4:313,
          name5:313,
          name6:313,
          name7:313,
          name8:313,
          name9:313,
          name10:313,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '不能正常工作',
          buwei: '14.外壳及零件',
          name1:314,
          name2:314,
          name3:314,
          name4:314,
          name5:314,
          name6:314,
          name7:314,
          name8:314,
          name9:314,
          name10:314,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '电压低',
          buwei: '15.供电模块',
          name1:315,
          name2:315,
          name3:315,
          name4:315,
          name5:315,
          name6:315,
          name7:315,
          name8:315,
          name9:315,
          name10:315,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        },{
          gzxx: '无法开机',
          buwei: '16.DC/DC',
          name1:316,
          name2:316,
          name3:316,
          name4:316,
          name5:316,
          name6:316,
          name7:316,
          name8:316,
          name9:316,
          name10:316,
          value1:2,
          value2:1,
          value3:1,
          value4:2,
          value5:1,
          value6:2,
          value7:1,
          value8:2,
          value9:1,
          value10:2,
        }]
      }
    }
  },
  created() {
    this.getList();
  },
  methods: {
    // 选择型号，循环故障清单
    selectSimType(val){
      console.log(val);
      console.log('newValue');
      simTypeTask(val).then(response => {
        console.log(response.data)
        console.log('response')
        // let jsonString = '';
        // const obj = {};
        // for (let i = 0; i < 6; i++) {
        //   obj[i] = response.data.selectedData[i]['name'];
        // }
        // console.log(obj)
        // jsonString = JSON.stringify(obj);

       

        const arr = [];
        arr['ids'] = 1;
        arr['xinghao'] = 'FZD04B型侦毒器';
        arr['xianxiang'] = '开机无响应';
        arr['name'] = '1.电源开关';
        console.log(arr);
        console.log(JSON.stringify(arr));
        console.log('JSON.stringify(arr)');
        this.tableData = [{
          ids:1,
          xinghao: 'FZD04B型侦毒器',
          xianxiang: '开机无响应',
          name: '1.电源开关',
        }];
      });

      // {
        //   ids:1,
        //   xinghao: 'FZD04B型侦毒器',
        //   xianxiang: '开机无响应',
        //   name: '1.电源开关',
        // },

    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      // console.log(this.selectedEquip+'@@@')
      //第一列型号
      if(columnIndex === 0) {
        if(this.selectedEquip==2){
          if(rowIndex==0){
            return { rowspan: 13, colspan: 1 };
          }
          return { rowspan: 0, colspan: 0 };
        }else if(this.selectedEquip==3){
          if(rowIndex==0){
            return { rowspan: 16, colspan: 1 };
          }
          return { rowspan: 0, colspan: 0};
        }else{
          if(rowIndex==0){
            return { rowspan: 11, colspan: 1 };
          }else if(rowIndex==11){
            return { rowspan: 13, colspan: 1 };
          }else if(rowIndex==24){
            return { rowspan: 16, colspan: 1 };
          }else{
            return { rowspan: 0, colspan: 0 };
          }
        }
      }

      //第二列故障现象
      if(columnIndex === 1) {
        if(this.selectedEquip==2){
          // console.log(rowIndex+'####')
          if(rowIndex<9 && rowIndex % 2 === 0){
            return { rowspan: 2, colspan: 1 };
          }else if((rowIndex>9&&rowIndex<13)){
            return { rowspan: 1, colspan: 1 };
          }else{
            return { rowspan: 0, colspan: 0 };
          }
        }else if(this.selectedEquip==3){
          if(rowIndex<7 && rowIndex % 2 === 0){
            return { rowspan: 2, colspan: 1 };
          }else if((rowIndex==8)){
            return { rowspan: 3, colspan: 1 };
          }else if(rowIndex==11){
            return { rowspan: 2, colspan: 1 };
          }else if(rowIndex>12 && rowIndex<16){
            return { rowspan: 1, colspan: 1 };
          }else{
            return { rowspan: 0, colspan: 0 };
          }
        }else{
          if(rowIndex<7 && rowIndex % 2 === 0){
            return { rowspan: 2, colspan: 1 };
          }else if((rowIndex>7&&rowIndex<11) || (rowIndex>20&&rowIndex<24) || (rowIndex>36)){
            return { rowspan: 1, colspan: 1 };
          }else if((rowIndex==35) || (rowIndex>10 && rowIndex<20) && rowIndex % 2 === 1){
            return { rowspan: 2, colspan: 1 };
          }else if(rowIndex>23 && rowIndex<32 && rowIndex % 2 === 0){
            return { rowspan: 2, colspan: 1 };
          }else if(rowIndex==32){
            return { rowspan: 3, colspan: 1 };
          }else{
            return { rowspan: 0, colspan: 0 };
          }
        }

      }
      //故障部位 和 选择
      if(columnIndex === 2 || columnIndex === 3){
        //return { rowspan: 1, colspan: 1 };
      }
    },

    objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
      //第二列故障现象
      if(columnIndex === 0) {
        if(rowIndex<7 && rowIndex % 2 === 0){
          return { rowspan: 2, colspan: 1 };
        }else if((rowIndex>7&&rowIndex<11) || (rowIndex>20&&rowIndex<24) || (rowIndex>36)){
          return { rowspan: 1, colspan: 1 };
        }else if((rowIndex==35) || (rowIndex>10 && rowIndex<20) && rowIndex % 2 === 1){
          return { rowspan: 2, colspan: 1 };
        }else if(rowIndex>23 && rowIndex<32 && rowIndex % 2 === 0){
          return { rowspan: 2, colspan: 1 };
        }else if(rowIndex==32){
          return { rowspan: 3, colspan: 1 };
        }else{
          return { rowspan: 0, colspan: 0 };
        }
      }
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
          console.log(row.ids+'###')
          console.log(row.name+'@@@')
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionRow(val) {
      this.multipleSelection = val;
    },
    /** 查询用户列表 */
    getList() {
      this.loading = true;
      listTask(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
          //将返回值注释
          this.userList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTreeSelect().then(response => {
        this.deptOptions = response.data;
      });
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    //清除故障
    clearFaultChange(row,number,nametext){
      console.log()
      // console.log(nametext+'###')
      // console.log(row[nametext]+'@@@')
      // console.log(row.name1+'@@@')
      let text1 = '清除所有模拟器故障';
      console.log(nametext + '###name1');
      if(nametext != 'all'){
        text1 = '清除'+ number +'号坐席模拟器故障';
      }
      this.$modal.confirm('确认要"' + text1 + '"吗？').then(function() {
        // return changeUserStatus(row.userId, row.status);
      }).then(() => {
        this.$modal.msgSuccess(text1 + "成功");
      }).catch(function() {
        // row.status = row.status === "0" ? "1" : "0";
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.openview = false;
      this.zijianopen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        taskId: undefined,
        name: undefined,
        simType:undefined,
        taskType:1,
        // postIds: [],
        // roleIds: []
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.taskId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    // 更多操作触发
    handleCommand(command, row) {
      switch (command) {
        case "handleResetPwd":
          this.handleResetPwd(row);
          break;
        case "handleAuthRole":
          this.handleAuthRole(row);
          break;
        default:
          break;
      }
    },
    /** 新增按钮操作 */
    handleAdd() {
      // this.$tab.openPage("用户管理", "/system/user");
      this.reset();
      this.open = true;
      this.title = "新增训练任务";
    },
    /* 故障设置自检 **/
    handleInspect() {
      this.reset();
      // getUser().then(response => {
        //this.postOptions = response.posts;
        //this.roleOptions = response.roles;
        this.zijianopen = true;
        this.title = "故障设置自检";
      // });
    },

    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const taskId = row.taskId || this.ids;
      getTask(taskId).then(response => {
        this.form = response.data;
        // this.postOptions = response.posts;
        // this.roleOptions = response.roles;
        // this.$set(this.form, "postIds", response.postIds);
        // this.$set(this.form, "roleIds", response.roleIds);
        this.open = true;
        this.title = "修改任务";
        // this.form.password = "";
      });
    },
    /** 详情按钮操作 */
    handleView(row) {
      this.reset();
      const taskId = row.taskId || this.ids;
      getTask(taskId).then(response => {
        this.form = response.data;
        this.openview = true;
        this.title = "任务详情";
      });
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.taskId != undefined) {
            updateTask(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            console.log(this.form);
            addTask(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const taskIds = row.taskId || this.ids;
      this.$modal.confirm('是否确认删除编号为"' + taskIds + '"的数据项？').then(function() {
        return delTask(taskIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    // //训练任务下发
    // handleIssued(row) {
    //   const userIds = row.userId || this.ids;
    //   this.$modal.confirm('是否确定编号为"' + userIds + '"的训练任务？').then(function() {
    //     //return delUser(userIds);
    //   }).then(() => {
    //     this.getList();
    //     this.$modal.msgSuccess("删除成功");
    //   }).catch(() => {});
    // },

  }
};
</script>
