feat(frontend):数据集 视图 名称长度限制

This commit is contained in:
junjie 2021-05-18 13:55:00 +08:00
parent 4e7d0173fc
commit 08153b1f1d
7 changed files with 97 additions and 26 deletions

View File

@ -3,6 +3,7 @@ import request from '@/utils/request'
export function validateLic() {
return request({
url: '/anonymous/license/validate',
method: 'get'
method: 'get',
hideMsg: true
})
}

View File

@ -275,7 +275,8 @@ export default {
select_module: '选择模块',
default_module: '默认模块'
},
datasource: '数据连接'
datasource: '数据连接',
char_can_not_more_50: '名称不能超过50字符'
},
documentation: {
documentation: '文档',

View File

@ -262,12 +262,14 @@ export default {
},
groupFormRules: {
name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
]
},
tableFormRules: {
name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
]
},
selectTableFlag: false,
@ -366,11 +368,11 @@ export default {
this.groupTree(this.groupForm)
})
} else {
this.$message({
message: this.$t('commons.input_content'),
type: 'error',
showClose: true
})
// this.$message({
// message: this.$t('commons.input_content'),
// type: 'error',
// showClose: true
// })
return false
}
})
@ -392,11 +394,11 @@ export default {
this.$store.dispatch('chart/setTable', null)
})
} else {
this.$message({
message: this.$t('commons.input_content'),
type: 'error',
showClose: true
})
// this.$message({
// message: this.$t('commons.input_content'),
// type: 'error',
// showClose: true
// })
return false
}
})
@ -545,7 +547,7 @@ export default {
},
createChart() {
if (!this.table.name) {
if (!this.table.name || this.table.name === '') {
this.$message({
message: this.$t('chart.name_can_not_empty'),
type: 'error',
@ -553,6 +555,14 @@ export default {
})
return
}
if (this.table.name.length > 50) {
this.$message({
showClose: true,
message: this.$t('commons.char_can_not_more_50'),
type: 'error'
})
return
}
const view = {}
view.name = this.table.name
view.title = this.table.name

View File

@ -181,6 +181,22 @@ export default {
}
},
save() {
if (!this.name || this.name === '') {
this.$message({
showClose: true,
message: this.$t('dataset.pls_input_name'),
type: 'error'
})
return
}
if (this.name.length > 50) {
this.$message({
showClose: true,
message: this.$t('commons.char_can_not_more_50'),
type: 'error'
})
return
}
const table = {
id: this.param.tableId,
name: this.name,

View File

@ -158,6 +158,22 @@ export default {
save() {
// console.log(this.checkTableList);
// console.log(this.scene);
if (!this.name || this.name === '') {
this.$message({
showClose: true,
message: this.$t('dataset.pls_input_name'),
type: 'error'
})
return
}
if (this.name.length > 50) {
this.$message({
showClose: true,
message: this.$t('commons.char_can_not_more_50'),
type: 'error'
})
return
}
const table = {
id: this.param.tableId,
name: this.name,

View File

@ -245,6 +245,14 @@ export default {
})
return
}
if (this.name.length > 50) {
this.$message({
showClose: true,
message: this.$t('commons.char_can_not_more_50'),
type: 'error'
})
return
}
const table = {
id: this.param.tableId,
name: this.name,

View File

@ -86,6 +86,9 @@
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('rename',data,node)">
{{ $t('dataset.rename') }}
</el-dropdown-item>
<!-- <el-dropdown-item icon="el-icon-right" :command="beforeClickMore('move',data,node)">-->
<!-- {{$t('dataset.move_to')}}-->
<!-- </el-dropdown-item>-->
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('delete',data,node)">
{{ $t('dataset.delete') }}
</el-dropdown-item>
@ -147,6 +150,12 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button type="primary" size="mini" plain>
{{ $t('dataset.update') }}
</el-button>
<el-button type="primary" size="mini" plain>
{{ $t('dataset.process') }}
</el-button> -->
</el-row>
<el-row>
<el-form>
@ -198,6 +207,9 @@
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('editTable',data,node)">
{{ $t('dataset.rename') }}
</el-dropdown-item>
<!-- <el-dropdown-item icon="el-icon-right" :command="beforeClickMore('move',data,node)">-->
<!-- {{$t('dataset.move_to')}}-->
<!-- </el-dropdown-item>-->
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('deleteTable',data,node)">
{{ $t('dataset.delete') }}
</el-dropdown-item>
@ -213,6 +225,10 @@
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="tableForm.name" />
</el-form-item>
<!-- <el-form-item :label="$t('dataset.mode')" prop="mode">-->
<!-- <el-radio v-model="tableForm.mode" label="0">{{ $t('dataset.direct_connect') }}</el-radio>-->
<!-- <el-radio v-model="tableForm.mode" label="1">{{ $t('dataset.sync_data') }}</el-radio>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeTable()">{{ $t('dataset.cancel') }}</el-button>
@ -226,7 +242,7 @@
</template>
<script>
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, isKettleRunning } from '@/api/dataset/dataset'
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree } from '@/api/dataset/dataset'
export default {
name: 'Group',
@ -257,16 +273,14 @@ export default {
},
groupFormRules: {
name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
]
},
tableFormRules: {
name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
{ min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur' }
],
mode: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
]
}
}
@ -366,11 +380,11 @@ export default {
this.tree(this.groupForm)
})
} else {
this.$message({
message: this.$t('commons.input_content'),
type: 'error',
showClose: true
})
// this.$message({
// message: this.$t('commons.input_error'),
// type: 'error',
// showClose: true
// })
return false
}
})
@ -394,6 +408,11 @@ export default {
this.$store.dispatch('dataset/setTable', null)
})
} else {
// this.$message({
// message: this.$t('commons.input_content'),
// type: 'error',
// showClose: true
// })
return false
}
})