cuiqian2004
2024-09-05 b217ec6d467ef11448dbcfa56f236ebe94f4be65
pages/modal/small-wnd/index.vue
@@ -290,6 +290,17 @@
   import Base64 from '../../components/js-base64/base64.js'
   import pickerAddress from '../../js/pickerAddress/pickerAddress.vue'
   import utils from "@/js/utils.js"
   import {
      dictGetInfo,
      dictItemGetInfo
   } from "@/api/mobox.js"
   import {
      getUIStyleInfo,
      classAttrGetList,
      runCustomEvent,
      dataObjCreate,
      dataObjDel
   } from "@/api/data.js"
   export default {
      name: "PageModalSmallWnd",
      modules: {
@@ -375,6 +386,28 @@
         this.loadData()
      },
      methods: {
         setData(obj) {
            let that = this;
            let keys = [];
            let val, data;
            Object.keys(obj).forEach(function(key) {
               keys = key.split(".");
               val = obj[key];
               data = that.$data;
               keys.forEach(function(key2, index) {
                  if (index + 1 == keys.length) {
                     that.$set(data, key2, val);
                  } else {
                     if (!data[key2]) {
                        that.$set(data, key2, {});
                     }
                  }
                  data = data[key2];
               });
            });
         },
         async loadData() {
@@ -386,47 +419,37 @@
            await this.loadAttrList();
         },
         async loadAttrList() {
            try {
            var dataInfo = {
               class_id: this.param.clsId,
               class_name: this.param.clsName,
               group_name: ''
            };
            var $this = this;
               this.$data.attrList == await classAttrGetList(dataInfo) || []
            // console.log($this.$store.getters.getclassAttrList);
            $this.$store.state.thisareaFuncID = this.param.clsId;
            //获取
            if ($this.$store.getters.getclassAttrList) {
               $this.$data.attrList = $this.$store.getters.getclassAttrList;
            } else {
               $this.$store.dispatch('classAttrGetList', dataInfo).then(success => {
                  // console.log(success);
                  if (success.err_code == 0) {
                     $this.$data.attrList = success.result;
                  }
               }).catch(ex => {
            } catch (ex) {
               // console.log(ex);
               let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
                  uni.showModal({
                     title: this.translateSys('error') + " 1.1",
                     content: ex.errMsg,
                  title: this.translateSys("error") + "1.1",
                  content: tip,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  })
               })
                  confirmText: this.translateSys("cancel")
               });
            }
         },
         async DictItemGetList(attr, name) { //Mobox3得到字典项列表
            try {
            this.data = [];
            var $this = this;
            var dataInfo = {
               dict_id: undefined,
               dict_name: name
            };
            this.$store.dispatch('DictItemGetList', dataInfo).then(async (success) => {
               // console.log(success);
               if (success.err_code == 0) {
                  let dicList = success.result?.dict_item_list || [];
                  $this.dictList[attr.attr] = dicList;
               const result = await dictItemGetInfo(dataInfo)
               let dicList = result?.dict_item_list || [];
               this.dictList[attr.attr] = dicList;
                  let dictName = "";
                  if (dicList?.length > 0) {
@@ -442,70 +465,47 @@
                  }
                  this.form[attr.attr] = dictName;
               } else {
                  uni.showModal({
                     title: this.translateSys('error') + " 1.2",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               }
            }).catch(ex => {
               // console.log(ex);
            } catch (ex) {
               uni.showModal({
                  title: this.translateSys('error') + " 1.3",
                  content: ex.errMsg,
                  showCancel: false,
                  confirmText: this.translateSys('cancel')
               });
            });
               return []
            }
         },
         async loadStyleDef() {
            try {
            var $this = this;
            var gridstyleInfo = {};
            if (param.editDlg.id) {
               gridstyleInfo = {
                  class_id: $this.param.clsId,
                     class_id: this.param.clsId,
                  ui_style_id: this.param.editDlg.id,
               };
            } else {
               gridstyleInfo = {
                  class_id: $this.param.clsId,
                  ui_style_type: 2,
                  ui_style_name: $this.param.editDlg.name
                     ui_style_name: this.param.editDlg.name
               };
            }
            $this.$store.state.thisareaFuncID = this.param.clsId;
            $this.$store.state.thisEditName = $this.$data.param.editDlg.name
            // console.log($this.$store.getters.getclassGridStyleInfo);
            //获取
            if ($this.$store.getters.getclassGridStyleInfo) {
               $this.$data.style_def = $this.$store.getters.getclassGridStyleInfo;
            } 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);
                     $this.$data.style_def = JSON.parse(styledef);
                  } else {
               const result = await getUIStyleInfo(gridstyleInfo)
               var styledef = Base64.decode(result?.style_def);
               this.$data.style_def = JSON.parse(styledef);
            } catch (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",
                  title: this.translateSys('error') + " 1.5,
                     content: ex.errMsg,
                     showCancel: false,
                     confirmText: this.translateSys('cancel')
                  });
               });
               return []
            }
         },
@@ -1487,14 +1487,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) {
@@ -1537,14 +1534,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();
@@ -1608,10 +1598,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 :
                        data
@@ -1716,14 +1704,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({
@@ -1800,10 +1781,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 :
                        data
@@ -1926,14 +1905,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({
@@ -2024,10 +1996,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 :
                        data
@@ -2077,14 +2047,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({
@@ -2177,10 +2140,9 @@
            };
            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 :
                        data
@@ -2371,14 +2333,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({