cuiqian2004
2024-07-05 37ff5e49c0e7c5b63e7e8e137058366244f826c1
pages/modal/3201.vue
@@ -1,12 +1,14 @@
<template>
   <view class="content">
   <view class="uni-page-modal-3201">
      <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">
            <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>
                     :style="{'width':param.welcome_page.width+'px','height':param.welcome_page.height+'px'}">
                  </image>
               </uni-transition>
            </view>
         </uni-section>
@@ -14,8 +16,7 @@
      
      <view class="dv_content">
         <view class="dv_panel" v-for="(item,index) in param.catalog" 
           :style="{'background-color':item.bkground_color}" @tap="onViewClick(item)"
         >
            :style="{'background-color':item.bkground_color}" @tap="onViewClick(item)">
            <view class="panel_image_uploadlist">
               <image :src="item.img"></image>
            </view>
@@ -80,7 +81,9 @@
  async onLoad(options) {
   // console.log(options);
   this.duration=2000;
   uni.setNavigationBarTitle({ title: options.titlename}); //设置顶部标题
         uni.setNavigationBarTitle({
            title: options.titlename
         }); //设置顶部标题
   this.$data.title = options.titlename;
   this.$data.param = JSON.parse(options.param);
   console.log(this.$data.param);
@@ -123,7 +126,14 @@
                if(!paramStr.includes('"')) param = Base64.decode(paramStr);
            }     
            if(!param){
               uni.showModal({title:"提示",content:defCode+"该功能点未配置参数,请重新配置参数!",showCancel:false,confirmText:"取消"});
                     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("cancel")
                     });
               return;
            }
            this.$data.param.catalog[index].param=param;
@@ -138,11 +148,21 @@
              await $this.loadDataGetList(param.DataCls.id,index);
            }
         }else{
            uni.showModal({title:"提示",content:success.msg,showCancel:false,confirmText:"取消"});
                  uni.showModal({
                     title: this.translateSys("tip"),
                     content: success.msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
         }
      }).catch(ex=>{
         // console.log(ex);
         uni.showModal({title:"错误",content:ex.errMsg,showCancel:false,confirmText:"取消"});
               uni.showModal({
                  title: this.translateSys("error"),
                  content: ex.errMsg,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
      });
   },
   // 执行查询事件
@@ -161,20 +181,39 @@
            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:"取消"});
                           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("cancel")
                           });
                           else uni.showModal({
                              title: this.translateSys("tip"),
                              content: tip + ',' + this.translateSys('tip') + ':' + result
                                 .ret,
                              showCancel: false,
                              confirmText: this.translateSys("cancel")
                           });
                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:"取消"});
                           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("cancel")
                           });
             
                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.orderby = value.order ? value.order : $this
                                       .orderby;
                          $this.loadDataGetList(clsid,index);
                      } 
                     
