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">
@@ -132,7 +132,7 @@
                              </div>
                              <div class="dv-panel-button">
                                 <checkbox v-if="param.Sub_Page[1].Select_Button==true" :value="ii"
                                 :checked="style.SelBut_Checked" />
                                    :checked="style.SelBut_Checked" />
                                 <!-- <text></text> -->
                                 <!-- <button type="primary" @click="savaDataObj(style,ii)" v-if="param.Sub_Page[1].OK_Button==true">保存</Button> -->
@@ -194,22 +194,24 @@
<script>
   import {
      Base64
   } from  '@/js/Base64.js';
   } from '@/js/Base64.js';
   import {
      appGetInfo,
      dictGetInfo
   } from "@/api/mobox.js"
   import {
      basisver_get,
      getUIStyleInfo,
      runCustomEvent,
      dataObjCreate,
      dataObjDel
   } from "@/api/data.js"
import {showInfo,
      showError} from "@/js/Page.js"
   export default {
      data() {
         return {
               largeMode: getApp().globalData.largeMode || false,
            largeMode: getApp().globalData.largeMode || false,
            title: this.translateSys("coding_disk"),
            ClsID: 'CG_Detail',
            param: {},
@@ -246,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) {
@@ -279,32 +286,27 @@
               });
            });
         },
         async getBasisVer() {
            try {
               const res = await basisver_get();
               const basisver = (res.ver || "").toLowerCase();
               return basisver;
            } catch (ex) {
               return "";
            }
         },
         async loadData(paramValue) {
            let clsDetailId = "CG_Detail";
            const basisver = await this.getBasisVer();
            if (basisver >= "v16.5") {
               clsDetailId = "INV_Detail";
            }
            this.ClsID = clsDetailId;
            //获取数据类的自定义表单参数
            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)
            }
            //加载初始界面
@@ -566,8 +568,8 @@
            //console.log(e.target)
            this.focusOldFieldId = item.fieldId
            getApp().onScan((result) => {
               console.log(result.decodedata);
               item.value = result.decodedata;
               console.log(result);
               item.value = result;
               // uni.hideKeyboard();
               var $this = this;
               if (item.oldvalue != item.value && item.value.trim() != "") {
@@ -1097,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) {
@@ -1867,8 +1937,8 @@
                  }
                  console.log($this.head_styledef);
                  if (data.result) {
                     $this.setFormValues( data.result)
                     }
                     $this.setFormValues(data.result)
                  }
               }
            }).catch(ex => {
@@ -1903,7 +1973,7 @@
               attr: a,
               value: obj_attr[a] || "",
            }));
            var extinfo = enviroment;
            extinfo.edit_dlg = {
               type: 'small', //小窗口
@@ -2190,7 +2260,6 @@
               });
            });
         },
         //确定
         ok() {
@@ -2703,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")
            });
         },