<!-- 基本信息 -->
<script lang="ts" setup name="baseInfo">
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import type { deptType, selectType } from '../standingBook-interface'
import showPhoto from '@/views/system/tool/showPhoto.vue'
import { UploadFile } from '@/api/measure/file'
import { getDictByCode } from '@/api/system/dict'
import { getUserList } from '@/api/system/user'
import { getDeptTreeList } from '@/api/system/dept'
import comTreeSelect from '@/views/system/user/selecTree.vue'
import { toTreeList } from '@/utils/structure'
import type { userType } from '@/views/system/user/user-interface'
const props = defineProps({
  title: {
    type: String,
    require: true,
  },
  name: {
    type: String,
    require: true,
  },
  row: {
    type: Object,
    defaule: () => ({}),
  },
})
const ruleFormRef = ref() // from组件
const dialogVisible = ref<boolean>(true)
const title = ref(props.title)
const row = ref(props.row)
const ruleForm = ref({
  assetNo: '', // 资产编号
  assetType: '', // 资产类型
  assetSource: '', // 资产来源
  equipmentNo: '', // 设备编号
  equipmentName: '', // 设备名称
  labelBind: '', // 标签绑定
  modelNo: '', // 型号
  equipmentSpecifications: '', // 设备规格
  equipmentType: '', // 设备类型
  equipmentCategory: '', // 设备类别
  capitalSource: '', // 资本来源
  managerLevel: '', // 管理级别
  purpose: '', // 用途
  technicalLevel: '', // 技术水平
  intactState: '', // 完好状态
  manufacturerCountry: '', // 厂家国别
  manufacturer: '', // 生产厂家
  overallDimension: '', // 外形尺寸
  manufacturingNo: '', // 出厂编号
  manufacturingDate: '', // 出厂年月
  cardEstablishmentDate: '', // 立卡年月
  weight: '', // 重量
  enableDate: '', // 启用年月
  singlePrice: '', // 单价
  installIncidentalExpenses: '', //	安装及杂费
  originValue: '', //	原值
  useDept: '', //	使用部门
  installPlace: '', //	安装地点
  createUser: '', //		创建人/负责人
  depreciationPeriod: '', //	折旧年限
  depreciationMethod: '', //	折旧方法
  attribute: '', //	属性
  majorCategory: '', //	专业分类
  presentOriginValue: '', //	目前原值
  managerState: '1', //	管理状态
  fileList: [] as any[], //	说明书
  remark: '', //	备注
  mesureType: '', //	检定方式
  mesureRange: '', //	测量范围
  uncertainty: '', //	不确定度
  usePerson: '', //	使用人
  mesureDept: '', //	检定部门
  mesureCycle: '', //	检定周期
  mesureDate: '', //	检定日期
  validDate: '', //	有效日期
  mesureResult: '', //	检定结果
  abc: '', //	ABC
  isCalibrationTestEquipment: '', //	是否是技术指标需要校准检定的设备
  isMeasureAccount: '', //	是否是测量工装台账
  isStandardSupportEquipment: '', //		是否标准配套设备
  id: '',
}) // 表单
const rules = ref<FormRules>({
  assetType: [{ required: true, message: '资产类型不能为空', trigger: 'blur' }],
  equipmentName: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
  manufacturer: [{ required: true, message: '生产厂家不能为空', trigger: 'blur' }],
  manufacturingNo: [{ required: true, message: '出厂编号不能为空', trigger: 'blur' }],
  manufacturingDate: [{ required: true, message: '出厂日期不能为空', trigger: 'blur' }],
  modelNo: [{ required: true, message: '型号不能为空', trigger: 'blur' }],
  abc: [{ required: true, message: 'ABC不能为空', trigger: 'blur' }],
  cardEstablishmentDate: [{ required: true, message: '立卡年月不能为空', trigger: 'blur' }],
  enableDate: [{ required: true, message: '启用日期不能为空', trigger: 'blur' }],
  mesureDate: [{ required: true, message: '检定日期不能为空', trigger: 'blur' }],
  validDate: [{ required: true, message: '有效日期不能为空', trigger: 'blur' }],
}) // 表单验证规则
const assetTypeList = ref<selectType[]>([]) // 资产类型
const ABCList = ref<selectType[]>([]) // ABC
const mesureTypeList = ref<selectType[]>([]) // 检定方式
const majorCategoryList = ref<selectType[]>([]) // 专业分类
const equipmentCategoryList = ref<selectType[]>([]) // 设备类别
const mesureResultList = ref<selectType[]>([]) //  检定结果
const equipmentTypeList = ref<selectType[]>([]) // 设备类型
const managerLevelList = ref<selectType[]>([]) // 管理级别
const depreciationMethodList = ref<selectType[]>([]) // 折旧方法
const managerStateList = ref<selectType[]>([]) // 管理状态
const capitalSourceList = ref<selectType[]>([]) // 资本来源
const usePersonList = ref<userType[]>([]) // 使用人列表
const useDeptList = ref<deptType[]>([]) // 使用部门列表
const isWhether = ref<selectType[]>([
  {
    name: '是',
    id: 'shi',
    value: '1',
  },
  {
    name: '否',
    id: 'fou',
    value: '0',
  },
])
const deptProps = reactive({
  parent: 'pid', value: 'id', label: 'name', children: 'children',
})
// 检定周期
const mesureCycleList = ref<selectType[]>([
  {
    name: '半年一检',
    id: '1',
    value: '6',
  },
  {
    name: '一年一检',
    id: '2',
    value: '12',
  },
  {
    name: '两年一检',
    id: '3',
    value: '24',
  },
  {
    name: '三年一检',
    id: '4',
    value: '36',
  },
  {
    name: '四年一检',
    id: '5',
    value: '48',
  },
  {
    name: '五年一检',
    id: '6',
    value: '60',
  },
])
// 获取下拉框数
const fetchData = () => {
// 获取资产类型
  getDictByCode('assetType').then((response) => {
    assetTypeList.value = response.data
  })
  // 获取ABC
  getDictByCode('ABC').then((response) => {
    ABCList.value = response.data
  })
  // 获取检定方式
  getDictByCode('mesureType').then((response) => {
    mesureTypeList.value = response.data
  })
  // 获取专业分类
  getDictByCode('majorCategory').then((response) => {
    majorCategoryList.value = response.data
  })
  // 获取检定结果
  getDictByCode('mesureResult').then((response) => {
    mesureResultList.value = response.data
  })
  // 获取设备类别
  getDictByCode('equipmentCategory').then((response) => {
    equipmentCategoryList.value = response.data
  })
  // 获取设备类型
  getDictByCode('equipmentType').then((response) => {
    equipmentTypeList.value = response.data
  })
  // 获取管理级别
  getDictByCode('managerLevel').then((response) => {
    managerLevelList.value = response.data
  })
  // 获取折旧方法
  getDictByCode('depreciationMethod').then((response) => {
    depreciationMethodList.value = response.data
  })
  // 获取管理状态
  getDictByCode('managerState').then((response) => {
    managerStateList.value = response.data
  })
  // 获取资本来源
  getDictByCode('capitalSource').then((response) => {
    capitalSourceList.value = response.data
  })
  // 获取用户列表
  getUserList({ offset: 1, limit: 99999 }).then((res) => {
    usePersonList.value = res.data.rows
  })
  // 获取部门列表
  getDeptTreeList().then((res) => {
    // 转成树结构
    useDeptList.value = toTreeList(res.data, '0', true)
  })
}
// 重置
const resetDATA = () => {
  ruleForm.value = {
    assetNo: '', // 资产编号
    assetType: '', // 资产类型
    assetSource: '', // 资产来源
    equipmentNo: '', // 设备编号
    equipmentName: '', // 设备名称
    labelBind: '', // 标签绑定
    modelNo: '', // 型号
    equipmentSpecifications: '', // 设备规格
    equipmentType: '', // 设备类型
    equipmentCategory: '', // 设备类别
    capitalSource: '', // 资本来源
    managerLevel: '', // 管理级别
    purpose: '', // 用途
    technicalLevel: '', // 技术水平
    intactState: '', // 完好状态
    manufacturerCountry: '', // 厂家国别
    manufacturer: '', // 生产厂家
    overallDimension: '', // 外形尺寸
    manufacturingNo: '', // 出厂编号
    manufacturingDate: '', // 出厂年月
    cardEstablishmentDate: '', // 立卡年月
    weight: '', // 重量
    enableDate: '', // 启用年月
    singlePrice: '', // 单价
    installIncidentalExpenses: '', //	安装及杂费
    originValue: '', //	原值
    useDept: '', //	使用部门
    installPlace: '', //	安装地点
    createUser: '', //		创建人/负责人
    depreciationPeriod: '', //	折旧年限
    depreciationMethod: '', //	折旧方法
    attribute: '', //	属性
    majorCategory: '', //	专业分类
    presentOriginValue: '', //	目前原值
    managerState: '1', //	管理状态
    fileList: [] as any[], //	说明书
    remark: '', //	备注
    mesureType: '', //	检定方式
    mesureRange: '', //	测量范围
    uncertainty: '', //	不确定度
    usePerson: '', //	使用人
    mesureDept: '', //	检定部门
    mesureCycle: '', //	检定周期
    mesureDate: '', //	检定日期
    validDate: '', //	有效日期
    mesureResult: '', //	检定结果
    abc: '', //	ABC
    isCalibrationTestEquipment: '', //	是否是技术指标需要校准检定的设备
    isMeasureAccount: '', //	是否是测量工装台账
    isStandardSupportEquipment: '', //		是否标准配套设备
    id: '',
  }
}
// 提交
const submitForm = () => {
  return ruleFormRef.value
}
defineExpose({ submitForm })
watch(() => ruleForm.value, (newVal) => {
// 变化后存储
  sessionStorage.setItem('deviceBaseInfo', JSON.stringify(newVal))
},
{ deep: true, immediate: true })

