cuiqian2004
2024-09-05 b217ec6d467ef11448dbcfa56f236ebe94f4be65
pages/modal/3018.vue
@@ -293,6 +293,21 @@
   import Base64 from '../../components/js-base64/base64.js'
   import pickerAddress from '../../js/pickerAddress/pickerAddress.vue'
   import utils from "@/js/utils.js"
   import {
      appGetInfo,
      dictGetInfo,
      dictItemGetInfo
   } from "@/api/mobox.js"
   import {
      getUIStyleInfo,
      runCustomEvent,
      dataObjCreate
   } from "@/api/data.js"
   import {
      classAttrList,
   } from "@/api/index.js"
   export default {
      modules: {
         Base64,
@@ -407,6 +422,7 @@
            });
         },
         async loadData() {
            try {
            const param = this.param
            var edit_dlg = {
               Model: param.EditDlgMode,
@@ -418,71 +434,44 @@
               group_name: ''
            };
            var $this = this;
            $this.$store.state.thisareaFuncID = param.clsid;
            // console.log($this.$store.getters.getclassAttrList);
            //获取
            if ($this.$store.getters.getclassAttrList) {
               $this.$data.classAttrList = $this.$store.getters.getclassAttrList;
               $this.classGridStyleInfo();
            } else {
               $this.$store.dispatch('classAttrGetList', dataInfo)
                  .then((success) => {
                     if (success.err_code == 0) {
                        $this.$data.classAttrList = success.result;
                        success.result.forEach(async (group, index) => {
                           group.attr_list.forEach(async (attr, key) => {
               const result = await classAttrList(dataInfo) || []
               for (let index in result) {
                  const group = result[index]
                  for (let key in group.attr_list) {
                     const attr = group.attr_list[key]
                              if (utils.classUtils.attrTypeIsDict(attr.type)) {
                                 await $this.DictItemGetList(attr, key,
                                    index);
                        attr.dictitem = await $this.DictItemGetList(attr);
                              }
                           });
                        });
                        setTimeout(function() {
                           $this.classGridStyleInfo();
                        }, 500);
                     } else {
                  }
               }
               $this.$data.classAttrList = result;
               await $this.classGridStyleInfo();
            } 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",
                           content: success.err_msg,
                  content: tip,
                           showCancel: false,
                           confirmText: this.translateSys('cancel')
                  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')
                     });
                  });
            }
            console.log(this.$data.param);
         },
         async DictItemGetList(attr, key, index) { //Mobox3得到字典项列表
         async DictItemGetList(attr) { //Mobox3得到字典项列表
            try {
            this.data = [];
            var $this = this;
            var dataInfo = {
               dict_id: attr.dict_id,
               dict_name: attr.dict_name
            };
            // console.log(dataInfo);
            this.$store.dispatch('DictItemGetList', dataInfo).then(async (success) => {
               // console.log(success);
               if (success.err_code == 0) {
                  $this.$data.classAttrList[index].attr_list[key].dictitem = success.result;
                  this.$store.commit("classAttrList", $this.$data.classAttrList);
               const res = await dictItemGetInfo(dataInfo)
               return res?.dict_item_list || []
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " 1.2",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
            } catch (ex) {
               // console.log(ex);
               uni.showModal({
                  title: this.translateSys('error') + " 1.3",
@@ -490,48 +479,32 @@
                  showCancel: false,
                  confirmText: this.translateSys('cancel')
               });
            });
               return []
            }
         },
         async classGridStyleInfo() {
            try {
            var $this = this;
            var gridstyleInfo = {
               class_id: $this.$data.param.clsid,
               ui_style_type: 2,
               ui_style_name: $this.$data.param.Edit_dlg.Name
            };
            $this.$store.state.thisEditName = $this.$data.param.Edit_dlg.Name
            // console.log($this.$store.getters.getclassGridStyleInfo);
            //获取
            if ($this.$store.getters.getclassGridStyleInfo) {
               $this.$data.classGridStyle = $this.$store.getters.getclassGridStyleInfo;
               $this.viewParam();
            } else {
               // console.log(gridstyleInfo);
               $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(async (success) => {
                  // console.log(success);
                  if (success.err_code == 0) {
                     var styledef = Base64.decode(success.result.style_def);
                     success.result.style_def = JSON.parse(styledef);
                     $this.$data.classGridStyle = success.result;
                     // console.log($this.$data.classGridStyle);
               const result = await getUIStyleInfo(dataInfo)
               var styledef = Base64.decode(result.style_def);
               result.style_def = JSON.parse(styledef);
               $this.$data.classGridStyle = result
                     $this.viewParam();
                  } else {
            } catch (ex) {
               // console.log(ex);
                     uni.showModal({
                        title: this.translateSys('error') + " 1.4",
                        content: success.err_msg,
                        showCancel: false,
                        confirmText: this.translateSys('cancel')
                     });
                  }
               }).catch(ex => {
                  console.log(ex);
                  uni.showModal({
                     title: this.translateSys('error') + " 1.5",
                     content: ex.errMsg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               });
            }
         },
@@ -1342,14 +1315,11 @@
            };
            console.log(dataInfo);
            // return
            this.$store.dispatch('createDataObj', dataInfo).then(success => {
               console.log(success);
            DataObjCreate(dataInfo).then((result) => {
               console.log(result);
               uni.hideLoading();
               if (success.err_code == 0) {
                  var result = success.result;
                  // if(result.result_type == 0){}
                  if (success.result.action) {
                     var action = JSON.parse(success.result.action);
               if (result.action) {
                  var action = JSON.parse(result.action);
                     console.log(action);
                     if (action.ret == '0') {
                        if (action.ret != 0) {
@@ -1401,14 +1371,7 @@
                        "&titlename=" + this.$data.title
                  });
                  // this.cancel();
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " ",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
               console.log(ex);
               uni.hideLoading();
@@ -1472,10 +1435,7 @@
            };
            console.log(dataInfo);
            // return;
            this.$store.dispatch('runCustomEvent', dataInfo).then(success => {
               console.log(success);
               if (success.err_code == 0) {
                  var data = success.result;
            runCustomEvent(dataInfo).then(data => {
                  if (data.ret != 0) {
                     var tip = data.err_info ? typeof data.err_info == 'string' ? data
                        .err_info :
@@ -1595,14 +1555,7 @@
                        }
                     }
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " 2",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
               // console.log(ex);
               uni.showModal({
@@ -1679,10 +1632,8 @@
            };
            console.log(dataInfo);
            // return;
            this.$store.dispatch('runCustomEvent', dataInfo).then(success => {
               console.log(success);
               if (success.err_code == 0) {
                  var data = success.result;
            runCustomEvent(dataInfo).then(data => {
               console.log(data);
                  if (data.ret != 0) {
                     var tip = data.err_info ? typeof data.err_info == 'string' ? data
                        .err_info :
@@ -1818,14 +1769,7 @@
                        }
                     }
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " 3",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
               // console.log(ex);
               uni.showModal({
@@ -1918,10 +1862,8 @@
            };
            console.log(dataInfo);
            // return;
            this.$store.dispatch('runCustomEvent', dataInfo).then(success => {
               console.log(success);
               if (success.err_code == 0) {
                  var data = success.result;
            runCustomEvent(dataInfo).then(data => {
               console.log(data);
                  if (data.ret != 0) {
                     var tip = data.err_info ? typeof data.err_info == 'string' ? data
                        .err_info :
@@ -1974,14 +1916,7 @@
                     this.add();
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " 4",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
               // console.log(ex);
               uni.showModal({
@@ -2074,10 +2009,8 @@
            };
            console.log(dataInfo);
            // return;
            this.$store.dispatch('runCustomEvent', dataInfo).then(success => {
               console.log(success);
               if (success.err_code == 0) {
                  var data = success.result;
            runCustomEvent(dataInfo).then(data => {
               console.log(data);
                  if (data.ret != 0) {
                     var tip = data.err_info ? typeof data.err_info == 'string' ? data
                        .err_info :
@@ -2301,14 +2234,7 @@
                        });
                     }
                  }
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " 5",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
               // console.log(ex);
               uni.showModal({
@@ -2352,7 +2278,6 @@
   }
</script>
<style>
   .popup-content {
      @include flex;
      align-items: center;
@@ -2362,6 +2287,7 @@
      /* height: 150px; */
      /* border: 1px solid red; */
   }
   .popup-height {
      @include height;
      /* width: 200px; */