فهرست منبع

所属社区调整

XhuiCoder 1 سال پیش
والد
کامیت
22eda680d7
1فایلهای تغییر یافته به همراه23 افزوده شده و 14 حذف شده
  1. 23 14
      pages/createInfo/createInfo.vue

+ 23 - 14
pages/createInfo/createInfo.vue

@@ -267,7 +267,6 @@
 
       getAccessToken(this.callbackToken)
       window.addEventListener("message", e => {
-        console.log(e);
         if (e.data.data && e.data.data.arg.base64) {
           setTimeout(() => {
             uni.showLoading({
@@ -300,24 +299,34 @@
         }
       }, false)
     },
-    methods: {
-      mchntChange(mchnt) {
-        if (mchnt) {
-          getChildListByMchnt({ mchnt }).then(res => {
-            if (res.code !== 200) return
-            const { data } = res
+    watch: {
+      'baseFormData.mchnt': {
+        immediate:true,
+        handler(newVal, oldVal) {
+          if (newVal) {
+            getChildListByMchnt({ mchnt: newVal }).then(res => {
+              if (res.code !== 200) return
+              const { data } = res
+              this.lrhjdzList = []
+              let str1 = JSON.stringify(data).replaceAll('code', 'value').replaceAll('label', 'text').replaceAll('null', '')
+              this.lrhjdzList = JSON.parse(str1)
+            })
+          } else {
             this.lrhjdzList = []
-            let str1 = JSON.stringify(data).replaceAll('code', 'value').replaceAll('label', 'text').replaceAll('null', '')
-            this.lrhjdzList = JSON.parse(str1)
-          })
-        } else {
-          this.lrhjdzList = []
-          this.baseFormData.lrHjdz = ''
+            this.baseFormData.lrHjdz = ''
+          }
         }
+      }
+    },
+    methods: {
+      mchntChange(mchnt) {
+        // console.log(mchnt);
       },
       lrhjdzChange(e) {
         const { value } = e.detail
-        this.baseFormData.lrHjdz = value[value.length - 1].value
+        if (value.length > 0) {
+          this.baseFormData.lrHjdz = value[value.length - 1].value
+        }
       },
       lrhjdzNodeClick(e) {
         // console.log(e);