<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item :label="$t('装置名称')" prop="plantCode">
        <el-input
          v-model="queryParams.plantCode"
          :placeholder="$t('请输入') + $t('装置名称')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('单元名称')" prop="unitCode">
        <el-input
          v-model="queryParams.unitCode"
          :placeholder="$t('请输入') + $t('单元名称')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('单位内编号')" prop="tagno">
        <el-input
          v-model="queryParams.tagno"
          :placeholder="$t('请输入') + $t('单位内编号')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item :label="$t('测厚部位CML')" prop="position">
        <el-input
          v-model="queryParams.position"
          :placeholder="$t('请输入') + $t('测厚部位CML')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('记录人')" prop="recorder">
        <el-input
          v-model="queryParams.recorder"
          :placeholder="$t('请输入') + $t('记录人')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('记录时间')" prop="recorderDate">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.recorderDate"
          type="date"
          value-format="yyyy-MM-dd"
          :placeholder="$t('请选择') + $t('记录时间')">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="$t('设备/管线名称')" prop="equipmentName">
        <el-input
          v-model="queryParams.equipmentName"
          :placeholder="$t('请输入') + $t('设备/管线名称')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('材质')" prop="material">
        <el-input
          v-model="queryParams.material"
          :placeholder="$t('请输入') + $t('材质')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('腐蚀裕度(mm)')" prop="corAllowance">
        <el-input
          v-model="queryParams.corAllowance"
          :placeholder="$t('请输入') + $t('腐蚀裕度(mm)')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('原始壁厚(mm)')" prop="originalThickness">
        <el-input
          v-model="queryParams.originalThickness"
          :placeholder="$t('请输入') + $t('原始壁厚(mm)')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('介质')" prop="medium">
        <el-input
          v-model="queryParams.medium"
          :placeholder="$t('请输入') + $t('介质')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('压力(MPa)')" prop="pressure">
        <el-input
          v-model="queryParams.pressure"
          :placeholder="$t('请输入') + $t('压力(MPa)')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('规格')" prop="specification">
        <el-input
          v-model="queryParams.specification"
          :placeholder="$t('请输入') + $t('规格')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('流速(m/s)')" prop="flowRate">
        <el-input
          v-model="queryParams.flowRate"
          :placeholder="$t('请输入') + $t('流速(m/s)')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('温度(℃)')" prop="temperature">
        <el-input
          v-model="queryParams.temperature"
          :placeholder="$t('请输入') + $t('温度(℃)')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('公称壁厚(mm)')" prop="nominalTickness">
        <el-input
          v-model="queryParams.nominalTickness"
          :placeholder="$t('请输入') + $t('公称壁厚(mm)')"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['sems:thickness:add']"
        >{{ $t('新增') }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['sems:thickness:edit']"
        >{{ $t('修改') }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['sems:thickness:remove']"
        >{{ $t('删除') }}</el-button>
      </el-col>

      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['sems:thickness:export']"
        >{{ $t('导出') }}</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['sems:thickness:edit']"
        >{{$t('导入更新数据')}}
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>


    <el-table v-loading="loading" :data="thicknessList" @selection-change="handleSelectionChange" :cell-style="tableCellStyle" :height="clientHeight" border>
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column :label="$t('装置名称')" align="center" prop="plantCode" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('单元名称')" align="center" prop="unitCode" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('单位内编号')" align="center" prop="tagno" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('状态')" align="center" prop="status" :formatter="statusFormat" />
      <el-table-column :label="$t('测厚部位CML')" align="center" prop="position" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('检测编号')" align="center" prop="measureNo" :show-overflow-tooltip="true"/>

      <!--      <el-table-column label="记录人" align="center" prop="recorder" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="记录时间" align="center" prop="recorderDate" width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.recorderDate, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column :label="$t('设备/管线名称')" align="center" prop="equipmentName" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('材质')" align="center" prop="material" :show-overflow-tooltip="true"/>
<!--      <el-table-column label="腐蚀裕度" align="center" prop="corAllowance" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="原始壁厚" align="center" prop="originalThickness" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="介质" align="center" prop="medium" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="压力" align="center" prop="pressure" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="规格" align="center" prop="specification" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="流速" align="center" prop="flowRate" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="温度" align="center" prop="temperature" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="腐蚀类型" align="center" prop="corrosionType" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="腐蚀照片" align="center" prop="photo" :show-overflow-tooltip="true"/>-->
<!--      <el-table-column label="原因分析" align="center" prop="analysis" :show-overflow-tooltip="true"/>-->
      <el-table-column :label="$t('公称壁厚(mm)')" align="center" prop="nominalTickness" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('最小允许壁厚(mm)')" align="center" prop="thicknessMin" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('短期腐蚀速率(mm/year)')" align="center" prop="stCorrosion" :show-overflow-tooltip="true"/>
      <el-table-column :label="$t('长期腐蚀速率(mm/year)')" align="center" prop="ltCorrosion" :show-overflow-tooltip="true"/>

      <el-table-column
        prop="firstMeasureDate"
        header-align="center"
        align="center"
        :label="$t('首次测厚日期')">
      </el-table-column>
      <el-table-column
        prop="newMeasureDate"
        header-align="center"
        align="center"
        :label="$t('最近测厚日期')">
      </el-table-column>
<!--      <el-table-column
        prop="measureCycle"
        header-align="center"
        align="center"
        :label="$t('测厚周期(year)')">
      </el-table-column>
      <el-table-column
        prop="nextMeasureDate"
        header-align="center"
        align="center"
        :label="$t('下次测厚日期')">
      </el-table-column>-->
      <el-table-column :label="$t('预估剩余寿命(year)')" align="center" prop="estRemain" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <span v-if="scope.row.estRemain"> {{ scope.row.estRemain }}</span>
          <span v-else-if="!scope.row.thicknessMin">缺少最小允许壁厚</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="nextWarnDate"
        header-align="center"
        align="center"
        :label="$t('下次测厚日期')">
      </el-table-column>
      <el-table-column :label="$t('检测方法')" align="center" prop="inspectionMethod" :formatter="inspectionMethodFormat" />
      <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="handleView(scope.row)">{{ $t('查看') }}</el-button>
          <el-button type="text" size="small" @click="recordHandle(scope.row)">{{ $t('测厚记录') }}</el-button>
          <el-button type="text" size="small" @click="downloadHandle(scope.row)">{{ $t('下载报告') }}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <form ref="downloadForm" :action="downloadAction" target="FORMSUBMIT">
      <input name="id" v-model="downloadForm.id"  hidden  />
    </form>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改定点测厚对话框 -->
    <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="1200" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row>
          <el-col :span="8">
          <el-form-item :label="$t('装置名称')" prop="plantCode">
            <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置')" filterable clearable size="small">
              <el-option
                v-for="dict in plantOptions"
                :key="dict.name"
                :label="dict.name"
                :value="dict.name"
              />
            </el-select>
          </el-form-item>
          </el-col>
          <el-col :span="8">
          <el-form-item :label="$t('单元名称')" prop="unitCode">
            <el-input v-model="form.unitCode" :placeholder="$t('请输入') + $t('单元名称')" />
          </el-form-item>
          </el-col>
          <el-col :span="8">
          <el-form-item :label="$t('单位内编号')" prop="tagno">
            <el-input v-model="form.tagno" :placeholder="$t('请输入') + $t('单位内编号')" />
          </el-form-item>
          </el-col>
      </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item :label="$t('测厚部位CML')" prop="position">
              <el-input v-model="form.position" :placeholder="$t('请输入') + $t('测厚部位CML')" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="$t('记录人')" prop="recorder">
              <el-input v-model="form.recorder" :placeholder="$t('请输入') + $t('记录人')" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="$t('记录时间')" prop="recorderDate">
              <el-date-picker clearable size="small" style="width: 119.85px"
                              v-model="form.recorderDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              :placeholder="$t('请选择') + $t('记录时间')">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
        <el-form-item :label="$t('设备/管线名称')" prop="equipmentName">
          <el-input v-model="form.equipmentName" :placeholder="$t('请输入') + $t('设备/管线名称')" />
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item :label="$t('材质')" prop="material">
          <el-input v-model="form.material" :placeholder="$t('请输入') + $t('材质')" />
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item :label="$t('腐蚀裕度(mm)')" prop="corAllowance">
          <el-input v-model="form.corAllowance" :placeholder="$t('请输入') + $t('腐蚀裕度(mm)')" />
        </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
        <el-form-item :label="$t('原始壁厚(mm)')" prop="originalThickness">
          <el-input v-model="form.originalThickness" :placeholder="$t('请输入') + $t('原始壁厚(mm)')" />
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item :label="$t('介质')" prop="medium">
          <el-input v-model="form.medium" :placeholder="$t('请输入') + $t('介质')" />
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item :label="$t('压力(MPa)')" prop="pressure">
          <el-input v-model="form.pressure" :placeholder="$t('请输入') + $t('压力(MPa)')" />
        </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
        <el-form-item :label="$t('规格')" prop="specification">
          <el-input v-model="form.specification" :placeholder="$t('请输入') + $t('规格')" />
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item :label="$t('流速(m/s)')" prop="flowRate">
          <el-input v-model="form.flowRate" :placeholder="$t('请输入') + $t('流速(m/s)')" />
        </el-form-item>
          </el-col>
          <el-col :span="8">
        <el-form-item :label="$t('温度(℃)')" prop="temperature">
          <el-input v-model="form.temperature" :placeholder="$t('请输入') + $t('温度(℃)')" />
        </el-form-item>
          </el-col>
        </el-row>

        <el-form-item :label="$t('状态')">
          <el-radio-group v-model="form.status">
            <el-radio
              v-for="dict in statusOptions"
              :key="dict.dictValue"
              :label="parseInt(dict.dictValue)"
            >{{dict.dictLabel}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item :label="$t('腐蚀位置')"  prop="locationUrl">
          <el-upload
            :action="locationpic.url"
            :headers="locationpic.headers"
            :file-list="locationList"
            :limit="3"
            :on-success="handleAvatarSuccess"
            :on-exceed="handleExceed"
            :before-upload="beforeAvatarUpload"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-dialogDrag :visible.sync="dialogVisible" append-to-body>
            <img width="100%" :src="dialogImageUrl" alt="">
          </el-dialog>
        </el-form-item>
        <el-form-item :label="$t('检测方法')">
          <el-checkbox-group v-model="form.inspectionMethod">
            <el-checkbox
              v-for="dict in inspectionMethodOptions"
              :key="dict.dictValue"
              :label="dict.dictValue">
              {{dict.dictLabel}}
            </el-checkbox>
          </el-checkbox-group>
          <el-input :placeholder="$t('请输入') + $t('其他')+ $t('空格')+ $t('检测方法')" class="otherMethod" v-if="form.inspectionMethod == 5" v-model="form.otherContent"></el-input>
        </el-form-item>
        <el-form-item :label="$t('腐蚀照片')"  prop="photo">
          <el-upload
            :action="photo.url"
            :headers="photo.headers"
            :file-list="photoList"
            :limit="3"
            :on-success="handleAvatarSuccess2"
            :on-exceed="handleExceed"
            :before-upload="beforeAvatarUpload"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove2">
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-dialogDrag :visible.sync="dialogVisible" append-to-body>
            <img width="100%" :src="dialogImageUrl" alt="">
          </el-dialog>
        </el-form-item>
        <el-form-item :label="$t('原因分析')" prop="analysis">
          <el-input v-model="form.analysis" :placeholder="$t('请输入') + $t('原因分析')" />
        </el-form-item>
        <el-row>
          <el-col :span="8">
        <el-form-item :label="$t('公称壁厚(mm)')" prop="nominalTickness">
          <el-input v-model="form.nominalTickness" :placeholder="$t('请输入') + $t('名义壁厚(mm)')" />
        </el-form-item>
            <el-form-item :label="$t('原因分析附件')" prop="analysisUrl">
              <el-upload
                ref="analysis"
                :limit="1"
                :headers="analysis.headers"
                :action="analysis.url"
                :disabled="analysis.isUploading"
                :on-progress="handleFileDocProgress"
                :on-success="handleFileDocSuccess"
                :auto-upload="true"
                drag
              >
                <i class="el-icon-upload"></i>
                <div class="el-upload__text">
                  {{ $t('将文件拖到此处，或') }}
                  <em>{{ $t('点击上传') }}</em>
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="16">
        <el-form-item :label="$t('最小允许壁厚(mm)')" label-width="150px" prop="thicknessMin">
          <el-input v-model="form.thicknessMin" :placeholder="$t('请输入') + $t('最小允许壁厚(mm)')" />
        </el-form-item>
          </el-col>
        </el-row>
        <el-form-item :label="$t('检测编号')" prop="measureNo">
          <el-input v-model="form.measureNo" :placeholder="$t('请输入') + $t('检测编号')" />
        </el-form-item>

      <el-row>
        <el-col :span="8">
        <el-form-item :label="$t('短期腐蚀速率(mm/year)')" label-width="180px" prop="stCorrosion">
          <el-input v-model="form.stCorrosion" :placeholder="$t('请输入') + $t('短期腐蚀速率(mm/year)')" />
        </el-form-item>
        </el-col>
        <el-col :span="8">
        <el-form-item :label="$t('长期腐蚀速率(mm/year)')" label-width="180px" prop="ltCorrosion">
          <el-input v-model="form.ltCorrosion" :placeholder="$t('请输入') + $t('长期腐蚀速率(mm/year)')" />
        </el-form-item>
        </el-col>
        <el-col :span="8">
        <el-form-item :label="$t('预估剩余寿命(year)')" label-width="180px" prop="estRemain">
          <el-input v-model="form.estRemain" :placeholder="$t('请输入') + $t('预估剩余寿命(year)')" />
        </el-form-item>
        </el-col>
      </el-row>
        <el-row>
        <el-form-item :label="$t('治理方法及依据')" prop="methodCause">
          <el-input v-model="form.methodCause" :placeholder="$t('请输入') + $t('治理方法及依据')" />
        </el-form-item>
        </el-row>
        <el-form-item :label="$t('效果跟踪')" prop="effectTracing">
          <el-input v-model="form.effectTracing" :placeholder="$t('请输入') + $t('效果跟踪')" />
        </el-form-item>
        <el-row>
          <el-col :span="8">
        <el-form-item :label="$t('提出人')" prop="raiser">
          <el-input v-model="form.raiser" :placeholder="$t('请输入') + $t('提出人')" />
        </el-form-item>
          </el-col>
          <el-col :span="16">
        <el-form-item :label="$t('提出时间')" prop="raiserDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.raiserDate"
            type="date"
            value-format="yyyy-MM-dd"
            :placeholder="$t('请选择') + $t('提出时间')">
          </el-date-picker>
        </el-form-item>
          </el-col>
        </el-row>
        <el-form-item :label="$t('下次测厚日期')" prop="raiserDate">
          <el-date-picker clearable size="small" style="width: 200px"
                          v-model="form.nextWarnDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          :placeholder="$t('请选择') + $t('下次测厚日期')">
          </el-date-picker>
        </el-form-item>
        <el-form-item :label="$t('备注')" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" :placeholder="$t('请输入') + $t('内容')" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
        <el-button @click="cancel">{{ $t('取 消') }}</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :title="$t('查看')"
      :close-on-click-modal="false"
      width="1200px"
      :visible.sync="visible">
      <el-descriptions class="margin-top" :column="3" size="medium" border>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('装置名称') }}
          </template>
          {{ dataForm.plantCode }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('单元名称') }}
          </template>
          {{ dataForm.unitCode }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('单位内编号') }}
          </template>
          {{ dataForm.tagno }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('测厚部位CML') }}
          </template>
          {{ dataForm.position }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('记录人') }}
          </template>
          {{ dataForm.recorder }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('记录时间') }}
          </template>
          {{ dataForm.recorderDate }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('设备/管线名称') }}
          </template>
          {{ dataForm.equipmentName }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('材质') }}
          </template>
          {{ dataForm.material }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('腐蚀裕度(mm)') }}
          </template>
          {{ dataForm.corAllowance }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('原始壁厚(mm)') }}
          </template>
          {{ dataForm.originalThickness }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('介质') }}
          </template>
          {{ dataForm.medium }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('压力(MPa)') }}
          </template>
          {{ dataForm.pressure }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('规格') }}
          </template>
          {{ dataForm.specification }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('流速(m/s)') }}
          </template>
          {{ dataForm.flowRate }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            {{ $t('温度(℃)') }}
          </template>
          {{ dataForm.temperature }}
        </el-descriptions-item>

        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('腐蚀位置') }}
          </template>
          <el-upload
            :action="locationpic.url"
            :headers="locationpic.headers"
            :file-list="locationList"
            :limit="3"
            :on-success="handleAvatarSuccess"
            :on-exceed="handleExceed"
            :before-upload="beforeAvatarUpload"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-descriptions-item>
        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('检测方法') }}
          </template>
          <el-checkbox-group v-model="dataForm.inspectionMethod">
            <el-checkbox
              v-for="dict in inspectionMethodOptions"
              :key="dict.dictValue"
              :label="dict.dictValue">
              {{dict.dictLabel}}
            </el-checkbox>
          </el-checkbox-group>
          {{ dataForm.otherContent }}
        </el-descriptions-item>
        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('腐蚀照片') }}
          </template>
          <el-upload
            :action="photo.url"
            :headers="photo.headers"
            :file-list="photoList"
            :limit="3"
            :on-success="handleAvatarSuccess2"
            :on-exceed="handleExceed"
            :before-upload="beforeAvatarUpload"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove2">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-descriptions-item>
        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('原因分析') }}
          </template>
          {{ dataForm.analysis }}
        </el-descriptions-item>
        <el-descriptions-item span="1">
          <template slot="label">
            {{ $t('公称壁厚(mm)') }}
          </template>
          {{ dataForm.nominalTickness }}
        </el-descriptions-item>
        <el-descriptions-item span="2">
          <template slot="label">
            {{ $t('最小允许壁厚(mm)') }}
          </template>
          {{ dataForm.thicknessMin }}
        </el-descriptions-item>
        <el-descriptions-item span="1">
          <template slot="label">
            {{ $t('短期腐蚀速率(mm/year)') }}
          </template>
          {{ dataForm.stCorrosion }}
        </el-descriptions-item>
        <el-descriptions-item span="1">
          <template slot="label">
            {{ $t('长期腐蚀速率(mm/year)') }}
          </template>
          {{ dataForm.ltCorrosion }}
        </el-descriptions-item>
        <el-descriptions-item span="1">
          <template slot="label">
            {{ $t('预估剩余寿命(year)') }}
          </template>
          {{ dataForm.estRemain }}
        </el-descriptions-item>
        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('治理方法及依据') }}
          </template>
          {{ dataForm.methodCause }}
        </el-descriptions-item>
        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('效果跟踪') }}
          </template>
          {{ dataForm.effectTracing }}
        </el-descriptions-item>
        <el-descriptions-item span="1">
          <template slot="label">
            {{ $t('提出人') }}
          </template>
          {{ dataForm.raiser }}
        </el-descriptions-item>
        <el-descriptions-item span="2">
          <template slot="label">
            {{ $t('提出时间') }}
          </template>
          {{ dataForm.raiserDate }}
        </el-descriptions-item>
        <el-descriptions-item span="3">
          <template slot="label">
            {{ $t('趋势图') }}
          </template>
          <img :src="dataForm.recordUrl" width="900px" />
        </el-descriptions-item>
      </el-descriptions>
          <template slot="label">
            {{ $t('测厚数据') }}
          </template>
         <template>
           <el-table
             :data="dataList"
             border
             style="width: 100%;">
             <el-table-column
               prop="measureValue"
               header-align="center"
               align="center"
               :label="$t('实测记录')">
               <template slot-scope="scope">
                 <el-input v-if="scope.row.isEdit" v-model="scope.row.measureValue"></el-input>
                 <span v-else>{{scope.row.measureValue}}</span>
               </template>
             </el-table-column>
             <el-table-column
               prop="measureDate"
               header-align="center"
               align="center"
               :label="$t('日期')">
               <template slot-scope="scope">
                 <el-date-picker
                   v-if="scope.row.isEdit"
                   v-model="scope.row.measureDate"
                   type="date"
                   value-format="yyyy-MM-dd"
                   :placeholder="$t('日期')">
                 </el-date-picker>
                 <span v-else>{{scope.row.measureDate}}</span>
               </template>
             </el-table-column>
           </el-table>
         </template>


      <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">{{ $t('取消') }}</el-button>
    </span>
    </el-dialog>
    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" slot="tip">
          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">提示：仅允许导入“xls”或“xlsx”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm"
                   v-loading.fullscreen.lock="fullscreenLoading">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
      <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
        <input name="type" :value="upload.type" hidden/>
      </form>
    </el-dialog>
    <record v-if="recordVisible" ref="record" @refreshDataList="getList" :showFlag="showFlag" @closeChildDialog="closeChildDialog"></record>
  </div>
