From 733cfa21c16c019c0337f948ac884ca4961ea2ad Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期二, 04 三月 2025 17:01:42 +0800
Subject: [PATCH] test

---
 pages/modal/5600.vue |  240 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 165 insertions(+), 75 deletions(-)

diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue
index 0864c5f..b1f2596 100644
--- a/pages/modal/5600.vue
+++ b/pages/modal/5600.vue
@@ -20,7 +20,7 @@
 						:placeholder="item.placeholder"
 						:style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}"
 						:focus="focusFieldId == item.fieldId" @focus="ontap(index,item)" @click="onClick(item)"
-						@keyup.enter="onEnterChange(item)" @blur="onEnterChange(item)"  :maxlength="-1"/>
+						@keyup.enter="onEnterChange(item)" @blur="onEnterChange(item)" :maxlength="-1" />
 					<text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]"
 						@click="classAttr_extButton(item)">&#xe568;</text>
 				</view>
@@ -59,7 +59,7 @@
 													<input class="uni-input" v-if="!item.disabled"
 														:type="item.name=='InputNumber'?'number':'text'"
 														v-model="item.value" :disabled="item.disabled"
-														:placeholder="item.placeholder"  :maxlength="-1"/>
+														:placeholder="item.placeholder" :maxlength="-1" />
 												</view>
 												<!-- 鏍呮牸甯冨眬 -->
 												<uni-row class="demo-uni-row" v-if="item.name=='Layout'">
@@ -73,7 +73,7 @@
 															<input class="uni-input" v-if="!cols.disabled"
 																:type="cols.name=='InputNumber'?'number':'text'"
 																v-model="cols.value" :disabled="cols.disabled"
-																:placeholder="cols.placeholder"  :maxlength="-1"/>
+																:placeholder="cols.placeholder" :maxlength="-1" />
 														</view>
 													</uni-col>
 												</uni-row>
@@ -163,7 +163,7 @@
 				</div>
 			</view>
 		</view>
-	<view>
+		<view>
 			<uni-popup class="view-popup" ref="popup" background-color="#fff" @change="popupChange">
 				<view class="popup-header">{{check_list.title}}</view>
 				<view class="popup-content" :class="{ 'popup-height': popupType === 'left' || popupType === 'right' }"
@@ -238,8 +238,8 @@
 				selectAttrObj: {},
 				okLoading: false,
 				ok2Loading: false,
-				
-				
+
+
 				global_attr: [],
 				refdatastore: [], //寮曠敤鏁版嵁瀛樺偍鍖�/ {attr:'G_PRJ_' + bindattr + '_ID', value:info.id}
 				popupType: "center",
