From 41e6159cfa12416155adcd6747e48fab28ffc534 Mon Sep 17 00:00:00 2001
From: cyy <cuiqian2004@163.com>
Date: 星期一, 26 八月 2024 22:45:17 +0800
Subject: [PATCH] test

---
 pages/modal/3018_2.vue |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 68 insertions(+), 25 deletions(-)

diff --git a/pages/modal/3018_2.vue b/pages/modal/3018_2.vue
index 483a96a..855ad61 100644
--- a/pages/modal/3018_2.vue
+++ b/pages/modal/3018_2.vue
@@ -60,11 +60,11 @@
 						</view>
 					</uni-forms-item>
 					<!-- 鏍呮牸甯冨眬 -->
-					<uni-row class="demo-uni-row" v-if="item.name=='Layout' && item.show==true">
+					<uni-row class="demo-uni-row" v-if="item.name=='Layout'">
 						<uni-col v-for="(cols,key) in item.setting.colList"
 							:span="item.setting.spanList?item.setting.spanList[key]:24 / item.setting.col">
-							<uni-forms-item class="head-form" v-if="cols!=null" :label="cols.label +'锛�"
-								:label-width="cols.labelWidth+'px'">
+							<uni-forms-item class="head-form" v-if="cols!=null  && cols.show==true" :label="cols.label +'锛�"
+								:label-width="cols.labelWidth+'px'" >
 								<!-- <text class="txt_title" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text> -->
 								<span class="form-item-span" v-if="cols.disabled">{{cols.value}}</span>
 								<view class="input-wrapper"
@@ -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) {
@@ -235,7 +236,8 @@
 
 					}
 				})
-			} else if (e.index == 1) {
+			} 
+			else if (e.index == 1) {
 				//鍒锋柊
 				uni.redirectTo({
 					url: '../modal/3018_2?param=' + JSON.stringify(this.$data.param) +
@@ -319,7 +321,7 @@
 					class_id: class_id,
 					ui_style_id: style_id,
 				};
-				this.$store.dispatch('UIStyleGetInfo', dataInfo).then(async(ret) => {
+				this.$store.dispatch('UIStyleGetInfo', dataInfo).then(async (ret) => {
 					// console.log(ret);
 					if (ret.err_code == 0) {
 						var styledef = "";
@@ -332,8 +334,7 @@
 								.style_def);
 						}
 						const styledefHead = styledef ? JSON.parse(styledef) : {};
-						for (let i in styledefHead.form.items)
-						{
+						for (let i in styledefHead.form.items) {
 							const ele = styledefHead.form.items[i]
 							if (ele.name != "Layout") {
 								ele.show = true
@@ -352,10 +353,9 @@
 									}
 								}
 							} else {
-								for (let j in ele.setting.colList)
-								{
+								for (let j in ele.setting.colList) {
 									const col = ele.setting.colList[j]
-							
+
 									if (col) {
 										col.show = true
 										if (col?.useDict) {
@@ -382,7 +382,7 @@
 						$this.setData({
 							head_styledef: styledefHead
 						})
-			
+						console.log("head_styledef",this.head_styledef)
 						if ($this.head_styledef.event?.length > 0) {
 							$this.head_styledef.event.forEach(async (a) => { //鍒ゆ柇鏄惁鏄垵濮嬪寲浜嬩欢
 								if (a.event_id == "initial") {
@@ -440,7 +440,7 @@
 						formModel[formItem.fieldId] = itemName;
 					}
 					formItem.dict = list;
-			
+
 					// $this.head_styledef.form.items[index].dictitem=success.result;
 					// this.$store.commit("classAttrList", $this.$data.classAttrList);
 				} catch (ex) {
@@ -482,6 +482,37 @@
 				})
 
 			},
+			getUIStyleInfo(info) { //Mobox3鏁版嵁绫荤晫闈㈡牱寮�+				const loginInfo = this.$store.getters.loginid
+				const dataSApi = this.$store.getters.getDataSApi
+				return new Promise((resolve, reject) => {
+					uni.request({
+						url: dataSApi + 'api/class/uistyle/GetInfo?sessionid=' + loginInfo.result
+							.session_id,
+						data: info,
+						method: 'POST',
+						dataType: "json",
+						success: (_res) => {
+							// console.log(_res);
+							const ret = _res.data
+							if (ret.err_code == 0) {
+								resolve(ret);
+							} else {
+								reject({
+									"errMsg": ret.err_msg
+								});
+							}
+						},
+						fail: (err) => {
+							// console.log(err);
+							reject(err);
+						}
+					})
+			
+				})
+			
+			},
+			
 			async loadInitEvent(eventid) {
 				var $this = this;
 				if (!eventid.includes('{')) eventid = '{' + eventid + '}';
@@ -742,6 +773,7 @@
 
 
 			ontap(item) { //鎵爜鍔熻兘
+					// console.log("ontap",item);
 				// 鎵撳紑钃濈墮閫傞厤鍣� 				// uni.openBluetoothAdapter({
 				//   success: function() {
@@ -789,13 +821,13 @@
 			},
 			onScanValue(item, value) {
 				const $this = this;
-				console.log("onScanValue", item);
+				//console.log("onScanValue", item);
 				if (item.oldvalue != value) {
 					item.oldvalue = value;
 					item.value = value;
-					var attr = value
+					var attr = item.fieldId;
 					$this.head_styledef.form.model[attr] = value;
-					if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌�+					/*if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌� 						//鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴�
 						var findd = false
 						const items = $this.head_styledef.form.items || []
@@ -859,7 +891,7 @@
 							}
 						}
 					}
-
+					*/
 					var eventid = item.bind.onChangeEvent.id; //鍐呭鍙樺寲鍚庝簨浠� 					if (eventid) {
 						var obj_attr = this.head_styledef.form.model;
@@ -886,12 +918,12 @@
 				}
 			},
 			onClick(item) {
+				// console.log("onClick",item);
 				this.focusFieldId = item.fieldId
 			},
 			onevent(item) {
-				// console.log(e.target);
-				console.log(item);
-				if (item.oldvalue != item.value) {
+					// console.log("onevent",item);
+				if (item.oldvalue != item.value && item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
 					this.head_styledef.form.model[attr] = item.value;
@@ -922,8 +954,8 @@
 
 			},
 			onchange(item) {
-				console.log(item);
-				if (item.oldvalue != item.value) {
+				// console.log("onchange",item);
+				if (item.oldvalue != item.value&& item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
 					this.head_styledef.form.model[attr] = item.value;
@@ -1756,7 +1788,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 +1851,7 @@
 										showCancel: false,
 										confirmText: this.translateSys("cancel")
 									});
+									this.saving = false
 									return;
 								}
 								if (action.info) {
@@ -1866,8 +1900,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 +1914,7 @@
 				});
 			},
 			afterOK() {
+				this.saving = true
 				var obj_attr = this.head_styledef.form.model;
 				// console.log(obj_attr);
 				var input_param = {
@@ -1934,6 +1971,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 +1996,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 +2314,10 @@
 				float: left;
 				display: inline-block;
 			}
-
+			.btn_disabled {
+				background-color: #ddd;
+				color: #888;
+			}
 			.btn_cancel {
 				width: 45%;
 				margin: 0 10rpx;

--
Gitblit v1.9.1