wangting
2024-11-15 6928489ffd5055f1b5a8b9e0432d36448bd8e4c1
修改action
已修改1个文件
77 ■■■■■ 文件已修改
Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-custom.vue 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-custom.vue
@@ -18,7 +18,9 @@
               :sourceData="sourceData"
               :dataStore="dataStore"
               :areasName="areasName"
               :paramVOS="urlParams"></component>
               :paramVOS="urlParams"
               @setData="setData"
               @setDataStore="setDataStore"></component>
  </div>
</template>
@@ -86,11 +88,10 @@
    }
  },
  watch: {
    sourceData: {
    sourceData:{
      handler(newval) {
        //源数据有变化时变更当前区域数据
        console.log(this.areasName);
        console.log(newval);
        this.sourceDataMap();
      },
      deep: true,
      immediate: true
@@ -98,40 +99,43 @@
  },
  computed: {},
  created() {
    this.customClass=this.componentVO.customClass;
    this.componentVO.customClass.split(';').forEach(item=>{
      if(item.indexOf('web=')==0){
        this.customClass=item.split('web=')[1];
      }
    })
    let urlParams = {};
    // 如果路径中存在 '?',则取问号前面部分给 parts
    if (this.customClass.includes('?')) {
      this.ComponentUrl = this.customClass.split("?")[0];
      urlParams = queryStringToObject(this.customClass);
    } else {
      this.ComponentUrl = this.customClass; // 不存在 '?' 整条路径就是 parts
    }
    if(validatenull(this.ComponentUrl) || ['ui', 'UI', 'base','bs'].includes(this.ComponentUrl)){
      this.ComponentUrl='views/base/UIContentViewerInDialog';
    }else if(this.ComponentUrl.indexOf('views/')===-1){
      this.ComponentUrl='views/custom-ui/'+this.ComponentUrl;
    }
    if (this.ComponentUrl=='base/UIContentViewerInDialog' && (!urlParams.type || !urlParams.context)) {
      this.isError = true;
      return;
    }
    this.btmType = urlParams.type;
    this.context = urlParams.context;
    this.urlParams = Object.assign({},this.paramVOS, urlParams)
    this.loadCompoent();
    this.sourceDataMap();
  },
  mounted() {
    //this.getHeight(this.$parent);
  },
  methods: {
    sourceDataMap: function () {
      this.customClass=this.componentVO.customClass;
      this.componentVO.customClass.split(';').forEach(item=>{
        if(item.indexOf('web=')==0){
          this.customClass=item.split('web=')[1];
        }
      })
      let urlParams = {};
      // 如果路径中存在 '?',则取问号前面部分给 parts
      if (this.customClass.includes('?')) {
        this.ComponentUrl = this.customClass.split("?")[0];
        urlParams = queryStringToObject(this.customClass);
      } else {
        this.ComponentUrl = this.customClass; // 不存在 '?' 整条路径就是 parts
      }
      if(validatenull(this.ComponentUrl) || ['ui', 'UI', 'base','bs'].includes(this.ComponentUrl)){
        this.ComponentUrl='views/base/UIContentViewerInDialog';
      }else if(this.ComponentUrl.indexOf('views/')===-1){
        this.ComponentUrl='views/custom-ui/'+this.ComponentUrl;
      }
      if (this.ComponentUrl=='base/UIContentViewerInDialog' && (!urlParams.type || !urlParams.context)) {
        this.isError = true;
        return;
      }
      this.btmType = urlParams.type;
      this.context = urlParams.context;
      this.urlParams = Object.assign({},this.paramVOS, urlParams)
      this.loadCompoent();
    },
    loadCompoent(){
      // 动态导入组件
      import(`@/${this.ComponentUrl}.vue`).then((module) => {
@@ -148,6 +152,13 @@
      } else {
        this.getHeight(el.$parent);
      }
    },
    setDataStore(value) {
      this.$emit("setDataStore", value);
      this.dataStore = value.dataStore;
    },
    setData(value) {
      this.$emit("setData", value);
    }
  }
}