From 946dae0a8885b529e7755788ba7872503d9f9d9d Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期二, 20 八月 2024 18:09:31 +0800
Subject: [PATCH] 按钮点击操作成功再有效

---
 pages/modal/3018_2.vue |   20 ++++-
 pages/modal/5602.vue   |   49 +++++++++---
 pages/modal/5601.vue   |   20 +++-
 pages/modal/3037_2.vue |   22 ++++-
 pages/modal/3200.vue   |   32 ++++---
 pages/modal/5600.vue   |   45 ++++++++---
 6 files changed, 134 insertions(+), 54 deletions(-)

diff --git a/pages/modal/3018_2.vue b/pages/modal/3018_2.vue
index b2bd8bb..ffa382f 100644
--- a/pages/modal/3018_2.vue
+++ b/pages/modal/3018_2.vue
@@ -130,7 +130,7 @@
 					</a>
 				</view>
 			</view>
-			<button type="default" @tap="sava" class="btn_add" v-if="dropdownBtns.length==0">{{title}}</button>
+			<button type="default" @tap="sava" class="btn_add" v-if="dropdownBtns.length==0" :class="saving?'btn_disabled':''" :disabled="saving">{{title}}</button>
 			<button type="default" @tap="cancel" class="btn_cancel">{{translateSys('cancel')}}</button>
 
 		</view>
@@ -197,7 +197,8 @@
 				activity: null,
 				receiver: null,
 				intentFilter: null,
-				content: ''
+				content: '',
+				saving:false
 			};
 		},
 		onNavigationBarButtonTap(e) {
@@ -1756,7 +1757,8 @@
 					title: this.translateSys("loading"),
 					mask: true
 				});
-				var obj_attr = this.head_styledef.form.model;
+				this.saving = true
+				var obj_attr = this.head_styledef.form.model || [];
 				console.log(obj_attr);
 				// var req = Object.keys(obj_attr).map((a) => ({
 				// 	name: a,
@@ -1818,6 +1820,7 @@
 										showCancel: false,
 										confirmText: this.translateSys("cancel")
 									});
+									this.saving = false
 									return;
 								}
 								if (action.info) {
@@ -1866,8 +1869,10 @@
 							confirmText: this.translateSys("cancel")
 						});
 					}
+					this.saving = false
 				}).catch(ex => {
 					console.log(ex);
+					this.saving = false
 					uni.hideLoading();
 					uni.showModal({
 						title: this.translateSys("tip"),
@@ -1878,6 +1883,7 @@
 				});
 			},
 			afterOK() {
+				this.saving = true
 				var obj_attr = this.head_styledef.form.model;
 				// console.log(obj_attr);
 				var input_param = {
@@ -1934,6 +1940,7 @@
 								showCancel: false,
 								confirmText: this.translateSys("cancel")
 							});
+							this.saving = false
 							return false
 						} else {
 							var tip = data.info ? typeof data.info == 'string' ? data.info : data
@@ -1958,8 +1965,10 @@
 							confirmText: this.translateSys("cancel")
 						});
 					}
