Parcourir la source

增加loading

liudan il y a 2 mois
Parent
commit
89734a6976

BIN
dist.zip


+ 14 - 23
src/pages/entryWrite/page/Entry/prescription/addPrescription/customDiagnostics/grass/grass.vue

@@ -943,11 +943,8 @@ export default {
             return obj;
         },
 
-        // 保存
+        // 保存 todo loading
         addbtn: function (event) {
-            this.setData({
-                isLoading: true
-            });
             let { gList } = this;
             let obj = this.objadd();
             let requireData = [
@@ -982,9 +979,6 @@ export default {
             ];
             util.formRequire(requireData, (data) => {
                 if (data && data.length > 0) {
-                    this.setData({
-                        isLoading: false
-                    });
                     this.setData({
                         verification: 'Y'
                     });
@@ -994,21 +988,12 @@ export default {
                         context: this
                     });
                 } else {
-                    // 没有主诊断不允许保存
-                    if (!(this.diagData && this.diagData.mainDiagID === 'Y')) {
-                        this.setData({
-                            isLoading: false
-                        });
-                        Toast({
-                            type: 'fail',
-                            message: '没有主诊断,不允许保存',
-                            context: this
-                        });
-                        return;
-                    }
                     // 直接保存草药医嘱(03050054)
-                    this.setData({ isLoading: true });
-                    this.saveHerbalDirect(obj);
+                    this.setData({ 
+                        isLoading: true,
+                    }, () => {
+                        this.saveHerbalDirect(obj);
+                    });
                 }
             });
         },
@@ -1069,14 +1054,20 @@ export default {
                             context: this
                         });
                         setTimeout(() => {
+                            this.setData({ isLoading: false });
                             uni.navigateBack({ delta: 1 });
                         }, 800);
                     } else {
-                        this.setData({ isLoading: false });
+                        setTimeout(() => {
+                            this.setData({ isLoading: false });
+                        }, 300);
+                       
                     }
                 },
                 fail: function () {
-                    this.setData({ isLoading: false });
+                    setTimeout(() => {
+                        this.setData({ isLoading: false });
+                    }, 300);
                 }
             });
         },

+ 19 - 9
src/pages/entryWrite/page/Entry/prescription/prescription.vue

@@ -421,7 +421,7 @@
             </view>
             <view style="width: 100%; height: 120rpx;"></view>
         </view>
-        <button class="diagnostibutton" @tap="sureChange" v-if="!(wList.length === 0 && gList.length === 0 && jList.length === 0 && yList.length === 0)">确认医嘱</button>
+        <button :disabled="saveLoaing" class="diagnostibutton" @tap="sureChange" v-if="!(wList.length === 0 && gList.length === 0 && jList.length === 0 && yList.length === 0)">确认医嘱</button>
     </view>
 </template>
 <script module="m1" lang="wxs">
@@ -445,6 +445,7 @@ import messageUtil from '../../../../../utils/message.js';
 export default {
     data() {
         return {
+            saveLoaing: false,
             imgDomain: httpconfig.imgDomain,
             wnum: 0,
 
@@ -1415,12 +1416,17 @@ export default {
         sureChange: Util.debounce(function () {
             let { active } = this;
             if (active === 0) {
-                this.sureChange1();
+                this.setData({ 
+                    saveLoaing: true,
+                }, () => {
+                    this.sureChange1();
+                });
+                
             }
         }),
 
         // 西药
-        sureChange1: function () {
+        sureChange1:function () {
             let patientData = Cache.get('patientData');
             let userData = Cache.get('userData');
             let { admID } = patientData;
@@ -1516,14 +1522,18 @@ export default {
                         }
                     ]
                 },
-                success: function (res) {
+                fail: () => {
+                    this.setData({ 
+                      saveLoaing: false,
+                    });
+                },
+                success: (res)=> {
                     let errorCode = res.errorCode;
                     if (errorCode == '0') {
-                        this.setData(
-                            {
-                                wList: [] // 草药数据
-                            },
-                            () => {
+                        this.setData({
+                                wList: [], // 草药数据
+                                saveLoaing: false,
+                            },() => {
                                 Toast({
                                     type: 'success',
                                     message: '成功',