cuiqian2004
2024-09-05 b217ec6d467ef11448dbcfa56f236ebe94f4be65
pages/modal/5600.vue
@@ -177,6 +177,17 @@
<script>
   import Base64 from '../../components/js-base64/base64.js'
   import {
      appGetInfo,
      dictGetInfo
   } from "@/api/mobox.js"
   import {
      getUIStyleInfo,
      runCustomEvent,
      dataObjCreate,
      dataObjDel
   } from "@/api/data.js"
   export default {
      modules: {
         Base64,
@@ -318,23 +329,23 @@
            }
         },
         async Head_UIStyleGetInfo(class_id, style_id) { //获取自定义表单样式
            try {
            var $this = this;
            var dataInfo = {
               class_id: class_id,
               ui_style_id: style_id,
            };
            this.$store.dispatch('UIStyleGetInfo', dataInfo).then(ret => {
               // console.log(ret);
               if (ret.err_code == 0) {
               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);
                  }
                  $this.$data.head_styledef = ret.result.style_def ? JSON.parse(styledef) : {};
               $this.$data.head_styledef = result.style_def ? JSON.parse(styledef) : {};
                  // this.form = this.head_styledef.form.model;
                  // console.log($this.$data.head_styledef);
                  if ($this.$data.head_styledef.form?.items) {
@@ -352,44 +363,36 @@
                     });
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys("error") + "1",
                     content: ret.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
               }
            }).catch(ex => {
            } catch (ex) {
               // console.log(ex);
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
               uni.showModal({
                  title: this.translateSys("error") + "1.1",
                  title: this.translateSys("error") + "2.1",
                  content: tip,
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            });
            }
         },
         async Detail1_UIstyleGetInfo(class_id, style_id) { //获取自定义表单样式
            try {
            var $this = this;
            var dataInfo = {
               class_id: class_id,
               ui_style_id: style_id,
            };
            this.$store.dispatch('UIStyleGetInfo', dataInfo).then(ret => {
               // console.log(ret);
               if (ret.err_code == 0) {
               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);
                  }
                  $this.$data.detail1_styledef = ret.result.style_def ? JSON.parse(styledef) : {};
               $this.$data.detail1_styledef = result.style_def ? JSON.parse(styledef) : {};
                  $this.$data.detail1_styledef.SelBut_Checked = true;
                  // console.log($this.$data.detail1_styledef);
                  // $this.$data.detail1StyleDefList.push($this.$data.detail1_styledef);
@@ -403,15 +406,7 @@
                        }
                     });
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys("error") + "2",
                     content: ret.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
               }
            }).catch(ex => {
            } catch (ex) {
               // console.log(ex);
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
               uni.showModal({
@@ -420,39 +415,27 @@
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            });
            }
         },
         async Detail2_UIstyleGetInfo(class_id, style_id) { //获取自定义表单样式
            try {
            var $this = this;
            var dataInfo = {
               class_id: class_id,
               ui_style_id: style_id,
            };
            this.$store.dispatch('UIStyleGetInfo', dataInfo).then(ret => {
               // console.log(ret);
               if (ret.err_code == 0) {
               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);
                  }
                  $this.$data.detail2_styledef = ret.result.style_def ? JSON.parse(styledef) : {};
               $this.$data.detail2_styledef = result.style_def ? JSON.parse(styledef) : {};
                  $this.$data.detail2_styledef.SelBut_Checked = true;
                  // console.log($this.$data.detail2_styledef);
               } else {
                  uni.showModal({
                     title: this.translateSys("error") + "3",
                     content: ret.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
               }
            }).catch(ex => {
            } catch (ex) {
               // console.log(ex);
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
               uni.showModal({
@@ -461,8 +444,7 @@
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            });
            }
         },
         async DictGetInfo(dict, index, type) { //Mobox3得到得到字典信息字典项列表
            this.data = [];
@@ -472,10 +454,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({
@@ -508,9 +490,6 @@
                  // console.log($this.$data.detail1_styledef);
               }
               // $this.head_styledef.form.items[index].dictitem=success.result;
               // this.$store.commit("classAttrList", $this.$data.classAttrList);
            } catch (ex) {
               // console.log(ex);
               uni.showModal({
@@ -521,107 +500,6 @@
               });
            }
            // console.log(dataInfo);
         },
         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);
                     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('将getDictInfo【json string】转换为【json object】失败')
                           }
                        }
                        if (ret.err_code == 0) {
                           resolve(ret);
                        } else {
                           reject({
                              "errMsg": ret.err_msg
                           });
                        }
                     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) {
@@ -868,10 +746,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
                              .err_info : result.err_info.join('<br/>') : '';
@@ -1106,14 +983,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
@@ -1422,9 +1292,8 @@
                        obj_id: objID
                     };
                     // console.log(dataInfo);
                     $this.$store.dispatch('dataObjDel', dataInfo).then(ret => {
                     dataObjDel(dataInfo).then(ret => {
                        // console.log(ret);
                        if (ret.err_code == 0) {
                           const style = $this.detail2StyleDefList[index];
                           $this.detail2StyleDefList.splice(index, 1);
                           if ($this.Before_Del_Event?.ID)
@@ -1439,16 +1308,6 @@
                              showCancel: false,
                              confirmText: this.translateSys("cancel")
                           });
                        } else {
                           uni.showModal({
                              title: this.translateSys("error") + "5",
                              content: ret.err_msg,
                              showCancel: false,
                              confirmText: this.translateSys("cancel")
                           });
                        }
                     }).catch(ex => {
                        // console.log(ex);
                        let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
@@ -1896,10 +1755,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 :
                        result.err_info.join('<br/>') : '';
@@ -1979,6 +1836,49 @@
                                 // });
                                 // uni.showModal({title:"系统提示",content:value,showCancel:false,confirmText:"关闭"});
                              } else if (item.action_type ==
                              "set_subtable_page_content") { //已码盘
                              $this.$data.param.Show_Welcom_Page = false;
                              var value = item.value;
                              if (value.clear_confirm != false && value.clear ==
                                 true &&
                                 $this.$data.detail1StyleDefList.length > 0 &&
                                 value.page_name == $this.$data.param.Sub_Page[0]
                                 .Name
                              ) { //判断是否清空页签内容,正在码盘是否有数据
                                 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) {
                                          $this.$data
                                             .detail1StyleDefList = [];
                                          $this.viewAceionContent(
                                             value);
                                       } else if (res.cancel) {
                                          $this.$data
                                             .detail1StyleDefList = [];
                                          $this.viewAceionContent(
                                             value);
                                       }
                                    }
                                 });
                              } else {
                                 if (value.page_name == $this.$data.param.Sub_Page[
                                       0].Name) { //判断返回的action的page_name是否是待分拣
                                    $this.$data.detail1StyleDefList = [];
                                 } else {
                                    $this.$data.detail2StyleDefList = [];
                                 }
                                 $this.viewAceionContent(value);
                              }
                           } else if (item.action_type ==
                                 "remove_subtable_page_row") { //清除面板中指定id的数据
                                 var value = item.value;
                                 if (value.page_name == $this.param.Sub_Page[0]
@@ -2041,6 +1941,44 @@
                                       focusFieldId: item.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) => {
                                 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 {
@@ -2064,14 +2002,7 @@
                        }
                     }
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys("error") + "8",
                     content: res.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
               }
               if (type == "1")
                  this.okLoading = false
               else if (type == "2")