gongchunyi
9 小时以前 b7bd9b9dfe27a188e72dd0c00163587a4a956cba
test: 默认选择第一个领料
已修改1个文件
29 ■■■■■ 文件已修改
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
@@ -189,7 +189,20 @@
  const currentMaterialSelectRowIndex = ref(-1);
  let materialTempId = 0;
  const createMaterialRow = (row = {}) => ({
  const getDefaultBatchNo = batchNoList => {
    if (!Array.isArray(batchNoList) || batchNoList.length === 0) return [];
    return [batchNoList[0]];
  };
  const createMaterialRow = (row = {}) => {
    const batchNoList = Array.isArray(row.batchNoList) ? row.batchNoList : [];
    const batchNo = row.batchNo
      ? typeof row.batchNo === "string"
        ? row.batchNo.split(",")
        : row.batchNo
      : getDefaultBatchNo(batchNoList);
    return {
    tempId: row.id || `temp_${++materialTempId}`,
    id: row.id,
    processId: row.processId || row.technologyOperationId,
@@ -202,13 +215,10 @@
    demandedQuantity: Number(row.requiredQty ?? row.demandedQuantity ?? 0),
    unit: row.unit || "",
    pickQty: Number(row.pickQty ?? row.pickQuantity ?? row.requiredQty ?? row.demandedQuantity ?? 0),
    batchNo: row.batchNo
      ? typeof row.batchNo === "string"
        ? row.batchNo.split(",")
        : row.batchNo
      : [],
    batchNoList: row.batchNoList || [],
  });
      batchNo,
      batchNoList,
    };
  };
  const getProcessOptions = async () => {
    if (!props.orderRow?.id) return;
@@ -329,7 +339,8 @@
      product.materialName || product.productName || product.name || "";
    row.materialModel = product.materialModel || product.model || "";
    row.unit = product.unit || product.measureUnit || "";
    row.batchNoList = product.batchNoList;
    row.batchNoList = Array.isArray(product.batchNoList) ? product.batchNoList : [];
    row.batchNo = getDefaultBatchNo(row.batchNoList);
    currentMaterialSelectRowIndex.value = -1;
    materialProductDialogVisible.value = false;
  };