<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <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 label="任务周期" prop="workCycle">
        <el-select v-model="queryParams.workCycle" placeholder="请选择任务周期" clearable size="small">
          <el-option
            v-for="dict in workCycleOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>

      <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>
        <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:workCheck: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:workCheck:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="workCheckList" 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="troubleName" />
      <el-table-column label="任务周期" align="center" prop="workCycle" :formatter="workCycleFormat"  width="80px"/>
      <el-table-column label="排查类型" align="center" prop="workType" :formatter="workTypeFormat" width="80px"/>
      <el-table-column label="排查形式" align="center" prop="workForm" :formatter="workFormFormat" width="80px"/>
      <el-table-column label="排查开始时间" align="center" prop="workBeginTime" width="180">

      </el-table-column>
      <el-table-column label="排查结束时间" align="center" prop="workEndTime" width="180">

      </el-table-column>
      <!--<el-table-column label="任务期限" align="center" prop="timeTerm" />-->
      <!--<el-table-column label="任务范围" align="center" prop="workRange" />-->
      <el-table-column label="责任部门" align="center" prop="deptName" />
      <el-table-column label="任务进展 " align="center" prop="workStep" width="80px" >
        <template slot-scope="scope">
          <div v-if="scope.row.workCycle==1 || scope.row.parentId!=0">
            <span style="color: red" v-if="scope.row.workStep==0">未进行</span>
            <span v-if="scope.row.workStep==1">待评估</span>
            <span v-if="scope.row.workStep==2">已评估</span>
            <span v-if="scope.row.workStep==3">待整改</span>
            <span v-if="scope.row.workStep==4">已结束</span>
          </div>
          <span v-if="scope.row.workCycle!=1 && scope.row.parentId==0">--</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            v-if ="scope.row.workCycle==1 || scope.row.parentId!=0"
            size="mini"
            type="text"
            icon="el-icon-document-copy"
            @click="handleDetail(scope.row)"
          >任务详情</el-button>

          <el-button
            v-if ="scope.row.workCycle!=1 && scope.row.parentId==0"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleRecord(scope.row)"
          >任务记录</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:workCheck: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="1200px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row :gutter="24" >
          <el-col :span="10">
            <el-form-item label="任务名称" prop="workName">
              <el-input v-model="form.workName" placeholder="请输入任务名称" />
            </el-form-item>

            <el-form-item label="任务周期" prop="workCycle">
              <el-select v-model="form.workCycle" placeholder="请选择任务周期">
                <el-option
                  v-for="dict in workCycleOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </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-form-item label="排查形式" prop="workForm">
              <el-select v-model="form.workForm" placeholder="请选择任务排查形式">
                <el-option
                  v-for="dict in workFormOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
            <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:ss"
                              placeholder="选择排查开始时间">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="结束时间" prop="workEndTime">
              <el-date-picker clearable size="small"
                              style = "width: 100%"
                              v-model="form.workEndTime"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="选择排查结束时间">
              </el-date-picker>
            </el-form-item>
            <!--<el-form-item label="责任部门" prop="deptId">-->
              <!--<el-input v-model="form.deptId" placeholder="请输入责任部门" />-->
            <!--</el-form-item>-->
            <el-form-item label="责任部门" prop="deptId">
              <!--<el-input v-model="form.deptId" placeholder="请输入部门id" />-->
              <el-select v-model="form.deptId" filterable placeholder="请选择责任部门">
                <el-option
                  v-for="dict in deptList"
                  :key="dict.deptId"
                  :label="dict.deptName"
                  :value="parseInt(dict.deptId)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="14">
            <!--<el-form-item label="关联隐患" prop="bookId">-->
              <!--<el-input v-model="form.bookId" placeholder="请" />-->
            <!--</el-form-item>-->
            <!--<el-form-item label="关联隐患" prop="bookId">-->
              <!--&lt;!&ndash;<el-input v-model="form.deptId" placeholder="请输入部门id" />&ndash;&gt;-->
              <!--<el-select v-model="form.bookId" placeholder="请选择关联隐患">-->
                <!--<el-option-->
                  <!--v-for="dict in bookList"-->
                  <!--:key="dict.bookId"-->
                  <!--:label="dict.troubleName"-->
                  <!--:value="parseInt(dict.bookId)"-->
                <!--&gt;</el-option>-->
              <!--</el-select>-->
            <!--</el-form-item>-->
            <el-form-item label="任务范围" prop="workRange">
              <el-input v-model="form.workRange" placeholder="请输入任务范围" />
            </el-form-item>
            <el-form-item label="排查库" >
              <!--<el-input v-model="form.deptId" placeholder="请输入部门id" />-->
              <el-select v-model="form.libraryId" placeholder="请选择" @change="selectLibrary">
                <el-option
                  v-for="dict in libraryList"
                  :key="dict.libraryId"
                  :label="dict.libraryName"
                  :value="parseInt(dict.libraryId)"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="排查内容" prop="content">
              <editor v-model="form.content" :min-height="200"/>
            </el-form-item>
          </el-col>
        </el-row>

        <!--<el-form-item label="任务期限" prop="timeTerm">-->
          <!--<el-input v-model="form.timeTerm" 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="24" >
          <el-col :span="6">
            <div class="div-left">
              <div style="font-size: 22px;text-align: center;padding: 10px 0 0 0;">任务信息</div>
              <el-form  label-width="80px" style="padding: 15px 0 0 0;width: 95%">

                  <el-form-item label="任务名称:"  style="margin-bottom: 10px">
                    <span>{{workInfo.workName}}</span>
                </el-form-item>
                <el-form-item label="关联隐患:" style="margin-bottom: 10px">
                  <span>{{workInfo.troubleName}}</span>
                </el-form-item>
                <el-form-item label="任务周期:" style="margin-bottom: 10px">
                  <span>{{workInfo.workCycle}}</span>
                </el-form-item>

                <el-form-item label="排查类型:" style="margin-bottom: 10px">
                  {{workInfo.workType}}
                </el-form-item>
                <el-form-item label="排查形式:" style="margin-bottom: 10px">
                  {{workInfo.workForm}}
                </el-form-item>
                <el-form-item label="开始时间:" style="margin-bottom: 10px">
                  {{workInfo.workBeginTime}}
                </el-form-item>
                <el-form-item label="结束时间" style="margin-bottom: 10px">
                  {{workInfo.workEndTime}}
                </el-form-item>

                <el-form-item label="责任部门" style="margin-bottom: 10px">
                  {{workInfo.deptName}}
                </el-form-item>
                <el-form-item label="任务范围" style="margin-bottom: 10px">
                  {{workInfo.workRange}}
                </el-form-item>

                <el-form-item label="排查内容" prop="content">
                  <dl v-html="workInfo.content">
                    {{workInfo.content}}
                  </dl>
                  <!--<editor v-model="workInfo.content" :min-height="200"/>-->
                </el-form-item>
              </el-form>
            </div>
          </el-col>
          <el-col :span="18">
            <el-table v-loading="loading" :data="childrenList" height="535px"  @selection-change="handleSelectionChange">
              <el-table-column label="任务名称" align="center" prop="workName" />
              <el-table-column label="排查开始时间" align="center" prop="workBeginTime" width="180">

              </el-table-column>
              <el-table-column label="排查结束时间" align="center" prop="workEndTime" width="180">

              </el-table-column>

              <el-table-column label="任务进展 " align="center" prop="workStep" width="80px" >
                <template slot-scope="scope">
                  <span style="color: red"  v-if="scope.row.workStep==0">未进行</span>
                  <span v-if="scope.row.workStep==1">待评估</span>
                  <span v-if="scope.row.workStep==2">已评估</span>
                  <span v-if="scope.row.workStep==3">待整改</span>
                  <span v-if="scope.row.workStep==4">已结束</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                  <el-button
                    v-if ="scope.row.workCycle==1 || scope.row.parentId!=0"
                    size="mini"
                    type="text"
                    icon="el-icon-document-copy"
                    @click="handleDetail(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="1000px" append-to-body>
      <el-form  label-width="100px">
        <!--<el-form-item label="结束时间" prop="workEndTime">-->
          <!--{{workInfo.workEndTime}}-->
        <!--</el-form-item>-->
        <div class="block">
          <el-timeline>
            <el-timeline-item :timestamp="assessment.checkTime+'（排查反馈）'" placement="top">
              <el-card>
                <el-form-item label="排查反馈:" >
                  <dl v-html="assessment.checkFeedback">
                    {{assessment.checkFeedback}}
                  </dl>
                </el-form-item>
                <el-form-item label="现场图片:" >
                  <img :src="assessment.checkUrl" style="height: 80px" @click="showPicture()"/>
                  <el-image :zIndex="9999" :ref="'a'+ 1" :src="assessment.checkUrl" v-show="false" :preview-src-list="[assessment.checkUrl]" v-if="assessment.checkUrl != '' && assessment.checkUrl != null"></el-image>

                </el-form-item>
                <el-form-item label="排查人员:" >
                  {{assessment.checkUser}}
                </el-form-item>
              </el-card>
            </el-timeline-item>
            <el-card v-if="pinggu">
              <el-form ref="assessment" :model="assessment" :rules="rules2" label-width="80px">
                <el-form-item label="评估内容" prop="assessmentContent">
                  <editor v-model="assessment.assessmentContent" :min-height="192"/>
                </el-form-item>

                <el-form-item label="风险等级" prop="assessmentLevel">
                  <el-select v-model="assessment.assessmentLevel" placeholder="请选择评估风险等级">
                    <el-option
                      v-for="dict in assessmentLevelOptions"
                      :key="dict.dictValue"
                      :label="dict.dictLabel"
                      :value="parseInt(dict.dictValue)"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="评估人" prop="assessmentUser">
                  <el-input v-model="assessment.assessmentUser" placeholder="请输入评估人" />
                </el-form-item>
              </el-form>
              <el-button type="primary" style="margin-left:42%" @click="submitping">确定</el-button>
            </el-card>
              <el-button v-if="!pinggu && assessment.assessmentTime==null" type="primary" style="margin-left:42%" @click="beginping">任务评估</el-button>

            <el-timeline-item v-if="assessment.assessmentTime!=null"  :timestamp="assessment.assessmentTime+'（风险评估）'" placement="top">
              <el-card>
                <el-form-item label="风险等级:" >
                  {{assessment.assessmentLevel}}
                </el-form-item>
                <el-form-item label="评估内容:" >
                  <dl v-html="assessment.assessmentContent">
                    {{assessment.assessmentContent}}
                  </dl>
                </el-form-item>
                <el-form-item label="评估人:" >
                  {{assessment.assessmentUser}}
                </el-form-item>
              </el-card>
            </el-timeline-item>
            <el-timeline-item v-if="assessment.modifyBegin!=null"  :timestamp="assessment.modifyBegin+'（隐患整改）'" placement="top">
              <el-card>
                <el-form-item label="是否整改:" >
                  <span v-if="assessment.isModify==1">是</span>
                  <span v-if="assessment.isModify==0">否</span>
                </el-form-item>
                <el-form-item label="整改意见:" >
                  <dl v-html="assessment.modifyOpinion">
                    {{assessment.modifyOpinion}}
                  </dl>
                </el-form-item>
                <el-form-item label="整改人:" >
                  {{assessment.modifyPeople}}
                </el-form-item>
                <el-form-item label="整改电话:" >
                  {{assessment.modifyPhone}}
                </el-form-item>
                <el-form-item label="整改期限:" >
                  {{assessment.modifyTerm}}天
                </el-form-item>
                <el-form-item label="结束时间:" >
                  {{assessment.modifyEnd}}
                </el-form-item>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </div>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { listWorkCheck, getWorkCheck, delWorkCheck, addWorkCheck, updateWorkCheck, exportWorkCheck } from "@/api/system/workCheck";
