提交 c138342c authored 作者: taojinlong's avatar taojinlong

Merge branch 'dev' of github.com:dataease/dataease into dev

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