cuiqian2004
2024-10-29 57fea2193ac207e2ecc6327fa76ad1c21b7cda16
pages/modal/3201.vue
@@ -1,116 +1,22 @@
<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">
   <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">
                  <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>
@@ -119,397 +25,639 @@
               <span>{{item.taskQty}}</span>
            </view>
         </view>
      </view>
    </view>
   </view>
</template>
<script>
import Base64 from '../../components/js-base64/base64.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,  //过渡动画持续时间,单位ms
   //    timingFunction: 'linear',
   //    transformOrigin: '50% 50%',
   //    delay: 500  //动画延迟时间,单位 ms
   // });
   // this.$refs.ani.step({
   //    // translateX: '50px'
   // },{
   //    duration: 1000,  //过渡动画持续时间,单位ms
   //    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);
     });
   }
  },
  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的param是json字符串
                param = paramStr.replace(/\\/g,"");
                //mobox3的param是base64字符串
                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:"取消"});
   import Base64 from '../../components/js-base64/base64.js'
   import classUtils from "@/js/utils.js"
   import {
      appGetInfo,
      dictGetInfo
   } from "@/api/mobox.js"
   import {
      getUIStyleInfo,
      runCustomEvent,
      dataObjQuery,
   } from "@/api/data.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,  //过渡动画持续时间,单位ms
         //    timingFunction: 'linear',
         //    transformOrigin: '50% 50%',
         //    delay: 500  //动画延迟时间,单位 ms
         // });
         // this.$refs.ani.step({
         //    // translateX: '50px'
         // },{
         //    duration: 1000,  //过渡动画持续时间,单位ms
         //    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);
            });
         }
      }).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的param是json字符串
                     param = paramStr.replace(/\\/g, "");
                     //mobox3的param是base64字符串
                     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("cancel")
                     });
                     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: this.translateSys("tip"),
                     content: this.translate("function_not_exist"),
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
                }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("cancel")
               });
               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("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: 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.loadDataGetList(clsid, index);
                              }
                           });
                        } else {
                           // this.detail2StyleDefList=[];
                           if (result.info) {
                              uni.showModal({
                                 title: this.translateSys("tip"),
                                 content: result.info,
                                 showCancel: false,
                                 confirmText: this.translateSys("cancel")
                              });
                           }
                        }
                     }
                  }).catch(ex => {
                     // console.log(ex);
                     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: this.translateSys("error") + "1.2",
                  content: this.translate("execute_query_event_failed") + this.translateSys("comma") +
                     tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            }
         },
         //查询数据类数据信息
         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.$data.param.catalog[index].taskQty = 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);
                  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: this.translateSys("error") + "2.2",
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            }
         },
      });
   },
   cancel(e){ //取消
      uni.navigateBack({
         delta:1 ,//返回层数,2则上上页
      });
   },
   /**
    * 只支持["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("cancel")
               });
               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);
                     });
                  }
                  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, //返回层数,2则上上页
            });
         },
         /**
          * 只支持["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">
   .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;
      }
   }
</style>