src/views/productionManagement/productionReporting/components/formDia.vue
@@ -7,7 +7,7 @@
            draggable
        @close="closeDia"
    >
      <el-form label-width="140px" label-position="top" :rules="rules" ref="formRef">
      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
        <el-table
          :data="reportList"
          border
@@ -27,9 +27,9 @@
              <span>{{ scope.row.schedulingNum }}</span>
            </template>
          </el-table-column>
          <el-table-column label="待生产数量" prop="pendingNum" width="100">
          <el-table-column label="待生产数量" prop="pendingFinishNum" width="100">
            <template #default="scope">
              <span>{{ scope.row.pendingNum }}</span>
              <span>{{ scope.row.pendingFinishNum }}</span>
            </template>
          </el-table-column>
          <el-table-column label="本次生产数量" prop="finishedNum" width="150">
@@ -122,11 +122,12 @@
const operationType = ref('')
const reportList = ref([])
const data = reactive({
  form: {},
  rules: {
      schedulingNum: [{ required: true, message: "请输入", trigger: "blur" },],
  },
});
const { rules } = toRefs(data);
const { form, rules } = toRefs(data);
// 打开弹框
const openDialog = (type, rows) => {
@@ -150,7 +151,7 @@
         productCategory: row?.productCategory ?? '',
         specificationModel: row?.specificationModel ?? '',
         schedulingNum: total,
         pendingNum: Math.max(total - autoFill, 0),
         pendingFinishNum: pendingFinish, // 保存原始的待报工数量
         finishedNum: autoFill,
         unitPrice: unitPrice,
         totalPrice: (autoFill * unitPrice).toFixed(2),
@@ -165,7 +166,11 @@
      row.finishedNum = row.schedulingNum;
      proxy.$modal.msgWarning('本次生产数量不可大于排产数量')
   }
   row.pendingNum = row.schedulingNum - row.finishedNum;
   // 验证本次生产数量不能大于待报工数量
   if (value > row.pendingFinishNum) {
      row.finishedNum = row.pendingFinishNum;
      proxy.$modal.msgWarning('本次生产数量不可大于待报工数量')
   }
   calculateTotalPrice(row);
}
@@ -192,6 +197,10 @@
      }
      if (item.finishedNum > item.schedulingNum) {
         proxy.$modal.msgError(`第${i + 1}行本次生产数量不可大于排产数量`);
         return;
      }
      if (item.finishedNum > item.pendingFinishNum) {
         proxy.$modal.msgError(`第${i + 1}行本次生产数量不可大于待报工数量`);
         return;
      }
      if (!item.schedulingUserId) {
@@ -237,9 +246,6 @@
// 关闭弹框
const closeDia = () => {
  if (proxy.$refs.formRef) {
    proxy.resetForm("formRef");
  }
  dialogFormVisible.value = false;
  reportList.value = [];
  emit('close')