| | |
| | | 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) |
| | |
| | | //刷新 |
| | | 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){ |
| | |
| | | start_transaction: true, |
| | | class_id: $this.param.DataCls.id, |
| | | event_id: eventid, |
| | | data_obj_id:$this.styledef.form.objId, |
| | | obj_attr, |
| | | input_param, |
| | | }); |
| | |
| | | }, |
| | | |
| | | 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 ,//返回层数,2则上上页 |
| | | }); |
| | |
| | | * ] |
| | | * } |
| | | */ |
| | | |
| | | 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> |