@@ -375,6 +375,23 @@
 						$this.$data.head_styledef.form.items.forEach(async (ele, index) => {
 							if (ele.useDict == true) { //鍒ゆ柇useDict鏄惁浣跨敤瀛楀吀
 								await this.DictGetInfo(ele.bind.dict, index, 'mast');
+							} else {
+								if (ele?.name === "Select") {
+									const selections = ele?.selections || []
+									//鏈夐粯璁ゅ�锛屾樉绀洪粯璁ゅ�
+									let itemName = ele.value || "";
+									if (itemName) {
+										$this.head_styledef.form
+											.model[ele.fieldId] = itemName;
+									}
+									$this.head_styledef.form.items[index].dict = selections.map((a) => {
+										return {
+											value: a.value,
+											text: a.label
+										}
+									})
+								}
+
 							}
 							if ($this.focusFieldId == "") {
 								if (ele.name == 'Input' || ele.name == 'InputNumber') {
@@ -426,6 +443,23 @@
 						$this.detail1_styledef.form.items.forEach(async (ele, index) => {
 							if (ele.useDict == true) { //鍒ゆ柇useDict鏄惁浣跨敤瀛楀吀
 								await this.DictGetInfo(ele.bind.dict, index, 'sub');
+							} else {
+								if (ele?.name === "Select") {
+									const selections = ele?.selections || []
+									//鏈夐粯璁ゅ�锛屾樉绀洪粯璁ゅ�
+									let itemName = ele.value || "";
+									if (itemName) {
+										$this.detail1_styledef.form
+											.model[ele.fieldId] = itemName;
+									}
+									$this.detail1_styledef.form.items[index].dict = selections.map((a) => {
+										return {
+											value: a.value,
+											text: a.label
+										}
+									})
+								}
+
 							}
 						});
 					}
@@ -482,7 +516,7 @@
 					var itemName = '';
 					(result.dict_item_list || []).forEach((item) => {
 						if (item.is_default == '1')
-							itemName =  item.name
+							itemName = item.name
 						list.push({
 							text: item.value ? item.value : item.name,
 							value: item.name,
@@ -537,25 +571,6 @@
 					item.value = result.decodedata;
 					// uni.hideKeyboard();
 					var $this = this;
-
-					// if(item.value=='B61DF51DD50645CEB9D152DD77D2466A'){
-					// 	this.active_id = 'B61DF51DD50645CEB9D152DD77D2466A';
-					// 	// var target = uni.createSelectorQuery().select('#B61DF51DD50645CEB9D152DD77D2466A');
-					// 	uni.createSelectorQuery()
-					// 	    .select("#tabpanel")//瀵瑰簲澶栧眰鑺傜偣
-					// 	    .boundingClientRect((container) => {
-					// 	        uni.createSelectorQuery()
-					// 	        .select("#B61DF51DD50645CEB9D152DD77D2466A")//鐩爣鑺傜偣
-					// 	        .boundingClientRect((target) => {
-					// 	            uni.pageScrollTo({
-					// 	            scrollTop: target.top - container.top,//婊氬姩鍒板疄闄呰窛绂绘槸鍏冪礌璺濈椤堕儴鐨勮窛绂诲噺鍘绘渶澶栧眰鐩掑瓙鐨勬粴鍔ㄨ窛绂�-					// 	            });
-					// 	        })
-					// 	        .exec();
-					// 	    })
-					// 	    .exec();
-					// }
-					//console.log(item);
 					if (item.oldvalue != item.value && item.value.trim() != "") {
 						item.oldvalue = item.value;
 						var attr = item.fieldId;
@@ -648,13 +663,13 @@
 					if (onChangeEvent.id) { //鍐呭鍙樺寲鍚庝簨浠� 						this.onChange(onChangeEvent);
 					}
-				
+
 				}
 			},
 			classAttr_extButton(item) {
 				var onSuffixClickCallbackEvent = item.bind.onSuffixClickCallbackEvent; //鍚庡浘鏍囩偣鍑讳簨浠� 				var onSuffixClickEvent = item.bind.onSuffixClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋�-			
+
 				if (!onSuffixClickCallbackEvent.id) {
 					uni.showModal({
 						title: this.translateSys("tip"),
@@ -676,11 +691,11 @@
 				this.$data.popupType = 'right'
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
 				this.$refs.popup.open(this.popupType);
-			
+
 				this.dataObjRunCustomEvent_Return(onSuffixClickCallbackEvent.id, '', onSuffixClickEvent.id,
 					item);
 			},
-			
+
 			getDetailAttrList(list, selectButton) {
 				const detailAttrList = [];
 				list.forEach(style => {
@@ -1061,6 +1076,9 @@
 					number1 = parseInt(value1)
 				if (value2)
 					number2 = parseInt(value2)
+				if (!operation) {
+					return value2;
+				}
 				if (operation == "+") {
 					return number1 + number2
 				} else if (operation == "-") {
@@ -1068,11 +1086,17 @@
 				} else if (operation == "*") {
 					return number1 * number2
 				} else if (operation == "/") {
-					if (number2)
-						return number1 / number2
-					else
-						return number1
-				} else return number2
+					if (number2) return number1 / number2;
+					else {
+						throw new Error(`${this.translate("illegal_dividend")}'${value2}'`);
+						return 0;
+					}
+				} else if (operation == "=") {
+					return value2;
+				} else {
+					throw new Error(`${this.translate("unrecognized_operator")}'${operation}'`);
+					return 0;
+				}
 			},
 
 			//鏇存柊鍒嗛〉绛句腑鐨勫垪琛ㄩ」鍐呭
@@ -1086,29 +1110,94 @@
 				}
 				detailStyleDefList.forEach(ele => {
 					value.row.forEach((rowData) => {
-						if (ele.form.objId == rowData.id) {
-							rowData.attrs.forEach(attr => {
-								ele.form.items.forEach(ele2 => {
-									if (ele2.name != 'Layout') {
-										if (ele2.fieldId == attr.attr) {
-											ele2.value = $this.operationNumber(ele2.value,
-												attr.value, attr.operation)
-										}
-									} else if (ele2.name == 'Layout') {
-										ele2.setting.colList.forEach(col => {
-											if (col) {
-												if (col.fieldId == attr.attr) {
-													col.value = $this
-														.operationNumber(col.value,
-															attr.value, attr
-															.operation)
-												}
+						if (rowData.id) {
+							if (ele.form.objId == rowData.id) {
+								rowData.attrs.forEach(attr => {
+									ele.form.items.forEach(ele2 => {
+										if (ele2.name != 'Layout') {
+											if (ele2.fieldId == attr.attr) {
+												ele2.value = $this.operationNumber(ele2
+													.value,
+													attr.value, attr.operation)
 											}
-										})
-									}
+										} else if (ele2.name == 'Layout') {
+											ele2.setting.colList.forEach(col => {
+												if (col) {
+													if (col.fieldId == attr.attr) {
+														col.value = $this
+															.operationNumber(col
+																.value,
+																attr.value, attr
+																.operation)
+													}
+												}
+											})
+										}
+									});
 								});
-							});
+							}
+
+						} else if (rowData.condition) {
+							const conditions = rowData.condition;
+							let bFindCondition = true;
+							for (let i in conditions) {
+								const condition = conditions[i];
+								let bFind = false;
+								for (let i2 in ele.form.items) {
+									const ele2 = ele.form.items[i2];
+									if (ele2.name != "Layout") {
+										if (ele2.fieldId == condition.attr) {
+											if (condition.value == ele2.value) {
+												bFind = true;
+											}
+											break;
+										}
+									} else {
+										const colList = ele2.setting.colList || [];
+										for (let i3 in colList) {
+											const col = colList[i3];
+											if (col.fieldId == condition.attr) {
+												if (condition.value == col.value) {
+													bFind = true;
+												}
+												break;
+											}
+										}
+										if (bFind) break;
+									}
+								}
+								if (!bFind) {
+									bFindCondition = false;
+									break;
+								}
+							}
+							if (bFindCondition) {
+								rowData.attrs.forEach(attr => {
+									ele.form.items.forEach(ele2 => {
+										if (ele2.name != 'Layout') {
+											if (ele2.fieldId == attr.attr) {
+												ele2.value = $this.operationNumber(ele2
+													.value,
+													attr.value, attr.operation)
+											}
+										} else if (ele2.name == 'Layout') {
+											ele2.setting.colList.forEach(col => {
+												if (col) {
+													if (col.fieldId == attr.attr) {
+														col.value = $this
+															.operationNumber(col
+																.value,
+																attr.value, attr
+																.operation)
+													}
+												}
+											})
+										}
+									});
+								});
+							}
 						}
+
 					})
 				});
 				if (value.page_name == $this.$data.param.Sub_Page[1].Name) {
@@ -1559,7 +1648,7 @@
 				}
 				data[index].check = ischeck ? false : true;
 				this.$data.check_list.items = data;
-			
+
 			},
 			popup_cancel(e) { //寮规鍙栨秷
 				this.$refs.popup.close();
@@ -1614,7 +1703,7 @@
 				$this.DataObjRunCustomEvent(info, $this.$data.popupParam.data_attr);
 				this.$refs.popup.close();
 			},
-			
+
 			async DataObjRunCustomEvent(info, data_attr) {
 				var $this = this;
 				var enviroment = {
@@ -1711,7 +1800,7 @@
 							showCancel: false,
 							confirmText: this.translateSys("cancel")
 						});
-			
+
 						var actionlist = data.action;
 						if (actionlist) {
 							console.log(actionlist);
@@ -1818,7 +1907,7 @@
 										});
 									}
 								}
-			
+
 								var length = 0;
 								if (!$this.$data.refdatastore.filter(function(s) {
 										return result[i].attr == s.attr
@@ -1838,7 +1927,7 @@
 							}
 						}
 					}
-			
+
 				}).catch(ex => {
 					// console.log(ex);
 					let exStr = JSON.stringify(ex)
@@ -1883,7 +1972,7 @@
 						}
 					}
 				}
-			
+
 				var extinfo = enviroment;
 				extinfo.edit_dlg = {
 					type: 'small', //灏忕獥鍙�@@ -1903,7 +1992,7 @@
 						}))
 					)
 				);
-			
+
 				if (!eventid.includes('{')) eventid = '{' + eventid + '}';
 				var dataInfo = {
 					ed_type: "0",
@@ -1962,7 +2051,7 @@
 							showCancel: false,
 							confirmText: $this.translateSys("cancel")
 						});
-			
+
 						if (data != "") {
 							var actions = data.action;
 							if (actions) {
@@ -1971,7 +2060,7 @@
 									console.log(action)
 									var val = action.value;
 									var enviroment = JSON.stringify(enviroment);
-			
+
 									if (action.action_type == 'open_panel') {
 										var d = dialog({
 											title: '<i class="ace-icon fa fa-info-circle"></i> ' +
@@ -2041,7 +2130,7 @@
 										});
 										d.show();
 									} else if (action.action_type == 'open_common_dlg') {
-			
+
 										if (val.common_dlg_id == 'check_list') {
 											$this.setData({
 												check_list: val.config
@@ -2100,7 +2189,7 @@
 															attr] =
 														data[0].ID +
 														';' + data[0].Name;
-			
+
 													// $this.$data.classAttrList[param.index].Attr[param.iindex].Value=data[0].Name;
 													// $this.$data.classAttrList[param.index].Attr[param.iindex].ValID=data[0].ID+';'+data[0].Name;
 													var callback_eventid = param
@@ -2121,7 +2210,7 @@
 															attr: param.req,
 															dataJson: [],
 														}
-			
+
 														$this.DataObjRunCustomEvent(
 															info);
 													}
@@ -2155,7 +2244,7 @@
 							});
 						}
 					}
