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 | 221 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 165 insertions(+), 56 deletions(-) diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue index 3db80aa..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)"></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, @@ -629,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"), @@ -657,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 => { @@ -1042,6 +1076,9 @@ number1 = parseInt(value1) if (value2) number2 = parseInt(value2) + if (!operation) { + return value2; + } if (operation == "+") { return number1 + number2 } else if (operation == "-") { @@ -1049,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; + } }, //鏇存柊鍒嗛〉绛句腑鐨勫垪琛ㄩ」鍐呭 @@ -1067,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) { @@ -1540,7 +1648,7 @@ } data[index].check = ischeck ? false : true; this.$data.check_list.items = data; - + }, popup_cancel(e) { //寮规鍙栨秷 this.$refs.popup.close(); @@ -1595,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 = { @@ -1692,7 +1800,7 @@ showCancel: false, confirmText: this.translateSys("cancel") }); - + var actionlist = data.action; if (actionlist) { console.log(actionlist); @@ -1799,7 +1907,7 @@ }); } } - + var length = 0; if (!$this.$data.refdatastore.filter(function(s) { return result[i].attr == s.attr @@ -1819,7 +1927,7 @@ } } } - + }).catch(ex => { // console.log(ex); let exStr = JSON.stringify(ex) @@ -1864,7 +1972,7 @@ } } } - + var extinfo = enviroment; extinfo.edit_dlg = { type: 'small', //灏忕獥鍙�@@ -1884,7 +1992,7 @@ })) ) ); - + if (!eventid.includes('{')) eventid = '{' + eventid + '}'; var dataInfo = { ed_type: "0", @@ -1943,7 +2051,7 @@ showCancel: false, confirmText: $this.translateSys("cancel") }); - + if (data != "") { var actions = data.action; if (actions) { @@ -1952,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> ' + @@ -2022,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 @@ -2081,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 @@ -2102,7 +2210,7 @@ attr: param.req, dataJson: [], } - + $this.DataObjRunCustomEvent( info); } @@ -2136,7 +2244,7 @@ }); } } - + }).catch(ex => { // console.log(ex); let exStr = JSON.stringify(ex) @@ -2151,8 +2259,8 @@ }); }); }, - - + + //纭畾 ok() { this.Before_OK_Event = this.param.Sub_Page[0].Before_ok; @@ -3045,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; @@ -3076,7 +3185,7 @@ /* float: left; */ display: inline-block; } - + button.btn_popup_cancel { width: 180rpx; margin-top: 50rpx; @@ -3090,7 +3199,7 @@ /* float: right; */ display: inline-block; } - + } </style> \ No newline at end of file -- Gitblit v1.9.1