NEZ-2336 fix:Rcord rules复制规则保存时提示name格式错误

This commit is contained in:
zhangyu
2022-10-31 17:49:48 +08:00
parent a90a94e095
commit 6deaa0b961
4 changed files with 21 additions and 7 deletions

View File

@@ -55,7 +55,7 @@
:multipleTime="multipleTime"
:isFullscreen="isFullscreen"
:showAllData="showAllData"
v-if="!isGroup(chartInfo.type) || !chartInfo.param.collapse"
v-if="(!isGroup(chartInfo.type) || !chartInfo.param.collapse) && snapshotShow"
></chart>
</div>
</template>
@@ -118,7 +118,8 @@ export default {
allDataLength: 0,
severityData: this.$store.getters.severityData, // 告警级别的数据
severityDataWeight: this.$store.getters.severityDataWeight,
myVariables: [] // 添加当前使用的变量 用于判断是否需要重新加载
myVariables: [], // 添加当前使用的变量 用于判断是否需要重新加载
snapshotShow: true
// isExportData: false
}
},
@@ -159,7 +160,7 @@ export default {
if (!this.variablesInit) { // 变量未加载完成 不请求数据
return
}
this.chartData = []
this.chartData = window.dataJson ? this.chartData : []
this.myVariables = []
this.loading = true
// TODO assetInfo、endpointInfo、echarts等进行不同的处理
@@ -758,6 +759,9 @@ export default {
deep: true,
handler (n) {
// console.log(n)
if (window.dataJson && this.loading) {
this.loading = false
}
}
},
variablesArr: {
@@ -778,8 +782,17 @@ export default {
}
}
},
created () {
if (window.dataJson) {
this.snapshotShow = false
this.getChartData()
}
},
mounted () {
this.chartInfo.loaded && this.getChartData()
setTimeout(() => {
this.snapshotShow = true
})
this.showAllData = !this.showMultiple(this.chartInfo.type)
}
}

View File

@@ -232,8 +232,9 @@ export default {
}
})
},
copy (u) {
this.object = { ...u, name: u.name + '-copy', id: '' }
copy (u, copyParams) {
const copyName = this.$loadsh.get(copyParams, 'copyName', '-copy')
this.object = { ...u, name: u.name + copyName, id: '' }
if (this.object.name.length > 64) {
const length = this.object.name.length - 64
this.object.name = u.name.substring(0, u.name.length - length) + '-copy'

View File

@@ -159,7 +159,7 @@ export default {
rules: {
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' },
{ pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: this.$t('overall.ASCIIKey'), trigger: 'change' }
{ pattern: /^[a-zA-Z_:][a-zA-Z0-9_:]*$/, message: this.$t('overall.ASCIIKey'), trigger: 'change' }
],
type: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }

View File

@@ -115,7 +115,7 @@
</div>
<el-dropdown-menu slot="dropdown" class="right-box-select-top right-public-box-dropdown-top">
<el-dropdown-item v-if="!scope.row.buildIn" v-has="'record_rule_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
<el-dropdown-item v-if="!scope.row.buildIn" v-has="'record_rule_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
<el-dropdown-item v-if="!scope.row.buildIn" v-has="'record_rule_edit'" :command="['copy', scope.row, {copyName: '_copy'}]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
<!-- <el-dropdown-item v-if="!scope.row.buildIn" v-has="'record_rule_delete'" :command="['delete', scope.row]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item> -->
<el-dropdown-item v-if="!scope.row.buildIn" v-has="'record_rule_delete'" :command="['delete', scope.row]">
<delete-button