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', `id` varchar(50) NOT NULL COMMENT 'ID',
`name` varchar(64) NOT NULL COMMENT '表名称', `name` varchar(64) NOT NULL COMMENT '表名称',
`scene_id` varchar(50) NOT NULL COMMENT '场景ID', `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', `type` varchar(50) COMMENT 'db,sql,excel,custom',
`mode` int(10) DEFAULT 0 COMMENT '连接模式0-直连1-定时同步', `mode` int(10) DEFAULT 0 COMMENT '连接模式0-直连1-定时同步',
`info` longtext COMMENT '表原始信息', `info` longtext COMMENT '表原始信息',

View File

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

View File

@ -36,7 +36,7 @@
<el-tab-pane :label="$t('dataset.join_view')" name="joinView"> <el-tab-pane :label="$t('dataset.join_view')" name="joinView">
关联视图 TODO 关联视图 TODO
</el-tab-pane> </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" /> <update-info :table="table" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </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 === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
<svg-icon v-if="data.type === 'custom'" icon-class="ds-custom" class="ds-icon-custom" /> <svg-icon v-if="data.type === 'custom'" icon-class="ds-custom" class="ds-icon-custom" />
</span> </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 === 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 v-if="data.mode === 1" style="margin-left: 6px"><i class="el-icon-alarm-clock" /></span>
</span> </span>