提交 7dfe9ccf authored 作者: taojinlong's avatar taojinlong

fix: 数据集重命名

上级 74a14093
...@@ -46,6 +46,12 @@ public class DataSetTableController { ...@@ -46,6 +46,12 @@ public class DataSetTableController {
} }
} }
@ApiOperation("重命名")
@PostMapping("rename")
public void rename(@RequestBody DataSetTableRequest request) throws Exception {
dataSetTableService.rename(request);
}
@ApiOperation("删除") @ApiOperation("删除")
@PostMapping("delete/{id}") @PostMapping("delete/{id}")
public void delete(@PathVariable String id) throws Exception { public void delete(@PathVariable String id) throws Exception {
......
...@@ -251,6 +251,14 @@ public class DataSetTableService { ...@@ -251,6 +251,14 @@ public class DataSetTableService {
return datasetTable; return datasetTable;
} }
public void rename(DataSetTableRequest request)throws Exception {
checkName(request);
DatasetTable datasetTable = new DatasetTable();
datasetTable.setId(request.getId());
datasetTable.setName(request.getName());
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
}
public void delete(String id) throws Exception { public void delete(String id) throws Exception {
DatasetTable table = datasetTableMapper.selectByPrimaryKey(id); DatasetTable table = datasetTableMapper.selectByPrimaryKey(id);
datasetTableMapper.deleteByPrimaryKey(id); datasetTableMapper.deleteByPrimaryKey(id);
......
...@@ -43,6 +43,15 @@ export function addTable(data) { ...@@ -43,6 +43,15 @@ export function addTable(data) {
}) })
} }
export function rename(data) {
return request({
url: '/dataset/table/rename',
method: 'post',
loading: true,
data
})
}
export function delTable(tableId) { export function delTable(tableId) {
return request({ return request({
url: '/dataset/table/delete/' + tableId, url: '/dataset/table/delete/' + tableId,
......
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
</template> </template>
<script> <script>
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, post, isKettleRunning} from '@/api/dataset/dataset' import { loadTable, getScene, addGroup, delGroup, addTable, delTable, post, isKettleRunning, rename} from '@/api/dataset/dataset'
import GroupMoveSelector from './GroupMoveSelector' import GroupMoveSelector from './GroupMoveSelector'
import DsMoveSelector from './DsMoveSelector' import DsMoveSelector from './DsMoveSelector'
...@@ -551,30 +551,21 @@ export default { ...@@ -551,30 +551,21 @@ export default {
}, },
saveTable(table) { saveTable(table) {
// console.log(table)
table.mode = parseInt(table.mode) table.mode = parseInt(table.mode)
this.$refs['tableForm'].validate((valid) => { this.$refs['tableForm'].validate((valid) => {
if (valid) { if (valid) {
table.isRename = true table.isRename = true
addTable(table).then(response => { rename(table).then(response => {
this.closeTable() this.closeTable()
this.$message({ this.$message({
message: this.$t('dataset.save_success'), message: this.$t('dataset.save_success'),
type: 'success', type: 'success',
showClose: true showClose: true
}) })
// this.tableTree()
this.refreshNodeBy(table.sceneId) this.refreshNodeBy(table.sceneId)
// this.$router.push('/dataset/home')
// this.$emit('switchComponent', { name: 'ViewTable', param: table.id })
this.$store.dispatch('dataset/setTable', new Date().getTime()) this.$store.dispatch('dataset/setTable', new Date().getTime())
}) })
} else { } else {
// this.$message({
// message: this.$t('commons.input_content'),
// type: 'error',
// showClose: true
// })
return false return false
} }
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论