refactor: 优化视图标题校验

This commit is contained in:
wangjiahao 2022-04-20 18:56:31 +08:00
parent 4ea6c83fa2
commit c164999209

View File

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