mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
feat: 数据集
This commit is contained in:
parent
8ba0f91e7a
commit
2b909be521
@ -0,0 +1,27 @@
|
||||
package io.dataease.controller.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import io.dataease.service.dataset.DataSetGroupService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/20 8:29 下午
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("dataset/group")
|
||||
public class DataSetGroupController {
|
||||
@Resource
|
||||
private DataSetGroupService dataSetGroupService;
|
||||
|
||||
@PostMapping("/save")
|
||||
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
|
||||
return dataSetGroupService.save(datasetGroup);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package io.dataease.dto.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/20 8:17 下午
|
||||
*/
|
||||
@Data
|
||||
public class DataSetGroupDTO extends DatasetGroup {
|
||||
private String label;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package io.dataease.service.dataset;
|
||||
|
||||
import com.alibaba.nacos.common.util.UuidUtils;
|
||||
import io.dataease.base.domain.DatasetGroup;
|
||||
import io.dataease.base.mapper.DatasetGroupMapper;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/20 8:10 下午
|
||||
*/
|
||||
@Service
|
||||
public class DataSetGroupService {
|
||||
@Resource
|
||||
private DatasetGroupMapper datasetGroupMapper;
|
||||
|
||||
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
|
||||
if (StringUtils.isEmpty(datasetGroup.getId())) {
|
||||
datasetGroup.setId(UuidUtils.generateUuid());
|
||||
datasetGroup.setCreateTime(System.currentTimeMillis());
|
||||
datasetGroupMapper.insert(datasetGroup);
|
||||
} else {
|
||||
datasetGroupMapper.updateByPrimaryKey(datasetGroup);
|
||||
}
|
||||
DataSetGroupDTO dataSetGroupDTO = new DataSetGroupDTO();
|
||||
BeanUtils.copyBean(dataSetGroupDTO, datasetGroup);
|
||||
dataSetGroupDTO.setLabel(dataSetGroupDTO.getName());
|
||||
return dataSetGroupDTO;
|
||||
}
|
||||
}
|
@ -57,6 +57,18 @@
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<el-dialog :title="$t('dataset.group')" :visible="editGroup" :show-close="false">
|
||||
<el-form :model="groupForm" :rules="groupFormRules" ref="groupForm">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input v-model="groupForm.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="close()">{{$t('commons.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="saveGroup()">{{$t('commons.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
@ -100,9 +112,21 @@
|
||||
label: '二级 3-2'
|
||||
}]
|
||||
}];
|
||||
|
||||
return {
|
||||
search: '',
|
||||
data: JSON.parse(JSON.stringify(data))
|
||||
editGroup: false,
|
||||
data: JSON.parse(JSON.stringify(data)),
|
||||
groupForm: {
|
||||
name: '',
|
||||
pid: null,
|
||||
level: 0
|
||||
},
|
||||
groupFormRules: {
|
||||
name: [
|
||||
{required: true, message: this.$t('commons.input_content'), trigger: 'blur'},
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -113,12 +137,36 @@
|
||||
},
|
||||
methods: {
|
||||
addGroup() {
|
||||
this.$message(
|
||||
{
|
||||
message: '添加分组',
|
||||
type: 'success'
|
||||
this.editGroup = true;
|
||||
|
||||
},
|
||||
|
||||
saveGroup() {
|
||||
console.log(this.groupForm);
|
||||
this.$refs['groupForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$post("/dataset/group/save", this.groupForm, response => {
|
||||
this.close();
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true,
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
message: this.$t('commons.input_content'),
|
||||
type: 'error',
|
||||
showClose: true,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
close() {
|
||||
this.editGroup = false;
|
||||
this.$refs['groupForm'].resetFields();
|
||||
},
|
||||
|
||||
addScene() {
|
||||
@ -130,7 +178,7 @@
|
||||
)
|
||||
},
|
||||
|
||||
nodeClick(data,node){
|
||||
nodeClick(data, node) {
|
||||
console.log(data);
|
||||
console.log(node);
|
||||
},
|
||||
|
@ -1522,6 +1522,7 @@ export default {
|
||||
dataset:{
|
||||
datalist:'Data List',
|
||||
add_group:'Add Group',
|
||||
add_scene:'Add Scene'
|
||||
add_scene:'Add Scene',
|
||||
group:'DataSet Group'
|
||||
}
|
||||
};
|
||||
|
@ -1525,6 +1525,7 @@ export default {
|
||||
dataset:{
|
||||
datalist:'数据列表',
|
||||
add_group:'添加分组',
|
||||
add_scene:'添加场景'
|
||||
add_scene:'添加场景',
|
||||
group:'分组'
|
||||
}
|
||||
};
|
||||
|
@ -1523,6 +1523,7 @@ export default {
|
||||
dataset:{
|
||||
datalist:'數據列表',
|
||||
add_group:'添加分組',
|
||||
add_scene:'添加場景'
|
||||
add_scene:'添加場景',
|
||||
group:'分組'
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user