spring
7 天以前 50f0b958546caee7f929b28c1f5ad0daa2637751
fix: 优化质量管理
已修改4个文件
91 ■■■■■ 文件已修改
src/pages/consumablesLogistics/stockReport/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/inventoryManagement/stockReport/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/qualityManagement/nonconformingManagement/form.vue 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/qualityManagement/nonconformingManagement/index.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/consumablesLogistics/stockReport/index.vue
@@ -252,6 +252,10 @@
      openDatePicker("endMonth");
    }, 300);
  } else if (datePickerTarget.value === "endMonth") {
    if (searchForm.value.startMonth && !dayjs(`${str}-01`).isAfter(dayjs(`${searchForm.value.startMonth}-01`))) {
      uni.showToast({ title: "结束月份必须大于开始月份", icon: "none" });
      return;
    }
    searchForm.value.endMonth = str;
    showDatePicker.value = false;
    handleQuery();
@@ -262,6 +266,10 @@
      openDatePicker("endDate");
    }, 300);
  } else if (datePickerTarget.value === "endDate") {
    if (searchForm.value.startDate && !dayjs(str).isAfter(dayjs(searchForm.value.startDate))) {
      uni.showToast({ title: "结束日期必须大于开始日期", icon: "none" });
      return;
    }
    searchForm.value.endDate = str;
    showDatePicker.value = false;
    handleQuery();
src/pages/inventoryManagement/stockReport/index.vue
@@ -274,6 +274,10 @@
      openDatePicker('endMonth')
    }, 300)
  } else if (datePickerTarget.value === 'endMonth') {
    if (searchForm.value.startMonth && !dayjs(`${str}-01`).isAfter(dayjs(`${searchForm.value.startMonth}-01`))) {
      uni.showToast({ title: '结束月份必须大于开始月份', icon: 'none' })
      return
    }
    searchForm.value.endMonth = str
    showDatePicker.value = false
    handleQuery()
@@ -285,6 +289,10 @@
      openDatePicker('endDate')
    }, 300)
  } else if (datePickerTarget.value === 'endDate') {
    if (searchForm.value.startDate && !dayjs(str).isAfter(dayjs(searchForm.value.startDate))) {
      uni.showToast({ title: '结束日期必须大于开始日期', icon: 'none' })
      return
    }
    searchForm.value.endDate = str
    showDatePicker.value = false
    handleQuery()
src/pages/qualityManagement/nonconformingManagement/form.vue
@@ -189,6 +189,7 @@
const pageType = ref('add') // add | edit
const id = ref('')
const submitting = ref(false)
const editFallback = ref({})
const isEdit = computed(() => pageType.value === 'edit')
const pageTitle = computed(() => (isEdit.value ? '编辑不合格管理' : '新增不合格管理'))
@@ -366,6 +367,46 @@
  if (!id.value) return
  const res = await getQualityUnqualifiedInfo(id.value)
  const d = res?.data || {}
  const rawCheckType =
    d.checkType ??
    d.inspectType ??
    d.check_type ??
    d.inspect_type ??
    d.checkTypeLabel ??
    d.inspectTypeLabel
  let normalizedCheckType = undefined
  if (!(rawCheckType === undefined || rawCheckType === null || rawCheckType === '')) {
    const rawText = String(rawCheckType).trim()
    if (rawText === '入厂检') normalizedCheckType = 0
    else if (rawText === '车间检') normalizedCheckType = 1
    else if (rawText === '出厂检') normalizedCheckType = 2
    else {
      const n = Number(rawText)
      normalizedCheckType = Number.isNaN(n) ? undefined : n
    }
  }
  const normalizedBatchNo =
    d.batchNo ??
    d.batchNO ??
    d.batchNum ??
    d.batchNumber ??
    d.batch ??
    d.inboundBatches ??
    d.lotNo ??
    d.lotNumber ??
    editFallback.value?.batchNo ??
    ''
  const fallbackCheckTypeRaw = editFallback.value?.checkType
  if (normalizedCheckType === undefined && !(fallbackCheckTypeRaw === undefined || fallbackCheckTypeRaw === null || fallbackCheckTypeRaw === '')) {
    const fallbackText = String(fallbackCheckTypeRaw).trim()
    if (fallbackText === '入厂检') normalizedCheckType = 0
    else if (fallbackText === '车间检') normalizedCheckType = 1
    else if (fallbackText === '出厂检') normalizedCheckType = 2
    else {
      const n = Number(fallbackText)
      normalizedCheckType = Number.isNaN(n) ? undefined : n
    }
  }
  Object.assign(form, {
    id: d.id,
    productId: d.productId,
@@ -373,9 +414,10 @@
    productModelId: d.productModelId ?? d.modelId ?? d.productModeId ?? '',
    model: d.model,
    unit: d.unit,
    batchNo: d.batchNo,
    // 兼容后端返回字段:优先 checkType,其次 inspectType
    checkType: d.checkType ?? d.inspectType,
    // 兼容后端返回字段:batchNo/batchNum/lotNo 等
    batchNo: normalizedBatchNo,
    // 兼容后端返回字段:checkType/inspectType 等,统一为 number
    checkType: normalizedCheckType,
    checkName: d.checkName,
    checkTime: d.checkTime,
    defectivePhenomena: d.defectivePhenomena,
@@ -423,6 +465,13 @@
onLoad(async (options) => {
  pageType.value = options?.type || 'add'
  id.value = options?.id || ''
  if (options?.fallback) {
    try {
      editFallback.value = JSON.parse(decodeURIComponent(options.fallback))
    } catch (e) {
      editFallback.value = {}
    }
  }
  form.dealResult = getScrapDealResultValue()
  await loadUsers()
  if (isEdit.value) {
src/pages/qualityManagement/nonconformingManagement/index.vue
@@ -377,14 +377,22 @@
};
const openForm = (type, row) => {
  if (type === 'edit' && !hasNonconformingEdit.value) return
  if (type !== 'add' && row?.inspectState == 1) {
    toast('已处理的数据不能再编辑')
    return
  }
  // if (type === 'edit' && !hasNonconformingEdit.value) return
  // if (type !== 'add' && row?.inspectState == 1) {
  //   toast('已处理的数据不能再编辑')
  //   return
  // }
  const id = row?.id
  let fallback = ''
  if (row) {
    const fallbackData = {
      batchNo: row.batchNo ?? '',
      checkType: row.checkType ?? row.inspectType ?? ''
    }
    fallback = `&fallback=${encodeURIComponent(JSON.stringify(fallbackData))}`
  }
  uni.navigateTo({
    url: `/pages/qualityManagement/nonconformingManagement/form?type=${type}${id ? `&id=${id}` : ''}`
    url: `/pages/qualityManagement/nonconformingManagement/form?type=${type}${id ? `&id=${id}` : ''}${fallback}`
  })
}