spring
10 天以前 2a92b8a223d4875737b8062d177505263abcb6a3
fix: 投入数量编辑不成功,现在投入数量记录参数不能被删除
已修改3个文件
39 ■■■■ 文件已修改
src/views/productionManagement/productionRecords/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/components/ProductionRecordForm.vue 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionRecords/index.vue
@@ -83,6 +83,10 @@
const { proxy } = getCurrentInstance();
const { parameter_tyep } = proxy.useDict("parameter_tyep");
/** 系统内置参数「投入重量」,不可编辑、删除 */
const isLockedParam = (row) =>
  String(row?.parameterItem ?? "").trim() === "投入重量";
const tableColumn = ref([
  { label: "参数编码", prop: "code" },
  { label: "参数项", prop: "parameterItem" },
@@ -113,11 +117,13 @@
      {
        name: "编辑",
        type: "text",
        disabled: (row) => isLockedParam(row),
        clickFun: (row) => showEditModal(row),
      },
      {
        name: "删除",
        type: "text",
        disabled: (row) => isLockedParam(row),
        clickFun: (row) => handleDeleteRow(row),
      },
    ],
@@ -166,11 +172,13 @@
};
const showEditModal = (row) => {
  if (isLockedParam(row)) return;
  record.value = { ...row };
  isShowEditModal.value = true;
};
const handleDeleteRow = (row) => {
  if (isLockedParam(row)) return;
  proxy.$modal
    .confirm(`是否确认删除参数编码为"${row.code}"的数据?`)
    .then(() => del([row.id]))
src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
@@ -93,13 +93,19 @@
  weightItem.value = Number(((qty * coeff) / 1000).toFixed(4));
};
/** 非成型:投入重量取工单 bomInputQty */
const syncBomInputWeight = () => {
/** 非成型:投入重量取工单 bomInputQty(仅回显,不覆盖用户已编辑的值) */
const syncBomInputWeight = (force = false) => {
  if (props.isFormingProcess) return;
  const weightItem = formData.list.find(isInputWeightItem);
  if (!weightItem) return;
  const bom = props.bomInputQty;
  if (bom === null || bom === undefined || Number.isNaN(Number(bom))) {
    return;
  }
  const current = weightItem.value;
  const isEmpty =
    current === null || current === undefined || current === "";
  if (!force && !isEmpty) {
    return;
  }
  weightItem.value = Number(bom);
@@ -113,15 +119,22 @@
  }
};
const cloneParamList = (list) =>
  JSON.parse(JSON.stringify(list || []));
const initData = () => {
  formData.list = props.list || [];
  formData.list = cloneParamList(props.list);
  formData.list.forEach(item => {
    if (item.value === undefined) {
      item.value = null;
    }
  });
  loadDeviceName();
  syncInputWeight();
  if (props.isFormingProcess) {
    syncFormingInputWeight();
  } else {
    syncBomInputWeight(true);
  }
};
const submitData = async () => {
@@ -139,7 +152,7 @@
    () => {
      initData();
    },
    {immediate: true, deep: true}
    {immediate: true}
);
watch(
src/views/productionManagement/workOrder/index.vue
@@ -598,9 +598,11 @@
    return;
  }
  reportForm.quantity = num;
  nextTick(() => {
    productionRecordFormRef.value?.syncInputWeight?.();
  });
  if (isFormingProcess.value) {
    nextTick(() => {
      productionRecordFormRef.value?.syncInputWeight?.();
    });
  }
};
// 处理报废数量