NEZ-2059 fix:panel 变量 未完全渲染
This commit is contained in:
@@ -546,22 +546,22 @@ export default {
|
|||||||
},
|
},
|
||||||
variablesReplace (expression) {
|
variablesReplace (expression) {
|
||||||
let str = expression
|
let str = expression
|
||||||
let confirmReg = ''
|
let confirmReg = []
|
||||||
let confirmRegItem = ''
|
|
||||||
this.variablesArr.forEach(item => {
|
this.variablesArr.forEach(item => {
|
||||||
const reg = '$' + item.name // 后续需要考虑 item,name 使用特殊字符的问题
|
const reg = '$' + item.name // 后续需要考虑 item,name 使用特殊字符的问题
|
||||||
const index = expression.indexOf(reg)
|
const index = expression.indexOf(reg)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
if (reg.length > confirmReg.length) {
|
confirmReg.push(item)
|
||||||
confirmReg = reg
|
|
||||||
confirmRegItem = item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (confirmReg) {
|
confirmReg = this.$loadsh.sortBy(confirmReg, function (item) { // 根据 匹配的name的长度排序 避免匹配的 $a 没匹配 $asset的问题
|
||||||
const index = expression.indexOf(confirmReg)
|
return item.name.length
|
||||||
const replaceStr = confirmRegItem.checked.map(label => label.replace(/\"/g, '\\"').replace(/\'/g, "\\'")).join('|')
|
})
|
||||||
str = str.substring(0, index) + replaceStr + str.substring(index + confirmReg.length)
|
if (confirmReg.length) {
|
||||||
|
confirmReg.forEach(item => {
|
||||||
|
const reg = new RegExp('\\$' + item.name, 'g') // 后续需要考虑 item,name 使用特殊字符的问题
|
||||||
|
str = str.replace(reg, item.checked.map(label => label.replace(/\"/g, '\\"').replace(/\'/g, "\\'")).join('|'))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return str
|
return str
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- visibility -->
|
<!-- visibility -->
|
||||||
<div>
|
<div v-if="params.type === 'group'">
|
||||||
<div class="form__sub-title">
|
<div class="form__sub-title">
|
||||||
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
|
|||||||
@@ -680,7 +680,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- visibility -->
|
<!-- visibility -->
|
||||||
<div>
|
<div v-if="params.type === 'group'">
|
||||||
<div class="form__sub-title">
|
<div class="form__sub-title">
|
||||||
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
|
|||||||
Reference in New Issue
Block a user