Newer
Older
xc-business-system / src / views / business / taskMeasure / measureData / components / useSolveFormData.ts
/**
 * 详情处理表单数据
 * @param res 详情返回数据
 * @param templateFormAndTableRef 表单公共组件ref
 */
export function useSolveFormData(res: any, templateFormAndTableRef: any) {
  if (!templateFormAndTableRef) {
    return
  }
  // =========================表单组件数据============================================
  templateFormAndTableRef.form.dataNo = res.data.dataNo // 检定数据编号
  templateFormAndTableRef.form.measureCategory = res.data.measureCategory // 检校类别
  templateFormAndTableRef.form.measureCategoryName =
    res.data.measureCategoryName // 检校类别名称
  templateFormAndTableRef.form.customerName = res.data.customerName // 委托单位
  templateFormAndTableRef.form.customerAddress = res.data.customerAddress // 委托单位地址
  templateFormAndTableRef.form.traceDate = res.data.traceDate // 测试、校准或检定日期
  templateFormAndTableRef.form.measureValidDate = res.data.measureValidDate // 检定有效期
  templateFormAndTableRef.form.measureAddress = res.data.measureAddress // 测试、校准或检定地点
  templateFormAndTableRef.form.temperature = res.data.temperature // 温度
  templateFormAndTableRef.form.humidity = res.data.humidity // 相对湿度
  templateFormAndTableRef.form.orderId = res.data.orderId // 任务单id
  templateFormAndTableRef.form.orderNo = res.data.orderNo // 任务单编号
  templateFormAndTableRef.form.createUserId = res.data.createUserId // 检定员id
  templateFormAndTableRef.form.createUserName = res.data.createUserName // 检定员
  templateFormAndTableRef.form.dataSource = res.data.dataSource // 数据来源
  templateFormAndTableRef.form.conclusion = res.data.conclusion // 结论
  templateFormAndTableRef.form.restrictionInstruction =
    res.data.restrictionInstruction // 限用说明
  templateFormAndTableRef.form.itemCategoryName = res.data.itemCategoryName // 设备检定项分类名称
  templateFormAndTableRef.form.itemCategoryId = res.data.itemCategoryId // 设备检定项分类名称id
  templateFormAndTableRef.form.itemId = res.data.itemId

  templateFormAndTableRef.form.meterIdentify = res.data.meterIdentify // 计量标识
  templateFormAndTableRef.form.labCode = res.data.labCode // 实验室
  templateFormAndTableRef.form.groupCode = res.data.groupCode // 部门
  templateFormAndTableRef.form.originalRecordFile = res.data.originalRecordFile // 原始记录附件
  templateFormAndTableRef.form.certificateFile = res.data.certificateFile // 检定证书附件
  templateFormAndTableRef.form.remark = res.data.remark // 测试结果(专用于多功能电气安全)
  templateFormAndTableRef.form.technologyFile =
    res.data.technologyFile.split(',')
  templateFormAndTableRef.form.constCertificateExcelData =
    res.data.constCertificateExcelData // 检校证书 --const检定证书文件base64 / 非已定义检定项分类时上传的检定证书minio存储文件名
  templateFormAndTableRef.form.constRecordExcelData =
    res.data.constRecordExcelData // 原始记录 -- const原始记录文件base64 / 非已定义检定项分类时上传的原始记录minio存储文件名

  templateFormAndTableRef.helpInstruction = res.data.helpInstruction // 辅助字段
  templateFormAndTableRef.helpFieldInstruction = res.data.helpFieldInstruction // 辅助字段说明

  // ============================被检件信息=============================================================
  templateFormAndTableRef.sampleList = [
    {
      // 被检设备
      sampleId: res.data.sampleId, // 设备id
      sampleName: res.data.sampleName, // 设备名称
      sampleModel: res.data.model, // 规格型号
      manufactureNo: res.data.manufactureNo, // 出厂编号
      manufacturer: res.data.manufacturer, // 制造厂家(生产厂家)
      categoryName: res.data.itemCategoryName, // 设备检定项分类
      helpInstruction: res.data.helpInstruction, // 辅助字段
      helpFieldInstruction: res.data.helpFieldInstruction // 辅助字段说明
    }
  ]
  // ==============================测量设备====================================================================
  templateFormAndTableRef.measureEquipmentList = res.data.equipmentList.map(
    (item: any) => {
      return {
        ...item,
        id: item.equipmentId
      }
    }
  ) // 所使用的标准,主要测量设备
}