张诺
2025-07-25 77bb73aaef8f85d961b373731a05361cbe6921de
src/views/equipment/management/mould/equipmentRequisitionDialog.vue
@@ -134,7 +134,7 @@
    </el-form>
    <template #footer>
      <el-button @click="handleClose">取消</el-button>
      <el-button type="primary" @click="handleSubmit" v-if="!isViewMode"
      <el-button type="primary" @click="debouncedSubmit" v-if="!isViewMode"
        >确定</el-button
      >
    </template>
@@ -320,6 +320,21 @@
  emit("update:modelValue", false);
}
// 通用防抖函数
function debounce(fn, delay = 800) {
  let timer = null;
  return function (...args) {
    if (timer) clearTimeout(timer);
    timer = setTimeout(() => {
      fn.apply(this, args);
      timer = null;
    }, delay);
  };
}
// 防抖后的提交方法
const debouncedSubmit = debounce(handleSubmit, 800);
function handleSubmit () {
  formRef.value.validate(async (valid) => {
    if (!valid) return;