cuiqian2004
2024-09-05 b217ec6d467ef11448dbcfa56f236ebe94f4be65
pages/modal/5601.vue
@@ -140,6 +140,14 @@
<script>
   import Base64 from '../../components/js-base64/base64.js'
   import {
      dictGetInfo
   } from "@/api/mobox.js"
   import {
      getUIStyleInfo,
      runCustomEvent,
   } from "@/api/data.js"
   export default {
      name: "PageModal5601",
      modules: {
@@ -302,14 +310,14 @@
                  class_id: class_id,
                  ui_style_id: style_id,
               };
               const ret = await this.getUIStyleInfo(dataInfo)
               const result = await getUIStyleInfo(dataInfo)
               var styledef = "";
               if (ret.result.style_def) {
               if (result.style_def) {
                  //mobox2的style_def是json字符串
                  styledef = ret.result.style_def.replace(/\\/g, "");
                  styledef = result.style_def.replace(/\\/g, "");
                  //mobox3的style_def是base64字符串
                  if (!ret.result.style_def.includes('"')) styledef = Base64.decode(
                     ret.result
                  if (!result.style_def.includes('"')) styledef = Base64.decode(
                     result
                     .style_def);
               }
               const styledefHead = styledef ? JSON.parse(styledef) : {};
@@ -369,80 +377,7 @@
               });
               return {}
            }
            // this.$store.dispatch('UIStyleGetInfo', dataInfo).then(async (ret) => {
            //    // console.log(ret);
            //    if (ret.err_code == 0) {
            //       var styledef = "";
            //       if (ret.result.style_def) {
            //          //mobox2的style_def是json字符串
            //          styledef = ret.result.style_def.replace(/\\/g, "");
            //          //mobox3的style_def是base64字符串
            //          if (!ret.result.style_def.includes('"')) styledef = Base64.decode(
            //             ret.result
            //             .style_def);
            //       }
            //       const styledefHead = styledef ? JSON.parse(styledef) : {};
            //       for (let i in styledefHead.form.items) {
            //          const ele = styledefHead.form.items[i]
            //          if (ele.name != "Layout") {
            //             if (ele?.useDict) {
            //                //判断useDict是否使用字典
            //                await this.DictGetInfo(ele.bind.dict,
            //                   styledefHead.form.model,
            //                   ele);
            //             }
            //             if ($this.focusFieldId == "") {
            //                if (ele.name == 'Input' || ele.name ==
            //                   'InputNumber') {
            //                   $this.setData({
            //                      focusFieldId: ele.fieldId
            //                   })
            //                }
            //             }
            //          } else {
            //             for (let j in ele.setting.colList) {
            //                const col = ele.setting.colList[j]
            //                if (col?.useDict) {
            //                   //判断useDict是否使用字典
            //                   await this.DictGetInfo(col.bind
            //                      .dict,
            //                      styledefHead.form
            //                      .model, col);
            //                }
            //                if ($this.focusFieldId == "") {
            //                   if (col.name == 'Input' || col
            //                      .name ==
            //                      'InputNumber') {
            //                      $this.setData({
            //                         focusFieldId: col
            //                            .fieldId
            //                      })
            //                   }
            //                }
            //             }
            //          }
            //       }
            //       this.setData({
            //          head_styledef: styledefHead
            //       })
            //    } else {
            //       uni.showModal({
            //          title: this.translateSys("error") + "1",
            //          content: ret.err_msg,
            //          showCancel: false,
            //          confirmText: this.translateSys("cancel")
            //       });
            //    }
            // }).catch(ex => {
            //    // console.log(ex);
            //    uni.showModal({
            //       title: this.translateSys("error") + "1.1",
            //       content: ex.errMsg,
            //       showCancel: false,
            //       confirmText: this.translateSys("cancel")
            //    });
            // });
         },
         async Detail_UIstyleGetInfo(class_id, style_id) { //获取自定义表单样式
@@ -452,18 +387,18 @@
                  class_id: class_id,
                  ui_style_id: style_id,
               };
               const ret = await this.getUIStyleInfo(dataInfo)
               const result = await getUIStyleInfo(dataInfo)
               var styledef = "";
               if (ret.result.style_def) {
               if (result.style_def) {
                  //mobox2的style_def是json字符串
                  styledef = ret.result.style_def.replace(/\\/g, "");
                  styledef = result.style_def.replace(/\\/g, "");
                  //mobox3的style_def是base64字符串
                  if (!ret.result.style_def.includes('"')) styledef = Base64
                     .decode(ret.result
                  if (!result.style_def.includes('"')) styledef = Base64
                     .decode(result
                        .style_def);
               }
               const detailstyledef = ret.result.style_def ? JSON.parse(
               const detailstyledef = result.style_def ? JSON.parse(
                  styledef) : {};
               detailstyledef.SelBut_Checked = true;
               if (detailstyledef?.form?.items) {
@@ -502,64 +437,7 @@
               });
               return {}
            }
            // this.$store.dispatch('UIStyleGetInfo', dataInfo).then(async (ret) => {
            //    // console.log(ret);
            //    if (ret.err_code == 0) {
            //       var styledef = "";
            //       if (ret.result.style_def) {
            //          //mobox2的style_def是json字符串
            //          styledef = ret.result.style_def.replace(/\\/g, "");
            //          //mobox3的style_def是base64字符串
            //          if (!ret.result.style_def.includes('"')) styledef = Base64
            //             .decode(ret.result
            //                .style_def);
            //       }
            //       const detailstyledef = ret.result.style_def ? JSON.parse(
            //          styledef) : {};
            //       detailstyledef.SelBut_Checked = true;
            //       for (let index in detailstyledef.form.items) {
            //          const ele = detailstyledef.form.items[index]
            //          if (ele.name != "Layout") {
            //             if (ele.useDict == true) { //判断useDict是否使用字典
            //                await this.DictGetInfo(ele.bind.dict,
            //                   detailstyledef.form
            //                   .model, ele);
            //             }
            //          } else {
            //             for (let j in ele.setting.colList) {
            //                const col = ele.setting.colList[j]
            //                if (col?.useDict == true) {
            //                   await this.DictGetInfo(col
            //                      .bind.dict,
            //                      detailstyledef.form
            //                      .model, col);
            //                }
            //             }
            //          }
            //       }
            //       console.log("Detail_UIstyleGetInfo", detailstyledef);
            //       return detailstyledef
            //    } else {
            //       return {}
            //       uni.showModal({
            //          title: this.translateSys("error") + "2",
            //          content: ret.err_msg,
            //          showCancel: false,
            //          confirmText: this.translateSys("cancel")
            //       });
            //    }
            // }).catch(ex => {
            //    // console.log(ex);
            //    uni.showModal({
            //       title: this.translateSys("error") + "2.1",
            //       content: ex.errMsg,
            //       showCancel: false,
            //       confirmText: this.translateSys("cancel")
            //    });
            //    return {}
            // });
         },
