<script lang="ts" setup name="standardListAdd">
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance, UploadRequestOptions, UploadUserFile } from 'element-plus'
import dayjs from 'dayjs'
import type { IFixedAssetsList, IFromListInfo, IformInline } from '../../standard_interface'
import EquipmentDialog from '../standardList/equipmentDialog.vue'
import StandarDialog from './standardDialog.vue'
import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue'
import { getStaffList } from '@/api/measure/person'
import { getTypeSelect } from '@/api/system/price'
import {
  getStandardLisAdd,
  getStandardLisdetali,
  getStandardListDetail,
  getUsersDept,
  submitStandardEquipmentApply,
  updateStandardEquipmentApply,
} from '@/api/device/standard'
import { UploadFile } from '@/api/measure/file'
import useUserStore from '@/store/modules/user'
import showPhoto from '@/views/system/tool/showPhoto.vue'
import { submitApproval } from '@/api/approval'
const loading = ref(false) // 表单加载状态
const infoId = ref('') // id
const buttonArray = ref<string[]>([]) // 顶部按钮数组
const pageType = ref('add') // 页面类型: add,edit, detail
const buttonLoading = ref(false) // 按钮加载状态
const textMap: { [key: string]: string } = {
  edit: '编辑',
  add: '新建',
  detail: '查看',
} // 字典
// 从路由中获取页面类型参数
const $route = useRoute()
const formId = ref<string>('')
const { username } = useUserStore()
if ($route.params && $route.params.type) {
  pageType.value = $route.params.type as string
  formId.value = $route.query.formId as string
  if (pageType.value === 'add') {
    buttonArray.value = ['提交', '保存']
  }
  else if (pageType.value === 'edit') {
    buttonArray.value = ['保存']
  }
  else {
    buttonArray.value = ['同意', '驳回', '拒绝']
  }
  if ($route.query.id) {
    infoId.value = $route.query.id as string
  }
}
const ruleFormRef = ref<FormInstance>()
// 逻辑代码
const formInline = ref<IformInline>({
  assessDate: '', // 考核日期
  assessmentUnit: '', // 考核单位
  category: '', // 类 别
  categoryName: '', // 类 别名称
  constructionStandardProject: '', // 建标项目
  constructionStandardUnitName: '', // 建标单位名称
  contactInfo: '', // 联系方式
  createTime: null, // 创建时间
  createUser: null, // 创建人
  id: '', // 主键id
  laboratoryOwner: '', // 实验室
  laboratoryOwnerContact: '', // 实验室负责人
  laboratoryOwnerName: '', // 实验室名称
  managerState: '', // 管理状态
  managerStateName: '', // 管理状态名称
  measureMajor: '', // 计量专业
  fileList: [], // 文件列表
  measureMajorName: '', // 计量专业名称
  mesureRange: '', // 测量范围
  organizeNo: '', // 组织机构代码
  preparationDate: '', // 筹建日期
  projectNo: '', // 项目编号
  remark: '', // 备注
  standardHumidity: null, // 标准湿度
  standardLaboratory: '', // 标准所在实验室
  standardLaboratoryName: '', // 标准所在实验室名称
  standardLevel: '', // 标准等级
  standardLevelName: '', // 标准等级名称
  standardName: '', // 标准名称
  standardNo: '', // 标准编号
  standardOwner: '', // 标准负责人
  standardOwnerName: '', // 标准负责人名称
  standardTemperature: null, // 标准温度
  totalInvestment: null, // 投资总额
  transmitRange: '', // 传递范围
  transmitRangeName: '', // 传递范围名称
  uncertainty: '', // 不确定度
})

