| | |
| | | <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" |
| | |
| | | |
| | | <script> |
| | | import {queryStringToObject} from '@/util/util' |
| | | import {validatenull} from "@/util/validate"; |
| | | export default { |
| | | name: "dynamic-custom", |
| | | components: { |
| | |
| | | content: '', |
| | | urlParams: {}, |
| | | height: '300px', |
| | | customClass: this.componentVO.customClass, //bs=?type=xxx&context=yyy¶m=zzz 或者 bs=组件name?type=xxx&context=yyy¶m=zzz |
| | | customClass: '', //?type=xxx&context=yyy¶m=zzz 或者 组件name?type=xxx&context=yyy¶m=zzz |
| | | isError: false, //路径解析失败 |
| | | currentComponent: 'UI',//组件name |
| | | } |
| | |
| | | |
| | | }, |
| | | 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); |