cuiqian2004
2024-12-30 a4ded387f6476a350e61c09e178478570ae98656
pages/modal/3018_2.vue
@@ -239,7 +239,7 @@
                              $this.onScanValue(ele, res.result)
                              break;
                           }
                        } else if (ele.name == "Layot") {
                        } else if (ele.name == "Layout") {
                           let curIndex = (ele.setting.colList || []).findIndex((col, index2,
                              arr) => {
                              return (col.name == 'Input' || col.name == 'InputNumber' || col
@@ -482,12 +482,19 @@
               formItem.dict = list;
            } catch (ex) {
               // console.log(ex);
               let exStr = JSON.stringify(ex)
               if (exStr == "{}")
                  exStr = ex
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
               uni.showModal({
                  title: this.translateSys("error") + "1.3",
                  content: ex.errMsg,
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            }
         },
@@ -546,11 +553,31 @@
                        if (action.action_type == 'set_dlg_attr') {
                           var result = action.value;
                           $this.setFormValues(result)
                        } else if (data.action[i].action_type == 'set_dlg_attr_show') {
                        } else if (action.action_type == 'set_dlg_attr_show') {
                           var result = action.value;
                           $this.hideFormItems(result)
                           // console.log($this.$data.head_styledef);
                        } else if (action.action_type ==
                           "set_dlg_current_edit_attr"
                        ) {
                           if ($this
                              .focusOldFieldId ==
                              action.value) {
                              $this.setData({
                                 focusFieldId: ""
                              })
                           } else {
                              $this.setData({
                                 focusFieldId: $this
                                    .focusOldFieldId
                              })
                           }
                           $this.$nextTick(() => {
                              $this.setData({
                                 focusFieldId: action
                                    .value
                              })
                           });
                        } else {
                           uni.showModal({
                              title: this.translateSys("tip"),
@@ -668,6 +695,66 @@
                  }
                  this.DataObjRunCustomEvent(info, '');
               }
               if (item.value) { //第一个输入框不为空
                  //初始化,下个输入框focus属性
                  var findd = false
                  for (let i in $this.head_styledef.form.items) {
                     const ele = $this.head_styledef.form.items[i]
                     if (ele.name != "Layout") {
                        if (ele.name == 'Input' || ele.name == 'InputNumber') {
                           if (attr == ele.fieldId) {
                              findd = true
                           } else {
                              if (findd) {
                                 $this.setData({
                                    focusFieldId: ele.fieldId
                                 })
                                 break
                              }
                           }
                        }
                     } else {
                        if (findd) {
                           let curIndex = ele.setting.colList.findIndex((col, index2, arr) => {
                              return (col.name == 'Input' || col.name == 'InputNumber');
                           })
                           if (curIndex > -1) {
                              $this.setData({
                                 focusFieldId: ele.setting.colList[curIndex]
                                    .fieldId
                              })
                              break
                           }
                        } else {
                           let curIndex = ele.setting.colList.findIndex((col, index2, arr) => {
                              return attr == col.fieldId;
                           })
                           if (curIndex > -1) {
                              findd = true
                              let curIndex2 = ele.setting.colList.findIndex((col, index2, arr) => {
                                 return (col.name == 'Input' || col.name ==
                                       'InputNumber') &&
                                    index2 >
                                    curIndex;
                              })
                              if (curIndex2 > -1) {
                                 $this.setData({
                                    focusFieldId: ele.setting.colList[curIndex]
                                       .fieldId
                                 })
                                 break
                              }
                           }
                        }
                     }
                  }
               }
            }
         },
         onClick(item) {
@@ -707,7 +794,7 @@
         },
         onchange(item) {
            // console.log("onchange",item);
            console.log("onchange", item);
            if (item.oldvalue != item.value && item.value.trim() != "") {
               item.oldvalue = item.value;
               var attr = item.fieldId;
@@ -961,6 +1048,27 @@
                           // console.log($this.$data.head_styledef);
                        } else if (action.action_type == 'set_global_attr') {
                           $this.$data.global_attr = action.value || [];
                        } else if (action.action_type ==
                           "set_dlg_current_edit_attr"
                        ) {
                           if ($this
                              .focusOldFieldId ==
                              action.value) {
                              $this.setData({
                                 focusFieldId: ""
                              })
                           } else {
                              $this.setData({
                                 focusFieldId: $this
                                    .focusOldFieldId
                              })
                           }
                           $this.$nextTick(() => {
                              $this.setData({
                                 focusFieldId: action
                                    .value
                              })
                           });
                        } else {
                           uni.showModal({
                              title: this.translateSys("tip"),
@@ -1470,12 +1578,15 @@
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
                  else {
                  uni.showToast({
                     title: this.translate('create_success'),
                     icon: "success",
                     duration: 3000
                  });
                     uni.showToast({
                        title: this.translate('create_success'),
                        icon: "success",
                        duration: 3000
                     });
                  }
                  if (!this.$data.param.After_Btn_Not_Refresh) {
                     //刷新
@@ -1492,28 +1603,50 @@
                           var action = actionlist[i];
                           if (action.action_type == 'set_dlg_attr') {
                              $this.setFormValues(action.value)
                           } else if (data.action[i].action_type == 'set_dlg_attr_show') {
                           } else if (action.action_type == 'set_dlg_attr_show') {
                              var result = action.value;
                              $this.hideFormItems(result)
                           } else if (action.action_type ==
                              "set_dlg_current_edit_attr"
                           ) {
                              if ($this
                                 .focusOldFieldId ==
                                 action.value) {
                                 $this.setData({
                                    focusFieldId: ""
                                 })
                              } else {
                                 $this.setData({
                                    focusFieldId: $this
                                       .focusOldFieldId
                                 })
                              }
                              $this.$nextTick(() => {
                                 $this.setData({
                                    focusFieldId: action
                                       .value
                                 })
                              });
                           }
                        }
                     }
                  }
               }
               // this.class_attr_init();
               this.saving = false
            }).catch(ex => {
               console.log(ex);
               this.saving = false
               uni.hideLoading();
               let exStr = JSON.stringify(ex)
               if (exStr == "{}")
                  exStr = ex
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
               uni.showModal({
                  title: this.translateSys("tip"),
                  content: ex.errMsg,
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
@@ -1762,10 +1895,32 @@
                           var action = actionlist[i];
                           if (action.action_type == 'set_dlg_attr') {
                              $this.setFormValues(action.value)
                           } else if (data.action[i].action_type == 'set_dlg_attr_show') {
                           } else if (action.action_type == 'set_dlg_attr_show') {
                              var result = action.value;
                              $this.hideFormItems(result)
                           } else if (action.action_type ==
                              "set_dlg_current_edit_attr"
                           ) {
                              if ($this
                                 .focusOldFieldId ==
                                 action.value) {
                                 $this.setData({
                                    focusFieldId: ""
                                 })
                              } else {
                                 $this.setData({
                                    focusFieldId: $this
                                       .focusOldFieldId
                                 })
                              }
                              $this.$nextTick(() => {
                                 $this.setData({
                                    focusFieldId: action
                                       .value
                                 })
                              });
                           }
                        }
                     }
                  }
@@ -1775,9 +1930,13 @@
            }).catch(ex => {
               // console.log(ex);
               this.saving = false
               let exStr = JSON.stringify(ex)
               if (exStr == "{}")
                  exStr = ex
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
               uni.showModal({
                  title: this.translateSys('tip') + "7.1",
                  content: ex.errMsg,
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
@@ -1893,28 +2052,61 @@
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
                  if (!this.$data.param.After_Btn_Not_Refresh) {
                     //刷新
                     uni.redirectTo({
                        url: '../modal/3018_2?param=' + JSON.stringify(this.$data
                              .param) +
                           "&titlename=" + this.$data.title
                     });
                  } else {
                     var actionlist = data.action;
                     if (actionlist) {
                        console.log(actionlist);
                        for (var i = 0; i < actionlist.length; i++) {
                           var action = actionlist[i];
                           if (action.action_type == 'set_dlg_attr') {
                              $this.setFormValues(action.value)
                           } else if (action.action_type == 'set_dlg_attr_show') {
                              var result = action.value;
                              $this.hideFormItems(result)
                           } else if (action.action_type ==
                              "set_dlg_current_edit_attr"
                           ) {
                              if ($this
                                 .focusOldFieldId ==
                                 action.value) {
                                 $this.setData({
                                    focusFieldId: ""
                                 })
                              } else {
                                 $this.setData({
                                    focusFieldId: $this
                                       .focusOldFieldId
                                 })
                              }
                              $this.$nextTick(() => {
                                 $this.setData({
                                    focusFieldId: action
                                       .value
                                 })
                              });
                           }
                  var actionlist = data.action;
                  if (actionlist) {
                     console.log(actionlist);
                     for (var i = 0; i < actionlist.length; i++) {
                        var action = actionlist[i];
                        if (action.action_type == 'set_dlg_attr') {
                           $this.setFormValues(action.value)
                        } else if (data.action[i].action_type == 'set_dlg_attr_show') {
                           var result = action.value;
                           $this.hideFormItems(result)
                        }
                     }
                  }
               }
            }).catch(ex => {
               // console.log(ex);
               let exStr = JSON.stringify(ex)
               if (exStr == "{}")
                  exStr = ex
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
               uni.showModal({
                  title: this.translateSys('tip') + "7.1",
                  content: ex.errMsg,
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
@@ -1933,7 +2125,6 @@
            const url = '../modal/3018?param=' + JSON.stringify(data) + "&titlename=" + btn.Edit_dlg
               .Name +
               "&type=addDataObj"
            console.log("showAddSmallDialog", url);
            var $this = this;
            uni.navigateTo({
               url: url,
@@ -1942,13 +2133,12 @@
                  addDataObj: function(resData) {
                     console.log(resData);
                     //刷新
                     if (!this.$data.param.After_Btn_Not_Refresh) {
                        uni.redirectTo({
                           url: '../modal/3018_2?param=' + JSON.stringify(this
                                 .$data.param) +
                              "&titlename=" + this.$data.title
                        });
                     }
                     uni.redirectTo({
                        url: '../modal/3018_2?param=' + JSON.stringify(this
                              .$data.param) +
                           "&titlename=" + this.$data.title
                     });
                  },
               }
            });