cuiqian2004
5 天以前 07925905f1a596e20e980de6d42db217abb753b0
pages/modal/5600.vue
@@ -33,7 +33,7 @@
            <!-- 页签 -->
            <view class="dv-tab">
               <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem"
                  styleType="button">
                  styleType="text">
               </uni-segmented-control>
            </view>
            <swiper class="view-tabpage" :current="current" @change="changeSwiper">
@@ -206,7 +206,8 @@
      dataObjCreate,
      dataObjDel
   } from "@/api/data.js"
import {showInfo,
      showError} from "@/js/Page.js"
   export default {
      data() {
         return {
@@ -247,16 +248,21 @@
            popupParam: {},
         };
      },
      onReady() {
         uni.setNavigationBarTitle({
            title: this.title
         }); //设置顶部标题
      },
      onLoad(options) {
         // console.log(options);
         uni.setNavigationBarTitle({
            title: options.titlename
         }); //设置顶部标题
         this.title = options.titlename;
         this.param = JSON.parse(options.param);
         // console.log(this.param);
         this.loadData(options.paramValue)
         const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined
         this.loadData(paramValue)
      },
      //页面初始化获取焦点
      methods: {
         setData: function(obj) {
@@ -300,27 +306,7 @@
            await this.Head_UIStyleGetInfo(this.ClsID, this.param.Input_UI_Style.ID);
            //传入参数值
            if (paramValue) {
               const attrs = paramValue.attrs || [];
               (this.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.setFormValues(paramValue)
            }
            //加载初始界面
@@ -1113,6 +1099,74 @@
               return 0;
            }
         },
         setFormValues(attrs) {
            const head_styledef = this.head_styledef
            if (!Array.isArray(attrs)) {
               return
            }
            console.log(attrs)
            attrs.forEach(async (attr, key) => {
               if (attr.choice_list) {
                  var dictItemList = [];
                  attr.choice_list.forEach(async (val, index) => {
                     dictItemList.push({
                        text: val,
                        value: val
                     });
                  });
                  head_styledef.form.items.forEach(async (attr_item, index) => {
                     if (attr_item.name != "Layout") {
                        if (attr_item.fieldId == attr.attr) {
                           if (attr_item.useDict) {
                              attr_item.dict = dictItemList;
                           } else {
                              attr_item.selections = dictItemList;
                           }
                        }
                     } else if (attr_item.name == "Layout") {
                        attr_item.setting.colList.forEach((col) => {
                           if (col) {
                              if (col.fieldId == attr.attr) {
                                 if (col.useDict) {
                                    col.dict = dictItemList;
                                 } else {
                                    col.selections = dictItemList;
                                 }
                              }
                           }
                        });
                     }
                  });
               }
               if (!head_styledef.form.model[attr.attr]) {
                  head_styledef.form.model[attr.attr] = attr.value;
               }
               head_styledef.form.items.forEach(async (ele) => {
                  if (ele.name != "Layout") {
                     if (ele.fieldId == attr.attr) {
                        ele.value = attr.value;
                        ele.oldvalue = attr.value;
                     }
                  } else if (ele.name == "Layout") {
                     ele.setting.colList.forEach((col) => {
                        if (col) {
                           if (col.fieldId == attr.attr) {
                              col.value = attr.value;
                              col.oldvalue = attr.value;
                           }
                        }
                     });
                  }
               })
               //判断表单里是否有返回字段,没有就装载到model里,点击确定提交的时候带上这些数据
            })
            console.log(head_styledef)
            this.setData({
               head_styledef: head_styledef
            })
         }, //更新分页签中的列表项内容
         //更新分页签中的列表项内容
         viewActionSetRow(value) {
@@ -2207,7 +2261,6 @@
            });
         },
         //确定
         ok() {
            this.Before_OK_Event = this.param.Sub_Page[0].Before_ok;
@@ -2719,21 +2772,8 @@
               else if (type == "2")
                  this.ok2Loading = false
            }).catch(ex => {
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
               // var tip = typeof ex == "string" ? ex : ex.errMsg;
               if (type == "1")
                  this.okLoading = false
               else if (type == "2")
                  this.ok2Loading = false
               uni.showModal({
                  title: this.translateSys("error") + "8.1",
                  content: this.translate("execute_after_ok_event_failed") + this.translateSys(
                        "comma") +
                     tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
               showError(ex, this.translateSys("error") + "8.1")
            });
         },