From e48615ec0a07b304b0287271f7f3833f8587b376 Mon Sep 17 00:00:00 2001 From: jt <jt@activesoft.com.cn> Date: 星期一, 21 八月 2023 16:52:33 +0800 Subject: [PATCH] 5600码盘页面功能新增 --- pages/modal/classAttr.vue | 358 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 298 insertions(+), 60 deletions(-) diff --git a/pages/modal/classAttr.vue b/pages/modal/classAttr.vue index d997aa8..44861c6 100644 --- a/pages/modal/classAttr.vue +++ b/pages/modal/classAttr.vue @@ -109,14 +109,17 @@ margin-top: -6rpx; display: inline-block; float: right; - font-size: 44rpx; + font-size: 48rpx; + } + .text-right a,.text-right2 a{ + color: #337ab7; } .text-right2 { margin: 0; vertical-align: -4px; margin-left: 9px; float: none; - font-size: 44rpx; + font-size: 48rpx; display: inline-block; } .section_iput{ @@ -205,6 +208,112 @@ .input_vallist ul li a i { font-size: 45rpx; } + .view-popup{ + position:relative; + } + .popup-content { + @include flex; + align-items: center; + justify-content: center; + padding: 30rpx; + background-color: #fff; + /* height: 150px; */ + /* border: 1px solid red; */ + } + .popup-cont { + overflow-y: auto; + /* border: 1px solid red; */ + } + .popup-height { + @include height; + /* width: 200px; */ + } + .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; + margin-right: 20rpx; + padding: 15rpx; + line-height: 1.5; + background: #27A6E1; + border: none; + color: #fff; + font-size: 38rpx; + font-weight: bold; + /* float: left; */ + display: inline-block; + } + button.btn_popup_cancel { + width:180rpx; + margin-top: 50rpx; + padding: 15rpx; + line-height: 1.5; + background: #27A6E1; + border: none; + color: #fff; + font-size: 38rpx; + font-weight: bold; + /* float: right; */ + display: inline-block; + } +</style> +<style> + .touch-item { + background-color: #F8F9FC; + display: flex; + justify-content: space-between; + width: 100%; + overflow: hidden + } + + .itemcontent { + display: flex; + flex-direction: column; + padding: 5px 10px; + border-bottom: 1px solid #eeeeee; + margin-right: 0; + margin-left: -100px; + width: 100%; + -webkit-transition: all 0.4s; + transition: all 0.4s; + -webkit-transform: translateX(100px); + transform: translateX(100px); + position: relative; + } + + .itembtn { + width: 100px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background-color: #119bf8; + color: white; + position: relative; + -webkit-transform: translateX(100px); + transform: translateX(100px); + -webkit-transition: all 0.4s; + transition: all 0.4s; + } + + .touch-move-active .itemcontent, + .touch-move-active .itembtn { + -webkit-transform: translateX(0); + transform: translateX(0); + } </style> <template> @@ -226,7 +335,7 @@ <div class="text-right" v-if="attr.ext_button==true"> <a @tap="classAttr_extButton(index,iindex)" ><i class="ace-icon fa fa-plus-circle"></i></a> </div> - <input type="text" :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" :disabled="attr.edit?false:true" > <!-- =='flase'?true:false --> + <input :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁�?'number':'text'" :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" :disabled="attr.edit?false:true" > <!-- =='flase'?true:false --> <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='2'" :data-index="index":data-iindex="iindex" style="height:60px;" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='3'" :data-index="index":data-iindex="iindex" style="height:90px;" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> <!-- 鎵爜鍚庝簨浠惰繑鍥�--> @@ -238,7 +347,7 @@ </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> - <input type="text" class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true" > + <input :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁�?'number':'text'" class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true" > <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='2'" :data-index="index":data-iindex="iindex" style="height:60px;" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true"></textarea> <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='3'" :data-index="index":data-iindex="iindex" style="height:90px;" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true"></textarea> <div class="text-right2" v-if="attr.ext_button==true"> @@ -378,6 +487,31 @@ </view> <button type="default" @tap="cancel" class="btn_cancel">鍙栨秷</button> <button type="default" @tap="sava" class="btn_add">{{title}}</button> + <!-- 鏅�寮圭獥 top bottom center left right --> + <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' }" + :style="{'width':check_list.width?check_list.width+'px':'200px','height':check_list.height?check_list.height+'px':'88%'}"> + <view class="popup-cont" :style="{'height':check_list.height?check_list.height-45+'px':'415px'}"> + <view class="view_popup_CheckList" v-for="(item,index) in check_list.items"> + <checkbox-group class="check_list" @change="checkChange" :data-ischeck="item.check" :data-index="index" :style="{'margin-left': '10rpx'}"> + <label> + <checkbox :value="item.check" :checked="item.check"/> + <text>{{item.name}}</text> + </label> + </checkbox-group> + </view> + </view> + <view class="popup-footer"> + <button type="default" @tap="popup_sava" class="btn_popup_add">纭畾</button> + <button type="default" @tap="popup_cancel" class="btn_popup_cancel">鍙栨秷</button> + </view> + </view> + </uni-popup> + </view> + <!-- <button class="button" type="primary" @click="classAttr_extButton('right')"><text class="button-text">鍙充晶</text></button> --> + </view> </template> @@ -399,7 +533,10 @@ edit_compose_cls_id:"", global_attr:[], refdatastore: [], //寮曠敤鏁版嵁瀛樺偍鍖�/ {attr:'G_PRJ_' + bindattr + '_ID', value:info.id} - inputValList:[{Name:"test"},{Name:"test2"},{Name:"test3"},{Name:"test4"},{Name:"test5"},{Name:"test6"},{Name:"test7"}] + inputValList:[{Name:"test"},{Name:"test2"},{Name:"test3"},{Name:"test4"},{Name:"test5"},{Name:"test6"},{Name:"test7"}], + popupType:"center", + check_list:{}, + popupParam:{}, } }, onLoad(options) { @@ -448,6 +585,97 @@ }, methods: { + classAttr_extButton(index,iindex){ //寮规灞傛樉绀�type:top bottom center left right + var $this = this; + $this.$data.popupType = 'right' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this.$refs.popup.open($this.popupType); + var data_attr = $this.$data.classAttrList[index].Attr[iindex]; + // var value = action.value; + // var action ={"action_type":"open_common_dlg","value":{"common_dlg_id":"check_list","config":{"title":"鐢熶骇宸ュ崟","appear_style":"sideslip","width":250,"multiple_choice":"1","items":[{"id":"133D50D7-D798-4D2E-A15F-308365092DF5","name":"5100691673", "check":false},{"id":"22992021-7D3B-4959-86B7-EF184B596AC6","name":"5100691674", "check":false},{"id":"48FBBE8E-594D-45D5-8C24-385C661C4A1C","name":"5100691675", "check":false},{"id":"4E429C60-325A-42ED-BEA3-B3397C07CCA1","name":"5100691668", "check":false}]}}} + // if (action.action_type == 'open_common_dlg') { + // var value = action.value; + // if(value.common_dlg_id == 'check_list'){ + // $this.$data.check_list= value.config; + // } + // } + // var popupParam={ + // index: index, + // iindex: iindex, + // button_callback:"", + // req:"", + // data_attr:data_attr + // } + // $this.$data.popupParam= popupParam; + // return; + var before_click_button = $this.$data.classAttrList[index].Attr[iindex].before_click_button; + var button_callback = $this.$data.classAttrList[index].Attr[iindex].button_callback; + if(!before_click_button){ + uni.showModal({title:"鎻愮ず",content:"before_click_button-event_id涓虹┖锛�,showCancel:false,confirmText:"鍙栨秷"}); + return; + } + if(!button_callback){ + uni.showModal({title:"鎻愮ず",content:"button_callback-event_id涓虹┖锛�,showCancel:false,confirmText:"鍙栨秷"}); + return; + } + this.DataObjRunCustomEvent_Return(before_click_button, data_attr, button_callback, index,iindex); + }, + popupChange(e) { + console.log('褰撳墠妯″紡锛� + e.type + ',鐘舵�锛� + e.show); + }, + checkChange(e){ //寮规check閫夋嫨 + // console.log(e.target.dataset); + var index = e.target.dataset.index; + var ischeck = e.target.dataset.ischeck; + var data = this.$data.check_list.items; + // this.$data.check_list.items=[]; + if(this.$data.check_list.multiple_choice=="0"){ //鍒ゆ柇鏃跺崟閫夎繕鏄閫�+ for(var i in data){ + data[i].check=false; + } + } + data[index].check=ischeck?false:true; + this.$data.check_list.items=data; + + }, + popup_cancel(e){ //寮规鍙栨秷 + this.$refs.popup.close(); + }, + popup_sava(e){ //寮规纭畾 + var $this = this; + var items = $this.$data.check_list.items; + var data=[]; + var name=""; + for (var i = 0; i < items.length; i++) { + if(items[i].check==true){ + if(name) + name+=';'; + name+=items[i].name; + data.push({id:items[i].id,name:items[i].name}); + } + } + if(!$this.$data.popupParam){ + uni.showModal({title:"鎻愮ず",content:"popupParam涓虹┖锛�,showCancel:false,confirmText:"鍙栨秷"}); + return; + } + $this.$data.classAttrList[$this.$data.popupParam.index].Attr[$this.$data.popupParam.iindex].Value=name; + console.log(data); + var callback_eventid = $this.$data.popupParam.button_callback.trim(); + var info = { + eventid: callback_eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: $this.$data.param.clsid, + objid: "", + attr: $this.$data.popupParam.req, + dataJson: data + } + $this.DataObjRunCustomEvent(info, $this.$data.popupParam.data_attr); + this.$refs.popup.close(); + }, cancel(e){ uni.navigateBack({ delta:1 //杩斿洖灞傛暟锛�鍒欎笂涓婇〉 @@ -539,6 +767,7 @@ clsid: this.$data.param.clsid, objid: "", attr: req, + dataJson:[] } this.DataObjRunCustomEvent(info); } @@ -549,7 +778,8 @@ // console.log(item); // console.log(value); // console.log(delvalue); - if(item.length==0){ //涓虹┖鏃讹紝娓呯┖灞炴�value + //涓虹┖鏃讹紝娓呯┖灞炴�value + if(item.length==0){ var index ,iindex,dindex=0; for(var i in this.$data.classAttrList){ for(var j in this.$data.classAttrList[i].Attr){ @@ -559,13 +789,13 @@ } } } - + for(var v in item){ var index ,iindex,dindex=0; for(var i in this.$data.classAttrList){ for(var j in this.$data.classAttrList[i].Attr){ if(item[v].attr == this.$data.classAttrList[i].Attr[j].Name){ - index=i;iindex=j;dindex=d; + index=i;iindex=j; } } } @@ -607,6 +837,7 @@ clsid: this.$data.param.clsid, objid: "", attr: req, + dataJson:[], } this.DataObjRunCustomEvent(info); } @@ -650,6 +881,7 @@ clsid: this.$data.param.clsid, objid: "", attr: req, + dataJson:[], } this.DataObjRunCustomEvent(info, data_attr); } @@ -693,6 +925,7 @@ clsid: this.$data.param.clsid, objid: "", attr: req, + dataJson:[], } this.DataObjRunCustomEvent(info); } @@ -708,21 +941,6 @@ // console.log(e.target); console.log(e.data.join(';')) this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=e.data.join(';'); - }, - classAttr_extButton(index,iindex){ - var $this = this; - var before_click_button = $this.$data.classAttrList[index].Attr[iindex].before_click_button; - var button_callback = $this.$data.classAttrList[index].Attr[iindex].button_callback; - if(!before_click_button){ - uni.showModal({title:"鎻愮ず",content:"before_click_button-event_id涓虹┖锛�,showCancel:false,confirmText:"鍙栨秷"}); - return; - } - if(!button_callback){ - uni.showModal({title:"鎻愮ず",content:"button_callback-event_id涓虹┖锛�,showCancel:false,confirmText:"鍙栨秷"}); - return; - } - var data_attr = this.$data.classAttrList[index].Attr[iindex]; - this.DataObjRunCustomEvent_Return(before_click_button, data_attr, button_callback, index,iindex); }, classAttr_AddPer(index,iindex){ var param={index:index,iindex:iindex}; @@ -750,6 +968,7 @@ clsid: $this.$data.param.clsid, objid: "", attr: [], + dataJson:[], } // var data_attr = $this.$data.classAttrList[param.index].Attr[param.iindex]; @@ -792,6 +1011,7 @@ clsid: $this.$data.param.clsid, objid: "", attr: [], + dataJson:[], } // var data_attr = $this.$data.classAttrList[param.index].Attr[param.iindex]; @@ -873,23 +1093,26 @@ console.log(success); uni.hideLoading(); if (success.code=='00000') { - var action = JSON.parse(success.data.Action); - console.log(action); - if(action.ret=='0'){ - if (action.ret != 0) { - uni.showModal({title:"鎻愮ず",content:'鎵ц鑴氭湰澶辫触锛� + action.result,showCancel:false,confirmText:"鍙栨秷"}); - return; + if(success.data.Action){ + var action = JSON.parse(success.data.Action); + console.log(action); + if(action.ret=='0'){ + if (action.ret != 0) { + uni.showModal({title:"鎻愮ず",content:'鎵ц鑴氭湰澶辫触锛� + action.result,showCancel:false,confirmText:"鍙栨秷"}); + return; + } + if (action.info) { + uni.showModal({title:"鎻愮ず",content:'鎵ц鑴氭湰澶辫触锛� + action.info,showCancel:false,confirmText:"鍙栨秷"}); + return; + } + if(action.result_type=='0'){ + uni.showToast({title:action.result,icon:"success",duration:3000}); + } + + // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" } - if (action.info) { - uni.showModal({title:"鎻愮ず",content:'鎵ц鑴氭湰澶辫触锛� + action.info,showCancel:false,confirmText:"鍙栨秷"}); - return; - } - if(action.result_type=='0'){ - uni.showToast({title:action.result,icon:"success",duration:3000}); - } - - // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" - } + } else + uni.showToast({title:"鍒涘缓鎴愬姛锛�,icon:"success",duration:3000}); //鍒锋柊 uni.redirectTo({ url:'../modal/classAttr?param='+JSON.stringify(this.$data.param)+"&titlename="+this.$data.title @@ -1077,27 +1300,23 @@ var value = action.value; if (action_type == 'set_dlg_attr') { if (value) { - var val = value; - if (typeof value == 'string') { - val = JSON.parse(value); - } - console.log(val); - for (var i = 0; i < val.length; i++) { + console.log(value); + for (var i = 0; i < value.length; i++) { for (var a = 0; a < this.$data.classAttrList.length; a++) { for (var l = 0; l < this.$data.classAttrList[a].Attr.length; l++) { var ca = this.$data.classAttrList[a].Attr[l]; - if (val[i].attr == ca.Name) { + if (value[i].attr == ca.Name) { if(ca.Type=='瀛楀吀' || ca.Type=='瀛楀吀-瀛楃涓� || ca.Type=='瀛楀吀-鏁存暟'){ var dictItemList=[]; - for(var d in val[i].choice_list){ - var list_val =val[i].choice_list[d]; + for(var d in value[i].choice_list){ + var list_val =value[i].choice_list[d]; dictItemList.push({"CN_S_NAME":list_val,"Name":list_val,"label":list_val,"value":list_val}); } ca.dictitem = dictItemList; // attr[j].dictitem = val[i].choice_list; }else{ - // ca.value = val[i].value; + ca.Value = value[i].value; } } } @@ -1105,15 +1324,15 @@ var length = 0; if (!this.$data.refdatastore.filter(function (s) { - return val[i].attr == s.attr + return value[i].attr == s.attr }).length) { length = 1; - this.$data.refdatastore.push(val[i]); + this.$data.refdatastore.push(value[i]); } if (length == 0) { for (var j = 0; j < this.$data.refdatastore.length; j++) { - if (this.$data.refdatastore[j].attr == val[i].attr) { - this.$data.refdatastore[j].value = val[i].value; + if (this.$data.refdatastore[j].attr == value[i].attr) { + this.$data.refdatastore[j].value = value[i].value; } } } @@ -1169,7 +1388,8 @@ var dataInfo = { edtype: info.edtype, eventid: info.eventid, projectid: info.projectid.replace('{','').replace('}',''), rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, - attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: '', global_attr: JSON.stringify(this.$data.global_attr) + attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: "", + global_attr: JSON.stringify(this.$data.global_attr), dataJson:JSON.stringify(info.dataJson) } console.log(dataInfo); this.$store.dispatch('DataObjRunCustomEventInfo',dataInfo).then(success=>{ @@ -1185,7 +1405,7 @@ if (action.action_type == 'set_dlg_attr') { var result = action.value; for (var i = 0; i < result.length; i++) { - if (result[i].choice_list) { + if (result[i].choice_list) { for (var c = 0; c < $this.$data.classAttrList.length; c++) { var attr = $this.$data.classAttrList[c].Attr; for (var j = 0; j < attr.length; j++) { @@ -1467,7 +1687,8 @@ clsid: $this.$data.param.clsid, objid: "", attr: param.req, - inputparameter: data + inputparameter: data, + dataJson:[], } $this.DataObjRunCustomEvent(info, param.data_attr); } @@ -1475,15 +1696,31 @@ }); } else if (action.action_type == 'open_data_query_dlg') { - - } - else if (action.action_type == 'open_common_dlg') { - var value = action.value; var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + '鎻愮ず', content: action.action_type + '姝ction灏氭湭澶勭悊锛� }); d.show(); + } + else if (action.action_type == 'open_common_dlg') { + var $this = this; + if(val.common_dlg_id == 'check_list'){ + $this.$data.check_list= val.config; + if(val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+ $this.$data.popupType = 'right'; + else + $this.$data.popupType = 'center' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this.$refs.popup.open($this.$data.popupType); + var popupParam={ + index: index, + iindex:iindex, + button_callback:button_callback, + req:req, + data_attr:data_attr + } + $this.$data.popupParam= popupParam; + } } else if (action.action_type == 'open_project_query_dlg') { //console.log(action.value.select_range); @@ -1527,6 +1764,7 @@ clsid: $this.$data.param.clsid, objid: "", attr: param.req, + dataJson:[], } $this.DataObjRunCustomEvent(info); -- Gitblit v1.9.1