Zhangbw пре 1 месец
родитељ
комит
b2e9bd8da5
1 измењених фајлова са 11 додато и 2 уклоњено
  1. 11 2
      src/pages/admin/shortPool.vue

+ 11 - 2
src/pages/admin/shortPool.vue

@@ -137,7 +137,14 @@ const request = (options) => {
       method: options.method || 'GET',
       data: options.data || {},
       header,
-      success: (res) => res.statusCode === 200 ? resolve(res.data) : reject(new Error((res.data && res.data.message) || '请求失败')),
+      success: (res) => {
+        if (res.statusCode === 200) {
+          resolve(res.data)
+        } else {
+          const errorMsg = (res.data && res.data.message) || '请求失败'
+          reject(new Error(errorMsg))
+        }
+      },
       fail: () => reject(new Error('网络异常'))
     })
   })
@@ -255,7 +262,9 @@ const clearSearch = () => {
   showSuggestions.value = false
 }
 
-const closeSuggestions = () => showSuggestions.value = false
+const closeSuggestions = () => {
+  showSuggestions.value = false
+}
 
 const handleAddFromSuggestion = async (item) => {
   if (stockList.value.some(s => s.code === item.code)) {