feat(数据集):编辑excel前端

This commit is contained in:
junjie 2021-06-08 11:30:26 +08:00
parent 0195edea45
commit c839b3cba4
5 changed files with 32 additions and 17 deletions

View File

@ -25,12 +25,12 @@ public class DataSetTableController {
private DataSetTableService dataSetTableService;
@PostMapping("batchAdd")
public void batchAdd(@RequestBody List<DatasetTable> datasetTable) throws Exception {
public void batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
dataSetTableService.batchInsert(datasetTable);
}
@PostMapping("update")
public DatasetTable save(@RequestBody DatasetTable datasetTable) throws Exception {
public DatasetTable save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
return dataSetTableService.save(datasetTable);
}

View File

@ -18,4 +18,6 @@ public class DataSetTableRequest extends DatasetTable {
private String row = "1000";
private String userId;
private Integer editType;
}

View File

@ -84,13 +84,13 @@ public class DataSetTableService {
@Value("${upload.file.path}")
private String path;
public void batchInsert(List<DatasetTable> datasetTable) throws Exception {
for (DatasetTable table : datasetTable) {
public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
for (DataSetTableRequest table : datasetTable) {
save(table);
}
}
public DatasetTable save(DatasetTable datasetTable) throws Exception {
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
checkName(datasetTable);
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();

View File

@ -20,7 +20,7 @@
<el-col style="width: 500px;">
<el-form :inline="true" size="mini" class="row-style">
<el-form-item class="form-item">
<el-input v-model="name" :disabled="!!param.tableId" :placeholder="$t('commons.name')" />
<el-input v-show="!param.tableId" v-model="name" :placeholder="$t('commons.name')" />
</el-form-item>
<el-form-item class="form-item">
<el-upload
@ -176,15 +176,28 @@ export default {
})
return
}
const table = {
id: this.param.tableId,
name: this.name,
sceneId: this.param.id,
dataSourceId: null,
type: 'excel',
mode: parseInt(this.mode),
info: '{"data":"' + this.path + '"}',
editType: this.param.editType ? this.param.editType : 0
let table = {}
if (!this.param.tableId) {
table = {
id: this.param.tableId,
name: this.name,
sceneId: this.param.id,
dataSourceId: null,
type: 'excel',
mode: parseInt(this.mode),
info: '{"data":"' + this.path + '"}'
}
} else {
table = {
id: this.param.tableId,
name: this.param.table.name,
sceneId: this.param.id,
dataSourceId: null,
type: 'excel',
mode: parseInt(this.mode),
info: '{"data":"' + this.path + '"}',
editType: this.param.editType ? this.param.editType : 0
}
}
post('/dataset/table/update', table).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime())

View File

@ -166,10 +166,10 @@ export default {
// console.log(param);
switch (param.type) {
case '0':
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 0 }})
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 0, table: this.table }})
break
case '1':
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 1 }})
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 1, table: this.table }})
break
}
},