zhou zhou
2 天以前 199204790315e6506615bec384455f6b88c32f26
rsf-design/src/views/orders/preparation/preparationPage.helpers.js
@@ -1,3 +1,5 @@
import { $t } from '@/locales'
const PREPARATION_STATUS_META = {
  8: { text: '取消', type: 'danger' },
  10: { text: '初始化', type: 'info' },
@@ -35,30 +37,38 @@
function normalizeStatusMeta(exceStatus, exceStatusText) {
  if (exceStatusText) {
    return PREPARATION_STATUS_META[Number(exceStatus)] || {
      text: exceStatusText,
      type: 'info'
    }
    return (
      PREPARATION_STATUS_META[Number(exceStatus)] || {
        text: exceStatusText,
        type: 'info'
      }
    )
  }
  return PREPARATION_STATUS_META[Number(exceStatus)] || {
    text: normalizeText(exceStatus) || '--',
    type: 'info'
  }
  return (
    PREPARATION_STATUS_META[Number(exceStatus)] || {
      text: normalizeText(exceStatus) || '--',
      type: 'info'
    }
  )
}
function normalizeRleStatusMeta(rleStatus, rleStatusText) {
  if (rleStatusText) {
    return PREPARATION_RLE_STATUS_META[Number(rleStatus)] || {
      text: rleStatusText,
      type: 'info'
    }
    return (
      PREPARATION_RLE_STATUS_META[Number(rleStatus)] || {
        text: rleStatusText,
        type: 'info'
      }
    )
  }
  return PREPARATION_RLE_STATUS_META[Number(rleStatus)] || {
    text: normalizeText(rleStatus) || '--',
    type: 'info'
  }
  return (
    PREPARATION_RLE_STATUS_META[Number(rleStatus)] || {
      text: normalizeText(rleStatus) || '--',
      type: 'info'
    }
  )
}
export function createPreparationSearchState() {
@@ -66,10 +76,14 @@
    condition: '',
    code: '',
    poCode: '',
    poId: '',
    wkType: '',
    exceStatus: '',
    rleStatus: '',
    anfme: '',
    qty: '',
    logisNo: '',
    arrTime: '',
    customerName: '',
    saleOrgName: '',
    memo: ''
@@ -85,6 +99,7 @@
    'poCode',
    'wkType',
    'logisNo',
    'arrTime',
    'customerName',
    'saleOrgName',
    'memo'
@@ -102,6 +117,12 @@
  if (params.rleStatus !== '' && params.rleStatus !== undefined && params.rleStatus !== null) {
    result.rleStatus = normalizeNumber(params.rleStatus)
  }
  ;['poId', 'anfme', 'qty'].forEach((key) => {
    if (params[key] !== '' && params[key] !== undefined && params[key] !== null) {
      result[key] = normalizeNumber(params[key])
    }
  })
  return result
}
@@ -164,7 +185,8 @@
    memo: normalizeText(record.memo) || '--',
    canComplete: Number(record.exceStatus) !== 15,
    canCancel: Number(record.exceStatus) === 10,
    canDelete: Number(record.exceStatus) !== 15
    canDelete: Number(record.exceStatus) !== 15,
    canPublic: Number(record.workQty || 0) < Number(record.anfme || 0)
  }
}
@@ -185,25 +207,33 @@
export function getPreparationActionList(row = {}) {
  const normalizedRow = normalizePreparationRow(row)
  return [
    { key: 'view', label: '查看详情', icon: 'ri:eye-line' },
    { key: 'print', label: '打印', icon: 'ri:printer-line' },
    { key: 'view', label: $t('common.actions.detail'), icon: 'ri:eye-line' },
    { key: 'items', label: $t('common.actions.items'), icon: 'ri:list-check-3' },
    {
      key: 'public',
      label: '下发执行',
      icon: 'ri:send-plane-line',
      color: 'var(--el-color-primary)',
      disabled: !normalizedRow.canPublic
    },
    { key: 'print', label: $t('common.actions.print'), icon: 'ri:printer-line' },
    {
      key: 'complete',
      label: '完成',
      label: $t('common.actions.complete'),
      icon: 'ri:check-line',
      color: 'var(--el-color-success)',
      disabled: !normalizedRow.canComplete
    },
    {
      key: 'cancel',
      label: '取消',
      label: $t('common.cancel'),
      icon: 'ri:close-circle-line',
      color: 'var(--el-color-danger)',
      disabled: !normalizedRow.canCancel
    },
    {
      key: 'delete',
      label: '删除',
      label: $t('common.actions.delete'),
      icon: 'ri:delete-bin-6-line',
      color: 'var(--el-color-danger)',
      disabled: !normalizedRow.canDelete
@@ -213,14 +243,14 @@
export function createPreparationDetailItemColumns() {
  return [
    { type: 'globalIndex', label: '序号', width: 72, align: 'center' },
    { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' },
    { prop: 'matnrCode', label: '物料编码', minWidth: 160, showOverflowTooltip: true },
    { prop: 'maktx', label: '物料名称', minWidth: 180, showOverflowTooltip: true },
    { prop: 'splrBatch', label: '供应商批次', minWidth: 140, showOverflowTooltip: true },
    { prop: 'splrName', label: '供应商', minWidth: 160, showOverflowTooltip: true },
    { prop: 'anfme', label: '应出数量', width: 100, align: 'right' },
    { prop: 'qty', label: '已出数量', width: 100, align: 'right' },
    { prop: 'memo', label: '备注', minWidth: 160, showOverflowTooltip: true }
    { prop: 'memo', label: $t('table.remark'), minWidth: 160, showOverflowTooltip: true }
  ]
}
@@ -248,3 +278,12 @@
    }
  }
}
export function buildPreparationGenerateWavePayload(rows = [], waveRuleId) {
  return {
    ids: Array.isArray(rows)
      ? rows.map((row) => Number(row?.id)).filter((id) => Number.isFinite(id))
      : [],
    waveRuleId: normalizeNumber(waveRuleId)
  }
}