From fd6b8f3edc8edf0a892bae55674fe8a05371bf0d Mon Sep 17 00:00:00 2001 From: jt <jt@activesoft.com.cn> Date: 星期五, 27 十月 2023 08:36:35 +0800 Subject: [PATCH] 5600码盘确定后事件参数增加事务回滚参数start_transaction: true --- pages/modal/5600.vue | 386 ++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 241 insertions(+), 145 deletions(-) diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue index 770efb4..383cc02 100644 --- a/pages/modal/5600.vue +++ b/pages/modal/5600.vue @@ -60,9 +60,9 @@ } .dv-panel{ background-color:#EAFED9; - padding: 10px 0px 1px 0px; - border-radius: 6px; - margin-bottom: 10px; + padding: 20rpx 20rpx 4rpx 0px; + border-radius: 12rpx; + margin-bottom: 20rpx; text-align: right; } .dv-panel-input{ @@ -84,34 +84,35 @@ height: 52rpx; line-height: 34rpx; background: #FFF; - border-radius: 0 !important; + border-radius: 7px !important; color: #2d8cf0; - padding: 10rpx 8rpx 12rpx; - font-size: 34rpx; + padding: 6rpx 8rpx 8rpx; + font-size: 32rpx; font-family: inherit; box-shadow: none !important; transition-duration: 0.1s; - margin-top: 4rpx; + margin-top: 0rpx; } .dv-panel input::-webkit-input-placeholder { font-size: 10rpx; } .dv-panel .form-item-span{ + vertical-align: text-top; color: #2d8cf0; - vertical-align: middle; white-space: normal; word-break: break-all; display: inline-block; width: calc(100% - 100px); } + .dv-panel-button{ display: inline-block; - margin-bottom: 10rpx; margin-right: 20rpx; } .dv-panel-button button { line-height: 1.8; border: none; + font-size: 34rpx; } button.btn_cancel { width:49.5%; @@ -141,15 +142,20 @@ display: flex; margin: 38% auto; } - +.dv-border{ + border: 1px solid red; +} </style> <style lang="scss"> .demo-uni-row { - margin-bottom: 10px; + margin-bottom: 0px; display: block; } ::v-deep .uni-row { - margin-bottom: 10px; + margin-bottom: 0px; + } + .view-tabpage ::v-deep .uni-row { + margin-bottom: 5px; } .demo-uni-col { height: 36px; @@ -198,7 +204,7 @@ </uni-segmented-control> </view> <!-- 姝e湪鐮佺洏 --> - <view v-if="current==0"> + <view class="view-tabpage" v-if="current==0"> <image class="logo" v-if="detail1StyleDefList.length==0" src="../../images/mobox_log_200x40.png"></image> <!-- <div class="dv-panel"> @@ -209,17 +215,29 @@ </div> <div > <text class="txt_title" style="width:100px">test锛�/text> - <input type="number"/> + <span class="form-item-span" >1111</span> </div> <div> <uni-row class="demo-uni-row"> <uni-col :span="12"> <text class="txt_title dv-form-item-col" style="width:100px">test锛�/text> - <span class="form-item-span" >fsferexggsfsfacxzzgfs</span> + <span class="form-item-span" >ffaaa</span> </uni-col> <uni-col :span="12"> <text class="txt_title dv-form-item-col" style="width:100px">test锛�/text> - <input type="number" style="width: calc(100% - 120px);"/> + <span class="form-item-span" >ffaaaffaaaffaaaffaaaffaaa</span> + </uni-col> + </uni-row> + </div> + <div> + <uni-row class="demo-uni-row"> + <uni-col :span="12"> + <text class="txt_title dv-form-item-col" style="width:100px">test锛�/text> + <span class="form-item-span" >fsfegfs</span> + </uni-col> + <uni-col :span="12"> + <text class="txt_title dv-form-item-col" style="width:100px">test锛�/text> + <input type="number" class="uni-input input-margintop" style="width: calc(100% - 120px);"/> </uni-col> </uni-row> </div> @@ -251,7 +269,7 @@ v-for="(cols,key) in item.setting.colList" > <view v-if="cols!=null" > - <text class="txt_title dv-form-item-col" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text> + <text class="txt_title" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text> <span class="form-item-span" v-if="cols.disabled">{{cols.value}}</span> <input class="uni-input" @@ -272,7 +290,8 @@ </div> </view> <!-- 宸茬爜鐩�--> - <view v-if="current==1"> + <view class="view-tabpage2" v-if="current==1"> + <image class="logo" v-if="detail2StyleDefList.length==0" src="../../images/mobox_log_200x40.png"></image> <div class="dv-panel" v-for="(style,ii) in detail2StyleDefList"> <div class="dv-panel-input"> <div v-for="(item,index) in style.form.items"> @@ -288,7 +307,7 @@ v-for="(cols,key) in item.setting.colList" > <view v-if="cols!=null" > - <text class="txt_title dv-form-item-col" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text> + <text class="txt_title" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text> <span class="form-item-span">{{cols.value}}</span> </view> </uni-col> @@ -317,7 +336,7 @@ data() { return { title:'鐮佺洏', - paramJson: {}, + param: {}, focusMateria:false, head_styledef:{ form:{ @@ -382,7 +401,7 @@ ui_style_id:style_id, }; this.$store.dispatch('UIStyleGetInfo',dataInfo).then(ret=>{ - console.log(ret); + // console.log(ret); if (ret.err_code == 0) { var styledef=""; if(ret.result.style_def){ @@ -392,7 +411,7 @@ if(!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result.style_def); } $this.$data.detail1_styledef = ret.result.style_def? JSON.parse(styledef): {}; - console.log($this.$data.detail1_styledef); + // console.log($this.$data.detail1_styledef); // $this.$data.detail1StyleDefList.push($this.$data.detail1_styledef); // let aa = JSON.stringify(this.detail1_styledef); // $this.$data.detail1StyleDefList.push(JSON.parse(aa)); @@ -414,7 +433,7 @@ ui_style_id:style_id, }; this.$store.dispatch('UIStyleGetInfo',dataInfo).then(ret=>{ - console.log(ret); + // console.log(ret); if (ret.err_code == 0) { var styledef=""; if(ret.result.style_def){ @@ -424,7 +443,7 @@ if(!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result.style_def); } $this.$data.detail2_styledef = ret.result.style_def? JSON.parse(styledef): {}; - console.log($this.$data.detail2_styledef); + // console.log($this.$data.detail2_styledef); }else{ uni.showModal({title:"閿欒3",content:ret.err_msg,showCancel:false,confirmText:"鍙栨秷"}); @@ -459,10 +478,13 @@ $this.onChange(onChangeEvent); } if(item.value){ //绗竴涓緭鍏ユ涓嶄负绌�- $this.focusMateria = false; //鍒濆鍖栵紝绗簩涓緭鍏ユfocus灞炴� - setTimeout(function(){ - $this.focusMateria=true; //绗簩涓緭鍏ユ鑾峰彇鐒︾偣 - },1000); + $this.focusMateria = true; //鍒濆鍖栵紝绗簩涓緭鍏ユfocus灞炴� + // setTimeout(function(){ + // $this.focusMateria=true; //绗簩涓緭鍏ユ鑾峰彇鐒︾偣 + setTimeout(function(){ + uni.hideKeyboard(); + },100); + // },500); } // if(onSuffixClickCallbackEvent.id){ //鍚庡浘鏍囩偣鍑讳簨浠� // this.onSuffixClick(onSuffixClickCallbackEvent); @@ -533,40 +555,50 @@ // console.log(ret); if (ret.err_code == 0) { var result = ret.result; - if(result.result_type == 0 && result.action){ - result.action.forEach(item=>{ - if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�- var value = item.value; - $this.viewAceionRow(value); - } else if(item.action_type == "set_subtable_page_content"){ //宸茬爜鐩�- var value = item.value; - if(value.clear == true && $this.$data.detail1StyleDefList.length>0){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹�- uni.showModal({ - title: '鎻愮ず', - content: '绯荤粺妫�祴鍒版湁姝e湪鐮佺洏涓殑璐у搧锛岀户缁搷浣滀細娓呯┖锛屾槸鍚︾户缁紵', - success: function (res) { - if (res.confirm) { - $this.$data.detail1StyleDefList=[]; - $this.$data.detail2StyleDefList=[]; - $this.viewAceionContent(value); - } else if (res.cancel) { - $this.$data.detail2StyleDefList=[]; - $this.viewAceionContent(value); + if (result.ret != 0) { + var tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info : result.err_info.join('<br/>') : ''; + if (result.ret == 801) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + else uni.showModal({title:'鎻愮ず',content:tip+',鎻愮ず:'+result.ret,showCancel:false,confirmText:"鍙栨秷"}); + return false + }else{ + let tip = result.info ? typeof result.info == 'string' ? result.info : result.info.join('<br/>') : ''; + if (tip) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + + if(result.result_type == 0 && result.action){ + result.action.forEach(item=>{ + if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�+ var value = item.value; + $this.viewAceionRow(value); + } else if(item.action_type == "set_subtable_page_content"){ //宸茬爜鐩�+ var value = item.value; + if(value.clear == true && $this.$data.detail1StyleDefList.length>0){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹�+ uni.showModal({ + title: '鎻愮ず', + content: '绯荤粺妫�祴鍒版湁姝e湪鐮佺洏涓殑璐у搧锛岀户缁搷浣滀細娓呯┖锛屾槸鍚︾户缁紵', + success: function (res) { + if (res.confirm) { + $this.$data.detail1StyleDefList=[]; + $this.$data.detail2StyleDefList=[]; + $this.viewAceionContent(value); + } else if (res.cancel) { + $this.$data.detail2StyleDefList=[]; + $this.viewAceionContent(value); + } } - } - }); - } else { - $this.$data.detail2StyleDefList=[]; - $this.viewAceionContent(value); - } - } - }); - }else{ - // this.detail2StyleDefList=[]; - if(result.info){ - uni.showModal({title:"閿欒4.3",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + }); + } else { + $this.$data.detail2StyleDefList=[]; + $this.viewAceionContent(value); + } + } + }); + }else{ + // this.detail2StyleDefList=[]; + if(result.info){ + uni.showModal({title:"閿欒4.3",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + } } - } + } }else{ uni.showModal({title:"閿欒4",content:ret.err_msg,showCancel:false,confirmText:"鍙栨秷"}); @@ -583,13 +615,16 @@ } }, //鍔犺浇姝e湪鐮佺洏鍐呭 - viewAceionRow(data){ + viewAceionRow(data,type){ // console.log(data); var styleStr = JSON.stringify(this.$data.detail1_styledef); + if(type){ //纭畾鍚庤剼鏈繘鍏ュ姞杞藉凡鐮佺洏鏁版嵁 + styleStr = JSON.stringify(this.$data.detail2_styledef); + } var detailStyle = JSON.parse(styleStr); data.row.attrs.forEach(attr=>{ detailStyle.form.items.forEach(ele=>{ - if(ele.name=='Input'){ + if(ele.name!='Layout'){ if(ele.fieldId == attr.attr) ele.value = attr.value; } else if(ele.name=='Layout'){ ele.setting.colList.forEach(col=>{ @@ -600,8 +635,15 @@ } }); }); - this.$data.detail1StyleDefList.push(detailStyle); - console.log(this.$data.detail1StyleDefList); + if(type){ //纭畾鍚庤剼鏈繘鍏ュ姞杞藉凡鐮佺洏鏁版嵁 + detailStyle.form.objId = data.row.id; + this.$data.detail2StyleDefList.push(detailStyle); + // console.log(this.$data.detail2StyleDefList); + }else{ + detailStyle.form.attrs = data.row.attrs; + this.$data.detail1StyleDefList.push(detailStyle); + // console.log(this.$data.detail1StyleDefList); + } }, //鍔犺浇宸茬爜鐩樺唴瀹� viewAceionContent(data){ @@ -611,7 +653,7 @@ detailStyle.form.objId = cont.id; cont.attrs.forEach(attr=>{ detailStyle.form.items.forEach(ele=>{ - if(ele.name=='Input'){ + if(ele.name!='Layout'){ if(ele.fieldId == attr.attr) ele.value = attr.value; } else if(ele.name=='Layout'){ ele.setting.colList.forEach(col=>{ @@ -637,7 +679,7 @@ this.detail1StyleDefList.splice(index,1); }, delDataObj(style,index){ //鍒犻櫎宸茬爜鐩樻暟 - console.log(style); + // console.log(style); var $this = this; uni.showModal({ title: '鎻愮ず', @@ -674,10 +716,17 @@ }, - ok(){ //纭畾 + // var $this = this; // console.log(this.$data.param.Before_OK_Event); // console.log(this.$data.param.After_OK_Event); + if(this.$data.param.Before_OK_Event) //鏄惁鏈夌‘瀹氬墠浜嬩欢 + this.sava(this.$data.param.Before_OK_Event); + else if(this.$data.param.After_OK_Event) //鏄惁鏈夌‘瀹氬悗浜嬩欢 + this.sava(this.$data.param.After_OK_Event); + }, + sava(event){ + var $this = this; if(this.$data.detail1StyleDefList.length==0){ uni.showModal({title:"鎻愮ず",content:"娌℃湁姝e湪鐮佺洏鐨勬暟鎹紒",showCancel:false,confirmText:"鍙栨秷"}); return false; @@ -703,85 +752,132 @@ detailAttrList.push(detail_attr); }); // console.log(detailAttrList); - - try { - if (this.$data.param.After_OK_Event.ID) { - var input_param = Base64.encode( - JSON.stringify( - Object.keys(head_attr).map((a) => ({ - attr: a, - value: head_attr[a] || "", - })) - ) - ); - var jsonlist=[]; - detailAttrList.forEach(attr=>{ - jsonlist.push({ - id:'', - attrs: Object.keys(attr).map((a) => ({ - attr: a, - value: attr[a] || "", - })) - }); - }); - // console.log(jsonlist); - var data_json = Base64.encode( - JSON.stringify(jsonlist) - ); - var $this = this; - var dataInfo={ - ed_type: 0, - start_transaction: '', - class_id: this.$data.head_styledef.form.clsId, - class_name: '', - event_id: this.$data.param.After_OK_Event.ID, - event_name: '', - data_obj_id: '', - obj_attr: '', - prj_id: '', - ref_cls_id: '', - rel_obj_id: '', - user_login: '', - data_json: data_json, - compose_info: '', - ext_info: '', - global_attr: '', - input_param: input_param, - }; - // console.log(dataInfo); - this.$store.dispatch('runCustomEvent',dataInfo).then(res=>{ - console.log(res); - if (res.err_code == 0) { - var result = res.result; - if(result.result_type == 0){ - $this.$data.head_styledef.form.items.forEach(item => { - item.value = ''; - item.oldvalue = ''; - $this.$data.head_styledef.form.model[item.fieldId] = ''; - }); - $this.$data.detail1StyleDefList=[]; - $this.$data.detail2StyleDefList=[]; - uni.showModal({title:"鎻愮ず",content:"鐮佺洏鎴愬姛",showCancel:false,confirmText:"鍙栨秷"}); - - }else{ - // $this.$data.detail2StyleDefList=[]; - if(result.info){ - uni.showModal({title:"鎻愮ず",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); - } - } - }else{ - uni.showModal({title:"閿欒8",content:res.err_msg,showCancel:false,confirmText:"鍙栨秷"}); - } - }).catch(ex=>{ - // console.log(ex); - uni.showModal({title:"閿欒8.1",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"}); - }); - } - } catch (ex) { - let tip = typeof ex == "string" ? ex : ex.message; - uni.showModal({title:"閿欒8.2",content:"鎵ц鈥滅‘瀹氬悗鈥濅簨浠跺け璐ワ細" + tip,showCancel:false,confirmText:"鍙栨秷"}); - } + //鑾峰彇姝e湪鐮佺洏閲屾病鏈夋樉绀虹殑瀛楁 + this.$data.detail1StyleDefList.forEach(style=>{ + style.form.attrs.forEach(attr => { + for(var key in detailAttrList){ + let keys = Object.keys(detailAttrList[key]); + let isflag = true; + keys.forEach((ele) => { + if(ele == attr.attr) isflag = false; + }); + if(isflag) { + detailAttrList[attr.attr] = attr.value; + } + } + }); + }); + // console.log(detailAttrList); + // return; + var input_param = Base64.encode( + JSON.stringify( + Object.keys(head_attr).map((a) => ({ + attr: a, + value: head_attr[a] || "", + })) + ) + ); + var jsonlist=[]; + detailAttrList.forEach(attr=>{ + jsonlist.push({ + id:'', + attrs: Object.keys(attr).map((a) => ({ + attr: a, + value: attr[a] || "", + })) + }); + }); + // console.log(jsonlist); + jsonlist.forEach(async (json,key)=>{ + await $this.runCustomEvent(event,input_param,json); + }); }, + //鎵ц纭畾鑴氭湰 + async runCustomEvent(event,input_param,json){ + var $this = this; + var data_json = Base64.encode( + JSON.stringify(json) + ); + var dataInfo={ + ed_type: 0, + start_transaction: true, + class_id: this.$data.head_styledef.form.clsId, + class_name: '', + event_id: this.$data.param.After_OK_Event.ID, + event_name: '', + data_obj_id: '', + obj_attr: '', + prj_id: '', + ref_cls_id: '', + rel_obj_id: '', + user_login: '', + data_json: data_json, + compose_info: '', + ext_info: '', + global_attr: '', + input_param: input_param, + }; + // console.log(dataInfo); + this.$store.dispatch('runCustomEvent',dataInfo).then(res=>{ + console.log(res); + if (res.err_code == 0) { + var result = res.result; + if (result.ret != 0) { + var tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info : result.err_info.join('<br/>') : ''; + if (result.ret == 801) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + else uni.showModal({title:'鎻愮ず',content:tip+',鎻愮ず:'+result.ret,showCancel:false,confirmText:"鍙栨秷"}); + return false + }else{ + let tip = result.info ? typeof result.info == 'string' ? result.info : result.info.join('<br/>') : ''; + if (tip) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + + if(result.result_type == 0){ + if(result.action){ + result.action.forEach(item=>{ + if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�+ var value = item.value; + //鍔犺浇宸茬粡鐮佺洏鏁版嵁 + $this.viewAceionRow(value,'add'); + //娓呯┖鏉$爜鍐呭 + $this.$data.head_styledef.form.items.forEach((item,index) => { + if(item.fieldId != "S_CNTR_CODE"){ + item.value = ''; + item.oldvalue = ''; + $this.$data.head_styledef.form.model[item.fieldId] = ''; + } + }); + //娓呴櫎姝e湪鐮佺洏涓垚鍔熺殑鏁版嵁 + $this.$data.detail1StyleDefList.forEach((style,index)=>{ + if(style.form.items[0].fieldId == json.attrs[0].attr && style.form.items[0].value == json.attrs[0].value){ + $this.$data.detail1StyleDefList.splice(index,1); + return; + } + }); + // this.detail2StyleDefList=[]; + uni.showModal({title:"鎻愮ず",content:"鐮佺洏鎴愬姛",showCancel:false,confirmText:"鍙栨秷"}); + } + }); + }else{ + if($this.$data.param.After_OK_Event.ID != event.ID){ //鍒ゆ柇褰撳墠浜嬩欢鏄惁鏄‘瀹氬悗浜嬩欢 + $this.sava($this.$data.param.After_OK_Event); //鎵ц纭畾鍚庝簨浠�+ } + } + }else{ + // $this.$data.detail2StyleDefList=[]; + if(result.info){ + uni.showModal({title:"鎻愮ず",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + } + } + } + }else{ + uni.showModal({title:"閿欒8",content:res.err_msg,showCancel:false,confirmText:"鍙栨秷"}); + } + }).catch(ex=>{ + let tip = typeof ex == "string" ? ex : ex.errMsg; + uni.showModal({title:"閿欒8.1",content:"鎵ц鈥滅‘瀹氬悗鈥濅簨浠跺け璐ワ細" + tip,showCancel:false,confirmText:"鍙栨秷"}); + }); + }, + cancel(e){ //鍙栨秷 uni.navigateBack({ delta:1 //杩斿洖灞傛暟锛�鍒欎笂涓婇〉 -- Gitblit v1.9.1