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