From dc4e312fde92237060bc23c35016f4d6b7a9187e Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期一, 24 六月 2024 11:11:37 +0800 Subject: [PATCH] 属性类型多语言 --- pages/modal/3201.vue | 443 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 224 insertions(+), 219 deletions(-) diff --git a/pages/modal/3201.vue b/pages/modal/3201.vue index 1d9547e..d538e30 100644 --- a/pages/modal/3201.vue +++ b/pages/modal/3201.vue @@ -1,98 +1,3 @@ -<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); - 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; - } - -</style> <template> <view class="content"> @@ -126,13 +31,14 @@ <script> import Base64 from '../../components/js-base64/base64.js' +import classUtils from "@/js/utils.js" export default { modules:{ Base64, }, data() { return { - title:'鏂板', + title:'3201棣栭〉', param: {}, show: true, duration:0, @@ -319,9 +225,9 @@ if(ret.result){ $this.$data.param.catalog[index].taskQty=ret.result.obj_list.length; // console.log($this.$data.param.catalog[index]); - var param = JSON.parse(JSON.stringify($this.$data.param)); - $this.$data.param=[]; - $this.$data.param = param; + var catalog = JSON.parse(JSON.stringify($this.$data.param.catalog)); + $this.$data.param.catalog=[]; + $this.$data.param.catalog=catalog; } }else{ uni.showModal({title:"閿欒2",content:ret.err_msg,showCancel:false,confirmText:"鍙栨秷"}); @@ -351,8 +257,12 @@ console.log(data); //鍒锋柊褰撳墠椤甸潰 // location.reload(); - uni.redirectTo({ - url:'../modal/3201?param='+JSON.stringify($this.$data.param)+"&titlename="+$this.$data.title + // 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); }); } }, @@ -386,126 +296,221 @@ * } */ 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 ([' 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(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(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(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(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(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 (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 + } + } + 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 }]) + } + } + }) + + 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); + 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; + } + +</style> -- Gitblit v1.9.1