diff --git a/magic-editor/src/console/src/components/resources/magic-api-list.vue b/magic-editor/src/console/src/components/resources/magic-api-list.vue
index 64f5fbb7..a1988e9c 100644
--- a/magic-editor/src/console/src/components/resources/magic-api-list.vue
+++ b/magic-editor/src/console/src/components/resources/magic-api-list.vue
@@ -85,6 +85,15 @@
+
+
+
+
+
+
+
+
@@ -131,7 +140,9 @@ export default {
tree: [],
// 数据排序规则,true:升序,false:降序
treeSort: true,
+ apiCopyGroupChooseVisible: false,
groupChooseVisible: false,
+ srcItem: {},
srcId: '',
// 新建分组对象
createGroupObj: {
@@ -459,6 +470,19 @@ export default {
this.open(newItem)
}
},
+ {
+ label: '复制接口到...',
+ icon: 'ma-icon-copy',
+ onClick: () => {
+ if (!item.id) {
+ this.$magicAlert({content: '请先保存在复制!'})
+ return
+ }
+ this.srcItem = item;
+ this.apiCopyGroupChooseVisible = true
+ this.$refs.apiCopyGroupChoose.initData();
+ }
+ },
{
label: '复制路径',
icon: 'ma-icon-copy',
@@ -517,6 +541,29 @@ export default {
})
return false
},
+ copyApi() {
+ let target = this.$refs.apiCopyGroupChoose.getSelected()
+ if(target && this.srcItem.id){
+ this.$refs.apiCopyGroupChoose.unDoSelected();
+ this.apiCopyGroupChooseVisible = false
+ let group = this.getGroupsById(target)[0];
+ bus.$emit('status', `复制接口「${this.srcItem.name}」到「${group.name}」分组`)
+ let newItem = {
+ ...deepClone(this.srcItem),
+ copy: true
+ }
+ newItem.name = newItem.name + '(复制)'
+ newItem.tmp_id = new Date().getTime() + '' + Math.floor(Math.random() * 1000)
+ newItem.selectRightItem = false
+ newItem.level = group.level + 1;
+ newItem.groupId = target;
+ newItem.groupName = group.name;
+ newItem.groupPath = group.path;
+ this.pushFileItemToGroup(this.tree, newItem)
+ this.open(newItem)
+ this.srcItem = {};
+ }
+ },
copyGroup(){
let target = this.$refs.groupChoose.getSelected()
if(target && this.srcId){
diff --git a/magic-editor/src/console/src/components/resources/magic-group-choose.vue b/magic-editor/src/console/src/components/resources/magic-group-choose.vue
index 33141e5f..17080524 100644
--- a/magic-editor/src/console/src/components/resources/magic-group-choose.vue
+++ b/magic-editor/src/console/src/components/resources/magic-group-choose.vue
@@ -131,6 +131,9 @@ export default {
doSelected(item) {
this.selectedItem = item.id
},
+ unDoSelected() {
+ this.selectedItem = ''
+ },
// 排序tree,分组在前,接口在后
sortTree() {
if (this.treeSort === null) {