const fromListInfo = ref<IFromListInfo>({
  applyDept: '', // 申请部门
  applyNo: '', // 申请编号
  applyType: $route.query.applyType, // 申请类型
  applyTypeName: '', // 申请类型名称
  approvalStatus: '', // 审批状态
  applyEquipmentList: [], // 申请设备列表
  fixedAssetsList: [], // 申请设备上传列表
  approvalStatusName: '', // 审批状态名称
  constructionStandardUnitName: '', // 建标单位名称
  createTime: null, // 创建时间
  createUser: null, // 创建人
  fileList: [], // 文件列表
  id: '', // 主键id
  processId: '', // 审批id
  remark: '', // 备注
  standardEquipmentId: '', // 标准装置id
  standardName: '', // 标准名称
  standardNo: '', // 标准编号
  standardOwner: '', // 标准负责人
  taskId: '', // 任务id
})
// 下拉框数组类型
interface IOptions {
  id: string
  name: string
  value: string
  organizeName: string
  deptId: string
}
const checkTypeOptions = ref<IOptions[]>([])
const standardOwnerOptions = ref<IOptions[]>([]) // 标准负责人
const fileList = ref<UploadUserFile[]>([]) // 文件对象数组
const measureMajorList = ref<IOptions[]>([]) // 计量专业下拉框
const standardManagerStateList = ref<IOptions[]>([]) // 管理状态下拉框
const standardLevelList = ref<IOptions[]>([]) // 标准等级下拉框
const transmitRangeList = ref<IOptions[]>([]) // 传递范围下拉框
// 标准所在部门下拉框
const standardUsersDeptList = ref<IOptions[]>([])
// 获取下拉框
const getSelectList = (code: string) => {
  getTypeSelect(code).then((res) => {
    if (code === 'measureMajor') {
      measureMajorList.value = res.data
    }
    else if (code === 'standardManagerState') {
      standardManagerStateList.value = res.data
    }
    else if (code === 'standardLevel') {
      standardLevelList.value = res.data
    }
    else if (code === 'transmitRange') {
      transmitRangeList.value = res.data
    }
    else if (code === 'standardCategory') {
      checkTypeOptions.value = res.data
    }
  })
}
getSelectList('measureMajor') // 获取计量专业下拉框
getSelectList('standardManagerState') // 获取管理状态下拉框
getSelectList('standardLevel') // 获取标准等级下拉框
getSelectList('transmitRange') // 获取传递范围下拉框
getSelectList('standardCategory') // 获取类别下拉框
const approvalDialog = ref()
const params = ref({
  director: '',
  meterMajor: '',
  createEndTime: '',
  createstartTime: '',
  organizeName: '',
  organizeNo: '',
  organizeType: '2',
  pdeptId: null,
  offset: 1,
  limit: 999999,
})
// 获取部门信息
getUsersDept(params.value).then((res) => {
  standardUsersDeptList.value = res.data.rows
})
// 获取到标准负责人数组
const getStandardOwnerOptions = () => {
  const params = {
    staffNo: '', // 人员编号
    name: '', // 姓名
    deptId: '', // 工作部门
    major: '', // 计量专业
    verifierCertificateNo: '', // 证书号
    certificateStatus: '', // 证书状态
    limit: 999999,
    offset: 1,
  }
  getStaffList(params).then((res) => {
    standardOwnerOptions.value = res.data.records
  })
}
// 数据
const list = ref<object[]>([])
// 标准配套设备更换表格总数
const total = ref(0)
// 审批弹窗开关
const applyShow = ref(false)
// 审批弹窗信息收集类型
interface applyListType {
  select: string
  epilog: string
  approval: string
  approvalTime: string
}
// 审批弹窗信息收集
const applyList = ref<applyListType>({
  select: '',
  epilog: '',
  approval: '', // 审批内容
  approvalTime: '', // 审批时间
})
// 标准配套设备表头类型
interface columnsType {
  text: string // 表头名称
  value: string // 内容
  align: string // 对齐方式
  required: Boolean // 是否必填
  choose: Boolean // 是否有按钮
  time: Boolean // 是否是时间选择框
}

