cuiqian2004
2024-06-24 dc4e312fde92237060bc23c35016f4d6b7a9187e
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,
@@ -242,7 +148,7 @@
   // 执行查询事件
   async onSearChange(clsid,eventid,index) {
    try {
       if (event.id) {
       if (eventid) {
         var $this = this;
         var dataInfo={
           ed_type: 0,
@@ -251,7 +157,7 @@
         event_id: eventid,
         };
         this.$store.dispatch('runCustomEvent',dataInfo).then(ret=>{
            // console.log(ret);
            console.log(ret);
            if (ret.err_code == 0) {
             var result = ret.result; 
             if (result.ret != 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>