mirror of
https://gitee.com/anji-plus/report.git
synced 2026-02-02 09:27:47 +08:00
数据集复制功能实现
This commit is contained in:
@@ -26,6 +26,8 @@ import com.anjiplus.template.gaea.business.modules.datasettransform.service.Data
|
||||
import com.anjiplus.template.gaea.business.modules.datasource.controller.dto.DataSourceDto;
|
||||
import com.anjiplus.template.gaea.business.modules.datasource.dao.entity.DataSource;
|
||||
import com.anjiplus.template.gaea.business.modules.datasource.service.DataSourceService;
|
||||
import com.anjiplus.template.gaea.business.modules.report.controller.dto.ReportDto;
|
||||
import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report;
|
||||
import com.anjiplus.template.gaea.business.util.JdbcConstants;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -388,11 +390,11 @@ public class DataSetServiceImpl implements DataSetService {
|
||||
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(dto.getSetCode())) {
|
||||
throw BusinessExceptionBuilder.build(ResponseCode.NOT_NULL, "数据集编码");
|
||||
}
|
||||
String setCode = dto.getSetCode();
|
||||
DataSet ds = new DataSet();
|
||||
GaeaBeanUtils.copyAndFormatter(ds,dto);
|
||||
insert(ds);
|
||||
String copySetCode = ds.getSetCode();
|
||||
DataSet dataSet = selectOne(dto.getId());
|
||||
String setCode = dataSet.getSetCode();
|
||||
DataSet dateSetCopy = copyDataSet(dataSet, dto);
|
||||
insert(dateSetCopy);
|
||||
String copySetCode = dateSetCopy.getSetCode();
|
||||
DataSetParam dataSetParam = dataSetParamService.selectOne("set_code", setCode);
|
||||
if (null != dataSetParam){
|
||||
dataSetParam.setId(null);
|
||||
@@ -465,4 +467,14 @@ public class DataSetServiceImpl implements DataSetService {
|
||||
return map;
|
||||
}
|
||||
|
||||
private DataSet copyDataSet(DataSet dataSet, DataSetDto dto){
|
||||
//复制主表数据
|
||||
DataSet copyDataSet = new DataSet();
|
||||
GaeaBeanUtils.copyAndFormatter(dataSet, copyDataSet);
|
||||
copyDataSet.setSetCode(dto.getSetCode());
|
||||
copyDataSet.setSetName(dto.getSetName());
|
||||
copyDataSet.setId(null);
|
||||
return copyDataSet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
-- 分享表增加report_name
|
||||
ALTER TABLE `aj_report`.`gaea_report_share` ADD `report_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '名称' AFTER `report_code`;
|
||||
ALTER TABLE `gaea_report_share` ADD `report_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '名称' AFTER `report_code`;
|
||||
|
||||
-- 更新report_name
|
||||
UPDATE `aj_report`.`gaea_report_share` t1
|
||||
UPDATE `gaea_report_share` t1
|
||||
INNER JOIN `aj_report`.`gaea_report` t2 on t1.report_code=t2.report_code
|
||||
SET t1.report_name=t2.report_name;
|
||||
SET t1.report_name=t2.report_name;
|
||||
|
||||
-- 数据集复制
|
||||
INSERT INTO `access_authority`(`parent_target`, `target`, `target_name`, `action`, `action_name`, `sort`, `enable_flag`, `delete_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `version`)
|
||||
VALUES
|
||||
('report', 'resultsetManage', '数据集管理', 'copy', '数据集复制', 204, 1, 0, 'admin', '2019-07-23 15:59:40', 'admin', '2019-07-23 15:59:40', 1);
|
||||
|
||||
-- root用户赋权
|
||||
INSERT INTO `access_role_authority`(`role_code`, `target`, `action`)
|
||||
VALUES
|
||||
('root', 'resultsetManage', 'copy');
|
||||
|
||||
@@ -39,4 +39,12 @@ export function reportDataSetDetail(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function reportDataSetCopy(data) {
|
||||
return request({
|
||||
url: '/dataSet/copy',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { reportDataSetList, reportDataSetAdd, reportDataSetDeleteBatch, reportDataSetUpdate, reportDataSetDetail }
|
||||
|
||||
83
report-ui/src/views/resultset/components/copyDialog.vue
Normal file
83
report-ui/src/views/resultset/components/copyDialog.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version:
|
||||
* @Author: qianlishi
|
||||
* @Date: 2022-05-17 16:55:05
|
||||
* @LastEditors: qianlishi
|
||||
* @LastEditTime: 2022-05-17 17:38:54
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
class="tree_dialog"
|
||||
title="数据集--复制"
|
||||
width="30%"
|
||||
:close-on-click-modal="false"
|
||||
center
|
||||
:visible.sync="visib"
|
||||
:before-close="close"
|
||||
>
|
||||
<el-form
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
ref="ruleForm"
|
||||
label-width="100px"
|
||||
class="demo-ruleForm"
|
||||
>
|
||||
<el-form-item label="数据集名称" prop="setName">
|
||||
<el-input v-model="form.setName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据集编码" prop="setCode">
|
||||
<el-input v-model="form.setCode" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" style="text-align: center">
|
||||
<el-button type="danger" plain @click="close">取消</el-button>
|
||||
<el-button type="primary" plain @click="save">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {reportDataSetCopy} from "@/api/reportDataSet"
|
||||
export default {
|
||||
props: {
|
||||
visib: Boolean,
|
||||
rowData: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
rules: {
|
||||
setName: [
|
||||
{ required: true, message: "请输入数据集名称", trigger: "blur" }
|
||||
],
|
||||
setCode: [
|
||||
{ required: true, message: "请输入数据集编码", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
visib(val) {
|
||||
this.form = this.deepClone(this.rowData);
|
||||
this.form.setCode = this.form.setCode + "_" + Date.now();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.$refs.ruleForm.validate(async valid => {
|
||||
if (valid) {
|
||||
const { code } = await reportDataSetCopy(this.form);
|
||||
if (code != "200") {
|
||||
return;
|
||||
}
|
||||
this.$message.success("复制成功");
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
close() {
|
||||
this.$emit("close");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
* @Descripttion: 用户权限--数据集
|
||||
* @version:
|
||||
* @version:
|
||||
* @Author: qianlishi
|
||||
* @Date: 2021-12-11 14:48:27
|
||||
* @LastEditors: qianlishi
|
||||
@@ -34,6 +34,7 @@
|
||||
:visib="dialogCaseResult"
|
||||
@handleClose="dialogCaseResult = false"
|
||||
/>
|
||||
<copyDialog :visib.sync="copyVisible" :rowData="rowData" @close="close" />
|
||||
</template>
|
||||
</anji-crud>
|
||||
</template>
|
||||
@@ -43,16 +44,19 @@ import {
|
||||
reportDataSetAdd,
|
||||
reportDataSetDeleteBatch,
|
||||
reportDataSetUpdate,
|
||||
reportDataSetDetail
|
||||
reportDataSetDetail,
|
||||
reportDataSetCopy
|
||||
} from "@/api/reportDataSet";
|
||||
import EditDataSet from "./components/EditDataSet";
|
||||
import DataView from "./components/DataView";
|
||||
import copyDialog from "./components/copyDialog.vue";
|
||||
|
||||
export default {
|
||||
name: "ReportDataSet",
|
||||
components: {
|
||||
EditDataSet: EditDataSet,
|
||||
DataView: DataView
|
||||
DataView: DataView,
|
||||
copyDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -123,6 +127,11 @@ export default {
|
||||
permission: "resultsetManage:query",
|
||||
click: this.dataView
|
||||
},
|
||||
{
|
||||
label: "复制",
|
||||
permission: "resultsetManage:copy",
|
||||
click: this.copyDataSet
|
||||
},
|
||||
{
|
||||
label: "删除",
|
||||
permission: "resultsetManage:delete",
|
||||
@@ -284,7 +293,11 @@ export default {
|
||||
disabled: false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// 复制
|
||||
copyVisible: false,
|
||||
rowData: {}
|
||||
};
|
||||
},
|
||||
|
||||
@@ -308,6 +321,15 @@ export default {
|
||||
prop.setName,
|
||||
JSON.parse(prop.caseResult)
|
||||
);
|
||||
},
|
||||
//复制
|
||||
async copyDataSet(val) {
|
||||
this.copyVisible = true;
|
||||
this.rowData = val;
|
||||
},
|
||||
close() {
|
||||
this.copyVisible = false;
|
||||
this.$refs.listPage.handleQueryForm("query");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user