cuiqian2004
2025-10-17 49dfdd3bf265db28d38167f34e9aabfdd3e8e5db
pages/modal/3202_view.vue
@@ -35,7 +35,9 @@
   } from '@/js/Base64.js';
   import {
      showInfo,
      showError
      showError,
      showLoading,
      hideLoading
   } from "@/js/Page.js"
   import classUtils from "@/js/utils.js"
   import {
@@ -113,58 +115,64 @@
         },
      },
      onBackPress(e) {
          this.beforeNavigateBack()
         this.beforeNavigateBack()
      },
      async onLoad(options) {
         console.log(options);
         uni.setNavigationBarTitle({
            title: options.titlename
         }); //设置顶部标题
         this.title = options.titlename;
         this.param = JSON.parse(options.param);
         this.head_styledef = {
            form: {
               items: []
            }
         };
         this.detail1_styledef = {};
         this.detail1StyleDefList = [];
         this.active_id = '';
         this.activeItem = {};
         await this.Head_UIStyleGetInfo(this.param.ClsID, this.param.MasterView_Panel.id);
         await this.Detail1_UIstyleGetInfo(this.param.ClsID, this.param.ViewItem_Panel.id);
         const dataObj = options.dataObj ? JSON.parse(options.dataObj) : {};
         if (dataObj) {
            let attrs = [];
            let master_view = dataObj?.master_view;
            Object.keys(master_view).forEach((a) => {
               attrs.push({
                  attr: a,
                  value: master_view[a]
         try {
            showLoading("loading...")
            console.log(options);
            uni.setNavigationBarTitle({
               title: options.titlename
            }); //设置顶部标题
            this.title = options.titlename;
            this.param = JSON.parse(options.param);
            this.head_styledef = {
               form: {
                  items: []
               }
            };
            this.detail1_styledef = {};
            this.detail1StyleDefList = [];
            this.active_id = '';
            this.activeItem = {};
            await this.Head_UIStyleGetInfo(this.param.ClsID, this.param.MasterView_Panel.id);
            await this.Detail1_UIstyleGetInfo(this.param.ClsID, this.param.ViewItem_Panel.id);
            const dataObj = options.dataObj ? JSON.parse(options.dataObj) : {};
            if (dataObj) {
               let attrs = [];
               let master_view = dataObj?.master_view;
               Object.keys(master_view).forEach((a) => {
                  attrs.push({
                     attr: a,
                     value: master_view[a]
                  });
               });
            });
            attrs.forEach((attr) => {
               this.head_styledef.form.items.forEach((ele2) => {
                  if (ele2.name != "Layout") {
                     if (ele2.fieldId == attr.attr) {
                        ele2.value = attr.value;
                     }
                  } else if (ele2.name == "Layout") {
                     ele2.setting.colList.forEach((col) => {
                        if (col) {
                           if (col.fieldId == attr.attr) {
                              col.value = attr.value;
                           }
               attrs.forEach((attr) => {
                  this.head_styledef.form.items.forEach((ele2) => {
                     if (ele2.name != "Layout") {
                        if (ele2.fieldId == attr.attr) {
                           ele2.value = attr.value;
                        }
                     });
                  }
                     } else if (ele2.name == "Layout") {
                        ele2.setting.colList.forEach((col) => {
                           if (col) {
                              if (col.fieldId == attr.attr) {
                                 col.value = attr.value;
                              }
                           }
                        });
                     }
                  });
               });
            });
            this.viewAceionContent(dataObj.page.list);
               this.viewAceionContent(dataObj.page.list);
            }
            if (this.enter_view_event.id)
               this.enterAfterEvent(this.enter_view_event);
            hideLoading()
         } catch (ex) {
            hideLoading()
            showError(ex, this.translateSys("error"));
         }
         if (this.enter_view_event.id)
            this.enterAfterEvent(this.enter_view_event);
      },
      methods: {
         //
@@ -347,6 +355,7 @@
         //页面进入后事件
         async enterAfterEvent(event) {
            try {
               showLoading("loading...")
               let data_json = [];
               let jsonlist = [];
               let detailStyleList = this.detail1StyleDefList;
@@ -372,7 +381,7 @@
                  } else input_param[item.fieldId] = item.value;
               });
               input_param = Base64.encode(JSON.stringify(input_param));
               this.runCustomEvent({
               await this.runCustomEvent({
                  ed_type: 0,
                  start_transaction: true,
                  class_id: this.param.ClsID,
@@ -380,8 +389,10 @@
                  input_param,
                  data_json,
               })
               hideLoading()
            } catch (ex) {
               hideLoading()
               showError(ex, this.translateSys('tip'));
            }
         },
@@ -511,46 +522,55 @@
         },
         async onTriggerEvent(btn, enviroment) {
            let data_json = [];
            let jsonlist = [];
            try {
               showLoading("loading...")
            let detailStyleList = this.detail1StyleDefList;
            detailStyleList.forEach((style) => {
               let detail_attr = {};
               style.form.items.forEach((item) => {
               let data_json = [];
               let jsonlist = [];
               let detailStyleList = this.detail1StyleDefList;
               detailStyleList.forEach((style) => {
                  let detail_attr = {};
                  style.form.items.forEach((item) => {
                     if (item.name == "Layout") {
                        item.setting.colList.forEach((cols) => {
                           if (cols != null) detail_attr[cols.fieldId] = cols.value;
                        });
                     } else detail_attr[item.fieldId] = item.value;
                  });
                  jsonlist.push(detail_attr);
               });
               data_json = Base64.encode(JSON.stringify(jsonlist));
               let input_param = {};
               this.head_styledef.form.items.forEach((item) => {
                  if (item.name == "Layout") {
                     item.setting.colList.forEach((cols) => {
                        if (cols != null) detail_attr[cols.fieldId] = cols.value;
                        if (cols != null) input_param[cols.fieldId] = cols.value;
                     });
                  } else detail_attr[item.fieldId] = item.value;
                  } else input_param[item.fieldId] = item.value;
               });
               jsonlist.push(detail_attr);
            });
            data_json = Base64.encode(JSON.stringify(jsonlist));
            let input_param = {};
            this.head_styledef.form.items.forEach((item) => {
               if (item.name == "Layout") {
                  item.setting.colList.forEach((cols) => {
                     if (cols != null) input_param[cols.fieldId] = cols.value;
                  });
               } else input_param[item.fieldId] = item.value;
            });
            input_param = Base64.encode(JSON.stringify(input_param));
            await this.runCustomEvent({
               ed_type: 0,
               start_transaction: true,
               class_id: btn.Cls_ID,
               event_id: btn.Event.ID,
               input_param,
               data_json,
            });
               input_param = Base64.encode(JSON.stringify(input_param));
               await this.runCustomEvent({
                  ed_type: 0,
                  start_transaction: true,
                  class_id: btn.Cls_ID,
                  event_id: btn.Event.ID,
                  input_param,
                  data_json,
               });
               hideLoading()
            } catch (ex) {
               hideLoading()
               showError(ex, this.translateSys("error"));
            }
         },
         async navigateBackEvent() {
            try {
               var $this = this;
               if (!this.exit_view_event.id)
                  return
                  showLoading("loading...")
               let data_json = [];
               let jsonlist = [];
               let detailStyleList = this.detail1StyleDefList;
@@ -584,6 +604,7 @@
                  input_param,
                  data_json,
               })
               hideLoading()
               if (result.ret != 0 && result.ret != 1) {
                  let cls_name = result.event_info?.cls_name
                  let event_name = result.event_info?.event_name
@@ -624,20 +645,20 @@
               }
            } catch (ex) {
               hideLoading()
               showError(ex, this.translateSys('error') + "9.2")
            }
         },
          cancel(e) { //取消
         cancel(e) { //取消
            this.beforeNavigateBack()
            uni.navigateBack({
               delta: 1, //返回层数,2则上上页
            });
         },
         async beforeNavigateBack()
         {
         async beforeNavigateBack() {
            await this.navigateBackEvent()
            const eventChannel = this.getOpenerEventChannel();
            eventChannel.emit('ExitViewPage');