const fileRef = ref() // 文件上传input
const onFileChange = (event: any) => {
  // 原生上传
  // console.log(event.target.files)
  if (event.target.files?.length !== 0) {
    // 创建formdata对象
    const fd = new FormData()
    fd.append('multipartFile', event.target.files[0])
    UploadFile(fd).then((res) => {
      if (res.code === 200) {
        console.log(res.data[0])
        // 重置当前验证
        ruleForm.value.fileList = []
        ruleForm.value.fileList.push({
          assetId: '',
          fileName: res.data[0],
          minioFileName: res.data[0],
          // id: '',
        })
        ruleFormRef.value?.clearValidate('minioFileName')
        ElMessage.success('文件上传成功')
      }
      else {
        ElMessage.error(res.message)
      }
    })
  }
}
const upload = () => {
  fileRef.value.click()
}
// 展示鉴定内容
const isShowCalibration = ref<boolean>(false)
// 若固定资产为测量设备，还需填写检定内容
watch(() => ruleForm.value.assetType, (newVal) => {
  if (newVal === '1') {
    isShowCalibration.value = true
  }
})
onMounted(() => {
  fetchData()
  ruleFormRef.value?.resetFields()
  // row数据后续详情编辑需要

  // dialogVisible.value = true
  // if (title.value !== '新建') {
  //   assetsDetailApi({ id: row.id }).then((res) => {
  //     for (const key in res.data) {
  //       if (typeof res.data[key] == 'number') {
  //         res.data[key] = String(res.data[key])
  //       }
  //     }
  //     ruleForm.value = res.data
  //   })
  // }
})
</script>