// 标准配套设备更换表头
const columns = ref<columnsType[]>([
  {
    text: '设备名称',
    value: 'equipmentName',
    align: 'center',
    required: true,
    choose: true,
    time: false,
  },
  {
    text: '设备编号',
    value: 'equipmentNo',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '型号',
    value: 'modelNo',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '测量范围',
    value: 'mesureRange',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '使用部门',
    value: 'useDept',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '检定时间',
    value: 'mesureDate',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '检定结果',
    value: 'mesureResult',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '有效日期',
    value: 'validDate',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
])
// 标准配套设备更换查询条件
const listQuery = ref<object>({
  limit: 10,
  offset: 1,
})
// 标准配套设备更换表格loding
const loadingTable = ref(false)
// 申请文档表头
const columnsFiles = ref<columnsType[]>([
  {
    text: '文件名称',
    value: 'fileName',
    align: 'center',
    required: true,
    choose: false,
    time: false,
  },
  {
    text: '上传时间',
    value: 'createTime',
    align: 'center',
    required: true,
    choose: false,
    time: true,
  },
  {
    text: '文件说明',
    value: 'remark',
    align: 'center',
    required: true,
    time: false,
    choose: false,
  },
  {
    text: '附件文档',
    value: 'minioFileName',
    align: 'center',
    required: true,
    time: false,
    choose: true,
  },
])
// 标准配套设备更换表格分页
const changePage = () => {}
getStandardOwnerOptions()
// 添加表格数据对象
const addList = ref({})
// 添加表格弹窗开关
const dialogVisible = ref(false)
// 选择标准装置数据列表下拉框类型
interface standardListType {
  id: string
  standardName: string
}
// 选择标准装置数据列表下拉框
const standardList = ref<standardListType[]>([])
// 初始化路由
const $router = useRouter()
// 关闭
const close = () => {
  $router.back()
}
// 表单验证规则
const rules = ref({
  standardName: [{ required: true, message: '标准名称不能为空', trigger: ['blur', 'change'] }],
  projectNo: [{ required: true, message: '项目编号不能为空', trigger: ['blur', 'change'] }],
  constructionStandardProject: [{ required: true, message: '建标项目不能为空', trigger: ['blur', 'change'] }],
  organizeNo: [{ required: true, message: '组织机构代码不能为空', trigger: ['blur', 'change'] }],
  constructionStandardUnitName: [{ required: true, message: '建标单位名称不能为空', trigger: ['blur', 'change'] }],
  standardOwner: [{ required: true, message: '标准负责人不能为空', trigger: ['blur', 'change'] }],
  contactInfo: [{ required: true, message: '联系方式不能为空', trigger: ['blur', 'change'] }],
  category: [{ required: true, message: '类 别不能为空', trigger: ['blur', 'change'] }],
  standardLevel: [{ required: true, message: '标准等级不能为空', trigger: ['blur', 'change'] }],
  transmitRange: [{ required: true, message: '传递范围不能为空', trigger: ['blur', 'change'] }],
  preparationDate: [{ required: true, message: '筹建日期不能为空', trigger: ['blur', 'change'] }],
  managerState: [{ required: true, message: '管理状态不能为空', trigger: ['blur', 'change'] }],
  measureMajor: [{ required: true, message: '计量专业不能为空', trigger: ['blur', 'change'] }],
  assessmentUnit: [{ required: true, message: '考核单位不能为空', trigger: ['blur', 'change'] }],
  assessDate: [{ required: true, message: '考核日期不能为空', trigger: ['blur', 'change'] }],
  uncertainty: [{ required: true, message: '不确定度不能为空', trigger: ['blur', 'change'] }],
  mesureRange: [{ required: true, message: '测量范围不能为空', trigger: ['blur', 'change'] }],
  standardTemperature: [{ required: true, message: '标准温度不能为空', trigger: ['blur', 'change'] },
    { pattern: /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/, message: '标准温度只能为数字', trigger: ['blur', 'change'] }],
  standardHumidity: [
    { required: true, message: '标准湿度不能为空', trigger: ['blur', 'change'] },
    { pattern: /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/, message: '标准湿度只能为数字', trigger: ['blur', 'change'] }],
})
// 第几条数据选择
const listIndex = ref(0)

// 文件上传点击对象
interface uploadIndexRowType {
  $index: number
}
// 文件上传点击第几行
const uploadIndex = (row: uploadIndexRowType) => {
  listIndex.value = row.$index
}
// 上传请求
const uploadQuarterlyEvaluateFile = (file: UploadRequestOptions) => {
  console.log(file)
  const fd = new FormData()
  fd.append('multipartFile', file.file)
  UploadFile(fd).then((res) => {
    if (res.code === 200) {
      fromListInfo.value.fileList[listIndex.value].minioFileName = res.data[0]
      // 重置当前验证
      ElMessage.success('文件上传成功')
      fromListInfo.value.fileList[listIndex.value].choose = true
    }
  })
}
// 选择标准配套设备
const equipmentDialog = ref()
// 点击标准配套设备选择按钮
const chooseList = (row: object, index: number) => {
  listIndex.value = index
  equipmentDialog.value.initDialog()
}
// 测试数据
const simulateObject = {
  data: dayjs(`${new Date()}`).format('YYYY.MM.DD'), // 有效日期
  certificateNo: '199926465422', // 证书编号
  authorityOfIssue: 'xxx公司', // 发证单位
  authorityOfDate: dayjs(`${new Date()}`).format('YYYY.MM.DD'), // 发证日期
}
// 点击增加行
const addRoow = () => {
  // 判断applyEquipmentList上一条数据是否填写
  if (
    fromListInfo.value.applyEquipmentList.length >= 1
    && fromListInfo.value.applyEquipmentList[
      fromListInfo.value.applyEquipmentList.length - 1
    ].equipmentId === ''
  ) {
    ElMessage.warning('请完善上一条设备信息')
  }
  else {
    fromListInfo.value.applyEquipmentList.push({
      equipmentId: '',
      standardApplyId: '',
    })
    fromListInfo.value.fixedAssetsList.push({ id: '' })
  }
}
// 选择设备之后
const equipmentAddRow = (data: IFixedAssetsList) => { // 类型标注
  fromListInfo.value.fixedAssetsList[listIndex.value] = data
  fromListInfo.value.applyEquipmentList[listIndex.value].equipmentId = data.id
  fromListInfo.value.applyEquipmentList[listIndex.value].standardApplyId
    = infoId.value || ''
}
// 增加申请文档列表
const addRow = () => {
  if (
    fromListInfo.value.fileList.length >= 1
    && !fromListInfo.value.fileList[fromListInfo.value.fileList.length - 1]
      .fileName
  ) {
    ElMessage.warning('请完善上一条文件信息')
  }
  else {
    fromListInfo.value.fileList.push({ minioFileName: '', choose: false })
  }
}
// 点击文件预览
const uploadShow = (e: any) => {
  const URL = window.URL || window.webkitURL
  window.open(URL.createObjectURL(e.raw))
}

// 表格选中的数组
const SelectionList = ref<object[]>([])
// 标准实验室发生改变row类型
interface rowReturn {
  phone: string
  director: string
  deptId: string
  organizeName: string
  id: string
}
// 标准实验室发生改变
const changeDeptList = (row: rowReturn) => {}
// 标准实验室清空时
const clearDeptList = () => {}
// 文件上传点击对象
interface fileListItemType {
  choose: boolean
}
// 获取详情信息
const getInfo = (id: string | number) => {
  getStandardLisdetali({ id }).then((res) => {
    // 判断下拉框返回的数据是否是number类型，如果是就得转成string类型
    Object.keys(res.data).map((item) => {
      if (typeof res.data[item] === 'number') {
        res.data[item] = res.data[item].toString()
      }
    })
    // 给数据对象赋值
    formInline.value = res.data.meterStandardEquipment
    // 拿到当前的标准设备id
    fromListInfo.value.standardEquipmentId = res.data.id
    // 拿到当前的设备信息
    fromListInfo.value.fixedAssetsList = res.data.fixedAssetsList
    // 给文件对象里面每条数据添加一个boolean值方便下面渲染组件使用
    fromListInfo.value.fileList = res.data.fileList.map((item: fileListItemType) => {
      item.choose = true
      return item
    })
  })
}
// 只要不是新增的数据都得获取到详情信息
if (pageType.value !== 'add') {
  getInfo(infoId.value)
}

// 取消
const handleCancel = () => {
  const params = {
    taskId: fromListInfo.value.taskId!, // 任务id
    comments: '', // 取消内容
  }
  ElMessageBox.confirm('确认取消该审批吗？', '提示', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    type: 'warning',
  }).then(() => {
    submitApproval('revoke', params).then((res) => {
      ElMessage({
        type: 'success',
        message: '取消成功',
      })
    })
  })
}
// 点击数据后的操作按钮
const clickBtn = (buttonType: string) => {
  switch (buttonType) {
    case '同意':
      approvalDialog.value.initDialog('agree', fromListInfo.value.taskId)
      break
    case '驳回':
      approvalDialog.value.initDialog('reject', fromListInfo.value.taskId)
      break
    case '拒绝':
      approvalDialog.value.initDialog('refuse', fromListInfo.value.taskId)
      break
    case '取消':
      handleCancel()
      break
  }
}
// 保存后的id
const addId = ref('')
// 点击顶部一排按钮
const getAddList = async (item: string, formEl: FormInstance | undefined) => {
  if (item === '保存' && pageType.value === 'add') {
    if (!formEl) {
      return
    }
    await formEl.validate((valid, fields) => {
      if (valid) {
        ElMessageBox.confirm('确认保存吗？', '提示', {
          confirmButtonText: '确认',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          getStandardLisAdd(fromListInfo.value).then((res) => {
            if (res.code === 200) {
              ElMessage.success('保存成功')
              addId.value = res.data.id
            }
          })
        })
      }
    })
  }
  else if (item === '保存' && pageType.value === 'edit') {
    if (!formEl) {
      return
    }
    await formEl.validate((valid, fields) => {
      if (valid) {
        ElMessageBox.confirm('确认保存吗？', '提示', {
          confirmButtonText: '确认',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          updateStandardEquipmentApply(fromListInfo.value).then((res) => {
            if (res.code === 200) {
              ElMessage.success('保存成功')
              addId.value = res.data.id
            }
          })
        })
      }
    })
  }
  else if (item === '提交') {
    if (addId.value === '') {
      ElMessage.warning('请先保存')
    }
    else {
      submitStandardEquipmentApply({
        id: addId.value,
        formId: formId.value,
      }).then((res) => {
        if (res.code === 200) {
          close()
        }
      })
    }
  }
  else {
    clickBtn(item)
  }
}
// 审批完成后的回调
const approvalSuccess = () => {}
// 选择标准装置弹窗ref
const standarDialog = ref()
// 选择了标准名称后
const standardChange = () => {
  standarDialog.value.initDialog()
}

