|
@@ -122,25 +122,23 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <draggable tag="div" class="layout-options" :sort="false" :list="layoutOptions"
|
|
|
|
- :group="{ name: 'option', pull: 'clone', put: false }">
|
|
|
|
- <div class="option-item" v-for="item in layoutOptions" :key="item.label">
|
|
|
|
|
|
+ <draggable tag="div" class="layout-options" :sort="false" :list="layoutOptions" @start="dropStart">
|
|
|
|
+ <div class="option-item" v-for="item in layoutOptions" :key="item.value">
|
|
<div class="option-item-title">{{ item.label }}</div>
|
|
<div class="option-item-title">{{ item.label }}</div>
|
|
<img src="~@/assets/img/icons/layout-option-icon.png" class="option-item-icon" />
|
|
<img src="~@/assets/img/icons/layout-option-icon.png" class="option-item-icon" />
|
|
</div>
|
|
</div>
|
|
</draggable>
|
|
</draggable>
|
|
- <draggable class="layout-background" ghostClass="ghost-class" forceFallback handle=".cannomove"
|
|
|
|
- tag="div" animation="300" :group="{ name: 'component1', pull: false, put: true }"
|
|
|
|
- @add="handleAddOption">
|
|
|
|
|
|
+ <div class="layout-background" @dragover.prevent @drop="handleAddOption">
|
|
<img :src="formData.imgUrl" class="layout-image" ref="layoutImage" />
|
|
<img :src="formData.imgUrl" class="layout-image" ref="layoutImage" />
|
|
<vue-drag-resize :parentLimitation="true" :sticks="['bl','br']" :minw="10" :minh="10"
|
|
<vue-drag-resize :parentLimitation="true" :sticks="['bl','br']" :minw="10" :minh="10"
|
|
- :w="item.width" :h="item.height" @resizestop="(p)=>resizeStop(p,item.label)" @dragstop="(p)=>dragStop(p,item.label)"
|
|
|
|
- v-for="item in layoutItems" :key="item.label" :x="item.x" :y="item.y" :z="item.z" @clicked="()=>optionClick(item)">
|
|
|
|
|
|
+ :w="item.width" :h="item.height" @resizestop="(p)=>resizeStop(p,item.value)" @dragstop="(p)=>dragStop(p,item.value)"
|
|
|
|
+ v-for="item in layoutItems" :key="item.value" :x="item.x" :y="item.y" :z="item.z" @clicked="()=>optionClick(item)">
|
|
<div class="layout-item" @contextmenu.prevent="(e)=>rightClick(e,item)" @blur="blur" tabindex="-1"
|
|
<div class="layout-item" @contextmenu.prevent="(e)=>rightClick(e,item)" @blur="blur" tabindex="-1"
|
|
:style="{fontFamily:item.family,fontSize:item.size+'px',fontWeight:item.weight,textAlign:item.align,color:item.color}">{{ item.label }}</div>
|
|
:style="{fontFamily:item.family,fontSize:item.size+'px',fontWeight:item.weight,textAlign:item.align,color:item.color}">{{ item.label }}</div>
|
|
</vue-drag-resize>
|
|
</vue-drag-resize>
|
|
<div
|
|
<div
|
|
class="right-mouse-menu"
|
|
class="right-mouse-menu"
|
|
|
|
+ ref="rightMenuRef"
|
|
v-if="rightMouseMenu.show"
|
|
v-if="rightMouseMenu.show"
|
|
:style="{
|
|
:style="{
|
|
left: rightMouseMenu.left,
|
|
left: rightMouseMenu.left,
|
|
@@ -149,7 +147,7 @@
|
|
>
|
|
>
|
|
<div class="item" @click="optionDel" style="color: #AD352F;">{{$t('Table.delete_btn')}}</div>
|
|
<div class="item" @click="optionDel" style="color: #AD352F;">{{$t('Table.delete_btn')}}</div>
|
|
</div>
|
|
</div>
|
|
- </draggable>
|
|
|
|
|
|
+ </div>
|
|
<div class="layout-font">
|
|
<div class="layout-font">
|
|
<div class="layout-font-title">{{$t('SystemManage.BaseConfig.text_style')}}</div>
|
|
<div class="layout-font-title">{{$t('SystemManage.BaseConfig.text_style')}}</div>
|
|
<div class="layout-font-options">
|
|
<div class="layout-font-options">
|
|
@@ -217,9 +215,9 @@ export default {
|
|
},
|
|
},
|
|
step:1,
|
|
step:1,
|
|
steps:[this.$t('SystemManage.BaseConfig.select_layout'),this.$t('SystemManage.BaseConfig.edit_layout')],
|
|
steps:[this.$t('SystemManage.BaseConfig.select_layout'),this.$t('SystemManage.BaseConfig.edit_layout')],
|
|
- layoutOptions:[{label:this.$t('SystemManage.BaseConfig.report_title')},//研报标题
|
|
|
|
- {label:this.$t('SystemManage.BaseConfig.report_author')},//研报作者
|
|
|
|
- {label:this.$t('SystemManage.BaseConfig.report_creation_time')}],//创建时间
|
|
|
|
|
|
+ layoutOptions:[{value:'研报标题',label:this.$t('SystemManage.BaseConfig.report_title')},//研报标题
|
|
|
|
+ {value:'研报作者',label:this.$t('SystemManage.BaseConfig.report_author')},//研报作者
|
|
|
|
+ {value:'创建时间',label:this.$t('SystemManage.BaseConfig.report_creation_time')}],//创建时间
|
|
layoutItems:[],
|
|
layoutItems:[],
|
|
// currentLayout:{},
|
|
// currentLayout:{},
|
|
layoutFont:{
|
|
layoutFont:{
|
|
@@ -233,8 +231,9 @@ export default {
|
|
show: false,
|
|
show: false,
|
|
left: '99999px',
|
|
left: '99999px',
|
|
top: '99999px',
|
|
top: '99999px',
|
|
- label: '',
|
|
|
|
|
|
+ value: '',
|
|
},
|
|
},
|
|
|
|
+ dragIndex:0,
|
|
layoutFontF:['Arial','Georgia','Impact','Tahoma','Times New Roman','Verdana','思源宋体','思源黑体'],
|
|
layoutFontF:['Arial','Georgia','Impact','Tahoma','Times New Roman','Verdana','思源宋体','思源黑体'],
|
|
layoutFontS:['12','13','14','15','16','18','20','24','28','32','36','40'],
|
|
layoutFontS:['12','13','14','15','16','18','20','24','28','32','36','40'],
|
|
layoutFontW:[{value:'normal',label:this.$t('SystemManage.BaseConfig.style_font_w_normal')},
|
|
layoutFontW:[{value:'normal',label:this.$t('SystemManage.BaseConfig.style_font_w_normal')},
|
|
@@ -330,6 +329,7 @@ export default {
|
|
let backgroundGHeight = this.$refs.layoutImage.height
|
|
let backgroundGHeight = this.$refs.layoutImage.height
|
|
let layoutStr = this.layoutItems.map(item =>{
|
|
let layoutStr = this.layoutItems.map(item =>{
|
|
return {
|
|
return {
|
|
|
|
+ value:item.value,
|
|
label:item.label,
|
|
label:item.label,
|
|
left:item.x/backgroundWidth*100+'%',
|
|
left:item.x/backgroundWidth*100+'%',
|
|
top:item.y/backgroundGHeight*100+'%',
|
|
top:item.y/backgroundGHeight*100+'%',
|
|
@@ -374,7 +374,10 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ convertLabel(value){
|
|
|
|
+ let row = this.layoutOptions.find(it => it.value==value)
|
|
|
|
+ return row?row.label:value
|
|
|
|
+ },
|
|
handleCloseImgUpload(){
|
|
handleCloseImgUpload(){
|
|
this.uploadImgPop=false
|
|
this.uploadImgPop=false
|
|
},
|
|
},
|
|
@@ -397,7 +400,7 @@ export default {
|
|
show: false,
|
|
show: false,
|
|
left: '99999px',
|
|
left: '99999px',
|
|
top: '99999px',
|
|
top: '99999px',
|
|
- label: '',
|
|
|
|
|
|
+ value: '',
|
|
},
|
|
},
|
|
this.$nextTick(()=>{
|
|
this.$nextTick(()=>{
|
|
this.$refs.ruleForm.clearValidate()
|
|
this.$refs.ruleForm.clearValidate()
|
|
@@ -474,9 +477,10 @@ export default {
|
|
let backgroundWidth = this.$refs.layoutImage?this.$refs.layoutImage.width:400
|
|
let backgroundWidth = this.$refs.layoutImage?this.$refs.layoutImage.width:400
|
|
let backgroundGHeight = this.$refs.layoutImage?this.$refs.layoutImage.height:100
|
|
let backgroundGHeight = this.$refs.layoutImage?this.$refs.layoutImage.height:100
|
|
try {
|
|
try {
|
|
- this.layoutItems=JSON.parse(this.formData.layout).map(it =>{
|
|
|
|
|
|
+ this.layoutItems=this.formData.layout?JSON.parse(this.formData.layout).map(it =>{
|
|
return {
|
|
return {
|
|
- label:it.label,
|
|
|
|
|
|
+ value:it.value || it.label,
|
|
|
|
+ label:this.convertLabel(it.value || it.label),
|
|
x:this.percent2Number(it.left,backgroundWidth),
|
|
x:this.percent2Number(it.left,backgroundWidth),
|
|
y:this.percent2Number(it.top,backgroundGHeight),
|
|
y:this.percent2Number(it.top,backgroundGHeight),
|
|
z:1,
|
|
z:1,
|
|
@@ -488,9 +492,9 @@ export default {
|
|
align:it.align,
|
|
align:it.align,
|
|
color:it.color,
|
|
color:it.color,
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ }):[]
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- // console.log(error,'error');
|
|
|
|
|
|
+ console.log(error,'error');
|
|
this.layoutItems=[]
|
|
this.layoutItems=[]
|
|
}
|
|
}
|
|
// console.log(this.layoutItems,'this.layoutItems');
|
|
// console.log(this.layoutItems,'this.layoutItems');
|
|
@@ -501,18 +505,22 @@ export default {
|
|
let decimals = (+per.substring(0,per.length-1))/100
|
|
let decimals = (+per.substring(0,per.length-1))/100
|
|
return entirety*decimals
|
|
return entirety*decimals
|
|
},
|
|
},
|
|
|
|
+ dropStart(e){
|
|
|
|
+ this.dragIndex = e.oldIndex
|
|
|
|
+ },
|
|
handleAddOption(e){
|
|
handleAddOption(e){
|
|
- let options = this.layoutOptions[e.oldIndex]
|
|
|
|
- let layoutItem = this.layoutItems.find(it => it.label == options.label)
|
|
|
|
|
|
+ let options = this.layoutOptions[this.dragIndex]
|
|
|
|
+ let layoutItem = this.layoutItems.find(it => it.value == options.value)
|
|
if(layoutItem){
|
|
if(layoutItem){
|
|
layoutItem.z = Math.max(...this.layoutItems.map(t => t.z))+1
|
|
layoutItem.z = Math.max(...this.layoutItems.map(t => t.z))+1
|
|
- this.$message.warning(`已添加${options.label}!`)
|
|
|
|
|
|
+ this.$message.warning(this.$i18nt.locale==='zh'?`已添加${options.label}!`:`${options.label} already added!`)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.layoutItems.push({
|
|
this.layoutItems.push({
|
|
|
|
+ value:options.value,
|
|
label:options.label,
|
|
label:options.label,
|
|
- x:e.originalEvent.layerX,
|
|
|
|
- y:e.originalEvent.layerY,
|
|
|
|
|
|
+ x:e.layerX,
|
|
|
|
+ y:e.layerY,
|
|
z:1,
|
|
z:1,
|
|
width:120,
|
|
width:120,
|
|
height:20,
|
|
height:20,
|
|
@@ -523,14 +531,14 @@ export default {
|
|
color:'#333333'
|
|
color:'#333333'
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- resizeStop({width,height},label){
|
|
|
|
- let item = this.layoutItems.find(it => it.label==label)
|
|
|
|
|
|
+ resizeStop({width,height},value){
|
|
|
|
+ let item = this.layoutItems.find(it => it.value==value)
|
|
if(!item) return
|
|
if(!item) return
|
|
item.width=width
|
|
item.width=width
|
|
item.height=height
|
|
item.height=height
|
|
},
|
|
},
|
|
- dragStop({left,top},label){
|
|
|
|
- let item = this.layoutItems.find(it => it.label==label)
|
|
|
|
|
|
+ dragStop({left,top},value){
|
|
|
|
+ let item = this.layoutItems.find(it => it.value==value)
|
|
if(!item) return
|
|
if(!item) return
|
|
item.x=left
|
|
item.x=left
|
|
item.y=top
|
|
item.y=top
|
|
@@ -539,20 +547,21 @@ export default {
|
|
this.layoutFont = op
|
|
this.layoutFont = op
|
|
},
|
|
},
|
|
rightClick(e,item){
|
|
rightClick(e,item){
|
|
- e.target.focus()
|
|
|
|
clearTimeout(this.rigtMenuHideTimer)
|
|
clearTimeout(this.rigtMenuHideTimer)
|
|
this.rightMouseMenu.left = e.clientX + "px";
|
|
this.rightMouseMenu.left = e.clientX + "px";
|
|
this.rightMouseMenu.top = e.clientY + "px";
|
|
this.rightMouseMenu.top = e.clientY + "px";
|
|
- this.rightMouseMenu.label = item.label;
|
|
|
|
|
|
+ this.rightMouseMenu.value = item.value;
|
|
this.rightMouseMenu.show = true;
|
|
this.rightMouseMenu.show = true;
|
|
},
|
|
},
|
|
optionDel(){
|
|
optionDel(){
|
|
- this.layoutItems=this.layoutItems.filter(it => it.label!=this.rightMouseMenu.label)
|
|
|
|
|
|
+ this.layoutItems=this.layoutItems.filter(it => it.value!=this.rightMouseMenu.value)
|
|
|
|
+ this.rightMouseMenu.show=false
|
|
},
|
|
},
|
|
blur(){
|
|
blur(){
|
|
- this.rigtMenuHideTimer=setTimeout(()=>{
|
|
|
|
|
|
+ this.$refs.rightMenuRef.style.opacity=0
|
|
|
|
+ setTimeout(()=>{
|
|
this.rightMouseMenu.show=false
|
|
this.rightMouseMenu.show=false
|
|
- },80)
|
|
|
|
|
|
+ },300)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}
|
|
}
|