<template>
  <div class="inspectionRecord">
    <div class="statistics">
      <span
        >{{ $t("message.quality.sum") }}:
        <span class="value">{{ statisticsValue.totalNum }}</span>
      </span>
      <span
        >{{ $t("message.quality.hasBeenClosed") }}:
        <span class="value">{{ statisticsValue.closeNum }}</span></span
      >
      <span
        >{{ $t("message.quality.NotClosed") }}:
        <span class="value">{{ statisticsValue.notCloseNum }}</span></span
      >
      <span
        >{{ $t("message.quality.extendedPeriodNotClosed") }}:
        <span class="value">{{ statisticsValue.overdueNotCloseNum }}</span></span
      >
      <span
        >{{ $t("message.quality.afterRectification") }}:
        <span class="value">{{ statisticsValue.rectificationNum }}</span></span
      >
      <span
        >{{ $t("message.quality.toReview") }}:
        <span class="value">{{ statisticsValue.reviewNum }}</span></span
      >
      <span
        >{{ $t("message.quality.toCheck") }}:
        <span class="value">{{ statisticsValue.verificationNum }}</span></span
      >
    </div>
    <el-form
      :inline="true"
      :model="formInline"
      size="small"
      class="demo-form-inline"
      style="display: flex"
    >
      <el-form-item
        v-if="securityDangerListUp('检查时间')"
        :label="securityDangerListUp('检查时间')"
      >
        <el-date-picker
          style="width: 335px"
          v-model="time"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetimerange"
          :range-separator="$t('message.quality.to')"
          :start-placeholder="$t('message.quality.startDate')"
          :end-placeholder="$t('message.quality.endDate')"
          @change="checkedTime"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item
        v-if="securityDangerListUp('问题等级')"
        :label="securityDangerListUp('问题等级')"
      >
        <el-select
          style="width: 150px"
          v-model="formInline.level"
          :placeholder="$t('message.quality.problemLevel')"
        >
          <el-option :label="$t('message.quality.add')" value=""></el-option>
          <el-option :label="$t('message.quality.stair')" :value="1"></el-option>
          <el-option :label="$t('message.quality.second')" :value="2"></el-option>
          <el-option :label="$t('message.quality.three')" :value="3"></el-option>
          <el-option :label="$t('message.quality.four')" :value="4"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('message.quality.state')">
        <el-select
          style="width: 150px"
          v-model="formInline.status"
          :placeholder="$t('message.quality.state')"
        >
          <el-option :label="$t('message.quality.add')" value=""></el-option>
          <el-option label="待整改" :value="2"></el-option>
          <el-option label="待复查" :value="3"></el-option>
          <el-option label="待核验" :value="4"></el-option>
          <el-option label="超期未关闭" :value="7"></el-option>
          <el-option label="合格" :value="5"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item
        v-if="securityDangerListUp('紧急程度')"
        :label="securityDangerListUp('紧急程度')"
      >
        <el-select
          style="width: 150px"
          v-model="formInline.urgentLevel"
          :placeholder="$t('message.quality.urgencyDegree')"
        >
          <el-option :label="$t('message.quality.add')" value=""></el-option>
          <el-option :label="$t('message.quality.ordinary')" :value="1"></el-option>
          <el-option :label="$t('message.quality.severity')" :value="2"></el-option>
          <el-option :label="$t('message.quality.critical')" :value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" plain @click="onSubmit">{{
          $t("message.quality.inquire")
        }}</el-button>
        <el-button type="warning" plain @click="refreshBtn">{{
          $t("message.quality.flush")
        }}</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      class="tables"
      height="calc(100% - 150px)"
      style="width: 100%; min-height: initial"
      ref="multipleTable"
    >
      <el-table-column
        :label="$t('message.quality.numericalOrder')"
        type="index"
        width="55"
      >
      </el-table-column>
      <el-table-column
        :width="securityDangerPinnedList.length > 0 ? 120 : ''"
        label="检查类型"
        align="center"
        prop="recordType"
      >
        <template slot-scope="scope">{{
          scope.row.recordType == 1 ? "质量问题" : "排查记录"
        }}</template>
      </el-table-column>
      <el-table-column
        :width="securityDangerPinnedList.length > 0 ? 120 : ''"
        label="状态"
        align="center"
        prop="status"
      >
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.status != 6">
            {{
              scope.row.status == 1
                ? $t("message.quality.noRectification")
                : scope.row.status == 2
                ? $t("message.quality.afterRectification")
                : scope.row.status == 3
                ? $t("message.quality.toReview")
                : scope.row.status == 4
                ? $t("message.quality.toCheck")
                : scope.row.status == 5
                ? $t("message.quality.qualified")
                : scope.row.status == 6
                ? $t("message.quality.disqualification")
                : scope.row.status == ""
                ? $t("message.quality.qualified")
                : ""
            }}
          </el-button>
          <span style="color: #94979e" v-else>已撤回</span>
          <span
            class="tableStatus"
            v-show="scope.row.overTime == true && scope.row.status != 6"
            >超期</span
          >
        </template>
      </el-table-column>
      <el-table-column
        :width="securityDangerPinnedList.length > 0 ? 150 : ''"
        label="检查人"
        align="center"
        prop="inspectManName"
      >
        <template slot-scope="scope">{{ scope.row.inspectManName }}</template>
      </el-table-column>
      <el-table-column
        v-for="item in securityDangerPinnedList"
        :key="item.id"
        align="center"
        prop="changeLimitTime"
        show-overflow-tooltip
        :width="170"
        :label="item.displayFieldName ? item.displayFieldName : item.originalFieldName"
      >
        <template slot-scope="scope">
          <template v-if="item.originalFieldName == '上传附件'">
            <span
              style="color: #5181f6; cursor: pointer; margin-top: 3px"
              class="value"
              @click.stop="playerVideo(scope.row[item.fieldName])"
            >
              {{ scope.row[item.fieldName].split("*")[0] }}
            </span>
          </template>
          <div
            v-else-if="
              item.originalFieldName == '隐患图片' ||
              item.originalFieldName == '上传图片' ||
              item.originalFieldName == '整改后图片'
            "
          >
            <el-image
              v-for="(item, index) in parseImage2(scope.row[item.fieldName])"
              :key="index"
              style="width: 100px; height: 100px; margin-right: 10px"
              :src="item"
              :preview-src-list="parseImage2(item.fileUrl)"
              @click="openImg(item)"
            >
            </el-image>
          </div>
          <template v-else>
            {{ dataNameUp(scope.row, item) }}
          </template>
        </template>
      </el-table-column>

      <!-- <el-table-column label="检查类型" align="center" prop="recordType">
        <template slot-scope="scope">{{
          scope.row.recordType == 1 ? "质量问题" : "排查记录"
        }}</template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="changeLimitTime"
        :width="170"
        :label="
          $t('message.quality.inspectionResult') +
          '/' +
          $t('message.quality.rectificationLimit')
        "
      >
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.status != 6">
            {{
              scope.row.status == 1
                ? $t("message.quality.noRectification")
                : scope.row.status == 2
                ? $t("message.quality.afterRectification")
                : scope.row.status == 3
                ? $t("message.quality.toReview")
                : scope.row.status == 4
                ? $t("message.quality.toCheck")
                : scope.row.status == 5
                ? $t("message.quality.qualified")
                : scope.row.status == 6
                ? $t("message.quality.disqualification")
                : scope.row.status == ""
                ? $t("message.quality.qualified")
                : ""
            }}
          </el-button>
          <span style="color: #94979e" v-else>已撤回</span>
          <span
            class="tableStatus"
            v-show="scope.row.overTime == true && scope.row.status != 6"
            >超期</span
          >
          <div>{{ scope.row.changeLimitTime }}</div>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="inspectManName"
        :label="
          $t('message.quality.rummager') +
          '/' +
          $t('message.quality.inspectionTime')
        "
        width="180"
      >
        <template slot-scope="scope">
          <div>{{ scope.row.inspectManName }}</div>
          <div>{{ scope.row.inspectTime }}</div>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="dangerItemContent" label="隐患类别">
      </el-table-column>
      <el-table-column
        :width="220"
        align="center"
        prop="dangerItemContent"
        label="隐患信息"
      >
        <template slot-scope="scope">
          <div class="hidden_info">
            <div class="hidden_top">
              <div
                :class="{
                  'hidden-start1': scope.row.urgentLevel == 1,
                  'hidden-start2': scope.row.urgentLevel == 2,
                  'hidden-start3': scope.row.urgentLevel == 3,
                }"
              >
                {{
                  scope.row.urgentLevel == 1
                    ? "一般"
                    : scope.row.urgentLevel == 2
                    ? "严重"
                    : scope.row.urgentLevel == 3
                    ? "紧要"
                    : ""
                }}
              </div>
              <el-tooltip
                class="item"
                effect="dark"
                :content="scope.row.problemDescription"
                placement="top-start"
              >
                <div>{{ scope.row.problemDescription }}</div>
              </el-tooltip>
            </div>
            <div class="hidden_bottom">
              <div @click="showImgViewer(scope.row.imageUrl)">
                <div>
                  <i class="el-icon-picture"></i>
                </div>
                <div>{{ parseImage2(scope.row.imageUrl).length }}</div>
              </div>
              <div>
                <div>
                  <i class="el-icon-location-information"></i>
                </div>
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="scope.row.regionName"
                  placement="top-start"
                >
                  <div>{{ scope.row.regionName }}</div>
                </el-tooltip>
              </div>
              <div>
                {{
                  scope.row.level == 1
                    ? "一级"
                    : scope.row.level == 2
                    ? "二级"
                    : scope.row.level == 3
                    ? "三级"
                    : scope.row.level == 4
                    ? "四级"
                    : "--"
                }}
              </div>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="changeName"
        :label="$t('message.quality.rectificationPeople')"
      >
      </el-table-column>
      <el-table-column
        align="center"
        prop="reviewName"
        :label="$t('message.quality.reviewOfThePeople')"
      >
      </el-table-column>
      <el-table-column
        align="center"
        prop="verifyManName"
        :label="$t('message.quality.checkOne')"
      >
      </el-table-column>
      <el-table-column align="center" prop="remark" label="整改要求">
        <template slot-scope="scope">
          <div :title="scope.row.remark" class="textSty">
            {{ scope.row.remark }}
          </div>
        </template>
      </el-table-column> -->
      <el-table-column fixed="right" align="center" label="操作" width="280">
        <template slot-scope="scope">
          <div class="tableBtns" style="justify-content: center">
            <div
              @click="newShowDatadetails(scope.row, scope.$index)"
              class="operationText"
            >
              <img
                src="@/assets/images/icon-abarbeitung.png"
                width="15px"
                height="15px"
              />
              <!-- 删除 -->
              <span>{{
                scope.row.status == 2
                  ? "整改"
                  : scope.row.status == 3
                  ? "复查"
                  : scope.row.status == 4
                  ? "核验"
                  : ""
              }}</span>
            </div>
            <div
              v-if="scope.row.status == 2"
              @click="onPostponeApply(scope.row, 1)"
              class="operationText"
            >
              <img
                src="@/assets/images/icon-postponeapply.png"
                width="15px"
                height="15px"
              />
              <!-- 删除 -->
              <span>申请延期</span>
            </div>
            <div
              v-if="scope.row.status == 2"
              @click="onPostponeApply(scope.row, 2)"
              class="operationText"
            >
              <img src="@/assets/images/icon-turnover.png" width="15px" height="15px" />
              <!-- 删除 -->
              <span>移交</span>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      class="pagerBox"
      style="margin: 30px 0 20px"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageNo"
      :page-sizes="$store.state.PAGESIZRS"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next"
      :total="Number(total)"
      background
    ></el-pagination>
    <el-image-viewer
      v-if="imgViewerVisible"
      :on-close="closeImgViewer"
      :url-list="previewList"
    />
    <!-- //编辑责任区域 -->
    <el-dialog
      :modal-append-to-body="false"
      @close="close"
      :title="addTitle"
      :visible.sync="addDialog"
      width="866px"
      :close-on-click-modal="false"
    >
      <vue-scroll style="height: 600px">
        <div class="dialog_content" style="padding: 0 100px">
          <el-radio-group
            v-model="recordType"
            size="small"
            style="margin-bottom: 20px"
            @change="close"
          >
            <el-radio-button
              :label="1"
              :disabled="!(addForm1.status != 6) && recordType == 2"
              v-show="type == 'add' || (type == 'detail' && recordType == 1)"
              >质量问题</el-radio-button
            >
            <el-radio-button
              v-if="COMPANY != 'zjwj'"
              :label="2"
              :disabled="!(addForm1.status != 6) && recordType == 1"
              v-show="type == 'add' || (type == 'detail' && recordType == 2)"
              >{{ $t("message.quality.recordsOfTheFebruary") }}</el-radio-button
            >
          </el-radio-group>
          <div v-show="recordType == 1 || (recordType == 1 && type == 'detail')">
            <el-form
              ref="addForm1"
              size="small"
              :rules="addForm1Rules"
              :model="addForm1"
              label-width="120px"
            >
              <!--              检查部位-->
              <el-form-item :label="$t('message.quality.checkPoint')" prop="regionId">
                <el-cascader
                  :disabled="type == 'detail'"
                  v-model="addForm1.regionId"
                  style="width: 400px"
                  clearable
                  ref="formRegion1"
                  :options="checkPointList"
                  :props="checkPointProps"
                  @change="changeRegion"
                ></el-cascader>
              </el-form-item>
              <!-- 问题描述 -->
              <el-form-item
                :label="$t('message.quality.problemDescription')"
                prop="dangerItemId"
              >
                <div class="custom-cascader-wrapper">
                  <el-cascader
                    :disabled="type == 'detail'"
                    :options="classifyList"
                    v-model="addForm1.dangerItemId"
                    style="width: 400px"
                    :show-all-levels="false"
                    @clear="addForm1.dangerItemId = []"
                    :props="checkClassifyProps"
                    clearable
                    @change="handleChange"
                    ref="cascaderAddr"
                  ></el-cascader>
                </div>
              </el-form-item>

              <!--              问题分类-->
              <el-form-item :label="$t('message.quality.questionClassification')">
                <el-input
                  style="width: 400px"
                  v-model="addForm1.dangerItemContent"
                  disabled
                ></el-input>
                <!-- prop="dangerItemId" -->
                <!-- <el-cascader
                  disabled
                  v-model="addForm1.dangerItemId"
                  style="width: 400px"
                  ref="formRegion2"
                  @change="selectcascader"
                  @focus="focuscascader"
                  @blur="blurcascader"
                  clearable
                  :props="checkClassifyProps"
                  @clear="addForm1.dangerItemId = []"
                  :options="classifyList"
                ></el-cascader> -->
              </el-form-item>
              <el-form-item :label="$t('message.quality.moreInfo')" prop="dangerDesc">
                <el-input
                  :disabled="type == 'detail'"
                  type="textarea"
                  style="width: 400px"
                  :placeholder="
                    $t('message.quality.pleaseEnter') + $t('message.quality.content')
                  "
                  v-model="addForm1.dangerDesc"
                >
                </el-input>
              </el-form-item>
              <!--              整改要求-->
              <el-form-item
                :label="$t('message.quality.rectificationRequest')"
                prop="remark"
              >
                <el-input
                  :disabled="type == 'detail'"
                  type="textarea"
                  style="width: 400px"
                  :placeholder="
                    $t('message.quality.pleaseEnter') + $t('message.quality.content')
                  "
                  v-model="addForm1.remark"
                >
                </el-input>
              </el-form-item>

              <el-form-item
                :label="$t('message.quality.routineCheck')"
                prop="routineId"
                v-if="routineList.length > 0"
              >
                <el-radio-group v-model="addForm1.routineId" :disabled="type == 'detail'">
                  <el-radio
                    v-for="(item, index) in routineList"
                    :key="index"
                    :label="item.id"
                    >{{ item.name }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>
              <!-- <el-form-item
                label="分部工程"
                prop="subsectionId"
                :disabled="type == 'detail'"
              >
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm1.subsectionId"
                  @change="checkSubListData"
                  filterable
                  style="width: 400px"
                  clearable
                  placeholder="请选择"
                >
                  <el-option
                    v-for="(item, index) in listData"
                    :key="index"
                    :label="item.subdivisionProjectName"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="分项工程" prop="subentryId">
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm1.subentryId"
                  filterable
                  style="width: 400px"
                  clearable
                  placeholder="请选择"
                >
                  <el-option
                    v-for="(item, index) in subListData"
                    :key="index"
                    :label="item.subdivisionProjectName"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="巡检楼层" prop="floor">
                <el-input
                  style="width: 400px"
                  :disabled="type == 'detail'"
                  placeholder="请输入整数"
                  v-model="addForm1.floor"
                  @input="
                    addForm1.floor = addForm1.floor.replace(/[^\-\d]/g, '')
                  "
                >
                </el-input>
              </el-form-item> -->
              <el-form-item label="事件描述" prop="addedDescription">
                <el-input
                  :disabled="type == 'detail'"
                  type="textarea"
                  style="width: 400px"
                  :placeholder="
                    $t('message.quality.pleaseEnter') + $t('message.quality.content')
                  "
                  v-model="addForm1.addedDescription"
                >
                </el-input>
              </el-form-item>
              <el-form-item :label="$t('message.quality.problemLevel')" prop="level">
                <!--                问题等级-->
                <el-radio-group v-model="addForm1.level" :disabled="type == 'detail'">
                  <el-radio :label="1">{{ $t("message.quality.stair") }}</el-radio>
                  <el-radio :label="2">{{ $t("message.quality.second") }}</el-radio>
                  <el-radio :label="3">{{ $t("message.quality.three") }}</el-radio>
                  <el-radio :label="4">{{ $t("message.quality.four") }}</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item
                :label="$t('message.quality.urgencyDegree')"
                prop="urgentLevel"
              >
                <el-radio-group
                  v-model="addForm1.urgentLevel"
                  :disabled="type == 'detail'"
                >
                  <el-radio label="1">{{ $t("message.quality.ordinary") }}</el-radio>
                  <el-radio label="2">{{ $t("message.quality.severity") }}</el-radio>
                  <el-radio label="3">{{ $t("message.quality.critical") }}</el-radio>
                </el-radio-group>
              </el-form-item>
              <!--              检查人-->
              <!-- <el-form-item
                :label="$t('message.quality.rummager')"
                prop="inspectManId"
              >
                <el-select
                :disabled="type=='detail'"
                  v-model="addForm1.inspectManId"
                  filterable
                  style="width: 400px"
                  clearable
                  :placeholder="$t('message.quality.pleaseSelect')"
                >
                  <el-option
                    v-for="item in crewList"
                    :key="item.userId"
                    :label="item.workerName"
                    :value="item.userId"
                  > -->
              <!-- <span style="float: left">{{ item.workerName }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px"
                      >{{ $t("message.quality.phoneNumber") }}：{{
                        item.userTel
                          ? item.userTel.substring(0, 3) +
                            "****" +
                            item.userTel.substring(7)
                          : ""
                      }}</span
                    > -->
              <!-- </el-option>
                </el-select>
              </el-form-item> -->
              <el-form-item
                :label="$t('message.quality.inspectionTime')"
                prop="inspectTime"
              >
                <el-date-picker
                  :disabled="true"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  style="width: 400px"
                  v-model="addForm1.inspectTime"
                  type="datetime"
                  :placeholder="$t('message.quality.optionDate')"
                >
                </el-date-picker>
              </el-form-item>

              <el-form-item
                v-if="COMPANY != 'zjwj'"
                :label="$t('message.quality.subContractor')"
                prop="enterpriseName"
              >
                <el-input
                  :disabled="type == 'detail'"
                  placeholder="请选择"
                  style="width: 400px"
                  v-model="addForm1.enterpriseName"
                  clearable
                  @focus="getEnterprise"
                  @clear="
                    addForm1.enterpriseSn = '';
                    addForm1.enterpriseName = '';
                    addForm1.changeId = '';
                    crewUpdateList = [];
                  "
                >
                </el-input>
              </el-form-item>
              <el-form-item
                :label="$t('message.quality.rectificationLimit')"
                prop="changeLimitTime"
              >
                <el-date-picker
                  :disabled="type == 'detail'"
                  style="width: 400px"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  v-model="addForm1.changeLimitTime"
                  type="datetime"
                  :placeholder="$t('message.quality.optionDate')"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item
                :label="$t('message.quality.rectificationPeople')"
                prop="changeId"
              >
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm1.changeId"
                  filterable
                  style="width: 400px"
                  clearable
                  :placeholder="$t('message.quality.pleaseSelect')"
                >
                  <el-option
                    v-for="item in crewUpdateList"
                    :key="item.userId + ''"
                    :label="item.realName"
                    :value="item.userId + ''"
                  >
                    <!-- <span style="float: left">{{ item.workerName }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px"
                      >{{ $t("message.quality.phoneNumber") }}：{{
                        item.userTel
                          ? item.userTel.substring(0, 3) +
                            "****" +
                            item.userTel.substring(7)
                          : ""
                      }}</span
                    > -->
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                :label="$t('message.quality.reviewOfThePeople')"
                prop="reviewId"
              >
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm1.reviewId"
                  filterable
                  style="width: 400px"
                  clearable
                  :placeholder="$t('message.quality.pleaseSelect')"
                >
                  <el-option
                    v-for="item in reviewList"
                    :key="item.userId + ''"
                    :label="item.realName"
                    :value="item.userId + ''"
                  >
                    <!-- <span style="float: left">{{ item.workerName }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px"
                      >{{ $t("message.quality.phoneNumber") }}：{{
                        item.userTel
                          ? item.userTel.substring(0, 3) +
                            "****" +
                            item.userTel.substring(7)
                          : ""
                      }}</span
                    > -->
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('message.quality.checkOne')" prop="verifyManId">
                <el-select
                  :disabled="true"
                  v-model="addForm1.verifyManId"
                  filterable
                  style="width: 400px"
                  clearable
                  :placeholder="$t('message.quality.pleaseSelect')"
                >
                  <el-option
                    v-for="item in crewList"
                    :key="item.userId + ''"
                    :label="item.realName"
                    :value="item.userId + ''"
                  >
                    <!-- <span style="float: left">{{ item.workerName }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px"
                      >{{ $t("message.quality.phoneNumber") }}：{{
                        item.userTel
                          ? item.userTel.substring(0, 3) +
                            "****" +
                            item.userTel.substring(7)
                          : ""
                      }}</span
                    > -->
                  </el-option>
                </el-select>
              </el-form-item>
              <!-- <el-form-item
                :label="$t('message.quality.notifier')"
                prop="notifyPerson"
              >
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm1.notifyPerson"
                  filterable
                  style="width: 400px"
                  multiple
                  :placeholder="$t('message.quality.pleaseSelect')"
                >
                  <el-option
                    v-for="item in crewList"
                    :key="item.userId + ''"
                    :label="item.workerName"
                    :value="item.userId + ''"
                  >
                   
                  </el-option>
                </el-select>
              </el-form-item> -->
              <el-form-item :label="$t('message.quality.sceneChanges')" prop="status">
                <el-switch
                  :disabled="type == 'detail'"
                  v-model="addForm1.status"
                  :active-text="$t('message.quality.completed')"
                  :inactive-text="$t('message.quality.unfinished')"
                  active-color="#13ce66"
                  :active-value="5"
                  :inactive-value="2"
                >
                </el-switch>
              </el-form-item>
              <!-- 图纸定位 -->
              <!-- <el-form-item
                v-if="COMPANY != 'longguang'"
                :label="$t('message.quality.drawingPositioning')"
              >
                <el-button
                  :disabled="type == 'detail'"
                  type="text"
                  icon="el-icon-location-information"
                  @click="drawingPositionBtn"
                  >{{ $t('message.quality.positionOnTheDrawing') }}</el-button
                >
              </el-form-item> -->
              <!--              上传图片-->
              <el-form-item :label="$t('message.quality.uploadPictures')" prop="imgUrl">
                <el-upload
                  :class="{ hide: hideUpload }"
                  :disabled="type == 'detail'"
                  :action="uploadUrl"
                  list-type="picture-card"
                  :on-success="(file) => handleSuccess(file, 1)"
                  :on-error="(file) => handleError(file, 1)"
                  :on-remove="(file, fileList) => handleRemove(file, fileList, 1)"
                  :on-preview="(file) => handlePreview(file, 1)"
                  accept="image/jpeg,image/jpg,image/png"
                  :before-upload="(file) => beforeUpload(file, 1)"
                  name="files"
                  :file-list="fileList1"
                >
                  <!-- :limit="5" -->
                  <i class="el-icon-plus"></i>
                </el-upload>
                <!--                支持格式-->
                <span>{{ $t("message.quality.uploadHint") }}</span>
              </el-form-item>
              <el-form-item prop="fileUrl">
                <el-upload
                  :disabled="type == 'detail'"
                  class="upload-demo"
                  :action="uploadUrl"
                  :on-success="(file) => handleSuccess(file, 2)"
                  :on-error="(file) => handleError(file, 2)"
                  :on-remove="(file, fileList) => handleRemove(file, fileList, 2)"
                  :on-preview="(file) => handlePreview(file, 2)"
                  :limit="1"
                  :file-list="fileList2"
                  :before-upload="(file) => beforeUpload(file, 2)"
                  name="files"
                >
                  <el-button :disabled="type == 'detail'" size="small" type="primary">{{
                    $t("message.quality.uploadAttachment")
                  }}</el-button>
                  <!--                  上传附件-->
                  <div slot="tip" class="el-upload__tip">
                    {{ $t("message.quality.uploadHint2") }}
                  </div>
                </el-upload>
              </el-form-item>
            </el-form>
            <!-- <el-divider
              content-position="left"
              v-if="rectifyRecordList.length > 0"
              >整改记录</el-divider
            >
            <el-timeline class="detailBox" :reverse="true">
              <el-timeline-item
                :timestamp="item.createTime"
                placement="top"
                v-for="(item, index) in rectifyRecordList"
                :key="index"
              >
                <el-card>
                  <p class="grid-content">
                    <span class="label"
                      >{{ item.type == 1 ? '整改人' : '复查人' }}：</span
                    ><span class="value">{{ item.createUserName }}</span>
                  </p>
                  <p class="grid-content" v-if="item.type == 1">
                    <span class="label">整改状态：</span
                    ><span class="value">{{
                      item.status == 2 ? '已整改' : '未整改'
                    }}</span>
                  </p>
                  <p class="grid-content" v-else>
                    <span class="label">复查状态：</span
                    ><span class="value">{{
                      item.status == 2 ? '合格' : '不合格'
                    }}</span>
                  </p>
                  <p class="grid-content">
                    <span class="label">相关说明：</span
                    ><span class="value">{{ item.additionalRemarks }}</span>
                  </p>
                  <div class="grid-content" v-if="imgList[index]">
                    <span class="label">相关照片：</span>
                    <span class="value">
                      <el-image
                        @click="
                          openImg($store.state.FILEURL + imgList[index][0].url)
                        "
                        style="width: 50px"
                        :src="$store.state.FILEURL + imgList[index][0].url"
                      >
                      </el-image>
                    </span>
                  </div>
                </el-card>
              </el-timeline-item>
            </el-timeline> -->
          </div>
          <div v-show="recordType == 2 || (recordType == 2 && type == 'detail')">
            <el-form
              ref="addForm2"
              size="small"
              :rules="addForm2Rules"
              :model="addForm2"
              label-width="120px"
            >
              <el-form-item :label="$t('message.quality.checkPoint')" prop="regionId">
                <el-cascader
                  :disabled="type == 'detail'"
                  v-model="addForm2.regionId"
                  style="width: 400px"
                  clearable
                  :options="checkPointList"
                  ref="addFormRegion2"
                  :props="checkPointProps"
                  @clear="addForm2.regionId = ''"
                  @change="changeRegion"
                ></el-cascader>
              </el-form-item>
              <el-form-item
                :label="$t('message.quality.classification')"
                prop="dangerItemId"
              >
                <el-cascader
                  :disabled="type == 'detail'"
                  :options="classifyList"
                  v-model="addForm2.dangerItemId"
                  style="width: 400px"
                  @clear="addForm2.dangerItemId = []"
                  :props="checkClassifyProps"
                  clearable
                  @change="handleChange"
                  ref="cascaderAddr2"
                ></el-cascader>
              </el-form-item>
              <!-- <el-form-item
                label="分部工程"
                prop="subsectionId"
                :disabled="type == 'detail'"
              >
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm2.subsectionId"
                  @change="checkSubListData"
                  filterable
                  style="width: 400px"
                  :clearable="true"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="(item, index) in listData"
                    :key="index"
                    :label="item.subdivisionProjectName"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="分项工程" prop="subentryId">
                <el-select
                  :disabled="type == 'detail'"
                  v-model="addForm2.subentryId"
                  filterable
                  style="width: 400px"
                  :clearable="true"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="(item, index) in subListData"
                    :key="index"
                    :label="item.subdivisionProjectName"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item> -->
              <!-- <el-form-item label="巡检楼层" prop="floor">
                <el-input
                  style="width: 400px"
                  :disabled="type == 'detail'"
                  placeholder="请输入整数"
                  v-model="addForm2.floor"
                >
                </el-input>
              </el-form-item> -->
              <el-form-item label="事件描述" prop="addedDescription">
                <el-input
                  :disabled="type == 'detail'"
                  type="textarea"
                  style="width: 400px"
                  :placeholder="
                    $t('message.quality.pleaseEnter') + $t('message.quality.content')
                  "
                  v-model="addForm2.addedDescription"
                >
                </el-input>
              </el-form-item>
              <el-form-item :label="$t('message.quality.moreInfo')" prop="dangerDesc">
                <el-input
                  :disabled="type == 'detail'"
                  style="width: 400px"
                  type="textarea"
                  :placeholder="
                    $t('message.quality.pleaseEnter') + $t('message.quality.content')
                  "
                  v-model="addForm2.dangerDesc"
                >
                </el-input>
              </el-form-item>

              <el-form-item
                :label="$t('message.quality.routineCheck')"
                prop="routineId"
                v-if="routineList.length > 0"
              >
                <el-radio-group v-model="addForm2.routineId" :disabled="type == 'detail'">
                  <el-radio
                    v-for="(item, index) in routineList"
                    :key="index"
                    :label="item.id"
                    >{{ item.name }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>

              <!-- <el-form-item
                :label="$t('message.quality.rummager')"
                prop="inspectManId"
              >
                <el-select
                :disabled="type=='detail'"
                  v-model="addForm2.inspectManId"
                  filterable
                  style="width: 400px"
                  clearable
                  :placeholder="$t('message.quality.pleaseSelect')"
                >
                  <el-option
                    v-for="item in crewList"
                    :key="item.userId"
                    :label="item.workerName"
                    :value="item.userId"
                  > -->
              <!-- <span style="float: left">{{ item.workerName }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px"
                      >{{ $t("message.quality.phoneNumber") }}：{{
                        item.userTel
                          ? item.userTel.substring(0, 3) +
                            "****" +
                            item.userTel.substring(7)
                          : ""
                      }}</span
                    > -->
              <!-- </el-option>
                </el-select>
              </el-form-item> -->
              <el-form-item
                :label="$t('message.quality.inspectionTime')"
                prop="inspectTime"
              >
                <el-date-picker
                  :disabled="true"
                  style="width: 400px"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  v-model="addForm2.inspectTime"
                  type="datetime"
                  :placeholder="$t('message.quality.optionDate')"
                >
                </el-date-picker>
              </el-form-item>

              <el-form-item
                :label="$t('message.quality.subContractor')"
                prop="enterpriseName"
              >
                <el-input
                  :disabled="type == 'detail'"
                  placeholder="请选择"
                  style="width: 400px"
                  v-model="addForm2.enterpriseName"
                  clearable
                  @focus="getEnterprise"
                  @clear="
                    addForm2.enterpriseSn = '';
                    addForm2.enterpriseName = '';
                  "
                >
                </el-input>
              </el-form-item>
              <!--              上传图片-->
              <el-form-item :label="$t('message.quality.uploadPictures')" prop="imgUrl">
                <el-upload
                  :class="{ hide: hideUpload }"
                  :disabled="type == 'detail'"
                  :action="uploadUrl"
                  list-type="picture-card"
                  :on-success="(file) => handleSuccess(file, 3)"
                  :on-error="(file) => handleError(file, 3)"
                  :on-remove="(file, fileList) => handleRemove(file, fileList, 3)"
                  :on-preview="(file) => handlePreview(file, 3)"
                  :file-list="fileList3"
                  accept="image/jpeg,image/jpg,image/png"
                  name="files"
                >
                  <!-- :limit="5" -->
                  <i class="el-icon-plus"></i>
                </el-upload>
                <span>{{ $t("message.quality.uploadHint") }}</span>
              </el-form-item>
              <el-form-item prop="fileUrl">
                <el-upload
                  :disabled="type == 'detail'"
                  class="upload-demo"
                  :action="uploadUrl"
                  :on-success="(file) => handleSuccess(file, 4)"
                  :on-error="(file) => handleError(file, 4)"
                  :on-remove="(file, fileList) => handleRemove(file, fileList, 4)"
                  :on-preview="(file) => handlePreview(file, 4)"
                  :limit="1"
                  :on-exceed="handleExceed"
                  :file-list="fileList4"
                  :before-upload="(file) => beforeUpload(file, 4)"
                  name="files"
                >
                  <el-button :disabled="type == 'detail'" size="small" type="primary">{{
                    $t("message.quality.uploadAttachment")
                  }}</el-button>
                  <div slot="tip" class="el-upload__tip">
                    {{ $t("message.quality.uploadHint2") }}
                  </div>
                </el-upload>
              </el-form-item>
            </el-form>
          </div>
        </div>

        <div class="dialog-footer">
          <el-button
            class="cancleBtn"
            @click="cancleEvent"
            icon="el-icon-circle-close"
            size="medium"
            >{{ $t("message.alarmValueSet.cancel") }}
          </el-button>
          <el-button
            v-if="addTitle != '编辑'"
            :disabled="type == 'detail'"
            type="primary"
            icon="el-icon-circle-check"
            @click="submitAddRecordFrom"
            size="medium"
            >{{ $t("message.alarmValueSet.save") }}
          </el-button>
          <el-button
            v-if="addTitle == '编辑'"
            :disabled="type == 'detail'"
            type="primary"
            icon="el-icon-circle-check"
            @click="submitEditRecordFrom"
            size="medium"
            >重新提交
          </el-button>
        </div>
      </vue-scroll>
    </el-dialog>

    <!-- 分包弹窗 -->
    <el-dialog
      :modal-append-to-body="false"
      :title="$t('message.quality.select') + $t('message.quality.subContractor')"
      :visible.sync="showEnterpriseDialog"
      width="667px"
      :close-on-click-modal="false"
    >
      <div class="dialog_content">
        <!-- <el-radio-group
          v-model="subcontractType"
          size="small"
          style="margin-bottom: 20px"
          @change="changeSubcontractType"
        >
          <el-radio-button :label="1">{{
            $t('message.quality.subcontractor')
          }}</el-radio-button>
          <el-radio-button :label="6">{{
            $t('message.quality.lborSubcontractor')
          }}</el-radio-button>
        </el-radio-group> -->
        <el-table
          :data="subcontractList"
          style="width: 100%"
          class="tables"
          @row-click="checkedSubcontractList"
        >
          <el-table-column
            prop="enterpriseName"
            :label="$t('message.quality.companyName')"
          >
          </el-table-column>
        </el-table>
      </div>
    </el-dialog>

    <!-- 图纸定位 -->
    <el-dialog
      :modal-append-to-body="false"
      :title="$t('message.quality.drawingPositioning')"
      :visible.sync="showPositioning"
      width="1000px"
      :close-on-click-modal="false"
    >
      <!-- <vue-scroll style="height: 600px"> -->
      <div class="dialog_content" style="padding: 0 20px">
        <div class="fullHeight">
          <div class="right fullHeight">
            <!-- <el-select
              v-model="value"
              clearable
              placeholder="请选择图纸"
              size="small"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select> -->
            <div class="mapContainer whiteBlock" id="mapContainer" v-show="mapUrl">
              <div class="infoDetail">
                <div class="operateBox">
                  <img
                    src="@/assets/images/personPosition/zoomin.png"
                    @click="shrink"
                    v-show="!createdCoord"
                  />
                  <img
                    src="@/assets/images/personPosition/zoomout.png"
                    @click="magnify"
                    v-show="!createdCoord"
                  />
                  <img
                    src="@/assets/images/personPosition/addPoint.png"
                    class="add"
                    v-show="!createdCoord"
                    @click="
                      createdCoord = !createdCoord;
                      multiples = 1;
                    "
                  />
                  <img
                    src="@/assets/images/personPosition/addPointing.png"
                    class="add"
                    v-show="createdCoord"
                    @click="createdCoord = !createdCoord"
                  />
                </div>
                <el-upload
                  class="uploadBtn"
                  ref="upload"
                  name="files"
                  :action="$store.state.UPLOADURL"
                  :on-success="uploadMapSuccess"
                  accept=".png, .jpg, .jpeg"
                  :show-file-list="false"
                >
                  <el-button slot="trigger" type="primary" size="medium">
                    {{ $t("message.personnelPosition.mapManage.re_upload") }}
                  </el-button>
                </el-upload>
              </div>

              <div class="mapBox" id="mapBox">
                <div
                  class="mapContent"
                  id="mapContent"
                  :style="{
                    transform: 'scale(' + multiples + ')',
                    transformOrigin: 'top left',
                  }"
                >
                  <img
                    id="map"
                    :src="mapUrl"
                    :class="createdCoord ? 'map' : ''"
                    :style="{ transform: 'rotateZ(' + deg + 'deg)' }"
                    @click="addPoint($event)"
                  />

                  <div
                    class="personBox"
                    v-for="(item, index) in pointList"
                    :key="index"
                    :style="{
                      left: item.coordinateX + 'px',
                      top: item.coordinateY + 'px',
                    }"
                  >
                    <el-popover placement="top" width="auto" trigger="click">
                      <div class="devDetail">
                        <p>
                          {{ $t("message.quality.coordinate") }}：X:
                          {{ item.coordinateX }}；Y:
                          {{ item.coordinateY }}
                        </p>
                        <p>
                          <!-- <span
                            class="primaryText hovers"
                            @click="editPoint(item, index)"
                            >{{
                              $t("message.personnelPosition.mapManage.edit")
                            }}</span> -->
                          <span
                            class="redText hovers"
                            @click="removePoint(item, index)"
                            >{{ $t("message.personnelPosition.mapManage.delete") }}</span
                          >
                        </p>
                      </div>
                      <img
                        slot="reference"
                        src="@/assets/images/personPosition/monitorPoint.png"
                        alt
                      />
                    </el-popover>
                  </div>
                </div>
              </div>
            </div>
            <div class="mapContainer whiteBlock" v-show="!mapUrl">
              <div class="placeholderBox">
                <img src="@/assets/images/noData.png" alt srcset />
                <p>
                  {{ $t("message.personnelPosition.mapManage.no_drawings") }}
                  <el-upload
                    style="display: inline-block"
                    ref="upload"
                    name="files"
                    :action="$store.state.UPLOADURL"
                    :on-success="uploadMapSuccess"
                    :before-upload="beforeAvatarUpload"
                    accept=".png, .jpg, .jpeg"
                    :show-file-list="false"
                  >
                    <span slot="trigger">{{
                      $t("message.personnelPosition.mapManage.click_upload")
                    }}</span>
                    <!--点击上传-->
                  </el-upload>
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="dialog-footer">
        <el-button
          class="cancleBtn"
          @click="
            showPositioning = false;
            pointList = [];
            createdCoord = false;
          "
          icon="el-icon-circle-close"
          size="medium"
          >{{ $t("message.alarmValueSet.cancel") }}
        </el-button>
        <el-button
          type="primary"
          icon="el-icon-circle-check"
          @click="savePointBtn"
          size="medium"
          >{{ $t("message.alarmValueSet.save") }}
        </el-button>
      </div>
      <!-- </vue-scroll> -->
    </el-dialog>

    <!-- 图片裁剪弹框 -->
    <el-dialog
      :modal-append-to-body="false"
      :title="$t('message.personnelPosition.mapManage.dialog_KJNova_Clipper.title')"
      :visible.sync="cropperDialog"
      width="1200px"
    >
      <div class="dialog_content" style="height: 600px">
        <!-- <vue-scroll> -->
        <vueCropper
          ref="cropper"
          :img="cropperOption.img"
          :outputType="cropperOption.outputType"
          :autoCrop="true"
        ></vueCropper>
        <!-- </vue-scroll> -->
      </div>
      <div class="dialog-footer">
        <el-button
          class="cancleBtn"
          @click="cropperDialog = false"
          icon="el-icon-circle-close"
          size="medium"
          >{{ $t("message.personnelPosition.cancel") }}
        </el-button>
        <el-button
          type="primary"
          icon="el-icon-circle-check"
          @click="saveMapUrlFn"
          size="medium"
          >{{ $t("message.personnelPosition.determine") }}
        </el-button>
      </div>
    </el-dialog>
    <el-dialog :modal-append-to-body="false" :visible.sync="dialogVisible">
      <img width="100%" :src="dialogImageUrl" alt="" />
    </el-dialog>
    <!-- 查看详情 -->
    <el-dialog
      :modal-append-to-body="false"
      title="查看详情"
      :visible.sync="dialogDetil"
      width="867px"
      :close-on-click-modal="false"
    >
      <div style="height: 600px">
        <vue-scroll>
          <div style="width: 800px">
            <!-- 隐患记录  超期整改 -->
            <div class="headerLeft">隐患记录</div>
            <div
              class="back-btn"
              v-if="
                detailData.status == 2 &&
                rectifyRecordList.length == 0 &&
                detailData.inspectManId == $store.state.userInfo.userId
              "
              @click="backQuestion(detailData)"
            >
              <i class="el-icon-refresh-right"></i>
              <span>撤回</span>
            </div>
            <span
              v-else-if="detailData.overTime == true"
              style="color: red; font-weight: 500; position: absolute; left: 89%; top: 1%"
              >超期</span
            >
            <!-- 超期整改 -->
            <div class="detailBox">
              <el-row :gutter="20">
                <el-col :span="12">
                  <div class="grid-content">
                    <span class="label">检查类型：</span>
                    <span
                      class="value"
                      style="font-weight: 500; color: #5181f6; cursor: pointer"
                      >{{ detailData.recordType == 1 ? "质量问题" : "排查记录" }}</span
                    >
                  </div>
                </el-col>
                <el-col :span="12">
                  <div class="grid-content">
                    <span class="label">整改结果：</span>
                    <span
                      class="value"
                      :style="{
                        'font-weight': 500,
                        cursor: 'pointer',
                        color:
                          detailData.status == 2
                            ? '#5181f6'
                            : detailData.status == 3
                            ? '#ff8c00'
                            : detailData.status == 4
                            ? '#a020f0'
                            : detailData.status == 5
                            ? '#21c28e'
                            : detailData.status == 6
                            ? '#262D47'
                            : '',
                      }"
                    >
                      <span
                        class="radiusD"
                        :style="{
                          background:
                            detailData.status == 2
                              ? '#5181f6'
                              : detailData.status == 3
                              ? '#ff8c00'
                              : detailData.status == 4
                              ? '#a020f0'
                              : detailData.status == 5
                              ? '#21c28e'
                              : detailData.status == 6
                              ? '#262D47'
                              : '',
                        }"
                      ></span>
                      <span>
                        {{
                          detailData.status == 2
                            ? "待整改"
                            : detailData.status == 3
                            ? "待复查"
                            : detailData.status == 4
                            ? "待核验"
                            : detailData.status == 5
                            ? "合格"
                            : detailData.status == 6
                            ? "已撤回"
                            : ""
                        }}</span
                      >
                    </span>
                  </div>
                </el-col>
                <el-col :span="12">
                  <div class="grid-content">
                    <span class="label" style="margin-left: -14px">检查人：</span>
                    <span class="value" style="margin-left: 25px">{{
                      detailData.inspectManName
                    }}</span>
                  </div>
                </el-col>
                <template v-for="item in securityDangerList">
                  <el-col v-if="item.originalFieldName == '现场整改'" :span="12">
                    <div class="grid-content">
                      <span class="label"
                        >{{
                          item.displayFieldName
                            ? item.displayFieldName
                            : item.originalFieldName
                        }}：</span
                      >
                      <span
                        class="value"
                        :style="{
                          color:
                            detailData.status == 1 || detailData.status == 5
                              ? '#21c28e'
                              : '#ff8c00',
                        }"
                        >{{
                          detailData.status == 1 || detailData.status == 5
                            ? "已完成"
                            : "未完成"
                        }}</span
                      >
                    </div>
                  </el-col>
                  <el-col v-else-if="item.originalFieldName == '上传附件'" :span="12">
                    <div class="grid-content">
                      <span class="label" style="line-height: 25px"
                        >{{
                          item.displayFieldName
                            ? item.displayFieldName
                            : item.originalFieldName
                        }}：</span
                      >
                      <span
                        style="color: #5181f6; cursor: pointer; margin-top: 3px"
                        class="value"
                        @click.stop="playerVideo(detailData[item.fieldName])"
                      >
                        {{ videoName }}
                      </span>
                    </div>
                  </el-col>
                  <el-col
                    v-else-if="
                      item.originalFieldName == '隐患图片' ||
                      item.originalFieldName == '上传图片' ||
                      item.originalFieldName == '整改后图片'
                    "
                    :span="12"
                  >
                    <div class="grid-content">
                      <span class="label"
                        >{{
                          item.displayFieldName
                            ? item.displayFieldName
                            : item.originalFieldName
                        }}：</span
                      >
                      <span
                        style="
                          cursor: pointer;
                          float: left;
                          width: calc(80% - 80px);
                          margin-left: 10px;
                        "
                      >
                        <el-image
                          v-for="(item, index) in parseImage2(detailData[item.fieldName])"
                          :key="index"
                          style="width: 100px; height: 100px; margin-right: 10px"
                          :src="item"
                          :preview-src-list="parseImage2(item.fileUrl)"
                          @click="openImg(item)"
                        >
                        </el-image>
                      </span>
                    </div>
                  </el-col>
                  <el-col v-else-if="item.originalFieldName == '施工图纸'" :span="12">
                    <div class="grid-content">
                      <span class="label"
                        >{{
                          item.displayFieldName
                            ? item.displayFieldName
                            : item.originalFieldName
                        }}：</span
                      >
                      <span class="value view-detail"
                        ><span>{{ detailData.drawingName }}</span
                        ><span
                          @click="onCascaderChange(detailData.regionDrawId, 'detail')"
                          style="color: #5181f6; cursor: pointer"
                          >点击查看</span
                        ></span
                      >
                    </div>
                  </el-col>
                  <el-col :span="12" v-else>
                    <div class="grid-content">
                      <span class="label"
                        >{{
                          item.displayFieldName
                            ? item.displayFieldName
                            : item.originalFieldName
                        }}：</span
                      >
                      <span class="value">{{ dataNameUp(detailData, item) }}</span>
                    </div>
                  </el-col>
                </template>
              </el-row>
              <el-row :gutter="20">
                <el-col :span="24">
                  <div class="grid-content1">
                    <div class="label">延期记录：</div>
                    <div class="content1-main">
                      <div
                        class="content1-box"
                        v-for="item in postponeRectifyApplyList"
                        :key="item.id"
                      >
                        <div class="content1-box_header" v-if="item.applyStatus != 1">
                          <div>{{ item.approveName }}审批于{{ item.approveTime }}</div>
                          <div>
                            审批意见<span>{{ item.approveRejectRemark }}</span>
                          </div>
                        </div>
                        <div class="content1-box_item">
                          <div>申请人</div>
                          <div>{{ item.applicant }}</div>
                        </div>
                        <div class="content1-box_item">
                          <div>申请时间</div>
                          <div>{{ item.applyTime }}</div>
                        </div>
                        <div class="content1-box_item">
                          <div>申请延期至</div>
                          <div>{{ item.postponeTime }}</div>
                        </div>
                        <div class="content1-box_item">
                          <div>原整改期限</div>
                          <div>{{ item.oldLimitTime }}</div>
                        </div>
                        <div class="content1-box_item">
                          <div>延期理由</div>
                          <div>{{ item.postponeReason }}</div>
                        </div>
                        <div
                          class="pending"
                          :class="{
                            trial1: item.applyStatus == 1,
                            trial2: item.applyStatus == 2,
                            trial3: item.applyStatus == 3,
                          }"
                        >
                          {{
                            item.applyStatus == 1
                              ? "延期待审"
                              : item.applyStatus == 2
                              ? "已批准"
                              : "已驳回"
                          }}
                        </div>
                      </div>
                    </div>
                  </div>
                </el-col>
              </el-row>

              <!-- <el-row :gutter="20">
                <el-col :span="24">
                  <div class="grid-content">
                    <span class="label">模型定位：</span>
                    <span class="value"> 已关联 </span>
                  </div>
                </el-col>
              </el-row> -->
              <div class="headerLeft" v-if="rectifyRecordList.length > 0">
                整改&复核记录
              </div>
              <el-timeline class="detailBox" :reverse="true">
                <el-timeline-item
                  :timestamp="item.rectifyTime"
                  placement="top"
                  v-for="(item, index) in rectifyRecordList"
                  :key="index"
                >
                  <el-card>
                    <div class="timestamp_btn">
                      <div class="timestamp_red" v-if="item.overTime == true">超期</div>
                      <div class="timestamp_bule">用时：{{ item.takeTime }}</div>
                    </div>
                    <p class="grid-content">
                      <span class="label">{{
                        item.type == 1
                          ? "责任人："
                          : item.type == 2
                          ? "复查人："
                          : item.type == 3
                          ? "核验人："
                          : "无"
                      }}</span
                      ><span class="value">{{ item.createUserName }}</span>
                    </p>
                    <p class="grid-content" v-if="item.type == 1 && item.violatorId">
                      <!-- item.violatorId.includes(ele.id) -->
                      <span class="label">违章人员：</span
                      ><span class="value">{{
                        personList
                          .filter((ele) => item.violatorId == ele.id)
                          .map((ele) => ele.workerName)
                          .join("、")
                      }}</span>
                    </p>
                    <p class="grid-content" v-if="item.type == 1">
                      <span class="label">整改状态：</span
                      ><span class="value">{{
                        item.status == 2 ? "已整改" : "未整改"
                      }}</span>
                    </p>
                    <p class="grid-content" v-else-if="item.type == 2">
                      <span class="label">复查状态：</span
                      ><span class="value">{{
                        item.status == 2 ? "合格" : "不合格"
                      }}</span>
                    </p>
                    <p class="grid-content" v-else>
                      <span class="label">核验状态：</span
                      ><span class="value">{{
                        item.status == 2 ? "合格" : "不合格"
                      }}</span>
                    </p>
                    <p class="grid-content" v-if="item.status == 1">
                      <span class="label">驳回说明：</span
                      ><span class="value">{{ item.additionalRemarks }}</span>
                    </p>
                    <p class="grid-content" v-if="item.status == 2">
                      <span class="label">补充说明：</span
                      ><span class="value">{{ item.additionalRemarks }}</span>
                    </p>
                    <div class="grid-content">
                      <span class="label">{{
                        item.type == 1
                          ? "整改照片："
                          : item.type == 2
                          ? "复查照片："
                          : "核验照片："
                      }}</span>
                      <span class="value" style="cursor: pointer">
                        <el-image
                          v-for="(item2, index) in item.fileUrl"
                          :key="index"
                          style="width: 100px; height: 100px; margin-right: 10px"
                          :src="item2"
                          :preview-src-list="item2.fileUrl"
                          @click="openImg(item2)"
                        >
                        </el-image>
                      </span>
                    </div>
                  </el-card>
                </el-timeline-item>
              </el-timeline>
              <div v-if="![5].includes(detailData.status) && statusCondition(detailData)">
                <div class="headerLeft">
                  {{
                    detailData.status == 2
                      ? "整改回复"
                      : detailData.status == 3
                      ? "复查回复"
                      : "核验回复"
                  }}
                </div>
                <el-row :gutter="20">
                  <el-col :span="24">
                    <div class="grid-content">
                      <span class="label" style="line-height: 30px; width: 90px">
                        <span style="color: red">*&nbsp;</span
                        >{{
                          detailData.status == 2
                            ? "整改时间："
                            : detailData.status == 3
                            ? "复查时间："
                            : "核验时间："
                        }}</span
                      >

                      <span
                        class="value"
                        style="width: calc(100% - 90px); margin-left: 0px"
                      >
                        <el-date-picker
                          v-model="replyData.rectifyTime"
                          size="mini"
                          type="datetime"
                          placeholder="选择日期时间"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          style="width: 175px"
                          required
                          disabled
                        >
                        </el-date-picker>
                      </span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20" v-if="detailData.status == 2">
                  <el-col :span="24">
                    <div class="grid-content">
                      <span class="label" style="line-height: 30px; width: 90px">
                        违章人员：</span
                      >
                      <!-- <span style="color: red" v-if="COMPANY != 'chaozhou'">*&nbsp;</span>违章人员：</span> -->

                      <span
                        class="value"
                        style="width: calc(100% - 90px); margin-left: 0px"
                      >
                        <!-- multiple
                      collapse-tags -->
                        <el-select
                          v-model="replyData.violatorId"
                          filterable
                          size="mini"
                          placeholder="请选择"
                        >
                          <el-option
                            v-for="item in personList"
                            :key="item.id"
                            :label="item.workerName"
                            :value="item.id"
                          >
                          </el-option>
                        </el-select>
                      </span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="24">
                    <div class="grid-content">
                      <span class="label" style="line-height: 45px; width: 90px"
                        ><span
                          style="color: red"
                          v-if="detailData.status == 2 || COMPANY != 'chaozhou'"
                          >*&nbsp;</span
                        >补充说明：</span
                      >
                      <span
                        class="value"
                        style="width: calc(100% - 90px); margin-left: 0px"
                      >
                        <el-input
                          v-model="replyData.additionalRemarks"
                          placeholder="请输入"
                          required
                        ></el-input>
                      </span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="24">
                    <div class="grid-content">
                      <span class="label" style="width: 90px"
                        ><span v-if="detailData.status == 2" style="color: red"
                          >*&nbsp;</span
                        >{{
                          detailData.status == 2
                            ? "整改照片："
                            : detailData.status == 3
                            ? "复查照片："
                            : "核验照片："
                        }}</span
                      >
                      <span
                        class="value"
                        style="width: calc(100% - 90px); margin-left: 0px"
                      >
                        <el-upload
                          :class="{ hide: hideUpload }"
                          :disabled="type == 'detail'"
                          :action="uploadUrl"
                          list-type="picture-card"
                          :on-success="(file) => handleSuccess(file, 5)"
                          :on-error="(file) => handleError(file, 5)"
                          :on-remove="(file, fileList) => handleRemove(file, fileList, 5)"
                          :before-upload="(file) => beforeUpload(file, 5)"
                          :on-preview="(file) => handlePreview(file, 5)"
                          name="files"
                          :file-list="fileListRectification"
                          accept="image/jpeg,image/jpg,image/png"
                          required
                        >
                          <!-- :limit="5" -->
                          <i class="el-icon-plus"></i>
                        </el-upload>
                      </span>
                    </div>
                  </el-col>
                </el-row>
              </div>
            </div>
          </div>
        </vue-scroll>
      </div>
      <div class="btn-box" v-if="statusCondition(detailData)">
        <el-button
          v-if="detailData.status == 3 || detailData.status == 4"
          size="medium"
          type="danger"
          @click.stop="rectifAdd(detailData.id, detailData.status, 3)"
          >驳回</el-button
        >
        <el-button
          v-if="detailData.status == 5 || detailData.status == 2"
          size="medium"
          @click="dialogDetil = false"
          >取消</el-button
        >
        <!-- v-permission="{key: 'inspectionLedger_edit', menuPath: '/project/safeSame/inspectionLedger'}" -->
        <el-button
          v-if="detailData.status == 3 || detailData.status == 4"
          size="medium"
          type="primary"
          @click="rectifAdd(detailData.id, detailData.status, 2)"
          >通过</el-button
        >
        <el-button
          v-if="detailData.status == 2"
          size="medium"
          type="primary"
          @click="rectifAdd(detailData.id, detailData.status, 1)"
          >提交</el-button
        >
      </div>
      <div class="btn-box" v-else>
        <el-button size="medium" @click="dialogDetil = false">取消</el-button>
      </div>
    </el-dialog>
    <!-- 视频播放 -->
    <el-dialog
      class="video"
      :modal-append-to-body="false"
      :visible.sync="isShow"
      @close="closeBtn"
    >
      <video
        v-if="isShow || player"
        width="100%"
        height="550"
        controls
        autoplay
        style="margin-left: 10px"
      >
        <source :src="player" type="video/mp4" />
        <source :src="player" type="video/mp4" />
        <source :src="player" type="video/mp4" />
        您的浏览器不支持 video 标签。
      </video>
    </el-dialog>
    <!-- 新增 -->
    <el-dialog :visible.sync="dealShow" width="600px" append-to-body :title="dealTitle">
      <el-form
        ref="dealForm"
        :model="dealForm"
        :rules="dealFormRules"
        size="medium"
        label-width="140px"
        class="dealForm"
      >
        <template v-if="dealType == 1">
          <el-form-item label="申请延期至" prop="postponeTime">
            <el-date-picker
              value-format="yyyy-MM-dd HH:mm:ss"
              v-model="dealForm.postponeTime"
              type="datetime"
              :picker-options="handleTimeChange(dealForm.oldLimitTime)"
              :placeholder="$t('message.quality.optionDate')"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="原整改时限" prop="oldLimitTime">
            {{ dealForm.oldLimitTime }}
          </el-form-item>
          <el-form-item label="延期理由" prop="postponeReason">
            <el-input
              type="text"
              :placeholder="$t('message.quality.pleaseEnter')"
              v-model="dealForm.postponeReason"
            >
            </el-input>
          </el-form-item>
        </template>
        <template v-if="dealType == 2">
          <el-form-item label="移交给" prop="changeId">
            <el-select
              :disabled="type == 'detail'"
              v-model="dealForm.changeId"
              :multiple="dealForm.state == 3 || dealForm.state == 4 ? true : false"
              filterable
              clearable
              :placeholder="$t('message.quality.pleaseSelect')"
              style="width: 320px"
            >
              <el-option
                v-for="item in crewUpdateList"
                :key="item.userId"
                :label="item.realName"
                :value="item.userId"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </template>
      </el-form>
      <div slot="footer" style="text-align: center">
        <el-button icon="el-icon-circle-close" size="medium" @click="dealFormCancel"
          >取消</el-button
        >
        <el-button
          icon="el-icon-circle-check"
          size="medium"
          type="primary"
          @click="submitDealForm"
          >确认</el-button
        >
      </div>
    </el-dialog>
    <!-- 视频播放 -->
    <el-dialog
      class="hiddenDanger"
      :modal-append-to-body="false"
      :title="'查看隐患点'"
      :visible.sync="hiddenDangerFlag"
    >
      <div>
        <ImageAnnotation
          ref="imageAnnotator"
          :viewMode="currentMode"
          :drawingPointData="drawingPointData"
          :imagePath="drawingUrl"
        ></ImageAnnotation>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {
  getInspectionRecordListApi,
  getQualityRegionTreePageApi,
  getDangerTypeRecordApi,
  getSubcontractListApi,
  addRecordApi,
  editRecordApi,
  getRoutineInspectApi,
  selectRectifyRecordListApi,
  addQualityRectifyRecordApi,
  deleteRectifyRecordListApi,
  backRectifyRecordListApi,
  backAddQualityInspectionRecordApi,
  getPostponeRectifyApplyListApi,
  addPostponeRectifyApplyApi,
  updateChangeIdQualityInspectionRecordApi,
  updateReviewIdsCheckIdQualityInspectionRecordApi,
  updateVerifyManIdsQualityInspectionRecordApi,
  getQualityRegionConstructionDrawByIdApi,
} from "@/assets/js/api/quality.js";
import {
  getEffectiveConfigDangerFieldApi,
  getEffectiveConfigDangerReviewVerifyApi,
} from "@/assets/js/api/safeManage";
import { getDictionaryItemApi } from "@/assets/js/api/companyDiagram";
import {
  getProjectChilderSystemUserListApi,
  getEnterpriseInfoListApi,
  getLaborManagementInfoListApi,
} from "@/assets/js/api/configManage.js";
import { getWorkerInfoListApi } from "@/assets/js/api/towerCrane";
import { VueCropper } from "vue-cropper";
import {
  getSubdivisionProjectApi, //所有分部分项工程， 以父子节点形式呈现
} from "@/assets/js/api/quality";
import { isJSON } from "@/util/nowDate";
import moment from "moment";
import dayjs from "dayjs";
import ImageAnnotation from "@/components/ImageAnnotation.vue";
var VUE = null;
export default {
  components: {
    VueCropper,
    ImageAnnotation,
    "el-image-viewer": () => import("element-ui/packages/image/src/image-viewer"),
  },

  data() {
    return {
      imgViewerVisible: false,
      previewList: [],
      areaData: {},
      replyData: {
        rectifyTime: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
        fileUrl: "",
        additionalRemarks: "",
        qualityId: "",
        violatorId: "",
      }, //未整改回复
      personList: [],
      dialogDetil: false,
      detailData: {},
      fileListRectification: [],
      userIdInfo: "",
      //-------
      listData: [],
      subListData: [],
      time: [],
      hideUpload: false, //
      formInline: {
        inspectEndTime: "",
        inspectStartTime: "",
        recordType: 1,
        level: "",
        status: "",
        urgentLevel: "",
        regionId: "",
        dangerInfoId: "",
        enterpriseId: "",
      },
      type: "add",
      pageNo: 1,
      pageSize: 10,
      total: 0,
      projectSn: this.$store.state.projectSn,
      statisticsValue: {
        closeNum: 0,
        investigateNum: 0,
        notCloseNum: 0,
        overdueNotCloseNum: 0,
        rectificationNum: 0,
        reviewNum: 0,
        totalNum: 0,
        verificationNum: 0,
        rectificationRatio: 0, //整改率
        completeRatio: 0, //闭合率
      },
      tableData: [], //列表数据
      recordType: 1, //新增数据 1质量问题，2排查记录
      addDialog: false,
      addTitle:
        this.$t("message.quality.new") + this.$t("message.quality.inspectionRecord"),
      addForm1: {
        regionId: "",
        regionName: "",
        dangerItemContent: "",
        dangerItemId: "",
        dangerTypeId: "",
        dangerDesc: "",
        remark: "",
        routineId: 0,
        level: 0,
        urgentLevel: 0,
        inspectManId: "",
        inspectTime: "",
        enterpriseSn: "",
        enterpriseName: "",
        changeLimitTime: "",
        changeId: "",
        reviewId: "",
        verifyManId: "",
        notifyPerson: [],
        status: "",
        measurePoints: [],
        imageUrl: "",
        fileUrl: "",
        subsectionId: "", //分部工程
        subentryId: "", //分项工程
        floor: "", //巡检楼层
        addedDescription: "", //问题描述
      },
      addForm1Rules: this.$t("message.quality.addForm1Rules"),
      addForm2: {
        regionId: "",
        regionName: "",
        dangerDesc: "",
        routineInspect: 0,
        inspectManId: "",
        inspectTime: "",
        dangerItemContent: "",
        dangerItemId: "",
        dangerTypeId: "",
        enterpriseSn: "",
        enterpriseName: "",
        imageUrl: "",
        fileUrl: "",
        subsectionId: "", //分部工程
        subentryId: "", //分项工程
        floor: "", //巡检楼层
        addedDescription: "", //问题描述
      },
      addForm2Rules: this.$t("message.quality.addForm2Rules"),
      checkPointList: [], // 检查部位下拉
      checkPointProps: {
        value: "id",
        label: "regionName",
        children: "children",
        checkStrictly: true,
      },
      classifyList: [], // 问题描述 问题分类下拉
      checkClassifyProps: {
        value: "id",
        label: "dangerName",
        children: "children",
        checkStrictly: false,
      },
      reviewList: [],
      crewList: [],
      crewUpdateList: [],
      routineList: [], //例行检查列表
      showEnterpriseDialog: false, // 显示分包选择弹窗
      subcontractType: 1, //分包商类型
      subcontractList: [], // 分包商列表
      uploadUrl: "",
      fileUrl: "",
      fileList1: [],
      fileList2: [],
      fileList3: [],
      fileList4: [],
      dialogImageUrl: "", //查看图片的路径
      dialogVisible: false, //查看图片弹窗
      showPositioning: false, //图纸定位 弹窗
      mapUrl: "", //图纸
      pointList: [], //坐标数组
      createdCoord: false, //创建坐标
      multiples: 1, //图纸大小
      floorList: [], //背景图列表
      cropperDialog: false, //图片裁剪弹窗
      cropperOption: {
        outputType: "png",
        img: "",
      },
      deg: 0,
      COMPANY: "",
      rectifyRecordList: "", //整改记录
      imgList: [],
      player: "",
      isShow: false,
      videoName: "",
      unitEnterpriseId: "",
      unitRegionId: "",
      enterpriseList: [],
      crewUpdateList2: [],

      dealShow: false,
      dealForm: {},
      dealType: 1,
      dealTitle: "",
      dealFormRules: {
        postponeTime: [
          { required: true, message: "请选择申请延期时间", trigger: "change" },
        ],
        postponeReason: [{ required: true, message: "请选择延期理由", trigger: "blur" }],
      },
      postponeRectifyApplyList: [],
      securityDangerList: [],
      dangerItemList: [], // 问题等级二
      majorItemList: [], // 责任专业
      securityDangerPinnedList: [],
      dangerReviewInfo: {},
      hiddenDangerFlag: false,
      drawingUrl: "",
      currentMode: "edit",
      drawingPointData: [],
    };
  },
  created() {
    this.userIdInfo = this.$store.state.userInfo.userId;
    console.log("查看当前用户的id", this.userIdInfo);

    this.uploadUrl = this.$store.state.UPLOADURL;
    this.fileUrl = this.$store.state.FILEURL;
    this.getSecurityDangerFieldPage();
    this.onSubmit();
    this.COMPANY = COMPANY;
    this.getProgressListData();
    this.getPositionList();
    this.getDescribeClassifyList();
    this.getDicProjectTypeList();
    this.getUpdateUnitListFn();
    this.getXzSecurityDangerReviewVerifyList();
  },
  computed: {
    isJSON() {
      return function (str) {
        if (typeof str == "string") {
          try {
            var obj = JSON.parse(str);
            if (typeof obj == "object" && obj) {
              return true;
            } else {
              return false;
            }
          } catch (e) {
            return false;
          }
        }
      };
    },
    securityDangerListUp() {
      return (originalFieldName) => {
        const find = this.securityDangerPinnedList.find(
          (item) => item.originalFieldName == originalFieldName
        );
        if (find) {
          return find.displayFieldName ? find.displayFieldName : find.originalFieldName;
        }
        return "";
      };
    },
    dataNameUp() {
      return (row, eItem) => {
        if (eItem.originalFieldName == "责任区域") {
          return row.regionNames ? row.regionNames : row.regionName;
        } else if (eItem.originalFieldName == "问题描述") {
          return row.problemDescription;
        } else if (eItem.originalFieldName == "问题分类") {
          return row.dangerItemContent;
        } else if (eItem.originalFieldName == "问题等级") {
          const levelList = ["一级", "二级", "三级", "四级"];
          return levelList[row.level - 1];
        } else if (eItem.originalFieldName == "问题等级二") {
          const find = this.dangerItemList.find(
            (item) => item.data == row.priorityNameDic
          );
          return find ? find.name : "";
        } else if (eItem.originalFieldName == "责任专业") {
          const find = this.majorItemList.find((item) => item.data == row.dutyMajor);
          return find ? find.name : "";
        } else if (eItem.originalFieldName == "紧急程度") {
          const levelList = ["一般", "严重", "重大"];
          return levelList[row.urgentLevel - 1];
        } else if (eItem.originalFieldName == "整改人") {
          return row.changeName;
        } else if (eItem.originalFieldName == "复查人") {
          return row.reviewNames ? row.reviewNames : row.reviewName;
        } else if (eItem.originalFieldName == "核验人") {
          return row.verifyManNames ? row.verifyManNames : row.verifyManName;
        } else if (eItem.originalFieldName == "分包单位") {
          console.log(113344455, row);
          return row.enterpriseNames ? row.enterpriseNames : row.enterpriseName;
        } else if (eItem.originalFieldName == "现场整改") {
          return row.status == 1 || row.status == 5 ? "已完成" : "未完成";
        }
        return row[eItem.fieldName];
      };
    },
  },
  watch: {
    "addForm1.regionId": {
      handler(newVal) {
        console.log(newVal);
        if (newVal.length == 0) {
          this.addForm1.reviewId = ""; // 先清空复查人
          this.reviewList = [];
        } else {
          this.getReviewPeopleList(newVal);
        }
        // this.addForm1.reviewId = ""
      },
      deep: true,
    },
    "addForm2.regionId": {
      handler(newVal) {
        if (newVal.length == 0) {
          this.reviewList = [];
        } else {
          this.getReviewPeopleList(newVal);
        }
        // this.addForm2.reviewId = ""
      },
      deep: true,
    },
  },
  mounted() {},
  methods: {
    onCascaderChange(e, type = "edit") {
      console.log(e);
      this.currentMode = type;
      if (e instanceof Array) {
        const regionDrawId = e[e.length - 1];
        // addForm1.regionDrawId
        this.getQualityRegionConstructionDrawById(regionDrawId);
      } else {
        if (!e) return this.$message.warning("施工图纸不存在！");
        if (type == "detail") {
          this.drawingPointData =
            this.detailData.drawingPointData && isJSON(this.detailData.drawingPointData)
              ? JSON.parse(this.detailData.drawingPointData)
              : [];
          this.getQualityRegionConstructionDrawById(e);
        }
      }
      this.hiddenDangerFlag = true;
    },
    getQualityRegionConstructionDrawById(regionDrawId) {
      getQualityRegionConstructionDrawByIdApi({
        projectSn: this.projectSn,
        id: regionDrawId,
      }).then((res) => {
        if (res.code == 200) {
          const data = res.result;
          this.drawingUrl = this.fileUrl + data.fileUrl;
        }
      });
    },
    getXzSecurityDangerReviewVerifyList() {
      getEffectiveConfigDangerReviewVerifyApi({
        sn: this.projectSn,
        companyProjectType: 2,
      }).then((res) => {
        if (res.code == 200) {
          const data = res.result;
          this.dangerReviewInfo = {
            ...data,
          };
        }
      });
    },
    // 获取字典工程类别列表
    getDicProjectTypeList() {
      getDictionaryItemApi({
        dictionaryEncoding: "xz_security_danger_item_record_priority_name_dic",
        projectSn: this.projectSn,
      }).then((res) => {
        if (res.result.length > 0) {
          this.dangerItemList = res.result;
        }
      });
      getDictionaryItemApi({
        dictionaryEncoding: "xz_security_quality_inspection_record_duty_major",
        projectSn: this.projectSn,
      }).then((res) => {
        if (res.result.length > 0) {
          this.majorItemList = res.result;
        }
      });
    },
    getSecurityDangerFieldPage(recordType) {
      getEffectiveConfigDangerFieldApi({
        pageNo: 1,
        pageSize: -1,
        sn: this.projectSn,
        companyProjectType: 2,
        recordType: recordType ? recordType : this.recordType,
      }).then((res) => {
        if (res.code === 200) {
          this.securityDangerList = res.result.filter((item) => item.isEnabled == 1);
          if (this.securityDangerPinnedList.length == 0) {
            this.securityDangerPinnedList = res.result
              .filter((item) => item.isPinned == 1)
              .filter((item) => item.recordType == 1);
            this.$nextTick(() => {
              this.$refs.multipleTable.doLayout();
            });
          }
        }
      });
    },
    handleTimeChange(diffTime) {
      return {
        disabledDate: (time) => {
          const date1 = dayjs(diffTime);
          const date2 = dayjs(time);
          return date1.diff(date2) > 0 ? true : false;
        },
      };
    },
    showImgViewer() {
      this.previewList = this.parseImage2(scope.row.imageUrl);
      this.imgViewerVisible = true;
    },
    closeImgViewer() {
      this.imgViewerVisible = false;
    },
    onPostponeApply(row, type) {
      console.log("申请延期", row);
      if (type == 1) {
        this.dealTitle = "申请延期";
        this.dealForm = {
          postponeTime: "",
          oldLimitTime: row.changeLimitTime,
          postponeReason: "",
          securityId: row.id,
        };
      } else if (type == 2) {
        this.dealTitle = "移交";
        this.dealForm = {
          id: row.id,
          status: row.status,
          changeId: "",
        };
        this.unitEnterpriseId = row.enterpriseIds ? row.enterpriseIds.split(",") : [];
        this.unitRegionId = row.regionIds ? row.regionIds.split(",") : [];
        this.getPeopleUpdateList();
      }

      this.dealType = type;
      this.$nextTick(() => {
        this.$refs["dealForm"] && this.$refs["dealForm"].clearValidate();
      });

      this.dealShow = true;
    },
    getXZSecurityPostponeRectifyApplyList(id) {
      let data = {
        projectSn: this.projectSn,
        securityId: id,
      };
      getPostponeRectifyApplyListApi(data).then((res) => {
        if (res.code == 200) {
          this.postponeRectifyApplyList = res.result;
        }
      });
    },
    initDealForm() {
      this.dealForm = {
        postponeTime: "",
        oldLimitTime: "",
        postponeReason: "",
      };
    },
    submitDealForm() {
      this.$refs["dealForm"].validate((valid) => {
        if (valid) {
          if (this.dealType == 1) {
            let param = {
              ...this.dealForm,
              applyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
              // applyStatus: 1,
            };
            addPostponeRectifyApplyApi({
              ...param,
              recordType: this.recordType,
              projectSn: this.projectSn,
            }).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.onSubmit();
                this.dealShow = false;
              }
            });
          } else if (this.dealType == 2) {
            let param = {
              id: this.dealForm.id,
              status: this.dealForm.status,
            };
            // 移交
            if (param.status == 2) {
              param.changeId = this.dealForm.changeId;
            } else if (param.status == 3) {
              param.reviewIds = this.dealForm.changeId
                ? this.dealForm.changeId.join(",")
                : [];
            } else if (param.status == 4) {
              param.verifyManIds = this.dealForm.changeId
                ? this.dealForm.changeId.join(",")
                : [];
            }
            const objFn = {
              2: updateChangeIdQualityInspectionRecordApi,
              3: updateReviewIdsCheckIdQualityInspectionRecordApi,
              4: updateVerifyManIdsQualityInspectionRecordApi,
            };
            objFn[param.status]({
              ...param,
              projectSn: this.projectSn,
            }).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.onSubmit();
                this.dealShow = false;
              }
            });
          }
        }
      });
    },
    dealFormCancel() {
      this.initDealForm();
      this.$refs["dealForm"].resetFields();
      this.dealShow = false;
    },
    //获取人员列表
    getViolationList() {
      let data = {
        projectSn: this.projectSn,
      };
      getSubdivisionProjectApi(data).then((res) => {
        if (res.code == 200) {
          this.violationList = res.result;
        }
      });
    },
    backQuestion(obj) {
      console.log("删除", obj);
      this.$confirm(
        "确定撤回该条记录?",
        this.$t("message.personnelPosition.beaconManage.table.Tips"),
        {
          confirmButtonText: this.$t("message.personnelPosition.confirmButtonText"),
          cancelButtonText: this.$t("message.personnelPosition.cancelButtonText"),
          type: "warning",
        }
      )
        .then(() => {
          backRectifyRecordListApi({ id: obj.id }).then((result) => {
            if (result.success) {
              this.$message.success(result.message);
              this.onSubmit();
              this.dialogDetil = false;
            }
          });
        })
        .catch(() => {});
    },
    deleteQuestion(obj) {
      console.log("删除", obj);
      this.$confirm(
        "确定删除该条记录?",
        this.$t("message.personnelPosition.beaconManage.table.Tips"),
        {
          confirmButtonText: this.$t("message.personnelPosition.confirmButtonText"),
          cancelButtonText: this.$t("message.personnelPosition.cancelButtonText"),
          type: "warning",
        }
      )
        .then(() => {
          deleteRectifyRecordListApi({ id: obj.id }).then((result) => {
            if (result.success) {
              this.$message.success(result.message);
              this.onSubmit();
            }
          });
        })
        .catch(() => {});
    },
    async editRow(obj) {
      // 编辑撤回数据(重新提交)
      console.log("77777777777777777777777777777");
      // await this.getReviewPeopleList(obj.regionId)
      console.log("77777777777777777777777777777");
      console.log(this.addForm1, 777);
      this.addTitle = "编辑";
      this.recordType = obj.recordType;
      if (obj.recordType == 1) {
        this.addForm1 = { ...obj };
        let arr = obj.imageUrl.split(",");
        let fileArr = obj.fileUrl.split(",");
        let showImgUrl = [];
        let showFileUrl = [];
        for (let i = 0; i < arr.length; i++) {
          let imgArr = arr[i].split("*");
          let objData = { name: imgArr[0], url: imgArr[1] };
          showImgUrl.push(objData);
        }
        for (let i = 0; i < fileArr.length; i++) {
          let file = fileArr[i].split("*");
          let objData = { name: file[0], url: file[1] };
          showFileUrl.push(objData);
        }
        showFileUrl = showFileUrl.filter((item) => {
          return item.url != undefined;
        });
        showImgUrl = showImgUrl.filter((item) => {
          return item.url != undefined;
        });
        this.fileList1 = showImgUrl;
        this.fileList2 = showFileUrl;
      } else if (obj.recordType == 2) {
        this.addForm2 = { ...obj };
      }
      // 责任人数据处理
      this.unitEnterpriseId = obj.enterpriseIds ? obj.enterpriseIds.split(",") : [];
      this.unitRegionId = obj.regionIds ? obj.regionIds.split(",") : [];
      // 逻辑结束
      this.getPositionList();
      this.getDescribeClassifyList();
      this.getPeopleList();
      this.getPeopleUpdateList();
      this.getRoutineInspect();
      this.rectifyRecordList = [];
      // 默认选择核验人逻辑
      let index = this.crewList.findIndex((item) => {
        return item.userId == obj.verifyManId;
      });
      if (index != -1) {
        this.addForm1.verifyManId = this.$store.state.userInfo.userId;
      } else {
        this.addForm1.verifyManId = this.$store.state.userInfo.realName;
      }
      // 检查时间都改为当前
      let date = new Date();
      let nowDate = moment(date).format("YYYY-MM-DD HH:mm:ss");
      this.addForm1.inspectTime = nowDate;
      this.addForm2.inspectTime = nowDate;
      this.addDialog = true;
      this.$nextTick(() => {
        this.editChangeRegion();
      });
    },
    statusCondition(data) {
      console.log(data, "我爱我爱");
      if (data.status == 2) {
        if (data.changeId == this.$store.state.userInfo.userId) {
          return true;
        }
      } else if (data.status == 3) {
        if (data.reviewIds.includes(this.$store.state.userInfo.userId)) {
          return true;
        }
      } else if (data.status == 4) {
        if (data.verifyManIds.includes(this.$store.state.userInfo.userId)) {
          return true;
        }
      } else {
        return false;
      }
    },
    //关闭视频
    closeBtn() {
      this.isShow = false;
      this.player = "";
    },
    //视频播放
    playerVideo(item) {
      if (item) {
        let index = item.indexOf("*");
        let videoUrl = item.substring(index + 1);
        console.log("点击", videoUrl);
        this.isShow = false;
        this.$nextTick(() => {
          this.player = videoUrl;
          this.isShow = true;
        });
      } else {
        this.$message.error("暂无视频");
      }
    },
    //新版查看详情
    newShowDatadetails(item, index) {
      this.videoName = item.fileUrl.split("*")[0];
      console.log("新版查看详情", item);
      this.selectRectifyRecordList(item.id);
      this.getXZSecurityPostponeRectifyApplyList(item.id);
      this.getSecurityDangerFieldPage(item.recordType);
      this.dialogDetil = true;
      this.detailData = item;
      this.replyData = {
        rectifyTime: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
        fileUrl: "",
        additionalRemarks: "",
        violatorId: "",
      };
      this.fileListRectification = [];
      this.loadPersonList(item.projectSn);
    },
    //提交整改回复
    rectifAdd(valId, statusType, type) {
      if (type == 1 && statusType == 2) {
        this.replyData.status = 2; //整改
        this.replyData.type = 1;
      } else if (type == 2 && statusType == 3) {
        this.replyData.status = 2; //复查合格
        this.replyData.type = 2;
      } else if (type == 3 && statusType == 3) {
        this.replyData.status = 1; //复查不合格
        this.replyData.type = 2;
      } else if (type == 2 && statusType == 4) {
        this.replyData.status = 2; //核验合格
        this.replyData.type = 3;
      } else if (type == 3 && statusType == 4) {
        this.replyData.status = 1; //核验不合格
        this.replyData.type = 3;
      }
      //待整改提交
      if (this.fileListRectification.length > 0) {
        let arr = [];
        this.fileListRectification.forEach((item) => {
          arr.push(item.name);
        });
        this.replyData.fileUrl = arr.join(",");
      } else {
        this.replyData.fileUrl = "";
      }
      // if (this.replyData.violatorId == "" && type == 1 && statusType == 2 && this.COMPANY != 'chaozhou') {
      //   this.$message.error("请选择违章人员");
      //   return;
      // }
      if (this.fileListRectification.length == 0 && this.replyData.type == 1) {
        this.$message.error("请将回复内容输入完整");
        return;
      }
      if (
        this.replyData.additionalRemarks == "" &&
        (type == 1 || this.COMPANY != "chaozhou")
      ) {
        this.$message.error("请将回复内容输入完整");
        return;
      }
      if (this.replyData.rectifyTime == "") {
        this.$message.error("请选择整改时间");
        return;
      }
      const result = {
        ...this.replyData,
        // violatorId: this.replyData.violatorId.join(","),
        qualityId: valId,
        createUser: this.userIdInfo,
      };
      if (type == 1 && statusType == 2) {
        // result.violatorId = this.replyData.violatorId.join(",");
        result.violatorId = this.replyData.violatorId;
      }
      console.log("整改提交的表单数据：：：", result);
      addQualityRectifyRecordApi(result).then((res) => {
        if (res.code == 200) {
          this.$message.success("提交成功");
          this.dialogDetil = false;
          this.onSubmit();
        }
      });
    },
    parseImage2(urls) {
      let arr = [];
      if (urls) {
        arr = urls.split(",");
      }
      arr.forEach((element, index) => {
        // console.log(22222, element)
        // arr[index] = element.includes("http://") ? element : this.$store.state.FILEURL + element;
        let result = arr[index].substring(arr[index].indexOf("*") + 1, arr[index].length);
        // console.log(3333, result)
        arr[index] = result.includes("http://")
          ? result
          : this.$store.state.FILEURL + result;
      });
      return arr;
    },
    parseImage(urls) {
      let arr = [];

      if (typeof urls === "string") {
        arr = urls.split(",");
      } else if (Array.isArray(urls)) {
        arr = urls;
      }

      const data = arr
        .map((item) => {
          return this.$store.state.FILEURL + item.trim();
        })
        .filter(Boolean);

      return data;
    },
    checkSubListData(val) {
      console.log("一级菜单改动了 ：", val);

      if (this.recordType == 1) {
        this.listData.forEach((value) => {
          if (value.id == val) {
            this.subListData = value.children;
            if (value.children.length >= 1) {
              this.addForm1.subentryId = value.children[0].id;
            }
          }
        });
      } else if (this.recordType == 2) {
        this.listData.forEach((value) => {
          if (value.id == val) {
            this.subListData = value.children;
            if (value.children.length >= 1) {
              this.addForm2.subentryId = value.children[0].id;
            }
          }
        });
      }
    },

    //获取分部分项工程， 以父子节点形式呈现
    getProgressListData() {
      let data = {
        projectSn: this.projectSn,
      };
      getSubdivisionProjectApi(data).then((res) => {
        if (res.code == 200) {
          this.listData = res.result;
          if (this.listData.length >= 1) {
            // this.addForm1.subsectionId = this.listData[0].id;//默认选中第一项分部工程
            if (this.listData[0].children.length >= 1) {
              this.subListData = this.listData[0].children;
              // this.addForm1.subentryId = this.listData[0].children[0].id//默认选中第一项分项工程
            }
          }
        }
      });
    },
    //导出
    exportData() {
      if (this.COMPANY == "zjwj") {
        window.location.href =
          this.$http.defaults.baseURL +
          "xmgl/qualityRectifyRecord/recordRectify/excel/export?projectSn=" +
          this.$store.state.projectSn +
          "&recordType=" +
          this.formInline.recordType +
          "&inspectStartTime=" +
          this.formInline.inspectStartTime +
          "&inspectEndTime=" +
          this.formInline.inspectEndTime +
          "&level=" +
          this.formInline.level +
          "&status=" +
          this.formInline.status +
          "&pageNo=" +
          this.pageNo +
          "&pageSize=" +
          this.pageSize;
      } else {
        // xmgl/download/exporExcelQualityInspectionRecord
        const data = {};
        if (this.formInline.dangerInfoId.length > 0) {
          data.dangerInfoLevel = this.formInline.dangerInfoId.length;
          data.dangerInfoId = this.formInline.dangerInfoId[
            this.formInline.dangerInfoId.length - 1
          ];
        } else {
          data.dangerInfoLevel = "";
          data.dangerInfoId = "";
        }
        console.log(this.formInline.enterpriseId);
        window.location.href =
          this.$http.defaults.baseURL +
          "xmgl/download/exportExcelXzSecurityQualityInspectionRecord?projectSn=" +
          this.$store.state.projectSn +
          "&recordType=" +
          this.formInline.recordType +
          "&inspectStartTime=" +
          this.formInline.inspectStartTime +
          "&inspectEndTime=" +
          this.formInline.inspectEndTime +
          "&level=" +
          this.formInline.level +
          "&status=" +
          this.formInline.status +
          "&urgentLevel=" +
          this.formInline.urgentLevel +
          "&pageNo=" +
          this.pageNo +
          "&pageSize=" +
          this.pageSize +
          "&dangerInfoId=" +
          data.dangerInfoId +
          "&dangerInfoLevel=" +
          data.dangerInfoLevel +
          "&enterpriseId=" +
          this.formInline.enterpriseId;
      }
    },
    openImg(src) {
      window.open(src);
    },
    focuscascader(e) {
      let that = this;
      console.log(that.classifyList);
      if (that.$refs["formRegion2"].getCheckedNodes().length) {
        that.classifyList.forEach((item) => {
          that.$set(item, "disabled", true);
          // item.disabled = true;
          if (item.children) {
            item.children.forEach((item2) => {
              that.$set(item2, "disabled", true);
              // item2.disabled = true
            });
          }
        });
        // this.$refs.formRegion2.panel.lazyLoad();
        // this.$refs['formRegion2'].getCheckedNodes()[0].pathNodes.disabled = true;
      }
    },
    blurcascader(e) {
      let that = this;
      console.log(that.classifyList);
      if (that.$refs["formRegion2"].getCheckedNodes().length) {
        that.classifyList.forEach((item) => {
          that.$set(item, "disabled", false);
          // item.disabled = true;
          if (item.children) {
            item.children.forEach((item2) => {
              that.$set(item2, "disabled", false);
              // item2.disabled = true
            });
          }
        });
        // this.$refs.formRegion2.panel.lazyLoad();
        // this.$refs['formRegion2'].getCheckedNodes()[0].pathNodes.disabled = true;
      }
    },
    selectcascader(e) {
      //remark整改要求 level等级
      if (this.dealShow) {
        if (e.length) {
          console.log(this.$refs["formRegion2"].getCheckedNodes()[0].data);
          this.dealForm.level = this.$refs["formRegion2"].getCheckedNodes()[0].data.level;
          this.dealForm.remark = this.$refs[
            "formRegion2"
          ].getCheckedNodes()[0].data.remark;
        } else {
          this.dealForm.level = "";
          this.dealForm.remark = "";
        }
      } else {
        if (e.length) {
          console.log(this.$refs["formRegion2"].getCheckedNodes()[0].data);
          this.addForm1.level = this.$refs["formRegion2"].getCheckedNodes()[0].data.level;
          this.addForm1.remark = this.$refs[
            "formRegion2"
          ].getCheckedNodes()[0].data.remark;
        } else {
          this.addForm1.level = "";
          this.addForm1.remark = "";
        }
      }
    },
    changeRegion2(val) {
      // console.log(val,this.checkPointList,this.$refs['formRegion1'].getCheckedNodes()[0])
      if (this.recordType == 1) {
        if (this.$refs["formRegion1"].getCheckedNodes().length == 0) {
          this.dealForm.enterpriseSn = "";
          this.dealForm.enterpriseName = "";
          this.dealForm.changeId = "";
          this.subcontractList = [];
          this.crewUpdateList = [];
          return;
        }
      } else {
        if (this.$refs["addFormRegion2"].getCheckedNodes().length == 0) {
          this.dealForm.enterpriseSn = "";
          this.dealForm.enterpriseName = "";
          this.subcontractList = [];
          this.crewUpdateList = [];
          return;
        }
      }
      if (this.recordType == 1) {
        this.dealForm.enterpriseSn = "";
        this.dealForm.enterpriseName = "";
        this.dealForm.changeId = "";
        let pathLabels = this.$refs["formRegion1"].getCheckedNodes()[0].pathLabels;
        let data = this.$refs["formRegion1"].getCheckedNodes()[0].data;
        this.areaData = data;
        console.log(data, 666);
        // console.log(pathLabels,data)
        let text = "";
        for (let i = 0; i < pathLabels.length; i++) {
          if (text) {
            text = text + "/" + pathLabels[i];
          } else {
            text = pathLabels[i];
          }
        }
        // if (data.dutyId) {
        //   this.addForm1.changeId = data.dutyId;
        //   console.log(
        //     " this.addForm1.changeId================",
        //     this.addForm1.changeId
        //   );
        // } else {
        //   this.addForm1.changeId = "";
        // }
        this.dealForm.changeId = "";
        this.dealForm.regionName = text;
        this.getReviewPeopleList(this.dealForm.regionId);
        // console.log(data.intendanceIds.split(','))
        // console.log(text)
        if (data.intendanceIds && data.intendanceIds.split(",") > 0) {
          for (let j = 0; j < data.intendanceIds.split(",").length; j++) {
            if (this.dealForm.notifyPerson > 0) {
              this.dealForm.notifyPerson = [];
            }
            this.dealForm.notifyPerson.push(Number(data.intendanceIds.split(",")[j]));
          }
        }
        this.dealForm.notifyPerson = data.intendanceIds
          ? data.intendanceIds.split(",")
          : [];
        console.log(
          " this.addForm1.notifyPerson================",
          this.dealForm.notifyPerson
        );
        this.subcontractList = data.enterpriseInfos;
        this.crewUpdateList = [];
      } else if (this.recordType == 2) {
        this.dealForm.enterpriseSn = "";
        this.dealForm.enterpriseName = "";
        let pathLabels = this.$refs["addFormRegion2"].getCheckedNodes()[0].pathLabels;
        let data = this.$refs["addFormRegion2"].getCheckedNodes()[0].data;
        this.areaData = data;
        let text = "";
        for (let i = 0; i < pathLabels.length; i++) {
          if (text) {
            text = text + "/" + pathLabels[i];
          } else {
            text = pathLabels[i];
          }
        }
        // if (data.dutyId) {
        //   this.addForm2.changeId = Number(data.dutyId)
        // }
        this.dealForm.regionName = text;
        this.getReviewPeopleList(this.dealForm.regionId);
        this.subcontractList = data.enterpriseInfos;
        this.crewUpdateList = [];
      }
      this.$refs["dealForm"].clearValidate();
      console.log(1122334455, this.checkPointList);
      // this.dealForm.inspectManId = this.checkPointList;
    },
    changeRegion(val) {
      // console.log(val,this.checkPointList,this.$refs['formRegion1'].getCheckedNodes()[0])
      if (this.recordType == 1) {
        if (this.$refs["formRegion1"].getCheckedNodes().length == 0) {
          this.addForm1.enterpriseSn = "";
          this.addForm1.enterpriseName = "";
          this.addForm1.changeId = "";
          this.subcontractList = [];
          this.crewUpdateList = [];
          return;
        }
      } else {
        if (this.$refs["addFormRegion2"].getCheckedNodes().length == 0) {
          this.addForm2.enterpriseSn = "";
          this.addForm2.enterpriseName = "";
          this.subcontractList = [];
          this.crewUpdateList = [];
          return;
        }
      }
      if (this.recordType == 1) {
        this.addForm1.enterpriseSn = "";
        this.addForm1.enterpriseName = "";
        this.addForm1.changeId = "";
        let pathLabels = this.$refs["formRegion1"].getCheckedNodes()[0].pathLabels;
        let data = this.$refs["formRegion1"].getCheckedNodes()[0].data;
        this.areaData = data;
        console.log(data, 666);
        // console.log(pathLabels,data)
        let text = "";
        for (let i = 0; i < pathLabels.length; i++) {
          if (text) {
            text = text + "/" + pathLabels[i];
          } else {
            text = pathLabels[i];
          }
        }
        // if (data.dutyId) {
        //   this.addForm1.changeId = data.dutyId;
        //   console.log(
        //     " this.addForm1.changeId================",
        //     this.addForm1.changeId
        //   );
        // } else {
        //   this.addForm1.changeId = "";
        // }
        this.addForm1.changeId = "";
        this.addForm1.regionName = text;
        this.getReviewPeopleList(this.addForm1.regionId);
        // console.log(data.intendanceIds.split(','))
        // console.log(text)
        if (data.intendanceIds && data.intendanceIds.split(",") > 0) {
          for (let j = 0; j < data.intendanceIds.split(",").length; j++) {
            if (this.addForm1.notifyPerson > 0) {
              this.addForm1.notifyPerson = [];
            }
            this.addForm1.notifyPerson.push(Number(data.intendanceIds.split(",")[j]));
          }
        }
        this.addForm1.notifyPerson = data.intendanceIds
          ? data.intendanceIds.split(",")
          : [];
        console.log(
          " this.addForm1.notifyPerson================",
          this.addForm1.notifyPerson
        );
        this.subcontractList = data.enterpriseInfos;
        this.crewUpdateList = [];
      } else if (this.recordType == 2) {
        this.addForm2.enterpriseSn = "";
        this.addForm2.enterpriseName = "";
        let pathLabels = this.$refs["addFormRegion2"].getCheckedNodes()[0].pathLabels;
        let data = this.$refs["addFormRegion2"].getCheckedNodes()[0].data;
        let text = "";
        for (let i = 0; i < pathLabels.length; i++) {
          if (text) {
            text = text + "/" + pathLabels[i];
          } else {
            text = pathLabels[i];
          }
        }
        // if (data.dutyId) {
        //   this.addForm2.changeId = Number(data.dutyId)
        // }
        this.addForm2.regionName = text;
        this.getReviewPeopleList(this.addForm2.regionId);
        this.subcontractList = data.enterpriseInfos;
        this.crewUpdateList = [];
      }
      this.$refs["addForm1"].clearValidate();
      this.addForm1.inspectManId = this.checkPointList;
    },
    editChangeRegion() {
      // console.log(val,this.checkPointList,this.$refs['formRegion1'].getCheckedNodes()[0])
      if (this.recordType == 1) {
        if (this.$refs["formRegion1"].getCheckedNodes().length == 0) {
          this.addForm1.enterpriseSn = "";
          this.addForm1.enterpriseName = "";
          this.addForm1.changeId = "";
          this.subcontractList = [];
          this.crewUpdateList = [];
          return;
        }
      } else {
        if (this.$refs["addFormRegion2"].getCheckedNodes().length == 0) {
          this.addForm2.enterpriseSn = "";
          this.addForm2.enterpriseName = "";
          this.subcontractList = [];
          this.crewUpdateList = [];
          return;
        }
      }
      if (this.recordType == 1) {
        let pathLabels = this.$refs["formRegion1"].getCheckedNodes()[0].pathLabels;
        let data = this.$refs["formRegion1"].getCheckedNodes()[0].data;
        this.areaData = data;
        const newArr = [];
        console.log(this.areaData, 777999333);
        if (this.areaData.systemUsers) {
          this.areaData.systemUsers.filter((item) => {
            if (item.userId && item.enterpriseId == this.addForm1.enterpriseId) {
              newArr.push(item);
            }
          });
          console.log(newArr, 666777);
          this.crewUpdateList = newArr;
        }
        console.log(data, 666);
        // console.log(pathLabels,data)
        let text = "";
        for (let i = 0; i < pathLabels.length; i++) {
          if (text) {
            text = text + "/" + pathLabels[i];
          } else {
            text = pathLabels[i];
          }
        }
        if (data.dutyId) {
          this.addForm1.changeId = data.dutyId;
        }
        this.addForm1.regionName = text;
        this.getReviewPeopleList(this.addForm1.regionId);
        // console.log(data.intendanceIds.split(','))
        // console.log(text)
        if (data.intendanceIds && data.intendanceIds.split(",") > 0) {
          for (let j = 0; j < data.intendanceIds.split(",").length; j++) {
            if (this.addForm1.notifyPerson > 0) {
              this.addForm1.notifyPerson = [];
            }
            this.addForm1.notifyPerson.push(Number(data.intendanceIds.split(",")[j]));
          }
        }
        this.addForm1.notifyPerson = data.intendanceIds
          ? data.intendanceIds.split(",")
          : [];
        console.log(
          " this.addForm1.notifyPerson================",
          this.addForm1.notifyPerson
        );
        this.subcontractList = data.enterpriseInfos;
        this.crewUpdateList = [];
      } else if (this.recordType == 2) {
        let pathLabels = this.$refs["addFormRegion2"].getCheckedNodes()[0].pathLabels;
        let data = this.$refs["addFormRegion2"].getCheckedNodes()[0].data;
        let text = "";
        for (let i = 0; i < pathLabels.length; i++) {
          if (text) {
            text = text + "/" + pathLabels[i];
          } else {
            text = pathLabels[i];
          }
        }
        // if (data.dutyId) {
        //   this.addForm2.changeId = Number(data.dutyId)
        // }
        this.addForm2.regionName = text;
        this.getReviewPeopleList(this.addForm2.regionId);
        this.subcontractList = data.enterpriseInfos;
        this.crewUpdateList = [];
      }
      this.$refs["addForm1"].clearValidate();
      this.addForm1.inspectManId = this.checkPointList;
    },
    // 切换检查时间
    checkedTime(time) {
      if (time != null) {
        this.formInline.inspectStartTime = time[0];
        this.formInline.inspectEndTime = time[1];
      } else {
        this.formInline.inspectStartTime = "";
        this.formInline.inspectEndTime = "";
      }
    },
    //整改记录
    selectRectifyRecordList(id) {
      selectRectifyRecordListApi({
        qualityId: id,
      }).then((res) => {
        this.rectifyRecordList = res.result;
        this.rectifyRecordList.forEach((item) => {
          if (item.fileUrl) {
            this.imgList = [];
            if (item.fileUrl.startsWith("[") && item.fileUrl.endsWith("]")) {
              let fileListI = JSON.parse(item.fileUrl);
              fileListI.forEach((file) => {
                let url = file.url;
                if (!url.startsWith("http://")) {
                  url = this.fileUrl + url;
                }
                this.imgList.push(url);
              });
            } else {
              let fileListI = item.fileUrl.split(",");
              fileListI.forEach((url) => {
                if (!url.startsWith("http://")) {
                  url = this.fileUrl + url;
                }
                this.imgList.push(url);
              });
            }
            item.fileUrl = this.imgList;
          } else {
            item.fileUrl = [];
          }
        });
        console.log("整改记录-处理后--", this.rectifyRecordList);
      });
    },
    //原版查看详情
    showDatadetails(val) {
      console.log("查看详情====", val);
      this.selectRectifyRecordList(val.id);
      this.hideUpload = true;
      this.addBtn(1);
      if (val.recordType == 1) {
        console.log("类型是1吗");
        this.recordType = 1;
        val.urgentLevel = Number(val.urgentLevel);
        // val.notifyPerson = [Number(val.notifyPerson)];
        let arr = val.imageUrl.split(",");
        let fileArr = val.fileUrl.split(",");
        let showImgUrl = [];
        let showFileUrl = [];
        for (let i = 0; i < arr.length; i++) {
          let imgArr = arr[i].split("*");
          let obj = { name: imgArr[0], url: imgArr[1] };
          showImgUrl.push(obj);
        }
        for (let i = 0; i < fileArr.length; i++) {
          let file = fileArr[i].split("*");
          let obj = { name: file[0], url: file[1] };
          showFileUrl.push(obj);
        }
        showFileUrl = showFileUrl.filter((item) => {
          return item.url != undefined;
        });
        showImgUrl = showImgUrl.filter((item) => {
          return item.url != undefined;
        });
        this.fileList1 = showImgUrl;
        this.fileList2 = showFileUrl;
        this.addForm1 = JSON.parse(JSON.stringify(val));
        this.addForm1.notifyPerson = val.notifyPerson
          .split(",")
          .map((item2) => String(item2));
      } else {
        this.recordType = 2;
        val.urgentLevel = Number(val.urgentLevel);

        // val.notifyPerson = [Number(val.notifyPerson)];
        let arr = val.imageUrl.split(",");
        let fileArr = val.fileUrl.split(",");
        let showImgUrl = [];
        let showFileUrl = [];
        for (let i = 0; i < arr.length; i++) {
          let imgArr = arr[i].split("*");
          let obj = { name: imgArr[0], url: imgArr[1] };
          showImgUrl.push(obj);
        }
        for (let i = 0; i < fileArr.length; i++) {
          let file = fileArr[i].split("*");
          let obj = { name: file[0], url: file[1] };
          showFileUrl.push(obj);
        }
        showFileUrl = showFileUrl.filter((item) => {
          return item.url != undefined;
        });
        showImgUrl = showImgUrl.filter((item) => {
          return item.url != undefined;
        });
        this.fileList3 = showImgUrl;
        this.fileList4 = showFileUrl;
        this.addForm2 = val;
        this.addForm2.notifyPerson = val.notifyPerson
          .split(",")
          .map((item) => Number(item));
      }
    },
    //刷新按钮
    refreshBtn() {
      this.time = [];
      this.formInline = {
        inspectEndTime: "",
        inspectStartTime: "",
        recordType: "",
        level: "",
        status: "",
        urgentLevel: "",
        regionId: "",
        dangerInfoId: "",
        enterpriseId: "",
      };
      this.pageNo = 1;
      this.pageSize = 10;
      this.onSubmit();
    },

    //查询按钮  分页列表查询
    onSubmit() {
      let data = { ...this.formInline };
      console.log(data.dangerInfoId);
      if (data.dangerInfoId.length > 0) {
        data.dangerInfoLevel = data.dangerInfoId.length;
        data.dangerInfoId = data.dangerInfoId[data.dangerInfoId.length - 1];
      } else {
        data.dangerInfoLevel = "";
        data.dangerInfoId = "";
      }

      data.projectSn = this.projectSn;
      data.pageNo = this.pageNo;
      data.pageSize = this.pageSize;
      data.operatorId = this.$store.state.userInfo.userId;
      getInspectionRecordListApi(data).then((res) => {
        console.log("res----", res);
        if (res.code == 200) {
          this.statisticsValue = res.result.total;
          this.tableData = res.result.page.records;
          this.total = res.result.page.total;
        }
      });
    },

    //新增按钮
    addBtn(type) {
      console.log(type);
      if (type == 1) {
        this.type = "detail";
        this.addTitle =
          this.$t("message.quality.inspectionRecord") + this.$t("message.quality.detail");
      } else {
        this.type = "add";
        this.addTitle =
          this.$t("message.quality.new") + this.$t("message.quality.inspectionRecord");

        this.fileList1 = [];

        this.fileList3 = [];
      }
      // 逻辑结束
      this.addDialog = true;
      this.getPositionList();
      // this.getDescribeClassifyList();
      this.getPeopleList();

      // this.getPeopleUpdateList();
      this.getRoutineInspect();
      this.close();
      this.rectifyRecordList = [];
    },

    //获取新增弹窗--  检查部位下拉
    getPositionList() {
      let data = {
        projectSn: this.projectSn,
        notSupervisingUnit: 1,
        pageNo: 1,
        pageSize: -1,
      };
      getQualityRegionTreePageApi(data).then((res) => {
        console.log("res=================", res);
        if (res.code == 200) {
          this.checkPointList = res.result.records;
        }
      });
    },
    // 例行检查 列表
    getRoutineInspect() {
      let data = {
        projectSn: this.projectSn,
      };
      getRoutineInspectApi(data).then((res) => {
        if (res.code == 200) {
          this.routineList = res.result;
        }
      });
    },

    //获取问题描述  和 问题分类 下拉列表
    getDescribeClassifyList() {
      let data = {
        projectSn: this.projectSn,
        recordStatus: 0,
      };
      getDangerTypeRecordApi(data).then((res) => {
        if (res.code == 200) {
          console.log(res);
          this.classifyList = res.result;
          this.classifyList.forEach((item) => {
            // item.disabled = true;
            if (item.children) {
              item.children.forEach((item2) => {
                // item2.disabled = true;
                // console.log(item2);
                if (item2.itemList) {
                  item2.itemList.forEach((item3) => {
                    item3.dangerName = item3.content;
                    // console.log(item.content);
                  });
                }
                item2.children = item2.itemList;
              });
              // console.log();
              // console.log(item.children);
            }
          });
        }
      });
    },

    //获取去整改人 通知人 检查人 核查人下拉
    getReviewPeopleList(regionId) {
      if (regionId instanceof Array) {
        this.addForm1.reviewId = ""; // 先清空复查人
        this.dealForm.reviewId = ""; // 先清空复查人
      }
      let data = {
        projectSn: this.projectSn,
        // enterpriseTypeId: 7,
       qualityRegionIdForReview:
          regionId instanceof Array ? regionId[regionId.length - 1].toString() : regionId,
        // safeQualityRegionIdForDuty: regionId.toString(),
        qualityRegionBindType: 2,
        isSupervisingRoleName: 1,
      };
      getProjectChilderSystemUserListApi(data).then((res) => {
        if (res.code == 200) {
          this.reviewList = res.result;
        }
      });
    },
    //查询劳务和管理人员列表
    loadPersonList(sn) {
      getLaborManagementInfoListApi({
        projectSn: sn,
      }).then((res) => {
        this.personList = res.result;
      });
    },
    //获取去整改人 通知人 检查人 核查人下拉
    getPeopleList() {
      let data = {
        projectSn: this.projectSn,
      };
      getProjectChilderSystemUserListApi(data).then((res) => {
        if (res.code == 200) {
          this.crewList = res.result;
        }
      });
    },
    //获取整改人
    getPeopleUpdateList() {
      let data = {
        projectSn: this.projectSn,
        enterpriseId: this.unitEnterpriseId.join(","),
        qualityRegionIdForDuty: this.unitRegionId.join(","),
      };
      if (this.dangerReviewInfo.enableVerify == 1 && this.dealForm.status == 4) {
        data.roleName = this.dangerReviewInfo.verifyRoleName;
      }
      if (this.dangerReviewInfo.enableReview == 1 && this.dealForm.status == 3) {
        data.roleName = this.dangerReviewInfo.reviewRoleName;
      }
      getProjectChilderSystemUserListApi(data).then((res) => {
        if (res.code == 200) {
          this.crewUpdateList = res.result;
        }
      });
    },
    getPeopleUpdate() {
      let data = {
        projectSn: this.projectSn,
        enterpriseId: this.unitEnterpriseId,
      };
      getWorkerInfoListApi(data).then((res) => {
        if (res.code == 200) {
          this.crewUpdateList2 = res.result;
        }
      });
    },
    //获取问题描述
    handleChange(value) {
      if (this.dealShow) {
        if (value.length) {
          console.log(value, this.dealForm.dangerItemId);
          let pathLabels =
            this.$refs["cascaderAddr"] && this.$refs["cascaderAddr"].getCheckedNodes();
          // for (let i = 0; i < pathLabels[0].pathNodes.length - 1; i++) {
          //   // pathLabels[0].pathNodes[i].disabled = true;
          // }
          console.log("11223344", pathLabels);
          if (this.recordType == 1 && pathLabels.length > 0) {
            //只有问题描述有三级时才查询问题等级
            if (this.$refs["cascaderAddr"].getCheckedNodes()[0].pathLabels.length >= 3) {
              this.dealForm.level = this.$refs[
                "cascaderAddr"
              ].getCheckedNodes()[0].data.level;
            } else {
              this.dealForm.level = "";
            }
            this.dealForm.remark = this.$refs[
              "cascaderAddr"
            ].getCheckedNodes()[0].data.remark;

            const pathLabelList = pathLabels[0].pathLabels.filter(
              (item) => item != pathLabels[0].label
            );
            console.log("整改时限", pathLabels, pathLabelList);
            this.dealForm.problemDescription = pathLabels[0].label;
            this.dealForm.dangerItemContent = pathLabelList
              .map((item) => {
                return item;
              })
              .join("/");
            // pathLabels[0].pathLabels[0] +
            // pathLabels[0].pathLabels[1] +
            // pathLabels[0].pathLabels[2];
          } else {
            // this.addForm2.level =
            //   this.$refs['cascaderAddr2'].getCheckedNodes()[0].data.level
            let pathLabels2 = this.$refs["cascaderAddr2"].getCheckedNodes();
            this.dealForm.remark = this.$refs[
              "cascaderAddr2"
            ].getCheckedNodes()[0].data.remark;

            this.dealForm.dangerItemContent = pathLabels2[0].pathLabels
              .map((item) => {
                console.log(item, 1640);
                return item;
              })
              .join("/");
            console.log(
              "获取问题进来了吗-2",
              pathLabels2,
              this.dealForm.dangerItemContent
            );

            // pathLabels2[0].pathLabels[0] +
            // pathLabels2[0].pathLabels[1] +
            // pathLabels2[0].pathLabels[2];
          }
        } else {
          this.dealForm.level = "";
          this.dealForm.remark = "";
        }
      } else {
        if (value.length) {
          console.log(value, this.addForm2.dangerItemId);
          let pathLabels = this.$refs["cascaderAddr"].getCheckedNodes();
          let pathLabels2 = this.$refs["cascaderAddr2"].getCheckedNodes();
          // for (let i = 0; i < pathLabels[0].pathNodes.length - 1; i++) {
          //   // pathLabels[0].pathNodes[i].disabled = true;
          // }
          if (this.recordType == 1 && pathLabels.length > 0) {
            //只有问题描述有三级时才查询问题等级
            if (this.$refs["cascaderAddr"].getCheckedNodes()[0].pathLabels.length >= 3) {
              this.addForm1.level = this.$refs[
                "cascaderAddr"
              ].getCheckedNodes()[0].data.level;
            } else {
              this.addForm1.level = "";
            }
            this.addForm1.remark = this.$refs[
              "cascaderAddr"
            ].getCheckedNodes()[0].data.remark;

            const pathLabelList = pathLabels[0].pathLabels.filter(
              (item) => item != pathLabels[0].label
            );
            console.log("整改时限", pathLabels, pathLabelList);
            this.addForm1.problemDescription = pathLabels[0].label;
            this.addForm1.dangerItemContent = pathLabelList
              .map((item) => {
                return item;
              })
              .join("/");
            // pathLabels[0].pathLabels[0] +
            // pathLabels[0].pathLabels[1] +
            // pathLabels[0].pathLabels[2];
          } else {
            // this.addForm2.level =
            //   this.$refs['cascaderAddr2'].getCheckedNodes()[0].data.level
            this.addForm2.remark = this.$refs[
              "cascaderAddr2"
            ].getCheckedNodes()[0].data.remark;

            this.addForm2.dangerItemContent = pathLabels2[0].pathLabels
              .map((item) => {
                console.log(item, 1640);
                return item;
              })
              .join("/");
            console.log("获取问题进来了吗-2", this.addForm2.dangerItemContent);

            // pathLabels2[0].pathLabels[0] +
            // pathLabels2[0].pathLabels[1] +
            // pathLabels2[0].pathLabels[2];
          }
        } else {
          this.addForm1.level = "";
          this.addForm1.remark = "";
        }
      }
    },
    // 获取分包单位
    getDivisionUnitFn() {
      let data = {
        // enterpriseTypeId: this.subcontractType,
        pageNo: 1,
        pageSize: 999,
        projectSn: this.projectSn,
      };
      getSubcontractListApi(data).then((res) => {
        if (res.code == 200) {
          this.subcontractList = res.result.records;
        }
      });
    },
    getUpdateUnitListFn() {
      getEnterpriseInfoListApi({ projectSn: this.projectSn }).then((res) => {
        console.log(res);
        if (res.code == 200) {
          this.enterpriseList = res.result;
        }
      });
    },

    //获取分包单位
    getEnterprise(type) {
      if (type != 1) {
        this.showEnterpriseDialog = true;
      }
    },
    //切换分包公司类型
    changeSubcontractType(val) {
      this.subcontractType = val;
      this.getEnterprise(1);
    },

    //选中的分包公司
    checkedSubcontractList(val) {
      if (this.dealShow) {
        if (this.recordType == 1) {
          this.dealForm.enterpriseSn = val.enterpriseSn;
          this.dealForm.enterpriseName = val.enterpriseName;
          this.unitEnterpriseId = val.id;
        } else {
          // addForm2
          this.dealForm.enterpriseSn = val.enterpriseSn;
          this.dealForm.enterpriseName = val.enterpriseName;
          this.unitEnterpriseId = val.id;
        }
        this.dealForm.changeId = "";
        this.getPeopleList();
        this.getPeopleUpdate();
        // this.getPeopleUpdateList();
        const newArr = [];
        console.log(this.areaData, 777999333);
        if (this.areaData.systemUsers) {
          this.areaData.systemUsers.filter((item) => {
            if (item.userId && item.enterpriseId == this.unitEnterpriseId) {
              newArr.push(item);
            }
          });
          console.log(newArr, 666777);
          this.crewUpdateList = newArr;
        }
      } else {
        if (this.recordType == 1) {
          this.addForm1.enterpriseSn = val.enterpriseSn;
          this.addForm1.enterpriseName = val.enterpriseName;
          this.unitEnterpriseId = val.id;
        } else {
          this.addForm2.enterpriseSn = val.enterpriseSn;
          this.addForm2.enterpriseName = val.enterpriseName;
          this.unitEnterpriseId = val.id;
        }
        this.addForm1.changeId = "";
        this.getPeopleList();
        // this.getPeopleUpdateList();
        const newArr = [];
        console.log(this.areaData, 777999333);
        if (this.areaData.systemUsers) {
          this.areaData.systemUsers.filter((item) => {
            if (item.userId && item.enterpriseId == this.unitEnterpriseId) {
              newArr.push(item);
            }
          });
          console.log(newArr, 666777);
          this.crewUpdateList = newArr;
        }
      }
      this.showEnterpriseDialog = false;
    },

    beforeUpload(file, type) {
      if (type == 1 || type == 3 || type == 5) {
        // console.log(this.fileList1.length)
        if (
          this.fileList1.length >= 5 ||
          this.fileList3.length >= 5 ||
          this.fileListRectification.length >= 5
        ) {
          this.$message.warning("最多只能上传5张图片");
          return false;
        }
        return true;
      }
      if (type == 2 || type == 4) {
        const fileType = file.type;
        const fileTypeList = ["audio/mp3", "video/mp4"];

        if (!fileTypeList.includes(fileType)) {
          this.$message.error("只能上传MP3/MP4文件");
          return false;
        }
        return true;
      }
    },
    //上传成功
    handleSuccess2(file, type) {
      const obj = {
        1: "zgFileUrl",
        2: "imageUrl",
        3: "fcFileUrl",
        4: "hyFileUrl",
        5: "fileUrl",
      };
      this.dealForm[obj[type]].push({
        name: file.data[0].filename,
        url: this.fileUrl + file.data[0].imageUrl,
      });
    },
    //删除图片
    handleRemove2(file, fileList, type) {
      const obj = {
        1: "zgFileUrl",
        2: "imageUrl",
        3: "fcFileUrl",
        4: "hyFileUrl",
        5: "fileUrl",
      };
      this.dealForm[obj[type]] = fileList;
    },
    //上传成功
    handleSuccess(file, type) {
      if (type == 1) {
        let data = {
          name: file.data[0].filename,
          url: this.fileUrl + file.data[0].imageUrl,
        };
        // if (this.fileList1.length >= 4) {
        //   this.$message.warning("最多只能上传5张图片");
        //   return false;
        // } else {

        // }
        this.fileList1.push(data);
      } else if (type == 2) {
        let data = {
          name: file.data[0].fileInfo.originalFilename,
          url: this.fileUrl + file.data[0].imageUrl,
        };

        this.fileList2.push(data);
      } else if (type == 3) {
        let data = {
          name: file.data[0].filename,
          url: this.fileUrl + file.data[0].imageUrl,
        };
        // if (this.fileList3.length >= 4) {
        //   this.$message.warning("最多只能上传5张图片");
        //   return false;
        // } else {

        // }
        this.fileList3.push(data);
      } else if (type == 4) {
        let data = {
          name: file.data[0].fileInfo.originalFilename,
          url: this.fileUrl + file.data[0].imageUrl,
        };
        this.fileList4.push(data);
      } else if (type == 5) {
        let data = {
          name: file.data[0].filename,
          url: this.fileUrl + file.data[0].imageUrl,
        };
        this.fileListRectification.push(data);
      }
    },
    //上传失败
    handleError(file) {
      this.$message.error(this.$t("message.quality.failToUpload"));
    },
    //查看图片
    handlePreview(file) {
      this.dialogImageUrl = file.url;
      var filename = file.name;
      var index1 = filename.lastIndexOf(".");
      var index2 = filename.length;
      var type = filename.substring(index1, index2);
      console.log(type);
      if (type == ".mp4" || type == ".mp3") {
        // window.open(file.url)
      } else {
        this.dialogVisible = true;
      }
    },
    //删除图片
    handleRemove(file, fileList, type) {
      if (type == 1) {
        this.fileList1 = fileList;
      } else if (type == 2) {
        this.fileList2 = fileList;
      } else if (type == 3) {
        this.fileList3 = fileList;
      } else if (type == 4) {
        this.fileList4 = fileList;
      } else if (type == 5) {
        this.fileListRectification = fileList;
      }
    },
    //在图纸定位弹窗
    drawingPositionBtn() {
      this.showPositioning = true;
    },

    //上传图纸
    uploadMapSuccess(res) {
      this.cropperOption.img = this.$store.state.FILEURL + res.data[0].imageUrl;
      this.cropperDialog = true;
    },

    //获取鼠标位置
    getMousePos(event) {
      var e = event || window.event;
      var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
      var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
      var x = e.pageX || e.clientX + scrollX;
      var y = e.pageY || e.clientY + scrollY;
      // console.log("x: " + x + "\ny: " + y);
      // console.log(this);
      return { x: x, y: y };
    },

    //新增坐标数据
    addPoint(event) {
      if (this.createdCoord) {
        let clickPoint = this.getMousePos(event); // 获取鼠标的位置
        let left = event.target.getBoundingClientRect().left; //获取点击元素的位置
        let top = event.target.getBoundingClientRect().top;
        let data = {
          coordinateX: clickPoint.x - left - 6,
          coordinateY: clickPoint.y - top - 9,
        };
        this.pointList.push(data);
      }
    },

    // 放大
    magnify() {
      if (this.multiples >= 3) {
        return;
      }
      this.multiples += 0.25;
    },
    // 缩小
    shrink() {
      if (this.multiples <= 0.5) {
        return;
      }
      this.multiples -= 0.25;
    },
    // 旋转
    rotate() {
      this.deg += 90;
      if (this.deg >= 360) {
        this.deg = 0;
      }
    },

    // 保存 裁剪后的 地图
    saveMapUrlFn() {
      this.$refs.cropper.startCrop();
      var _this = this;
      this.$refs.cropper.getCropBlob((data) => {
        var param = new FormData();
        param.append("files", data, "image.png");
        _this.$http
          .post("/upload/image", param, {
            headers: {
              "Content-Type": "multipart/form-data",
            },
          })
          .then((res) => {
            if (res.data.status == "SUCCESS") {
              console.log(_this.$store.state.FILEURL);
              console.log(res.data);
              _this.mapUrl = _this.$store.state.FILEURL + res.data.data[0].imageUrl;
              _this.cropperDialog = false;
              console.log(_this.$store.state.FILEURL, res.data.data);
              _this.$nextTick(() => {
                var oImg = document.getElementById("map"),
                  w,
                  h;
                if (oImg.naturalWidth) {
                  oImg.onload = function () {
                    w = oImg.naturalWidth;
                    h = oImg.naturalHeight;
                  };
                } else {
                  // IE 6/7/8
                  var nImg = new Image();
                  nImg.onload = function () {
                    w = nImg.width;
                    h = nImg.height;
                  };
                  nImg.src = oImg.src;
                }
              });
            }
          });
      });
    },
    //上传前
    beforeAvatarUpload(file) {},

    editPoint(item) {},
    //删除坐标
    removePoint(item, index) {
      let arr = JSON.parse(JSON.stringify(this.pointList));
      for (let i = 0; i < arr.length; i++) {
        if (
          item.coordinateX == arr[i].coordinateX &&
          item.coordinateY == arr[i].coordinateY
        ) {
          arr.splice(i, 1);
        }
      }
      this.pointList = arr;
    },

    //保存坐标
    savePointBtn() {
      this.showPositioning = false;
      this.createdCoord = false;
    },
    // 取消新增
    cancleEvent() {
      this.mapUrl = "";
      this.addDialog = false;
      this.$refs.addForm1.resetFields(); //清除所有验证
      this.$refs.addForm2.resetFields(); //清除所有验证
    },

    //提交 新增
    submitAddRecordFrom() {
      let newRefs = null;
      if (this.recordType == 1) {
        newRefs = "addForm1";
      } else if (this.recordType == 2) {
        newRefs = "addForm2";
      }
      console.log(this.addForm1);
      console.log(this.addForm2);
      this.$refs[newRefs].validate((valid) => {
        if (valid) {
          let data = {};
          if (this.recordType == 1) {
            data = JSON.parse(JSON.stringify(this.addForm1));
            data.regionId =
              this.addForm1.regionId.length > 1
                ? this.addForm1.regionId[this.addForm1.regionId.length - 1]
                : this.addForm1.regionId[0];
            data.dangerItemId = this.addForm1.dangerItemId[
              this.addForm1.dangerItemId.length - 1
            ];
            data.dangerTypeId = this.addForm1.dangerItemId[0];
            let pointArr = [];
            for (let i = 0; i < this.pointList.length; i++) {
              let obj =
                this.pointList[i].coordinateX + "*" + this.pointList[i].coordinateY;
              pointArr.push(obj);
            }
            let imgUrl = [];
            let fileUrl = [];
            for (let i = 0; i < this.fileList1.length; i++) {
              let obj = this.fileList1[i].name + "*" + this.fileList1[i].url;
              imgUrl.push(obj);
            }
            for (let i = 0; i < this.fileList2.length; i++) {
              let obj = this.fileList2[i].name + "*" + this.fileList2[i].url;
              fileUrl.push(obj);
            }
            data.measurePoints = pointArr.join(",");
            console.log("data.measurePoints=============", data.measurePoints);
            data.notifyPerson = this.addForm1.notifyPerson.join(",");
            data.imageUrl = imgUrl.join(",");
            data.fileUrl = fileUrl.join(",");
            if (data.verifyManId == this.$store.state.userInfo.realName) {
              data.verifyManId = this.$store.state.userInfo.userId;
            }
          } else {
            data = JSON.parse(JSON.stringify(this.addForm2));
            data.regionId =
              this.addForm2.regionId.length > 1
                ? this.addForm2.regionId[this.addForm2.regionId.length - 1]
                : this.addForm2.regionId[0];
            data.dangerItemId = this.addForm2.dangerItemId[
              this.addForm2.dangerItemId.length - 1
            ];
            data.dangerTypeId = this.addForm2.dangerItemId[0];
            // data.regionId = this.addForm2.regionId
            //   ? this.addForm2.regionId.pop()
            //   : "";
            // data.dangerItemId = this.addForm2.dangerItemId
            //   ? this.addForm1.dangerItemId.pop()
            //   : "";
            let imgUrl = [];
            let fileUrl = [];
            for (let i = 0; i < this.fileList3.length; i++) {
              let obj = this.fileList3[i].name + "*" + this.fileList3[i].url;
              imgUrl.push(obj);
            }
            for (let i = 0; i < this.fileList4.length; i++) {
              let obj = this.fileList4[i].name + "*" + this.fileList4[i].url;
              fileUrl.push(obj);
            }
            data.imageUrl = imgUrl.join(",");
            data.fileUrl = fileUrl.join(",");
          }
          data.recordType = this.recordType;
          data.projectSn = this.projectSn;
          console.log("data", data);
          data.inspectManId = this.$store.state.userInfo.userId;
          addRecordApi(data).then((res) => {
            if (res.code == 200) {
              this.$message.success(this.$t("message.quality.newSuccess"));
              this.$refs.addForm1.resetFields(); //清除所有验证
              this.$refs.addForm2.resetFields(); //清除所有验证
              // this.$refs["addForm1"].resetFields();
              // this.$refs["addForm2"].resetFields();
              this.addDialog = false;
              this.fileList1 = [];
              this.fileList2 = [];
              this.fileList3 = [];
              this.fileList4 = [];
              this.pointList = [];
              this.recordType = 1;
              this.mapUrl = "";
              this.pageNo = 1;
              this.onSubmit();
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    //重新提交 编辑
    submitEditRecordFrom() {
      let newRefs = null;
      if (this.recordType == 1) {
        newRefs = "addForm1";
      } else if (this.recordType == 2) {
        newRefs = "addForm2";
      }
      console.log(this.addForm1);
      console.log(this.addForm2);
      this.$refs[newRefs].validate((valid) => {
        if (valid) {
          let data = {};
          if (this.recordType == 1) {
            data = JSON.parse(JSON.stringify(this.addForm1));
            if (Array.isArray(data.regionId)) {
              data.regionId =
                this.addForm1.regionId.length > 1
                  ? this.addForm1.regionId[this.addForm1.regionId.length - 1]
                  : this.addForm1.regionId[0];
            }
            if (Array.isArray(data.dangerItemId)) {
              data.dangerItemId = this.addForm1.dangerItemId[
                this.addForm1.dangerItemId.length - 1
              ];
              data.dangerTypeId = this.addForm1.dangerItemId[0];
            }
            let pointArr = [];
            for (let i = 0; i < this.pointList.length; i++) {
              let obj =
                this.pointList[i].coordinateX + "*" + this.pointList[i].coordinateY;
              pointArr.push(obj);
            }
            let imgUrl = [];
            let fileUrl = [];
            for (let i = 0; i < this.fileList1.length; i++) {
              let obj = this.fileList1[i].name + "*" + this.fileList1[i].url;
              imgUrl.push(obj);
            }
            for (let i = 0; i < this.fileList2.length; i++) {
              let obj = this.fileList2[i].name + "*" + this.fileList2[i].url;
              fileUrl.push(obj);
            }
            data.measurePoints = pointArr.join(",");
            console.log("data=============", data);
            console.log("data=============", this.addForm1.notifyPerson);
            console.log("data=============", imgUrl);
            console.log("data=============", fileUrl);
            if (this.addForm1.notifyPerson) {
              data.notifyPerson = this.addForm1.notifyPerson.join(",");
            }
            data.imageUrl = imgUrl.join(",");
            data.fileUrl = fileUrl.join(",");
            if (data.verifyManId == this.$store.state.userInfo.realName) {
              data.verifyManId = this.$store.state.userInfo.userId;
            }
          } else {
            data = JSON.parse(JSON.stringify(this.addForm2));
            if (Array.isArray(data.regionId)) {
              data.regionId =
                this.addForm2.regionId.length > 1
                  ? this.addForm2.regionId[this.addForm2.regionId.length - 1]
                  : this.addForm2.regionId[0];
            }
            if (Array.isArray(data.dangerItemId)) {
              data.dangerItemId = this.addForm2.dangerItemId[
                this.addForm2.dangerItemId.length - 1
              ];
              data.dangerTypeId = this.addForm2.dangerItemId[0];
            }
            // data.regionId = this.addForm2.regionId
            //   ? this.addForm2.regionId.pop()
            //   : "";
            // data.dangerItemId = this.addForm2.dangerItemId
            //   ? this.addForm1.dangerItemId.pop()
            //   : "";
            let imgUrl = [];
            let fileUrl = [];
            for (let i = 0; i < this.fileList3.length; i++) {
              let obj = this.fileList3[i].name + "*" + this.fileList3[i].url;
              imgUrl.push(obj);
            }
            for (let i = 0; i < this.fileList4.length; i++) {
              let obj = this.fileList4[i].name + "*" + this.fileList4[i].url;
              fileUrl.push(obj);
            }
            data.imageUrl = imgUrl.join(",");
            data.fileUrl = fileUrl.join(",");
          }
          data.recordType = this.recordType;
          data.projectSn = this.projectSn;
          console.log("data", data);
          data.inspectManId = this.$store.state.userInfo.userId;
          data.status = 2; // 改为待整改状态
          editRecordApi(data).then((res) => {
            if (res.code == 200) {
              this.$message.success(this.$t("message.quality.newSuccess"));
              this.$refs.addForm1.resetFields(); //清除所有验证
              this.$refs.addForm2.resetFields(); //清除所有验证
              // this.$refs["addForm1"].resetFields();
              // this.$refs["addForm2"].resetFields();
              this.addDialog = false;
              this.fileList1 = [];
              this.fileList2 = [];
              this.fileList3 = [];
              this.fileList4 = [];
              this.pointList = [];
              this.recordType = 1;
              this.mapUrl = "";
              this.pageNo = 1;
              this.onSubmit();
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.onSubmit();
    },
    handleCurrentChange(val) {
      this.pageNo = val;
      this.onSubmit();
    },

    close() {
      if (this.addTitle == "编辑") return;
      // this.mapUrl = ''
      this.fileList1 = [];
      this.fileList2 = [];
      this.fileList3 = [];
      this.fileList4 = [];
      this.$nextTick(() => {
        this.$refs.addForm1.clearValidate(); //清除所有验证
        this.$refs.addForm2.clearValidate(); //清除所有验证
      });

      this.hideUpload = false;
      if (this.recordType == 1) {
        this.addForm1 = {
          regionId: "",
          regionName: "",
          dangerItemContent: "",
          dangerItemId: "",
          dangerTypeId: "",
          dangerDesc: "",
          remark: "",
          routineId: 0,
          level: 0,
          urgentLevel: 0,
          inspectManId: "",
          inspectTime: "",
          enterpriseSn: "",
          enterpriseName: "",
          changeLimitTime: "",
          changeId: "",
          reviewId: "",
          verifyManId: "",
          notifyPerson: [],
          status: 2,
          measurePoints: [],
          imageUrl: "",
          fileUrl: "",
          subsectionId: "",
          subentryId: "",
        };
      } else {
        this.addForm2 = {
          regionId: "",
          regionName: "",
          dangerDesc: "",
          routineInspect: 0,
          inspectManId: "",
          inspectTime: "",
          dangerItemContent: "",
          dangerItemId: "",
          dangerTypeId: "",
          enterpriseSn: "",
          enterpriseName: "",
          imageUrl: "",
          fileUrl: "",
          subsectionId: "",
          subentryId: "",
        };
      }
      // 默认选择
      let date = new Date();
      let nowDate = moment(date).format("YYYY-MM-DD HH:mm:ss");
      this.addForm1.inspectTime = nowDate;
      this.addForm2.inspectTime = nowDate;
      console.log(nowDate, 11334455);
      console.log(this.crewList, 11334455);
      // 默认选择核验人逻辑
      let index = this.crewList.findIndex((item) => {
        return item.userId == this.$store.state.userInfo.userId;
      });
      if (index != -1) {
        this.addForm1.verifyManId = this.$store.state.userInfo.userId;
      } else {
        this.addForm1.verifyManId = this.$store.state.userInfo.realName;
      }
    },
    submit() {},

    handleExceed() {},
  },
};
</script>
<style lang="less" scoped>
/deep/ .el-table__fixed-right {
  height: 100% !important;
  bottom: 0 !important;
  right: 0 !important;
}
.hidden_info {
  .hidden_top {
    display: flex;
    align-items: center;
    > div:first-child {
      padding: 2px 18px;
      font-size: 11px;
      color: #ffffff;
      margin-right: 5px;
    }
    .hidden-start1 {
      background-color: #409eff;
    }
    .hidden-start2 {
      background-color: #e6a23c;
    }
    .hidden-start3 {
      background-color: #ca0e0e;
    }
    .el-tooltip {
      flex: 1;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 1;
      overflow: hidden;
    }
  }
  .hidden_bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    > div {
      padding: 4px 5px;
      background: #ebecf0;
      font-size: 14px;
      color: #272d45;
      display: flex;
    }
    > div:first-child > div:first-child {
      color: #b3b3b3;
      margin-right: 5px;
    }
    > div:nth-child(2) {
      > div:first-child {
        color: #272d45;
        margin-right: 10px;
      }
      > div:last-child {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        overflow: hidden;
      }
    }
  }
}
.dealForm {
  display: flex;
  flex-wrap: wrap;
  // .el-form-item {
  //   width: 50%;
  // }
  .el-input,
  .el-textarea {
    width: 320px;
  }
}
/deep/ .el-card {
  position: relative;
  overflow: initial;
}
.timestamp_btn {
  position: absolute;
  top: -30px;
  right: 0;
  display: flex;
  .timestamp_red {
    background: red;
    color: #fff;
    padding: 4px 8px;
    border-radius: 5px;
  }
  .timestamp_bule {
    margin-left: 10px;
    background: #5181f6;
    color: #fff;
    padding: 4px 8px;
    border-radius: 5px;
  }
}

/deep/ .hide .el-upload--picture-card {
  display: none;
}

.inspectionRecord {
  box-sizing: border-box;
  padding: 16px 20px;
  height: calc(100% - 32px);
  background: #fff;
}

.statistics {
  width: 100%;
  padding: 0 0 20px 0;
  font-weight: 600;
  font-size: 13px;

  .value {
    color: rgb(64, 158, 255);
    margin-right: 20px;
  }
}
.closeBtn {
  position: absolute;
  top: 1%;
  color: #fff;
  left: 98%;
  font-size: 20px;
  cursor: pointer;
}
// .title {
//   border-bottom: 1px solid rgba(220, 230, 253, 1);
//   color: @--color-primary;
//   padding-left: 24px;
//   font-size: 14px;

//   span {
//     position: relative;
//     padding: 16px 0 5px;
//     display: inline-block;

//     &::before {
//       content: '';
//       position: absolute;
//       bottom: -1px;
//       left: 0;
//       width: 100%;
//       height: 2px;
//       background-color: @--color-primary;
//       z-index: 2;
//     }
//   }
// }

// .right {
//   width: calc(100% - 222px);
//   margin-left: 10px;
// }

.flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex2 {
  display: flex;
  align-items: center;
}

.list_content {
  padding: 10px 0;
  height: calc(100% - 87px - 20px);
  position: relative;
}

.content_data {
  padding: 0 20px;
  box-sizing: border-box;
  height: 43px;
  line-height: 43px;
  cursor: pointer;
  position: relative;

  &.active {
    background-color: rgba(81, 129, 246, 0.1);

    &::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background-color: @--color-primary;
      border-radius: 2px;
    }
  }
}

.mapContainer {
  height: calc(100% - 133px - 40px);
  padding: 20px;
  position: relative;

  .infoDetail {
    font-size: 14px;
    margin-bottom: 24px;

    span:first-child {
      margin-right: 165px;
      display: inline-block;
    }

    .uploadBtn {
      float: right;
      margin-top: -25px;
    }
  }

  .mapBox {
    border: 1px solid rgba(151, 151, 151, 0.5);
    height: calc(100% - 40px);
    position: relative;
    overflow: auto;
  }

  .mapContent {
    position: relative;
    height: 480px;
    // left: 0;
    // top: 0;
    // z-index: 3;
  }

  // .mapContent2{
  //   position: relative;
  // }
  .personBox {
    position: absolute;
    transition: 0.2s all;

    img {
      cursor: pointer;
    }

    .redText {
      margin-left: 20px;
      display: inline-block;
    }
  }
}

.devDetail {
  p {
    margin-bottom: 10px;

    .primaryText {
      margin-right: 20px;
      display: inline-block;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }
}

.operateBox {
  // margin-bottom: 10px;
  position: absolute;
  right: 112px;
  top: -9px;

  img {
    margin-right: 20px;
    cursor: pointer;
  }
}

.operateList {
  font-size: 12px;

  li {
    cursor: pointer;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    justify-content: center;

    img {
      margin-right: 10px;
    }

    &.last {
      margin-bottom: 0;
    }
  }
}

.map {
  cursor: pointer;
}

// /deep/.el-select{
//   input{
//     height: auto !important;
//   }
// }

.el-cascader-node {
  max-width: 250px;
}

.detailBox {
  .grid-content1 {
    margin-bottom: 10px;
    display: flex;
    .label {
      width: 85px;
      text-align: right;
    }
    .content1-main {
      display: flex;
      flex-wrap: wrap;
      flex: 1;
      > .content1-box:not(:last-child) {
        margin-bottom: 16px;
      }
      .content1-box {
        width: 100%;
        position: relative;
        padding: 10px 16px;
        background-color: #fafafa;
        .pending {
          position: absolute;
          top: 10px;
          right: 10px;
          padding: 2px 10px;
          font-size: 12px;
          border-radius: 4px;
          border: 1px solid;
        }
        .trial1 {
          border-color: #dba71a;
          color: #dba71a;
        }
        .trial2 {
          border-color: #13b22f;
          background-color: #13b22f;
          color: white;
        }
        .trial3 {
          border-color: #ed2b29;
          background-color: #ed2b29;
          color: white;
        }
        > .content1-box_item:not(:last-child) {
          margin-bottom: 16px;
        }
        .content1-box_item {
          display: flex;
          align-items: center;
          font-size: 14px;

          > div:last-child {
            margin-left: 12px;
            color: #272d45;
          }
          > div:first-child {
            color: #a2a4af;
          }
        }
        .content1-box_header {
          display: flex;
          align-items: center;
          margin-bottom: 20px;
          > div:last-child {
            font-size: 14px;
            color: #a2a4af;
            > span {
              margin-left: 12px;
              color: #272d45;
            }
          }
          > div:first-child {
            margin-right: 50px;
            font-size: 14px;
            color: #a2a4af;
          }
        }
      }
    }
  }
  .grid-content {
    overflow: hidden;
    margin-bottom: 10px;

    .label {
      float: left;
      width: 85px;
      text-align: right;
    }

    .value {
      float: left;
      width: calc(80% - 80px);
      margin-left: 10px;
      // text-overflow: ellipsis;
      // overflow: hidden;
      // white-space: nowrap;
    }
    .view-detail {
        padding: 6px 10px;
        width: 180px;
        background-color: rgba(81, 129, 246, 0.1);
        border-radius: 3px;
        border: 1px solid #5181f6;
        display: flex;
        justify-content: space-between;
        align-items: center;
        > span:first-child {
          width: 50%;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
        }
        > span:last-child {
          font-size: 12px;
        }
      }
  }
}

.btn-box {
  height: 50px;
  margin-top: 30px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.tableStatus {
  width: 55px;
  height: 25px;
  display: block;
  background: red;
  color: #fff;
  line-height: 25px;
  border-radius: 5px;
  margin: auto;
  // position: absolute;
  // top: 18%;
  // left: 65%;
}
.radiusD {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 10px;
  margin-top: 3px;
  margin: 2px 0px;
}
.headerLeft {
  height: 30px;
  background: #ededed;
  font-size: 14px;
  color: #616266;
  line-height: 30px;
  padding: 0 10px;
  margin-bottom: 20px;
}
.back-btn {
  color: #5788f7;
  font-weight: 500;
  position: absolute;
  left: 89%;
  top: 1%;
  display: flex;
  align-items: center;
  cursor: pointer;
  span {
    margin-left: 3px;
  }
}
.textSty {
  width: 190px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
</style>