</template>

<script>
import { listThickness, getThickness, delThickness, addThickness, updateThickness, exportThickness, importTemplate} from "@/api/sems/thickness";
import { treeselect } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Editor from '@/components/Editor';
import request from "@/utils/request";
import record from './record'
import {listMeasurerecord} from "@/api/sems/measure-record";
import {listPlant, mylistPlant} from "@/api/system/plant";

export default {
  name: "Thickness",
  components: { Treeselect ,record },
  // components: { Editor },
  data() {
    return {
      fullscreenLoading: false,
      recordVisible: false,
      showFlag: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 定点测厚表格数据
      thicknessList: [],
      dataList: [],
      // 弹出层标题
      title: "",
      // 部门树选项
      deptOptions: undefined,
      clientHeight:300,
      // 是否显示弹出层
      open: false,
      visible: false,
      // 检测方法字典
      inspectionMethodOptions: [],
      statusOptions:[],
      plantOptions: [],
        // 用户导入参数
        upload: {
            //模板下载路由
            downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
            //模板下载区分
            type: "thickness",
            // 是否显示弹出层（用户导入）
            open: false,
            // 弹出层标题（用户导入）
            title: "",
            // 是否禁用上传
            isUploading: false,
            // 是否更新已经存在的用户数据
            updateSupport: 0,
            // 设置上传的请求头部
            headers: { Authorization: "Bearer " + getToken() },
            // 上传的地址
            url: process.env.VUE_APP_BASE_API + "/sems/measure-record/importForUpdate"
        },
      downloadForm: {
        id: '',
        key: ''
      },
      downloadAction: process.env.VUE_APP_BASE_API +'/sems/thickness/measure/exportPDF',
      locationpic: {
        imageUrl: '',
        fileList: [],
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/sems/thickness/uploadFile",
      },
      photo: {
        imageUrl: '',
        fileList: [],
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/sems/thickness/uploadFile",
      },
      analysis: {
        file: "",
        // 是否显示弹出层（报告附件）
        open: false,
        // 弹出层标题（报告附件）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 报告附件上传位置编号
        ids: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/sems/thickness/uploadFile",
        commonfileList: null,
        pType: 'traning',
        pId: null
      },
      locationList: [],
      photoList: [],
      dialogImageUrl: '',
      dialogVisible: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        plantCode: null,
        unitCode: null,
        tagno: null,
        status: null,
        remarks: null,
        position: null,
        recorder: null,
        recorderDate: null,
        equipmentName: null,
        material: null,
        corAllowance: null,
        originalThickness: null,
        medium: null,
        pressure: null,
        specification: null,
        flowRate: null,
        temperature: null,
        corrosionType: null,
        inspectionMethod: null,
        photo: null,
        analysis: null,
        nominalTickness: null,
        thicknessMin: null,
        stCorrosion: null,
        ltCorrosion: null,
        estRemain: null,
        methodCause: null,
        effectTracing: null,
        raiser: null,
        raiserDate: null,
        locationUrl: null,
        analysisUrl: null,
        measureCycle: null,
        recordUrl: null,
        otherContent: null
      }, // 查询参数
      recordParams: {
        pageNum: 1,
        pageSize: 99,

      },
      // 表单参数
      form: {},
      dataForm: {},
      // 表单校验
      rules: {
        plantCode: [
          { required: true, message: this.$t('装置名称')+this.$t('不能为空'), trigger: "blur" }
        ],
        unitCode: [
          { required: true, message: this.$t('单元名称')+this.$t('不能为空'), trigger: "blur" }
        ],
        position: [
          { required: true, message: this.$t('测厚部位CML')+this.$t('不能为空'), trigger: "blur" }
        ],
        recorder: [
          { required: true, message: this.$t('记录人')+this.$t('不能为空'), trigger: "blur" }
        ],
        recorderDate: [
          { required: true, message: this.$t('记录时间')+this.$t('不能为空'), trigger: "blur" }
        ],
        equipmentName: [
          { required: true, message: this.$t('设备/管线名称')+this.$t('不能为空'), trigger: "blur" }
        ],
        material: [
          { required: true, message: this.$t('材质')+this.$t('不能为空'), trigger: "blur" }
        ],
        corAllowance: [
          { required: true, message: this.$t('腐蚀裕度(mm)')+this.$t('不能为空'), trigger: "blur" }
        ],
        originalThickness: [
          { required: true, message: this.$t('原始壁厚(mm)')+this.$t('不能为空'), trigger: "blur" }
        ],
        medium: [
          { required: true, message: this.$t('介质')+this.$t('不能为空'), trigger: "blur" }
        ],
        pressure: [
          { required: true, message: this.$t('压力')+this.$t('不能为空'), trigger: "blur" }
        ],
        specification: [
          { required: true, message: this.$t('规格')+this.$t('不能为空'), trigger: "blur" }
        ],
/*        flowRate: [
          { required: true, message: this.$t('流速(m/s)')+this.$t('不能为空'), trigger: "blur" }
        ],*/
        temperature: [
          { required: true, message: this.$t('温度(℃)')+this.$t('不能为空'), trigger: "blur" }
        ],
        corrosionType: [
          { required: true, message: this.$t('腐蚀类型')+this.$t('不能为空'), trigger: "change" }
        ],
        inspectionMethod: [
          { required: true, message: this.$t('检测方法')+this.$t('不能为空'), trigger: "blur" }
        ],
        /*analysis: [
          { required: true, message: "原因分析不能为空", trigger: "blur" }
        ],*/
        nominalTickness: [
          { required: true, message: this.$t('公称壁厚(mm)')+this.$t('不能为空'), trigger: "blur" }
        ],
        // thicknessMin: [
        //   { required: true, message: this.$t('最小允许壁厚(mm)')+this.$t('不能为空'), trigger: "blur" }
        // ],
        /*stCorrosion: [
          { required: true, message: "短期腐蚀速率不能为空", trigger: "blur" }
        ],
        ltCorrosion: [
          { required: true, message: "长期腐蚀速率不能为空", trigger: "blur" }
        ],
        estRemain: [
          { required: true, message: "预估剩余寿命不能为空", trigger: "blur" }
        ],*/
        /*methodCause: [
          { required: true, message: "治理方法及依据不能为空", trigger: "blur" }
        ],
        effectTracing: [
          { required: true, message: "效果跟踪不能为空", trigger: "blur" }
        ],*/
        /*raiser: [
          { required: true, message: "提出人不能为空", trigger: "blur" }
        ],
        raiserDate: [
          { required: true, message: "提出时间不能为空", trigger: "blur" }
        ],
        locationUrl: [
          { required: true, message: "腐蚀位置不能为空", trigger: "blur" }
        ],
        measureCycle: [
          { required: true, message: "测厚周期不能为空", trigger: "blur" }
        ],
        otherContent: [
          { required: true, message: "其他检测方法内容不能为空", trigger: "blur" }
        ]*/
      }
    };
  },
  watch: {
        // 根据名称筛选部门树
        deptName(val) {
            this.$refs.tree.filter(val);
        }
   },
  created() {
      //设置表格高度对应屏幕高度
      this.$nextTick(() => {
          this.clientHeight = document.body.clientHeight -250
      })
    this.getList();
    this.getTreeselect();
    this.getDicts("spec_measure_status").then(response => {
      this.statusOptions = response.data;
    });
    this.getDicts("spec_measure_method").then(response => {
      this.inspectionMethodOptions = response.data;
    });
    let plantParams = {
      pType: 1
    }
    mylistPlant(plantParams).then(response => {
      this.plantOptions = response.data;
    });
  },
  methods: {
    /** 查询定点测厚列表 */
    getList() {
      this.loading = true;
      listThickness(this.queryParams).then(response => {
        this.thicknessList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
     /** 查询部门下拉树结构 */
     getTreeselect() {
          treeselect().then(response => {
              this.deptOptions = response.data;
          });
     },
    // 状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    // 检测方法字典翻译
    inspectionMethodFormat(row, column) {
      return this.selectDictLabels(this.inspectionMethodOptions, row.inspectionMethod);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        plantCode: null,
        unitCode: null,
        tagno: null,
        status: 0,
        createdate: null,
        updaterCode: null,
        updatedate: null,
        deptId: null,
        remarks: null,
        position: null,
        recorder: null,
        recorderDate: null,
        equipmentName: null,
        material: null,
        corAllowance: null,
        originalThickness: null,
        medium: null,
        pressure: null,
        specification: null,
        flowRate: null,
        temperature: null,
        corrosionType: null,
        inspectionMethod: [],
        photo: null,
        analysis: null,
        nominalTickness: null,
        thicknessMin: null,
        stCorrosion: null,
        ltCorrosion: null,
        estRemain: null,
        methodCause: null,
        effectTracing: null,
        raiser: null,
        raiserDate: null,
        delFlag: null,
        locationUrl: null,
        analysisUrl: null,
        measureCycle: null,
        recordUrl: null,
        otherContent: null,
        measureNo: null,
        nextWarnDate: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = this.$t('添加') + this.$t('定点测厚');
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getThickness(id).then(response => {
        this.form = response.data;
        this.form.inspectionMethod = this.form.inspectionMethod.split(",");
        this.open = true;
        this.title = this.$t('修改') + this.$t('定点测厚');
        if (this.form.photo!= null){
          this.photoList =[]
          let fileList = this.form.photo.split(",")
          for (let i = 0; i < fileList.length; i++) {
            let item = {url: process.env.VUE_APP_BASE_API +fileList[i],response: {msg: fileList[i]} }
            this.photoList.push(item)
          }
        }
        if (this.form.locationUrl!= null){
          this.locationList =[]
          let fileList = this.form.locationUrl.split(",")
          for (let i = 0; i < fileList.length; i++) {
            let item = {url: process.env.VUE_APP_BASE_API +fileList[i],response: {msg: fileList[i]} }
            this.locationList.push(item)
          }
        }
      });
    },
    handleView (row){
      const id = row.id
      getThickness(id).then(response => {
        this.dataForm = response.data;
        this.dataForm.inspectionMethod = this.dataForm.inspectionMethod.split(",");
        this.visible = true;
        this.title = this.$t('查看') + this.$t('定点测厚');
        if (this.dataForm.photo!= null){
          this.photoList =[]
          let fileList = this.dataForm.photo.split(",")
          for (let i = 0; i < fileList.length; i++) {
            let item = {url: process.env.VUE_APP_BASE_API +fileList[i],response: {msg: fileList[i]} }
            this.photoList.push(item)
          }
        }
        if (this.dataForm.locationUrl!= null){
          this.locationList =[]
          let fileList = this.dataForm.locationUrl.split(",")
          for (let i = 0; i < fileList.length; i++) {
            let item = {url: process.env.VUE_APP_BASE_API +fileList[i],response: {msg: fileList[i]} }
            this.locationList.push(item)
          }
        }
        this.dataForm.recordUrl = process.env.VUE_APP_BASE_API + this.dataForm.recordUrl
      });
      this.recordParams.measureId = row.id
      listMeasurerecord(this.recordParams).then(response => {
        this.dataList = response.rows;
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.inspectionMethod = this.form.inspectionMethod.join(",");
          if (this.form.id != null) {
            updateThickness(this.form).then(response => {
              this.msgSuccess(this.$t('修改成功'));
              this.open = false;
              this.getList();
            });
          } else {
            addThickness(this.form).then(response => {
              this.msgSuccess(this.$t('新增成功'));
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
          type: "warning"
        }).then(function() {
          return delThickness(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess(this.$t('删除成功'));
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm(this.$t('是否确认导出所有定点测厚数据项?'), this.$t('警告'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
          type: "warning"
        }).then(function() {
          return exportThickness(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    },
      /** 导入按钮操作 */
      handleImport() {
          this.upload.title = this.$t('导入更新数据');
          this.upload.open = true;
      },
      /** 下载模板操作 */
      importTemplate() {
        this.$refs['downloadFileForm'].submit()
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
          this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
          this.upload.open = false;
          this.upload.isUploading = false;
          this.$refs.upload.clearFiles();
          this.fullscreenLoading = false;
        if (response.data.length > 0) {
          let failrow = ''
          for (let i = 0; i < response.data.length; i++) {
            failrow += response.data[i] + ','
          }
          this.$alert(this.$t('导入成功条数:') + response.msg + '<br>' + this.$t('失败行数:') + failrow, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
        } else {
          this.$alert(this.$t('导入成功条数:') + response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
        }
          this.getList();
      },
      // 提交上传文件
      submitFileForm() {
          this.$refs.upload.submit();
          this.fullscreenLoading = true;
      },
      //下载报告
      downloadHandle (row) {
        this.downloadForm.id = row.id;
        this.$nextTick(() => {
          this.$refs['downloadForm'].submit()
        })
      },
    //查询测厚记录
    recordHandle (row) {
      this.recordVisible = true
      this.$nextTick(() => {
        this.$refs.record.init(row)
      })
    },
    closeChildDialog () {
      this.showFlag = false
      this.getList();
    },

    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 3 个文件`);
    },
    handleRemove(file, fileList) {
      this.form.locationUrl = fileList.map((obj)=>{return obj.response.msg}).join(",");
      console.log(this.form.locationUrl)
    },
    handleAvatarSuccess(res, file, fileList) {
      console.log(fileList)
      this.locationList = fileList
      this.form.locationUrl = fileList.map((obj)=>{return obj.response.msg}).join(",");
      console.log(this.form.locationUrl)
    },
    handleRemove2(file, fileList) {
      this.form.photo = fileList.map((obj)=>{return obj.response.msg}).join(",");
    },
    handleAvatarSuccess2(res, file, fileList) {
      console.log(fileList)
      this.photoList = fileList
      this.form.photo = fileList.map((obj)=>{return obj.response.msg}).join(",");
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isJPG) {
        this.$message.error(this.$t('上传图片只能是 JPG/PNG 格式!'));
      }
      if (!isLt2M) {
        this.$message.error(this.$t('上传图片大小不能超过 2MB!'));
      }
      return isJPG && isLt2M;
    },
    //附件上传中处理
    handleFileDocProgress(event, file, fileList) {
      this.analysis.file = file;
    },
    //附件上传成功处理
    handleFileDocSuccess(response, file, fileList) {
      this.form.analysisUrl = response.msg
      this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
    },

    //寿命颜色预警
    tableCellStyle({ row, column, rowIndex, columnIndex }) {
     if (columnIndex == 18 && row.warnFlag == 1){
        return "color: rgba(255, 26, 26, 0.98) "
      }else if (columnIndex == 17 && row.warnFlag == 1){
       return "color: rgba(255, 26, 26, 0.98) "
      }
    },

  }
};
</script>
<style>
.otherMethod {
  width: 40%;
}
</style>