// 点击关闭
const handleClose = () => {
  dialogVisible.value = false
}
// 标准配套设备更换表格删除行
const removeRow = (type: string) => {
  if (SelectionList.value.length > 0) {
    ElMessageBox.confirm('确认删除选中的数据吗？', '提示', {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: 'warning',
    }).then(() => {
      if (type == '1') {
        // 删除行
        fromListInfo.value.fixedAssetsList = fromListInfo.value.fixedAssetsList.filter((item) => {
          return !SelectionList.value.includes(item)
        })
        fromListInfo.value.applyEquipmentList = fromListInfo.value.fixedAssetsList.filter((item) => {
          return !SelectionList.value.includes(item)
        })
        ElMessage.success('删除成功')
      }
      else {
        // 删除行
        fromListInfo.value.fileList = fromListInfo.value.fileList.filter(
          (item) => {
            return !SelectionList.value.includes(item)
          },
        )
        ElMessage.success('删除成功')
      }
    })
  }
  else {
    ElMessage.warning('请先选择需要删除的数据')
  }
}
// 表格多选框
const handleSelectionChange = (e: any) => {
  SelectionList.value = e
}
watch(
  () => formInline.value,
  (newVal) => {
    // 变化后存储
  },
  { deep: true, immediate: true },
)
// 审批弹窗的关闭
const applyListClose = () => {
  applyShow.value = false
}
// 审批弹窗的提交
const applyListSubmit = () => {
  console.log(applyList.value)
  if (applyList.value.select == '') {
    return ElMessage.error('必须选择审批意见')
  }
  applyListClose()
}
// 标准装置发生改变data类型
interface dataReturn {
  id: string
}
// 获取详情信息
const getStandarInfo = (id: string | number) => {
  getStandardListDetail({ id }).then((res) => {
    Object.keys(res.data).map((item) => {
      if (typeof res.data[item] === 'number') {
        res.data[item] = res.data[item].toString()
      }
    })
    formInline.value = res.data
    fromListInfo.value.standardEquipmentId = res.data.id
  })
}
// 选择标准装置完成之后
const StandarAddRow = (data: dataReturn) => {
  getStandarInfo(data.id)
}

