cuiqian2004
2024-08-20 e01994d84332869ebad232af477a4ded68560c55
pages/modal/5602.vue
@@ -185,8 +185,8 @@
      data() {
         return {
            title: this.translateSys("sorting"),
            ClsID: "Sorting_Detail",
            ClsID2: "Sorting_Result",
            ClsID: "Distribution_CNTR_Detail",
            ClsID2: "Picking_Result",
            param: {},
            focusFieldId: "",
            focusOldFieldId: "",
@@ -220,22 +220,7 @@
         this.$data.title = options.titlename;
         this.$data.param = JSON.parse(options.param);
         // console.log(this.$data.param);
         //获取数据类的自定义表单参数
         this.Head_UIStyleGetInfo(this.$data.ClsID, this.$data.param.Input_UI_Style.ID);
         //加载初始界面
         if (this.$data.param.Show_Welcom_Page) {
            this.$data.param.Welcome_Page.Img = this.$data.param.Welcome_Page.Img.replace(/ /g, '+');
            this.$data.param.Welcome_Page.Width = parseInt(this.$data.param.Welcome_Page.Width);
            this.$data.param.Welcome_Page.Height = parseInt(this.$data.param.Welcome_Page.Height);
         }
         //加载Tab页签
         this.$data.items.push(this.$data.param.Sub_Page[0].Name);
         this.$data.items.push(this.$data.param.Sub_Page[1].Name);
         this.Detail1_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[0].UI_Style.ID);
         this.Detail2_UIstyleGetInfo(this.ClsID2, this.$data.param.Sub_Page[1].UI_Style.ID);
         console.log(this.$data.param);
         this.loadData(options.paramValue)
      },
      methods: {
         setData: function(obj) {
@@ -258,6 +243,50 @@
                  data = data[key2];
               });
            });
         },
         async loadData(paramValue) {
            //获取数据类的自定义表单参数
            await this.Head_UIStyleGetInfo(this.$data.ClsID, this.$data.param.Input_UI_Style.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;
                              }
                           });
                        }
                     });
                  }
               })
            }
            //加载初始界面
            if (this.$data.param.Show_Welcom_Page) {
               this.$data.param.Welcome_Page.Img = this.$data.param.Welcome_Page.Img.replace(/ /g, '+');
               this.$data.param.Welcome_Page.Width = parseInt(this.$data.param.Welcome_Page.Width);
               this.$data.param.Welcome_Page.Height = parseInt(this.$data.param.Welcome_Page.Height);
            }
            //加载Tab页签
            this.$data.items.push(this.$data.param.Sub_Page[0].Name);
            this.$data.items.push(this.$data.param.Sub_Page[1].Name);
            await this.Detail1_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[0].UI_Style.ID);
            await this.Detail2_UIstyleGetInfo(this.ClsID2, this.$data.param.Sub_Page[1].UI_Style.ID);
            console.log(this.$data.param);
         },
         changeSwiper(evt) {
            let index = evt.target.current || evt.detail.current;
@@ -437,53 +466,47 @@
               dict_name: dict.name
            };
            // console.log(dataInfo);
            this.$store.dispatch('DictGetInfo', dataInfo).then(async (success) => {
               // console.log(success);
               if (success.err_code == 0) {
                  var list = [];
                  var itemName = '';
                  success.result.dict_item_list.forEach((item) => {
                     if (item.is_default == '1')
                        itemName = item.name;
                     list.push({
                        text: item.value,
                        value: item.name,
                     });
            try {
               const res = await this.getDictInfo(dataInfo)
               var list = [];
               var itemName = '';
               res.result.dict_item_list.forEach((item) => {
                  if (item.is_default == '1')
                     itemName = item.name;
                  list.push({
                     text: item.value,
                     value: item.name,
                  });
                  if (type == 'mast') { //有默认值,显示默认值
                     if (itemName) {
                        $this.head_styledef.form.items[index].value = itemName;
                        var attr = $this.head_styledef.form.items[index].fieldId;
                        $this.head_styledef.form.model[attr] = itemName;
                     }
                     $this.head_styledef.form.items[index].dict = list;
                     var head_styledef = JSON.parse(JSON.stringify($this.head_styledef));
                     $this.head_styledef = [];
                     $this.head_styledef = head_styledef;
                     // console.log($this.$data.detail1StyleDefList);
                  } else {
                     if (itemName) {
                        $this.detail1_styledef.form.items[index].value = itemName;
                        var attr = $this.detail1_styledef.form.items[index].fieldId;
                        $this.detail1_styledef.form.model[attr] = itemName;
                     }
                     $this.detail1_styledef.form.items[index].dict = list;
                     var detail1_styledef = JSON.parse(JSON.stringify($this.detail1_styledef));
                     $this.detail1_styledef = [];
                     $this.detail1_styledef = detail1_styledef;
                     // console.log($this.$data.detail1_styledef);
               });
               //有默认值,显示默认值
               if (type == 'mast') { //有默认值,显示默认值
                  if (itemName) {
                     $this.head_styledef.form.items[index].value = itemName;
                     var attr = $this.head_styledef.form.items[index].fieldId;
                     $this.head_styledef.form.model[attr] = itemName;
                  }
                  $this.head_styledef.form.items[index].dict = list;
                  var head_styledef = JSON.parse(JSON.stringify($this.head_styledef));
                  $this.head_styledef = [];
                  $this.head_styledef = head_styledef;
                  // console.log($this.head_styledef);
               } else {
                  uni.showModal({
                     title: this.translateSys("error") + "9.1",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
                  if (itemName) {
                     $this.detail1_styledef.form.items[index].value = itemName;
                     var attr = $this.detail1_styledef.form.items[index].fieldId;
                     $this.detail1_styledef.form.model[attr] = itemName;
                  }
                  $this.detail1_styledef.form.items[index].dict = list;
                  var detail1_styledef = JSON.parse(JSON.stringify($this.detail1_styledef));
                  $this.detail1_styledef = [];
                  $this.detail1_styledef = detail1_styledef;
                  // console.log($this.$data.detail1_styledef);
               }
            }).catch(ex => {
               // $this.head_styledef.form.items[index].dictitem=success.result;
               // this.$store.commit("classAttrList", $this.$data.classAttrList);
            } catch (ex) {
               // console.log(ex);
               uni.showModal({
                  title: this.translateSys("error") + "9",
@@ -491,8 +514,38 @@
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            });
            }
         },
         getDictInfo(info) { //Mobox3得到得到字典信息字典项列表
            const loginInfo = this.$store.getters.loginid
            const mobxoSApi = this.$store.getters.getMobxoSApi
            return new Promise((resolve, reject) => {
               uni.request({
                  url: mobxoSApi + 'api/dict/GetInfo2?sessionid=' + loginInfo.result.session_id,
                  data: info,
                  method: 'POST',
                  dataType: "json",
                  success: (_res) => {
                     // console.log(_res);
                     const ret = _res.data
                     if (ret.err_code == 0) {
                        resolve(ret);
                     } else {
                        reject({
                           "errMsg": ret.err_msg
                        });
                     }
                  },
                  fail: (err) => {
                     // console.log(err);
                     reject(err);
                  }
               })
            })
         },
         onClick(item) {
            this.focusFieldId = item.fieldId
         },
@@ -506,7 +559,7 @@
               var $this = this;
               console.log(item);
               if (item.oldvalue != item.value) {
               if (item.oldvalue != item.value&& item.value.trim() != "") {
                  item.oldvalue = item.value;
                  var attr = item.fieldId;
                  this.head_styledef.form.model[attr] = item.value;
@@ -589,7 +642,7 @@
         },
         onEnterChange(item) { //回车,点击按钮,取消节点事件
            // console.log(item);
            if (item.oldvalue != item.value) {
            if (item.oldvalue != item.value&& item.value.trim() != "") {
               item.oldvalue = item.value;
               var attr = item.fieldId;
               this.head_styledef.form.model[attr] = item.value;
@@ -913,8 +966,34 @@
                                       data.forEach(async (ele2, index) => {
                                          if (ele.fieldId == ele2
                                             .attr) {
                                             if (ele.name ==
                                                'Select' &&
                                                ele2
                                                .choice_list) {
                                                const
                                                   dictItemList = [];
                                                const
                                                   choiceList =
                                                   ele2
                                                   .choice_list ||
                                                   [];
                                                for (let d in
                                                      choiceList) {
                                                   const val =
                                                      choiceList[
                                                         d];
                                                   dictItemList
                                                      .push({
                                                         text: val,
                                                         value: val
                                                      });
                                                }
                                                ele.dict =
                                                   dictItemList;
                                             }
                                             ele.value = ele2
                                                .value;
                                          }
                                       });
                                    });