feat(数据集):flyway fix;excel数据集创建

This commit is contained in:
junjie 2021-04-20 11:48:38 +08:00
parent 3c17fc57c0
commit 5f402b35df
5 changed files with 22 additions and 28 deletions

View File

@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `dataset_table`
`id` varchar(50) NOT NULL COMMENT 'ID',
`name` varchar(64) NOT NULL COMMENT '表名称',
`scene_id` varchar(50) NOT NULL COMMENT '场景ID',
`data_source_id` varchar(50) NOT NULL COMMENT '数据源ID',
`data_source_id` varchar(50) COMMENT '数据源ID',
`type` varchar(50) COMMENT 'db,sql,excel,custom',
`mode` int(10) DEFAULT 0 COMMENT '连接模式0-直连1-定时同步',
`info` longtext COMMENT '表原始信息',

View File

@ -9,7 +9,7 @@
<el-button size="mini" @click="cancel">
{{ $t('dataset.cancel') }}
</el-button>
<el-button :disabled="!form.name || fileList.length === 0" size="mini" type="primary" @click="save">
<el-button :disabled="!name || fileList.length === 0" size="mini" type="primary" @click="save">
{{ $t('dataset.confirm') }}
</el-button>
</el-row>
@ -18,9 +18,9 @@
<el-row>
<el-row>
<el-col style="width: 500px;">
<el-form :model="form" :inline="true" size="mini" class="row-style">
<el-form :inline="true" size="mini" class="row-style">
<el-form-item>
<el-input v-model="form.name" :placeholder="$t('commons.name')" />
<el-input v-model="name" :placeholder="$t('commons.name')" />
</el-form-item>
<el-form-item>
<el-upload
@ -88,9 +88,7 @@ export default {
},
data() {
return {
form: {
name: ''
},
name: '',
fields: [],
data: [],
mode: '1',
@ -130,9 +128,9 @@ export default {
// })
// },
uploadSuccess(response, file, fileList) {
console.log(response)
console.log(file)
console.log(fileList)
// console.log(response)
// console.log(file)
// console.log(fileList)
this.fields = response.data.fields
this.data = response.data.data
@ -140,7 +138,7 @@ export default {
this.$refs.plxTable.reloadData(datas)
if (file.name.lastIndexOf('.') > 0) {
this.form.name = file.name.substring(0, file.name.lastIndexOf('.'))
this.name = file.name.substring(0, file.name.lastIndexOf('.'))
}
this.fileList = fileList
},
@ -148,20 +146,16 @@ export default {
save() {
// console.log(this.checkTableList);
// console.log(this.scene);
const sceneId = this.param.id
const dataSourceId = this.dataSource
const tables = []
const mode = this.mode
this.checkTableList.forEach(function(name) {
tables.push({
name: name,
sceneId: sceneId,
dataSourceId: dataSourceId,
type: 'excel',
mode: parseInt(mode)
})
})
post('/dataset/table/batchAdd', tables).then(response => {
const table = {
id: this.param.tableId,
name: this.name,
sceneId: this.param.id,
dataSourceId: null,
type: 'excel',
mode: parseInt(this.mode),
info: '{"data":"' + '123' + '"}'
}
post('/dataset/table/update', table).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
this.cancel()
})

View File

@ -89,7 +89,7 @@
<svg-icon v-if="data.type === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
<svg-icon v-if="data.type === 'custom'" icon-class="ds-custom" class="ds-icon-custom" />
</span>
<span>
<span v-if="data.type === 'db' || data.type === 'sql'">
<span v-if="data.mode === 0" style="margin-left: 6px"><i class="el-icon-s-operation" /></span>
<span v-if="data.mode === 1" style="margin-left: 6px"><i class="el-icon-alarm-clock" /></span>
</span>

View File

@ -36,7 +36,7 @@
<el-tab-pane :label="$t('dataset.join_view')" name="joinView">
关联视图 TODO
</el-tab-pane>
<el-tab-pane v-if="table.mode === 1" :label="$t('dataset.update_info')" name="updateInfo">
<el-tab-pane v-if="table.mode === 1 && (table.type === 'db' || table.type === 'sql')" :label="$t('dataset.update_info')" name="updateInfo">
<update-info :table="table" />
</el-tab-pane>
</el-tabs>

View File

@ -186,7 +186,7 @@
<svg-icon v-if="data.type === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
<svg-icon v-if="data.type === 'custom'" icon-class="ds-custom" class="ds-icon-custom" />
</span>
<span>
<span v-if="data.type === 'db' || data.type === 'sql'">
<span v-if="data.mode === 0" style="margin-left: 6px"><i class="el-icon-s-operation" /></span>
<span v-if="data.mode === 1" style="margin-left: 6px"><i class="el-icon-alarm-clock" /></span>
</span>