onMounted(async () => {
  fromListInfo.value.processId = $route.query.processId as string // 任务id
})
</script>

<template>
  <app-container>
    <detail-page :title="`${$route.meta.title} -- ${textMap[pageType]}`">
      <template #btns>
        <el-button
          v-for="(item, index) in buttonArray"
          :key="index"
          type="primary"
          @click="getAddList(item, ruleFormRef)"
        >
          {{ item }}
        </el-button>
        <el-button type="info" @click="close">
          关闭
        </el-button>
      </template>
      <el-form
        ref="ruleFormRef"
        :model="formInline"
        label-position="right"
        label-width="auto"
        :rules="rules"
      >
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="标准名称:" prop="standardName">
              <el-input
                v-model="formInline.standardName"
                :placeholder="pageType === 'detail' ? '' : '请选择标准装置名称'"
                class="input"
                :disabled="pageType === 'detail'"
              >
                <template v-if="pageType !== 'detail'" #append>
                  <el-button
                    size="small"
                    :disabled="pageType === 'detail'"
                    @click="standardChange"
                  >
                    选择
                  </el-button>
                </template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准代码:">
              <el-input
                v-model.trim="formInline.standardNo"
                class="full-width-input"
                placeholder="系统编号，自动生成"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="项目编号:" prop="projectNo">
              <el-input
                v-model.trim="formInline.projectNo"
                :placeholder="pageType === 'detail' ? '' : '项目编号'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="建标项目:" prop="constructionStandardProject">
              <el-input
                v-model.trim="formInline.constructionStandardProject"
                :placeholder="pageType === 'detail' ? '' : '建标项目'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="组织机构代码:" prop="organizeNo">
              <el-input
                v-model.trim="formInline.organizeNo"
                :placeholder="pageType === 'detail' ? '' : '组织机构代码'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item
              label="建标单位名称:"
              prop="constructionStandardUnitName"
            >
              <el-input
                v-model.trim="formInline.constructionStandardUnitName"
                :placeholder="pageType === 'detail' ? '' : '建标单位名称'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准负责人:" prop="standardOwner">
              <el-select
                v-model="formInline.standardOwner"
                clearable
                :placeholder="pageType === 'detail' ? '' : '标准负责人'"
                size="default"
                style="width: 100%;"
                disabled
              >
                <el-option
                  v-for="item in standardOwnerOptions"
                  :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="contactInfo">
              <el-input
                v-model.trim="formInline.contactInfo"
                :placeholder="pageType === 'detail' ? '' : '联系方式'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="类 别:" prop="category">
              <el-select
                v-model="formInline.category"
                clearable
                :placeholder="pageType === 'detail' ? '' : '类别'"
                style="width: 100%;"
                size="default"
                disabled
              >
                <el-option
                  v-for="item in checkTypeOptions"
                  :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="standardLevel">
              <el-select
                v-model.trim="formInline.standardLevel"
                clearable
                :placeholder="pageType === 'detail' ? '' : '标准等级'"
                style="width: 100%;"
                size="default"
                disabled
              >
                <el-option
                  v-for="item in standardLevelList"
                  :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="transmitRange">
              <el-select
                v-model.trim="formInline.transmitRange"
                clearable
                :placeholder="pageType === 'detail' ? '' : '传递范围'"
                style="width: 100%;"
                size="default"
                disabled
              >
                <el-option
                  v-for="item in transmitRangeList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="投资总额:">
              <el-input
                v-model.trim="formInline.totalInvestment"
                :placeholder="pageType === 'detail' ? '' : '投资总额'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="筹建日期:" prop="preparationDate">
              <el-date-picker
                v-model="formInline.preparationDate"
                type="date"
                :placeholder="pageType === 'detail' ? '' : '筹建日期'"
                style="width: 100%;"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准所在实验室:">
              <el-select
                v-model="formInline.standardLaboratory"
                clearable
                :placeholder="pageType === 'detail' ? '' : '标准所在实验室'"
                style="width: 100%;"
                size="default"
                disabled
                @clear="clearDeptList"
              >
                <el-option
                  v-for="item in standardUsersDeptList"
                  :key="item.id"
                  :label="item.organizeName"
                  :value="item.deptId"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="实验室负责人:">
              <el-input
                v-model.trim="formInline.laboratoryOwner"
                :placeholder="pageType === 'detail' ? '' : '实验室负责人'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="联系方式:">
              <el-input
                v-model.trim="formInline.laboratoryOwnerContact"
                :placeholder="pageType === 'detail' ? '' : '联系方式'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="管理状态:" prop="managerState">
              <el-select
                v-model="formInline.managerState"
                clearable
                :placeholder="pageType === 'detail' ? '' : '管理状态'"
                style="width: 100%;"
                size="default"
                disabled
              >
                <el-option
                  v-for="item in standardManagerStateList"
                  :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="measureMajor">
              <el-select
                v-model="formInline.measureMajor"
                clearable
                :placeholder="pageType === 'detail' ? '' : '计量专业'"
                style="width: 100%;"
                size="default"
                disabled
              >
                <el-option
                  v-for="item in measureMajorList"
                  :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="assessmentUnit">
              <el-input
                v-model.trim="formInline.assessmentUnit"
                :placeholder="pageType === 'detail' ? '' : '考核单位'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="考核日期:" prop="assessDate">
              <el-date-picker
                v-model="formInline.assessDate"
                type="datetime"
                style="width: 100%;"
                :placeholder="pageType === 'detail' ? '' : '考核日期'"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="不确定度:" prop="uncertainty">
              <el-input
                v-model.trim="formInline.uncertainty"
                :placeholder="pageType === 'detail' ? '' : '不确定度'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="测量范围:" prop="mesureRange">
              <el-input
                v-model.trim="formInline.mesureRange"
                :placeholder="pageType === 'detail' ? '' : '测量范围'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="2">
            <el-form-item label="环境条件" />
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准温度(℃):" prop="standardTemperature">
              <el-input
                v-model.trim="formInline.standardTemperature"
                :placeholder="pageType === 'detail' ? '' : '标准温度℃'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准湿度(%):" prop="standardHumidity">
              <el-input
                v-model.trim="formInline.standardHumidity"
                :placeholder="pageType === 'detail' ? '' : '标准湿度%'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" class="marg">
          <el-col :span="6">
            <el-form-item label="有效日期:">
              <el-date-picker
                v-model="simulateObject.data"
                type="date"
                style="width: 100%;"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="证书编号:">
              <el-input v-model.trim="simulateObject.certificateNo" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发证单位:">
              <el-input
                v-model.trim="simulateObject.authorityOfIssue"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发证日期:">
              <el-date-picker
                v-model="simulateObject.authorityOfDate"
                type="date"
                style="width: 100%;"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="备注:">
              <el-input
                v-model.trim="formInline.remark"
                :placeholder="pageType === 'detail' ? '' : '备注'"
                class="full-width-input"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </detail-page>
    <detail-block title="标准配套设备更换">
      <template v-if="pageType !== 'detail'" #btns>
        <el-button v-if="pageType !== 'detail'" type="primary" @click="addRoow">
          增加行
        </el-button>
        <el-button
          v-if="pageType !== 'detail'"
          type="info"
          @click="removeRow('1')"
        >
          删除行
        </el-button>
      </template>
      <el-table
        :data="fromListInfo.fixedAssetsList"
        border
        style="width: 100%;"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          v-if="pageType !== 'detail'"
          type="selection"
          width="38"
        />
        <el-table-column align="center" label="序号" width="80" type="index" />
        <el-table-column
          v-for="item in columns"
          :key="item.value"
          :prop="item.value"
          :label="item.text"
          align="center"
        >
          <template #header>
            <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span>
          </template>
          <template
            v-if="item.text === '设备名称' && pageType !== 'detail'"
            #default="scope"
          >
            <el-input
              v-model="scope.row[item.value]"
              :placeholder="`${item.text}`"
              class="input"
            >
              <template v-if="item.choose" #append>
                <el-button
                  v-if="pageType !== 'detail'"
                  size="small"
                  @click="chooseList(scope.row, scope.$index)"
                >
                  选择
                </el-button>
              </template>
            </el-input>
          </template>
        </el-table-column>
      </el-table>
    </detail-block>
    <detail-block title="申请文档">
      <template v-if="pageType !== 'detail'" #btns>
        <el-button type="primary" @click="addRow">
          增加行
        </el-button>
        <el-button type="info" @click="removeRow('2')">
          删除行
        </el-button>
      </template>
      <el-table
        :data="fromListInfo.fileList"
        border
        style="width: 100%;"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          v-if="pageType !== 'detail'"
          type="selection"
          width="38"
        />
        <el-table-column align="center" label="序号" width="80" type="index" />
        <el-table-column
          v-for="item in columnsFiles"
          :key="item.value"
          :prop="item.value"
          :label="item.text"
          align="center"
        >
          <template #header>
            <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span>
          </template>
          <template #default="scope">
            <el-date-picker
              v-if="item.time && pageType !== 'detail'"
              v-model="scope.row[item.value]"
              type="datetime"
              placeholder="请选择上传时间"
              format="YYYY-MM-DD hh:mm:ss"
              value-format="YYYY-MM-DD h:m:s"
            />
            <show-photo
              v-else-if="
                scope.row.choose && scope.row.minioFileName && item.choose
              "
              :minio-file-name="scope.row.minioFileName"
            />
            <el-input
              v-else-if="!item.time && pageType !== 'detail'"
              v-model="scope.row[item.value]"
              :autofocus="true"
              style="height: 5vh;"
              :placeholder="`${item.text}`"
            >
              <template v-if="!scope.row.minioFileName && item.choose" #append>
                <el-upload
                  v-model:file-list="fileList"
                  :http-request="uploadQuarterlyEvaluateFile"
                >
                  <el-button
                    v-if="pageType !== 'detail'"
                    @click="uploadIndex(scope)"
                  >
                    上传
                  </el-button>
                </el-upload>
              </template>
            </el-input>
          </template>
        </el-table-column>
      </el-table>
    </detail-block>
    <div v-if="pageType === 'detail'">
      <detail-block title="审批流程">
        <!-- 审批流程 -->
        <approval-record :process-id="fromListInfo.processId" />
      </detail-block>
    </div>
  </app-container>
  <!-- 审批弹窗信息收集 -->
  <approval-dialog ref="approvalDialog" @on-success="approvalSuccess" />
  <!-- 选择标准装置弹窗 -->
  <standar-dialog ref="standarDialog" @add="StandarAddRow" />
  <!-- 选择设备弹窗 -->
  <equipment-dialog ref="equipmentDialog" @add="equipmentAddRow" />
</template>

<style lang="scss">
.el-upload-list {
  display: none !important;
}
</style>
