forked from github/dataease
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
c138342c08
@ -1,6 +1,5 @@
|
||||
package io.dataease.job.sechedule.strategy.impl;
|
||||
|
||||
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
@ -26,11 +25,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Service
|
||||
public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
|
||||
|
||||
private static final Integer RUNING = 0;
|
||||
private static final Integer SUCCESS = 1;
|
||||
private static final Integer ERROR = -1;
|
||||
@ -38,7 +35,6 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
@Resource
|
||||
private AuthUserServiceImpl authUserServiceImpl;
|
||||
|
||||
|
||||
@Override
|
||||
protected JobDataMap jobDataMap(GlobalTaskEntity taskEntity) {
|
||||
JobDataMap jobDataMap = new JobDataMap();
|
||||
@ -54,7 +50,8 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
// 插件没有加载 空转
|
||||
if (!CommonBeanFactory.getBean(AuthUserService.class).pluginLoaded()) return;
|
||||
if (!CommonBeanFactory.getBean(AuthUserService.class).pluginLoaded())
|
||||
return;
|
||||
|
||||
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
|
||||
GlobalTaskEntity taskEntity = (GlobalTaskEntity) jobDataMap.get("taskEntity");
|
||||
@ -74,7 +71,6 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public EmailTaskHandler proxy() {
|
||||
return CommonBeanFactory.getBean(EmailTaskHandler.class);
|
||||
}
|
||||
@ -106,12 +102,13 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
emailXpackService.saveInstance(taskInstance);
|
||||
}
|
||||
|
||||
|
||||
@Async
|
||||
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO, SysUserEntity user) {
|
||||
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO,
|
||||
SysUserEntity user) {
|
||||
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
|
||||
try {
|
||||
byte[] bytes = emailXpackService.printData(panelUrl(emailTemplateDTO.getPanelId()), tokenByUser(user), buildPixel(emailTemplateDTO));
|
||||
byte[] bytes = emailXpackService.printData(panelUrl(emailTemplateDTO.getPanelId()), tokenByUser(user),
|
||||
buildPixel(emailTemplateDTO));
|
||||
// 下面继续执行发送邮件的
|
||||
String recipients = emailTemplateDTO.getRecipients();
|
||||
byte[] content = emailTemplateDTO.getContent();
|
||||
@ -131,12 +128,14 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
private XpackPixelEntity buildPixel(XpackEmailTemplateDTO emailTemplateDTO) {
|
||||
XpackPixelEntity pixelEntity = new XpackPixelEntity();
|
||||
String pixelStr = emailTemplateDTO.getPixel();
|
||||
if (StringUtils.isBlank(pixelStr)) return null;
|
||||
if (StringUtils.isBlank(pixelStr))
|
||||
return null;
|
||||
String[] arr = pixelStr.split("\\*");
|
||||
if (arr.length != 2) return null;
|
||||
if (arr.length != 2)
|
||||
return null;
|
||||
try {
|
||||
int x = Integer.parseInt(arr[0]);
|
||||
int y = Integer.parseInt(arr[1]);
|
||||
int x = Integer.parseInt(arr[0].trim());
|
||||
int y = Integer.parseInt(arr[1].trim());
|
||||
pixelEntity.setX(String.valueOf(x));
|
||||
pixelEntity.setY(String.valueOf(y));
|
||||
return pixelEntity;
|
||||
@ -145,7 +144,6 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String tokenByUser(SysUserEntity user) {
|
||||
TokenInfo tokenInfo = TokenInfo.builder().userId(user.getUserId()).username(user.getUsername()).build();
|
||||
String token = JWTUtils.sign(tokenInfo, user.getPassword());
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.dataease.plugins.server;
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
@ -34,7 +33,8 @@ public class XEmailTaskServer {
|
||||
private ScheduleService scheduleService;
|
||||
|
||||
@PostMapping("/queryTasks/{goPage}/{pageSize}")
|
||||
public Pager<List<XpackTaskGridDTO>> queryTask(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackGridRequest request) {
|
||||
public Pager<List<XpackTaskGridDTO>> queryTask(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody XpackGridRequest request) {
|
||||
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
List<XpackTaskGridDTO> tasks = emailXpackService.taskGrid(request);
|
||||
@ -115,7 +115,8 @@ public class XEmailTaskServer {
|
||||
}
|
||||
|
||||
@PostMapping("/queryInstancies/{goPage}/{pageSize}")
|
||||
public Pager<List<XpackTaskInstanceDTO>> instancesGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackGridRequest request) {
|
||||
public Pager<List<XpackTaskInstanceDTO>> instancesGrid(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody XpackGridRequest request) {
|
||||
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
List<XpackTaskInstanceDTO> instances = emailXpackService.taskInstanceGrid(request);
|
||||
@ -132,13 +133,15 @@ public class XEmailTaskServer {
|
||||
|
||||
private XpackPixelEntity buildPixel(String pixel) {
|
||||
|
||||
if (StringUtils.isBlank(pixel)) return null;
|
||||
if (StringUtils.isBlank(pixel))
|
||||
return null;
|
||||
String[] arr = pixel.split("\\*");
|
||||
if (arr.length != 2) return null;
|
||||
if (arr.length != 2)
|
||||
return null;
|
||||
try {
|
||||
XpackPixelEntity result = new XpackPixelEntity();
|
||||
int x = Integer.parseInt(arr[0]);
|
||||
int y = Integer.parseInt(arr[1]);
|
||||
int x = Integer.parseInt(arr[0].trim());
|
||||
int y = Integer.parseInt(arr[1].trim());
|
||||
result.setX(String.valueOf(x));
|
||||
result.setY(String.valueOf(y));
|
||||
return result;
|
||||
|
@ -1,26 +1,26 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function saveEnshrine(panelGroupId) {
|
||||
export function saveEnshrine(panelGroupId, loading = true) {
|
||||
return request({
|
||||
url: '/api/store/' + panelGroupId,
|
||||
method: 'post',
|
||||
loading: true
|
||||
loading: loading
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteEnshrine(id) {
|
||||
export function deleteEnshrine(id, loading = true) {
|
||||
return request({
|
||||
url: '/api/store/remove/' + id,
|
||||
method: 'post',
|
||||
loading: true
|
||||
loading: loading
|
||||
})
|
||||
}
|
||||
|
||||
export function enshrineList(data) {
|
||||
export function enshrineList(data, loading = true) {
|
||||
return request({
|
||||
url: '/api/store/list',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
loading: loading,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ export default {
|
||||
timeOptions: [
|
||||
|
||||
{ value: 'hh:mm:ss', label: 'hh:mm:ss' },
|
||||
{ value: 'hh时mm分ss秒', label: 'hh时mm分ss秒' }
|
||||
{ value: 'hh时mm分ss秒', label: 'hh时mm分ss秒' },
|
||||
{ value: '', label: '无' }
|
||||
],
|
||||
dateOptions: [
|
||||
{ value: 'yyyy-MM-dd', label: 'yyyy-MM-dd' },
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="bg" :style="customStyle">
|
||||
<div id="canvasInfoMain" ref="canvasInfoMain" style="width: 100%;height: 100%">
|
||||
<div id="canvasInfoMain" ref="canvasInfoMain" :style="canvasInfoMainStyle">
|
||||
<div
|
||||
id="canvasInfoTemp"
|
||||
ref="canvasInfoTemp"
|
||||
@ -73,6 +73,11 @@ export default {
|
||||
event: 'change'
|
||||
},
|
||||
props: {
|
||||
// 后端截图
|
||||
backScreenShot: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
screenShot: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
@ -123,12 +128,21 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const terminalInfo = this.$route.query.terminal
|
||||
if (terminalInfo) {
|
||||
this.terminal = terminalInfo
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
canvasInfoMainStyle() {
|
||||
if (this.backScreenShot) {
|
||||
return {
|
||||
width: '100%',
|
||||
height: this.mainHeight
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
}
|
||||
}
|
||||
},
|
||||
customStyle() {
|
||||
let style = {
|
||||
width: '100%'
|
||||
@ -146,6 +160,11 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.backScreenShot) {
|
||||
style.height = this.mainHeight
|
||||
} else {
|
||||
style.padding = '5px'
|
||||
}
|
||||
return style
|
||||
},
|
||||
screenShotStyle() {
|
||||
@ -178,6 +197,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this._isMobile()
|
||||
const _this = this
|
||||
const erd = elementResizeDetectorMaker()
|
||||
// 监听主div变动事件
|
||||
@ -192,6 +212,7 @@ export default {
|
||||
_this.$nextTick(() => {
|
||||
// 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题
|
||||
_this.mainHeight = tempCanvas.scrollHeight + 'px!important'
|
||||
this.$emit('mainHeightChange', _this.mainHeight)
|
||||
})
|
||||
})
|
||||
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
|
||||
@ -206,6 +227,12 @@ export default {
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
methods: {
|
||||
_isMobile() {
|
||||
console.log('navigator.userAgent:' + navigator.userAgent)
|
||||
const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
|
||||
this.terminal = flag ? 'mobile' : 'pc'
|
||||
// this.terminal = 'mobile'
|
||||
},
|
||||
canvasStyleDataInit() {
|
||||
// 数据刷新计时器
|
||||
this.searchCount = 0
|
||||
@ -228,8 +255,13 @@ export default {
|
||||
const canvasHeight = document.getElementById('canvasInfoMain').offsetHeight
|
||||
const canvasWidth = document.getElementById('canvasInfoMain').offsetWidth
|
||||
this.scaleWidth = (canvasWidth) * 100 / this.canvasStyleData.width // 获取宽度比
|
||||
this.scaleHeight = canvasHeight * 100 / this.canvasStyleData.height// 获取高度比
|
||||
this.$store.commit('setPreviewCanvasScale', (this.scaleWidth / 100), (this.scaleHeight / 100))
|
||||
// 如果是后端截图方式使用 的高度伸缩比例和宽度比例相同
|
||||
if (this.backScreenShot) {
|
||||
this.scaleHeight = this.scaleWidth
|
||||
} else {
|
||||
this.scaleHeight = canvasHeight * 100 / this.canvasStyleData.height// 获取高度比
|
||||
}
|
||||
this.$store.commit('setPreviewCanvasScale', { scaleWidth: (this.scaleWidth / 100), scaleHeight: (this.scaleHeight / 100) })
|
||||
this.handleScaleChange()
|
||||
},
|
||||
resetID(data) {
|
||||
@ -278,7 +310,7 @@ export default {
|
||||
}
|
||||
},
|
||||
handleMouseDown() {
|
||||
this.$store.commit('setClickComponentStatus', false)
|
||||
this.$store.commit('setClickComponentStatus', fals)
|
||||
},
|
||||
initMobileCanvas() {
|
||||
this.$store.commit('openMobileLayout')
|
||||
@ -289,7 +321,6 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bg {
|
||||
padding: 5px;
|
||||
min-width: 200px;
|
||||
min-height: 300px;
|
||||
width: 100%;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div v-loading="dataLoading" class="bg">
|
||||
<Preview v-if="!dataLoading" />
|
||||
<div v-loading="dataLoading" class="bg" :style="bgStyle">
|
||||
<Preview v-if="!dataLoading" :back-screen-shot="backScreenShot" @mainHeightChange="mainHeightChange" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -14,16 +14,33 @@ export default {
|
||||
components: { Preview },
|
||||
data() {
|
||||
return {
|
||||
dataLoading: false
|
||||
dataLoading: false,
|
||||
backScreenShot: false,
|
||||
mainHeight: '100vh!important'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
bgStyle() {
|
||||
if (this.backScreenShot) {
|
||||
return { height: this.mainHeight }
|
||||
} else {
|
||||
return { height: '100vh!important' }
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.restore()
|
||||
},
|
||||
methods: {
|
||||
mainHeightChange(mainHeight) {
|
||||
this.mainHeight = mainHeight
|
||||
},
|
||||
restore() {
|
||||
this.dataLoading = true
|
||||
this.panelId = this.$route.path.split('/')[2]
|
||||
this.panelId = this.$route.params.reportId
|
||||
if (this.$route.params.backScreenShot !== undefined) {
|
||||
this.backScreenShot = this.$route.params.backScreenShot
|
||||
}
|
||||
// 加载视图数据
|
||||
findOne(this.panelId).then(response => {
|
||||
this.dataLoading = false
|
||||
@ -80,8 +97,8 @@ export default {
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 100vh!important;
|
||||
min-width: 800px;
|
||||
min-height: 600px;
|
||||
min-width: 200px;
|
||||
min-height: 300px;
|
||||
background-color: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
|
@ -142,7 +142,7 @@ export default {
|
||||
})
|
||||
},
|
||||
addTab() {
|
||||
bus.$emit('add-new-tab')
|
||||
bus.$emit('add-new-tab', this.curComponent.id)
|
||||
},
|
||||
// 跳转设置
|
||||
linkJumpSet() {
|
||||
|
@ -1195,7 +1195,7 @@ export default {
|
||||
matrixStyleOriginWidth: this.matrixStyle.originWidth,
|
||||
matrixStyleOriginHeight: this.matrixStyle.originHeight
|
||||
})
|
||||
this.$store.commit('setPreviewCanvasScale', this.scalePointWidth, this.scalePointHeight)
|
||||
this.$store.commit('setPreviewCanvasScale', { scaleWidth: this.scalePointWidth, scaleHeight: this.scalePointHeight })
|
||||
}
|
||||
},
|
||||
getShapeStyleIntDeDrag(style, prop) {
|
||||
|
@ -299,7 +299,6 @@ export default {
|
||||
// 监控缩放比例
|
||||
previewCanvasScale: {
|
||||
handler(newVal, oldVal) {
|
||||
console.log('previewCanvasScale:' + JSON.stringify(this.previewCanvasScale))
|
||||
this.destroyScaleTimeMachine()
|
||||
this.changeScaleIndex++
|
||||
this.chartScale(this.changeScaleIndex)
|
||||
|
@ -94,8 +94,6 @@ export const customAttrTrans = {
|
||||
'barWidth',
|
||||
'lineWidth',
|
||||
'lineSymbolSize',
|
||||
'pieInnerRadius',
|
||||
'pieOuterRadius',
|
||||
'funnelWidth', // 漏斗图 最大宽度
|
||||
'tableTitleFontSize',
|
||||
'tableItemFontSize',
|
||||
|
@ -51,9 +51,17 @@ export default {
|
||||
defaultValueStr() {
|
||||
if (!this.element || !this.element.options || !this.element.options.value) return ''
|
||||
return this.element.options.value.toString()
|
||||
},
|
||||
viewIds() {
|
||||
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
|
||||
return this.element.options.attrs.viewIds.toString()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'viewIds': function(value, old) {
|
||||
if (typeof value === 'undefined' || value === old) return
|
||||
this.setCondition()
|
||||
},
|
||||
'defaultValueStr': function(value, old) {
|
||||
if (this.element.serviceName === 'timeDateWidget' && this.element.options.attrs.default.isDynamic) {
|
||||
// 如果设置了动态时间 不做任何操作
|
||||
@ -79,7 +87,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.element.serviceName === 'timeDateWidget' && this.element.options.attrs.default.isDynamic) {
|
||||
if (this.element.serviceName === 'timeDateWidget' && this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) {
|
||||
if (this.element.options.attrs.default) {
|
||||
const widget = ApplicationContext.getService(this.element.serviceName)
|
||||
this.values = widget.dynamicDateFormNow(this.element)
|
||||
@ -146,10 +154,10 @@ export default {
|
||||
fillValueDerfault() {
|
||||
const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString()
|
||||
if (this.element.options.attrs.type === 'daterange') {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '') return []
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return []
|
||||
return defaultV.split(',').map(item => parseFloat(item))
|
||||
} else {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '') return null
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null
|
||||
return parseFloat(defaultV.split(',')[0])
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@
|
||||
v-model="value"
|
||||
resize="vertical"
|
||||
:placeholder="$t(element.options.attrs.placeholder)"
|
||||
:size="size"
|
||||
@input="valueChange"
|
||||
@keypress.enter.native="search"
|
||||
@dblclick="setEdit"
|
||||
:size="size"
|
||||
>
|
||||
|
||||
<el-button slot="append" icon="el-icon-search" @click="search" />
|
||||
@ -37,10 +37,24 @@ export default {
|
||||
canEdit: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
defaultValueStr() {
|
||||
if (!this.element || !this.element.options || !this.element.options.value) return ''
|
||||
return this.element.options.value.toString()
|
||||
},
|
||||
viewIds() {
|
||||
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
|
||||
return this.element.options.attrs.viewIds.toString()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'element.options.value': function(value, old) {
|
||||
'viewIds': function(value, old) {
|
||||
if (typeof value === 'undefined' || value === old) return
|
||||
this.setCondition()
|
||||
},
|
||||
'defaultValueStr': function(value, old) {
|
||||
if (value === old) return
|
||||
this.value = value
|
||||
this.value = this.fillValueDerfault()
|
||||
this.search()
|
||||
}
|
||||
},
|
||||
@ -60,7 +74,7 @@ export default {
|
||||
setCondition() {
|
||||
const param = {
|
||||
component: this.element,
|
||||
value: !this.value ? [] : [this.value],
|
||||
value: !this.value ? [] : Array.isArray(this.value) ? this.value : [this.value],
|
||||
operator: this.operator
|
||||
}
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
@ -72,6 +86,11 @@ export default {
|
||||
if (!this.inDraw) {
|
||||
this.element.options.value = val
|
||||
}
|
||||
},
|
||||
fillValueDerfault() {
|
||||
const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString()
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null
|
||||
return defaultV.split(',')[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@
|
||||
<el-form v-if="element.options!== null && element.options.attrs!==null" ref="form" :model="form" :rules="rules">
|
||||
<div class="de-number-range-container">
|
||||
<el-form-item prop="min">
|
||||
<el-input v-model="form.min" :placeholder="$t(element.options.attrs.placeholder_min)" @input="inputChange" @change="handleMinChange" :size="size"/>
|
||||
<el-input v-model="form.min" :placeholder="$t(element.options.attrs.placeholder_min)" :size="size" @input="inputChange" @change="handleMinChange" />
|
||||
</el-form-item>
|
||||
<span>{{ $t('denumberrange.split_placeholder') }}</span>
|
||||
<el-form-item prop="max">
|
||||
<el-input v-model="form.max" :placeholder="$t(element.options.attrs.placeholder_max)" @input="inputChange" @change="handleMaxChange" :size="size"/>
|
||||
<el-input v-model="form.max" :placeholder="$t(element.options.attrs.placeholder_max)" :size="size" @input="inputChange" @change="handleMaxChange" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
@ -60,9 +60,17 @@ export default {
|
||||
return JSON.stringify([])
|
||||
}
|
||||
return JSON.stringify(this.element.options.value)
|
||||
},
|
||||
viewIds() {
|
||||
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
|
||||
return this.element.options.attrs.viewIds.toString()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'viewIds': function(value, old) {
|
||||
if (typeof value === 'undefined' || value === old) return
|
||||
this.setCondition()
|
||||
},
|
||||
'defaultvalues': function(value, old) {
|
||||
if (value === old) return
|
||||
const values = this.element.options.value
|
||||
|
@ -62,10 +62,18 @@ export default {
|
||||
defaultValueStr() {
|
||||
if (!this.element || !this.element.options || !this.element.options.value) return ''
|
||||
return this.element.options.value.toString()
|
||||
},
|
||||
viewIds() {
|
||||
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
|
||||
return this.element.options.attrs.viewIds.toString()
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'viewIds': function(value, old) {
|
||||
if (typeof value === 'undefined' || value === old) return
|
||||
this.setCondition()
|
||||
},
|
||||
'defaultValueStr': function(value, old) {
|
||||
if (value === old) return
|
||||
this.value = this.fillValueDerfault()
|
||||
@ -153,10 +161,10 @@ export default {
|
||||
fillValueDerfault() {
|
||||
const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString()
|
||||
if (this.element.options.attrs.multiple) {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '') return []
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return []
|
||||
return defaultV.split(',')
|
||||
} else {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '') return null
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null
|
||||
return defaultV.split(',')[0]
|
||||
}
|
||||
},
|
||||
|
@ -75,10 +75,17 @@ export default {
|
||||
defaultValueStr() {
|
||||
if (!this.element || !this.element.options || !this.element.options.value) return ''
|
||||
return this.element.options.value.toString()
|
||||
},
|
||||
viewIds() {
|
||||
if (!this.element || !this.element.options || !this.element.options.attrs.viewIds) return ''
|
||||
return this.element.options.attrs.viewIds.toString()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
'viewIds': function(value, old) {
|
||||
if (typeof value === 'undefined' || value === old) return
|
||||
this.setCondition()
|
||||
},
|
||||
'defaultValueStr': function(value, old) {
|
||||
if (value === old) return
|
||||
this.value = this.fillValueDerfault()
|
||||
@ -119,7 +126,7 @@ export default {
|
||||
initLoad() {
|
||||
this.value = this.element.options.attrs.multiple ? [] : null
|
||||
if (this.element.options.attrs.fieldId) {
|
||||
multFieldValues(this.element.options.attrs.fieldId.split()).then(res => {
|
||||
multFieldValues(this.element.options.attrs.fieldId.split(',')).then(res => {
|
||||
this.datas = this.optionDatas(res.data)
|
||||
if (this.element.options.attrs.multiple) {
|
||||
this.checkAll = this.value.length === this.datas.length
|
||||
@ -158,12 +165,12 @@ export default {
|
||||
return this.value.split(',')
|
||||
},
|
||||
fillValueDerfault() {
|
||||
const defaultV = this.element.options.value
|
||||
const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString()
|
||||
if (this.element.options.attrs.multiple) {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '') return []
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return []
|
||||
return defaultV.split(',')
|
||||
} else {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '') return null
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null
|
||||
return defaultV.split(',')[0]
|
||||
}
|
||||
},
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div style="height: 100%">
|
||||
<time-default v-if="element.formatInfo.openMode === '0'" :ref="element.id" :element="element" />
|
||||
<time-default v-if="element.formatInfo.openMode === '0'" :ref="element.id" :element="element" />
|
||||
|
||||
<time-elec v-if="element.formatInfo.openMode === '1'" :ref="element.id" :element="element" />
|
||||
<time-elec v-if="element.formatInfo.openMode === '1'" :ref="element.id" :element="element" />
|
||||
|
||||
<time-simple v-if="element.formatInfo.openMode === '2'" :ref="element.id" :element="element" />
|
||||
<time-simple v-if="element.formatInfo.openMode === '2'" :ref="element.id" :element="element" />
|
||||
|
||||
<time-complex v-if="element.formatInfo.openMode === '3'" :ref="element.id" :element="element" />
|
||||
<time-complex v-if="element.formatInfo.openMode === '3'" :ref="element.id" :element="element" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -134,10 +134,14 @@ export default {
|
||||
tabList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'curComponent'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
curComponent: {
|
||||
handler(newVal, oldVla) {
|
||||
console.log(newVal)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
@ -147,11 +151,6 @@ export default {
|
||||
this.tabList = this.element.options && this.element.options.tabList
|
||||
this.activeTabName = this.tabList[0].name
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'curComponent'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
beforeHandleCommond(item, param) {
|
||||
return {
|
||||
@ -244,7 +243,8 @@ export default {
|
||||
this.styleChange()
|
||||
},
|
||||
|
||||
addNewTab() {
|
||||
addNewTab(componentId) {
|
||||
if (!componentId || componentId !== this.element.id) return
|
||||
const curName = uuid.v1()
|
||||
const tab = {
|
||||
title: 'NewTab',
|
||||
|
@ -44,7 +44,7 @@ export default {
|
||||
},
|
||||
formatDate() {
|
||||
const weekArr = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
|
||||
let timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss'
|
||||
let timeFormat = this.element.formatInfo.timeFormat
|
||||
const showWeek = this.element.formatInfo.showWeek
|
||||
const showDate = this.element.formatInfo.showDate
|
||||
const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd'
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="clock" :style="{'--varBg': varBg}">
|
||||
<p class="date">{{ date }}</p>
|
||||
<p class="time" :style="{'fontSize': (parseInt(element.style.fontSize) * 3) + 'px'}">{{ time }}</p>
|
||||
<p v-if="time" class="time" :style="{'fontSize': (parseInt(element.style.fontSize) * 3) + 'px'}">{{ time }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -66,7 +66,7 @@ export default {
|
||||
},
|
||||
updateTime() {
|
||||
var cd = new Date()
|
||||
const timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss'
|
||||
const timeFormat = this.element.formatInfo.timeFormat
|
||||
const showWeek = this.element.formatInfo.showWeek
|
||||
const showDate = this.element.formatInfo.showDate
|
||||
const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd'
|
||||
@ -75,8 +75,12 @@ export default {
|
||||
nowDate = cd.format(dateFormat)
|
||||
}
|
||||
const nowWeek = this.week[cd.getDay()]
|
||||
if (timeFormat) {
|
||||
this.time = cd.format(timeFormat)
|
||||
} else {
|
||||
this.time = null
|
||||
}
|
||||
|
||||
this.time = cd.format(timeFormat)
|
||||
this.date = showWeek ? (nowDate + ' ' + nowWeek) : nowDate
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export default {
|
||||
this.timer = setInterval(this.canvass, 500)
|
||||
},
|
||||
canvass() {
|
||||
const timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss'
|
||||
const timeFormat = this.element.formatInfo.timeFormat
|
||||
const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd'
|
||||
const showWeek = this.element.formatInfo.showWeek
|
||||
const showDate = this.element.formatInfo.showDate
|
||||
@ -110,8 +110,10 @@ export default {
|
||||
} else {
|
||||
englishWeek = 'Saturday'
|
||||
}
|
||||
|
||||
const simpleTime = time.format(timeFormat)
|
||||
let simpleTime = ''
|
||||
if (timeFormat) {
|
||||
simpleTime = time.format(timeFormat)
|
||||
}
|
||||
let nowDate = ''
|
||||
if (showDate && dateFormat) {
|
||||
nowDate = time.format(dateFormat)
|
||||
|
@ -998,7 +998,8 @@ export default {
|
||||
logic_exp: 'Logic',
|
||||
enum_exp: 'Enum',
|
||||
pls_slc: 'Please Select',
|
||||
filter_exp: 'Filter Value'
|
||||
filter_exp: 'Filter Value',
|
||||
filter_type: 'Filter Type'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
|
||||
@ -1720,7 +1721,7 @@ export default {
|
||||
once_a_week: 'Once a week',
|
||||
once_a_month: 'Once a month',
|
||||
complex_repeat: 'Complex repeat',
|
||||
pixel_tip: 'Please select'
|
||||
pixel_tip: 'Please code custom pixel(such as 2560 * 1600) or select'
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -996,9 +996,10 @@ export default {
|
||||
and: '與',
|
||||
or: '或',
|
||||
logic_exp: '邏輯條件',
|
||||
enum_exp: '枚舉條件',
|
||||
enum_exp: '字段枚舉值',
|
||||
pls_slc: '請選擇',
|
||||
filter_exp: '過濾條件'
|
||||
filter_exp: '過濾值',
|
||||
filter_type: '過濾方式'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: '有多個 Sheet 頁,默認抽取第一個',
|
||||
@ -1732,7 +1733,7 @@ export default {
|
||||
once_a_week: '每周一次',
|
||||
once_a_month: '每月一次',
|
||||
complex_repeat: '複雜重複',
|
||||
pixel_tip: '可直接輸入分辨率或者選擇'
|
||||
pixel_tip: '可直接輸入分辨率(例如:2560 * 1600)或者選擇'
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -999,9 +999,10 @@ export default {
|
||||
and: '与',
|
||||
or: '或',
|
||||
logic_exp: '逻辑条件',
|
||||
enum_exp: '枚举条件',
|
||||
enum_exp: '字段枚举值',
|
||||
pls_slc: '请选择',
|
||||
filter_exp: '过滤条件'
|
||||
filter_exp: '过滤值',
|
||||
filter_type: '过滤方式'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
|
||||
@ -1742,7 +1743,7 @@ export default {
|
||||
once_a_week: '每周一次',
|
||||
once_a_month: '每月一次',
|
||||
complex_repeat: '复杂重复',
|
||||
pixel_tip: '可直接输入自定义分辨率或选择'
|
||||
pixel_tip: '可直接输入自定义分辨率(例如:2560 * 1600)或选择'
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ router.beforeEach(async(to, from, next) => {
|
||||
NProgress.done()
|
||||
} else {
|
||||
const hasGetUserInfo = store.getters.name
|
||||
if (hasGetUserInfo || to.path.indexOf('/preview/') > -1 || to.path.indexOf('/delink') > -1 || to.path.indexOf('/nolic') > -1) {
|
||||
if (hasGetUserInfo || to.path.indexOf('/previewScreenShot/') > -1 || to.path.indexOf('/preview/') > -1 || to.path.indexOf('/delink') > -1 || to.path.indexOf('/nolic') > -1) {
|
||||
next()
|
||||
store.dispatch('permission/setCurrentPath', to.path)
|
||||
} else {
|
||||
|
@ -82,7 +82,11 @@ export const constantRoutes = [
|
||||
component: () => import('@/components/canvas/components/Editor/PreviewEject'),
|
||||
hidden: true
|
||||
},
|
||||
|
||||
{
|
||||
path: '/previewScreenShot/:reportId/:backScreenShot',
|
||||
component: () => import('@/components/canvas/components/Editor/PreviewEject'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/previewFullScreen',
|
||||
component: () => import('@/components/canvas/components/Editor/PreviewFullScreen'),
|
||||
|
@ -140,12 +140,12 @@ const data = {
|
||||
setCurCanvasScale(state, curCanvasScale) {
|
||||
state.curCanvasScale = curCanvasScale
|
||||
},
|
||||
setPreviewCanvasScale(state, scaleWidth, scaleHeight) {
|
||||
if (scaleWidth) {
|
||||
state.previewCanvasScale.scalePointWidth = scaleWidth
|
||||
setPreviewCanvasScale(state, scale) {
|
||||
if (scale.scaleWidth) {
|
||||
state.previewCanvasScale.scalePointWidth = scale.scaleWidth
|
||||
}
|
||||
if (scaleHeight) {
|
||||
state.previewCanvasScale.scalePointHeight = scaleHeight
|
||||
if (scale.scaleHeight) {
|
||||
state.previewCanvasScale.scalePointHeight = scale.scaleHeight
|
||||
}
|
||||
},
|
||||
setShapeStyle({ curComponent, canvasStyleData, curCanvasScale }, { top, left, width, height, rotate }) {
|
||||
|
@ -13,7 +13,13 @@ export function baseMapOption(chart_option, chart) {
|
||||
if (customAttr.tooltip) {
|
||||
const tooltip = JSON.parse(JSON.stringify(customAttr.tooltip))
|
||||
const reg = new RegExp('\n', 'g')
|
||||
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
|
||||
const text = tooltip.formatter.replace(reg, '<br/>')
|
||||
tooltip.formatter = function(params) {
|
||||
const a = params.seriesName
|
||||
const b = params.name
|
||||
const c = params.value ? params.value : ''
|
||||
return text.replaceAll('{a}', a).replaceAll('{b}', b).replaceAll('{c}', c)
|
||||
}
|
||||
chart_option.tooltip = tooltip
|
||||
}
|
||||
}
|
||||
@ -22,13 +28,16 @@ export function baseMapOption(chart_option, chart) {
|
||||
chart_option.title.text = chart.title
|
||||
if (chart.data.series.length > 0) {
|
||||
chart_option.series[0].name = chart.data.series[0].name
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].radius = [customAttr.size.pieInnerRadius + '%', customAttr.size.pieOuterRadius + '%']
|
||||
}
|
||||
// label
|
||||
if (customAttr.label) {
|
||||
const text = customAttr.label.formatter
|
||||
chart_option.series[0].label = customAttr.label
|
||||
chart_option.series[0].label.formatter = function(params) {
|
||||
const a = params.seriesName
|
||||
const b = params.name
|
||||
const c = params.value ? params.value : ''
|
||||
return text.replaceAll('{a}', a).replaceAll('{b}', b).replaceAll('{c}', c)
|
||||
}
|
||||
chart_option.series[0].labelLine = customAttr.label.labelLine
|
||||
}
|
||||
// visualMap
|
||||
|
@ -122,12 +122,24 @@
|
||||
@scroll="canvasScroll"
|
||||
>
|
||||
<el-row class="this_mobile_canvas_top" />
|
||||
<el-row class="this_mobile_canvas_inner_top">
|
||||
{{ panelInfo.name }}
|
||||
</el-row>
|
||||
<el-row
|
||||
id="canvasInfoMobile"
|
||||
class="this_mobile_canvas_main"
|
||||
:style="mobileCanvasStyle"
|
||||
>
|
||||
<Editor ref="editorMobile" :matrix-count="mobileMatrixCount" :out-style="outStyle" :scroll-top="scrollTop" />
|
||||
<Editor v-if="mobileEditorShow" ref="editorMobile" :matrix-count="mobileMatrixCount" :out-style="outStyle" :scroll-top="scrollTop" />
|
||||
</el-row>
|
||||
<el-row class="this_mobile_canvas_inner_bottom">
|
||||
<el-col :span="12">
|
||||
<i v-if="!hasStar" class="el-icon-star-off" size="mini" @click="star" />
|
||||
<i v-if="hasStar" class="el-icon-star-on" style="color: #0a7be0;font-size: 18px" size="mini" @click="unstar" />
|
||||
</el-col>
|
||||
<el-col :span="12" style="float: right">
|
||||
<i class="el-icon-refresh-right" size="mini" @click="mobileRefresh" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="this_mobile_canvas_bottom" />
|
||||
</div>
|
||||
@ -233,6 +245,7 @@ import generateID from '@/components/canvas/utils/generateID'
|
||||
import TextAttr from '@/components/canvas/components/TextAttr'
|
||||
import { queryPanelJumpInfo } from '@/api/panel/linkJump'
|
||||
import ComponentWait from '@/views/panel/edit/ComponentWait'
|
||||
import { deleteEnshrine, saveEnshrine, starStatus } from '@/api/panel/enshrine'
|
||||
|
||||
export default {
|
||||
name: 'PanelEdit',
|
||||
@ -256,6 +269,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
mobileEditorShow: true,
|
||||
hasStar: false,
|
||||
drawerSize: '300px',
|
||||
visible: false,
|
||||
show: false,
|
||||
@ -453,6 +468,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init(panelId) {
|
||||
this.initHasStar()
|
||||
// 如果临时画布有数据 则使用临时画布数据(视图编辑的时候 会保存临时画布数据)
|
||||
const componentDataTemp = this.$store.state.panel.componentDataTemp
|
||||
const canvasStyleDataTemp = this.$store.state.panel.canvasStyleDataTemp
|
||||
@ -512,6 +528,27 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
star() {
|
||||
this.panelInfo && saveEnshrine(this.panelInfo.id, false).then(res => {
|
||||
this.hasStar = true
|
||||
})
|
||||
},
|
||||
unstar() {
|
||||
this.panelInfo && deleteEnshrine(this.panelInfo.id, false).then(res => {
|
||||
this.hasStar = false
|
||||
})
|
||||
},
|
||||
initHasStar() {
|
||||
starStatus(this.panelInfo.id, false).then(res => {
|
||||
this.hasStar = res.data
|
||||
})
|
||||
},
|
||||
mobileRefresh() {
|
||||
this.mobileEditorShow = false
|
||||
this.$nextTick(() => {
|
||||
this.mobileEditorShow = true
|
||||
})
|
||||
},
|
||||
save() {
|
||||
|
||||
},
|
||||
@ -964,11 +1001,30 @@ export default {
|
||||
background-size:100% 100% !important;
|
||||
}
|
||||
|
||||
.this_mobile_canvas_inner_top{
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
background-color: #f7f8fa;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.this_mobile_canvas_top{
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.this_mobile_canvas_inner_bottom{
|
||||
background-color: #f7f8fa;
|
||||
line-height: 30px;
|
||||
vertical-align: middle;
|
||||
color: gray;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.this_mobile_canvas_bottom{
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
@ -977,7 +1033,7 @@ export default {
|
||||
.this_mobile_canvas_main{
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
height: calc(100% - 60px);;
|
||||
height: calc(100% - 120px);;
|
||||
background-color: #d7d9e3;
|
||||
background-size:100% 100% !important;
|
||||
}
|
||||
|
@ -4,11 +4,11 @@
|
||||
style="height: 100%;width: 100%;"
|
||||
:element-loading-text="$t('panel.export_loading')"
|
||||
element-loading-spinner="el-icon-loading"
|
||||
element-loading-background="rgba(0, 0, 0, 0.8)"
|
||||
element-loading-background="rgba(0, 0, 0, 1)"
|
||||
>
|
||||
<el-row class="export_body_class">
|
||||
<div id="exportPdf" ref="exportPdf">
|
||||
<div class="export_body_inner_class" v-html="templateContentChange" />
|
||||
<div id="exportPdf" ref="exportPdf" :style="mainCanvasStyle">
|
||||
<div class="export_body_inner_class" :style="templateHtmlStyle" v-html="templateContentChange" />
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row class="root_class">
|
||||
@ -26,6 +26,7 @@ import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
|
||||
|
||||
export default {
|
||||
name: 'PDFPreExport',
|
||||
components: { },
|
||||
props: {
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
panelName: {
|
||||
@ -43,6 +44,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
toExport: false,
|
||||
exportLoading: false,
|
||||
activeName: '',
|
||||
templateContentChange: '',
|
||||
@ -60,7 +62,26 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
mainCanvasStyle() {
|
||||
if (this.toExport) {
|
||||
return {
|
||||
width: '4096px'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
width: '100%'
|
||||
}
|
||||
}
|
||||
},
|
||||
templateHtmlStyle() {
|
||||
if (this.toExport) {
|
||||
return {
|
||||
fontSize: '48px!important'
|
||||
}
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
templateContent(newVal, oldVla) {
|
||||
@ -92,19 +113,22 @@ export default {
|
||||
const _this = this
|
||||
_this.exportLoading = true
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('exportPdf')).then(function(canvas) {
|
||||
_this.exportLoading = false
|
||||
const contentWidth = canvas.width
|
||||
const contentHeight = canvas.height
|
||||
const pageData = canvas.toDataURL('image/jpeg', 1.0)
|
||||
const lp = contentWidth > contentHeight ? 'l' : 'p'
|
||||
const PDF = new JsPDF(lp, 'pt', [contentWidth, contentHeight])
|
||||
PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
|
||||
PDF.save(_this.panelName + '.pdf')
|
||||
_this.$emit('closePreExport')
|
||||
}
|
||||
)
|
||||
}, 50)
|
||||
_this.toExport = true
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('exportPdf')).then(function(canvas) {
|
||||
_this.exportLoading = false
|
||||
const contentWidth = canvas.width
|
||||
const contentHeight = canvas.height
|
||||
const pageData = canvas.toDataURL('image/jpeg', 1.0)
|
||||
const lp = contentWidth > contentHeight ? 'l' : 'p'
|
||||
const PDF = new JsPDF(lp, 'pt', [contentWidth, contentHeight])
|
||||
PDF.addImage(pageData, 'JPEG', 0, 0, contentWidth, contentHeight)
|
||||
PDF.save(_this.panelName + '.pdf')
|
||||
_this.$emit('closePreExport')
|
||||
}
|
||||
)
|
||||
}, 1500)
|
||||
}, 500)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
style="height: 100%;width: 100%;"
|
||||
:element-loading-text="$t('panel.data_loading')"
|
||||
element-loading-spinner="el-icon-loading"
|
||||
element-loading-background="rgba(0, 0, 0, 0.8)"
|
||||
element-loading-background="rgba(0, 0, 0, 1)"
|
||||
>
|
||||
<el-col v-if="panelInfo.name.length>0" class="panel-design">
|
||||
|
||||
@ -73,9 +73,10 @@
|
||||
</el-row>
|
||||
<!-- 仪表板预览区域-->
|
||||
<el-row class="panel-design-preview">
|
||||
<div id="imageWrapper" ref="imageWrapper" style="width: 100%;height: 100%">
|
||||
<!-- <div id="imageWrapper" ref="imageWrapper" style="width: 4096px;height: 2160px">-->
|
||||
<div id="imageWrapper" ref="imageWrapper" :style="imageWrapperStyle">
|
||||
<fullscreen style="height: 100%;background: #f7f8fa;overflow-y: auto" :fullscreen.sync="fullscreen">
|
||||
<Preview v-if="showMain" :in-screen="!fullscreen" :show-type="'width'" :screen-shot="dataLoading" />
|
||||
<Preview v-if="showMainFlag" :in-screen="!fullscreen" :show-type="'width'" :screen-shot="dataLoading" />
|
||||
</fullscreen>
|
||||
</div>
|
||||
</el-row>
|
||||
@ -129,6 +130,7 @@ import { starStatus, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
|
||||
import bus from '@/utils/bus'
|
||||
import { queryAll } from '@/api/panel/pdfTemplate'
|
||||
import ShareHead from '@/views/panel/GrantAuth/ShareHead'
|
||||
import JsPDF from 'jspdf'
|
||||
|
||||
export default {
|
||||
name: 'PanelViewShow',
|
||||
@ -154,10 +156,27 @@ export default {
|
||||
pdfExportShow: false,
|
||||
snapshotInfo: '',
|
||||
showType: 0,
|
||||
dataLoading: false
|
||||
dataLoading: false,
|
||||
exporting: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
imageWrapperStyle() {
|
||||
if (this.exporting) {
|
||||
return {
|
||||
width: '4096px',
|
||||
height: '2160px'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
}
|
||||
}
|
||||
},
|
||||
showMainFlag() {
|
||||
return this.showMain
|
||||
},
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
@ -252,17 +271,24 @@ export default {
|
||||
},
|
||||
|
||||
downloadAsPDF() {
|
||||
// this.pdfExportShow = true
|
||||
//
|
||||
this.dataLoading = true
|
||||
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
|
||||
const snapshot = canvas.toDataURL('image/jpeg', 1) // 是图片质量
|
||||
this.dataLoading = false
|
||||
if (snapshot !== '') {
|
||||
this.snapshotInfo = snapshot
|
||||
this.pdfExportShow = true
|
||||
}
|
||||
})
|
||||
}, 50)
|
||||
this.exporting = true
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
|
||||
const snapshot = canvas.toDataURL('image/jpeg', 1) // 是图片质量
|
||||
this.dataLoading = false
|
||||
this.exporting = false
|
||||
if (snapshot !== '') {
|
||||
this.snapshotInfo = snapshot
|
||||
this.pdfExportShow = true
|
||||
}
|
||||
})
|
||||
}, 1500)
|
||||
}, 500)
|
||||
},
|
||||
refreshTemplateInfo() {
|
||||
this.templateInfo = {}
|
||||
|
Loading…
Reference in New Issue
Block a user