aXin-0810 9 kuukautta sitten
vanhempi
commit
099dc8c81d
1 muutettua tiedostoa jossa 11 lisäystä ja 5 poistoa
  1. 11 5
      src/utils/selectOptionWebsit.js

+ 11 - 5
src/utils/selectOptionWebsit.js

@@ -1,15 +1,13 @@
 import { getWebsit } from '@/api/customerManagement.js'
 
-var AppVueThis = null
+window.AppVueThis = null
 
 export function setAppVueThis(e) {
-  console.log(e, 'lllllllllllllllllllllll')
   AppVueThis = e
 }
 
 export default function (pam = {}, option = [], placeholder = '请选择操作网点', errMsg = '请选择操作网点') {
   return new Promise((r, j) => {
-    console.log(AppVueThis)
     if (!AppVueThis) {
       j({})
       return
@@ -83,11 +81,19 @@ export default function (pam = {}, option = [], placeholder = '请选择操作
         })
     }
     if (option && option.length) {
-      tanchuang()
+      if (option.length == 1) {
+        r(option?.[0])
+      } else if (option.length > 1) {
+        tanchuang()
+      }
     } else {
       getWebsit({ status: true, ...pam }).then(res => {
         option = res.data
-        tanchuang()
+        if (option.length == 1) {
+          r(option?.[0])
+        } else if (option.length > 1) {
+          tanchuang()
+        }
       })
     }
   })