From 69d1bd7b11a673e9e675055966e1b027de310858 Mon Sep 17 00:00:00 2001 From: jt <jt@activesoft.com.cn> Date: 星期日, 09 六月 2024 13:03:15 +0800 Subject: [PATCH] mobox3PDA码盘功能page_rowaction支持多条数据显示改进 --- pages/modal/3200.vue | 342 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 197 insertions(+), 145 deletions(-) diff --git a/pages/modal/3200.vue b/pages/modal/3200.vue index f994c85..3b0a5a3 100644 --- a/pages/modal/3200.vue +++ b/pages/modal/3200.vue @@ -674,35 +674,85 @@ uni.setNavigationBarTitle({ title: options.titlename}); //璁剧疆椤堕儴鏍囬 this.$data.title = options.titlename; this.$data.param = JSON.parse(options.param); - this.isFilter=true; - if(this.param.ShowFilter) - this.isFilter=false; - //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�- if(this.param.Query_Panel){ - this.Head_UIStyleGetInfo(this.param.DataCls.id,this.param.Query_Panel.id); - } - if(this.param.ListPage.ListItem_UIDef?.ui_type=="HTML椤甸潰"){ - // HTML椤甸潰 - //鑾峰彇鏁版嵁绫荤殑HTML椤甸潰 - await this.Html_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id); - }else{ - await this.Detail1_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id); - } - this.orderby = this.param.Order?this.param.Order:'T_CREATE Desc'; - if(this.param.Query_Event){ - await this.onSearChange(this.param.DataCls.id,this.param.Query_Event.id); - } else{ - this.wheres = this.param.Condition; - this.pageindex = 1; - this.page_size = 3; - this.query_id = ""; - await this.loadDataGetList(); - } - console.log(this.$data.param); + this.initial(); + // this.isFilter=true; + // if(this.param.ShowFilter) + // this.isFilter=false; + // //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�+ // if(this.param.Query_Panel){ + // this.Head_UIStyleGetInfo(this.param.DataCls.id,this.param.Query_Panel.id); + // } + // if(this.param.ListPage.ListItem_UIDef?.ui_type=="HTML椤甸潰"){ + // // HTML椤甸潰 + // //鑾峰彇鏁版嵁绫荤殑HTML椤甸潰 + // await this.Html_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id); + // }else{ + // await this.Detail1_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id); + // } + // this.orderby = this.param.Order?this.param.Order:'T_CREATE Desc'; + // if(this.param.Query_Event){ + // await this.onSearChange(this.param.DataCls.id,this.param.Query_Event.id); + // } else{ + // this.wheres = this.param.Condition; + // this.pageindex = 1; + // this.page_size = 3; + // this.query_id = ""; + // await this.loadDataGetList(); + // } + // console.log(this.$data.param); //椤甸潰鍒濆鍖栬幏鍙栫劍鐐� // this.focusMateria=true; }, methods: { + //鍒濆鍖�+ async initial(){ + this.styledef={}; + this.head_styledef={ + form:{ + items:[] + } + }; + this.detail1_styledef={}; + this.detail1StyleDefList=[]; + this.detail2_styledef={}; + this.detail2StyleDefList=[]; + this.items=[]; + this.active_id=''; + this.activelist=[]; + this.ListHtml_Panel=""; + this.ListPageHtml_Show= { + name: "", + event: { + id: "", + name: "" + } + }; + + this.isFilter=true; + if(this.param.ShowFilter) + this.isFilter=false; + //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�+ if(this.param.Query_Panel){ + this.Head_UIStyleGetInfo(this.param.DataCls.id,this.param.Query_Panel.id); + } + if(this.param.ListPage.ListItem_UIDef?.ui_type=="HTML椤甸潰"){ + // HTML椤甸潰 + //鑾峰彇鏁版嵁绫荤殑HTML椤甸潰 + await this.Html_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id); + }else{ + await this.Detail1_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id); + } + this.orderby = this.param.Order?this.param.Order:'T_CREATE Desc'; + if(this.param.Query_Event){ + await this.onSearChange(this.param.DataCls.id,this.param.Query_Event.id); + } else{ + this.wheres = this.param.Condition; + this.pageindex = 1; + this.page_size = 3; + this.query_id = ""; + await this.loadDataGetList(); + } + }, //婊氬姩鍒板簳閮ㄥ悗鎳掑姞杞芥暟鎹� async scrolltolower(e) { // console.log(e) @@ -1071,10 +1121,10 @@ //鍒锋柊 Refresh(value){ //鍒锋柊褰撳墠椤甸潰 - // location.reload(); - uni.redirectTo({ - url:'../modal/3200?param='+JSON.stringify(this.$data.param)+"&titlename="+this.$data.title - }); + this.initial(); + // uni.redirectTo({ + // url:'../modal/3200?param='+JSON.stringify(this.$data.param)+"&titlename="+this.$data.title, + // }); }, //鐐瑰嚮鏄剧ず娴忚瀵硅薄鏄剧ず椤甸潰 async onViewPageClick(style){ @@ -1103,6 +1153,7 @@ start_transaction: true, class_id: $this.param.DataCls.id, event_id: eventid, + data_obj_id:$this.styledef.form.objId, obj_attr, input_param, }); @@ -1511,9 +1562,9 @@ }, cancel(e){ //鍙栨秷 - var eventChannel = this.$scope.eventChannel; - // const eventChannel = this.getOpenerEventChannel(); - eventChannel.emit('view_3201',""); + // var eventChannel = this.$scope.eventChannel; + // // const eventChannel = this.getOpenerEventChannel(); + // eventChannel.emit('view_3201',""); uni.navigateBack({ delta:1 ,//杩斿洖灞傛暟锛�鍒欎笂涓婇〉 }); @@ -1538,127 +1589,128 @@ * ] * } */ + toWhereBase64String(list) { - if (typeof list == 'string') list = [list] - var sql = [] - var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=', '>', ' like'] - list.forEach(ls => { - var where = ls.trim().toLowerCase() - if (where.startsWith('(') && where.endsWith(')')) where = where.replace(/^\(/, '').replace(/\)$/, '') - if (where.includes(' and ')) { - // 浜岀骇and鏀惧湪绗竴绾ф暟缁勪腑 - where.split(' and ').forEach(li => { - var l = li.trim() - if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '') - var sep = '' - for (var i = 0; i < seps.length; i++) { - if (l.includes(seps[i])) { - sep = seps[i] - break - } - } - if (sep) { - var values = l.split(sep) - var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '') - var value = '' - var op = sep.trim() + if (typeof list == 'string') list = [list] + var sql = [] + var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=', '>', ' like'] + list.forEach(ls => { + var where = ls.trim() + if (where.startsWith('(') && where.endsWith(')')) where = where.replace(/^\(/, '').replace(/\)$/, '') + if (where.toLowerCase().includes(' and ')) { + // 浜岀骇and鏀惧湪绗竴绾ф暟缁勪腑 + where.split(/ and /i).forEach(li => { + var l = li.trim() + if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '') + var sep = '' + for (var i = 0; i < seps.length; i++) { + if (l.toLowerCase().includes(seps[i])) { + sep = seps[i] + break + } + } + if (sep) { + var values = l.split(new RegExp(sep, 'i')) + var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '') + var value = '' + var op = sep.trim() - if ([' in', ' not in'].includes(sep) && values[1].includes('select ') && values[1].includes(' from ')) { - value = l.replace(field, '').replace(/^\s*(in|not in)\s*/, '').trim() - if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim() - } - else { - value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '') + if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) { + value = l.replace(field, '').replace(/^\s*(in|not in)\s*/i, '').trim() + if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim() + } + else { + value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '') - if (['in', 'not in'].includes(op)) { - value = value.replace(/^\(/, '').replace(/\)$/, '') - value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, '')) - } - } - sql.push([{ field, value, op }]) - } - }) - } - else if (where.includes(' or ')) { - // 浜岀骇or鏀惧湪绗簩绾у悓涓�粍鏁扮粍涓�- var s = [] - where.split(' or ').forEach(li => { - var l = li.trim() - if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '') - var sep = '' - for (var i = 0; i < seps.length; i++) { - if (l.includes(seps[i])) { - sep = seps[i] - break - } - } - if (sep) { - var values = l.split(sep) - var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '') - var value = '' - var op = sep.trim() + if (['in', 'not in'].includes(op)) { + value = value.replace(/^\(/, '').replace(/\)$/, '') + value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, '')) + } + } + sql.push([{ field, value, op }]) + } + }) + } + else if (where.toLowerCase().includes(' or ')) { + // 浜岀骇or鏀惧湪绗簩绾у悓涓�粍鏁扮粍涓�+ var s = [] + where.split(/ or /i).forEach(li => { + var l = li.trim() + if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '') + var sep = '' + for (var i = 0; i < seps.length; i++) { + if (l.toLowerCase().includes(seps[i])) { + sep = seps[i] + break + } + } + if (sep) { + var values = l.split(new RegExp(sep, 'i')) + var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '') + var value = '' + var op = sep.trim() - if ([' in', ' not in'].includes(sep) && values[1].includes('select ') && values[1].includes(' from ')) { - value = l.replace(field, '').replace(/^\s*(in|not in)\s*/, '').trim() - if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim() - } - else { - value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '') + if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) { + value = l.replace(field, '').replace(/^\s*(in|not in)\s*/i, '').trim() + if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim() + } + else { + value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '') - if (['in', 'not in'].includes(op)) { - value = value.replace(/^\(/, '').replace(/\)$/, '') - value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, '')) - } - } - sql.push([{ field, value, op }]) - } - }) - sql.push(s) - } - else { - var li = where - // 鍗曚竴鏌ヨ鏉′欢鐩存帴鏀惧湪绗竴绾ф暟缁勪腑 - var l = li.trim() - if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '') - var sep = '' - for (var i = 0; i < seps.length; i++) { - if (l.includes(seps[i])) { - sep = seps[i] - break - } - } - if (sep) { - var values = l.split(sep) - var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '') - var value = '' - var op = sep.trim() + if (['in', 'not in'].includes(op)) { + value = value.replace(/^\(/, '').replace(/\)$/, '') + value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, '')) + } + } + sql.push([{ field, value, op }]) + } + }) + sql.push(s) + } + else { + var li = where + // 鍗曚竴鏌ヨ鏉′欢鐩存帴鏀惧湪绗竴绾ф暟缁勪腑 + var l = li.trim() + if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '') + var sep = '' + for (var i = 0; i < seps.length; i++) { + if (l.toLowerCase().includes(seps[i])) { + sep = seps[i] + break + } + } + if (sep) { + var values = l.split(new RegExp(sep,'i')) + var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '') + var value = '' + var op = sep.trim() - if ([' in', ' not in'].includes(sep) && values[1].includes('select ') && values[1].includes(' from ')) { - value = l.replace(field, '').replace(/^\s*(in|not in)\s*/, '').trim() - if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim() - } - else { - value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '') + if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) { + value = l.replace(field, '').replace(/^\s*(in|not in)\s*/i, '').trim() + if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim() + } + else { + value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '') - if (['in', 'not in'].includes(op)) { - value = value.replace(/^\(/, '').replace(/\)$/, '') - value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, '')) - } - } - sql.push([{ field, value, op }]) - } - } - }) + if (['in', 'not in'].includes(op)) { + value = value.replace(/^\(/, '').replace(/\)$/, '') + value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, '')) + } + } + sql.push([{ field, value, op }]) + } + } + }) - if (sql.length > 0) - return Base64.encode(JSON.stringify({ - model: 1, - condition: sql - })) - else - return '' - } - + if (sql.length > 0) + return Base64.encode(JSON.stringify({ + model: 1, + condition: sql + })) + else + return '' + }, + }, }; </script> -- Gitblit v1.9.1