Browse Source

dag名称增加复制按钮

pull/2/head
gongzijian 6 years ago
parent
commit
3918a958d0
  1. 15
      escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
  2. 18
      escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

15
escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss

@ -138,11 +138,24 @@
.assist-btn { .assist-btn {
position: absolute; position: absolute;
left: 10px; left: 10px;
top: 8px; top: 4px;
>.name { >.name {
padding-left: 6px; padding-left: 6px;
vertical-align: middle; vertical-align: middle;
} }
>.copy-name {
cursor: pointer;
padding-left: 4px;
&:hover {
i {
color: #47c3ff;
}
}
i {
color: #333;
font-size: 18px;
}
}
} }
.save-btn { .save-btn {
position: absolute; position: absolute;

18
escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

@ -28,7 +28,8 @@
@click="_toggleView" @click="_toggleView"
icon="fa fa-code"> icon="fa fa-code">
</x-button> </x-button>
<span class="name">{{name}}</span> <span class="name ">{{name}}</span>
<span class="copy-name" @click="_copyName" :data-clipboard-text="name"><i class="iconfont" data-container="body" data-toggle="tooltip" title="复制名称" >&#xe61e;</i></span>
</div> </div>
<div class="save-btn"> <div class="save-btn">
<div class="operation" style="vertical-align: middle;"> <div class="operation" style="vertical-align: middle;">
@ -88,6 +89,7 @@
import mUdp from './udp/udp' import mUdp from './udp/udp'
import i18n from '@/module/i18n' import i18n from '@/module/i18n'
import { jsPlumb } from 'jsplumb' import { jsPlumb } from 'jsplumb'
import Clipboard from 'clipboard'
import { allNodesId } from './plugIn/util' import { allNodesId } from './plugIn/util'
import { toolOper, tasksType } from './config' import { toolOper, tasksType } from './config'
import mFormModel from './formModel/formModel' import mFormModel from './formModel/formModel'
@ -139,6 +141,20 @@
Dag.create() Dag.create()
} }
}, },
_copyName(){
let clipboard = new Clipboard(`.copy-name`)
clipboard.on('success', e => {
this.$message.success(`${i18n.$t('Copy success')}`)
// Free memory
clipboard.destroy()
})
clipboard.on('error', e => {
// Copy is not supported
this.$message.warning(`${i18n.$t('The browser does not support automatic copying')}`)
// Free memory
clipboard.destroy()
})
},
/** /**
* Get state interface * Get state interface
* @param isReset Whether to manually refresh * @param isReset Whether to manually refresh

Loading…
Cancel
Save