jt
2024-07-20 0108f10f2ffe52fadf2ae425aae9727a400dd973
pages/modal/3200.vue
@@ -273,7 +273,38 @@
         }); //设置顶部标题 
         this.$data.title = options.titlename;
         this.$data.param = JSON.parse(options.param);
         this.initial();
         this.styledef = {};
         this.head_styledef = {
            form: {
               items: []
            }
         };
         this.detail1_styledef = {};
         this.detail1StyleDefList = [];
         this.detail2_styledef = {};
         this.detail2StyleDefList = [];
         this.ListHtml_Panel = "";
         this.ListPageHtml_Show = {
            name: "",
            event: {
               id: "",
               name: ""
            }
         };
         this.items = [];
         this.active_id = '';
         this.activelist = [];
         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);
         }
         await this.initial(options.paramValue);
         // this.isFilter=true;
         // if(this.param.ShowFilter)
         //   this.isFilter=false;
@@ -303,43 +334,61 @@
         // 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: ""
               }
            };
         //
         setData: function(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 initial(paramValue) {
            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);
               await this.Head_UIStyleGetInfo(this.param.DataCls.id, this.param.Query_Panel.id);
               //传入参数值
               if (paramValue) {
                  const attrs = paramValue.attrs || [];
                  (this.$data.head_styledef?.form?.items || []).forEach(async (ele, index) => {
                     if (ele.name != "Layout") {
                        attrs.forEach(async (ele2, index2) => {
                           if (ele.fieldId == ele2.name) {
                              ele.value = ele2.value;
                           }
                        });
                     } else {
                        ele.setting.colList.forEach(async (col) => {
                           if (col) {
                              attrs.forEach(async (ele2,
                                 index2) => {
                                 if (col.fieldId == ele2.name) {
                                    col.value = ele2.value;
                                 }
                              });
                           }
                        });
                     }
                  })
               }
            }
            this.orderby = this.param.Order ? this.param.Order : 'T_CREATE Desc';
            if (this.param.Query_Event) {
@@ -351,6 +400,7 @@
               this.query_id = "";
               await this.loadDataGetList();
            }
         },
         //滚动到底部后懒加载数据
         async scrolltolower(e) {
@@ -479,6 +529,7 @@
                     if (!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result
                        .style_def);
                  }
                  // console.log(styledef);
                  $this.ListPageHtml_Show = ret.result.style_def ? JSON.parse(styledef) : {};
                  // console.log($this.ListPageHtml_Show);
               } else {
@@ -695,6 +746,7 @@
                     if (ret.result) {
                        $this.page_count = ret.result.page_count;
                        if (ret.result.page_count > 1) $this.query_id = ret.result.query_id;
                        // console.log($this.ListPageHtml_Show.event);
                        if ($this.ListPageHtml_Show.event.id) {
                           ret.result.obj_list.forEach((obj) => {
                              var info = {
@@ -1053,7 +1105,114 @@
         },
         //执行事件
         TriggerEvent(btn, style, enviroment) {},
         async TriggerEvent(btn, style, enviroment) { //执行触发事件
            try {
               let obj_attr = {
                  S_ID: this.styledef.form.objId
               };
               style.form.attrs.forEach((attr) => {
                  obj_attr[attr.name] = attr.value;
               });
               if (!this.ListPageHtml_Show.event.id) {
                  //判断没有HTML页面事件
                  // console.log(this.detail2_styledef);
                  this.detail2_styledef.form.items.forEach(async (ele, index) => {
                     if (ele.name != "Layout") {
                        if (!obj_attr[ele.fieldId]) {
                           obj_attr[ele.fieldId] = ele.value;
                        }
                     } else if (ele.name == "Layout") {
                        ele.setting.colList.forEach(async (col, key) => {
                           if (col) {
                              if (!obj_attr[col.fieldId]) {
                                 obj_attr[col.fieldId] = col.value;
                              }
                           }
                        });
                     }
                  });
               }
               const dataInfo = {
                  ed_type: 0,
                  start_transaction: true,
                  class_id: btn.clsId,
                  event_id: btn.event.id,
                  data_obj_id: this.styledef.form.objId,
                  obj_attr: obj_attr,
               }
               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) {
                           if (this.param.Only_Script_Error) {
                              let pos = tip.indexOf(":");
                              if (pos > -1) tip = tip.substring(pos + 1);
                           }
                           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")
                        });
                     }
                  } else {
                     uni.showModal({
                        title: this.translateSys("error") + "8",
                        content: ret.err_msg,
                        showCancel: false,
                        confirmText: this.translateSys("cancel")
                     });
                  }
               }).catch(ex => {
                  // console.log(ex);
                  uni.showModal({
                     title: this.translateSys("error") + "8.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"),
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
               this.showError(ex);
            }
         },
         //跳转
         async RelatedFunction(btn, style, enviroment) {
@@ -1102,7 +1261,7 @@
                        uni.navigateTo({
                           url: '../modal/' + name + '?param=' + param + "&titlename=" +
                              appName +
                              "&type=relatedFunction&attrValue=" + JSON.stringify(style
                              "&type=relatedFunction&paramValue=" + JSON.stringify(style
                                 .form),
                           events: {
                              relatedFunction: function(data) {
@@ -1136,6 +1295,14 @@
                     confirmText: this.translateSys("cancel")
                  });
               });
            } else {
               uni.showModal({
                  title: this.translateSys("error"),
                  content: this.translate("cannot_related_function"),
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            }
         },
         //执行后处理事件