wangting
2024-04-10 d1d59913384ce70d30ae9f98b4c79a976611e9ad
路径解析
已修改3个文件
43 ■■■■■ 文件已修改
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/views/base/UIContentViewer.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
@@ -2,11 +2,12 @@
  <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid">
    <el-alert
      class="alert"
      :closable="false"
      v-if="isError"
      title="自定义组件配置信息错误!"
      type="error"
      show-icon
      description="这个自定义页面的地址格式不正确。推荐使用bs=组件name?type=xxx&context=yyy&pparam=zzz这种形式">
      description="这个自定义页面的地址格式不正确。推荐使用“组件name?param=xxx”(自定义组件)或者“?type=xxx&context=yyy&pparam=zzz”(UI引擎)这2种形式">
    </el-alert>
    <component v-else :is="currentComponent"
               :btmType="btmType"
@@ -23,6 +24,7 @@
<script>
import {queryStringToObject} from '@/util/util'
import {validatenull} from "@/util/validate";
export default {
  name: "dynamic-custom",
  components: {
@@ -69,7 +71,7 @@
      content: '',
      urlParams: {},
      height: '300px',
      customClass: this.componentVO.customClass, //bs=?type=xxx&context=yyy&param=zzz  或者 bs=组件name?type=xxx&context=yyy&param=zzz
      customClass: '', //?type=xxx&context=yyy&param=zzz  或者 组件name?type=xxx&context=yyy&param=zzz
      isError: false, //路径解析失败
      currentComponent: 'UI',//组件name
    }
@@ -88,24 +90,31 @@
  },
  mounted() {
    if (this.customClass.indexOf("bs=") < 0) {
    this.componentVO.customClass.split(';').forEach(item=>{
      if(item.indexOf('web=')==0){
        this.customClass=item.split('web=')[1];
      }
    })
    // 如果路径中存在 '?',则取问号前面部分给 parts
    if (this.customClass.includes('?')) {
      this.currentComponent = this.customClass.split("?")[0];
    } else {
      this.currentComponent = this.customClass; // 不存在 '?' 整条路径就是 parts
    }
    if(validatenull(this.currentComponent)){
      this.currentComponent='UI';
    }
    if (['UI', 'ui'].includes(this.currentComponent) && (this.customClass.indexOf("type=") < 0 || this.customClass.indexOf("context=") < 0)) {
      this.isError = true;
      return;
    }
    this.customClass = this.componentVO.customClass.split("bs=")[1];
    if (this.customClass.indexOf("?") < 0 || this.customClass.indexOf("type=") < 0 || this.customClass.indexOf("context=") < 0) {
      this.isError = true;
      return;
    let urlParams = {};
    if(this.customClass.includes('?')) {
      urlParams = queryStringToObject(this.customClass);
    }
    if (this.customClass.split('?')[0] != '' && this.customClass.split('?')[0] != 'UI' && this.customClass.split('?')[0] != 'ui') {
      this.currentComponent = this.customClass.split('?')[0];
    }
    let urlParams = queryStringToObject(this.customClass);
    let btmType = urlParams.type;
    let content = urlParams.context;
    this.btmType = btmType;
    this.content = content;
    this.btmType = urlParams.type;
    this.content = urlParams.context;
    this.urlParams = Object.assign(this.paramVOS, urlParams)
    //this.getHeight(this.$parent);
Source/ProjectWeb/src/views/base/UIContentViewer.vue
@@ -90,7 +90,7 @@
  },
  created() {
    if (verifyNull(this.$route.query.type) || (verifyNull(this.$route.query.context) && verifyNull(this.$route.query.content))) {
      this.$message.error("配置的信息错误,请参考bs=组件name?type=xxx&context=yyy&param=zzz这种形式。其中type是业务类型(或链接类型),context是UI上下文的名称");
      this.$message.error("配置的信息错误,请参考“?type=xxx&context=yyy&param=zzz”这种形式。其中type是业务类型(或链接类型),context是UI上下文的名称");
      return false;
    }
    this.getTheParameters()
Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
@@ -115,7 +115,7 @@
  },
  created() {
    if (verifyNull(this.btmType) || verifyNull(this.content) ) {
      this.$message.error("自定义组件配置的信息错误,请参考bs=name?type=xxx&context=yyy&param=zzz这种形式。其中type是业务类型(或链接类型),context是UI上下文的名称,name为组件名称,空值时默认展示UI引擎");
      this.$message.error("自定义组件配置的信息错误,请参考”?type=xxx&context=yyy&param=zzz“这种形式。其中type是业务类型(或链接类型),context是UI上下文的名称");
      return false;
    }
  },