<template>
  <div class="body-container">
    <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-position="right" label-width="110px" class="form" :class="[title === '详情' ? 'isDetail' : '']">
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="资产编号" prop="assetNo">
            <el-input v-model.trim="ruleForm.assetNo" placeholder="系统自动生成" disabled />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="资产类型" prop="assetType">
            <el-select v-model="ruleForm.assetType" :placeholder="title === '详情' ? '' : '资产类型'" :disabled="title === '详情'" clearable>
              <el-option v-for="item in assetTypeList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="设备编号" prop="equipmentNo">
            <el-input v-model.trim="ruleForm.equipmentNo" placeholder="系统自动生成" disabled />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="设备名称" prop="equipmentName">
            <el-input v-model.trim="ruleForm.equipmentName" :placeholder="title === '详情' ? '' : '设备名称'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="生产厂家" prop="manufacturer">
            <el-input v-model.trim="ruleForm.manufacturer" :placeholder="title === '详情' ? '' : '生产厂家'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="厂家国别" prop="manufacturerCountry">
            <el-select v-model="ruleForm.manufacturerCountry" :placeholder="title === '详情' ? '' : '厂家国别'" :disabled="title === '详情'" clearable>
              <el-option v-for="item in []" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="出厂编号" prop="manufacturingNo">
            <el-input v-model.trim="ruleForm.manufacturingNo" :placeholder="title === '详情' ? '' : '出厂编号'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="出厂年月" prop="manufacturingDate">
            <el-date-picker
              v-model="ruleForm.manufacturingDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled="title === '详情'"
              :placeholder="title === '详情' ? '' : '出厂年月'"
              class="normal-date"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="型号" prop="modelNo">
            <el-input v-model.trim="ruleForm.modelNo" :placeholder="title === '详情' ? '' : '型号'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="管理状态" prop="managerState">
            <el-select v-model="ruleForm.managerState" :placeholder="title === '详情' ? '' : '管理状态'" :disabled="title === '详情'" clearable>
              <el-option v-for="item in managerStateList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="ABC" prop="abc">
            <el-select v-model="ruleForm.abc" :placeholder="title === '详情' ? '' : 'ABC'" :disabled="title === '详情'">
              <el-option v-for="item in ABCList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="标签绑定" prop="labelBind">
            <el-input v-model.trim="ruleForm.labelBind" :placeholder="title === '详情' ? '' : '标签'" :disabled="title === '详情'" clearable>
              <template #append>
                <el-button type="primary" size="small">
                  扫描
                </el-button>
              </template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="立卡年月" prop="cardEstablishmentDate">
            <el-date-picker
              v-model="ruleForm.cardEstablishmentDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled="title === '详情'"
              :placeholder="title === '详情' ? '' : '立卡年月'"
              class="normal-date"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="启用日期" prop="enableDate">
            <el-date-picker
              v-model="ruleForm.enableDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled="title === '详情'"
              :placeholder="title === '详情' ? '' : '启用日期'"
              class="normal-date"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="检定方式" prop="mesureType">
            <el-select v-model="ruleForm.mesureType" :placeholder="title === '详情' ? '' : '检定方式'" :disabled="title === '详情'">
              <el-option v-for="item in mesureTypeList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="检定周期" prop="mesureCycle">
            <el-select v-model="ruleForm.mesureCycle" :placeholder="title === '详情' ? '' : '检定周期'" :disabled="title === '详情'" clearable>
              <el-option v-for="item in mesureCycleList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="12">
          <el-form-item label="测量范围" prop="mesureRange">
            <el-input v-model.trim="ruleForm.mesureRange" :placeholder="title === '详情' ? '' : '测量范围'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="不确定度" prop="uncertainty">
            <el-input v-model.trim="ruleForm.uncertainty" :placeholder="title === '详情' ? '' : '不确定度'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="使用部门" prop="useDept">
            <com-tree-select
              v-if="title !== '详情'"
              v-model="ruleForm.useDept" :options="useDeptList as any" placeholder="使用部门"
              :tree-props="deptProps"
            />
            <el-select v-else v-model="ruleForm.useDept" placeholder="''" :disabled="title === '详情'">
              <el-option v-for="item in useDeptList" :key="item.id" :label="item.name" :value="item.id" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="使用人" prop="usePerson">
            <el-select v-model="ruleForm.usePerson" :placeholder="title === '详情' ? '' : '使用人'" :disabled="title === '详情'">
              <el-option v-for="item in usePersonList" :key="item.id" :label="item.name" :value="item.id" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="专业分类" prop="majorCategory">
            <el-select v-model="ruleForm.majorCategory" :placeholder="title === '详情' ? '' : '专业分类'" :disabled="title === '详情'">
              <el-option v-for="item in majorCategoryList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="检定部门" prop="mesureDept">
            <com-tree-select
              v-if="title !== '详情'"
              v-model="ruleForm.mesureDept" :options="useDeptList as any" placeholder="使用部门"
              :tree-props="deptProps"
            />
            <el-select v-else v-model="ruleForm.useDept" placeholder="" :disabled="title === '详情'">
              <el-option v-for="item in useDeptList" :key="item.id" :label="item.name" :value="item.id" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="检定日期" prop="mesureDate">
            <el-date-picker
              v-model="ruleForm.mesureDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled="title === '详情'"
              :placeholder="title === '详情' ? '' : '检定日期'"
              class="normal-date"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="有效日期" prop="validDate">
            <el-date-picker
              v-model="ruleForm.validDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD HH:mm:ss" :disabled="title === '详情'"
              :placeholder="title === '详情' ? '' : '有效日期'"
              class="normal-date"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="检定结果" prop="mesureResult">
            <el-select v-model="ruleForm.mesureResult" :placeholder="title === '详情' ? '' : '检定结果'" :disabled="title === '详情'">
              <el-option v-for="item in mesureResultList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="8">
          <el-form-item label="是否是技术指标需要校准/检定的设备" prop="isCalibrationTestEquipment" label-width="260px">
            <el-select v-model="ruleForm.isCalibrationTestEquipment" :placeholder="title === '详情' ? '' : '是/否'" :disabled="title === '详情'">
              <el-option v-for="item in isWhether" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="是否是测量工装台账" prop="isMeasureAccount" label-width="260px">
            <el-select v-model="ruleForm.isMeasureAccount" :placeholder="title === '详情' ? '' : '是/否'" :disabled="title === '详情'">
              <el-option v-for="item in isWhether" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="是否标准配套设备" prop="isStandardSupportEquipment" label-width="260px">
            <el-select v-model="ruleForm.isStandardSupportEquipment" :placeholder="title === '详情' ? '' : '是/否'" :disabled="title === '详情'">
              <el-option v-for="item in isWhether" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="资产来源" prop="assetSource">
            <el-input v-model.trim="ruleForm.assetSource" :placeholder="title === '详情' ? '' : '资产来源'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="设备规格" prop="equipmentSpecifications">
            <el-input v-model.trim="ruleForm.equipmentSpecifications" :placeholder="title === '详情' ? '' : '设备规格'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="设备类别" prop="equipmentCategory">
            <el-select v-model="ruleForm.equipmentCategory" :placeholder="title === '详情' ? '' : '设备类别'" :disabled="title === '详情'">
              <el-option v-for="item in equipmentCategoryList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="设备类型" prop="equipmentType">
            <el-select v-model="ruleForm.equipmentType" :placeholder="title === '详情' ? '' : '设备类型'" :disabled="title === '详情'">
              <el-option v-for="item in equipmentTypeList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="资本来源" prop="capitalSource">
            <el-select v-model="ruleForm.capitalSource" :placeholder="title === '详情' ? '' : '资本来源'" :disabled="title === '详情'">
              <el-option v-for="item in capitalSourceList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="管理级别" prop="managerLevel">
            <el-select v-model="ruleForm.managerLevel" :placeholder="title === '详情' ? '' : '管理级别'" :disabled="title === '详情'">
              <el-option v-for="item in managerLevelList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="用途" prop="purpose">
            <el-input v-model.trim="ruleForm.purpose" :placeholder="title === '详情' ? '' : '用途'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="技术水平" prop="technicalLevel">
            <el-input v-model.trim="ruleForm.technicalLevel" :placeholder="title === '详情' ? '' : '技术水平'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="完好状态" prop="intactState">
            <el-input v-model.trim="ruleForm.intactState" :placeholder="title === '详情' ? '' : '完好状态'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="外形尺寸" prop="overallDimension">
            <el-input v-model.trim="ruleForm.overallDimension" :placeholder="title === '详情' ? '' : '外形尺寸'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="重量(吨)" prop="weight">
            <el-input v-model.trim="ruleForm.weight" :placeholder="title === '详情' ? '' : '重量'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="单价" prop="singlePrice">
            <el-input v-model.trim="ruleForm.singlePrice" :placeholder="title === '详情' ? '' : '单价'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="安装及杂费" prop="installIncidentalExpenses">
            <el-input v-model.trim="ruleForm.installIncidentalExpenses" :placeholder="title === '详情' ? '' : '安装及杂费'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="安装地点" prop="installPlace">
            <el-input v-model.trim="ruleForm.installPlace" :placeholder="title === '详情' ? '' : '安装地点'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="原值" prop="originValue">
            <el-input v-model.trim="ruleForm.originValue" :placeholder="title === '详情' ? '' : '原值'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="目前原值" prop="presentOriginValue">
            <el-input v-model.trim="ruleForm.presentOriginValue" :placeholder="title === '详情' ? '' : '目前原值'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="折旧年限" prop="depreciationPeriod">
            <el-input v-model.trim="ruleForm.depreciationPeriod" :placeholder="title === '详情' ? '' : '折旧年限'" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="折旧方法" prop="depreciationMethod">
            <el-select v-model="ruleForm.depreciationMethod" placeholder="折旧方法" :disabled="title === '详情'">
              <el-option v-for="item in depreciationMethodList" :key="item.id" :label="item.name" :value="item.value" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="6">
          <el-form-item label="属性" prop="attribute">
            <el-input v-model.trim="ruleForm.attribute" placeholder="属性" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="12">
          <el-form-item label="说明书" prop="minioFileName">
            <show-photo :minio-file-name="ruleForm.fileList[0]?.minioFileName || ''" />
            <input v-show="title === ''" ref="fileRef" type="file" @change="onFileChange">
            <el-button v-if="title !== '详情'" type="primary" :disabled="title === '详情'" :style="{ 'margin-left': ruleForm.fileList[0]?.minioFileName ? '20px' : '0px' }" @click="upload">
              {{ ruleForm.fileList[0]?.minioFileName ? '更换' : '上传' }}
            </el-button>
            <span v-if="title === '详情' && !ruleForm.fileList[0]?.minioFileName">暂无</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24" class="marg">
        <el-col :span="24">
          <el-form-item label="备注" prop="remark">
            <el-input v-model.trim="ruleForm.remark" :rows="3" type="textarea" placeholder="备注" :disabled="title === '详情'" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<style lang="scss" scoped>
.body-container {
  .form {
    border-radius: 8px;
    background-color: #fff;
    padding-top: 20px;
  }
}

.marg {
  margin-top: 5px;
}

.isDetail {
  ::v-deep {
    .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap > .el-form-item__label::before,
    .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label::before {
      display: none;
    }
  }
}
</style>
