<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="巡检类型" prop="workType">
        <el-select v-model="queryParams.workType" placeholder="请选择类型" clearable size="small">
          <el-option
            v-for="dict in workTypeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="任务名称" prop="workName">
        <el-input
          v-model="queryParams.workName"
          placeholder="请输入任务名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:workinfo:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
		  :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['system:workinfo:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="workinfoList"
              row-key="workId"
              :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @selection-change="handleSelectionChange">
      <el-table-column label="任务名称" align="center" prop="workName" />
      <el-table-column label="任务类型" align="center" prop="workType" :formatter="workTypeFormat" width="90"/>
      <el-table-column label="任务开始时间" align="center" prop="workBeginTime" >
      </el-table-column>
      <el-table-column label="任务截止时间" align="center" prop="workLimitTime" >

      </el-table-column>
      <el-table-column label="部门" align="center" prop="deptName" width="120">
        <template slot-scope="scope" >
          <div class="deptname" :title="scope.row.deptName">{{scope.row.deptName}}</div>
        </template>
      </el-table-column>
      <el-table-column label="巡检进度" align="center" prop="inspectPointNum" width="90">
        <template slot-scope="scope" >
          <span v-if="scope.row.parentId!=0">{{scope.row.inspectSuccessNum}}/{{scope.row.inspectPointNum}}</span>
          <span v-if="scope.row.parentId==0">&#45;&#45;</span>
        </template>

      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
        <template slot-scope="scope">
          <el-button
            v-if="scope.row.parentId==0"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleDetail(scope.row)"
            v-hasPermi="['system:workinfo:edit']"
          >详情记录</el-button>
          <el-button
            v-if="scope.row.parentId!=0"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleRecord(scope.row)"
            v-hasPermi="['system:workinfo:edit']"
          >巡检记录</el-button>
          <el-button
            v-if ="scope.row.isDel==0 && scope.row.parentId==0"
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:workinfo:remove']"
          >作废</el-button>
          <el-button
            v-if ="scope.row.isDel==1"
            style="color: red"
            size="mini"
            type="text"
            icon="el-icon-delete"
          >已作废</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改巡检任务信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
        <el-form-item label="任务名称" prop="workName">
          <el-input v-model="form.workName" placeholder="请输入任务名称" />
        </el-form-item>
        <el-form-item label="任务类型" prop="workType">
          <el-select v-model="form.workType" placeholder="请选择任务类型">
            <el-option
              v-for="dict in workTypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="parseInt(dict.dictValue)"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-row :gutter="24" class="mb8">
          <el-col :span="12">
            <el-form-item label="开始时间" prop="workBeginTime" >
              <el-date-picker clearable size="small" style = "width: 100%;"
                              v-model="form.workBeginTime"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm"
                              placeholder="选择任务开始时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="截止时间" prop="workLimitTime" >
              <el-date-picker clearable size="small" style = "width: 100%;"
                              v-model="form.workLimitTime"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm"
                              placeholder="选择任务截止时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="任务描述" prop="workDescribe">
          <el-input type="textarea" v-model="form.workDescribe" placeholder="请输入任务描述" />
        </el-form-item>
        <el-form-item label="巡检点多个" prop="pantrolId">
          <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
          <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
          <!--<el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')" >父子联动</el-checkbox>-->
          <el-tree
            class="tree-border"
            :data="menuOptions"
            show-checkbox
            ref="menu"
            node-key="id"
            :check-strictly="!form.menuCheckStrictly"
            empty-text="加载中，请稍后"
            :props="defaultProps"
          ></el-tree>
          <!--<el-input v-model="form.pantrolId" type="textarea" placeholder="请输入内容" />-->
        </el-form-item>

        <el-form-item label="备注" prop="remarks">
          <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 巡检任务列表 -->
    <el-dialog title="巡检任务列表" :visible.sync="open2" width="1200px"  append-to-body>
      <el-row :gutter="10" >
        <el-col :span="5">
          <div class="div-left">
            <div style="font-size: 22px;text-align: center;padding: 10px 0 0 0;">任务信息</div>
            <el-form  label-width="85px" size="mini" style="padding: 15px 0 0 0;width: 95%">
              <el-form-item label="任务名称:" >
                  <span >{{form.workName}}</span>
              </el-form-item>
              <el-form-item label="任务类型:" >
                <span >{{workType}}</span>
              </el-form-item>
              <el-form-item label="开始时间:" >
                <span >{{form.workBeginTime}}</span>
              </el-form-item>
              <el-form-item label="截止时间:" >
                <span >{{form.workLimitTime}}</span>
              </el-form-item>
              <el-form-item label="任务描述:" >
                <span >{{form.workDescribe}}</span>
              </el-form-item>
              <el-form-item label="备注:" >
                <span >{{form.remarks}}</span>
              </el-form-item>
            </el-form>
          </div>
        </el-col>
        <el-col :span="19">
          <el-table v-loading="loading2" height="535px" :data="workinfoList2">
            <!--<el-table-column type="selection" width="55" align="center" />-->
            <!--<el-table-column label="计划/任务id" align="center" prop="workId" />-->
            <el-table-column label="任务名称" align="center" prop="workName" />
            <el-table-column label="任务类型" align="center" prop="workType" :formatter="workTypeFormat"  width="80" />
            <el-table-column label="任务开始时间" align="center" prop="workBeginTime" width="160">
            </el-table-column>
            <el-table-column label="任务截止时间" align="center" prop="workLimitTime" width="160">

            </el-table-column>
            <el-table-column label="部门" align="center" prop="deptName" width="100"/>
            <!--<el-table-column label="巡检点多个" align="center" prop="pantrolId" />-->
            <el-table-column label="巡检进度" align="center" prop="inspectPointNum" width="80">
              <template slot-scope="scope" >
                <span >{{scope.row.inspectSuccessNum}}/{{scope.row.inspectPointNum}}</span>
              </template>
            </el-table-column>
            <!--<el-table-column label="备注" align="center" prop="remarks" />-->
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleRecord(scope.row)"
                >巡检记录</el-button>
              </template>
            </el-table-column>
          </el-table>

          <pagination
            style="margin-top: 5px;height: 40px;background: #f7f7f7"
            v-show="total2>0"
            :total="total2"
            :page.sync="queryParams2.pageNum"
            :limit.sync="queryParams2.pageSize"
            @pagination="getList2"
          />
        </el-col>
      </el-row>
    </el-dialog>
    <!-- 巡检记录列表 -->
    <el-dialog title="巡检记录列表" :visible.sync="open3" width="1200px"  append-to-body>
      <el-row :gutter="10" >
        <el-col :span="5">
          <div class="div-left">
            <div style="font-size: 22px;text-align: center;padding: 10px 0 0 0;">任务信息</div>
            <el-form  label-width="85px" size="mini" style="padding: 15px 0 0 0;width: 95%">
              <el-form-item label="任务名称:" >
                <span >{{form.workName}}</span>
              </el-form-item>
              <el-form-item label="任务类型:" >
                <span >{{workType}}</span>
              </el-form-item>
              <el-form-item label="执行部门:" >
                <span >{{form.deptName}}</span>
              </el-form-item>
              <el-form-item label="开始时间:" >
                <span >{{form.workBeginTime}}</span>
              </el-form-item>
              <el-form-item label="截止时间:" >
                <span >{{form.workLimitTime}}</span>
              </el-form-item>
              <el-form-item label="任务描述:" >
                <span >{{form.workDescribe}}</span>
              </el-form-item>
              <el-form-item label="备注:" >
                <span >{{form.remarks}}</span>
              </el-form-item>
            </el-form>
          </div>
        </el-col>
        <el-col :span="19">
          <el-table v-loading="loading3" :data="recordeList" max-height="535px">
            <el-table-column label="巡检点" align="center" prop="patrolName" />
            <el-table-column label="打卡地点" align="center" prop="punchPlace" />
            <!--<el-table-column label="巡检参数" align="center" prop="patrolDetail" />-->
            <el-table-column label="打卡时间" align="center" prop="punchTime" width="180">
            </el-table-column>
            <el-table-column label="巡检点状态" align="center" prop="pointStatus" >
              <template slot-scope="scope">
                <span v-if="scope.row.pointStatus==0">未打卡</span>
                <span v-if="scope.row.pointStatus==1">已打卡</span>
              </template>
            </el-table-column>
            <el-table-column label="是否异常" align="center" prop="isException" >
              <template slot-scope="scope">
                <span v-if="scope.row.isException==0">正常</span>
                <span style="color: red" v-if="scope.row.isException==1">异常</span>
              </template>
            </el-table-column>
            <!--<el-table-column label="反馈内容" align="center" prop="feedBook" />-->
            <!--<el-table-column label="是否有异常：0.无、1.有" align="center" prop="isException" />-->
            <!--<el-table-column label="备注" align="center" prop="remarks" />-->
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-document"
                  @click="recordDetail(scope.row)"
                >详情</el-button>
                <el-button
                  v-if="scope.row.pointStatus==0"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleSign(scope.row)"
                >打卡</el-button>
              </template>
            </el-table-column>
            <pagination
              style="margin-top: 5px;height: 40px"
              v-show="total3>0"
              :total="total3"
              :page.sync="queryParams3.pageNum"
              :limit.sync="queryParams3.pageSize"
              @pagination="getList3"
            />
          </el-table>


        </el-col>
      </el-row>
    </el-dialog>
    <!-- 打卡 -->
    <el-dialog title="巡检打卡" :visible.sync="open4" width="600px"  append-to-body>

          <div style="width: 100%;min-height: 350px">
            <div class="dakaTitle">
              巡检点：<span class="detailcomment">{{xunDetail.patrolName}}</span>
            </div>
            <div class="detailTitle">
              打卡位置：<span class="detailcomment">{{xunDetail.position}}</span>
            </div>
            <div class="division" v-for="item of detailList"  >
              <div class="div-detail">{{item.paramName}}</div>
              <div class="div-detail" v-if="item.paramType==1" >{{item.paramNum1}} ～ {{item.paramNum2}}</div>
              <div class="div-detail" v-if="item.paramType==2" >
                <span v-if="item.paramNum1==1">是</span>
                <span v-if="item.paramNum1==0">否</span>
              </div>
              <div class="div-detail">
                <input v-if="item.paramType==1" v-model="item.testingNum" class="inputdiv" />
                <el-radio  v-if="item.paramType==2" v-model="item.testingNum" :label="1">是</el-radio>
                <el-radio  v-if="item.paramType==2" v-model="item.testingNum" :label="0">否</el-radio>
              </div>
            </div>
            <div class="detailTitle">
              反馈信息：
            </div>
            <textarea style="min-height: 100px;width: 100%" v-model="racodeDetail.feedBook"  />
          </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="testingSubmit">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 打卡详情 -->
    <el-dialog title="打卡详情" :visible.sync="open5" width="800px"  append-to-body>
      <el-row :gutter="24" >
        <el-col :span="8">
          <div  class="div-left2">
            <div style="width: 92%;margin-left: 4%">
              <el-form label-width="85px" size="mini">
                <el-form-item label="巡检点:" >
                  <span >{{xunDetail.patrolName}}</span>
                </el-form-item>
                <el-form-item label="打卡位置:" >
                  <span >{{xunDetail.position}}</span>
                </el-form-item>
                <el-form-item label="打卡时间:" >
                  <span >{{xunDetail.punchTime}}</span>
                </el-form-item>
                <el-form-item label="打卡状态:" >
                  <span  v-if="racodeDetail.pointStatus==0">未打卡</span>
                  <span  v-if="racodeDetail.pointStatus==1">已打卡</span>
                </el-form-item>
                <el-form-item label="异常状态:" >
                  <span  v-if="racodeDetail.isException==0">正常</span>
                  <span  style="color: red" v-if="racodeDetail.isException==1">异常</span>
                </el-form-item>
                <el-form-item label="反馈内容:" >
                  <span >{{xunDetail.feedBook}}</span>
                </el-form-item>
              </el-form>

            </div>
          </div>
        </el-col>
        <el-col :span="16">
          <el-table  :data="detailList" max-height="400px">
            <el-table-column label="参数名称" align="center" prop="paramName" />
            <!--<el-table-column label="巡检参数" align="center" prop="patrolDetail" />-->
            <el-table-column label="参数范围" align="center" >
              <template slot-scope="scope">
                <span v-if="scope.row.paramType==1">{{scope.row.paramNum1}} ～ {{scope.row.paramNum2}}</span>
                <span v-if="scope.row.paramType==2 && scope.row.paramNum1==1">是</span>
                <span v-if="scope.row.paramType==2 && scope.row.paramNum1==0">否</span>
              </template>
            </el-table-column>
            <el-table-column label="参数值" align="center" prop="testingNum" >
              <template  slot-scope="scope">
                <span v-if="scope.row.paramType==1">{{scope.row.testingNum}}</span>

                <span v-if="scope.row.paramType==2 && scope.row.testingNum=='1'">是</span>
                <span v-if="scope.row.paramType==2 && scope.row.testingNum=='0'">否</span>

              </template>
            </el-table-column>

          </el-table>

        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import { listWorkinfo,listTwoWorkinfo, getWorkinfo, delWorkinfo, addWorkinfo, updateWorkinfo, exportWorkinfo,treeDetail } from "@/api/system/workinfo";
import { listRecorde,updateRecorde} from "@/api/system/recorde";
import { getPosition } from "@/api/system/position";

export default {
  name: "Workinfo",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      loading2: true,
      loading3: true,
      loading4: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      total2:0,
      total3:0,
      // 巡检任务信息表格数据
      workinfoList: [],
      workinfoList2:[],
      // 巡检点记录信息表格数据
      recordeList: [],
      detailList:[],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open2:false,
      open3:false,
      open4:false,
      open5:false,
      racodeDetail:{},
      xunDetail:{},
      workType:"",
      // 1单次 2每天 3每周 4每月 5每季度字典
      workTypeOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        workType: null,
        workName: null,
      },
      // 查询参数
      queryParams2: {
        pageNum: 1,
        pageSize: 10,
        parentId:""
      },
      queryParams3: {
        pageNum: 1,
        pageSize: 10,
        workId:""
      },
      //选择巡检点
      menuExpand: false,
      menuNodeAll: false,
      // 菜单列表
      menuOptions: [],
      defaultProps: {
        children: "children",
        label: "label"
      },
      // 表单参数
      form: {
      },
      // 表单校验
      rules: {
        workType: [
          { required: true, message: "任务类型不能为空", trigger: "change" }
        ],
        workName: [
          { required: true, message: "任务名称不能为空", trigger: "blur" }
        ],
        workBeginTime: [
          { required: true, message: "开始时间不能为空", trigger: "blur" }
        ],
        workLimitTime: [
          { required: true, message: "结束时间不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("work_type").then(response => {
      this.workTypeOptions = response.data;
    });
  },
  methods: {
    /** 查询巡检任务信息列表 */
    getList() {
      this.loading = true;
      listTwoWorkinfo(this.queryParams).then(response => {
        this.workinfoList = response.rows;
        //this.workinfoList = this.handleTree(response.rows, "workId");
        this.total = response.total;
        this.loading = false;
      });
    },
    getList2() {
      this.loading2 = true;
      listWorkinfo(this.queryParams2).then(response => {
        this.workinfoList2 = response.rows;
      this.total2 = response.total;
      this.loading2 = false;
    });
    },
    /** 查询巡检点记录信息列表 */
    getList3() {
      this.loading3 = true;
      listRecorde(this.queryParams3).then(response => {
        this.recordeList = response.rows;
      this.total3 = response.total;
      this.loading3 = false;
    });
    },
    // 1单次 2每天 3每周 4每月 5每季度字典翻译
    workTypeFormat(row, column) {
      return this.selectDictLabel(this.workTypeOptions, row.workType);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel2() {
      this.open4 = false;
    },
    // 表单重置
    reset() {
      this.form = {
        workId: null,
        workType: null,
        planId: null,
        workName: null,
        workBeginTime: null,
        workLimitTime: null,
        workDescribe: null,
        pantrolId: null,
        inspectPointNum: null,
        inspectSuccessNum: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDel: null,
        menuCheckStrictly: true,
        remarks: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.workId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.getMenuTreeselect();
      this.reset();
      this.open = true;
      this.title = "添加巡检任务信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const workId = row.workId || this.ids
      getWorkinfo(workId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改巡检任务信息";
      });
    },
    handleDetail(row){
      this.queryParams2.pageNum = 1;
      console.log(row)
      this.workType = this.workTypeFormat(row,null);
      this.queryParams2.parentId= row.workId;
      this.getList2();
      this.open2=true;
      this.form= row;
    },
    handleRecord(row){
      this.queryParams3.pageNum = 1;
      this.workType = this.workTypeFormat(row,null);
      this.queryParams3.workId= row.workId;
      this.getList3();
      this.open3=true;
      this.form= row;
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          var ids =  this.getMenuAllCheckedKeys();
          if(ids.length<1){
            this.msgError("请选择巡检点")
            return;
          }
          this.form.pantrolId = JSON.stringify(ids);
          if (this.form.workId != null) {
            updateWorkinfo(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addWorkinfo(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      //const workIds = row.workId || this.ids;
      this.$confirm('是否确认作废该巡检任务数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return updateWorkinfo({workId:row.workId,isDel:1});
        }).then(() => {
          this.getList();
          this.msgSuccess("作废成功");
        }).catch(() => {});
    },
    // 树权限（展开/折叠）
    handleCheckedTreeExpand(value, type) {
      if (type == 'menu') {
        let treeList = this.menuOptions;
        for (let i = 0; i < treeList.length; i++) {
          this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
        }
      } else if (type == 'dept') {
        let treeList = this.deptOptions;
        for (let i = 0; i < treeList.length; i++) {
          this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
        }
      }
    },
    // 树权限（全选/全不选）
    handleCheckedTreeNodeAll(value, type) {
      if (type == 'menu') {
        this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
      } else if (type == 'dept') {
        this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
      }
    },
    // 树权限（父子联动）
    handleCheckedTreeConnect(value, type) {
      if (type == 'menu') {
        this.form.menuCheckStrictly = value ? true: false;
      } else if (type == 'dept') {
        this.form.deptCheckStrictly = value ? true: false;
      }
    },
    /** 查询菜单树结构 */
    getMenuTreeselect() {
      treeDetail().then(response => {
        console.log(response.data)
        this.menuOptions = response.data;
    });
    },
    // 所有菜单节点数据
    getMenuAllCheckedKeys() {
      // 目前被选中的菜单节点
      let checkedKeys = this.$refs.menu.getCheckedKeys(true);
      // 半选中的菜单节点
      // let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
      // checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);

      for (var a = checkedKeys.length-1;a>=0;a--){
        if(checkedKeys[a].toString().indexOf("-") == -1){
          checkedKeys.splice(a,1);
        }
      }
      console.log(checkedKeys);
      return checkedKeys;
    },
    //打卡展示
    handleSign(row){
        this.racodeDetail = row;
        getPosition(row.patrolId).then(response => {
          this.xunDetail = response.data;
          this.detailList= JSON.parse(response.data.patrolDetail);
          this.open4 = true;
      });
    },
    //打卡详情
    recordDetail(row){
      this.racodeDetail = row;
      getPosition(row.patrolId).then(response => {
        this.xunDetail = response.data;
        if(row.pointStatus==0){
          this.detailList= JSON.parse(response.data.patrolDetail);
        }else{
          this.detailList= JSON.parse(row.patrolDetail);
        }
      this.open5 = true;
    });
    },
    //打卡提交
    testingSubmit(){
      var fromDetail = this.racodeDetail;
      if(fromDetail.feedBook==null|| fromDetail.feedBook==""){
        this.msgError("请填写反馈意见");
        return;
      }
      for (var num =0  ; num<this.detailList.length; num++){
        if(this.detailList[num].testingNum===""){
          this.msgError("请完整填写参数值");
          return;
        }
      }
      fromDetail.patrolDetail = JSON.stringify(this.detailList);
      updateRecorde(fromDetail).then(response => {
        this.msgSuccess("打卡成功");
      this.open4 = false;
      this.getList3();
    });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有巡检任务信息数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportWorkinfo(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>
<style>
  .detailTitle{
    width: 100%;
    font-weight:700;
    padding: 20px 0 0 0;
  }
  .dakaTitle{
    width: 100%;
    font-weight:700;
    margin-left: 5px;
  }
  .detailcomment{
    font-weight:400;
    font-size: 13px;
  }
  .division{
    display:flex;
    flex-direction:row;
    justify-content:flex-start;
  }
  .div-detail{
    width: 30%;
    margin-top: 20px;
    margin-left: 5px;
  }
  .div-left{
    height: 530px;
    border-radius: 10px;
    background: white;
  }
  .div-left2{
    height: 400px;
    border-radius: 10px;
    background: white;
  }
  .inputdiv{
    width: 80px;
  }
  .deptname{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    cursor:pointer;
  }
</style>
<style lang="scss" scoped>
  ::v-deep .el-select{
    width: 100%;
  }
  ::v-deep .el-dialog__header{
    border-bottom: 1px solid #cccccc;
  }
  /*::v-deep .el-textarea__inner{*/
    /*height: 100px;*/
  /*}*/
  ::v-deep .el-dialog{
    min-height: 500px;
  }
  ::v-deep .el-table__row--level-1{
    background: #e9e9e9;
  }
  ::v-deep .el-dialog{
    background: #f7f7f7;
  }
  /*el-pagination*/
</style>
