云
2 天以前 77e4c3d0201a83cf41b73d7bd7a79255759575f4
src/views/mes/pro/bagCode/modules/generate-form.vue
@@ -18,9 +18,9 @@
  const emit = defineEmits(["success"]);
  // 所选品种主计量单位类型:48千克/100千克 -> 每托 N 袋;吨 -> 无托盘直接输袋码数
  // 所选品种主计量单位类型:48袋/100袋 -> 每托 N 袋;吨 -> 无托盘直接输袋码数
  const unitType = ref("");
  const kgPerPallet = ref<number | null>(null);
  const bagsPerPallet = ref<number | null>(null);
  const isTon = ref(false);
  const unitTypeError = ref(false);
  const palletCountVal = ref<number | null>(null);
@@ -29,7 +29,7 @@
  /** 换算/配置提示文案 */
  const tipText = computed(() => {
    if (unitTypeError.value) {
      return "该品种主计量单位未配置类型(仅支持 48千克/100千克/吨),请先前往「计量单位」维护后重试";
      return "该品种主计量单位未配置类型(仅支持 48袋/100袋/吨),请先前往「计量单位」维护后重试";
    }
    if (!unitType.value) {
      return "";
@@ -39,7 +39,7 @@
        bagCountVal.value ? `,将生成 ${bagCountVal.value} 个袋码` : ""
      }`;
    }
    const per = kgPerPallet.value ?? 0;
    const per = bagsPerPallet.value ?? 0;
    const count = palletCountVal.value ?? 0;
    return `计量单位类型为「${unitType.value}」:每托 ${per} 袋${
      count > 0
@@ -61,7 +61,7 @@
        rules: "selectRequired",
      },
    ];
    if (kgPerPallet.value) {
    if (bagsPerPallet.value) {
      schema.push({
        fieldName: "palletCount",
        label: "托盘数",
@@ -110,7 +110,7 @@
  /** 选择品种后读取主计量单位类型,动态切换托盘数/袋码数输入 */
  async function handleItemChange(item?: MdmItemApi.Item) {
    unitType.value = "";
    kgPerPallet.value = null;
    bagsPerPallet.value = null;
    isTon.value = false;
    unitTypeError.value = false;
    palletCountVal.value = null;
@@ -123,9 +123,9 @@
        if (type === "吨") {
          isTon.value = true;
        } else {
          const matcher = /^(\d{1,5})千克$/.exec(type);
          const matcher = /^(\d{1,5})袋$/.exec(type);
          if (matcher) {
            kgPerPallet.value = Number(matcher[1]);
            bagsPerPallet.value = Number(matcher[1]);
          } else {
            unitTypeError.value = true;
          }
@@ -190,7 +190,7 @@
      modalApi.lock();
      try {
        unitType.value = "";
        kgPerPallet.value = null;
        bagsPerPallet.value = null;
        isTon.value = false;
        unitTypeError.value = false;
        palletCountVal.value = null;