<template>
    <div class="inspectionRecord">
      <div class="statistics">
        <span
          >{{ $t('message.quality.sum') }}:
          <span class="value">{{ statisticsValue.totalNum }}</span>
        </span>
        <span
          >{{ $t('message.quality.recordsOfTheFebruary') }}:
          <span class="value">{{ statisticsValue.investigateNum }}</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
        >
        <!-- 中建五局添加字段 -->
        <span v-if="COMPANY == 'zjwj'"
          >整改率:
          <span class="value"
            >{{ statisticsValue.rectificationRatio }}%</span
          ></span
        >
        <span v-if="COMPANY == 'zjwj'"
          >闭合率:
          <span class="value">{{ statisticsValue.completeRatio }}%</span></span
        >
      </div>
      <el-form
        :inline="true"
        :model="formInline"
        size="small"
        class="demo-form-inline"
      >
        <el-form-item :label="$t('message.quality.inspectionTime')">
          <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 :label="$t('message.quality.queryType')">
          <el-select
            style="width: 150px"
            v-model="formInline.recordType"
            :placeholder="$t('message.quality.queryType')"
          >
            <el-option :label="$t('message.quality.add')" value=""></el-option>
            <el-option label="排查记录" :value="2"></el-option>
            <el-option label="安全问题" :value="1"></el-option>
            <!-- <el-option
              :label="$t('message.quality.recordsOfTheFebruary')"
              :value="1"
            ></el-option>
            <el-option
              :label="$t('message.quality.hasBeenClosed')"
              :value="2"
            ></el-option>
            <el-option
              :label="$t('message.quality.NotClosed')"
              :value="3"
            ></el-option>
            <el-option
              :label="$t('message.quality.extendedPeriodNotClosed')"
              :value="4"
            ></el-option>
            <el-option
              :label="$t('message.quality.afterRectification')"
              :value="5"
            ></el-option>
            <el-option
              :label="$t('message.quality.toReview')"
              :value="6"
            ></el-option>
            <el-option
              :label="$t('message.quality.toCheck')"
              :value="7"
            ></el-option> -->
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('message.quality.problemLevel')">
          <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-option
                :label="$t('message.quality.noRectification')"
                :value="1"
              ></el-option> -->
            <!-- <el-option
                :label="$t('message.quality.afterRectification')"
                :value="2"
              ></el-option>
              <el-option
                :label="$t('message.quality.toReview')"
                :value="3"
              ></el-option>
              <el-option
                :label="$t('message.quality.toCheck')"
                :value="4"
              ></el-option>
              <el-option
                :label="$t('message.quality.qualified')"
                :value="5"
              ></el-option>
              <el-option
                :label="$t('message.quality.disqualification')"
                :value="6"
              ></el-option> -->
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('message.quality.urgencyDegree')">
          <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 label="区域" prop="regionId" v-if="COMPANY == 'zjwj'">
          <el-cascader
            style="width: 150px"
            v-model="formInline.regionId"
            clearable
            ref="formRegion1"
            :options="checkPointList"
            :props="checkPointProps"
            @change="changeRegion"
          ></el-cascader>
        </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-button type="primary" @click="addBtn">新增</el-button>
          <el-button type="primary" @click="exportData">导出</el-button>
        </el-form-item>
      </el-form>
      <el-table :data="tableData" class="tables" height="570" style="width: 100%">
        <el-table-column
          :label="$t('message.quality.numericalOrder')"
          type="index"
          width="55"
        >
        </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"
          :label="
            $t('message.quality.inspectionResult') +
            '/' +
            $t('message.quality.rectificationLimit')
          "
        >
          <template slot-scope="scope">
            <el-button type="text">
              {{
                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 class="tableStatus" v-show="scope.row.overTime == true"
              >超期</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.createEnterpriseName }}</div> -->
            <div>{{ scope.row.inspectTime }}</div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="dangerItemContent"
          :label="$t('message.quality.problemInformation')"
        >
        </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="notifyPersonName"
            :label="$t('message.quality.notifier')"
          >
          </el-table-column> -->
        <!--        //例行检查-->
        <!-- <el-table-column
            prop="routineCheckName"
            :label="$t('message.quality.routineCheck')"
          >
          </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 align="center" label="操作">
          <template slot-scope="scope">
            <div class="tableBtns" style="margin-left: 60px">
              <div
                @click="newShowDatadetails(scope.row, scope.$index)"
                class="operationText last"
              >
                <i
                  class="el-icon-tickets"
                  style="color: #8dacfa; font-size: 16px; margin-right: 2px"
                ></i>
                <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-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"
                v-show="type == 'add' || (type == 'detail' && recordType == 1)"
                >{{ $t('message.quality.qualityProblem') }}</el-radio-button
              >
              <el-radio-button
                v-if="COMPANY != 'zjwj'"
                :label="2"
                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')"
                  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="type == 'detail'"
                    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 = ''"
                  >
                  </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 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.checkOne')"
                  prop="verifyManId"
                >
                  <el-select
                    :disabled="type == 'detail'"
                    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="type == 'detail'"
                    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 = ''"
                  >
                  </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)"
                    :limit="5"
                    :file-list="fileList3"
                    accept="image/jpeg,image/jpg,image/png"
                    name="files"
                  >
                    <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
              :disabled="type == 'detail'"
              type="primary"
              icon="el-icon-circle-check"
              @click="submitAddRecordFrom"
              size="medium"
              >{{ $t('message.alarmValueSet.save') }}
            </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>
              <span
                v-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">{{ detailData.enterpriseName }}</span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <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'
                              : '',
                        }"
                      >
                        <span
                          class="radiusD"
                          :style="{
                            background:
                              detailData.status == 2
                                ? '#5181f6'
                                : detailData.status == 3
                                ? '#ff8c00'
                                : detailData.status == 4
                                ? '#a020f0'
                                : detailData.status == 5
                                ? '#21c28e'
                                : '',
                          }"
                        ></span>
                        <span>
                          {{
                            detailData.status == 2
                              ? '待整改'
                              : detailData.status == 3
                              ? '待复查'
                              : detailData.status == 4
                              ? '待核验'
                              : detailData.status == 5
                              ? '合格'
                              : ''
                          }}</span
                        >
                      </span>
                      <!-- <span
                        class="value"
                        style="font-weight: 500; color: #5181f6; cursor: pointer"
                      >
                        {{
                          detailData.status == 1
                            ? '无需整改'
                            : detailData.status == 2
                            ? '待整改'
                            : detailData.status == 3
                            ? '待复查'
                            : detailData.status == 4
                            ? '待核验'
                            : detailData.status == 5
                            ? '合格'
                            : detailData.status == 6
                            ? '不合格'
                            : detailData.status == ''
                            ? '合格'
                            : ''
                        }}</span
                      > -->
                    </div>
                  </el-col>
                  <el-col :span="12">
                    <div class="grid-content">
                      <span class="label">检查时间：</span>
                      <span class="value">{{ detailData.inspectTime }}</span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <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>
                  <el-col :span="12">
                    <div class="grid-content">
                      <span class="label">补充说明：</span>
                      <span class="value">
                        {{ detailData.dangerDesc }}
                      </span>
                    </div>
                  </el-col>
                </el-row>
                <div>
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <div class="grid-content">
                        <span class="label">分部工程：</span>
                        <span class="value">
                          {{ detailData.subsectionName }}
                        </span>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content">
                        <span class="label">分项工程：</span>
                        <span class="value">
                          {{ detailData.subentryName }}
                        </span>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20" v-show="detailData.recordType == 1">
                    <el-col :span="12">
                      <div class="grid-content">
                        <span class="label" style="margin-left: -14px"
                          >核验人：</span
                        >
                        <span class="value" style="margin-left: 25px">{{
                          detailData.verifyManName
                        }}</span>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content">
                        <span class="label">问题等级：</span>
                        <span class="value">{{
                          detailData.level == 1
                            ? '一级'
                            : detailData.level == 2
                            ? '二级'
                            : detailData.level == 3
                            ? '三级'
                            : '四级'
                        }}</span>
                      </div>
                    </el-col>
                  </el-row>
  
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <div class="grid-content">
                        <span class="label">检查部位：</span>
                        <span class="value" :title="detailData.regionName">{{
                          detailData.regionName
                        }}</span>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content">
                        <span class="label">事件描述：</span>
                        <span class="value">
                          {{ detailData.addedDescription }}
                        </span>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="12" v-show="detailData.recordType == 1">
                      <div class="grid-content">
                        <span class="label">现场整改：</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 :span="12" v-show="detailData.recordType == 1">
                      <div class="grid-content">
                        <span class="label">紧急程度：</span>
                        <span class="value">{{
                          detailData.urgentLevel == 1
                            ? '一般'
                            : detailData.urgentLevel == 2
                            ? '严重'
                            : '紧要'
                        }}</span>
                      </div>
                    </el-col>
                  </el-row>
                </div>
                <el-row :gutter="20">
                  <el-col :span="12" v-show="detailData.recordType == 1">
                    <div class="grid-content">
                      <span class="label">问题分类：</span>
                      <span class="value" :title="detailData.dangerItemContent">
                        {{ detailData.dangerItemContent }}
                      </span>
                    </div>
                  </el-col>
                  <el-col :span="12" v-show="detailData.recordType == 1">
                    <div class="grid-content">
                      <span class="label" style="margin-left: -14px"
                        >整改人：</span
                      >
                      <span class="value" style="margin-left: 25px">{{
                        detailData.changeName
                      }}</span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12" v-show="detailData.recordType == 1">
                    <div class="grid-content">
                      <span class="label">整改要求：</span>
                      <span class="value" :title="detailData.remark">
                        {{ detailData.remark }}
                      </span>
                    </div>
                  </el-col>
                  <el-col :span="12" v-show="detailData.recordType == 1">
                    <div class="grid-content">
                      <span class="label">整改时限：</span>
                      <span class="value">{{ detailData.changeLimitTime }}</span>
                    </div>
                  </el-col>
                </el-row>
  
                <el-row :gutter="20">
                  <el-col :span="12" v-show="detailData.recordType == 1">
                    <div class="grid-content">
                      <span class="label">问题描述：</span>
                      <span class="value">
                        {{ detailData.problemDescription }}
                      </span>
                    </div>
                  </el-col>
                  <el-col :span="12" v-show="detailData.recordType == 1">
                    <div class="grid-content">
                      <span class="label" style="margin-left: -14px"
                        >复查人：</span
                      >
                      <span class="value" style="margin-left: 25px">{{
                        detailData.reviewName
                      }}</span>
                    </div>
                  </el-col>
                </el-row>
  
                <el-row :gutter="20">
                  <el-col :span="12">
                    <div class="grid-content">
                      <span class="label">巡检楼层：</span>
                      <span class="value">
                        {{ detailData.floor }}
                      </span>
                    </div>
                  </el-col>
                  <el-col :span="12">
                    <div class="grid-content">
                      <span class="label" style="line-height: 25px"
                        >现场视频：</span
                      >
                      <span
                        style="color: #5181f6; cursor: pointer; margin-top: 3px"
                        class="value"
                        @click.stop="playerVideo(detailData.fileUrl)"
                      >
                        {{ videoName }}
                      </span>
                    </div>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12" v-show="detailData.recordType == 2">
                    <div class="grid-content">
                      <span class="label">排查分类：</span>
                      <span class="value" :title="detailData.dangerItemContent">{{
                        detailData.dangerItemContent
                      }}</span>
                    </div>
                  </el-col>
  
                  <el-col :span="12">
                    <div class="grid-content">
                      <span class="label">现场照片：</span>
                      <span class="value"  style="cursor: pointer;">
                        <el-image
                          v-for="(item, index) in parseImage2(
                            detailData.imageUrl
                          )"
                          :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-row>
                <el-row :gutter="20"> </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>
                      <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">
                        <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>
            </div>
          </vue-scroll>
        </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>
    </div>
  </template>
  <script>
  import {
    getInspectionRecordListApi,
    getQualityRegionListApi,
    getDangerTypeRecordApi,
    getSubcontractListApi,
    addRecordApi,
    getRoutineInspectApi,
    selectRectifyRecordListApi,
    addQualityRectifyRecordApi
  } from '@/assets/js/api/quality.js'
  import { getProjectChilderSystemUserListApi } from '@/assets/js/api/configManage.js'
  import { VueCropper } from 'vue-cropper'
  import {
    getSubdivisionProjectApi //所有分部分项工程， 以父子节点形式呈现
  } from '@/assets/js/api/quality'
  
  var VUE = null
  export default {
    components: {
      VueCropper
    },
  
    data() {
      return {
        replyData: {
          rectifyTime: '',
          fileUrl: '',
          additionalRemarks: '',
          qualityId: '',
        },//未整改回复
        dialogDetil: false,
        detailData: {},
        fileListRectification: [],
        userIdInfo: '',
        //-------
        listData: [],
        subListData: [],
        time: [],
        hideUpload: false, //
        formInline: {
          inspectEndTime: '',
          inspectStartTime: '',
          recordType: '',
          level: '',
          status: '',
          urgentLevel: '',
          regionId: '',
        },
        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
        },
        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: ''
      }
    },
    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.onSubmit()
      this.COMPANY = COMPANY
      this.getProgressListData()
      this.getPositionList()
  
    },
    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
            }
          }
        }
      }
    },
    mounted() { },
    methods: {
      //关闭视频
      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.dialogDetil = true
        this.detailData = item
        this.replyData = {
          rectifyTime: '',
          fileUrl: '',
          additionalRemarks: '',
        }
        this.fileListRectification = []
      },
      //提交整改回复
      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 = ""
        }
        this.replyData.qualityId = valId
        this.replyData.createUser = this.userIdInfo
        console.log('整改提交的表单数据：：：', this.replyData);
        addQualityRectifyRecordApi(this.replyData).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) => {
          arr[index] = this.$store.state.FILEURL + element
          let result = arr[index].substring(0, arr[index].indexOf('*'));
          arr[index] = 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 {
          window.location.href =
            this.$http.defaults.baseURL +
            'xmgl/download/exporExcelQualityInspectionRecord?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
        }
  
      },
      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 (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 = ''
        }
      },
      changeRegion(val) {
        // console.log(val,this.checkPointList,this.$refs['formRegion1'].getCheckedNodes()[0])
        if (this.recordType == 1) {
          let pathLabels =
            this.$refs['formRegion1'].getCheckedNodes()[0].pathLabels
          let data = this.$refs['formRegion1'].getCheckedNodes()[0].data
          // 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.regionName = text
          // console.log(data.intendanceIds.split(','))
          // console.log(text)
          if (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);
        } 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.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: '',
        }
        this.pageNo = 1
        this.pageSize = 10
        this.onSubmit()
      },
  
      //查询按钮  分页列表查询
      onSubmit() {
        let data = this.formInline
        data.projectSn = this.projectSn
        data.pageNo = this.pageNo
        data.pageSize = this.pageSize
        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
        }
        getQualityRegionListApi(data).then((res) => {
          console.log('res=================', res);
          if (res.code == 200) {
            this.checkPointList = res.result
          }
        })
      },
      // 例行检查 列表
      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);
              }
            })
          }
        })
      },
  
      //获取去整改人 通知人 检查人 核查人下拉
      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
        }
        getProjectChilderSystemUserListApi(data).then((res) => {
          if (res.code == 200) {
            this.crewUpdateList = res.result
          }
        })
      },
      //获取问题描述
      handleChange(value) {
  
        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
  
            this.addForm1.dangerItemContent = pathLabels[0].pathLabels
              .map((item) => {
                console.log(pathLabels)
                console.log(item, 1632)
                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 = ''
        }
      },
  
      //获取分包单位
      getEnterprise(type) {
        if (type != 1) {
          this.showEnterpriseDialog = true
        }
        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
          }
        })
      },
      //切换分包公司类型
      changeSubcontractType(val) {
        this.subcontractType = val
        this.getEnterprise(1)
      },
  
      //选中的分包公司
      checkedSubcontractList(val) {
        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();
        this.showEnterpriseDialog = false
      },
  
      beforeUpload(file, type) {
        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
        }
      },
  
      //上传成功
      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(',')
            } 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
          }
        })
      },
  
      handleSizeChange(val) {
        this.pageSize = val
        this.onSubmit()
      },
      handleCurrentChange(val) {
        this.pageNo = val
        this.onSubmit()
      },
  
      close() {
        // this.mapUrl = ''
        this.fileList1 = []
        this.fileList2 = []
        this.fileList3 = []
        this.fileList4 = []
        this.$refs.addForm1.resetFields() //清除所有验证
        this.$refs.addForm2.resetFields() //清除所有验证
        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: '',
          }
        }
      },
      submit() { },
  
      handleExceed() { }
    }
  }
  </script>
  <style lang="less" scoped>
  /deep/ .hide .el-upload--picture-card {
    display: none;
  }
  
  .inspectionRecord {
    box-sizing: border-box;
    padding: 16px 20px;
    height: 100%;
    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-content {
      overflow: hidden;
      margin-bottom: 10px;
  
      .label {
        float: left;
        width: 80px;
        text-align: right;
      }
  
      .value {
        float: left;
        width: calc(80% - 80px);
        margin-left: 10px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
      }
    }
  }
  
  .btn-box {
    height: 50px;
    margin-top: 30px;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  .tableStatus {
    width: 55px;
    height: 25px;
    display: inline-block;
    background: red;
    color: #fff;
    line-height: 25px;
    border-radius: 5px;
    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;
  }
  
  .textSty {
    width: 190px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  </style>
  