pages/modal/3200.vue
@@ -59,8 +59,8 @@
}
.v-content{
   height: 945rpx;
   overflow: auto;
   /* border:1px solid red; */
   overflow: hide;
   /* border:0.1px solid red; */
}
.view-content{
   margin-top: 10rpx;
@@ -70,11 +70,12 @@
}
.dv-panel{ 
    background-color:#efefef;
    padding: 20rpx 20rpx 4rpx 0px;
    padding: 20rpx 20rpx 20rpx 0px;
    border-radius: 12rpx;
    margin-bottom: 20rpx;
   text-align: right;
}
.dv-listHtml-Panel,
.dv-panel-input{
    vertical-align: middle;
    width: 91%;
@@ -82,23 +83,23 @@
    text-align: left;
}
.dv-panel-buticon{
  line-height: 50rpx;
  line-height: 0rpx;
  text-align: left;
  /* font-size: 17px; */
  padding: 0 30rpx;
}
.dv-panel-buticon .btn-padding{
    padding: 20rpx;
    padding: 0rpx 20rpx;
   display: inline-block;
   vertical-align: middle;
}
.dv-panel-buticon a i { 
   font-size: 44rpx;
   font-size: 38rpx;
}
.dv-panel-buticon button{
   min-width: 120rpx;
    font-size: 32rpx;
   padding: 20rpx 20rpx;
   padding: 20rpx 20rpx 0rpx 20rpx;
   line-height: 1;
   background: #4D6AF4;
   border: none;
@@ -144,6 +145,10 @@
}
.dv-panel-button checkbox-group { 
   display: inline-block;
}
.dv-panel-button uni-checkbox .uni-checkbox-input{
   width: 34rpx;
   height: 34rpx;
}
.dv-panel-button a i { 
   font-size: 36rpx;
@@ -227,6 +232,62 @@
.input-disabled{
   background-color: #f3f3f3 !important;
}
.dv_panel_condent{
    background-color:#D6FCB2;
    padding: 20rpx;
    border-radius: 12rpx;
}
.dv_panel_attr{
   margin-bottom: 10rpx;
}
.dv_panel_attr .dv_inline{
   display: inline-block;
   text-align: center;
}
.dv_panel_attr i{
   vertical-align: 25px;
   margin: 0 10px;
}
.dv_panel_attr .dv_inline p{
   background: #4D6AF4;
   color: #fff;
   padding: 10rpx 15rpx;
   line-height: 1.5;
    border-radius: 10rpx;
}
.scroll-Y {
   height: 100%;
}
.scroll-view_H {
   white-space: nowrap;
   width: 100%;
}
.dv_panel_content{
    margin: 0 10px;
}
.dv_panel_content .dv_panel_attr{
    margin-bottom: 5px;
}
.dv_panel_content .dv_panel_attr i{
    vertical-align: 22px;
    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_box_node p{
    background: #4D6AF4;
    color: #fff;
    padding: 3px 7px;
    line-height: 1.5;
    border-radius: 5px;
}
</style>
<style lang="scss">
   .demo-uni-row {
@@ -246,11 +307,28 @@
   .demo-uni-row .uni-input{
      width: calc(100% - 120px);
   }
</style>
<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">
@@ -288,6 +366,8 @@
          </view>
      </view>
      
      <scroll-view :scroll-top="scrollTop" :scroll-y="true" class="scroll-Y"
        @scrolltolower="scrolltolower" @scroll="scroll">
      <view class="view-content" id="tabpanel">
        <view class="dv-panel dv-panel-bkcolor" v-for="(style,ii) in detail1StyleDefList" 
          @click="onPanelClick(ii)"
@@ -300,7 +380,31 @@
               </label>
            </checkbox-group>
          </div>
          <div class="dv-panel-input"
            <!-- HTML页面类型显示 -->
            <div class="dv-listHtml-Panel" v-if="ListHtml_Panel" v-html="ListHtml_Panel[ii]"
              :style="param.ListPage.CheckBox==true && param.ListPage.Click_View==true?'width:85%;':
              param.ListPage.CheckBox==false && param.ListPage.Click_View==true?'width:91%;':
              param.ListPage.CheckBox==true && param.ListPage.Click_View==false?'width:88%;':'width:100%;'">
               <!-- <div class="dv_panel_content">
                  <div class="dv_panel_attr">
                    <label>No:</label>
                    <span>TA240129-00001</span>
                  </div>
                  <div class="dv_panel_attr">
                    <div class="dv_box_node">
                     <p>毛料线边</p>
                     <label>L002-1</label>
                    </div>
                    <i class="mobox-normal-right"></i>
                    <div class="dv_box_node">
                     <p>毛料线边</p>
                     <label>L003-3</label>
                    </div>
                  </div>
               </div> -->
            </div>
            <!-- 自定义表单类型显示 -->
            <div class="dv-panel-input" v-if="!ListHtml_Panel"
            :style="param.ListPage.CheckBox==true && param.ListPage.Click_View==true?'width:85%;':
            param.ListPage.CheckBox==false && param.ListPage.Click_View==true?'width:91%;':
            param.ListPage.CheckBox==true && param.ListPage.Click_View==false?'width:88%;':'width:100%;'">
@@ -473,6 +577,7 @@
          </div>
        </view>
      </view>
      </scroll-view>
     </view>
      
     <view class="view-floor">
@@ -504,6 +609,16 @@
   else
       this.isFilter=true;
  },
  onBackPress(e){
   // console.log("监听返回按钮事件",e);
   var eventChannel = this.$scope.eventChannel;
   // const eventChannel = this.getOpenerEventChannel();
   eventChannel.emit('view_3201',"");
   // uni.navigateBack({
   //    delta:1 ,//返回层数,2则上上页
   // });
   // return true;
  },
  data() {
    return {
     title:'新增',
@@ -523,8 +638,27 @@
     items: [],
      active_id:'',
     activelist:[],
      where:'',
      wheres:'',
      orderby:'',
      query_id:'',
      pageindex:1,
      page_size:10,
      page_count:0,
     scrollTop: 0,
     old: {
        scrollTop: 0
     },
     isScroll:true,
     //获取数据类的HTML页面
     ListHtml_Panel:"",
     ListPageHtml_Show: {
        name: "",
        event: {
           id: "",
           name: ""
        }
     },
    };
  },
  async onLoad(options) {
@@ -537,12 +671,21 @@
     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);
@@ -550,6 +693,25 @@
   // this.focusMateria=true; 
  },   
  methods: {
   //滚动到底部后懒加载数据
   async scrolltolower(e) {
      // console.log(e)
      if(this.isScroll){ //判断刷新一次后不会持续刷新
         if(this.page_count==this.pageindex){
            return;
         }
         this.pageindex += 1;
         if(this.where || this.page_count==1) {
           this.query_id = "";
           this.detail1StyleDefList=[];
         }
         await this.loadDataGetList();
      }
   },
   scroll: function(e) {
      // console.log(e.detail.scrollTop)
      this.old.scrollTop = e.detail.scrollTop
   },
   async Head_UIStyleGetInfo(class_id,style_id){   //获取自定义表单样式
      var $this = this;
      var dataInfo={
@@ -616,6 +778,44 @@
      }).catch(ex=>{
         // console.log(ex);
         uni.showModal({title:"错误2.1",content:ex.errMsg,showCancel:false,confirmText:"取消"});
      });
   },
   async Html_UIstyleGetInfo(class_id, style_id) { //获取自定义表单样式
      var $this = this;
      var dataInfo = {
         class_id: class_id,
         ui_style_id: style_id,
      };
      this.$store.dispatch('UIStyleGetInfo', dataInfo).then(ret => {
         // console.log(ret);
         if (ret.err_code == 0) {
            var styledef = "";
            if (ret.result.style_def) {
               //mobox2的style_def是json字符串
               styledef = ret.result.style_def.replace(/\\/g, "");
               //mobox3的style_def是base64字符串
               if (!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result
                  .style_def);
            }
            $this.ListPageHtml_Show = ret.result.style_def ? JSON.parse(styledef) : {};
            // console.log($this.ListPageHtml_Show);
         } else {
            uni.showModal({
               title: "错误10",
               content: ret.err_msg,
               showCancel: false,
               confirmText: "取消"
            });
         }
      }).catch(ex => {
         // console.log(ex);
         uni.showModal({
            title: "错误10.1",
            content: ex.errMsg,
            showCancel: false,
            confirmText: "取消"
         });
      });
       
   },
@@ -695,6 +895,9 @@
                          var value = item.value;
                          $this.wheres = value.condition;
                          $this.orderby = value.order?value.order:$this.orderby;
                        $this.pageindex = 1;
                        $this.query_id = "";
                        $this.detail1StyleDefList=[];
                          $this.loadDataGetList();
                      } 
                     
