<template>
  <el-dialog  :close-on-click-modal="false"
    :title="!this.taskForm.taskId == '' ? $t('处理') : $t('设备详情')"

    :visible.sync="visible" append-to-body>
    <el-form :model="taskForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="" label-width="80px" style="margin-left: -80px">
      <el-form-item>
        <el-table
          v-show="dataForm.approveType != 7 && dataForm.devType == 1"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="devno"
            header-align="center"
            align="center"
            :label="$t('位号')">
          </el-table-column>
          <el-table-column
            prop="devname"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="150"
            :label="$t('设备名称')">
          </el-table-column>
          <el-table-column
            prop="useno"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('使用证编号')">
          </el-table-column>
          <el-table-column
            prop="medium"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('介质')">
          </el-table-column>
          <el-table-column
            prop="desPressure"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('设计压力')+'(MPa)'">
          </el-table-column>
          <el-table-column
            prop="desTemp"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('设计温度')+'(℃)'">
          </el-table-column>
        </el-table>
        <el-table
          v-show="dataForm.approveType != 7 && dataForm.devType == 2"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            width="100"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="devno"
            header-align="center"
            align="center"
            width="120"
            :label="$t('位号')">
          </el-table-column>
          <el-table-column
            prop="starting"
            header-align="center"
            align="center"
            width="100"
            :show-overflow-tooltip="true"
            :label="$t('起点')">
          </el-table-column>
          <el-table-column
            prop="ending"
            header-align="center"
            align="center"
            width="100"
            :show-overflow-tooltip="true"
            :label="$t('终点')">
          </el-table-column>
          <el-table-column
            prop="medium"
            header-align="center"
            align="center"
            width="100"
            :show-overflow-tooltip="true"
            :label="$t('介质')">
          </el-table-column>
          <el-table-column
            prop="desPressure"
            header-align="center"
            align="center"
            :label="$t('设计压力')">
          </el-table-column>
          <el-table-column
            prop="desTemp"
            header-align="center"
            align="center"
            :label="$t('设计温度')">
          </el-table-column>
          <el-table-column
            prop="optPressure"
            header-align="center"
            align="center"
            :label="$t('工作压力')">
          </el-table-column>
          <el-table-column
            prop="optTemp"
            header-align="center"
            align="center"
            width="100"
            :show-overflow-tooltip="true"
            :label="$t('工作温度')">
          </el-table-column>
        </el-table>
        <el-table
          v-show="dataForm.devType == 3"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="docno"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('档案号')">
          </el-table-column>
          <el-table-column
            prop="devname"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="150"
            :label="$t('设备名称')">
          </el-table-column>
          <el-table-column
            prop="capacity"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('起吊重量')+'(ton)'">
          </el-table-column>
          <el-table-column
            prop="location"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('使用地点')">
          </el-table-column>
        </el-table>
        <el-table
          v-show="dataForm.devType == 4"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="devno"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('位号')">
          </el-table-column>
          <el-table-column
            prop="devname"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('设备名称')">
          </el-table-column>
          <el-table-column
            prop="useno"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('使用证编号')">
          </el-table-column>
          <el-table-column
            prop="desTemp"
            header-align="center"
            align="center"
            :label="$t('设计温度')+'(℃)'">
          </el-table-column>
          <el-table-column
            prop="desPressure"
            header-align="center"
            align="center"
            :label="$t('设计压力')+'(MPa)'">
          </el-table-column>
        </el-table>
        <el-table
          v-show="dataForm.devType == 5"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="docno"
            header-align="center"
            align="center"
            :label="$t('docNo')">
          </el-table-column>
          <el-table-column
            prop="devname"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="150"
            :label="$t('设备名称')">
          </el-table-column>
          <el-table-column
            prop="model"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('型号')">
          </el-table-column>
          <el-table-column
            prop="location"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            :label="$t('使用地点')">
          </el-table-column>
        </el-table>
        <el-table
          v-show="dataForm.devType == 6"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="useDept"
            header-align="center"
            align="center"
            :label="$t('dept')">
          </el-table-column>
          <el-table-column
            prop="carNo"
            header-align="center"
            align="center"
            :label="$t('plateNo')">
          </el-table-column>
          <el-table-column
            prop="docno"
            header-align="center"
            align="center"
            :label="$t('docNo')">
          </el-table-column>
          <el-table-column
            prop="model"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('model')">
          </el-table-column>
        </el-table>
        <el-table
          v-show="dataForm.devType == 7"
          :data="devList"
          border
          style="width: 100%;">
          <el-table-column
            prop="plantCode"
            header-align="center"
            align="center"
            :label="$t('装置名称')">
          </el-table-column>
          <el-table-column
            prop="unit"
            header-align="center"
            align="center"
            :label="$t('单元')">
          </el-table-column>
          <el-table-column
            prop="devno"
            header-align="center"
            align="center"
            :label="$t('位号')">
          </el-table-column>
          <el-table-column
            prop="devname"
            header-align="center"
            align="center"
            :label="$t('名称')">
          </el-table-column>
          <el-table-column
            prop="createno"
            header-align="center"
            align="center"
            :label="$t('制造编号')">
          </el-table-column>
          <el-table-column
            prop="indiameter"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('内径')+' mm'">
          </el-table-column>
          <el-table-column
            prop="height"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('高(长)')+' mm'">
          </el-table-column>
          <el-table-column
            prop="chickness"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('壁厚(mm)')">
          </el-table-column>
          <el-table-column
            prop="volume"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('容积mm³')">
          </el-table-column>
          <el-table-column
            prop="medium"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('介质')">
          </el-table-column>
          <el-table-column
            prop="material"
            header-align="center"
            align="center"
            :show-overflow-tooltip="true"
            width="120"
            :label="$t('材料')">
          </el-table-column>
        </el-table>
      </el-form-item>

      <el-form-item v-if="[5,7,8].includes(dataForm.approveType)" :label="$t('reasonDescription')" prop="content">
        <el-input type="textarea" :placeholder="$t('reasonDescription')"
                  v-model="dataForm.content"
                  maxlength="200"
                  :autosize="{ minRows: 2, maxRows: 10}" disabled></el-input>
      </el-form-item>
      <template v-if="dataForm.approveType == 5">
        <el-form-item :label="$t('延期日期')" prop="delayDate">
          <el-form-item prop="endTime">
            <el-date-picker
              v-model="dataForm.delayDate"
              type="date"
              value-format="yyyy-MM-dd"
              :placeholder="$t('selectDate')" disabled>
            </el-date-picker>
          </el-form-item>
        </el-form-item>
        <el-form-item :label="$t('延期原因')" prop="delayReason">
          <el-input type="textarea" :placeholder="$t('延期原因')"
                    v-model="dataForm.delayReason"
                    :autosize="{ minRows: 2, maxRows: 50}" disabled></el-input>
        </el-form-item>
        <el-form-item :label="$t('延期措施')" prop="delayMeasure">
          <el-input type="textarea" :placeholder="$t('延期措施')"
                    v-model="dataForm.delayMeasure"
                    :autosize="{ minRows: 2, maxRows: 50}" disabled></el-input>
        </el-form-item>
        <el-form-item :label="$t('延期责任安全声明')" prop="delayNotice">
          <el-input type="textarea" :placeholder="$t('延期责任安全声明')"
                    v-model="dataForm.delayNotice"
                    :autosize="{ minRows: 2, maxRows: 50}" disabled></el-input>
        </el-form-item>
      </template>

      <el-form-item :label="$t('attachment')" prop="fileUrls" v-if="[7,8].includes(dataForm.approveType)">
        <template v-for="item in this.dataForm.files">
          <a style="margin-right: 40px" class='download' :href='getUrl(item.fileUrl)' download="" target="_blank" :title="$t('download')">{{item.fileName}}</a>
        </template>
      </el-form-item >
      <!--<template v-if="this.taskName == '政府回执'">
        <el-form-item :label="$t('govFileUrls')" prop="govFileUrls" >
          <el-upload
            class="upload-demo"
            drag
            :action="UploadUrl ()"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :before-remove="beforeRemove"
            :on-success="handleAvatarSuccess"
            :limit="5"
            :on-exceed="handleExceed"
            :file-list="taskForm.govFileList"
            multiple>
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">{{$t('dragFile')}}<em>{{$t('clickUpload')}}</em></div>
            &lt;!&ndash;        <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>&ndash;&gt;
          </el-upload>

        </el-form-item>
        <el-form-item :label="$t('govDate')" prop="govDate">
          <el-date-picker
            v-model="taskForm.govDate"
            type="date"
            value-format="yyyy-MM-dd"
            :placeholder="$t('selectDate')">
          </el-date-picker>
        </el-form-item>
      </template>-->
      <!--<template v-else>
        <el-form-item v-if="!this.taskForm.taskId == ''" :label="$t('审核意见')" prop="comment">
          <el-input v-model="taskForm.comment" :placeholder="$t('enterOpinion')" maxlength="100" show-word-limit></el-input>
        </el-form-item>
      </template>-->
    </el-form>
    <!--<span v-if="this.taskName == '政府回执'" slot="footer" class="dialog-footer">
      <el-button v-if="this.dataForm.approveType == 5" type="text" size="small" @click="recordLetter()">{{$t('downloadLetter')}}</el-button>
      <el-button v-if="!this.taskForm.taskId == ''" type="primary" @click="dataFormSubmit(1)" :disabled="submitDisabled">{{$t('submitReceipt')}}</el-button>
    </span>
    <span slot="footer" class="dialog-footer" v-else>
      <el-button v-if="this.taskForm.taskId == ''" @click="visible = false">{{$t('message.return')}}</el-button>
      <el-button v-if="!this.taskForm.taskId == ''" type="primary" @click="dataFormSubmit(1)" :disabled="submitDisabled">{{$t('通过')}}</el-button>
      <el-button v-if="!this.taskForm.taskId == ''" type="danger" @click="dataFormSubmit(0)" :disabled="submitDisabled">{{$t('拒绝')}}</el-button>
    </span>-->
    <!--<div>
      <span>{{$t('流转详情')}}</span>
      <el-table :data="historyList" border v-loading="historyLoading" style="width: 100%;">
        <el-table-column prop="taskName" header-align="center" align="center" :label="$t('流程进度')"></el-table-column>
        <el-table-column prop="userName" header-align="center" align="center" :label="$t('姓名')"></el-table-column>
        <el-table-column prop="taskCreateTime" header-align="center" align="center" :label="$t('开始时间')"></el-table-column>
        <el-table-column prop="taskEndTime" header-align="center" align="center" :label="$t('结束时间')"></el-table-column>
        <el-table-column prop="comment" header-align="center" align="center" :label="$t('审批意见')"></el-table-column>
      </el-table>
    </div>-->
  </el-dialog>
