cuiqian2004
2025-08-14 e540e5b44f56ce8e8edc377dfa4c5b343b1a9eef
pages/modal/3037_2.vue
@@ -173,7 +173,7 @@
         }); //设置顶部标题 
         this.title = options.titlename;
         this.param = JSON.parse(options.param);
         const  paramValue = options.paramValue ?JSON.parse(options.paramValue) :undefined
         const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined
         this.loadData(paramValue)
         //页面初始化获取焦点
@@ -207,28 +207,29 @@
            await this.Head_UIStyleGetInfo(this.param.Master_Cls?.ID, this.param.Master_Cls?.UI_Style?.ID);
            //传入参数值
            if (paramValue) {
               const attrs = paramValue.attrs || [];
               this.setFormItemVisible(this.head_styledef,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.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;
                              }
                           });
                        }
                     });
                  }
               })
            }
            await this.Detail1_UIstyleGetInfo(this.param.Sub_Cls?.ID, this.param.Sub_Cls?.UI_Style?.ID);
@@ -441,7 +442,7 @@
            runCustomEvent(dataInfo).then(data => {
               console.log(data);
               if (data.ret != 0&& data.ret != 1) {
               if (data.ret != 0 && data.ret != 1) {
                  var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
                     .err_info.join('<br/>') : '';
                  if (data.ret == 801) {
@@ -491,84 +492,8 @@
                           var action = actionlist[i];
                           if (action.action_type == 'set_dlg_attr') {
                              var result = action.value;
                              for (var i = 0; i < result.length; i++) {
                                 if (result[i].choice_list) {
                                    for (var c = 0; c < styledef.form.items.length; c++) {
                                       var attr = styledef.form.items[c];
                                       if (attr.name != 'Layout') {
                                          if (attr.fieldId == result[i].attr) {
                                             var dictItemList = [];
                                             for (var d in result[i].choice_list) {
                                                var val = result[i].choice_list[d];
                                                dictItemList.push({
                                                   "CN_S_NAME": val,
                                                   "CN_S_VALUE": val,
                                                   "text": val,
                                                   "value": val
                                                });
                                             }
                                             attr.dict = dictItemList;
                                          }
                                       } else if (attr.name == 'Layout') {
                                          attr.setting.colList.forEach(col => {
                                             if (col) {
                                                if (col.fieldId == result[i].attr) {
                                                   var dictItemList = [];
                                                   for (var d in result[i]
                                                         .choice_list) {
                                                      var val = result[i]
                                                         .choice_list[d];
                                                      dictItemList.push({
                                                         "CN_S_NAME": val,
                                                         "CN_S_VALUE": val,
                                                         "text": val,
                                                         "value": val
                                                      });
                                                   }
                                                   col.dict = dictItemList;
                                                }
                                             }
                                          });
                                       }
                              $this.setFormValues(styledef, result)
                                    }
                                 }
                                 for (var c = 0; c < styledef.form.items.length; c++) {
                                    var attr = styledef.form.items[c];
                                    // console.log(attr[j].Name+'=='+result[i].attr);
                                    //判断表单里是否有返回字段,没有就装载到model里,点击确定提交的时候带上这些数据
                                    if ($this.head_styledef.form.model[result[i].attr] ==
                                       undefined) {
                                       $this.head_styledef.form.model[result[i].attr] = result[i]
                                          .value;
                                    }
                                    //判断是否是栅格表单
                                    if (attr.name != 'Layout') {
                                       if (attr.fieldId == result[i].attr) {
                                          attr.value = '';
                                          attr.oldvalue = '';
                                          attr.value = result[i].value;
                                          attr.oldvalue = result[i].value;
                                          $this.head_styledef.form.model[attr.fieldId] = result[
                                             i].value;
                                       }
                                    } else if (attr.name == 'Layout') {
                                       attr.setting.colList.forEach(col => {
                                          if (col) {
                                             if (col.fieldId == result[i].attr) {
                                                col.value = '';
                                                col.oldvalue = '';
                                                col.value = result[i].value;
                                                col.oldvalue = result[i].value;
                                                $this.head_styledef.form.model[col
                                                   .fieldId] = result[i].value;
                                             }
                                          }
                                       });
                                    }
                                 }
                              }
                           } else if (data.action[i].action_type == 'set_dlg_attr_show') {
                              var result = action.value;
                              if (type == 'head') {
@@ -855,7 +780,7 @@
            console.log(dataInfo);
            // return;
            runCustomEvent(dataInfo).then(data => {
               if (data.ret != 0&& data.ret != 1) {
               if (data.ret != 0 && data.ret != 1) {
                  var tip = data.err_info ? typeof data.err_info == 'string' ? data
                     .err_info :
                     data
@@ -1552,7 +1477,7 @@
            // return;
            runCustomEvent(dataInfo).then(data => {
               console.log(data);
               if (data.ret != 0&& data.ret != 1) {
               if (data.ret != 0 && data.ret != 1) {
                  var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
                     .err_info.join('<br/>') : '';
                  if (data.ret == 801) {
@@ -1648,75 +1573,7 @@
                           var action = actionlist[i];
                           if (action.action_type == 'set_dlg_attr') {
                              var result = action.value;
                              for (var i = 0; i < result.length; i++) {
                                 if (result[i].choice_list) {
                                    for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
                                       var attr = $this.head_styledef.form.items[c];
                                       if (attr.name != 'Layout') {
                                          if (attr.fieldId == result[i].attr) {
                                             var dictItemList = [];
                                             for (var d in result[i].choice_list) {
                                                var val = result[i].choice_list[d];
                                                dictItemList.push({
                                                   "CN_S_NAME": val,
                                                   "CN_S_VALUE": val,
                                                   "text": val,
                                                   "value": val
                                                });
                                             }
                                             attr.dict = dictItemList;
                                          }
                                       } else if (attr.name == 'Layout') {
                                          attr.setting.colList.forEach(col => {
                                             if (col) {
                                                if (col.fieldId == result[i].attr) {
                                                   var dictItemList = [];
                                                   for (var d in result[i].choice_list) {
                                                      var val = result[i].choice_list[d];
                                                      dictItemList.push({
                                                         "CN_S_NAME": val,
                                                         "CN_S_VALUE": val,
                                                         "text": val,
                                                         "value": val
                                                      });
                                                   }
                                                   col.dict = dictItemList;
                                                }
                                             }
                                          });
                                       }
                                    }
                                 }
                                 for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
                                    var attr = $this.head_styledef.form.items[c];
                                    // console.log(attr[j].Name+'=='+result[i].attr);
                                    if (attr.name != 'Layout') {
                                       if (attr.fieldId == result[i].attr) {
                                          attr.value = '';
                                          attr.oldvalue = '';
                                          attr.value = result[i].value;
                                          attr.oldvalue = result[i].value;
                                          $this.head_styledef.form.model[attr.fieldId] = result[i]
                                             .value;
                                       }
                                    } else if (attr.name == 'Layout') {
                                       attr.setting.colList.forEach(col => {
                                          if (col) {
                                             if (col.fieldId == result[i].attr) {
                                                col.value = '';
                                                col.oldvalue = '';
                                                col.value = result[i].value;
                                                col.oldvalue = result[i].value;
                                                $this.head_styledef.form.model[col
                                                   .fieldId] = result[i].value;
                                             }
                                          }
                                       });
                                    }
                                 }
                              }
                              $this.setFormValues($this.head_styledef, result)
                           } else if (action.action_type == 'set_dlg_attr_show') {
                              var data = action.value;
                              $this.setFormItemVisible(data)
@@ -1752,6 +1609,89 @@
                  confirmText: this.translateSys('close')
               });
            });
         },
         setFormValues(styledef, attrs) {
            if (!Array.isArray(attrs)) {
               return
            }
            for (var i = 0; i < attrs.length; i++) {
               if (attrs[i].choice_list) {
                  for (var c = 0; c < styledef.form.items.length; c++) {
                     var attr = styledef.form.items[c];
                     if (attr.name != 'Layout') {
                        if (attr.fieldId == attrs[i].attr) {
                           var dictItemList = [];
                           for (var d in attrs[i].choice_list) {
                              var val = attrs[i].choice_list[d];
                              dictItemList.push({
                                 "CN_S_NAME": val,
                                 "CN_S_VALUE": val,
                                 "text": val,
                                 "value": val
                              });
                           }
                           attr.dict = dictItemList;
                        }
                     } else if (attr.name == 'Layout') {
                        attr.setting.colList.forEach(col => {
                           if (col) {
                              if (col.fieldId == attrs[i].attr) {
                                 var dictItemList = [];
                                 for (var d in attrs[i]
                                       .choice_list) {
                                    var val = attrs[i]
                                       .choice_list[d];
                                    dictItemList.push({
                                       "CN_S_NAME": val,
                                       "CN_S_VALUE": val,
                                       "text": val,
                                       "value": val
                                    });
                                 }
                                 col.dict = dictItemList;
                              }
                           }
                        });
                     }
                  }
               }
               for (var c = 0; c < styledef.form.items.length; c++) {
                  var attr = styledef.form.items[c];
                  // console.log(attr[j].Name+'=='+attrs[i].attr);
                  //判断表单里是否有返回字段,没有就装载到model里,点击确定提交的时候带上这些数据
                  if (styledef.form.model[attrs[i].attr] ==
                     undefined) {
                     styledef.form.model[attrs[i].attr] = attrs[i]
                        .value;
                  }
                  //判断是否是栅格表单
                  if (attr.name != 'Layout') {
                     if (attr.fieldId == attrs[i].attr) {
                        attr.value = '';
                        attr.oldvalue = '';
                        attr.value = attrs[i].value;
                        attr.oldvalue = attrs[i].value;
                        styledef.form.model[attr.fieldId] = attrs[
                           i].value;
                     }
                  } else if (attr.name == 'Layout') {
                     attr.setting.colList.forEach(col => {
                        if (col) {
                           if (col.fieldId == attrs[i].attr) {
                              col.value = '';
                              col.oldvalue = '';
                              col.value = attrs[i].value;
                              col.oldvalue = attrs[i].value;
                              styledef.form.model[col
                                 .fieldId] = attrs[i].value;
                           }
                        }
                     });
                  }
               }
            }
         },
         setFormItemVisible(attrs) {
            if (!Array.isArray(attrs)) {
@@ -1838,7 +1778,7 @@
            runCustomEvent(dataInfo).then(data => {
               console.log(data);
               if (data.ret != 0&& data.ret != 1) {
               if (data.ret != 0 && data.ret != 1) {
                  var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
                     .err_info.join('<br/>') : '';
                  if (data.ret == 801) {