-			
+
 				}).catch(ex => {
 					// console.log(ex);
 					let exStr = JSON.stringify(ex)
@@ -2170,8 +2259,8 @@
 					});
 				});
 			},
-			
-			
+
+
 			//纭畾
 			ok() {
 				this.Before_OK_Event = this.param.Sub_Page[0].Before_ok;
@@ -3064,23 +3153,24 @@
 		.demo-uni-row .uni-input {
 			width: calc(100% - 120px);
 		}
+
 		.popup-header {
 			font-size: 42rpx;
 			font-weight: bold;
 			margin: 20rpx 20rpx 0px 20rpx;
 		}
-		
+
 		.view_popup_CheckList {
 			margin-bottom: 20rpx;
 		}
-		
+
 		.popup-footer {
 			float: right;
 			position: absolute;
 			bottom: 0;
 			right: 20rpx;
 		}
-		
+
 		button.btn_popup_add {
 			width: 180rpx;
 			margin-top: 50rpx;
@@ -3095,7 +3185,7 @@
 			/* float: left; */
 			display: inline-block;
 		}
-		
+
 		button.btn_popup_cancel {
 			width: 180rpx;
 			margin-top: 50rpx;
@@ -3109,7 +3199,7 @@
 			/* float: right; */
 			display: inline-block;
 		}
-		
+
 
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.1