Browse Source

fix 修改作废接口的对接方式和 code 判断

ylong 4 tháng trước cách đây
mục cha
commit
758b4813e7
1 tập tin đã thay đổi với 12 bổ sung7 xóa
  1. 12 7
      src/views/code/record/components/invalid-modal.vue

+ 12 - 7
src/views/code/record/components/invalid-modal.vue

@@ -62,16 +62,21 @@ const handleConfirm = async () => {
 
     try {
         // 调用作废API(暂时使用假接口)
-        await mockInvalidApi({
+        mockInvalidApi({
             id: currentRecord.value.id,
             reason: selectedReason.value
+        }).then((res) => {
+            console.log('作废响应:', res);
+            if (res.data.code === 200) {
+                ElMessage.success('作废成功');
+                visible.value = false;
+
+                // 触发父组件刷新
+                emit('success');
+            } else {
+                ElMessage.error(res.data.msg || '作废失败');
+            }
         });
-
-        ElMessage.success('作废成功');
-        visible.value = false;
-
-        // 触发父组件刷新
-        emit('success');
     } catch (error) {
         console.error('作废失败:', error);
         ElMessage.error('作废失败');