pages/modal/5600.vue
@@ -60,9 +60,9 @@
}
.dv-panel{
    background-color:#EAFED9;
    padding: 10px 0px 1px 0px;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 20rpx 20rpx 4rpx 0px;
    border-radius: 12rpx;
    margin-bottom: 20rpx;
   text-align: right;
}
.dv-panel-input{
@@ -84,34 +84,35 @@
   height: 52rpx;
    line-height: 34rpx;
   background: #FFF;
   border-radius: 0 !important;
   border-radius: 7px !important;
   color: #2d8cf0;
   padding: 10rpx 8rpx 12rpx;
   font-size: 34rpx;
   padding: 6rpx 8rpx 8rpx;
   font-size: 32rpx;
   font-family: inherit;
   box-shadow: none !important;
   transition-duration: 0.1s;
   margin-top: 4rpx;
   margin-top: 0rpx;
}
.dv-panel input::-webkit-input-placeholder {
   font-size: 10rpx;
}
.dv-panel .form-item-span{
   vertical-align: text-top;
    color: #2d8cf0;
   vertical-align: middle;
   white-space: normal;
   word-break: break-all;
    display: inline-block;
   width: calc(100% - 100px);
}
.dv-panel-button{
    display: inline-block;
    margin-bottom: 10rpx;
   margin-right: 20rpx;
}
.dv-panel-button button {    
   line-height: 1.8;
    border: none;
   font-size: 34rpx;
}
button.btn_cancel {
   width:49.5%;
@@ -141,15 +142,20 @@
    display: flex;
    margin: 38% auto;
}
.dv-border{
   border: 1px solid red;
}
</style>
<style lang="scss">
   .demo-uni-row {
      margin-bottom: 10px;
      margin-bottom: 0px;
      display: block;
   }
   ::v-deep .uni-row {
      margin-bottom: 10px;
      margin-bottom: 0px;
   }
   .view-tabpage ::v-deep .uni-row  {
      margin-bottom: 5px;
   }
   .demo-uni-col {
      height: 36px;
@@ -198,7 +204,7 @@
            </uni-segmented-control>
         </view>
         <!-- 正在码盘 -->
         <view v-if="current==0">
         <view class="view-tabpage" v-if="current==0">
            <image class="logo" v-if="detail1StyleDefList.length==0" src="../../images/mobox_log_200x40.png"></image>
            
            <!-- <div class="dv-panel">
@@ -209,17 +215,29 @@
                  </div>
                    <div >
                     <text class="txt_title" style="width:100px">test:</text>
                     <input type="number"/>
                     <span class="form-item-span" >1111</span>
                  </div>
                  <div>
                     <uni-row class="demo-uni-row">
                        <uni-col :span="12">
                           <text class="txt_title dv-form-item-col" style="width:100px">test:</text>
                           <span class="form-item-span" >fsferexggsfsfacxzzgfs</span>
                           <span class="form-item-span" >ffaaa</span>
                        </uni-col>
                        <uni-col :span="12">
                           <text class="txt_title dv-form-item-col" style="width:100px">test:</text>
                           <input type="number" style="width: calc(100% - 120px);"/>
                           <span class="form-item-span" >ffaaaffaaaffaaaffaaaffaaa</span>
                        </uni-col>
                     </uni-row>
                  </div>
                  <div>
                     <uni-row class="demo-uni-row">
                        <uni-col :span="12">
                           <text class="txt_title dv-form-item-col" style="width:100px">test:</text>
                           <span class="form-item-span" >fsfegfs</span>
                        </uni-col>
                        <uni-col :span="12">
                           <text class="txt_title dv-form-item-col" style="width:100px">test:</text>
                           <input type="number" class="uni-input input-margintop" style="width: calc(100% - 120px);"/>
                        </uni-col>
                     </uni-row>
                  </div>
@@ -251,7 +269,7 @@
                           v-for="(cols,key) in item.setting.colList" 
                        >
                           <view v-if="cols!=null" >
                              <text class="txt_title dv-form-item-col" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}:</text>
                              <text class="txt_title" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}:</text>
                              <span class="form-item-span" v-if="cols.disabled">{{cols.value}}</span>
                              <input
                                 class="uni-input"
