cuiqian2004
2024-06-17 b1f20a79e8c5635e0f8aeea42df1d5804fd6dc1f
pages/modal/3200.vue
@@ -271,15 +271,41 @@
    margin-bottom: 5px;
}
.dv_panel_content .dv_panel_attr i{
    vertical-align: 22px;
    vertical-align: super;
    margin: 0 10px;
}
.dv_panel_content .dv_panel_attr .circel_node{}
/* 是菱形的 */
.dv_panel_content .dv_panel_attr .dv_diamond_node {}
.dv_panel_content .dv_panel_attr .dv_box_node{
  display: inline-block;
  text-align: center;
.dv_panel_content .dv_panel_attr .dv_diamond_node p{
   width: 50px;
   height: 50px;
   background-color: #4D6AF4;
   transform: rotate(45deg);
   -ms-transform: rotate(45deg);
   -moz-transform: rotate(45deg);
   -webkit-transform: rotate(45deg);
   -o-transform: rotate(45deg);
   margin: 15px auto;
   padding: 9px;
   // line-height: 28px;
   text-align: center;
}
.dv_panel_content .dv_panel_attr .dv_diamond_node p span{
    color: #fff;
   transform: rotate(-45deg);
   display: inline-block;
   text-align: center;
   overflow: hidden;
   text-overflow: ellipsis;
   // white-space: nowrap;
}
/* 默认形 */
.dv_panel_content .dv_panel_attr .dv_box_node,
.dv_panel_content .dv_panel_attr .dv_diamond_node{
   vertical-align: middle;
   display: inline-block;
   text-align: center;
   width: 100px;
}
.dv_panel_content .dv_panel_attr .dv_box_node p{
    background: #4D6AF4;
@@ -311,24 +337,6 @@
<template>
   <view class="content">
      <!-- <view class="dv_panel_condent">
         <view class="dv_panel_attr">
            <label>No:</label>
            <span>TA240129-00001</span>
         </view>
         <view class="dv_panel_attr">
            <view class="dv_inline">
               <p>毛料线边</p>
               <label>L002-1</label>
            </view>
            <i class="mobox-normal-right"></i>
            <view class="dv_inline">
               <p>毛料线边</p>
               <label>L003-3</label>
            </view>
         </view>
      </view> -->
     <view class="v-content">
      <!-- 表头样式 -->
      <view class="v-headStyle" v-for="(item,index) in head_styledef.form.items" v-if="isFilter==true">
@@ -392,12 +400,12 @@
                  </div>
                  <div class="dv_panel_attr">
                    <div class="dv_box_node">
                     <p>毛料线边</p>
                     <p><span>毛料线边</span></p>
                     <label>L002-1</label>
                    </div>
                    <i class="mobox-normal-right"></i>
                    <div class="dv_box_node">
                     <p>毛料线边</p>
                     <p><span>毛料线边</span></p>
                     <label>L003-3</label>
                    </div>
                  </div>
@@ -666,33 +674,85 @@
   uni.setNavigationBarTitle({ title: options.titlename}); //设置顶部标题 
   this.$data.title = options.titlename;
   this.$data.param = JSON.parse(options.param);
   this.isFilter=true;
   if(this.param.ShowFilter)
     this.isFilter=false;
   //获取数据类的自定义表单参数
   this.Head_UIStyleGetInfo(this.param.DataCls.id,this.param.Query_Panel.id);
   if(this.param.ListPage.ListItem_UIDef?.ui_type=="HTML页面"){
      // HTML页面
      //获取数据类的HTML页面
      await this.Html_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id);
   }else{
      await this.Detail1_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id);
   }
   this.orderby = this.param.Order?this.param.Order:'T_CREATE Desc';
   if(this.param.Query_Event){
       await this.onSearChange(this.param.DataCls.id,this.param.Query_Event.id);
   } else{
     this.wheres = this.param.Condition;
     this.pageindex = 1;
     this.page_size = 3;
     this.query_id = "";
     await this.loadDataGetList();
   }
   console.log(this.$data.param);
   this.initial();
   // this.isFilter=true;
   // if(this.param.ShowFilter)
   //   this.isFilter=false;
   // //获取数据类的自定义表单参数
   // if(this.param.Query_Panel){
   //    this.Head_UIStyleGetInfo(this.param.DataCls.id,this.param.Query_Panel.id);
   // }
   // if(this.param.ListPage.ListItem_UIDef?.ui_type=="HTML页面"){
   //    // HTML页面
   //    //获取数据类的HTML页面
   //    await this.Html_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id);
   // }else{
   //    await this.Detail1_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id);
   // }
   // this.orderby = this.param.Order?this.param.Order:'T_CREATE Desc';
   // if(this.param.Query_Event){
   //     await this.onSearChange(this.param.DataCls.id,this.param.Query_Event.id);
   // } else{
   //   this.wheres = this.param.Condition;
   //   this.pageindex = 1;
   //   this.page_size = 3;
   //   this.query_id = "";
   //   await this.loadDataGetList();
   // }
   // console.log(this.$data.param);
   //页面初始化获取焦点
   // this.focusMateria=true; 
  },   
  methods: {
   //初始化
   async initial(){
      this.styledef={};
      this.head_styledef={
            form:{
               items:[]
            }
      };
      this.detail1_styledef={};
      this.detail1StyleDefList=[];
      this.detail2_styledef={};
      this.detail2StyleDefList=[];
      this.items=[];
      this.active_id='';
      this.activelist=[];
      this.ListHtml_Panel="";
      this.ListPageHtml_Show= {
         name: "",
         event: {
            id: "",
            name: ""
         }
      };
      this.isFilter=true;
      if(this.param.ShowFilter)
        this.isFilter=false;
      //获取数据类的自定义表单参数
      if(this.param.Query_Panel){
         this.Head_UIStyleGetInfo(this.param.DataCls.id,this.param.Query_Panel.id);
      }
      if(this.param.ListPage.ListItem_UIDef?.ui_type=="HTML页面"){
         // HTML页面
         //获取数据类的HTML页面
         await this.Html_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id);
      }else{
         await this.Detail1_UIstyleGetInfo(this.param.DataCls.id,this.param.ListPage.ListItem_UIDef.id);
      }
      this.orderby = this.param.Order?this.param.Order:'T_CREATE Desc';
      if(this.param.Query_Event){
          await this.onSearChange(this.param.DataCls.id,this.param.Query_Event.id);
      } else{
        this.wheres = this.param.Condition;
        this.pageindex = 1;
        this.page_size = 3;
        this.query_id = "";
        await this.loadDataGetList();
      }
   },
   //滚动到底部后懒加载数据
   async scrolltolower(e) {
      // console.log(e)
@@ -868,7 +928,7 @@
   // 执行查询事件
   async onSearChange(clsid,eventid) {
    try {
       if (event.id) {
       if (eventid) {
         var $this = this;
         var dataInfo={
           ed_type: 0,
@@ -1061,10 +1121,10 @@
   //刷新
   Refresh(value){
     //刷新当前页面
     // location.reload();
     uni.redirectTo({
        url:'../modal/3200?param='+JSON.stringify(this.$data.param)+"&titlename="+this.$data.title
     });
     this.initial();
     // uni.redirectTo({
     //    url:'../modal/3200?param='+JSON.stringify(this.$data.param)+"&titlename="+this.$data.title,
     // });
   },
   //点击显示浏览对象显示页面
   async onViewPageClick(style){
@@ -1093,6 +1153,7 @@
                       start_transaction: true,
                         class_id: $this.param.DataCls.id,
                         event_id: eventid,
                       data_obj_id:$this.styledef.form.objId,
                         obj_attr,
                         input_param,
                     });
@@ -1300,7 +1361,7 @@
               //    $this.focusMateria=true; //第二个输入框获取焦点
                  setTimeout(function(){
                     uni.hideKeyboard();
                  },100);
                  },1000);
               // },500);
            }
             // if(onSuffixClickCallbackEvent.id){   //后图标点击事件
@@ -1501,9 +1562,9 @@
   },
   
   cancel(e){ //取消
      var eventChannel = this.$scope.eventChannel;
      // const eventChannel = this.getOpenerEventChannel();
      eventChannel.emit('view_3201',"");
      // var eventChannel = this.$scope.eventChannel;
      // // const eventChannel = this.getOpenerEventChannel();
      // eventChannel.emit('view_3201',"");
      uni.navigateBack({
         delta:1 ,//返回层数,2则上上页
      });
@@ -1528,127 +1589,128 @@
    *     ]
    * }
    */
   toWhereBase64String(list) {
       if (typeof list == 'string') list = [list]
       var sql = []
       var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=', '>', ' like']
       list.forEach(ls => {
           var where = ls.trim().toLowerCase()
           if (where.startsWith('(') && where.endsWith(')')) where = where.replace(/^\(/, '').replace(/\)$/, '')
           if (where.includes(' and ')) {
               // 二级and放在第一级数组中
               where.split(' and ').forEach(li => {
                   var l = li.trim()
                   if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '')
                   var sep = ''
                   for (var i = 0; i < seps.length; i++) {
                       if (l.includes(seps[i])) {
                           sep = seps[i]
                           break
                       }
                   }
                   if (sep) {
                       var values = l.split(sep)
                       var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '')
                       var value = ''
                       var op = sep.trim()
      if (typeof list == 'string') list = [list]
      var sql = []
      var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=', '>', ' like']
      list.forEach(ls => {
         var where = ls.trim()
         if (where.startsWith('(') && where.endsWith(')')) where = where.replace(/^\(/, '').replace(/\)$/, '')
         if (where.toLowerCase().includes(' and ')) {
            // 二级and放在第一级数组中
            where.split(/ and /i).forEach(li => {
               var l = li.trim()
               if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '')
               var sep = ''
               for (var i = 0; i < seps.length; i++) {
                  if (l.toLowerCase().includes(seps[i])) {
                     sep = seps[i]
                     break
                  }
               }
               if (sep) {
                  var values = l.split(new RegExp(sep, 'i'))
                  var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '')
                  var value = ''
                  var op = sep.trim()
   
                       if ([' in', ' not in'].includes(sep) && values[1].includes('select ') && values[1].includes(' from ')) {
                           value = l.replace(field, '').replace(/^\s*(in|not in)\s*/, '').trim()
                           if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim()
                       }
                       else {
                           value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '')
                  if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) {
                     value = l.replace(field, '').replace(/^\s*(in|not in)\s*/i, '').trim()
                     if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim()
                  }
                  else {
                     value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '')
   
                           if (['in', 'not in'].includes(op)) {
                               value = value.replace(/^\(/, '').replace(/\)$/, '')
                               value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, ''))
                           }
                       }
                       sql.push([{ field, value, op }])
                   }
               })
           }
           else if (where.includes(' or ')) {
               // 二级or放在第二级同一组数组中
               var s = []
               where.split(' or ').forEach(li => {
                   var l = li.trim()
                   if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '')
                   var sep = ''
                   for (var i = 0; i < seps.length; i++) {
                       if (l.includes(seps[i])) {
                           sep = seps[i]
                           break
                       }
                   }
                   if (sep) {
                       var values = l.split(sep)
                       var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '')
                       var value = ''
                       var op = sep.trim()
                     if (['in', 'not in'].includes(op)) {
                        value = value.replace(/^\(/, '').replace(/\)$/, '')
                        value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, ''))
                     }
                  }
                  sql.push([{ field, value, op }])
               }
            })
         }
         else if (where.toLowerCase().includes(' or ')) {
            // 二级or放在第二级同一组数组中
            var s = []
            where.split(/ or /i).forEach(li => {
               var l = li.trim()
               if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '')
               var sep = ''
               for (var i = 0; i < seps.length; i++) {
                  if (l.toLowerCase().includes(seps[i])) {
                     sep = seps[i]
                     break
                  }
               }
               if (sep) {
                  var values = l.split(new RegExp(sep, 'i'))
                  var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '')
                  var value = ''
                  var op = sep.trim()
   
                       if ([' in', ' not in'].includes(sep) && values[1].includes('select ') && values[1].includes(' from ')) {
                           value = l.replace(field, '').replace(/^\s*(in|not in)\s*/, '').trim()
                           if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim()
                       }
                       else {
                           value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '')
                  if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) {
                     value = l.replace(field, '').replace(/^\s*(in|not in)\s*/i, '').trim()
                     if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim()
                  }
                  else {
                     value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '')
   
                           if (['in', 'not in'].includes(op)) {
                               value = value.replace(/^\(/, '').replace(/\)$/, '')
                               value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, ''))
                           }
                       }
                       sql.push([{ field, value, op }])
                   }
               })
               sql.push(s)
           }
           else {
               var li = where
               // 单一查询条件直接放在第一级数组中
               var l = li.trim()
               if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '')
               var sep = ''
               for (var i = 0; i < seps.length; i++) {
                   if (l.includes(seps[i])) {
                       sep = seps[i]
                       break
                   }
               }
               if (sep) {
                   var values = l.split(sep)
                   var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '')
                   var value = ''
                   var op = sep.trim()
                     if (['in', 'not in'].includes(op)) {
                        value = value.replace(/^\(/, '').replace(/\)$/, '')
                        value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, ''))
                     }
                  }
                  sql.push([{ field, value, op }])
               }
            })
            sql.push(s)
         }
         else {
            var li = where
            // 单一查询条件直接放在第一级数组中
            var l = li.trim()
            if (l.startsWith('(') && l.endsWith(')')) l = l.replace(/^\(/, '').replace(/\)$/, '')
            var sep = ''
            for (var i = 0; i < seps.length; i++) {
               if (l.toLowerCase().includes(seps[i])) {
                  sep = seps[i]
                  break
               }
            }
            if (sep) {
               var values = l.split(new RegExp(sep,'i'))
               var field = values[0]?.trim().replace(/^\[/, '').replace(/\]$/, '')
               var value = ''
               var op = sep.trim()
   
                   if ([' in', ' not in'].includes(sep) && values[1].includes('select ') && values[1].includes(' from ')) {
                       value = l.replace(field, '').replace(/^\s*(in|not in)\s*/, '').trim()
                       if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim()
                   }
                   else {
                       value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '')
               if ([' in', ' not in'].includes(sep) && values[1]?.toLowerCase().includes('select ') && values[1]?.toLowerCase().includes(' from ')) {
                  value = l.replace(field, '').replace(/^\s*(in|not in)\s*/i, '').trim()
                  if (value.startsWith('(') && value.endsWith(')')) value = value.replace(/^\(/, '').replace(/\)$/, '').trim()
               }
               else {
                  value = values[1]?.trim().replace(/^\'/, '').replace(/\'$/, '')
   
                       if (['in', 'not in'].includes(op)) {
                           value = value.replace(/^\(/, '').replace(/\)$/, '')
                           value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, ''))
                       }
                   }
                   sql.push([{ field, value, op }])
               }
           }
       })
                  if (['in', 'not in'].includes(op)) {
                     value = value.replace(/^\(/, '').replace(/\)$/, '')
                     value = value.split(',').map(v => v.trim().replace(/^\'/, '').replace(/\'$/, ''))
                  }
               }
               sql.push([{ field, value, op }])
            }
         }
      })
   
       if (sql.length > 0)
           return Base64.encode(JSON.stringify({
               model: 1,
               condition: sql
           }))
       else
           return ''
   }
      if (sql.length > 0)
         return Base64.encode(JSON.stringify({
            model: 1,
            condition: sql
         }))
      else
      return ''
   },
  },
};
</script>