import { getAssessmentWorkId,updateAssessment } from "@/api/system/assessment";
import { listLibrary} from "@/api/system/library";
import { listBook } from "@/api/system/book";
import Editor from '@/components/Editor';
import { listDept } from "@/api/system/dept";
export default {
  name: "WorkCheck",
  components: {
    Editor,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      loading2: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      total2: 0,
      // 隐患排查任务表格数据
      workCheckList: [],
      childrenList:[],
      //部门列表
      deptList:[],
      //资料库
      libraryList:[],
      //隐患台账列表
      bookList:[],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open2: false,
      open3: false,
      pinggu: false,
      pingbutton:false,
      // 任务周期字典
      workCycleOptions: [],
      // 任务排查类型字典
      workTypeOptions: [],
      // 任务排查形式字典
      workFormOptions: [],
      assessmentLevelOptions:[],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        parentId: 0,
        bookId: null,
        workCycle: null,
        workName: null,
        workType: null,
      },
      // 查询参数
      queryParams2: {
        pageNum: 1,
        pageSize: 10,
        parentId: 0,
        bookId: null,
        workCycle: null,
        workName: null,
        workType: null,
      },
      // 表单参数
      form: {},
      workInfo:{},
      assessment:{},
      // 表单校验
      rules: {
        workCycle: [
          { required: true, message: "任务周期不能为空", trigger: "change" }
        ],
        workName: [
          { required: true, message: "任务名称不能为空", trigger: "blur" }
        ],
        workType: [
          { required: true, message: "任务排查类型不能为空", trigger: "change" }
        ],
        workForm: [
          { required: true, message: "任务排查形式不能为空", trigger: "change" }
        ],
        workBeginTime: [
          { required: true, message: "排查开始时间不能为空", trigger: "blur" }
        ],
        workEndTime: [
          { required: true, message: "排查结束时间不能为空", trigger: "blur" }
        ],
        deptId: [
          { required: true, message: "责任部门不能为空", trigger: "blur" }
        ],
        content: [
          { required: true, message: "排查内容不能为空", trigger: "blur" }
        ],
      },
      rules2: {
        assessmentContent: [
          {required: true, message: "评估内容不可空", trigger: "change"}
        ],
        assessmentLevel: [
          {required: true, message: "风险等级不可空", trigger: "change"}
        ],
        assessmentUser: [
          {required: true, message: "评估人不可空", trigger: "change"}
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getDeptList();
    this.getBookList();
    this.getDicts("work_type").then(response => {
      this.workCycleOptions = response.data;
    });
    this.getDicts("t_work_type").then(response => {
      this.workTypeOptions = response.data;
    });
    this.getDicts("t_type_form").then(response => {
      this.workFormOptions = response.data;
    });
    this.getDicts("assessment_level").then(response => {
      this.assessmentLevelOptions = response.data;
    });
    listLibrary({pageNum:1,pageSize:100}).then(response => {
      this.libraryList = response.rows;
    });
  },
  methods: {
    /** 查询隐患排查任务列表 */
    getList() {
      this.loading = true;
      listWorkCheck(this.queryParams).then(response => {
        this.workCheckList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getList2(workId) {
      this.loading2 = true;
      this.queryParams2.parentId = workId;
      listWorkCheck(this.queryParams2).then(response => {
        this.childrenList = response.rows;
      this.total2 = response.total;
      this.loading2 = false;
    });
    },
    getBookList() {
      listBook(this.queryParams).then(response => {
        this.bookList = response.rows;
    });
    },
    getDeptList() {
      listDept({status: undefined}).then(response => {
        this.deptList = response.data;
      console.log(this.deptList)
    });
    },
    // 任务周期字典翻译
    workCycleFormat(row, column) {
      return this.selectDictLabel(this.workCycleOptions, row.workCycle);
    },
    // 任务排查类型字典翻译
    workTypeFormat(row, column) {
      return this.selectDictLabel(this.workTypeOptions, row.workType);
    },
    // 任务排查形式字典翻译
    workFormFormat(row, column) {
      return this.selectDictLabel(this.workFormOptions, row.workForm);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        workId: null,
        parentId: null,
        bookId: null,
        workCycle: null,
        workName: null,
        workType: null,
        workForm: null,
        workBeginTime: null,
        workEndTime: null,
        timeTerm: null,
        workRange: null,
        deptId: null,
        workStep: null,
        content: null,
        createTime: null,
        createBy: null,
        isDel: 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.reset();
      this.open = true;
      this.title = "添加隐患排查任务";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const workId = row.workId || this.ids
      getWorkCheck(workId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改隐患排查任务";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.workId != null) {
            updateWorkCheck(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addWorkCheck(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    //任务记录
    handleRecord(row){
      this.getList2(row.workId);
      getWorkCheck(row.workId).then(response => {
        this.workInfo = response.data;
        this.workInfo.workCycle = this.selectDictLabel(this.workCycleOptions, this.workInfo.workCycle);
        this.workInfo.workType = this.selectDictLabel(this.workTypeOptions, this.workInfo.workType);
        this.workInfo.workForm = this.selectDictLabel(this.workFormOptions, this.workInfo.workForm);
        this.open2 = true;
    });
    },
    //任务详情
    handleDetail(row) {
      getAssessmentWorkId(row.workId).then(response => {
        console.log(response.data);
        if(response.data==undefined){
          this.msgError("任务未进行");
          return;
        }
        this.assessment = response.data;
      this.assessment.assessmentLevel = this.selectDictLabel(this.assessmentLevelOptions, response.data.assessmentLevel)
        this.open3 = true;
    });
    },
    showPicture(){
      console.log(this.$refs['a'+1]);
      this.$refs['a'+1].showViewer = true;
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      //const workIds = row.workId || this.ids;
      this.$confirm('是否确认作废这条隐患排查任务数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return updateWorkCheck({workId:row.workId,isDel:1});
        }).then(() => {
          this.getList();
          this.msgSuccess("作废成功");
        }).catch(() => {});
    },
    beginping(){
      this.pinggu = true;
    },
    submitping(){
      this.$refs["assessment"].validate(valid => {
        if (valid) {
            this.assessment.updateType = 2;
            updateAssessment(this.assessment).then(response => {
              this.msgSuccess("评估成功");
              this.pinggu = false;
              this.handleDetail(this.assessment);
            })
        }
      });
    },
    selectLibrary(val){
      for(var i=0;i<this.libraryList.length;i++){
        if(this.libraryList[i].libraryId == val){
          this.form.content = this.libraryList[i].libraryContent;
        }
      }
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有隐患排查任务数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportWorkCheck(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>
<style lang="scss" scoped>
  ::v-deep .el-select{
    width: 100%;
  }
  ::v-deep .el-dialog__header{
    border-bottom: 1px solid #ccc;
  }
  ::v-deep .el-table__row--level-1{
    background: #e9e9e9;
  }
  ::v-deep .el-dialog{
    background: #f7f7f7;
  }
  ::v-deep p{
    margin: 0;
  }
  ::v-deep .el-form-item__content{
    background: white;
  }
  .div-left{
    min-height: 530px;
    border-radius: 10px;
    background: white;
  }

  dl{
    margin: 0;
  }
</style>