@@ -272,7 +290,8 @@
            </div>
         </view>
         <!-- 已码盘 -->
         <view v-if="current==1">
         <view class="view-tabpage2" v-if="current==1">
            <image class="logo" v-if="detail2StyleDefList.length==0" src="../../images/mobox_log_200x40.png"></image>
            <div class="dv-panel" v-for="(style,ii) in detail2StyleDefList">
                <div class="dv-panel-input">
                    <div v-for="(item,index) in style.form.items">
@@ -288,7 +307,7 @@
                           v-for="(cols,key) in item.setting.colList" 
                        >
                           <view v-if="cols!=null" >
                              <text class="txt_title dv-form-item-col" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}:</text>
                              <text class="txt_title" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}:</text>
                              <span class="form-item-span">{{cols.value}}</span>
                           </view>
                        </uni-col>
@@ -317,7 +336,7 @@
  data() {
    return {
     title:'码盘',
      paramJson: {},
      param: {},
     focusMateria:false,
     head_styledef:{
      form:{
@@ -382,7 +401,7 @@
         ui_style_id:style_id,
      };
      this.$store.dispatch('UIStyleGetInfo',dataInfo).then(ret=>{
         console.log(ret);
         // console.log(ret);
         if (ret.err_code == 0) {
            var styledef="";
            if(ret.result.style_def){
@@ -392,7 +411,7 @@
                 if(!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result.style_def);
            }
            $this.$data.detail1_styledef = ret.result.style_def? JSON.parse(styledef): {};
            console.log($this.$data.detail1_styledef);
            // console.log($this.$data.detail1_styledef);
            // $this.$data.detail1StyleDefList.push($this.$data.detail1_styledef);
            // let aa = JSON.stringify(this.detail1_styledef);
            // $this.$data.detail1StyleDefList.push(JSON.parse(aa));
@@ -414,7 +433,7 @@
         ui_style_id:style_id,
      };
      this.$store.dispatch('UIStyleGetInfo',dataInfo).then(ret=>{
         console.log(ret);
         // console.log(ret);
         if (ret.err_code == 0) {
            var styledef="";
            if(ret.result.style_def){
@@ -424,7 +443,7 @@
                 if(!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result.style_def);
            }
            $this.$data.detail2_styledef = ret.result.style_def? JSON.parse(styledef): {};
            console.log($this.$data.detail2_styledef);
            // console.log($this.$data.detail2_styledef);
            
         }else{
            uni.showModal({title:"错误3",content:ret.err_msg,showCancel:false,confirmText:"取消"});
@@ -459,10 +478,13 @@
               $this.onChange(onChangeEvent); 
             }
            if(item.value){ //第一个输入框不为空
               $this.focusMateria = false; //初始化,第二个输入框focus属性
               setTimeout(function(){
                  $this.focusMateria=true; //第二个输入框获取焦点
               },1000);
               $this.focusMateria = true; //初始化,第二个输入框focus属性
               // setTimeout(function(){
               //    $this.focusMateria=true; //第二个输入框获取焦点
                  setTimeout(function(){
                     uni.hideKeyboard();
                  },100);
               // },500);
            }
             // if(onSuffixClickCallbackEvent.id){   //后图标点击事件
             //   this.onSuffixClick(onSuffixClickCallbackEvent);
@@ -583,13 +605,16 @@
       }
   },
   //加载正在码盘内容
   viewAceionRow(data){
   viewAceionRow(data,type){
      // console.log(data);
       var styleStr = JSON.stringify(this.$data.detail1_styledef);
      if(type){ //确定后脚本进入加载已码盘数据
          styleStr = JSON.stringify(this.$data.detail2_styledef);
      }
       var detailStyle = JSON.parse(styleStr);
       data.row.attrs.forEach(attr=>{
           detailStyle.form.items.forEach(ele=>{
               if(ele.name=='Input'){
               if(ele.name!='Layout'){
                 if(ele.fieldId == attr.attr) ele.value = attr.value;
               } else if(ele.name=='Layout'){
                 ele.setting.colList.forEach(col=>{
@@ -600,8 +625,14 @@
               }
           });
       });
       this.$data.detail1StyleDefList.push(detailStyle);
       console.log(this.$data.detail1StyleDefList);
      if(type){ //确定后脚本进入加载已码盘数据
          detailStyle.form.objId = data.row.id;
          this.$data.detail2StyleDefList.push(detailStyle);
          // console.log(this.$data.detail2StyleDefList);
      }else{
         this.$data.detail1StyleDefList.push(detailStyle);
       // console.log(this.$data.detail1StyleDefList);
      }
   },
   //加载已码盘内容
   viewAceionContent(data){
@@ -611,7 +642,7 @@
           detailStyle.form.objId = cont.id;
           cont.attrs.forEach(attr=>{
             detailStyle.form.items.forEach(ele=>{ 
               if(ele.name=='Input'){
               if(ele.name!='Layout'){
                 if(ele.fieldId == attr.attr) ele.value = attr.value;
               } else if(ele.name=='Layout'){
                 ele.setting.colList.forEach(col=>{
@@ -637,7 +668,7 @@
       this.detail1StyleDefList.splice(index,1);
   },
    delDataObj(style,index){  //删除已码盘数
      console.log(style);
      // console.log(style);
     var $this = this;
     uni.showModal({
        title: '提示',
@@ -674,10 +705,17 @@
      
    },
   
   ok(){ //确定
      // var $this = this;
      // console.log(this.$data.param.Before_OK_Event);
    //    console.log(this.$data.param.After_OK_Event);
       if(this.$data.param.Before_OK_Event) //是否有确定前事件
           this.sava(this.$data.param.Before_OK_Event);
       else if(this.$data.param.After_OK_Event)  //是否有确定后事件
           this.sava(this.$data.param.After_OK_Event);
   },
   sava(event){
      var $this = this;
       if(this.$data.detail1StyleDefList.length==0){
         uni.showModal({title:"提示",content:"没有正在码盘的数据!",showCancel:false,confirmText:"取消"});
         return false;
@@ -704,84 +742,105 @@
       });
       // console.log(detailAttrList);
       
      try {
          if (this.$data.param.After_OK_Event.ID) {
              var input_param = Base64.encode(
                  JSON.stringify(
                    Object.keys(head_attr).map((a) => ({
                      attr: a,
                      value: head_attr[a] || "",
                    }))
                  )
              );
              var jsonlist=[];
              detailAttrList.forEach(attr=>{
                  jsonlist.push({
                    id:'',
                    attrs: Object.keys(attr).map((a) => ({
                      attr: a,
                      value: attr[a] || "",
                    }))
                  });
              });
              // console.log(jsonlist);
              var data_json = Base64.encode(
                  JSON.stringify(jsonlist)
              );
            var $this = this;
            var dataInfo={
              ed_type: 0,
              start_transaction: '',
              class_id: this.$data.head_styledef.form.clsId,
              class_name: '',
              event_id: this.$data.param.After_OK_Event.ID,
              event_name: '',
              data_obj_id: '',
              obj_attr: '',
              prj_id: '',
              ref_cls_id: '',
              rel_obj_id: '',
              user_login: '',
              data_json: data_json,
              compose_info: '',
              ext_info: '',
              global_attr: '',
              input_param: input_param,
            };
              // console.log(dataInfo);
            this.$store.dispatch('runCustomEvent',dataInfo).then(res=>{
               console.log(res);
               if (res.err_code == 0) {
                  var result = res.result;
                  if(result.result_type == 0){
                      $this.$data.head_styledef.form.items.forEach(item => {
                          item.value = '';
                          item.oldvalue = '';
                          $this.$data.head_styledef.form.model[item.fieldId] = '';
                      });
                      $this.$data.detail1StyleDefList=[];
                      $this.$data.detail2StyleDefList=[];
                      uni.showModal({title:"提示",content:"码盘成功",showCancel:false,confirmText:"取消"});
                  }else{
                     // $this.$data.detail2StyleDefList=[];
                      if(result.info){
                       uni.showModal({title:"提示",content:result.info,showCancel:false,confirmText:"取消"});
                     }
                  }
               }else{
                  uni.showModal({title:"错误8",content:res.err_msg,showCancel:false,confirmText:"取消"});
               }
            }).catch(ex=>{
               // console.log(ex);
               uni.showModal({title:"错误8.1",content:ex.errMsg,showCancel:false,confirmText:"取消"});
            });
          }
      } catch (ex) {
          let tip = typeof ex == "string" ? ex : ex.message;
         uni.showModal({title:"错误8.2",content:"执行“确定后”事件失败:" + tip,showCancel:false,confirmText:"取消"});
      }
      var input_param = Base64.encode(
          JSON.stringify(
            Object.keys(head_attr).map((a) => ({
              attr: a,
              value: head_attr[a] || "",
            }))
          )
      );
       var jsonlist=[];
      detailAttrList.forEach(attr=>{
          jsonlist.push({
            id:'',
            attrs: Object.keys(attr).map((a) => ({
              attr: a,
              value: attr[a] || "",
            }))
          });
      });
      // console.log(jsonlist);
      jsonlist.forEach(async (json,key)=>{
         await $this.runCustomEvent(event,input_param,json);
      });
   },
    //执行确定脚本
    async runCustomEvent(event,input_param,json){
      var $this = this;
      var data_json = Base64.encode(
          JSON.stringify(json)
      );
      var dataInfo={
        ed_type: 0,
        start_transaction: '',
        class_id: this.$data.head_styledef.form.clsId,
        class_name: '',
        event_id: this.$data.param.After_OK_Event.ID,
        event_name: '',
        data_obj_id: '',
        obj_attr: '',
        prj_id: '',
        ref_cls_id: '',
        rel_obj_id: '',
        user_login: '',
        data_json: data_json,
        compose_info: '',
        ext_info: '',
        global_attr: '',
        input_param: input_param,
      };
      // console.log(dataInfo);
      this.$store.dispatch('runCustomEvent',dataInfo).then(res=>{
         console.log(res);
         if (res.err_code == 0) {
            var result = res.result;
            if(result.result_type == 0){
              if(result.action){
               result.action.forEach(item=>{
                 if(item.action_type == "insert_subtable_page_row"){ //码盘中
                   var value = item.value;
                   //加载已经码盘数据
                    $this.viewAceionRow(value,'add');
                     //清空条码内容
                  $this.$data.head_styledef.form.items.forEach((item,index) => {
                     if(item.fieldId != "S_CNTR_CODE"){
                       item.value = '';
                         item.oldvalue = '';
                       $this.$data.head_styledef.form.model[item.fieldId] = '';
                     }
                  });
                  //清除正在码盘中成功的数据
                  $this.$data.detail1StyleDefList.forEach((style,index)=>{
                    if(style.form.items[0].fieldId == json.attrs[0].attr && style.form.items[0].value == json.attrs[0].value){
                     $this.$data.detail1StyleDefList.splice(index,1);
                     return;
                    }
                  });
                   // this.detail2StyleDefList=[];
                  uni.showModal({title:"提示",content:"码盘成功",showCancel:false,confirmText:"取消"});
                 }
               });
              }else{
               if($this.$data.param.After_OK_Event.ID != event.ID){ //判断当前事件是否是确定后事件
                   $this.sava($this.$data.param.After_OK_Event); //执行确定后事件
               }
              }
            }else{
               // $this.$data.detail2StyleDefList=[];
                if(result.info){
                 uni.showModal({title:"提示",content:result.info,showCancel:false,confirmText:"取消"});
               }
            }
         }else{
            uni.showModal({title:"错误8",content:res.err_msg,showCancel:false,confirmText:"取消"});
         }
      }).catch(ex=>{
          let tip = typeof ex == "string" ? ex : ex.errMsg;
         uni.showModal({title:"错误8.1",content:"执行“确定后”事件失败:" + tip,showCancel:false,confirmText:"取消"});
      });
   },
   cancel(e){ //取消
      uni.navigateBack({
         delta:1 //返回层数,2则上上页