提交 c839b3cb authored 作者: junjie's avatar junjie

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

上级 0195edea
...@@ -25,12 +25,12 @@ public class DataSetTableController { ...@@ -25,12 +25,12 @@ public class DataSetTableController {
private DataSetTableService dataSetTableService; private DataSetTableService dataSetTableService;
@PostMapping("batchAdd") @PostMapping("batchAdd")
public void batchAdd(@RequestBody List<DatasetTable> datasetTable) throws Exception { public void batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
dataSetTableService.batchInsert(datasetTable); dataSetTableService.batchInsert(datasetTable);
} }
@PostMapping("update") @PostMapping("update")
public DatasetTable save(@RequestBody DatasetTable datasetTable) throws Exception { public DatasetTable save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
return dataSetTableService.save(datasetTable); return dataSetTableService.save(datasetTable);
} }
......
...@@ -18,4 +18,6 @@ public class DataSetTableRequest extends DatasetTable { ...@@ -18,4 +18,6 @@ public class DataSetTableRequest extends DatasetTable {
private String row = "1000"; private String row = "1000";
private String userId; private String userId;
private Integer editType;
} }
...@@ -84,13 +84,13 @@ public class DataSetTableService { ...@@ -84,13 +84,13 @@ public class DataSetTableService {
@Value("${upload.file.path}") @Value("${upload.file.path}")
private String path; private String path;
public void batchInsert(List<DatasetTable> datasetTable) throws Exception { public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
for (DatasetTable table : datasetTable) { for (DataSetTableRequest table : datasetTable) {
save(table); save(table);
} }
} }
public DatasetTable save(DatasetTable datasetTable) throws Exception { public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
checkName(datasetTable); checkName(datasetTable);
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) { if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest(); DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-col style="width: 500px;"> <el-col style="width: 500px;">
<el-form :inline="true" size="mini" class="row-style"> <el-form :inline="true" size="mini" class="row-style">
<el-form-item class="form-item"> <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>
<el-form-item class="form-item"> <el-form-item class="form-item">
<el-upload <el-upload
...@@ -176,15 +176,28 @@ export default { ...@@ -176,15 +176,28 @@ export default {
}) })
return return
} }
const table = { let table = {}
id: this.param.tableId, if (!this.param.tableId) {
name: this.name, table = {
sceneId: this.param.id, id: this.param.tableId,
dataSourceId: null, name: this.name,
type: 'excel', sceneId: this.param.id,
mode: parseInt(this.mode), dataSourceId: null,
info: '{"data":"' + this.path + '"}', type: 'excel',
editType: this.param.editType ? this.param.editType : 0 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 => { post('/dataset/table/update', table).then(response => {
this.$store.dispatch('dataset/setSceneData', new Date().getTime()) this.$store.dispatch('dataset/setSceneData', new Date().getTime())
......
...@@ -166,10 +166,10 @@ export default { ...@@ -166,10 +166,10 @@ export default {
// console.log(param); // console.log(param);
switch (param.type) { switch (param.type) {
case '0': 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 break
case '1': 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 break
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论