fix: 数据集重命名

This commit is contained in:
taojinlong 2021-08-30 15:47:39 +08:00
parent 74a140931f
commit 7dfe9ccf34
4 changed files with 25 additions and 11 deletions

View File

@ -46,6 +46,12 @@ public class DataSetTableController {
}
}
@ApiOperation("重命名")
@PostMapping("rename")
public void rename(@RequestBody DataSetTableRequest request) throws Exception {
dataSetTableService.rename(request);
}
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) throws Exception {

View File

@ -251,6 +251,14 @@ public class DataSetTableService {
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 {
DatasetTable table = datasetTableMapper.selectByPrimaryKey(id);
datasetTableMapper.deleteByPrimaryKey(id);

View File

@ -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) {
return request({
url: '/dataset/table/delete/' + tableId,

View File

@ -341,7 +341,7 @@
</template>
<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 DsMoveSelector from './DsMoveSelector'
@ -551,30 +551,21 @@ export default {
},
saveTable(table) {
// console.log(table)
table.mode = parseInt(table.mode)
this.$refs['tableForm'].validate((valid) => {
if (valid) {
table.isRename = true
addTable(table).then(response => {
rename(table).then(response => {
this.closeTable()
this.$message({
message: this.$t('dataset.save_success'),
type: 'success',
showClose: true
})
// this.tableTree()
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())
})
} else {
// this.$message({
// message: this.$t('commons.input_content'),
// type: 'error',
// showClose: true
// })
return false
}
})