<template>
  <!-- 机械台账详情抽屉 -->

  <el-drawer v-model="isShowDialog" size="40%" direction="ltr">
    <template #header>
      <span>机械台账详情</span>
    </template>
    <el-form ref="formRef" :model="formData" label-width="100px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="设备名称">{{ formData.devicename }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备类型">{{ formData.deviceType }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备编号">{{ formData.deviceNumber }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="班组名称">{{ formData.teamName }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="入场日期">{{ parseTime(formData.entryTime, '{y}-{m}-{d}') }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="规格型号">{{ formData.specification }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="生产能力">{{ formData.production }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="车牌号码">{{ formData.plateNumber }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备管理员">{{ formData.deviceKeeper }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="车辆行驶证">{{ formData.drivingLicence }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="新旧程度">{{ formData.degree }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="车辆容量">{{ formData.vehicleCapacity }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="车辆净重">{{ formData.suttle }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="铭牌">
            <el-image :src="formData.nameplate" fit="contain" style="width: 150px; height: 150px" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="合格证书">
            <el-image :src="formData.equipmentPhoto" fit="contain" style="width: 150px; height: 150px" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备照片">
            <el-image :src="formData.qualification" fit="contain" style="width: 150px; height: 150px" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="检验报告">
            <el-image :src="formData.verificationReport" fit="contain" style="width: 150px; height: 150px" />
          </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
          <el-form-item label="上传时间">{{ formData.createdAt }}</el-form-item>
        </el-col> -->
        <el-col :span="12">
          <el-form-item label="备注">{{ formData.remark }}</el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-drawer>
</template>

<script setup lang="ts">
import { getMechanicalrewriting } from '@/api/mechanical/mechanicalrewriting';
const formData: any = ref({
  devicename: '',
  deviceType: '',
  deviceNumber: '',
  teamName: '',
  entryTime: '',
  specification: '',
  production: '',
  plateNumber: '',
  deviceKeeper: '',
  drivingLicence: '',
  degree: '',
  vehicleCapacity: '',
  suttle: '',
  nameplate: '',
  qualification: '',
  equipmentPhoto: '',
  verificationReport: '',
  createdAt: '',
  remark: ''
});
const isShowDialog = ref(false);
const open = async (id?: any) => {
  console.log(id);
  isShowDialog.value = true;
  if (id) {
    const res = await getMechanicalrewriting(id);
    console.log(res);
    formData.value = res.data;
    // form.value.equipmentType = res.data.deviceNumber + '_' + res.data.deviceType;
    // Object.assign(form.value, res.data);
  }
};

defineExpose({
  open
});
</script>
