<template>
  <basic-container style="max-height: 800px;overflow: hidden;">
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="form"
      :permission="permissionList" :before-open="beforeOpen" :before-close="beforeClose"
      @selection-change="selectionChange" @search-change="searchChange" @search-reset="searchReset"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot-scope="scope" slot="menuLeft">
        <el-button type="primary" size="small" @click="createTask">生成巡检任务</el-button>
         <el-button type="primary" size="small" @click="allExportReport">批量导出报告</el-button>
      </template>
      <template slot-scope="{ row }" slot="taskStatus">
        <!-- role_id  运维主管 1839537055389515777  维修人员 1839552581620793346 实验室管理员 1846419477876510721-->
        <el-tag :type="getStatus('inspectionTask', userInfo.role_id, row.taskStatus).type">{{
          getStatus('inspectionTask', userInfo.role_id, row.taskStatus).name }}</el-tag>
      </template>
      <template slot-scope="{ row }" slot="menu">
        <el-button @click="handleView(row)" v-show="permission.taskView">查看</el-button>
        <el-button v-show="row.taskStatus == 0 && permission.taskAssign" @click="assignUser(row)">指派</el-button>
        <el-button v-show="permission.taskAccept && row.taskStatus == 1" @click="handleAccept(row)">接单</el-button>
        <el-button v-show="permission.taskPolling && row.taskStatus == 2" @click="handleInspection(row)">巡检</el-button>
        <el-button v-show="permission.taskConfirm && row.taskStatus == 3" @click="handleuserConfirm(row)">确认</el-button>
        <el-button v-show="row.taskStatus == 4" @click="handleExport(row)">报告</el-button>
        <el-button type="primary" @click="handleExportDevice(row)">导出</el-button>
        <!--  -->
        <!-- <el-button :disabled="row.taskStatus != 1" v-show="permission.inspection_btn" @click="handleInspection(row)">巡检</el-button> -->
      </template>
    </avue-crud>
    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" :append-to-body="true" width="70%">
      <div style="height: 500px; overflow: auto">
        <el-form ref="addForm" :model="addForm" :rules="addRules" label-width="120px" label-position="left">
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              基本信息
            </div>
            <el-form-item label="单位名称" prop="deptName">
              <el-input placeholder="请输入单位名称" v-model="addForm.deptName" disabled style="width: 98%;"></el-input>
            </el-form-item>
            <!-- <el-form-item label="巡检项目名称" prop="inspectionName">
                <el-input placeholder="请输入巡检项目名称" v-model="addForm.inspectionName" disabled style="width: 98%;"></el-input>
              </el-form-item>
              <el-form-item label="项目地址" prop="projectAddr">
                <el-input placeholder="请输入项目地址" v-model="addForm.projectAddr" disabled style="width: 98%;"></el-input>
              </el-form-item> -->
          </div>
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              巡检任务
            </div>
            <el-form-item label="巡检主要内容" prop="taskContent">
              <el-input placeholder="请输入巡检主要内容" type="textarea" disabled v-model="addForm.taskContent"
                style="width: 98%;"></el-input>
            </el-form-item>
            <el-form-item label="楼层" prop="inspectionContent">
              <div style="display: flex;">
                <div v-for="item in floorArr" :key="item" @click="clickFloor(item)"
                  style="padding: 0px 15px;border: 1px solid #bbbbbb; height: 30px;display: flex;align-items: center;justify-content: center;margin-right: 10px;border-radius: 3px;cursor: pointer;"
                  :style="{ background: item == activeFloorName ? '#3a62d7' : '', color: item == activeFloorName ? '#fff' : '', borderColor: item == activeFloorName ? '#3a62d7' : '#bbb' }">
                  {{ item }}
                </div>
              </div>
            </el-form-item>
            <el-form-item label="房间" prop="inspectionContent">
              <div style="display: flex;">
                <div v-for="item in roomArr" :key="item" @click="clickRoom(item)"
                  style="padding: 0px 15px;border: 1px solid #bbbbbb; height: 30px;display: flex;align-items: center;justify-content: center;margin-right: 10px;border-radius: 3px;cursor: pointer;"
                  :style="{ background: item == activeRoom ? '#3a62d7' : '', color: item == activeRoom ? '#fff' : '', borderColor: item == activeRoom ? '#3a62d7' : '#bbb' }">
                  {{ item }}
                </div>
              </div>
            </el-form-item>
            <el-form-item label="巡检配置">
              <el-table :data="tableData" border style="width: 98%">
                <el-table-column prop="deviceId" align="center" label="专业名称">
                  <template slot-scope="scope">
                    <el-select placeholder="请选择设备" disabled v-model="scope.row.deviceId"
                      @change="((val) => { changeDevice(val, scope.$index) })">
                      <el-option v-for="item in deviceList" :disabled="item.disabled" :key="item.id" :label="item.name"
                        :value="item.id"></el-option>
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="checkContent" align="center" label="巡检内容">
                  <template slot-scope="scope">
                    <el-input placeholder="请输入巡检内容" v-model="scope.row.checkContent" disabled></el-input>
                  </template>
                </el-table-column>
                <el-table-column prop="craft" align="center" label="工艺要求">
                  <template slot-scope="scope">
                    <el-input placeholder="请输入工艺要求" v-model="scope.row.craft" disabled></el-input>
                  </template>
                </el-table-column>
                <el-table-column prop="period" align="center" label="巡检周期" v-if="addForm.taskStatus < 3">
                  <template slot-scope="scope">
                    <el-select placeholder="请选择巡检周期" v-model="scope.row.period" disabled>
                      <el-option v-for="item in periodArr" :key="item.dictKey" :label="item.dictValue"
                        :value="parseInt(item.dictKey)"></el-option>
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="startTime" align="center" label="开始时间" v-if="addForm.taskStatus < 3">
                  <template slot-scope="scope">
                    <el-date-picker style="width: 100%;" v-model="scope.row.startTime" type="date" placeholder="请选择开始时间"
                      format="yyyy-MM-dd" value-format="yyyy-MM-dd" disabled>
                    </el-date-picker>
                  </template>
                </el-table-column>
                <el-table-column prop="startTime" align="center" label="状态" v-if="addForm.taskStatus >= 3">
                  <template slot-scope="scope">
                    {{ scope.row.status == 0 ? '正常' : '异常' }}
                  </template>
                </el-table-column>
                <el-table-column prop="startTime" align="center" label="现场照片" v-if="addForm.taskStatus >= 3">
                  <template slot-scope="scope" v-if="scope.row.picUrl != ''">
                    <img :src="scope.row.picUrl" alt="" style="width: 200px;height: 200px;">
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
            <el-form-item label="使用人签字" prop="signUrl" v-if="addForm.taskStatus >= 3">
              <el-input placeholder="请输入使用人签字" v-model="addForm.signUrl" disabled style="width: 98%;"></el-input>
            </el-form-item>
            <el-form-item label="备注" prop="remark" v-if="addForm.taskStatus >= 3">
              <el-input placeholder="请输入备注" type="textarea" v-model="addForm.remark" disabled
                style="width: 98%;"></el-input>
            </el-form-item>
          </div>
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              处理情况
            </div>
            <el-form-item label="巡检人员" prop="servicemanId">
              <el-select placeholder="请选择巡检人员" :disabled="addForm.taskStatus != 0 || dialogType == '查看'"
                v-model="addForm.servicemanId" style="width: 98%;">
                <el-option v-for="item in repairPersonList" :key="item.id" :label="item.name"
                  :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div v-show="addForm.taskStatus == 1">
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              巡检配置
            </div>
            <!-- <el-form-item label="任务开始时间" prop="taskStartTime">
                <el-date-picker :disabled="dialogType == '查看'" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%;" v-model="addForm.taskStartTime" type="date" placeholder="请选择任务开始时间">
                </el-date-picker>
              </el-form-item> -->
            <el-form-item label="预约上门时间" prop="appointTime">
              <el-date-picker :disabled="dialogType == '查看'" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                style="width: 98%;" v-model="addForm.appointTime" type="date" placeholder="请选择预约上门时间">
              </el-date-picker>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">关 闭</el-button>
        <!-- <el-button v-show="dialogType != '查看'" @click="handleSave">保 存</el-button> -->
        <el-button v-show="dialogType != '查看'" type="primary" @click="handleConfirm">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog class="inspectionDialog" :title="dialogTitle" :visible.sync="dialogInspection" :append-to-body="true"
      width="70%">
      <div style="height: 500px; overflow: auto">
        <el-form ref="inspectionForm" :model="inspectionForm" :rules="inspectionRules" label-width="120px"
          label-position="left">
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              基本信息
            </div>
            <el-form-item label="单位名称" prop="deptName">
              <el-input placeholder="请输入单位名称" v-model="inspectionForm.deptName" disabled style="width: 98%;"></el-input>
            </el-form-item>
            <!-- <el-form-item label="巡检项目名称" prop="inspectionName">
                <el-input placeholder="请输入巡检项目名称" v-model="inspectionForm.inspectionName" readonly></el-input>
              </el-form-item>
              <el-form-item label="项目地址" prop="projectAddr">
                <el-input placeholder="请输入项目地址" v-model="inspectionForm.projectAddr" readonly></el-input>
              </el-form-item> -->
          </div>
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              巡检配置
            </div>
            <el-form-item label="巡检主要内容" prop="taskContent">
              <el-input placeholder="请输入巡检主要内容" type="textarea" disabled v-model="inspectionForm.taskContent"
                style="width: 98%;"></el-input>
            </el-form-item>
            <el-form-item label="任务开始时间" prop="taskStartTime">
              <el-date-picker :disabled="dialogType == '查看' || dialogTitle == '巡检任务'" style="width: 98%;"
                v-model="inspectionForm.taskStartTime" type="date" placeholder="请选择任务开始时间">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="预约上门时间" prop="reservationTime">
              <el-date-picker :disabled="dialogType == '查看' || dialogTitle == '巡检任务'" style="width: 98%;"
                v-model="inspectionForm.reservationTime" type="date" placeholder="请选择预约上门时间">
              </el-date-picker>
            </el-form-item>
          </div>
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              巡检任务
            </div>
            <el-form-item label="巡检楼层">
              <div style="display: flex; width: 98%;">
                <div v-for="item in floorArr" :key="item" @click="clickFloor(item)"
                  style="padding: 0px 15px;border: 1px solid #bbbbbb; height: 30px;display: flex;align-items: center;justify-content: center;margin-right: 10px;border-radius: 3px;cursor: pointer;"
                  :style="{ background: item == activeFloorName ? '#3a62d7' : '', color: item == activeFloorName ? '#fff' : '', borderColor: item == activeFloorName ? '#3a62d7' : '#bbb' }">
                  {{ item }}
                </div>
              </div>
            </el-form-item>
            <el-form-item label="巡检内容">
              <div style="width: 98%;margin-bottom: 20px;display: flex;justify-content: space-between;">
                <div style="display: flex;">
                  <el-input placeholder="请输入设备名称" v-model="deviceName"
                    style="width: 200px;margin-right: 2%;"></el-input><el-button type="primary"
                    @click="handleSearchDevice">搜索</el-button>
                </div>
                <!-- <div>
                  <el-button type="primary" @click="handleExportDevice">导出</el-button>
                </div> -->
              </div>
              <el-table :row-key="getRowKeys" :span-method="objectSpanMethod"
                :data="inspectionForm.tableData && inspectionForm.tableData.filter(item => item.floorName == activeFloorName)"
                border style="width:98%">
                <el-table-column prop="deptName" align="center" label="房间名称"></el-table-column>
                <el-table-column prop="deviceName" align="center" label="巡检设备"></el-table-column>
                <el-table-column prop="checkContent" align="center" label="巡检内容"></el-table-column>
                <el-table-column prop="status" align="center" label="状态">
                  <template slot-scope="scope">
                    <el-radio-group v-model="scope.row.status" fill="red">
                      <el-radio :label="0" :disabled="dialogTitle == '巡检确认'">正常</el-radio>
                      <el-radio class="error_radio" :label="1" :disabled="dialogTitle == '巡检确认'">异常</el-radio>
                    </el-radio-group>
                  </template>
                </el-table-column>
                <el-table-column prop="imgs" align="center" label="现场照片">
                  <template slot-scope="scope">
                    <el-upload list-type="picture-card" v-show="dialogTitle != '巡检确认'" :disabled="dialogTitle == '巡检确认'"
                      class="upload-demo" action="/api/blade-resource/oss/endpoint/put-file"
                      :on-success="handleSuccess(scope.row)" :on-remove="handleRemove(scope.row)" :headers="headers"
                      :limit="1" :on-exceed="handleExceed" :file-list="scope.row.fileList">
                      <i class="el-icon-plus"></i>
                    </el-upload>
                    <img @click="clickImg(scope.row.picUrl)" style="width: 200px;height: 200px;cursor: pointer;"
                      :src="scope.row.picUrl" alt="" v-show="dialogTitle == '巡检确认' && scope.row.picUrl != ''">
                  </template>
                </el-table-column>
                <!-- <el-table-column prop="signUrl" align="center" label="使用人签字">
                    <template slot-scope="scope">
                      <el-input placeholder="请输入使用人签字" v-model="scope.row.signUrl" :disabled="dialogTitle == '巡检确认'"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column prop="remark" align="center" label="备注">
                    <template slot-scope="scope">
                      <el-input placeholder="请输入备注" type="textarea" v-model="scope.row.remark" :disabled="dialogTitle == '巡检确认'"></el-input>
                    </template>
                  </el-table-column> -->
              </el-table>
            </el-form-item>
            <el-form-item label="使用人签字" prop="signUrl">
              <el-input placeholder="请输入使用人签字" v-model="inspectionForm.signUrl" :disabled="dialogTitle == '巡检确认'"
                style="width: 98%;"></el-input>
            </el-form-item>
            <el-form-item label="备注" prop="remark">
              <el-input placeholder="请输入备注" type="textarea" v-model="inspectionForm.remark"
                :disabled="dialogTitle == '巡检确认'" style="width: 98%;"></el-input>
            </el-form-item>
          </div>
          <div v-show="inspectionForm.taskStatus == 3"> <!--  -->
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              巡检确认
            </div>
            <el-form-item label="是否巡检完成">
              <el-select v-model="inspectionForm.isOver" style="width: 98%;" placeholder="请选择是否巡检完成">
                <el-option label="是" :value="1"></el-option>
                <el-option label="否" :value="0"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item v-if="inspectionForm.isOver === 0" label="驳回意见">
              <el-input type="textarea" v-model="inspectionForm.approveRemark" style="width: 98%;"></el-input>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleCancel">取 消</el-button>
        <el-button type="primary" @click="handleConfirmInspection">提 交</el-button>
      </span>
    </el-dialog>
    <el-dialog title="巡检异常维修" :visible.sync="dialogerror" :append-to-body="true" width="70%">
      <div style="height: 500px; overflow: auto">
        <el-form ref="errorForm" :model="errorForm" :rules="addRules" label-width="120px" label-position="left">
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              基本信息
            </div>
            <el-form-item label="单位名称" prop="deptName">
              <el-input placeholder="请输入单位名称" v-model="errorForm.deptName"></el-input>
            </el-form-item>
            <!-- <el-form-item label="巡检项目名称" prop="inspectionName">
                <el-input placeholder="请输入巡检项目名称" v-model="errorForm.inspectionName" readonly></el-input>
              </el-form-item>
              <el-form-item label="项目地址" prop="projectAddr">
                <el-input placeholder="请输入项目地址" v-model="errorForm.projectAddr" readonly></el-input>
              </el-form-item> -->
          </div>
          <div>
            <div style="
                  color: #101010;
                  font-size: 20px;
                  font-weight: 550;
                  margin-bottom: 20px;
                ">
              巡检异常清单
            </div>
            <el-form-item label="异常清单">
              <el-table :span-method="errorSpanMethod" :data="errorForm.tableData" border style="width: 100%">
                <el-table-column label="楼层" prop="floorName"></el-table-column>
                <el-table-column label="房间名称" prop="roomName"></el-table-column>
                <el-table-column label="专业/设备" prop="majorName"></el-table-column>
                <el-table-column label="巡检内容" prop="inspectionContent"></el-table-column>
                <el-table-column label="状态" prop="status">
                  <template slot-scope="scope">
                    {{ scope.row.status == 1 ? '异常' : '正常' }}
                  </template>
                </el-table-column>
                <el-table-column label="价格" prop="price">
                  <template slot-scope="scope">
                    <el-input placeholder="请输入价格" v-model="scope.row.price"></el-input>
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleSaveError">保 存</el-button>
        <el-button type="primary" @click="handleConfirmError">提 交</el-button>
      </span>
    </el-dialog>
    <el-dialog title="图片查看" :visible.sync="dialogImage" :append-to-body="true" width="70%" @close="closeImg">
      <img :src="imgUrl" alt="">
    </el-dialog>
    <!-- <div id="pdfDom" style="padding:20px" v-if="routingFormShow">
      <routing-inspection v-if="routingFormShow" :detailForm="routingForm" detailType="task"></routing-inspection>
    </div> -->
  </basic-container>