</template>

<script>
  import { getApproveInfo } from "@/api/sems/his/modify";
    export default {
      name: "record",
      data(){
        return{
          visible: false,
          devList: [],
          dataForm: {
            id: 0,
            userId: '',
            devId: '',
            devType: '',
            approveType: '',
            content: '',
            fileUrls: '',
            reUrls: '',
            status: '',
            creattime: '',
            plantCode: '',
            unit: '',
            devname: '',
            devno: '',
            files: [],
            delayDate: '',
            delayReason: '',
            delayMeasure: '',
            delayNotice: ''
          },
          taskForm: {
            comment: '',
            taskId: '',
            files: '',
            govDate: '',
            govFileList: []
          },
          dataRule: {
            approveType: [
              { required: true, message: this.$t('approveType') + this.$t('notEmpty'), trigger: 'blur' }
            ],
            content: [
              { required: true, message: this.$t('content') + this.$t('notEmpty'), trigger: 'blur' }
            ]
          },

        }
      },
      methods: {
        init (devList,dataForm) {
          this.visible = true;
          this.devList = devList;
          this.dataForm = dataForm;
          /*this.devType = dataForm.devType;
          this.approveType = dataForm.approveType;*/
        },
        approveOption: [],
        devTypeOption: [],
      }
    }

</script>

<style scoped>

</style>
