cuiqian2004
2025-08-18 381357c9d11045ff6c0e73cf2d64b735b13c7b99
pages/modal/5600.vue
@@ -1,5 +1,5 @@
<template>
   <view class="uni-page-modal-5600">
   <view class="uni-page-modal-5600" :class="largeMode?'large-mode':''">
      <!-- 表头样式 -->
      <view class="view-header">
         <view class="v-headStyle" v-for="(item,index) in head_styledef.form.items">
@@ -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,12 +194,13 @@
<script>
   import {
      Base64
   } from  '@/js/Base64.js';
   } from '@/js/Base64.js';
   import {
      appGetInfo,
      dictGetInfo
   } from "@/api/mobox.js"
   import {
      basisver_get,
      getUIStyleInfo,
      runCustomEvent,
      dataObjCreate,
@@ -209,6 +210,7 @@
   export default {
      data() {
         return {
            largeMode: getApp().globalData.largeMode || false,
            title: this.translateSys("coding_disk"),
            ClsID: 'CG_Detail',
            param: {},
@@ -253,7 +255,8 @@
         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: {
@@ -278,32 +281,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)
            }
            //加载初始界面
@@ -565,8 +563,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() != "") {
@@ -1096,6 +1094,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) {
@@ -1866,8 +1932,8 @@
                  }
                  console.log($this.head_styledef);
                  if (data.result) {
                     $this.setFormValues( data.result)
                     }
                     $this.setFormValues(data.result)
                  }
               }
            }).catch(ex => {
@@ -1902,7 +1968,7 @@
               attr: a,
               value: obj_attr[a] || "",
            }));
            var extinfo = enviroment;
            extinfo.edit_dlg = {
               type: 'small', //小窗口
@@ -2189,7 +2255,6 @@
               });
            });
         },
         //确定
         ok() {