|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="select-content">
|
|
|
|
|
<div class="select-input">
|
|
|
|
|
<a-select
|
|
|
|
|
size="small"
|
|
|
|
|
ref="selectView"
|
|
|
|
@ -13,6 +14,7 @@
|
|
|
|
|
:open="open"
|
|
|
|
|
optionLabelProp="label"
|
|
|
|
|
:notFoundContent="inLoading ? '加载中...' : '暂无数据'"
|
|
|
|
|
v-clickDown="{ clickFun: () => {} , dblclickFun: this.dblclickFun }"
|
|
|
|
|
@focus="getSelectFirst"
|
|
|
|
|
@blur="getSelectBlur"
|
|
|
|
|
@select="selectOption"
|
|
|
|
@ -43,8 +45,17 @@
|
|
|
|
|
</a-select>
|
|
|
|
|
<div v-show="!open" class="select_overlap" @mouseup="openSelect"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="copy-btn iconfont icon-fuzhi11" @click="dblclickFun"></div>
|
|
|
|
|
<!-- <div
|
|
|
|
|
v-show="!open"
|
|
|
|
|
class="select_overlap"
|
|
|
|
|
v-clickDown="{ clickFun: this.openSelect, dblclickFun: this.dblclickFun }"
|
|
|
|
|
>
|
|
|
|
|
</div> -->
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import Vue from 'vue'
|
|
|
|
|
import {
|
|
|
|
|
GetPortloadlist,
|
|
|
|
|
GetPortlist,
|
|
|
|
@ -60,6 +71,29 @@ import {
|
|
|
|
|
} from '@/api/modular/main/BookingLedger'
|
|
|
|
|
import { mapGetters, mapActions } from 'vuex'
|
|
|
|
|
let timer
|
|
|
|
|
Vue.directive('clickDown', {
|
|
|
|
|
inserted(el, binding, vnode) {
|
|
|
|
|
let clickTimer = null
|
|
|
|
|
// 单击
|
|
|
|
|
el.addEventListener('click', () => {
|
|
|
|
|
if (clickTimer) {
|
|
|
|
|
window.clearTimeout(clickTimer);
|
|
|
|
|
clickTimer = null;
|
|
|
|
|
}
|
|
|
|
|
clickTimer = setTimeout(() => {
|
|
|
|
|
binding.value.clickFun()
|
|
|
|
|
}, 300);
|
|
|
|
|
})
|
|
|
|
|
// 双击
|
|
|
|
|
el.addEventListener('dblclick', () => {
|
|
|
|
|
if (clickTimer) {
|
|
|
|
|
window.clearTimeout(clickTimer);
|
|
|
|
|
clickTimer = null;
|
|
|
|
|
}
|
|
|
|
|
binding.value.dblclickFun()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
export default {
|
|
|
|
|
name: '',
|
|
|
|
|
props: {
|
|
|
|
@ -457,7 +491,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
openSelect() {
|
|
|
|
|
openSelect(open) {
|
|
|
|
|
console.log('== 测试鼠标滑过 ==')
|
|
|
|
|
if (!this.open) {
|
|
|
|
|
this.getSelectFirst('', false)
|
|
|
|
|
} else {
|
|
|
|
@ -469,6 +504,27 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
getSelectBlur (e) {
|
|
|
|
|
this.open = false
|
|
|
|
|
},
|
|
|
|
|
dblclickFun () {
|
|
|
|
|
if (!this.value) {
|
|
|
|
|
this.$message.error('暂无可复制内容')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
this.copy(this.value)
|
|
|
|
|
},
|
|
|
|
|
copy(textValue) {
|
|
|
|
|
const textarea = document.createElement('textarea')
|
|
|
|
|
textarea.readOnly = 'readonly'
|
|
|
|
|
textarea.style.position = 'absolute'
|
|
|
|
|
textarea.style.left = '-9999px'
|
|
|
|
|
textarea.value = textValue
|
|
|
|
|
document.body.appendChild(textarea)
|
|
|
|
|
textarea.select()
|
|
|
|
|
const result = document.execCommand('Copy')
|
|
|
|
|
if (result) {
|
|
|
|
|
this.$message.success('复制成功')
|
|
|
|
|
}
|
|
|
|
|
document.body.removeChild(textarea)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -509,7 +565,11 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.select-content {
|
|
|
|
|
display: flex;
|
|
|
|
|
.select-input{
|
|
|
|
|
flex: 1;
|
|
|
|
|
position: relative;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
.select_overlap {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
height: 32px;
|
|
|
|
@ -521,5 +581,15 @@ export default {
|
|
|
|
|
bottom: 0;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.copy-btn{
|
|
|
|
|
width: 30px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #bbb;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
&:hover{
|
|
|
|
|
color: @primary-color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|