@@ -571,10 +449,10 @@
               dict_name: dict.name
            };
            try {
               const res = await this.getDictInfo(dataInfo)
               const result = await dictGetInfo(dataInfo)
               var list = [];
               var itemName = '';
               res.result.dict_item_list.forEach((item) => {
               (result.dict_item_list || []).forEach((item) => {
                  if (item.is_default == '1')
                     itemName = item.name;
                  list.push({
@@ -588,9 +466,6 @@
                  formModel[formItem.fieldId] = itemName;
               }
               formItem.dict = list;
               // $this.head_styledef.form.items[index].dictitem=success.result;
               // this.$store.commit("classAttrList", $this.$data.classAttrList);
            } catch (ex) {
               // console.log(ex);
               uni.showModal({
@@ -602,83 +477,6 @@
            }
         },
         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);
                  }
               })
            })
         },
         getUIStyleInfo(info) { //Mobox3数据类界面样式
            const loginInfo = this.$store.getters.loginid
            const dataSApi = this.$store.getters.getDataSApi
            return new Promise((resolve, reject) => {
               uni.request({
                  url: dataSApi + 'api/class/uistyle/GetInfo?sessionid=' + loginInfo.result
                     .session_id,
                  data: info,
                  method: 'POST',
                  dataType: "json",
                  success: (_res) => {
                     // console.log(_res);
                     var ret = _res.data
                     if (typeof ret == 'string') {
                        try {
                           try {
                              try {
                                 ret = JSON.parse(ret.replace(/\\"/g, '"'));
                              } catch (ex) {
                                 ret = JSON.parse(ret.replace(/\\/g, '\\\\'))
                              }
                           } catch (ex) {
                              ret = JSON.parse(ret.replace(/\\"/g, "'").replace(/[\r\n]/g,
                                 '<br>').replace(/[\t]/g, '    '));
                           }
                        } catch (ex) {
                           console.log(ret)
                           return reject('将getUIStyleInfo【json string】转换为【json object】失败')
                        }
                     }
                     if (ret.err_code == 0) {
                        resolve(ret);
                     } else {
                        reject({
                           "errMsg": ret.err_msg || ret.errMsg
                        });
                     }
                  },
                  fail: (err) => {
                     // console.log(err);
                     reject(err);
                  }
               })
            })
         },
         onClick(item) {
            this.focusFieldId = item.fieldId
         },
@@ -912,10 +710,9 @@
                     global_attr: '',
                     input_param: input_param,
                  };
                  this.$store.dispatch('runCustomEvent', dataInfo).then(ret => {
                     console.log(ret);
                     if (ret.err_code == 0) {
                        var result = ret.result;
                  runCustomEvent(dataInfo).then(result => {
                     console.log(result);
                        if (result.ret != 0) {
                           var tip = result.err_info ? typeof result
                              .err_info == 'string' ? result
@@ -1354,16 +1151,7 @@
                           }
                        }
                     } else {
                        uni.showModal({
                           title: this.translateSys("error") +
                              "4",
                           content: ret.err_msg,
                           showCancel: false,
                           confirmText: this.translateSys(
                              "cancel")
                        });
                     }
                  }).catch(ex => {
                     // console.log(ex);
                     let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
@@ -1905,10 +1693,8 @@
            };
            // console.log(dataInfo);
            this.$store.dispatch('runCustomEvent', dataInfo).then(res => {
               console.log(res);
               if (res.err_code == 0) {
                  var result = res.result;
            runCustomEvent(dataInfo).then(result => {
               console.log(result);
                  if (result.ret != 0) {
                     var tip = result.err_info ? typeof result
                        .err_info == 'string' ? result.err_info :
@@ -2002,6 +1788,86 @@
                                          "cancel"
                                       )
                                 });
                           } else if (item.action_type ==
                              "set_subtable_page_content"
                           ) { //已码盘
                              $this.$data.param
                                 .Show_Welcom_Page =
                                 false;
                              var value = item.value;
                              const pageData = $this
                                 .pageDetail.find((
                                    page) => {
                                    return value
                                       .page_name ==
                                       page.Name;
                                 });
                              if (value.clear_confirm !=
                                 false && value.clear ==
                                 true &&
                                 pageData && pageData
                                 .DefList.length > 0
                              ) { //判断是否清空页签内容,正在码盘是否有数据
                                 uni.showModal({
                                    title: this
                                       .translateSys(
                                          'tip'
                                       ),
                                    content: this
                                       .translate(
                                          "are_you_sure_clear_first"
                                       ) +
                                       this
                                       .translateSys(
                                          "quotation_mark_left"
                                       ) +
                                       value
                                       .page_name +
                                       this
                                       .translateSys(
                                          "quotation_mark_right"
                                       ) +
                                       this
                                       .translate(
                                          "are_you_sure_clear_last"
                                       ),
                                    success: function(
                                       res
                                    ) {
                                       if (res
                                          .confirm
                                       ) {
                                          if (
                                             pageData)
                                             pageData
                                             .DefList = [];
                                          $this
                                             .viewAceionContent(
                                                value
                                             );
                                       } else if (
                                          res
                                          .cancel
                                       ) {
                                          if (
                                             pageData)
                                             pageData
                                             .DefList = [];
                                          $this
                                             .viewAceionContent(
                                                value
                                             );
                                       }
                                    }
                                 });
                              } else {
                                 if (pageData)
                                    pageData
                                    .DefList = [];
                                 $this
                                    .viewAceionContent(
                                       value);
                              }
                              } else if (item
                                 .action_type ==
                                 "remove_subtable_page_row"
@@ -2113,7 +1979,126 @@
                                             .value
                                       })
                                 });
                           } else if (item.action_type ==
                              "set_dlg_attr") {
                              // value = {"attr":"xxx", "value":"xxx"}
                              var data = item.value;
                              $this.$data.head_styledef
                                 .form.items.forEach(
                                    async (
                                       ele, index
                                    ) => {
                                       if (ele
                                          .name !=
                                          "Layout"
                                       ) {
                                          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;
                                                }
                                             });
                                       } else {
                                          ele.setting
                                             .colList
                                             .forEach(
                                                async (
                                                   col
                                                ) => {
                                                   if (
                                                      col) {
                                                      data.forEach(
                                                         async (ele2,
                                                            index
                                                         ) => {
                                                            if (col
                                                               .fieldId ==
                                                               ele2
                                                               .attr
                                                            ) {
                                                               if (col
                                                                  .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
                                                                        });
                                                                  }
                                                                  col.dict =
                                                                     dictItemList;
                                                               }
                                                               col.value =
                                                                  ele2
                                                                  .value;
                                                            }
                                                         });
                                                   }
                                                })
                                       }
                                    })
                           }
                           });
                        } else {
                           if ($this.$data.After_OK_Event.ID !=
@@ -2139,16 +2124,7 @@
                        }
                     }
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys("error") +
                        "8",
                     content: res.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys(
                        "cancel")
                  });
               }
               pageParam.okLoading = false
            }).catch(ex => {
               pageParam.okLoading = false