+					this.saving = false
 				}).catch(ex => {
 					// console.log(ex);
+					this.saving = false
 					uni.showModal({
 						title: this.translateSys('tip') + "7.1",
 						content: ex.errMsg,
@@ -2274,7 +2283,10 @@
 				float: left;
 				display: inline-block;
 			}
-
+			.btn_disabled {
+				background-color: #ddd;
+				color: #888;
+			}
 			.btn_cancel {
 				width: 45%;
 				margin: 0 10rpx;
diff --git a/pages/modal/3037_2.vue b/pages/modal/3037_2.vue
index 5ef4a3f..de4968a 100644
--- a/pages/modal/3037_2.vue
+++ b/pages/modal/3037_2.vue
@@ -213,10 +213,10 @@
 		<view class="view-floor">
 			<button type="default" @tap="cancel" class="btn_cancel"
 				v-if="param.Sub_Cls.Can_Add_Delete == true">{{translateSys('cancel')}}</button>
-			<button type="default" @tap="sava" class="btn_add"
-				v-if="param.Sub_Cls.Can_Add_Delete == true">{{title}}</button>
-			<button type="default" @tap="sava" class="btn_sava"
-				v-else-if="param.Sub_Cls.Can_Add_Delete == false">{{title}}</button>
+			<button type="default" @tap="sava" class="btn_add" v-if="param.Sub_Cls.Can_Add_Delete == true"
+				:class="saving?'btn_disabled':''" :disabled="saving">{{title}}</button>
+			<button type="default" @tap="sava" class="btn_sava" v-else-if="param.Sub_Cls.Can_Add_Delete == false"
+				:class="saving?'btn_disabled':''" :disabled="saving">{{title}}</button>
 		</view>
 		<!-- 鏅�寮圭獥 top bottom center left right -->
 		<view>
@@ -279,6 +279,7 @@
 				detail1_styledef: {},
 				detail1StyleDefList: [],
 				activelist: [],
+				saving: false,
 			};
 		},
 		onLoad(options) {
@@ -806,7 +807,7 @@
 				// console.log(e.target);
 				var $this = this;
 				console.log(item);
-				if (item.oldvalue != item.value&& item.value.trim() != "") {
+				if (item.oldvalue != item.value && item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
 					$this.head_styledef.form.model[attr] = item.value;
@@ -845,7 +846,7 @@
 				console.log(item);
 				var $this = this;
 				console.log(item);
-				if (item.oldvalue != item.value&& item.value.trim() != "") {
+				if (item.oldvalue != item.value && item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
 					$this.head_styledef.form.model[attr] = item.value;
@@ -1848,6 +1849,7 @@
 					}); //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
 			},
 			scan_OKDataObjRunCustomEvent(eventID) {
+				this.saving = true
 				uni.showLoading({
 					title: this.translateSys("loading"),
 					mask: true
@@ -1946,6 +1948,7 @@
 								showCancel: false,
 								confirmText: this.translateSys("cancel")
 							});
+							this.saving =false
 							return false
 						} else {
 							var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join(
@@ -1976,8 +1979,10 @@
 							confirmText: this.translateSys("cancel")
 						});
 					}
+					this.saving = false
 				}).catch(ex => {
 					// console.log(ex);
+					this.saving = false
 					uni.hideLoading();
 					uni.showModal({
 						title: this.translateSys("error") + "8.1",
@@ -2278,6 +2283,11 @@
 			display: inline-block;
 		}
 
+		button.btn_disabled {
+			background-color: #ddd;
+			color: #888;
+		}
+
 		.class_attr_body .form-group {
 			margin: 20rpx 30rpx;
 			/* margin-left: -12px;
diff --git a/pages/modal/3200.vue b/pages/modal/3200.vue
index 1390f1d..79d9908 100644
--- a/pages/modal/3200.vue
+++ b/pages/modal/3200.vue
@@ -400,6 +400,7 @@
 					this.pageindex = 1;
 					this.page_size = 3;
 					this.query_id = "";
+					this.detail1StyleDefList = [];
 					await this.loadDataGetList();
 				}
 
@@ -1244,26 +1245,27 @@
 			},
 			//璺宠浆
 			async RelatedFunction(btn, style, enviroment) {
-
+				const defCode = btn.Related_Function?.Def_Code
+				var $this = this;
 				if (
-					btn.Related_Function?.Def_Code == "3018" ||
-					btn.Related_Function?.Def_Code == "3037" ||
-					btn.Related_Function?.Def_Code == "3200" ||
-					btn.Related_Function?.Def_Code == "3201" ||
-					btn.Related_Function?.Def_Code == "5600" ||
-					btn.Related_Function?.Def_Code == "5601" ||
-					btn.Related_Function?.Def_Code == "5602"
+					defCode == "3018" ||
+					defCode == "3037" ||
+					defCode == "3200" ||
+					defCode == "3201" ||
+					defCode == "5600" ||
+					defCode == "5601" ||
+					defCode == "5602"
 				) {
-					let name = btn.Related_Function?.Def_Code
-					if (btn.Related_Function?.Def_Code == "3018" || btn.Related_Function?.Def_Code == "3037")
-						name = btn.Related_Function?.Def_Code + "_2"
 
-					var $this = this;
+					let name = defCode
+					if (defCode == "3018" || defCode == "3037")
+						name = defCode + "_2"
 					var json = {
-						app_id: appId,
+						app_id: [btn.Related_Function.ID],
 					};
+					console.log("RelatedFunction2", json);
 					this.$store.dispatch('appGetInfo', json).then(success => {
-						// console.log(success);
+						console.log(success);
 						if (success.err_code == 0) {
 							if ((success.result || []).length > 0) {
 								const app = success.result[0]
@@ -1316,7 +1318,7 @@
 							});
 						}
 					}).catch(ex => {
-						// console.log(ex);
+						console.log(ex);
 						uni.showModal({
 							title: this.translateSys("error"),
 							content: ex.errMsg,
diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue
index 34a9ef2..d589191 100644
--- a/pages/modal/5600.vue
+++ b/pages/modal/5600.vue
@@ -94,7 +94,8 @@
 							<view class="view-bottom" v-if="param.Sub_Page[0].OK_Button==true">
 								<button type="default" @tap="cancel"
 									class="btn_cancel">{{translateSys('cancel')}}</button>
-								<button type="primary" @tap="ok" class="btn_add">{{translateSys('ok')}}</button>
+								<button type="primary" @tap="ok" class="btn_add" :class="okLoading?'btn_disabled':''"
+									:disabled="okLoading">{{translateSys('ok')}}</button>
 							</view>
 						</view>
 					</swiper-item>
@@ -143,7 +144,8 @@
 							<view class="view-bottom" v-if="param.Sub_Page[1].OK_Button==true"> <!--  -->
 								<button type="default" @tap="cancel"
 									class="btn_cancel">{{translateSys('cancel')}}</button>
-								<button type="primary" @tap="ok2" class="btn_add">{{translateSys('ok')}}</button>
+								<button type="primary" @tap="ok2" class="btn_add" :class="ok2Loading?'btn_disabled':''"
+									:disabled="ok2Loading">{{translateSys('ok')}}</button>
 							</view>
 						</view>
 					</swiper-item>
@@ -206,6 +208,8 @@
 				active_id: '',
 				activelist: [],
 				selectAttrObj: {},
+				okLoading: false,
+				ok2Loading: false,
 			};
 		},
 		onLoad(options) {
@@ -571,7 +575,7 @@
 					// 	    .exec();
 					// }
 					//console.log(item);
-					if (item.oldvalue != item.value&& item.value.trim() != "") {
+					if (item.oldvalue != item.value && item.value.trim() != "") {
 						item.oldvalue = item.value;
 						var attr = item.fieldId;
 						this.head_styledef.form.model[attr] = item.value;
@@ -653,7 +657,7 @@
 			},
 			onEnterChange(item) { //鍥炶溅锛岀偣鍑绘寜閽紝鍙栨秷鑺傜偣浜嬩欢
 				// console.log(item);
-				if (item.oldvalue != item.value&& item.value.trim() != "") {
+				if (item.oldvalue != item.value && item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
 					this.head_styledef.form.model[attr] = item.value;
@@ -843,7 +847,7 @@
 															this.translateSys(
 																"quotation_mark_left") + value
 															.page_name + this.translateSys(
-																"sys.quotation_mark_right") +
+																"quotation_mark_right") +
 															this.translate(
 																"are_you_sure_clear_last"),
 														success: function(res) {
@@ -1552,17 +1556,18 @@
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate(
-								"page.tip_no_data_first") +
+								"tip_no_data_first") +
 							this.translateSys(
 								"quotation_mark_left") + this.param.Sub_Page[0].Name + this.translateSys(
-								"sys.quotation_mark_right") +
+								"quotation_mark_right") +
 							this.translate(
-								"page.tip_no_data_last"),
+								"tip_no_data_last"),
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
 					return false;
 				}
+				this.okLoading = true
 				//鑾峰彇琛ㄥご灞炴�
 				var head_attr = {};
 				this.$data.head_styledef.form.items.forEach(item => {
@@ -1629,6 +1634,7 @@
 				});
 				const list = []
 				if (jsonlist.length == 0) {
+					//this.okLoading = false
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate("tip_no_select_data"),
@@ -1665,17 +1671,18 @@
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate(
-								"page.tip_no_data_first") +
+								"tip_no_data_first") +
 							this.translateSys(
 								"quotation_mark_left") + this.param.Sub_Page[1].Name + this.translateSys(
-								"sys.quotation_mark_right") +
+								"quotation_mark_right") +
 							this.translate(
-								"page.tip_no_data_last"),
+								"tip_no_data_last"),
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
 					return false;
 				}
+				this.ok2Loading = true
 				//鑾峰彇琛ㄥご灞炴�
 				var head_attr = {};
 				this.$data.head_styledef.form.items.forEach(item => {
@@ -1741,6 +1748,7 @@
 					});
 				});
 				if (jsonlist.length == 0) {
+					this.ok2Loading = false
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate("tip_no_select_data"),
@@ -1965,8 +1973,16 @@
 							confirmText: this.translateSys("cancel")
 						});
 					}
+					if (type == "1")
+						this.okLoading = false
+					else if (type == "2")
+						this.ok2Loading = false
 				}).catch(ex => {
 					var tip = typeof ex == "string" ? ex : ex.errMsg;
+					if (type == "1")
+						this.okLoading = false
+					else if (type == "2")
+						this.ok2Loading = false
 					uni.showModal({
 						title: this.translateSys("error") + "8.1",
 						content: this.translate("execute_after_ok_event_failed") + this.translateSys(
@@ -2209,16 +2225,21 @@
 
 		button.btn_add {
 			width: 49.5%;
-
 			padding: 20rpx;
 			line-height: 1.5;
 			border: none;
 			font-size: 38rpx;
 			font-weight: bold;
 			float: right;
+			color: #fff;
 			display: inline-block;
 		}
 
+		button.btn_disabled {
+			background-color: #ddd;
+			color: #888;
+		}
+
 		.logo {
 			height: 100rpx;
 			width: 460rpx;
diff --git a/pages/modal/5601.vue b/pages/modal/5601.vue
index 4d9d1d8..824013f 100644
--- a/pages/modal/5601.vue
+++ b/pages/modal/5601.vue
@@ -117,7 +117,7 @@
 								<button type="default" @tap="cancel"
 									class="btn_cancel">{{translateSys('cancel')}}</button>
 								<button type="primary" @tap="ok(pageData)"
-									class="btn_add">{{translateSys('ok')}}</button>
+									class="btn_add" :class="pageData.okLoading?'btn_disabled':''" :disabled="pageData.okLoading? true:false">{{translateSys('ok')}}</button>
 							</view>
 						</view>
 					</swiper-item>
@@ -834,7 +834,7 @@
 															.page_name +
 															this
 															.translateSys(
-																"sys.quotation_mark_right"
+																"quotation_mark_right"
 															) +
 															this
 															.translate(
@@ -1586,19 +1586,20 @@
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate(
-								"page.tip_no_data_first") +
+								"tip_no_data_first") +
 							this.translateSys(
 								"quotation_mark_left") + pageData.Name + this
 							.translateSys(
-								"sys.quotation_mark_right") +
+								"quotation_mark_right") +
 							this.translate(
-								"page.tip_no_data_last"),
+								"tip_no_data_last"),
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
 					return false;
 				}
 				//鑾峰彇琛ㄥご灞炴�
+				pageData.okLoading = true
 				var head_attr = {};
 				this.$data.head_styledef.form.items.forEach(item => {
 					if (item.name == "Layout") { //鍒ゆ柇鏄惁鏄爡鏍忔牸寮�@@ -1679,6 +1680,7 @@
 					});
 				});
 				if (jsonlist.length == 0) {
+					pageData.okLoading = false
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate("tip_no_select_data"),
@@ -1970,7 +1972,9 @@
 								"cancel")
 						});
 					}
+					pageParam.okLoading = false
 				}).catch(ex => {
+					pageParam.okLoading = false
 					var tip = typeof ex == "string" ? ex : ex.errMsg;
 					uni.showModal({
 						title: this.translateSys("error") + "8.1",
@@ -2204,8 +2208,14 @@
 						font-size: 38rpx;
 						font-weight: bold;
 						float: right;
+						color: #fff;
 						display: inline-block;
 					}
+					.btn_disabled {
+						background-color: #ddd;
+						color: #888;
+					}
+					
 
 				}
 			}
diff --git a/pages/modal/5602.vue b/pages/modal/5602.vue
index 25973ec..66f1fbe 100644
--- a/pages/modal/5602.vue
+++ b/pages/modal/5602.vue
@@ -98,7 +98,8 @@
 							<view v-if="param.Sub_Page[0].OK_Button==true">
 								<button type="default" @tap="cancel"
 									class="btn_cancel">{{translateSys('cancel')}}</button>
-								<button type="primary" @tap="ok" class="btn_add">{{translateSys('ok')}}</button>
+								<button type="primary" @tap="ok" class="btn_add" :class="okLoading?'btn_disabled':''"
+									:disabled="okLoading">{{translateSys('ok')}}</button>
 							</view>
 						</view>
 					</swiper-item>
@@ -147,7 +148,8 @@
 							<view v-if=" param.Sub_Page[1].OK_Button==true">
 								<button type="default" @tap="cancel"
 									class="btn_cancel">{{translateSys('cancel')}}</button>
-								<button type="primary" @tap="ok2" class="btn_add">{{translateSys('ok')}}</button>
+								<button type="primary" @tap="ok2" class="btn_add" :class="ok2Loading?'btn_disabled':''"
+									:disabled="ok2Loading">{{translateSys('ok')}}</button>
 							</view>
 						</view>
 					</swiper-item>
@@ -210,6 +212,8 @@
 				items: [],
 				active_id: '',
 				activelist: [],
+				okLoading: false,
+				ok2Loading: false,
 			};
 		},
 		onLoad(options) {
@@ -559,7 +563,7 @@
 					var $this = this;
 
 					console.log(item);
-					if (item.oldvalue != item.value&& item.value.trim() != "") {
+					if (item.oldvalue != item.value && item.value.trim() != "") {
 						item.oldvalue = item.value;
 						var attr = item.fieldId;
 						this.head_styledef.form.model[attr] = item.value;
@@ -642,7 +646,7 @@
 			},
 			onEnterChange(item) { //鍥炶溅锛岀偣鍑绘寜閽紝鍙栨秷鑺傜偣浜嬩欢
 				// console.log(item);
-				if (item.oldvalue != item.value&& item.value.trim() != "") {
+				if (item.oldvalue != item.value && item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
 					this.head_styledef.form.model[attr] = item.value;
@@ -832,7 +836,7 @@
 															this.translateSys(
 																"quotation_mark_left") + value
 															.page_name + this.translateSys(
-																"sys.quotation_mark_right") +
+																"quotation_mark_right") +
 															this.translate(
 																"are_you_sure_clear_last"),
 
@@ -1535,21 +1539,23 @@
 			},
 			sava(event) {
 				var $this = this;
+
 				if (this.$data.detail1StyleDefList.length == 0) {
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate(
-								"page.tip_no_data_first") +
+								"tip_no_data_first") +
 							this.translateSys(
 								"quotation_mark_left") + this.param.Sub_Page[0].Name + this.translateSys(
-								"sys.quotation_mark_right") +
+								"quotation_mark_right") +
 							this.translate(
-								"page.tip_no_data_last"),
+								"tip_no_data_last"),
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
 					return false;
 				}
+				this.okLoading = true
 				//鑾峰彇琛ㄥご灞炴�
 				var head_attr = {};
 				this.$data.head_styledef.form.items.forEach(item => {
@@ -1617,6 +1623,7 @@
 					});
 				});
 				if (jsonlist.length == 0) {
+					this.okLoading = false
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate("tip_no_select_data"),
@@ -1650,21 +1657,23 @@
 			},
 			sava2(event) {
 				var $this = this;
+
 				if (this.$data.detail1StyleDefList.length == 0) {
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate(
-								"page.tip_no_data_first") +
+								"tip_no_data_first") +
 							this.translateSys(
 								"quotation_mark_left") + this.param.Sub_Page[1].Name + this.translateSys(
-								"sys.quotation_mark_right") +
+								"quotation_mark_right") +
 							this.translate(
-								"page.tip_no_data_last"),
+								"tip_no_data_last"),
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
 					return false;
 				}
+				this.ok2Loading = true
 				//鑾峰彇琛ㄥご灞炴�
 				var head_attr = {};
 				this.$data.head_styledef.form.items.forEach(item => {
@@ -1732,12 +1741,14 @@
 					});
 				});
 				if (jsonlist.length == 0) {
+					this.ok2Loading = false
 					uni.showModal({
 						title: this.translateSys("tip"),
 						content: this.translate("tip_no_select_data"),
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
+
 					return;
 				}
 				const list = []
@@ -1861,7 +1872,7 @@
 														this.translateSys(
 															"quotation_mark_left") + value
 														.page_name + this.translateSys(
-															"sys.quotation_mark_right") +
+															"quotation_mark_right") +
 														this.translate(
 															"are_you_sure_clear_last"),
 													success: function(res) {
@@ -2002,7 +2013,15 @@
 							confirmText: this.translateSys("cancel")
 						});
 					}
+					if (type == "1")
+						this.okLoading = false
+					else if (type == "2")
+						this.ok2Loading = false
 				}).catch(ex => {
+					if (type == "1")
+						this.okLoading = false
+					else if (type == "2")
+						this.ok2Loading = false
 					var tip = typeof ex == "string" ? ex : ex.errMsg;
 					uni.showModal({
 						title: this.translateSys("error") + "8.1",
@@ -2273,9 +2292,15 @@
 			font-size: 38rpx;
 			font-weight: bold;
 			float: right;
+			color: #fff;
 			display: inline-block;
 		}
 
+		button.btn_disabled {
+			background-color: #ddd;
+			color: #888;
+		}
+
 		.logo {
 			height: 100rpx;
 			width: 460rpx;

--
Gitblit v1.9.1