From a2f5317f01290597eb44aaf80aa535ff468a61c5 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期四, 05 六月 2025 17:10:46 +0800 Subject: [PATCH] 3202 set_subtable_page_content --- pages/modal/3201.vue | 1093 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 621 insertions(+), 472 deletions(-) diff --git a/pages/modal/3201.vue b/pages/modal/3201.vue index d538e30..5e6160a 100644 --- a/pages/modal/3201.vue +++ b/pages/modal/3201.vue @@ -1,21 +1,22 @@ - <template> - <view class="content"> + <view class="uni-page-modal-3201" :class="largeMode?'large-mode':''"> <view class="dv_head"> <uni-section :title="title"> - <view class="example" :style="{'background-color':param.welcome_page.bkground_color,'height':(param.welcome_page.height+30)+'px'}"> - <uni-transition ref="ani" custom-class="transition" :duration="duration" :mode-class="modeClass" :styles="styles" :show="show"> - <image :src="param.welcome_page.img" - :style="{'width':param.welcome_page.width+'px','height':param.welcome_page.height+'px'}"></image> + <view class="example" + :style="{'background-color':param.welcome_page.bkground_color,'height':(param.welcome_page.height+30)+'px'}"> + <uni-transition ref="ani" custom-class="transition" :duration="duration" :mode-class="modeClass" + :styles="styles" :show="show"> + <image :src="param.welcome_page.img" + :style="{'width':param.welcome_page.width+'px','height':param.welcome_page.height+'px'}"> + </image> </uni-transition> </view> </uni-section> </view> - + <view class="dv_content"> - <view class="dv_panel" v-for="(item,index) in param.catalog" - :style="{'background-color':item.bkground_color}" @tap="onViewClick(item)" - > + <view class="dv_panel" v-for="(item,index) in param.catalog" + :style="{'background-color':item.bkground_color}" @tap="onViewClick(item)"> <view class="panel_image_uploadlist"> <image :src="item.img"></image> </view> @@ -24,493 +25,641 @@ <span>{{item.taskQty}}</span> </view> </view> - + </view> - </view> + </view> </template> <script> -import Base64 from '../../components/js-base64/base64.js' -import classUtils from "@/js/utils.js" -export default { - modules:{ - Base64, - }, - data() { - return { - title:'3201棣栭〉', - param: {}, - show: true, - duration:0, - modeClass: ['fade', 'slide-left'], - styles: { - justifyContent: 'center', - alignItems: 'center', - width: '100px', - height: '100px', - borderRadius: '5px', - textAlign: 'center', - backgroundColor: '#fff', - }, - wheres:'', - orderby:'', - }; - }, - onReady() { - // console.log(1111); - // this.$refs.ani.init({ - // duration: 1000, //杩囨浮鍔ㄧ敾鎸佺画鏃堕棿锛屽崟浣峬s - // timingFunction: 'linear', - // transformOrigin: '50% 50%', - // delay: 500 //鍔ㄧ敾寤惰繜鏃堕棿锛屽崟浣�ms - // }); - // this.$refs.ani.step({ - // // translateX: '50px' - // },{ - // duration: 1000, //杩囨浮鍔ㄧ敾鎸佺画鏃堕棿锛屽崟浣峬s - // timingFunction: 'linear', - // transformOrigin: '50% 50%', - // delay: 500 //鍔ㄧ敾寤惰繜鏃堕棿锛屽崟浣�ms - // }); - // // 寮�鎵ц鍔ㄧ敾 - // this.$refs.ani.run(()=>{ - // console.log('鍔ㄧ敾鏀寔瀹屾瘯') - // }); - }, - async onLoad(options) { - // console.log(options); - this.duration=2000; - uni.setNavigationBarTitle({ title: options.titlename}); //璁剧疆椤堕儴鏍囬 - this.$data.title = options.titlename; - this.$data.param = JSON.parse(options.param); - console.log(this.$data.param); - //鍔犺浇鍒濆鐣岄潰 - if(this.$data.param.welcome_page){ - this.$data.styles.width = this.$data.param.welcome_page.width+'px'; - this.$data.styles.height = this.$data.param.welcome_page.height+'px'; - this.$data.styles.backgroundColor = this.$data.param.welcome_page.bkground_color; - - this.$data.param.welcome_page.img = this.$data.param.welcome_page.img.replace(/ /g,'+'); - this.$data.param.welcome_page.width = parseInt(this.$data.param.welcome_page.width); - this.$data.param.welcome_page.height = parseInt(this.$data.param.welcome_page.height); - this.$data.param.catalog.forEach(async (ele,index) => { - ele.img = ele.img.replace(/ /g,'+'); - ele.taskQty=0; - await this.appGetInfo(ele.function_def_id,index); - }); - } + import { + Base64 + } from '@/js/Base64.js'; + import classUtils from "@/js/utils.js" + import { + appGetInfo, + dictGetInfo + } from "@/api/mobox.js" + import { + getUIStyleInfo, + runCustomEvent, + dataObjQuery, + + } from "@/api/data.js" + import buttonClickMixin from '@/mixins/button-click.js'; - }, - methods: { - //鑾峰彇鍔熻兘鐐逛俊鎭�- appGetInfo(appid,index){ - var $this = this; - var json ={ - app_id: [appid] - }; - this.$store.dispatch('appGetInfo',json).then(async success=>{ - // console.log(success); - if (success.err_code == 0) { - var app = success.result[0]; - var paramStr = app.param; - var appName = app.name; - var defCode = app.def_code; - var param = ""; - if(paramStr){ - //mobox2鐨刾aram鏄痡son瀛楃涓�- param = paramStr.replace(/\\/g,""); - //mobox3鐨刾aram鏄痓ase64瀛楃涓�- if(!paramStr.includes('"')) param = Base64.decode(paramStr); - } - if(!param){ - uni.showModal({title:"鎻愮ず",content:defCode+"璇ュ姛鑳界偣鏈厤缃弬鏁帮紝璇烽噸鏂伴厤缃弬鏁帮紒",showCancel:false,confirmText:"鍙栨秷"}); - return; - } - this.$data.param.catalog[index].param=param; - this.$data.param.catalog[index].appName=appName; - param = JSON.parse(param); - - $this.orderby = param.Order?param.Order:'T_CREATE Desc'; - if(param.Query_Event){ - await $this.onSearChange(param.DataCls.id,param.Query_Event.id,index); - } else{ - $this.wheres = param.Condition; - await $this.loadDataGetList(param.DataCls.id,index); - } - }else{ - uni.showModal({title:"鎻愮ず",content:success.msg,showCancel:false,confirmText:"鍙栨秷"}); + export default { + mixins: [buttonClickMixin], + data() { + return { + largeMode: getApp().globalData.largeMode || false, + title: '3201棣栭〉', + param: {}, + show: true, + duration: 0, + modeClass: ['fade', 'slide-left'], + styles: { + justifyContent: 'center', + alignItems: 'center', + width: '100px', + height: '100px', + borderRadius: '5px', + textAlign: 'center', + backgroundColor: '#fff', + }, + wheres: '', + orderby: '', + }; + }, + onReady() { + // console.log(1111); + // this.$refs.ani.init({ + // duration: 1000, //杩囨浮鍔ㄧ敾鎸佺画鏃堕棿锛屽崟浣峬s + // timingFunction: 'linear', + // transformOrigin: '50% 50%', + // delay: 500 //鍔ㄧ敾寤惰繜鏃堕棿锛屽崟浣�ms + // }); + // this.$refs.ani.step({ + // // translateX: '50px' + // },{ + // duration: 1000, //杩囨浮鍔ㄧ敾鎸佺画鏃堕棿锛屽崟浣峬s + // timingFunction: 'linear', + // transformOrigin: '50% 50%', + // delay: 500 //鍔ㄧ敾寤惰繜鏃堕棿锛屽崟浣�ms + // }); + // // 寮�鎵ц鍔ㄧ敾 + // this.$refs.ani.run(()=>{ + // console.log('鍔ㄧ敾鏀寔瀹屾瘯') + // }); + }, + async onLoad(options) { + // console.log(options); + this.duration = 2000; + uni.setNavigationBarTitle({ + title: options.titlename + }); //璁剧疆椤堕儴鏍囬 + this.title = options.titlename; + this.param = JSON.parse(options.param); + console.log(this.param); + //鍔犺浇鍒濆鐣岄潰 + if (this.param.welcome_page) { + this.styles.width = this.param.welcome_page.width + 'px'; + this.styles.height = this.param.welcome_page.height + 'px'; + this.styles.backgroundColor = this.param.welcome_page.bkground_color; + + this.param.welcome_page.img = this.param.welcome_page.img.replace(/ /g, '+'); + this.param.welcome_page.width = parseInt(this.param.welcome_page.width); + this.param.welcome_page.height = parseInt(this.param.welcome_page.height); + this.param.catalog.forEach(async (ele, index) => { + ele.img = ele.img.replace(/ /g, '+'); + ele.taskQty = 0; + await this.appGetInfo(ele.function_def_id, index); + }); } - }).catch(ex=>{ - // console.log(ex); - uni.showModal({title:"閿欒",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"}); - }); - }, - // 鎵ц鏌ヨ浜嬩欢 - async onSearChange(clsid,eventid,index) { - try { - if (eventid) { - var $this = this; - var dataInfo={ - ed_type: 0, - start_transaction: true, - class_id: clsid, - event_id: eventid, - }; - this.$store.dispatch('runCustomEvent',dataInfo).then(ret=>{ - console.log(ret); - if (ret.err_code == 0) { - var result = ret.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{ - var 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 == "set_query_condition"){ - var value = item.value; - $this.wheres = value.condition; - $this.orderby = value.order?value.order:$this.orderby; - $this.loadDataGetList(clsid,index); - } - + + }, + methods: { + setData(obj) { + let that = this; + let keys = []; + let val, data; + + Object.keys(obj).forEach(function(key) { + keys = key.split("."); + val = obj[key]; + data = that.$data; + keys.forEach(function(key2, index) { + if (index + 1 == keys.length) { + that.$set(data, key2, val); + } else { + if (!data[key2]) { + that.$set(data, key2, {}); + } + } + data = data[key2]; + }); + }); + }, + + //鑾峰彇鍔熻兘鐐逛俊鎭�+ async appGetInfo(appid, index) { + try { + + var $this = this; + var json = { + app_id: [appid] + }; + const result = await appGetInfo(json) + if ((result || []).length > 0) { + var app = result[0]; + var paramStr = app.param; + var appName = app.name; + var defCode = app.def_code; + var param = ""; + if (paramStr) { + //mobox2鐨刾aram鏄痡son瀛楃涓�+ param = paramStr.replace(/\\/g, ""); + //mobox3鐨刾aram鏄痓ase64瀛楃涓�+ if (!paramStr.includes('"')) param = Base64.decode(paramStr); + } + if (!param) { + uni.showModal({ + title: this.translateSys("tip"), + content: this.translateSys("quotation_mark_left") + defCode + this + .translateSys("quotation_mark_right") + this.translate( + "tip_no_app_param"), + showCancel: false, + confirmText: this.translateSys('close') + }); + return; + } + this.param.catalog[index].param = param; + this.param.catalog[index].appName = appName; + param = JSON.parse(param); + + $this.orderby = param.Order ? param.Order : 'T_CREATE Desc'; + if (param.Query_Event) { + await $this.onSearChange(param.DataCls.id, param.Query_Event.id, index); + } else { + $this.wheres = param.Condition; + await $this.loadDataGetList(param.DataCls.id, index); + } + } else { + uni.showModal({ + title: this.translateSys("tip"), + content: this.translate("function_not_exist"), + showCancel: false, + confirmText: this.translateSys('close') }); - }else{ - // this.detail2StyleDefList=[]; - if(result.info){ - uni.showModal({title:"鎻愮ず",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); - } - } - } - - }else{ - uni.showModal({title:"閿欒1",content:ret.err_msg,showCancel:false,confirmText:"鍙栨秷"}); - } - }).catch(ex=>{ - // console.log(ex); - uni.showModal({title:"閿欒1.1",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"}); - }); - } - } catch (ex) { - var tip = typeof ex == "string" ? ex : ex.message; - uni.showModal({title:"閿欒1.2",content:"鎵ц鈥滄煡璇簨浠垛�浜嬩欢澶辫触锛� + tip,showCancel:false,confirmText:"鍙栨秷"}); - - } - }, - //鏌ヨ鏁版嵁绫绘暟鎹俊鎭�- async loadDataGetList(clsid,index){ - try{ - //鏉′欢鏌ヨ - var condition = this.wheres; - // console.log(condition); - // console.log(this.orderby); - var $this = this; - var dataInfo={ - class_id: clsid, - attrs: [], - condition: this.toWhereBase64String(""+ condition +""), - prj_rel_type: "", - order_by: this.orderby, - page_size: 99999, - page: 1, - query_id: '', - }; - this.$store.dispatch('dataObjQuery',dataInfo).then(ret=>{ - // console.log(ret); - if (ret.err_code == 0) { - if(ret.result){ - $this.$data.param.catalog[index].taskQty=ret.result.obj_list.length; - // console.log($this.$data.param.catalog[index]); - var catalog = JSON.parse(JSON.stringify($this.$data.param.catalog)); - $this.$data.param.catalog=[]; - $this.$data.param.catalog=catalog; + } + } catch (ex) { + console.log(ex); + let exStr = JSON.stringify(ex) + if (exStr == "{}") + exStr = ex + let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr + uni.showModal({ + title: this.translateSys("error"), + content: tip, + showCancel: false, + confirmText: this.translateSys('close') + }); + return undefined } - }else{ - uni.showModal({title:"閿欒2",content:ret.err_msg,showCancel:false,confirmText:"鍙栨秷"}); - } - }).catch(ex=>{ - // console.log(ex); - uni.showModal({title:"閿欒2.1",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"}); - }); - } catch (ex) { - var tip = typeof ex == "string" ? ex : ex.message; - uni.showModal({title:"閿欒2.2",content:tip,showCancel:false,confirmText:"鍙栨秷"}); - } - }, - - //鐐瑰嚮鏉$洰鎵撳紑3200 - onViewClick(data){ - if(!data.function_def_id){ - uni.showModal({title:"鎻愮ず",content:"璇ユ潯鐩湭鍏宠仈鍔熻兘鐐癸紒",showCancel:false,confirmText:"鍙栨秷"}); - return; - } - var $this = this; - uni.navigateTo({ - url:'../modal/3200?param='+data.param+"&titlename="+data.appName, - events: { - // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁 - view_3201: function(data) { - console.log(data); - //鍒锋柊褰撳墠椤甸潰 - // location.reload(); - // uni.redirectTo({ - // url:'../modal/3201?param='+JSON.stringify($this.$data.param)+"&titlename="+$this.$data.title - // }); - $this.$data.param.catalog.forEach(async (ele,index) => { - ele.taskQty=0; - await $this.appGetInfo(ele.function_def_id,index); + + }, + // 鎵ц鏌ヨ浜嬩欢 + async onSearChange(clsid, eventid, index) { + try { + if (eventid) { + var $this = this; + var dataInfo = { + ed_type: 0, + start_transaction: true, + class_id: clsid, + event_id: eventid, + }; + runCustomEvent(dataInfo).then(result => { + console.log(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: this.translateSys("tip"), + content: tip, + showCancel: false, + confirmText: this.translateSys('close') + }); + else uni.showModal({ + title: this.translateSys("tip"), + content: tip + ',' + this.translateSys('tip') + ':' + result + .ret, + showCancel: false, + confirmText: this.translateSys('close') + }); + return false; + } else { + var tip = result.info ? typeof result.info == 'string' ? result.info : + result.info.join('<br/>') : ''; + if (tip) uni.showModal({ + title: this.translateSys("tip"), + content: tip, + showCancel: false, + confirmText: this.translateSys('close') + }); + + if (result.result_type == 0 && result.action) { + result.action.forEach(item => { + if (item.action_type == "set_query_condition") { + var value = item.value; + $this.wheres = value.condition; + $this.orderby = value.order ? value.order : $this + .orderby; + $this.loadDataGetList(clsid, index); + } + + }); + } else { + // this.detail2StyleDefList=[]; + if (result.info) { + uni.showModal({ + title: this.translateSys("tip"), + content: result.info, + showCancel: false, + confirmText: this.translateSys('close') + }); + } + } + } + + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys("error") + "1.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('close') + }); + }); + } + } catch (ex) { + var tip = typeof ex == "string" ? ex : ex.message; + uni.showModal({ + title: this.translateSys("error") + "1.2", + content: this.translate("execute_query_event_failed") + this.translateSys("comma") + + tip, + showCancel: false, + confirmText: this.translateSys('close') + }); + + } + }, + //鏌ヨ鏁版嵁绫绘暟鎹俊鎭�+ async loadDataGetList(clsid, index) { + try { + //鏉′欢鏌ヨ + var condition = this.wheres; + // console.log(condition); + // console.log(this.orderby); + var $this = this; + var dataInfo = { + class_id: clsid, + attrs: [], + condition: this.toWhereBase64String("" + condition + ""), + prj_rel_type: "", + order_by: this.orderby, + page_size: 99999, + page: 1, + query_id: '', + }; + dataObjQuery(dataInfo).then(result => { + // console.log(result); + if (result) { + $this.param.catalog[index].taskQty = result.obj_list.length; + // console.log($this.param.catalog[index]); + var catalog = JSON.parse(JSON.stringify($this.param.catalog)); + $this.param.catalog = []; + $this.param.catalog = catalog; + } + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys("error") + "2.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('close') + }); + }); + } catch (ex) { + var tip = typeof ex == "string" ? ex : ex.message; + uni.showModal({ + title: this.translateSys("error") + "2.2", + content: tip, + showCancel: false, + confirmText: this.translateSys('close') }); } }, - }); - }, - - - cancel(e){ //鍙栨秷 - uni.navigateBack({ - delta:1 ,//杩斿洖灞傛暟锛�鍒欎笂涓婇〉 - }); - }, - /** - * 鍙敮鎸乕"column1='A' or column2='B'", "column3='C' and column4='D'", "column5='E'"]杩欑鏍煎紡 - * { - * "model": 0 / 1, - * "condition": - * [ - * [ - * { }, - * { }, - * { } - * ], - * [ - * { } - * ], - * [ - * { } - * ] - * ] - * } - */ - toWhereBase64String(list) { - 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]?.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() + //鐐瑰嚮鏉$洰鎵撳紑3200 + onViewClick(data) { + if (!data.function_def_id) { + uni.showModal({ + title: this.translateSys("tip"), + content: this.translate("not_associated_function_point"), + showCancel: false, + confirmText: this.translateSys('close') + }); + return; + } + var $this = this; + uni.navigateTo({ + url: '../modal/3200?param=' + data.param + "&titlename=" + data.appName, + events: { + // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁 + view_3201: function(data) { + console.log(data); + //鍒锋柊褰撳墠椤甸潰 + // location.reload(); + // uni.redirectTo({ + // url:'../modal/3201?param='+JSON.stringify($this.param)+"&titlename="+$this.title + // }); + $this.param.catalog.forEach(async (ele, index) => { + ele.taskQty = 0; + await $this.appGetInfo(ele.function_def_id, index); + }); } - 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(/\'$/, '')) + + cancel(e) { //鍙栨秷 + uni.navigateBack({ + delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉 + }); + }, + /** + * 鍙敮鎸乕"column1='A' or column2='B'", "column3='C' and column4='D'", "column5='E'"]杩欑鏍煎紡 + * { + * "model": 0 / 1, + * "condition": + * [ + * [ + * { }, + * { }, + * { } + * ], + * [ + * { } + * ], + * [ + * { } + * ] + * ] + * } + */ + toWhereBase64String(list) { + 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]?.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.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]?.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.toLowerCase().includes(seps[i])) { + sep = seps[i] + break } } - 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 (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]?.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(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(/\'$/, '')) + 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([{ 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]?.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 (sql.length > 0) + return Base64.encode(JSON.stringify({ + model: 1, + condition: sql + })) + else + return '' + }, + translate(t) { + if (typeof this.$t == "function") return this.$t(`page.${t}`) + else return t; + }, + translateSys(t) { + if (typeof this.$t == "function") return this.$t(`sys.${t}`) + else return t; + }, - 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 '' - }, - - }, -}; + }, + }; </script> <style lang="scss"> - .example { - display: flex; - justify-content: center; - align-items: center; - height: 150px; - // background-color: #efefef; - } - .transition-button { - width: 100%; - flex: 1; - margin-bottom: 10px; - } - .example ::v-deep .transition { - display: flex; - justify-content: center; - align-items: center; - width: 100px; - height: 100px; - border-radius: 5px; - text-align: center; - // background-color: #4cd964; - // box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.2); - } - .text { - font-size: 14px; - color: #fff; - } -</style> -<style> - .content{ - min-height: 100vh; - background-color: #efefef; - padding: 1rpx 0rpx; - } - .dv_head{ - background-color: #efefef; - } - .head_title{ - text-align: center; - font-size: 19px; - font-weight: bold; - } - .uni-section .uni-section-header{ - display: none !important; - } - .dv_content{ - margin: 30rpx; - padding: 10rpx; - border-radius: 12rpx; - } - .dv_panel{ - background-color:#fff; - padding: 20rpx; - margin-top: 20rpx; - border-radius: 12rpx; - /* box-shadow: 2rpx 2rpx 2rpx rgba(0, 0, 0, 0.3); */ - } - .dv_panel:first-child{ - margin: 0; - } - .panel_image_uploadlist { - display: inline-block; - /* padding: 30rpx 0px 10rpx 0px; */ - vertical-align: middle; - width: 200rpx; - height: 200rpx; - text-align: center; - line-height: 100%; - border: 2rpx solid transparent; - border-radius: 8rpx; - overflow: hidden; - background: #fff; - position: relative; - /* box-shadow: 0 2rpx 2rpx rgba(0, 0, 0, 0.2); + .uni-page-modal-3201 { + + + .example { + display: flex; + justify-content: center; + align-items: center; + height: 150px; + // background-color: #efefef; + } + + .transition-button { + width: 100%; + flex: 1; + margin-bottom: 10px; + } + + .example ::v-deep .transition { + display: flex; + justify-content: center; + align-items: center; + width: 100px; + height: 100px; + border-radius: 5px; + text-align: center; + // background-color: #4cd964; + // box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.2); + } + + .text { + font-size: 14px; + color: #fff; + } + + .content { + min-height: 100vh; + background-color: #efefef; + padding: 1rpx 0rpx; + } + + .dv_head { + background-color: #efefef; + } + + .head_title { + text-align: center; + font-size: 19px; + font-weight: bold; + } + + .uni-section .uni-section-header { + display: none !important; + } + + .dv_content { + margin: 30rpx; + padding: 10rpx; + border-radius: 12rpx; + } + + .dv_panel { + background-color: #fff; + padding: 20rpx; + margin-top: 20rpx; + border-radius: 12rpx; + /* box-shadow: 2rpx 2rpx 2rpx rgba(0, 0, 0, 0.3); */ + } + + .dv_panel:first-child { + margin: 0; + } + + .panel_image_uploadlist { + display: inline-block; + /* padding: 30rpx 0px 10rpx 0px; */ + vertical-align: middle; + width: 200rpx; + height: 200rpx; + text-align: center; + line-height: 100%; + border: 2rpx solid transparent; + border-radius: 8rpx; + overflow: hidden; + background: #fff; + position: relative; + /* box-shadow: 0 2rpx 2rpx rgba(0, 0, 0, 0.2); margin-right: 8rpx; */ + } + + .panel_image_uploadlist image { + width: 100%; + height: 100%; + } + + .panel_title { + display: inline-block; + padding-left: 30rpx; + vertical-align: middle; + } + + .panel_title p { + font-size: 19px; + font-weight: bold; + } + + .panel_title span { + font-size: 14px; + } } - .panel_image_uploadlist image{ - width: 100%; - height: 100%; - } - .panel_title{ - display: inline-block; - padding-left: 30rpx; - vertical-align: middle; - } - .panel_title p{ - font-size: 19px; - font-weight: bold; - } - .panel_title span{ - font-size: 14px; - } - -</style> +</style> \ No newline at end of file -- Gitblit v1.9.1