Merge pull request #2062 from dataease/pr@dev@refactor-anvt-title

refactor: 增加antv视图title重复校验
This commit is contained in:
王嘉豪 2022-04-06 19:21:21 +08:00 committed by GitHub
commit e9c2b36604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,7 @@
<script> <script>
import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart' import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart'
import { checkTitle } from '@/api/chart/chart'
export default { export default {
name: 'TitleSelectorAntV', name: 'TitleSelectorAntV',
@ -107,10 +108,18 @@ export default {
this.titleForm.title = this.chart.title this.titleForm.title = this.chart.title
return return
} }
if (!this.titleForm.show) { checkTitle({ id: this.chart.id, title: this.titleForm.title, sceneId: this.chart.sceneId }).then((rsp) => {
this.isSetting = false if (rsp.data === 'success') {
} if (!this.titleForm.show) {
this.$emit('onTextChange', this.titleForm) this.isSetting = false
}
this.$emit('onTextChange', this.titleForm)
} else {
this.$error(this.$t('chart.title_repeat'))
this.titleForm.title = this.chart.title
return
}
})
}, },
inputOnInput: function(e) { inputOnInput: function(e) {
this.$forceUpdate() this.$forceUpdate()