forked from github/dataease
fix(仪表板): 优化一些热键冲突
This commit is contained in:
parent
4f9f0fb12e
commit
b7c5b5bb24
@ -120,6 +120,7 @@ import { userLoginInfo } from '@/api/systemInfo/userLogin'
|
||||
import html2canvas from 'html2canvasde'
|
||||
import { queryAll } from '@/api/panel/pdfTemplate'
|
||||
import PDFPreExport from '@/views/panel/export/PDFPreExport'
|
||||
import { listenGlobalKeyDownPreview } from '@/components/canvas/utils/shortcutKey'
|
||||
|
||||
const erd = elementResizeDetectorMaker()
|
||||
export default {
|
||||
@ -351,6 +352,9 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.canvasId === 'canvas-main') {
|
||||
listenGlobalKeyDownPreview()
|
||||
}
|
||||
// 取消视图请求
|
||||
this.$cancelRequest('/chart/view/getData/**')
|
||||
this.$cancelRequest('/api/link/viewDetail/**')
|
||||
|
@ -25,6 +25,24 @@ export default {
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
// 复制到粘贴板
|
||||
copyToClipboard(state) {
|
||||
if (state.curComponent) {
|
||||
Vue.prototype.$copyText('datease-component-' + state.curComponent.id)
|
||||
}
|
||||
},
|
||||
passFromClipboard(state, componentId) {
|
||||
state.componentData.forEach(item => {
|
||||
if (item.id === componentId) {
|
||||
state.copyData = {
|
||||
data: deepCopy(item),
|
||||
index: state.componentData.length
|
||||
}
|
||||
}
|
||||
})
|
||||
state.isCut = false
|
||||
this.commit('paste')
|
||||
},
|
||||
copyMultiplexingComponents(state) {
|
||||
let pYMax = 0
|
||||
const _this = this
|
||||
@ -89,10 +107,8 @@ export default {
|
||||
|
||||
paste(state, needAdaptor) {
|
||||
if (!state.copyData) {
|
||||
toast('请选择组件')
|
||||
return
|
||||
}
|
||||
|
||||
const data = state.copyData.data
|
||||
// 仪表板复制的组件默认不在移动端部署中mobileSelected = false
|
||||
data.mobileSelected = false
|
||||
|
@ -56,7 +56,27 @@ export function listenGlobalKeyDown() {
|
||||
if (keyCode === ctrlKey || keyCode === commandKey) {
|
||||
isCtrlOrCommandDown = true
|
||||
} else if (isCtrlOrCommandDown) {
|
||||
if (keyCode === zKey || keyCode === yKey || keyCode === vKey || keyCode === cKey || keyCode === sKey || keyCode === enlargeKey) {
|
||||
if (keyCode === zKey || keyCode === yKey || keyCode === cKey || keyCode === sKey || keyCode === enlargeKey) {
|
||||
e.preventDefault()
|
||||
unlockMap[keyCode]()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.onkeyup = (e) => {
|
||||
if (e.keyCode === ctrlKey || e.keyCode === commandKey) {
|
||||
isCtrlOrCommandDown = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function listenGlobalKeyDownPreview() {
|
||||
window.onkeydown = (e) => {
|
||||
const { keyCode } = e
|
||||
if (keyCode === ctrlKey || keyCode === commandKey) {
|
||||
isCtrlOrCommandDown = true
|
||||
} else if (isCtrlOrCommandDown) {
|
||||
if (keyCode === enlargeKey) {
|
||||
e.preventDefault()
|
||||
unlockMap[keyCode]()
|
||||
}
|
||||
@ -71,12 +91,11 @@ export function listenGlobalKeyDown() {
|
||||
}
|
||||
|
||||
function copy() {
|
||||
store.commit('copy')
|
||||
store.commit('copyToClipboard')
|
||||
}
|
||||
|
||||
function paste() {
|
||||
store.commit('paste')
|
||||
store.commit('recordSnapshot')
|
||||
|
||||
}
|
||||
|
||||
function cut() {
|
||||
|
@ -30,8 +30,8 @@
|
||||
type="number"
|
||||
:min="0"
|
||||
:max="maxLeft"
|
||||
@change="leftOnChange"
|
||||
class="hide-icon-number"
|
||||
@change="leftOnChange"
|
||||
>
|
||||
<template slot="append">px</template>
|
||||
</el-input>
|
||||
|
@ -742,7 +742,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { post, fieldListDQ, batchEdit, dateformats } from '@/api/dataset/dataset'
|
||||
import { batchEdit, dateformats, fieldListDQ, post } from '@/api/dataset/dataset'
|
||||
import CalcFieldEdit from './CalcFieldEdit'
|
||||
import { getFieldName } from '@/views/dataset/data/utils'
|
||||
import msgCfm from '@/components/msgCfm/index'
|
||||
@ -839,7 +839,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getFields(item) {
|
||||
if(item.deExtractType == 0){
|
||||
if (item.deExtractType === 0) {
|
||||
const children = this.dateformats
|
||||
return [
|
||||
{ label: this.$t('dataset.text'), value: 0 },
|
||||
|
@ -283,8 +283,7 @@
|
||||
@click="changeRightDrawOpen(false)"
|
||||
/>
|
||||
</el-tooltip>
|
||||
<span style="font-weight: bold;font-size: 14px;margin-left: 40px;line-height:40px"
|
||||
>{{ $t('panel.position_adjust') }}</span>
|
||||
<span style="font-weight: bold;font-size: 14px;margin-left: 40px;line-height:40px">{{ $t('panel.position_adjust') }}</span>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<position-adjust v-if="curComponent&&!curComponent.auxiliaryMatrix" />
|
||||
@ -446,8 +445,7 @@
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="21">
|
||||
<span style="font-size: 13px;margin-left: 10px;font-weight: bold;line-height: 20px"
|
||||
>{{ $t('panel.panel_cache_use_tips') }}</span>
|
||||
<span style="font-size: 13px;margin-left: 10px;font-weight: bold;line-height: 20px">{{ $t('panel.panel_cache_use_tips') }}</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div
|
||||
@ -646,7 +644,7 @@ export default {
|
||||
},
|
||||
// 显示视图工具栏
|
||||
showViewToolsAside() {
|
||||
return !this.batchOptStatus && this.curComponent && (this.curComponent.type === 'view')
|
||||
return !this.batchOptStatus && this.curComponent && (this.curComponent.type === 'view' || this.curComponent.type === 'de-tabs')
|
||||
},
|
||||
showBatchViewToolsAside() {
|
||||
return this.batchOptStatus
|
||||
@ -792,8 +790,8 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// Global listening for key events
|
||||
listenGlobalKeyDown()
|
||||
document.addEventListener('paste', this.passFromClipboard)
|
||||
},
|
||||
mounted() {
|
||||
this.initWatermark()
|
||||
@ -810,6 +808,7 @@ export default {
|
||||
this.init(this.$store.state.panel.panelInfo.id)
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('paste', this.passFromClipboard)
|
||||
bus.$off('component-on-drag', this.componentOnDrag)
|
||||
// bus.$off('component-dialog-edit', this.editDialog)
|
||||
// bus.$off('button-dialog-edit', this.editButtonDialog)
|
||||
@ -823,6 +822,14 @@ export default {
|
||||
elx && elx.remove()
|
||||
},
|
||||
methods: {
|
||||
passFromClipboard(event) {
|
||||
// 获取解析 粘贴的文本
|
||||
const text = (event.clipboardData || window.clipboardData).getData('text')
|
||||
if (text && text.includes('datease-component-')) {
|
||||
event.preventDefault()
|
||||
this.$store.commit('passFromClipboard', text.replace('datease-component-', ''))
|
||||
}
|
||||
},
|
||||
initWatermark() {
|
||||
if (this.panelInfo.watermarkInfo) {
|
||||
userLoginInfo().then(res => {
|
||||
|
Loading…
Reference in New Issue
Block a user