</template>

<script>
import statusData from "@/assets/json/status.json"; // 引入状态数据
import website from '@/config/website';
import { getToken } from '@/util/auth';
import { getChildList } from '@/api/system/dictbiz'
import { getDeepData } from '@/api/labManagement/inspectionManagement'
import { getRepairPeople } from '@/api/operation/hand'
import {
  getTaskPage, getDetail, taskSupervisorConfirm, taskServicemanReceive, updateTime, taskCreat, servicemanUpdateDetail, servicemanSubmit,
  customerConfirm, customerRefuse, updateSign, exportDevice
} from '@/api/labManagement/task'
import { mapGetters } from "vuex";
import { getDeviceList } from '@/api/device/device'
import routingInspection from '@/views/components/routingInspection.vue'
import {  exportBlob1,zipDownload } from "@/api/common";
import { downloadXls } from "@/util/util";

export default {
  components: {
    routingInspection
  },
  data() {
    return {
      deviceName: '',
      htmlTitle: '巡检报告',
      routingForm: {},
      inspectionForm: {
        tableData: [
          { status: 0 }
        ]
      },
      dialogImage: false,
      imgUrl: '',
      periodArr: [],
      repairPersonList: [],
      deviceList: [],
      option: {
        selection: true,
        height: "auto",
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        dialogType: "dialog",
        dialogClickModal: false,
        addBtn: false,
        viewBtn: false,
        editBtn: false,
        delBtn: false,
        searchShowBtn: false,
        refreshBtn: false,
        columnBtn: false,
        menuWidth: 300,
        column: [
          {
            label: "任务单号",
            labelWidth: 120,
            prop: "taskCode",
            overHidden: true,
          },
          {
            label: "单位名称",
            labelWidth: 120,
            prop: "deptName",
            search: true,
            overHidden: true,
          },
          // {
          //   label: "巡检项目名称",
          //   labelWidth: 120,
          //   prop: "inspectionName",
          //   overHidden: true,
          // },
          // {
          //   label: "项目地址",
          //   labelWidth: 120,
          //   prop: "projectAddr",
          //   overHidden: true,
          // },
          {
            label: "巡检说明",
            labelWidth: 120,
            prop: "taskContent",
            overHidden: true,
          },
          {
            label: "计划开始时间",
            labelWidth: 120,
            prop: "startTime",
            overHidden: true,
          },
          {
            label: "状态",
            labelWidth: 120,
            prop: "taskStatus",
            slot: true,
          },
          {
            label: "客户预约时间",
            labelWidth: 120,
            prop: "reservationTime",
          },
          {
            label: '巡检完成时间',
            labelWidth: 120,
            prop: 'finishTime'
          }
        ],
      },
      headers: {},
      data: [],
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      dialogTitle: '设备新增',
      dialogType: '',
      dialogVisible: false,
      dialogInspection: false,
      floorArr: [],
      activeFloor: '001',
      activeFloorName: '',
      roomArr: [
        { name: '种子常规检测1', value: '001', checked: true },
        { name: 'PCR室', value: '002', checked: false },
      ],
      activeRoom: '001',
      activeRoomName: '',
      addForm: {

      },
      addRules: {
        deviceNo: { required: true, message: '请输入设备编号', trigger: 'blur' },
        deviceName: { required: true, message: '请输入设备名称', trigger: 'blur' },
        deviceModel: { required: true, message: '请输入型号', trigger: 'blur' },
        devicePosition: { required: true, message: '请输入设备位置', trigger: 'blur' },
        deviceType: { required: true, message: '请选择设备类型', trigger: 'blur' },
        supplier: { required: true, message: '请输入供应商', trigger: 'blur' },
        productTime: { required: true, message: '请选择生产时间', trigger: 'blur' },
        fileName: { required: true, message: '请输入附件名称', trigger: 'blur' },
      },
      typeList: [
        { label: '类型一', value: '001' },
        { label: '类型二', value: '002' },
        { label: '类型三', value: '003' },
      ],
      fileList: [],
      requestVisible: false,
      requestForm: {},
      selectedList: [],
      dialogerror: false, //巡检异常弹窗
      errorForm: {},
      role_id: '',
      tableData: [],
      inspectionTable: [],
      routingFormShow: false
    }
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    getStatus() {
      return (type, id, status) => {
        let val
        statusData[type][id].map(item => {
          if (item.status == status) {
            val = item
          }
        })
        return val
      }
    },
  },
  mounted() {
    this.headers = {
      "Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
      'Blade-Auth': 'bearer ' + getToken(),
      'Blade-Requested-With': 'BladeHttpRequest'
    }
    getChildList(1, 100, '1858710780677984257').then(res => {
      this.periodArr = res.data.data
    })
    getDeviceList({ current: 1, size: 100 }).then(res => {
      this.deviceList = res.data.data.records
      this.deviceList.forEach(item => {
        item.disabled = false
      })
    })
    console.log('persimmon-------------->', this.permission)
    this.role_id = this.userInfo.role_id
    console.log('role_id=======>', this.role_id)

    getRepairPeople().then(res => {
      this.repairPersonList = res.data.data
      // this.dialogVisible = true
    })

  },
  methods: {
    // 批量导出报告
    allExportReport() {
      if (this.selectedList.length == 0) {
        this.$message.warning('请至少选择一条数据')
      } else {
        let tmp = this.selectedList.filter(item => { return item.taskStatus == 4 })
        if (tmp.length != this.selectedList.length) {
          this.$message.warning('请选择状态为已完成的数据')
        } else {
          console.log('批量导出报告', this.selectedList)
          zipDownload('/api/lab-ops/maintenance/batch-maintenance-output-service', this.selectedList)
            .then((response) => {
              const blob = new Blob([response.data])
              const fileName = '巡检报告.zip'
              if ('download' in document.createElement('a')) { // 非IE下载
                const elink = document.createElement('a')
                elink.download = fileName
                elink.style.display = 'none'
                elink.href = URL.createObjectURL(blob)
                document.body.appendChild(elink)
                elink.click()
                URL.revokeObjectURL(elink.href)// 释放URL 对象
                document.body.removeChild(elink)
              } else { // IE10+下载
                navigator.msSaveBlob(blob, fileName)
              }
            })
            .catch((err) => {
              console.log(err);
            });

        }
      }
    },
    // 搜索设备
    handleSearchDevice() {
      this.inspectionForm.tableData = this.inspectionTable
      if (this.inspectionForm.tableData.length != 0) {
        let arr = this.inspectionForm.tableData && this.inspectionForm.tableData.filter(item => item.floorName == this.activeFloorName)
        let arr1 = arr.filter(item => item.deviceName.indexOf(this.deviceName) != -1)
        console.log('arr1', arr1)
        this.inspectionForm.tableData = arr1
        this.$forceUpdate()
      }
    },
    // 导出设备
    handleExportDevice(row) {
      // exportBlob1(`/api/lab-ops/maintenance/task-detail-configuration`, { id: this.inspectionForm.id }).then(res => {
      //
      // })
      let query = JSON.parse(JSON.stringify(row))
        exportBlob1(`/api/lab-ops/maintenance/maintenance-plan-report`, query).then(res => {
          downloadXls(res.data, "巡检计划.xlsx");
        })
      getDetail({ id: row.id }).then(res => {


        // const header = ["deviceName", "address", "checkContent", "craft", "period", "remark"]
        // //展示的名称
        // const headerDisplay = { deviceName: "专业", address: '点位', checkContent: "巡检内容", craft: '巡检工艺', period: '巡检频次', remark: '备注' };

        // let data = []
        // let data2 = []
        // let oldData = this.checkDeepData(res.data.data.details)
        // oldData.forEach(item => {
        //   data2.push([item.floorName, item.deptName, item.deviceName,1, item.checkContent, item.craft, this.periodArr.filter(v => v.dictKey == item.period)[0].dictValue, item.remark])

        //   data.push({
        //     deviceName: item.deviceName,
        //     address: item.floorName + '/' + item.deptName,
        //     checkContent: item.checkContent,
        //     craft: item.craft,
        //     period: this.periodArr.filter(v => v.dictKey == item.period)[0].dictValue,
        //     remark: item.remark
        //   })
        // })

        // let newData = [headerDisplay, ...data]

        // // 创建工作簿
        // const ws = XLSX.utils.json_to_sheet(newData, { header: header, skipHeader: true });


        // // 创建工作簿并添加工作表
        // const wb = XLSX.utils.book_new();
        // XLSX.utils.book_append_sheet(wb, ws, "点检任务");

        // // 创建数据并写入sheet2
        // const sheet2Data = [
        //   ["楼层", "房间", "设备名称", "数量", "维保内容及频次", "巡检工艺", "巡检频次", "备注"],
        // ];
        // data2.forEach(i => {
        //   sheet2Data.push(i)
        // })
        // const sheet2 = XLSX.utils.aoa_to_sheet(sheet2Data);
        // XLSX.utils.book_append_sheet(wb, sheet2, res.data.data.deptName + '维保计划');

        // // 生成Excel文件
        // const wbout = XLSX.write(wb, { bookType: "xlsx", type: "binary" });
        // // 字符串转ArrayBuffer
        // function s2ab(s) {
        //   const buf = new ArrayBuffer(s.length);
        //   const view = new Uint8Array(buf);
        //   for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
        //   return buf;
        // }
        // downloadXls(new Blob([s2ab(wbout)]), res.data.data.deptName + "维保计划.xlsx");
        // maintenance-plan-report
      })
    },
    // 点击图片
    clickImg(url) {
      this.imgUrl = url
      this.dialogImage = true
    },
    // 关闭图片
    closeImg() {
      this.imgUrl = ''
    },
    createTask() {
      taskCreat().then(res => {
        console.log('res =========>', res)
      })
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      // console.log('row--------------->',row)
      // console.log('column--------------->',column)
      // console.log('rowIndex--------------->',rowIndex)
      // console.log('columnIndex--------------->',columnIndex)
      const span = column['property'] + '-span'
      if (row[span]) {
        return row[span]
      }

    },
    // *  table合并行通用 */
    mergeTableRow(data, val, merge) {
      if (!merge || merge.length === 0) {
        return data
      }
      console.log('merge==========>', merge)
      merge.forEach((m) => {
        const mList = {}
        data = data.map((v, index) => {
          console.log('v----------->', v)
          console.log('val=============>', val)
          if (v && v.floorName && v.floorName == val) {
            const rowVal = v[m]
            if (mList[rowVal] && mList[rowVal].newIndex === index) {
              mList[rowVal]['num']++
              mList[rowVal]['newIndex']++
              data[mList[rowVal]['index']][m + '-span'].rowspan++
              v[m + '-span'] = {
                rowspan: 0,
                colspan: 0
              }
            } else {
              mList[rowVal] = { num: 1, index: index, newIndex: index + 1 }
              v[m + '-span'] = {
                rowspan: 1,
                colspan: 1
              }
            }
            return v
          }

        })
      })
      return data
    },
    beforeOpen(done, type) {
      done();
    },
    beforeClose(done) {
      done();
    },
    searchReset(params, done) {
      //   params.releaseTimeRange = dateFormat(new Date(), 'yyyy-MM-dd');
      this.query = params;
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    addOperation(val) {
      console.log('val================>', val && val.deviceNo)
      if (val && val.deviceNo) {
        this.requestForm = {
          errPosition: val.devicePosition,
          deviceName: val.deviceName,
          errType: val.deviceType
        }
        this.requestVisible = true
      } else {
        this.requestVisible = true
      }
    },
    clickFloor(val) {
      console.log('val----------->', val)
      this.inspectionForm.tableData = this.inspectionTable
      this.deviceName = ''
      // this.activeFloor = val.value
      this.activeFloorName = val
      let firstFloor = this.addForm.details.find(item => item.floorName == this.activeFloorName)
      this.roomArr = firstFloor.details.map(item => item.deptName)
      this.activeRoom = this.roomArr[0]
      let firstRoom = firstFloor.details.find(item => item.deptName == this.activeRoom)
      this.tableData = firstRoom.details
    },
    clickRoom(val) {
      this.activeRoom = val
      let firstFloor = this.addForm.details.find(item => item.floorName == this.activeFloorName)
      let firstRoom = firstFloor.details.find(item => item.deptName == this.activeRoom)
      console.log('firstRoom', firstRoom)
      this.tableData = firstRoom.details

    },
    closeRequest() {
      this.requestVisible = false
    },
    selectionChange(list) {
      this.selectedList = list
    },
    // 点击新增按钮
    handleAdd() {
      if (this.selectedList.length != 1) {
        this.$message.warning('只能选择一条数据')
      } else {
        if (this.selectedList[0].status == 1) {
          this.$message.warning('请选择状态为待接单的数据')
        } else {
          this.dialogTitle = '巡检任务'
          this.dialogType = '接单'
          this.addForm = this.selectedList[0]
          this.dialogVisible = true
        }
      }
    },
    handleView(row) {
      this.dialogTitle = '巡检任务'
      this.dialogType = '查看'
      // this.addForm = row
      this.fileList = []
      getDetail({ id: row.id }).then(res => {
        this.addForm = res.data.data
        getRepairPeople({ isRepair: this.role_id == '1839537055389515777' ? true : false }).then(res => {
          this.repairPersonList = res.data.data
        })
        // getDeepData({parentId:res.data.data.deptId}).then(result =>{
        //   this.floorArr = []
        //   result.data.data.map(item =>{
        //     this.floorArr.push({
        //       value:item.id,
        //       name:item.deptName,
        //       checked:false
        //     })
        //     this.activeFloor = result.data.data[0].id
        //     this.activeFloorName = result.data.data[0].deptName
        //     getDeepData({parentId:this.activeFloor}).then(result1 =>{
        //       this.roomArr = []
        //       result1.data.data.map(item =>{
        //         this.roomArr.push({
        //           value:item.id,
        //           name:item.deptName,
        //           checked:false
        //         })
        //       })
        //       this.activeRoom = result1.data.data[0].id
        //       this.activeRoomName = result1.data.data[0].deptName
        //       this.dialogVisible = true

        //     })
        //   })
        //   console.log('floor=========>',this.floorArr)
        //   console.log('details========>',res.data.data.details)
        // })

        this.floorArr = this.addForm.details.map(item => item.floorName)
        this.activeFloorName = this.floorArr[0]
        let firstFloor = this.addForm.details.find(item => item.floorName == this.activeFloorName)
        this.roomArr = firstFloor.details.map(item => item.deptName)
        this.activeRoom = this.roomArr[0]
        let firstRoom = firstFloor.details.find(item => item.deptName == this.activeRoom)
        this.tableData = firstRoom.details
        this.dialogVisible = true
        this.addForm = {
          ...res.data.data,
          inspectionData: res.data.data.details,
          servicemanId: res.data.data.servicemanId != -1 ? res.data.data.servicemanId : ''
        }
      })
    },
    assignUser(row) {
      this.dialogTitle = '审核并指派'
      this.dialogType = '审核并指派'
      this.addForm = row
      this.fileList = []
      getRepairPeople({ isRepair: this.role_id == '1839537055389515777' ? true : false }).then(res => {
        this.repairPersonList = res.data.data
        // this.dialogVisible = true
      })
      getDetail({ id: row.id }).then(res => {
        this.addForm = res.data.data
        // getDeepData({parentId:res.data.data.deptId}).then(result =>{
        //   this.floorArr = []
        //   result.data.data.map(item =>{
        //     this.floorArr.push({
        //       value:item.id,
        //       name:item.deptName,
        //       checked:false
        //     })
        //     this.activeFloor = result.data.data[0].id
        //     this.activeFloorName = result.data.data[0].deptName
        //     getDeepData({parentId:this.activeFloor}).then(result1 =>{
        //       this.roomArr = []
        //       result1.data.data.map(item =>{
        //         this.roomArr.push({
        //           value:item.id,
        //           name:item.deptName,
        //           checked:false
        //         })
        //       })
        //       this.activeRoom = result1.data.data[0].id
        //       this.activeRoomName = result1.data.data[0].deptName
        //       this.dialogVisible = true

        //     })
        //   })
        //   console.log('floor=========>',this.floorArr)
        //   console.log('details========>',res.data.data.details)
        // })

        this.floorArr = this.addForm.details.map(item => item.floorName)
        this.activeFloorName = this.floorArr[0]
        let firstFloor = this.addForm.details.find(item => item.floorName == this.activeFloorName)
        this.roomArr = firstFloor.details.map(item => item.deptName)
        this.activeRoom = this.roomArr[0]
        let firstRoom = firstFloor.details.find(item => item.deptName == this.activeRoom)
        this.tableData = firstRoom.details
        this.dialogVisible = true

        this.addForm = {
          ...res.data.data,
          inspectionData: res.data.data.details,
          servicemanId: res.data.data.servicemanId != -1 ? res.data.data.servicemanId : ''
        }
      })

    },
    handleAccept(row) {
      this.dialogTitle = '巡检任务'
      this.dialogType = '接单'
      // this.addForm = row
      this.fileList = []
      // this.dialogVisible = true
      getRepairPeople({ isRepair: this.role_id == '1839537055389515777' ? true : false }).then(res => {
        this.repairPersonList = res.data.data
        // this.dialogVisible = true
      })
      getDetail({ id: row.id }).then(res => {
        this.addForm = res.data.data
        // getDeepData({parentId:res.data.data.deptId}).then(result =>{
        //   this.floorArr = []
        //   result.data.data.map(item =>{
        //     this.floorArr.push({
        //       value:item.id,
        //       name:item.deptName,
        //       checked:false
        //     })
        //     this.activeFloor = result.data.data[0].id
        //     this.activeFloorName = result.data.data[0].deptName
        //     getDeepData({parentId:this.activeFloor}).then(result1 =>{
        //       this.roomArr = []
        //       result1.data.data.map(item =>{
        //         this.roomArr.push({
        //           value:item.id,
        //           name:item.deptName,
        //           checked:false
        //         })
        //       })
        //       this.activeRoom = result1.data.data[0].id
        //       this.activeRoomName = result1.data.data[0].deptName
        //       this.dialogVisible = true

        //     })
        //   })
        //   console.log('floor=========>',this.floorArr)
        //   console.log('details========>',res.data.data.details)
        // })

        this.floorArr = this.addForm.details.map(item => item.floorName)
        this.activeFloorName = this.floorArr[0]
        let firstFloor = this.addForm.details.find(item => item.floorName == this.activeFloorName)
        this.roomArr = firstFloor.details.map(item => item.deptName)
        this.activeRoom = this.roomArr[0]
        let firstRoom = firstFloor.details.find(item => item.deptName == this.activeRoom)
        this.tableData = firstRoom.details
        this.dialogVisible = true
        this.addForm = {
          ...res.data.data,
          inspectionData: res.data.data.details,
        }
      })

    },

    //用于回调的函数
    checkData(data, list) {
      data.forEach((item) => {
        if (item.details && item.details.length > 0) {
          this.checkData(item.details, list);
        } else {
          list.push(item);
        }
      });
      return list;
    },
    //调用此函数 返回的就是最底层的数据
    checkDeepData(data) {
      const list = [];
      return this.checkData(data, list);
    },
    // 客户确认巡检计划
    handleuserConfirm(row) {
      this.dialogTitle = '巡检确认'
      getDetail({ id: row.id }).then(res => {
        this.inspectionForm = res.data.data
        this.dialogInspection = true
        this.inspectionForm.tableData = this.checkDeepData(res.data.data.details)
        // getDeepData({parentId:res.data.data.deptId}).then(result =>{
        //   this.floorArr = []
        //   result.data.data.map(item =>{
        //     this.floorArr.push({
        //       value:item.id,
        //       name:item.deptName,
        //       checked:false
        //     })
        //     this.activeFloor = result.data.data[0].id
        //     this.activeFloorName = result.data.data[0].deptName
        //     getDeepData({parentId:this.activeFloor}).then(result1 =>{
        //       this.roomArr = []
        //       result1.data.data.map(item =>{
        //         this.roomArr.push({
        //           value:item.id,
        //           name:item.deptName,
        //           checked:false
        //         })
        //       })
        //       this.activeRoom = result1.data.data[0].id
        //       this.activeRoomName = result1.data.data[0].deptName
        //     })
        //   })
        //   console.log('floor=========>',this.floorArr)
        //   console.log('details========>',res.data.data.details)
        // })

        this.floorArr = this.inspectionForm.details.map(item => item.floorName)
        this.activeFloorName = this.floorArr[0]
        // this.inspectionForm.tableData  = this.mergeTableRow(this.inspectionForm.tableData,this.activeFloorName,['deptName'])
        console.log('tableData------->', this.inspectionForm.tableData)
      })
    },
    // 导出 报告
    handleExport(row) {

      getDetail({ id: row.id }).then(res => {
        this.routingForm = res.data.data
        this.routingForm.tableData = this.checkDeepData(res.data.data.details)
        this.routingForm.tableData.map(item => {
          item.price = item.price != -1 ? item.price : ''
        })
        // this.routingFormShow = true
        let query = JSON.parse(JSON.stringify(row))
        exportBlob1(`/api/lab-ops/maintenance/maintenance-output-service`, query).then(res => {
          downloadXls(res.data, "巡检报告.xlsx");
        })
        // setTimeout(() => {
        //   this.getPdf()
        // }, 100)
      })
    },
    handleInspection(row) {
      this.dialogTitle = '巡检任务'
      this.inspectionRules = {
        signUrl: { required: true, message: '请输入签名', trigger: 'blur' }
      }
      getDetail({ id: row.id }).then(res => {
        this.inspectionForm = res.data.data
        this.dialogInspection = true
        this.inspectionForm.tableData = this.checkDeepData(res.data.data.details)
        this.inspectionTable = JSON.parse(JSON.stringify(this.inspectionForm.tableData))
        this.inspectionForm.tableData.map(item => {
          if (item.picUrl != '') {
            item.fileList = [{ name: '巡检图片.png', link: item.picUrl }]
          }
        })
        this.floorArr = this.inspectionForm.details.map(item => item.floorName)
        this.activeFloorName = this.floorArr[0]

        console.log('activeFloorName==========>', this.activeFloorName)
        console.log('tableData------->', this.inspectionForm.tableData)
      })
    },
    // 点击编辑按钮
    handleEdit(row) {
      this.addForm = row
      this.fileList = row.fileList
      this.dialogTitle = '设备编辑'
      this.dialogVisible = true
    },
    // 点击删除按钮
    handleChangeStatus(row) {
      this.$confirm('请确认是否修改巡检计划状态?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (row.status == 0) {
          row.status = 1
        } else {
          row.status = 0
        }
        this.$message({
          type: 'success',
          message: '修改成功!'
        });
      }).catch(() => {
        // this.$message({
        //   type: 'info',
        //   message: '已取消删除'
        // });
      });
    },
    // 点击新增弹窗关闭按钮
    handleClose() {
      this.dialogVisible = false
      this.addForm = {}
    },
    // 点击接单弹窗保存按钮
    handleSave() {
      this.$refs['addForm'].validate((valid) => {
        if (valid) {
          console.log('addForm--------------->', this.addForm)
        }
      })
    },
    // 点击接单弹窗确定按钮
    handleSave() {
      this.$refs['addForm'].validate((valid) => {
        if (valid) {
          console.log('addForm--------------->', this.addForm)
        }
      })
    },

    // 点击巡检弹窗中的保存按钮
    handleSaveInspection() {
      this.$refs['inspectionForm'].validate((valid) => {
        if (valid) {
          console.log('inspectionForm--------------->', this.inspectionForm)
        }
      })
    },
    handleConfirm() {
      if (this.dialogType == '审核并指派') {
        let servicemanArr = this.repairPersonList.filter(item => {
          return item.id = this.addForm.servicemanId
        })
        let query = {
          id: this.addForm.id,
          servicemanId: this.addForm.servicemanId,
          servicemanName: servicemanArr[0].name
        }
        console.log('query=========>', query, this.addForm)
        taskSupervisorConfirm(query).then(res => {
          if (res.data.code == 200) {
            this.$message.success('审核完成')
            this.dialogVisible = false
            this.onLoad()
          }
        })
      } else if (this.dialogType == '接单') {
        let query = {
          id: this.addForm.id,
          reservationTime: this.addForm.appointTime
        }
        taskServicemanReceive({ id: this.addForm.id }).then(res => {
          if (res.data.code == 200) {
            updateTime(query).then(result => {
              if (result.data.code == 200) {
                this.$message.success('接单完成')
                this.dialogVisible = false
                this.onLoad()
              }
            })
          }
        })
      }
    },
    handleCancel() {
      this.dialogInspection = false
      this.inspectionForm = {}
    },
    // 点击巡检弹窗中的确定按钮
    handleConfirmInspection() {
      this.$refs['inspectionForm'].validate((valid) => {
        if (valid) {
          if (this.dialogTitle == '巡检确认') {
            if (this.inspectionForm.isOver === 1) {
              customerConfirm({ id: this.inspectionForm.id }).then(res => {
                if (res.data.code == 200) {
                  this.$message.success('确认成功')
                  this.dialogInspection = false
                  this.onLoad()
                }
              })
            } else {
              let query = {
                id: this.inspectionForm.id,						//任务id
                approvePerson: this.userInfo.user_id,			//审核人
                appproveResult: this.inspectionForm.isOver,		 //审核结果
                approveRemark: this.inspectionForm.approveRemark,		//备注
              }
              console.log('quer=====>', query)
              customerRefuse(query).then(res => {
                if (res.data.code == 200) {
                  this.$message.success('确认成功')
                  this.dialogInspection = false
                  this.onLoad()
                }
              })
            }
          } else {
            let query = []
            this.inspectionForm.tableData.map(item => {
              query.push({
                taskId: this.inspectionForm.id,
                floorName: item.floorName,
                deptId: item.deptId,
                checkContent: item.checkContent,
                craft: item.craft,
                period: item.period,
                picUrl: item.picUrl,
                // signUrl:item.signUrl,
                // remark:item.remark,
                id: item.id,
                status: item.status
              })
            })
            if (query.find(item => item.status === '')) {
              this.$message.error('状态及使用人签名请填写完整')
            } else {
              this.$confirm('请确认是否巡检完成?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                servicemanUpdateDetail(query).then(res => {
                  if (res.data.code == 200) {
                    servicemanSubmit({ id: this.inspectionForm.id }).then(res => {
                      if (res.data.code == 200) {
                        updateSign({
                          signUrl: this.inspectionForm.signUrl,
                          remark: this.inspectionForm.remark,
                          id: this.inspectionForm.id
                        }).then(res => {
                          if (res.data.code == 200) {
                            this.$message.success('提交成功')
                            this.onLoad()
                            this.dialogInspection = false
                          }
                        })

                      }
                    })
                  }
                })
              }).catch(() => {

              })

            }
          }

        }
      })
    },
    //巡检维修弹窗保存按钮
    handleSaveError() {
      this.$refs['errorForm'].validate((valid) => {
        if (valid) {
          console.log('errorForm--------------->', this.errorForm)
        }
      })
    },

    //巡检维修弹窗确定按钮
    handleConfirmError() {
      this.$refs['errorForm'].validate((valid) => {
        if (valid) {
          console.log('errorForm--------------->', this.errorForm)
        }
      })
    },
    // 附件上传成功
    handleSuccess(val) {
      return (response, file, fileList) => {
        console.log('val==========>', val)
        // this.inspectionForm.tableData[index].picUrl = response.data.link
        val.picUrl = response.data.link
        val.fileList = [
          {
            url: response.data.link,
            name: response.data.originalName
          }
        ]
      }
    },
    getRowKeys(row) {
      return row.id
    },
    // 附件删除
    handleRemove(index) {
      return (file, fileList) => {
        // this.inspectionForm.tableData[index].picUrl = ''
        val.picUrl = ''
        val.fileList = []
      }
    },
    onLoad(page, params = {}) {
      // this.data = [
      //   {
      //     taskNo:'WX-20240820-01',
      //     deptName:'济南安池实验室',
      //     inspectionName:'实验室设备巡检',
      //     projectAddr:'济南市钢城区',
      //     inspectionFloor:'三层、四层',
      //     inspectionDate:'2024-05-21',
      //     appointTime:'2024-07-21',
      //     inspectionContent:'巡检主要内容1111',
      //     status:0,
      //     inspectionData:[
      //       {
      //         floorId:'001',					//楼层id
      //         roomArr:[
      //           {
      //             roomId:'001',		//房间id
      //             data:[
      //               {
      //                 majorName:'001',		//专业名称
      //                 content:'巡检内容11111',			//巡检内容
      //                 requirements:'001',	//工艺要求
      //                 cycle:'001',			//巡检周期
      //                 startTime:'2024-07-11'		//开始时间
      //               },
      //             ]
      //           },
      //           {
      //             roomId:'002',		//房间id
      //             data:[
      //               {
      //                 majorName:'002',		//专业名称
      //                 content:'巡检内容2222222',			//巡检内容
      //                 requirements:'002',	//工艺要求
      //                 cycle:'002',			//巡检周期
      //                 startTime:'2024-07-12'		//开始时间
      //               }
      //             ]
      //           }
      //         ]
      //       },
      //       {
      //         floorId:'002',					//楼层id
      //         roomArr:[
      //           {
      //             roomId:'001',		//房间id
      //             data:[
      //               {
      //                 majorName:'001',		//专业名称
      //                 content:'巡检内容33333',			//巡检内容
      //                 requirements:'001',	//工艺要求
      //                 cycle:'001',			//巡检周期
      //                 startTime:'2024-07-11'		//开始时间
      //               },
      //             ]
      //           },
      //           {
      //             roomId:'002',		//房间id
      //             data:[
      //               {
      //                 majorName:'002',		//专业名称
      //                 content:'巡检内容44444',			//巡检内容
      //                 requirements:'002',	//工艺要求
      //                 cycle:'002',			//巡检周期
      //                 startTime:'2024-07-12'		//开始时间
      //               }
      //             ]
      //           }
      //         ]
      //       }
      //     ]
      //   },
      //   {
      //     taskNo:'WX-20240820-01',
      //     deptName:'济南安池实验室',
      //     inspectionName:'实验室设备巡检',
      //     projectAddr:'济南市钢城区',
      //     inspectionFloor:'三层、四层',
      //     inspectionDate:'2024-09-21',
      //     appointTime:'2024-12-21',
      //     status:2,
      //     inspectionContent:'巡检主要内容2222',
      //     floorId:'001,002',
      //     tableData:[
      //       {floorId:'001',floorName:'三楼',roomName:'种子常规检测1',majorName:'水系统',inspectionContent:'巡检内容1111',requirements:'工艺要求1',status:0,imgs:[],userName:'',remark:''},
      //       {floorId:'001',floorName:'三楼',roomName:'种子常规检测1',majorName:'电气系统',inspectionContent:'巡检内容1111',requirements:'工艺要求1',status:0,imgs:[],userName:'',remark:''},
      //       {floorId:'001',floorName:'三楼',roomName:'种子常规检测1',majorName:'电气系统',inspectionContent:'巡检内容1111',requirements:'工艺要求1',status:0,imgs:[],userName:'',remark:''},
      //       {floorId:'002',floorName:'四楼',roomName:'种子常规检测1',majorName:'电气系统',inspectionContent:'巡检内容1111',requirements:'工艺要求1',status:0,imgs:[],userName:'',remark:''},
      //       {floorId:'002',floorName:'四楼',roomName:'种子常规检测1',majorName:'水系统',inspectionContent:'巡检内容1111',requirements:'工艺要求1',status:0,imgs:[],userName:'',remark:''},
      //     ]
      //   },
      // ];
      // this.page.total = this.data.length
      // this.loading = false;

      let query = {
        current: this.page.currentPage,
        size: this.page.pageSize
      }
      getTaskPage(query).then(res => {
        console.log('res=======>', res)
        this.data = res.data.data.records
        this.page.total = res.data.data.total
      })
    },
  }
}
</script>

<style lang="scss" scoped></style>
<style lang="scss">
.inspectionDialog {
  .error_radio {
    .el-radio__input.is-checked .el-radio__inner {
      border-color: red;
      background: red;
    }

    .el-radio__input.is-checked+.el-radio__label {
      color: red;
    }
  }
}
</style>