@@ -722,13 +925,17 @@
    }
   },
   //查询数据类数据信息
   async loadDataGetList(where){
   async loadDataGetList(){
     try{
      uni.showLoading({
         title:"加载中...",
         mask:true
      });
       //条件查询
       var condition = this.wheres;
       if(where){
       if(this.where){
         if(condition) condition +=' and ';
         condition+=where;
         condition+=this.where;
       }
       // console.log(condition);
       // console.log(this.orderby);
@@ -739,16 +946,64 @@
         condition: this.toWhereBase64String(""+ condition +""), 
         prj_rel_type: "",
         order_by: this.orderby,
         page_size: 99999,
         page: 1,
         query_id: '',
         page_size: this.page_size,
         page: this.pageindex,
         query_id: this.query_id,
      };
      this.$store.dispatch('dataObjQuery',dataInfo).then(ret=>{
         // console.log(ret);
         console.log(ret);
         uni.hideLoading();
         if (ret.err_code == 0) {
            // var list=[];
            $this.query_id = '';
            if(ret.result){
              $this.detail1StyleDefList=[];
               $this.page_count = ret.result.page_count;
               if(ret.result.page_count>1) $this.query_id = ret.result.query_id;
               if($this.ListPageHtml_Show.event.id){
                  ret.result.obj_list.forEach((obj) => {
                     var info ={
                         id:obj.id,
                     };
                     obj.attr_list.forEach((attr) => {
                       info[attr.name]=attr.value;
                     });
                     var detailStyle ={
                         SelBut_Checked:false,
                         form:{},
                         info:info
                     };
                     detailStyle.form.htmlobjId = obj.id?obj.id.replace(/-/g,'').replace('{','').replace('}',''):'null';
                     detailStyle.form.objId = obj.id;
                     detailStyle.form.attrs = obj.attr_list;
                     $this.detail1StyleDefList.push(detailStyle);
                    $this.activelist.push({active:false});
                   });
                   // console.log(this.detail1StyleDefList);
                   var jsonlist=[];
                   $this.detail1StyleDefList.forEach(attr=>{
                     jsonlist.push({
                       id:attr.info.id,
                       attrs: Object.keys(attr.info).map((a) => ({
                         attr: a,
                         value: attr.info[a] || "",
                       }))
                     });
                   });
                   // console.log(jsonlist);
                  var data_json = Base64.encode(JSON.stringify(jsonlist));
                   var eventid = $this.ListPageHtml_Show.event.id;
                   if (!$this.ListPageHtml_Show.event.id.includes('{'))
                      eventid = '{' + $this.ListPageHtml_Show.event.id + '}';
                   //HTML页面事件
                   $this.runCustomEvent({
                      ed_type: 0,
                      start_transaction: true,
                      class_id: $this.param.DataCls.id,
                      event_id: eventid,
                      data_json,
                   });
               }else{
                 // $this.detail1StyleDefList=[];
              ret.result.obj_list.forEach((obj) => {
                var styleStr = JSON.stringify($this.detail1_styledef);
                var detailStyle = JSON.parse(styleStr);
@@ -777,6 +1032,14 @@
               $this.activelist.push({active:false});
                //list.push(info);
              });
               }
               // 解决view层不同步的问题
               // $this.scrollTop = $this.old.scrollTop;
               $this.isScroll=false;
               setTimeout(function(){
                  $this.isScroll=true;
               },1000);
            // console.log($this.detail1StyleDefList);
            }
            
@@ -1023,10 +1286,13 @@
             if(onChangeEvent.id){   //内容变化后事件
               $this.onChange(onChangeEvent); 
             } else{
              var where ='';
              $this.where ='';
              if(item.value)
               where =item.fieldId+" like '%"+item.value+"%'";
              $this.loadDataGetList(where);
               $this.where =item.fieldId+" like '%"+item.value+"%'";
              $this.query_id='';
              $this.pageindex = 1;
              $this.detail1StyleDefList=[];
              $this.loadDataGetList();
            }
            if(item.value){ //第一个输入框不为空
               $this.focusMateria = true; //初始化,第二个输入框focus属性
@@ -1060,10 +1326,13 @@
          if(onChangeEvent.id){   //内容变化后事件
            this.onChange(onChangeEvent); 
          } else{
           var where ='';
           this.where ='';
           if(item.value)
            where =item.fieldId+" like '%"+item.value+"%'";
           this.loadDataGetList(where);
            this.where =item.fieldId+" like '%"+item.value+"%'";
           this.query_id='';
           this.pageindex = 1;
           this.detail1StyleDefList=[];
           this.loadDataGetList();
         }
          // if(onSuffixClickCallbackEvent.id){   //后图标点击事件
          //   this.onSuffixClick(onSuffixClickCallbackEvent);
@@ -1198,6 +1467,12 @@
                           })
                        // } else if(item.action_type == "refresh_cur_row"){ //
                        //    var value = item.value;
                        } else if (item.action_type == "set_panel_html") { //显示Html页面
                           // var value = item.value;
                           $this.ListHtml_Panel = item.value;
                           // $this.detail1StyleDefList.forEach((ele,index)=>{
                           //    ele.ListHtml_Panel = item.value[index];
                           // });
                           
                        } else{
                           uni.showModal({title:"提示",content:"当前action_type:"+item.action_type+"未处理",showCancel:false,confirmText:"取消"});
@@ -1226,8 +1501,11 @@
   },
   
   cancel(e){ //取消
      var eventChannel = this.$scope.eventChannel;
      // const eventChannel = this.getOpenerEventChannel();
      eventChannel.emit('view_3201',"");
      uni.navigateBack({
         delta:1 //返回层数,2则上上页
         delta:1 ,//返回层数,2则上上页
      });
   },
   /**