@@ -182,22 +221,43 @@
                }else{
                   // this.detail2StyleDefList=[];
                   if(result.info){
                      uni.showModal({title:"提示",content:result.info,showCancel:false,confirmText:"取消"});
                                 uni.showModal({
                                    title: this.translateSys("tip"),
                                    content: result.info,
                                    showCancel: false,
                                    confirmText: this.translateSys("cancel")
                                 });
                   }
                }
             }
               
            }else{
               uni.showModal({title:"错误1",content:ret.err_msg,showCancel:false,confirmText:"取消"});
                        uni.showModal({
                           title: this.translateSys("error") + "1",
                           content: ret.err_msg,
                           showCancel: false,
                           confirmText: this.translateSys("cancel")
                        });
            }
         }).catch(ex=>{
            // console.log(ex);
            uni.showModal({title:"错误1.1",content:ex.errMsg,showCancel:false,confirmText:"取消"});
                     uni.showModal({
                        title: this.translateSys("error") + "1.1",
                        content: ex.errMsg,
                        showCancel: false,
                        confirmText: this.translateSys("cancel")
                     });
         });
        }
    } catch (ex) {
        var tip = typeof ex == "string" ? ex : ex.message;
       uni.showModal({title:"错误1.2",content:"执行“查询事件”事件失败:" + tip,showCancel:false,confirmText:"取消"});
               uni.showModal({
                  title: this.translateSys("error") + "1.2",
                  content: this.translate("execute_query_event_failed") + this.translateSys("comma") +
                     tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
       
    }
   },
@@ -230,22 +290,42 @@
               $this.$data.param.catalog=catalog;
            }
         }else{
            uni.showModal({title:"错误2",content:ret.err_msg,showCancel:false,confirmText:"取消"});
                     uni.showModal({
                        title: this.translateSys("error") + "2",
                        content: ret.err_msg,
                        showCancel: false,
                        confirmText: this.translateSys("cancel")
                     });
         }
      }).catch(ex=>{
         // console.log(ex);
         uni.showModal({title:"错误2.1",content:ex.errMsg,showCancel:false,confirmText:"取消"});
                  uni.showModal({
                     title: this.translateSys("error") + "2.1",
                     content: ex.errMsg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
      });
     } catch (ex) {
       var tip = typeof ex == "string" ? ex : ex.message;
      uni.showModal({title:"错误2.2",content:tip,showCancel:false,confirmText:"取消"});
               uni.showModal({
                  title: this.translateSys("error") + "2.2",
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
     }
   },
   
   //点击条目打开3200
   onViewClick(data){
      if(!data.function_def_id){
         uni.showModal({title:"提示",content:"该条目未关联功能点!",showCancel:false,confirmText:"取消"});
               uni.showModal({
                  title: this.translateSys("tip"),
                  content:this.translate("not_associated_function_point"),
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
         return;
      }
      var $this = this;
@@ -301,12 +381,14 @@
      var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=', '>', ' like']
      list.forEach(ls => {
         var where = ls.trim()
         if (where.startsWith('(') && where.endsWith(')')) where = where.replace(/^\(/, '').replace(/\)$/, '')
               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(/\)$/, '')
                     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])) {
@@ -320,28 +402,34 @@
                  var value = ''
                  var op = sep.trim()
                  if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) {
                        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 {
                           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(/\'$/, ''))
                              value = value.split(',').map(v => v.trim().replace(/^\'/, '')
                                 .replace(/\'$/, ''))
                     }
                  }
                  sql.push([{ field, value, op }])
                        sql.push([{
                           field,
                           value,
                           op
                        }])
               }
            })
         }
         else if (where.toLowerCase().includes(' or ')) {
               } 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(/\)$/, '')
                     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])) {
@@ -355,24 +443,29 @@
                  var value = ''
                  var op = sep.trim()
                  if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) {
                        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 {
                           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(/\'$/, ''))
                              value = value.split(',').map(v => v.trim().replace(/^\'/, '')
                                 .replace(/\'$/, ''))
                     }
                  }
                  sql.push([{ field, value, op }])
                        sql.push([{
                           field,
                           value,
                           op
                        }])
               }
            })
            sql.push(s)
         }
         else {
               } else {
            var li = where
            // 单一查询条件直接放在第一级数组中
            var l = li.trim()
@@ -390,19 +483,25 @@
               var value = ''
               var op = sep.trim()
               if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) {
                     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 {
                        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(/\'$/, ''))
                           value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/,
                              ''))
                  }
               }
               sql.push([{ field, value, op }])
                     sql.push([{
                        field,
                        value,
                        op
                     }])
            }
         }
      })
@@ -415,11 +514,22 @@
      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;
         },
   
  },
};
</script>
<style lang="scss">
   .uni-page-modal-3200 {
   .example {
      display: flex;
      justify-content: center;
@@ -427,11 +537,13 @@
      height: 150px;
      // background-color: #efefef;
   }
   .transition-button {
      width: 100%;
      flex: 1;
      margin-bottom: 10px;
   }
   .example ::v-deep .transition {
      display: flex;
      justify-content: center;
@@ -443,33 +555,38 @@
      // 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;
@@ -477,9 +594,11 @@
     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; */
@@ -496,21 +615,25 @@
      /* 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>