!126 update 1.1.0

Merge pull request !126 from Foming/dev
Foming 1 year ago committed by Gitee
commit c91ae79775
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -34,6 +34,7 @@ module.exports = {
collapsable: false, collapsable: false,
children: [ children: [
{title: 'V1.0.0', path: '/guide/releases/1.0.0'}, {title: 'V1.0.0', path: '/guide/releases/1.0.0'},
{title: 'V1.1.0', path: '/guide/releases/1.1.0'},
] ]
}, },
{ {

@ -54,6 +54,20 @@
当超链接和视频链接无效的时候,请尝试使用内联框架。 <br> 当超链接和视频链接无效的时候,请尝试使用内联框架。 <br>
## 样式组件
### 边框
![img42](../picture/charts/img_42.png) <br>
### 装饰
![img43](../picture/charts/img_43.png) <br>
### 装饰饼图
![img12](../picture/charts/img_12.png) <br>
## 柱状图 ## 柱状图
### 柱状图 ### 柱状图
@ -265,13 +279,6 @@
**如有问题,请提交 [Issue](https://gitee.com/anji-plus/report/issues) <br>** **如有问题,请提交 [Issue](https://gitee.com/anji-plus/report/issues) <br>**
## 装饰图
### 装饰饼图
装饰用,可单独使用或者配合文本框等图表组件来使整个大屏立体、丰满。<br>
![img12](../picture/charts/img_12.png) <br>
## 词云图 ## 词云图
### 词云图 ### 词云图

@ -1,12 +1,38 @@
## 简要说明 ## 简要说明
现有系统联动的本质是数据集查询参数“示例值”的替换, 现在联动有两种。<br> 现有系统联动的本质是数据集查询参数“示例值”的替换, 现在联动有两种。<br>
除下文介绍的示例外,还可去数据集、体验地址去查看示例。<br>
- 表单联动 <br> - 表单联动 <br>
目前支持的有下拉框、时间筛选器。<br> 目前支持的有下拉框、时间筛选器。<br>
V1.0.0 支持被联动的组件有:<br>
- 文本栏 - V1.1.0
- 文本
- 滚动文本
- 表格
- 柱状图(包含全部)
- 折线图(包含全部)
- 柱线图(包含全部)
- 饼图(包含全部)
- 漏斗图(包含全部)
- 百分比(包含全部)-V1.1.0
- 中国地图(包含全部)
- 词云图(包含全部)-V1.1.0
- 热力图(包含全部)
- 雷达图(包含全部)
- 刻度尺(包含全部)-V1.1.0
- 图表联动:<br> - 图表联动:<br>
目前联动主要集中在柱状图、折线图、饼图等这种二维图表二维图表是指图表只支持2个字段的数据集当然并不是说需要3个字段的堆叠图柱状/折线)不支持联动,而是这种三维图表去联动二维图表会带来一些问题,反之二维的去联动三维的同样存在问题,因此目前源代码中只添加了部分二维图表的联动。<br> 目前联动主要集中在柱状图、折线图、饼图等这种二维图表二维图表是指图表只支持2个字段的数据集当然并不是说需要3个字段的堆叠图柱状/折线)不支持联动,而是这种三维图表去联动二维图表会带来一些问题,反之二维的去联动三维的同样存在问题,因此目前源代码中只添加了部分二维图表的联动。<br>
V1.0.0 支持联动的组件有:<br>
- 柱状图
- 柱状图
- 柱状图-渐变色
- 折线图
- 折线图
- 饼图
- 饼图
- 南丁格尔玫瑰图
**注:** **注:**
没有多级联动联动都是一对一的。例如时间筛选器绑定了A柱图A柱图绑定了B饼图当使用时间筛选器更改时间后只会更新绑定的A柱图A绑定的B饼图并不会更新数据。<br> 没有多级联动联动都是一对一的。例如时间筛选器绑定了A柱图A柱图绑定了B饼图当使用时间筛选器更改时间后只会更新绑定的A柱图A绑定的B饼图并不会更新数据。<br>

@ -51,9 +51,12 @@
自定义JS这里的JS是java的scriptengine执行的支持ES5的写法。 自定义JS这里的JS是java的scriptengine执行的支持ES5的写法。
- 示例一 <br>
返回yyyyy-MM-dd类型的当前时间
```js ```js
//返回yyyyy-MM-dd类型的当前时间 // 返回yyyyy-MM-dd类型的当前时间
function verification(data){ function verification(data) {
//自定义脚本内容 //自定义脚本内容
//获取当前时间 //获取当前时间
var date = new Date(); var date = new Date();
@ -71,6 +74,31 @@ function verification(data){
} }
``` ```
- 示例二 <br>
不传参则查询全部
```sql
// sql可以这么写
SELECT DATE_FORMAT(create_time, '%Y-%m-%d') create_time, sum(nums) sum_nums
FROM aj_report_city ${city_name}
group by create_time;
```
```js
// 不传参则查询全部
function verification(data) {
// 获取示例值
data = data.sampleItem;
if (data == null || data == '') {
return ''
}
data = 'where city_name = "' + data + '" '
return data;
}
```
**注:** 当前V1.0.0版本示例值是不可为空的,所以实际使用可能会麻烦点
### 数据转换 ### 数据转换
数据转换是在执行完 sql 之后进行的数据清洗操作。 数据转换是在执行完 sql 之后进行的数据清洗操作。
@ -82,11 +110,11 @@ function verification(data){
```js ```js
// 根据sql查询出的结果进行数据清洗 // 根据sql查询出的结果进行数据清洗
function dataTransform(data){ function dataTransform(data) {
//自定义脚本内容 //自定义脚本内容
//1.遍历测试预览中的java.util.ArrayList<java.lang.Object> //1.遍历测试预览中的java.util.ArrayList<java.lang.Object>
for(j = 0, len = data.length; j < len; j++){ for (j = 0, len = data.length; j < len; j++) {
//获取一行数据 //获取一行数据
var row = data[j] var row = data[j]
//比如对brand字段进行拆分,例如A-100B-50 //比如对brand字段进行拆分,例如A-100B-50

@ -0,0 +1,24 @@
## 注意事项
- 之前版本更新至本版本时,可能会遇到图表不显示静态、动态数据,需对该图表重新配置;如果已对旧版本进行二次开发,请谨慎更新。<br>
跨版本更新可查对应版本的[releases](https://gitee.com/anji-plus/report/releases)。<br>
## 新增/优化
- 1、引入datav依赖新增样式组件装饰边框+装饰图 贡献人wenqindong@wenqindong
- 2、大屏图表-文本组件增加对多行的支持 贡献人StefanZhu@stefanZhu
- 3、Excel报表支持pdf导出 贡献人:陈旭光@chen-xuguang
- 4、大屏文本栏组件-文本、滚动文本、表格支持被联动
- 5、大屏刻度尺组件-被联动,词云组件-被联动,仪表盘被联动
## 修复
- 1、部分图表的副标题和数值设定颜色冲突
- 2、当数据集第一条数据中存在null值时被自动过滤导致未能解析
- 3、大屏图表-仪表盘的配置项冲突重复
- 4、大屏图片-饼图图例位置不正确问题
- 5、装饰饼图不显示问题
## 其他
- 1、文档更新

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@ -166,6 +166,18 @@
<version>3.0.9</version> <version>3.0.9</version>
</dependency> </dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>core-renderer</artifactId>
<version>R8</version>
</dependency>
<dependency>
<groupId>com.itextpdf.tool</groupId>
<artifactId>xmlworker</artifactId>
<version>5.5.13</version>
</dependency>
</dependencies> </dependencies>
<developers> <developers>

@ -1,8 +1,11 @@
package com.anjiplus.template.gaea.business.modules.dataset.service.impl; package com.anjiplus.template.gaea.business.modules.dataset.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.anji.plus.gaea.constant.Enabled; import com.anji.plus.gaea.constant.Enabled;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper; import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import com.anji.plus.gaea.exception.BusinessExceptionBuilder; import com.anji.plus.gaea.exception.BusinessExceptionBuilder;
@ -27,6 +30,7 @@ import com.anjiplus.template.gaea.business.util.JdbcConstants;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -39,10 +43,10 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @desc DataSet * @author Raod
* @author Raod * @desc DataSet
* @date 2021-03-18 12:11:31.150755900 * @date 2021-03-18 12:11:31.150755900
**/ **/
@Service @Service
//@RequiredArgsConstructor //@RequiredArgsConstructor
@Slf4j @Slf4j
@ -131,7 +135,7 @@ public class DataSetServiceImpl implements DataSetService {
JSONObject jsonObject = jsonArray.getJSONObject(0); JSONObject jsonObject = jsonArray.getJSONObject(0);
dto.setSetParamList(jsonObject.keySet()); dto.setSetParamList(jsonObject.keySet());
} catch (Exception e) { } catch (Exception e) {
log.error("error",e); log.error("error", e);
} }
} }
return dto; return dto;
@ -159,7 +163,7 @@ public class DataSetServiceImpl implements DataSetService {
Object o = objects.get(0); Object o = objects.get(0);
objects = new JSONArray(); objects = new JSONArray();
objects.add(o); objects.add(o);
dataSet.setCaseResult(objects.toJSONString()); dataSet.setCaseResult(JSON.toJSONString(objects, SerializerFeature.WriteMapNullValue));
} }
} catch (Exception e) { } catch (Exception e) {
log.info("结果集只保留一行数据失败...{}", e.getMessage()); log.info("结果集只保留一行数据失败...{}", e.getMessage());
@ -180,7 +184,7 @@ public class DataSetServiceImpl implements DataSetService {
* @param dto * @param dto
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void updateSet(DataSetDto dto) { public void updateSet(DataSetDto dto) {
List<DataSetParamDto> dataSetParamDtoList = dto.getDataSetParamDtoList(); List<DataSetParamDto> dataSetParamDtoList = dto.getDataSetParamDtoList();
List<DataSetTransformDto> dataSetTransformDtoList = dto.getDataSetTransformDtoList(); List<DataSetTransformDto> dataSetTransformDtoList = dto.getDataSetTransformDtoList();
@ -194,7 +198,7 @@ public class DataSetServiceImpl implements DataSetService {
Object o = objects.get(0); Object o = objects.get(0);
objects = new JSONArray(); objects = new JSONArray();
objects.add(o); objects.add(o);
dataSet.setCaseResult(objects.toJSONString()); dataSet.setCaseResult(JSON.toJSONString(objects, SerializerFeature.WriteMapNullValue));
} }
} catch (Exception e) { } catch (Exception e) {
log.info("结果集只保留一行数据失败...{}", e.getMessage()); log.info("结果集只保留一行数据失败...{}", e.getMessage());
@ -266,11 +270,11 @@ public class DataSetServiceImpl implements DataSetService {
String body = JSONObject.parseObject(dynSentence).getString("body"); String body = JSONObject.parseObject(dynSentence).getString("body");
if (StringUtils.isNotBlank(body)) { if (StringUtils.isNotBlank(body)) {
dynSentence = body; dynSentence = body;
}else { } else {
dynSentence = "{}"; dynSentence = "{}";
} }
}else { } else {
dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode()); dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode());
} }
@ -322,11 +326,11 @@ public class DataSetServiceImpl implements DataSetService {
String body = JSONObject.parseObject(dynSentence).getString("body"); String body = JSONObject.parseObject(dynSentence).getString("body");
if (StringUtils.isNotBlank(body)) { if (StringUtils.isNotBlank(body)) {
dynSentence = body; dynSentence = body;
}else { } else {
dynSentence = "{}"; dynSentence = "{}";
} }
}else { } else {
dataSource = dataSourceService.selectOne("source_code", sourceCode); dataSource = dataSourceService.selectOne("source_code", sourceCode);
} }
@ -374,7 +378,7 @@ public class DataSetServiceImpl implements DataSetService {
return dataSetMapper.selectList(wrapper); return dataSetMapper.selectList(wrapper);
} }
public void dataSetParamBatch(List<DataSetParamDto> dataSetParamDtoList,String setCode){ public void dataSetParamBatch(List<DataSetParamDto> dataSetParamDtoList, String setCode) {
dataSetParamService.delete( dataSetParamService.delete(
new QueryWrapper<DataSetParam>() new QueryWrapper<DataSetParam>()
.lambda() .lambda()
@ -396,7 +400,7 @@ public class DataSetServiceImpl implements DataSetService {
} }
public void dataSetTransformBatch(List<DataSetTransformDto> dataSetTransformDtoList,String setCode){ public void dataSetTransformBatch(List<DataSetTransformDto> dataSetTransformDtoList, String setCode) {
dataSetTransformService.delete( dataSetTransformService.delete(
new QueryWrapper<DataSetTransform>() new QueryWrapper<DataSetTransform>()
.lambda() .lambda()
@ -420,10 +424,11 @@ public class DataSetServiceImpl implements DataSetService {
/** /**
* dataSetParamDtoListmap * dataSetParamDtoListmap
*
* @param dataSetParamDtoList * @param dataSetParamDtoList
* @return * @return
*/ */
public Map<String, Object> setContextData(List<DataSetParamDto> dataSetParamDtoList){ public Map<String, Object> setContextData(List<DataSetParamDto> dataSetParamDtoList) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (null != dataSetParamDtoList && dataSetParamDtoList.size() > 0) { if (null != dataSetParamDtoList && dataSetParamDtoList.size() > 0) {
dataSetParamDtoList.forEach(dataSetParamDto -> map.put(dataSetParamDto.getParamName(), dataSetParamDto.getSampleItem())); dataSetParamDtoList.forEach(dataSetParamDto -> map.put(dataSetParamDto.getParamName(), dataSetParamDto.getSampleItem()));

@ -0,0 +1,20 @@
package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto;
import lombok.Data;
/**
* @author chenxg
* @date 2023/8/1 10:37
*/
@Data
public class CellStyleDto {
/**
*
*/
private String fa;
/**
*
*/
private String t;
}

@ -0,0 +1,42 @@
package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto;
import lombok.Data;
/**
* @author chenxg
* @date 2023/8/1 10:37
*/
@Data
public class CommentDto {
/**
*
*/
private int left;
/**
*
*/
private int top;
/**
*
*/
private int width;
/**
*
*/
private int height;
/**
*
*/
private String value;
/**
*
*/
private boolean isshow;
}

@ -5,6 +5,7 @@ import com.anji.plus.gaea.curd.dto.GaeaBaseDTO;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
@ -58,4 +59,9 @@ public class ReportExcelDto extends GaeaBaseDTO implements Serializable {
*/ */
private String exportType; private String exportType;
/**
*
*/
private String rowDatas;
} }

@ -0,0 +1,97 @@
package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto;
import com.anji.plus.gaea.curd.dto.GaeaBaseDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @author chenxg
* @date 2023/8/1 10:37
*/
@Data
public class ReportExcelStyleDto extends GaeaBaseDTO implements Serializable {
/**
*
*/
private CellStyleDto ct;
/**
*
*/
private String v;
/**
*
*/
private String m;
/**
*
*/
private String bg;
/**
*
*/
private String ff;
/**
*
*/
private String fc;
/**
*
*/
private boolean bl;
/**
*
*/
private boolean it;
/**
*
*/
private int fs;
/**
* 线
*/
private boolean cl;
/**
*
*/
private int ht;
/**
*
*/
private int vt;
/**
*
*/
private int tr;
/**
*
*/
private int tb;
/**
*
*/
private CommentDto ps;
/**
*
*/
private String f;
}

@ -19,29 +19,40 @@ import com.anjiplus.template.gaea.business.modules.file.service.GaeaFileService;
import com.anjiplus.template.gaea.business.modules.report.dao.ReportMapper; import com.anjiplus.template.gaea.business.modules.report.dao.ReportMapper;
import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report; import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report;
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelDto; import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelDto;
import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelStyleDto;
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.ReportExcelMapper; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.ReportExcelMapper;
import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel;
import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService; import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService;
import com.anjiplus.template.gaea.business.modules.reportexcel.util.CellType; import com.anjiplus.template.gaea.business.modules.reportexcel.util.CellType;
import com.anjiplus.template.gaea.business.modules.reportexcel.util.XlsUtil; import com.anjiplus.template.gaea.business.modules.reportexcel.util.XlsUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itextpdf.text.*;
import com.itextpdf.text.Font;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.tool.xml.XMLWorkerHelper;
import com.lowagie.text.DocumentException;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.xhtmlrenderer.pdf.ITextRenderer;
import java.io.File; import java.io.*;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* TODO * TODO
@ -136,16 +147,33 @@ public class ReportExcelServiceImpl implements ReportExcelService {
@Override @Override
public Boolean exportExcel(ReportExcelDto reportExcelDto) { public Boolean exportExcel(ReportExcelDto reportExcelDto) {
logger.error("导出...");
exportExcelCore(reportExcelDto);
return true;
}
/**
* Excel
*/
public void exportExcelCore(ReportExcelDto reportExcelDto)
{
String reportCode = reportExcelDto.getReportCode(); String reportCode = reportExcelDto.getReportCode();
String exportType = reportExcelDto.getExportType(); String exportType = reportExcelDto.getExportType();
logger.error("导出..."); List<List<ReportExcelStyleDto>> reportExcelStyleList = new ArrayList<>();
if (exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_EXCEL.getCodeValue())) { JSONObject rowData= JSON.parseObject(reportExcelDto.getRowDatas());
// 将JSONObject对象转换为列表
List<Integer> dataNumList = rowData.keySet().stream().map(Integer::parseInt).sorted().collect(Collectors.toList());
for (Integer i : dataNumList) {
JSONArray jsonArray = rowData.getJSONArray(i.toString());
List<ReportExcelStyleDto> reportExcelStyleDtos = jsonArray.toJavaList(ReportExcelStyleDto.class);
reportExcelStyleList.add(reportExcelStyleDtos);
}
ReportExcelDto report = detailByReportCode(reportCode); ReportExcelDto report = detailByReportCode(reportCode);
reportExcelDto.setJsonStr(report.getJsonStr()); reportExcelDto.setJsonStr(report.getJsonStr());
String jsonStr = analysisReportData(reportExcelDto); String jsonStr = analysisReportData(reportExcelDto);
List<JSONObject> lists=(List<JSONObject> ) JSON.parse(jsonStr); List<JSONObject> lists=(List<JSONObject> ) JSON.parse(jsonStr);
OutputStream out = null; OutputStream out = null;
File file = null; File file = null;
File pdfFile = null;
try { try {
String fileName = report.getReportCode(); String fileName = report.getReportCode();
File dir = new File(dictPath + ZIP_PATH); File dir = new File(dictPath + ZIP_PATH);
@ -156,7 +184,17 @@ public class ReportExcelServiceImpl implements ReportExcelService {
file = new File(filePath); file = new File(filePath);
out = Files.newOutputStream(Paths.get(filePath)); out = Files.newOutputStream(Paths.get(filePath));
XlsUtil.exportXlsFile(out, true, lists); XlsUtil.exportXlsFile(out, true, lists);
if (exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_EXCEL.getCodeValue())) {
gaeaFileService.upload(file); gaeaFileService.upload(file);
}
else if(exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_PDF.getCodeValue()))
{
// 将Excel文件转换为PDF
String pdfFileName = fileName + ".pdf";
String pdfFilePath = dir.getAbsolutePath() + File.separator + pdfFileName;
pdfFile = convertExcelToPdf(filePath, pdfFilePath,reportExcelStyleList);
gaeaFileService.upload(pdfFile);
}
} catch (IOException e) { } catch (IOException e) {
logger.error("导出失败", e); logger.error("导出失败", e);
@ -164,15 +202,231 @@ public class ReportExcelServiceImpl implements ReportExcelService {
try { try {
out.close(); out.close();
file.delete(); file.delete();
if(!Objects.isNull(pdfFile))
{
pdfFile.delete();
}
} catch (IOException e) { } catch (IOException e) {
throw BusinessExceptionBuilder.build(ResponseCode.FILE_OPERATION_FAILED, e.getMessage()); throw BusinessExceptionBuilder.build(ResponseCode.FILE_OPERATION_FAILED, e.getMessage());
} }
} }
} }
return true; // 将Excel文件转换为PDF
public File convertExcelToPdf(String excelFilePath, String pdfFilePath, List<List<ReportExcelStyleDto>> reportExcelStyleList) {
try {
// 读取Excel文件
Workbook workbook = new XSSFWorkbook(excelFilePath);
Sheet sheet = workbook.getSheetAt(0);
// 创建PDF文档
Document document = new Document(PageSize.A4);
PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(pdfFilePath));
document.open();
// 创建PDF表格
PdfPTable table = new PdfPTable(sheet.getRow(0).getLastCellNum());
table.setWidthPercentage(100);
// 设置中文字体
BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font font = new Font(baseFont, 10, Font.NORMAL);
// 设置表头
Row headerRow = sheet.getRow(0);
for (int i = 0; i < headerRow.getLastCellNum(); i++) {
Cell headerCell = headerRow.getCell(i);
// 获取单元格样式
PdfPCell tableCell = new PdfPCell();
tableCell.setPhrase(new Phrase(getStringValue(headerCell), font));
ReportExcelStyleDto reportExcelStyleDto = reportExcelStyleList.get(0).get(i);
if(!Objects.isNull(reportExcelStyleDto))
{
processCellStyle(reportExcelStyleDto,tableCell,font);
}
table.addCell(tableCell);
} }
// 遍历Excel表格的行和列
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
if (row == null) {
// 如果行为空创建一个空的行并添加到PDF表格中
row = sheet.createRow(i);
}
for (int j = 0; j < headerRow.getLastCellNum(); j++) {
Cell cell = row.getCell(j, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
if (cell.getCellType() == org.apache.poi.ss.usermodel.CellType.BLANK) {
cell.setCellValue(" ");
}
PdfPCell tableCell = new PdfPCell();
tableCell.setPhrase(new Phrase(getStringValue(cell), font));
ReportExcelStyleDto reportExcelStyleDto = reportExcelStyleList.get(i).get(j);
if(!Objects.isNull(reportExcelStyleDto))
{
processCellStyle(reportExcelStyleDto,tableCell,font);
}
table.addCell(tableCell);
}
}
// 将表格添加到PDF文档中
document.add(table);
document.close();
workbook.close();
System.out.println("Excel转换为PDF成功");
return new File(pdfFilePath);
} catch (IOException e) {
e.printStackTrace();
} catch (com.itextpdf.text.DocumentException e) {
e.printStackTrace();
}
return null;
}
/**
* pdf
* @param tableCell
*/
public void processCellStyle(ReportExcelStyleDto reportExcelStyleDto,PdfPCell tableCell,Font font)
{
// 处理单元格背景颜色
String bg = reportExcelStyleDto.getBg();
java.awt.Color color = null;
if(!Objects.isNull(bg))
{
color = parseRGB(bg);
tableCell.setBackgroundColor(new BaseColor(color.getRed(), color.getGreen(), color.getBlue()));
}
// 处理字体
String fc = reportExcelStyleDto.getFc();
Integer fs = reportExcelStyleDto.getFs();
String ff = reportExcelStyleDto.getFf();
Boolean bl = reportExcelStyleDto.isBl();
Boolean it = reportExcelStyleDto.isIt();
Boolean cl = reportExcelStyleDto.isCl();
Integer ht = reportExcelStyleDto.getHt();
Integer vt = reportExcelStyleDto.getVt();
// 设置字体颜色
if(!Objects.isNull(fc))
{
color = parseRGB(fc);
font.setColor(new BaseColor(color.getRed(), color.getGreen(), color.getBlue()));
}
// 设置字体
if(!Objects.isNull(ff) && !Objects.equals("0",ff))
{
font.setFamily(ff.toString());
}
// 设置字体大小
if(!Objects.isNull(fs) && !Objects.equals(0,fs))
{
font.setSize(fs);
}
// 设置字体加粗
if(Objects.equals(Boolean.TRUE,bl))
{
font.setStyle(Font.BOLD);
}
// 设置字体斜体
if(Objects.equals(Boolean.TRUE,it))
{
font.setStyle(Font.ITALIC);
}
// 设置字体加粗且斜体
if(Objects.equals(Boolean.TRUE,bl) && Objects.equals(Boolean.TRUE,it))
{
font.setStyle(Font.BOLDITALIC);
}
// 是否删除线
if(Objects.equals(Boolean.TRUE,cl))
{
// 如果是粗体且斜体
if (font.getStyle() == Font.BOLDITALIC)
{
font.setStyle(Font.BOLDITALIC | Font.STRIKETHRU);
}
// 如果是粗体
else if(font.getStyle() == Font.BOLD)
{
font.setStyle(Font.BOLD | Font.STRIKETHRU);
}
// 如果是斜体
else if(font.getStyle() == Font.ITALIC)
{
font.setStyle(Font.ITALIC | Font.STRIKETHRU);
}
else
{
font.setStyle(Font.STRIKETHRU);
}
}
// 水平对齐
if(!Objects.isNull(ht))
{
if(Objects.equals(ht,0))
{
tableCell.setHorizontalAlignment(Element.ALIGN_CENTER);
}
else if(Objects.equals(ht,1))
{
tableCell.setHorizontalAlignment(Element.ALIGN_LEFT);
}
else if(Objects.equals(ht,2))
{
tableCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
}
}
// 垂直对齐
if(!Objects.isNull(vt))
{
if(Objects.equals(ht,0))
{
tableCell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
}
else if(Objects.equals(ht,1))
{
tableCell.setVerticalAlignment(Element.ALIGN_TOP);
}
else if(Objects.equals(ht,2))
{
tableCell.setVerticalAlignment(Element.ALIGN_BOTTOM);
}
}
Phrase phrase = tableCell.getPhrase();
tableCell.setPhrase(new Paragraph(phrase.getContent(), font));
//处理字体
tableCell.setBorderColor(BaseColor.BLACK);
}
public static java.awt.Color parseRGB(String rgb) {
try {
String[] components = rgb.substring(rgb.indexOf("(") + 1, rgb.indexOf(")")).split(",");
int red = Integer.parseInt(components[0].trim());
int green = Integer.parseInt(components[1].trim());
int blue = Integer.parseInt(components[2].trim());
return new java.awt.Color(red, green, blue);
} catch (Exception e) {
e.printStackTrace();
return null; // 解析失败返回null
}
}
private String getStringValue(Cell cell) {
if (cell == null)
return "";
else
return cell.toString();
}
/** /**
* *
*/ */

@ -13,6 +13,7 @@
}, },
"dependencies": { "dependencies": {
"@ckeditor/ckeditor5-build-decoupled-document": "^23.1.0", "@ckeditor/ckeditor5-build-decoupled-document": "^23.1.0",
"@jiaminghi/data-view": "^2.10.0",
"@smallwei/avue": "^2.8.23", "@smallwei/avue": "^2.8.23",
"axios": "0.18.0", "axios": "0.18.0",
"chokidar": "^3.5.2", "chokidar": "^3.5.2",

@ -22,7 +22,9 @@ import 'echarts/lib/component/tooltip'
//import 'echarts-liquidfill' //import 'echarts-liquidfill'
// import 'echarts-gl' // import 'echarts-gl'
Vue.component('v-chart', ECharts) Vue.component('v-chart', ECharts)
// 全局引入datav
import dataV from '@jiaminghi/data-view'
Vue.use(dataV)
// anji component // anji component
import anjiCrud from '@/components/AnjiPlus/anji-crud/anji-crud' import anjiCrud from '@/components/AnjiPlus/anji-crud/anji-crud'
import anjiSelect from '@/components/AnjiPlus/anji-select' import anjiSelect from '@/components/AnjiPlus/anji-select'

@ -65,7 +65,7 @@
:style="{ width: widthLeftForToolsHideButton + 'px' }" :style="{ width: widthLeftForToolsHideButton + 'px' }"
@click="toolIsShow = !toolIsShow" @click="toolIsShow = !toolIsShow"
> >
<i class="el-icon-arrow-right" /> <i class="el-icon-arrow-right"/>
</div> </div>
<div <div
@ -130,7 +130,7 @@
content="缩小" content="缩小"
placement="bottom" placement="bottom"
> >
<i class="el-icon-minus" style="font-size: 16px" /> <i class="el-icon-minus" style="font-size: 16px"/>
</el-tooltip> </el-tooltip>
</span> </span>
<span <span
@ -165,7 +165,7 @@
content="放大" content="放大"
placement="bottom" placement="bottom"
> >
<i class="el-icon-plus" style="font-size: 16px" /> <i class="el-icon-plus" style="font-size: 16px"/>
</el-tooltip> </el-tooltip>
</span> </span>
@ -349,7 +349,7 @@
</template> </template>
<script> <script>
import { widgetTools, getToolByCode } from "./tools/index"; import {widgetTools, getToolByCode} from "./tools/index";
import mixin from "@/utils/screenMixins"; import mixin from "@/utils/screenMixins";
import widget from "./widget/widget.vue"; import widget from "./widget/widget.vue";
import dynamicForm from "./components/dynamicForm.vue"; import dynamicForm from "./components/dynamicForm.vue";
@ -598,6 +598,8 @@ export default {
return widgetJson; return widgetJson;
}, },
setWidgetConfigValue(config, configValue) { setWidgetConfigValue(config, configValue) {
//
if (config) {
config.forEach((item) => { config.forEach((item) => {
if (this.isObjectFn(item)) { if (this.isObjectFn(item)) {
configValue[item.name] = item.value; configValue[item.name] = item.value;
@ -610,6 +612,7 @@ export default {
}); });
} }
}); });
}
}, },
layerClick(index) { layerClick(index) {
this.widgetIndex = index; this.widgetIndex = index;

@ -593,7 +593,7 @@ export const widgetBarCompare = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -631,12 +631,12 @@ export const widgetBarDoubleYaxis = {
], ],
}, },
{ {
name: '折线数值设定', name: '数值设定',
list: [ list: [
{ {
type: 'el-switch', type: 'el-switch',
label: '显示', label: '显示',
name: 'isShowLine', name: 'isShow',
required: false, required: false,
placeholder: '', placeholder: '',
value: false value: false
@ -644,7 +644,7 @@ export const widgetBarDoubleYaxis = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '距离', label: '距离',
name: 'distanceLine', name: 'distance',
required: false, required: false,
placeholder: '', placeholder: '',
value: 5 value: 5
@ -652,7 +652,7 @@ export const widgetBarDoubleYaxis = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字体字号', label: '字体字号',
name: 'fontSizeLine', name: 'fontSize',
required: false, required: false,
placeholder: '', placeholder: '',
value: 14 value: 14
@ -660,7 +660,7 @@ export const widgetBarDoubleYaxis = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColorLine', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'
@ -668,58 +668,7 @@ export const widgetBarDoubleYaxis = {
{ {
type: 'el-select', type: 'el-select',
label: '字体粗细', label: '字体粗细',
name: 'fontWeightLine', name: 'fontWeight',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'bold', name: '粗体' },
{ code: 'bolder', name: '特粗体' },
{ code: 'lighter', name: '细体' }
],
value: 'normal'
},
],
},
{
name: '柱体数值设定',
list: [
{
type: 'el-switch',
label: '显示',
name: 'isShowBar',
required: false,
placeholder: '',
value: false
},
{
type: 'el-input-number',
label: '距离',
name: 'distanceBar',
required: false,
placeholder: '',
value: 5
},
{
type: 'el-input-number',
label: '字体字号',
name: 'fontSizeBar',
required: false,
placeholder: '',
value: 14
},
{
type: 'vue-color',
label: '字体颜色',
name: 'subTextColorBar',
required: false,
placeholder: '',
value: '#fff'
},
{
type: 'el-select',
label: '字体粗细',
name: 'fontWeightBar',
required: false, required: false,
placeholder: '', placeholder: '',
selectOptions: [ selectOptions: [

@ -547,7 +547,7 @@ export const widgetBarStack = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -469,7 +469,7 @@ export const widgetBarchart = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -445,7 +445,7 @@ export const widgetGradientBarchart = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -376,7 +376,7 @@ export const widgetHeatmap = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -656,7 +656,7 @@ export const widgetLineCompare = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -579,7 +579,7 @@ export const widgetLineStack = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -489,7 +489,7 @@ export const widgetLinechart = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -233,6 +233,14 @@ export const widgetGauge = {
placeholder: '', placeholder: '',
value: 0, value: 0,
}, },
{
type: 'vue-color',
label: '颜色',
name: 'labelColor',
required: false,
placeholder: '',
value: '#fff',
},
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字号', label: '字号',
@ -242,12 +250,31 @@ export const widgetGauge = {
value: 10, value: 10,
}, },
{ {
type: 'vue-color', type: 'el-select',
label: '颜色', label: '字体粗细',
name: 'labelColor', name: 'labelFontWeight',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff', selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'bold', name: '粗体' },
{ code: 'bolder', name: '特粗体' },
{ code: 'lighter', name: '细体' }
],
value: 'normal'
},
{
type: 'el-select',
label: '字体风格',
name: 'labelFontStyle',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'italic', name: 'italic斜体' },
{ code: 'oblique', name: 'oblique斜体' },
],
value: 'normal'
}, },
] ]
}, },
@ -257,7 +284,7 @@ export const widgetGauge = {
{ {
type: 'vue-color', type: 'vue-color',
label: '颜色', label: '颜色',
name: 'labelColor', name: 'detailColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff', value: '#fff',
@ -265,7 +292,7 @@ export const widgetGauge = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字号', label: '字号',
name: 'labelFontSize', name: 'detailFontSize',
require: false, require: false,
placeholder: '', placeholder: '',
value: 14, value: 14,
@ -273,7 +300,7 @@ export const widgetGauge = {
{ {
type: 'el-select', type: 'el-select',
label: '字体粗细', label: '字体粗细',
name: 'labelFontWeight', name: 'detailFontWeight',
required: false, required: false,
placeholder: '', placeholder: '',
selectOptions: [ selectOptions: [
@ -284,6 +311,19 @@ export const widgetGauge = {
], ],
value: 'normal' value: 'normal'
}, },
{
type: 'el-select',
label: '字体风格',
name: 'detailFontStyle',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'italic', name: 'italic斜体' },
{ code: 'oblique', name: 'oblique斜体' },
],
value: 'normal'
},
] ]
}, },
], ],

@ -162,18 +162,6 @@ export const widgetPiePercentage = {
value: '#173164' value: '#173164'
}, },
] ]
},
{
name: '组件联动',
list: [
{
type: 'componentLinkage',
label: '',
name: 'componentLinkage',
required: false,
value: []
}
]
} }
], ],
], ],

@ -210,7 +210,7 @@ export const widgetPieNightingale = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '' value: ''

@ -210,7 +210,7 @@ export const widgetPiechart = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '' value: ''

@ -387,7 +387,7 @@ export const widgetRadar = {
{ {
type: 'vue-color', type: 'vue-color',
label: '字体颜色', label: '字体颜色',
name: 'subTextColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: '#fff'

@ -0,0 +1,74 @@
/**
* author:wenqindong
* date:2023-05-31
*/
let selectOptions = []
for(let i=1;i<14;i++){
selectOptions.push({code: 'dv-border-Box-'+i, name: '样式'+i})
}
export const widgetBorder = {
code: 'widget-border',
type: 'border',
tabName: '样式组件',
label: '边框',
icon: 'icontupian1',
options: {
// 配置
setup: [
{
type: 'el-input-text',
label: '图层名称',
name: 'layerName',
required: false,
placeholder: '',
value: '边框',
},
{
type: 'el-select',
label: '样式',
name: 'showtype',
required: false,
placeholder: '',
selectOptions: selectOptions,
value: 'dv-border-Box-1'
},
],
// 数据
data: [],
// 坐标
position: [
{
type: 'el-input-number',
label: '左边距',
name: 'left',
required: false,
placeholder: '',
value: 0,
},
{
type: 'el-input-number',
label: '上边距',
name: 'top',
required: false,
placeholder: '',
value: 0,
},
{
type: 'el-input-number',
label: '宽度',
name: 'width',
required: false,
placeholder: '该容器在1920px大屏中的宽度',
value: 400,
},
{
type: 'el-input-number',
label: '高度',
name: 'height',
required: false,
placeholder: '该容器在1080px大屏中的高度',
value: 300,
},
],
}
}

@ -8,8 +8,8 @@
*/ */
export const widgetDecoratePie = { export const widgetDecoratePie = {
code: 'widgetDecoratePieChart', code: 'widgetDecoratePieChart',
type: 'decorate', type: 'border',
tabName: '装饰图', tabName: '样式组件',
label: '装饰饼图', label: '装饰饼图',
icon: 'iconicon_tubiao_bingtu', icon: 'iconicon_tubiao_bingtu',
options: { options: {
@ -407,6 +407,7 @@ export const widgetDecoratePie = {
}, },
], ],
], ],
data: [],
// 坐标 // 坐标
position: [ position: [
{ {

@ -0,0 +1,74 @@
/**
* author:wenqindong
* date:2023-05-31
*/
let selectOptions = []
for(let i=1;i<13;i++){
selectOptions.push({code: 'dv-decoration-'+i, name: '装饰'+i})
}
export const widgetDecoration = {
code: 'widget-decoration',
type: 'border',
tabName: '样式组件',
label: '装饰',
icon: 'icontupian1',
options: {
// 配置
setup: [
{
type: 'el-input-text',
label: '图层名称',
name: 'layerName',
required: false,
placeholder: '',
value: '装饰',
},
{
type: 'el-select',
label: '样式',
name: 'showtype',
required: false,
placeholder: '',
selectOptions: selectOptions,
value: 'dv-decoration-1'
},
],
// 数据
data: [],
// 坐标
position: [
{
type: 'el-input-number',
label: '左边距',
name: 'left',
required: false,
placeholder: '',
value: 0,
},
{
type: 'el-input-number',
label: '上边距',
name: 'top',
required: false,
placeholder: '',
value: 0,
},
{
type: 'el-input-number',
label: '宽度',
name: 'width',
required: false,
placeholder: '该容器在1920px大屏中的宽度',
value: 400,
},
{
type: 'el-input-number',
label: '高度',
name: 'height',
required: false,
placeholder: '该容器在1080px大屏中的高度',
value: 150,
},
],
}
}

@ -24,7 +24,7 @@ export const widgetText = {
value: '文本框', value: '文本框',
}, },
{ {
type: 'el-input-text', type: 'el-input-textarea',
label: '文本内容', label: '文本内容',
name: 'text', name: 'text',
required: false, required: false,
@ -90,6 +90,14 @@ export const widgetText = {
], ],
value: 'center' value: 'center'
}, },
{
type: 'el-switch',
label: '识别换行符',
name: 'whiteSpace',
required: false,
placeholder: '',
value: true,
}
], ],
// 数据 // 数据
data: [ data: [

@ -73,7 +73,7 @@ export const widgetTime = {
name: 'background', name: 'background',
required: false, required: false,
placeholder: '', placeholder: '',
value: 'rgba(115,170,229,.5)' value: ''
}, },
{ {
type: 'el-select', type: 'el-select',

@ -32,7 +32,7 @@ import { widgetBarStack } from "./configure/barCharts/widget-bar-stack"
import { widgetLineStack } from "./configure/lineCharts/widget-line-stack" import { widgetLineStack } from "./configure/lineCharts/widget-line-stack"
import { widgetBarCompare } from "./configure/barCharts/widget-bar-compare" import { widgetBarCompare } from "./configure/barCharts/widget-bar-compare"
import { widgetLineCompare } from "./configure/lineCharts/widget-line-compare" import { widgetLineCompare } from "./configure/lineCharts/widget-line-compare"
import { widgetDecoratePie } from "./configure/decorateCharts/widget-decorate-pie"; import { widgetDecoratePie } from "./configure/styleWidget/widget-decorate-pie";
import { widgetMoreBarLine } from "./configure/barlineCharts/widget-more-bar-line"; import { widgetMoreBarLine } from "./configure/barlineCharts/widget-more-bar-line";
import { widgetWordCloud } from "./configure/wordcloudCharts/widget-word-cloud"; import { widgetWordCloud } from "./configure/wordcloudCharts/widget-word-cloud";
import { widgetHeatmap } from "./configure/heatmap/widget-heatmap"; import { widgetHeatmap } from "./configure/heatmap/widget-heatmap";
@ -44,10 +44,14 @@ import { widgetFormTime } from "./configure/form/widget-form-time";
import { widgetScaleVertical } from "./configure/scaleCharts/widget-scale-vertical"; import { widgetScaleVertical } from "./configure/scaleCharts/widget-scale-vertical";
import { widgetScaleHorizontal } from "./configure/scaleCharts/widget-scale-horizontal" import { widgetScaleHorizontal } from "./configure/scaleCharts/widget-scale-horizontal"
import {widgetBarDoubleYaxis} from "./configure/barCharts/widget-bar-double-yaxis-chart"; import {widgetBarDoubleYaxis} from "./configure/barCharts/widget-bar-double-yaxis-chart";
import {widgetBorder} from "./configure/styleWidget/widget-border";
import {widgetDecoration} from "./configure/styleWidget/widget-decoration";
export const widgetTool = [ export const widgetTool = [
// type=html类型的组件 // type=html类型的组件
widgetText, widgetText,
widgetBorder,
widgetDecoration,
widgetMarquee, widgetMarquee,
widgetHref, widgetHref,
widgetTime, widgetTime,

@ -1,6 +1,6 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart ref="myVChart" :options="options" autoresize /> <v-chart ref="myVChart" :options="options" autoresize/>
</div> </div>
</template> </template>
@ -14,7 +14,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -435,7 +434,7 @@ export default {
position: "insideLeft", position: "insideLeft",
textStyle: { textStyle: {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
}, },
@ -450,7 +449,7 @@ export default {
position: "insideRight", position: "insideRight",
textStyle: { textStyle: {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
}, },

@ -13,7 +13,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -98,6 +97,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -141,7 +141,6 @@ export default {
this.setOptionsTitle(); this.setOptionsTitle();
this.setOptionsX(); this.setOptionsX();
this.setOptionsY(); this.setOptionsY();
//this.setOptionsLine();
this.setOptionsBar(); this.setOptionsBar();
this.setOptionsTooltip(); this.setOptionsTooltip();
this.setOptionsData(); this.setOptionsData();
@ -306,41 +305,6 @@ export default {
]; ];
this.options.yAxis = yAxis; this.options.yAxis = yAxis;
}, },
// 线
setOptionsLine() {
const optionsSetup = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == "line") {
series[key].symbol = optionsSetup.symbol;
series[key].showSymbol = optionsSetup.markPoint;
series[key].symbolSize = optionsSetup.pointSize;
series[key].smooth = optionsSetup.smoothCurve;
if (optionsSetup.area) {
series[key].areaStyle = {
opacity: optionsSetup.areaThickness / 100,
};
} else {
series[key].areaStyle = {
opacity: 0,
};
}
series[key].lineStyle = {
width: optionsSetup.lineWidth,
};
series[key].itemStyle.borderRadius = optionsSetup.radius;
series[key].label = {
show: optionsSetup.isShowLine,
position: "top",
distance: optionsSetup.distanceLine,
fontSize: optionsSetup.fontSizeLine,
color: optionsSetup.subTextColorLine,
fontWeight: optionsSetup.fontWeightLine,
};
}
}
this.options.series = series;
},
// //
setOptionsBar() { setOptionsBar() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
@ -348,12 +312,12 @@ export default {
for (const key in series) { for (const key in series) {
if (series[key].type == "bar") { if (series[key].type == "bar") {
series[key].label = { series[key].label = {
show: optionsSetup.isShowBar, show: optionsSetup.isShow,
position: "top", position: "top",
distance: optionsSetup.distanceBar, distance: optionsSetup.distance,
fontSize: optionsSetup.fontSizeBar, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColorBar, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeightBar, fontWeight: optionsSetup.fontWeight,
}; };
series[key].barWidth = optionsSetup.maxWidth; series[key].barWidth = optionsSetup.maxWidth;
series[key].barMinHeight = optionsSetup.minHeight; series[key].barMinHeight = optionsSetup.minHeight;

@ -13,7 +13,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -368,7 +367,7 @@ export default {
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
// //
@ -449,7 +448,7 @@ export default {
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
// //

@ -237,7 +237,7 @@ export default {
distance: optionsSetup.distance, distance: optionsSetup.distance,
textStyle: { textStyle: {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
}; };
@ -247,7 +247,7 @@ export default {
position: "top", position: "top",
distance: optionsSetup.distance, distance: optionsSetup.distance,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}; };
} }

@ -16,6 +16,7 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
widgetIndex: { widgetIndex: {
type: Number, type: Number,
default: 0, default: 0,
@ -311,7 +312,7 @@ export default {
position: "right", position: "right",
distance: optionsSetup.distance, distance: optionsSetup.distance,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}; };
} else { } else {
@ -320,7 +321,7 @@ export default {
position: "top", position: "top",
distance: optionsSetup.distance, distance: optionsSetup.distance,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}; };
} }

@ -98,6 +98,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {

@ -157,6 +157,10 @@ export default {
}, },
], ],
}, },
optionsStyle: {}, //
optionsData: {}, //
optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {

@ -13,7 +13,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -78,6 +77,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {

@ -13,7 +13,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -106,6 +105,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -258,7 +258,7 @@ export default {
show: optionsSetup.isShow, show: optionsSetup.isShow,
textStyle: { textStyle: {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
}; };

@ -14,7 +14,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -496,7 +495,7 @@ export default {
position: "top", position: "top",
distance: 10, distance: 10,
show: optionsSetup.isShow, show: optionsSetup.isShow,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}; };
@ -504,7 +503,7 @@ export default {
position: "bottom", position: "bottom",
distance: 10, distance: 10,
show: optionsSetup.isShow, show: optionsSetup.isShow,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}; };

@ -13,7 +13,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -393,13 +392,13 @@ export default {
color: arrColor[i], color: arrColor[i],
}, },
areaStyle: this.getOptionArea(), areaStyle: this.getOptionArea(),
// //
label: { label: {
show: optionsSetup.isShow, show: optionsSetup.isShow,
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
}); });
@ -481,13 +480,13 @@ export default {
color: arrColor[i], color: arrColor[i],
}, },
areaStyle: this.getOptionArea(), areaStyle: this.getOptionArea(),
// //
label: { label: {
show: optionsSetup.isShow, show: optionsSetup.isShow,
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
}); });

@ -70,6 +70,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -258,7 +259,7 @@ export default {
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}; };
} }

@ -211,7 +211,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -395,6 +394,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {

@ -133,7 +133,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -293,6 +292,7 @@ export default {
], ],
}, },
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {

@ -1,11 +1,13 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart ref="myVChart" :options="options" autoresize/>
</div> </div>
</template> </template>
<script> <script>
import echarts from "echarts"; import echarts from "echarts";
import {targetWidgetLinkageLogic} from "@/views/bigscreenDesigner/designer/linkageLogic";
export default { export default {
name: "WidgetGauge", name: "WidgetGauge",
components: {}, components: {},
@ -125,6 +127,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -138,6 +141,9 @@ export default {
background: this.optionsSetup.background, background: this.optionsSetup.background,
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
}, },
watch: { watch: {
value: { value: {
@ -158,6 +164,9 @@ export default {
this.optionsSetup = this.value.setup; this.optionsSetup = this.value.setup;
this.editorOptions(); this.editorOptions();
}, },
mounted() {
targetWidgetLinkageLogic(this);
},
methods: { methods: {
editorOptions() { editorOptions() {
this.setOptions(); this.setOptions();
@ -244,19 +253,53 @@ export default {
width: optionsSetup.splitWidth, width: optionsSetup.splitWidth,
}, },
}; };
const axisLabel = {
show: optionsSetup.labelShow,
color: optionsSetup.labelColor,
distance: optionsSetup.labelDistance,
fontSize: optionsSetup.labelFontSize,
fontWeight: optionsSetup.labelFontWeight,
fontStyle: optionsSetup.labelFontStyle,
};
const detail = {
valueAnimation: true,
formatter: "{value} %",
color: optionsSetup.detailColor,
fontSize: optionsSetup.detailFontSize,
fontWeight: optionsSetup.detailFontWeight,
fontStyle: optionsSetup.detailFontStyle,
};
series[0].axisLine = axisLine; series[0].axisLine = axisLine;
series[0].axisTick = axisTick; series[0].axisTick = axisTick;
series[0].splitLine = splitLine; series[0].splitLine = splitLine;
series[0].axisLabel = axisLabel;
series[0].detail = detail;
} }
}, },
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined
const myDynamicData = optionsData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
optionsData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
optionsData.dataType == "staticData" optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData) ? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); : this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
}, },
staticDataFn(val) { staticDataFn(val) {
const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
const num = val[0]["num"]; const num = val[0]["num"];
const data = [ const data = [
@ -264,15 +307,7 @@ export default {
value: num, value: num,
}, },
]; ];
const detail = {
valueAnimation: true,
formatter: "{value} %",
color: optionsSetup.labelColor,
fontSize: optionsSetup.labelFontSize,
fontWeight: optionsSetup.labelFontWeight,
};
series[0].data = data; series[0].data = data;
series[0].detail = detail;
}, },
dynamicDataFn(val, refreshTime) { dynamicDataFn(val, refreshTime) {
if (!val) return; if (!val) return;
@ -292,22 +327,13 @@ export default {
}); });
}, },
renderingFn(val) { renderingFn(val) {
const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
const data = [ const data = [
{ {
value: val[0].value, value: val[0].value,
}, },
]; ];
const detail = {
valueAnimation: true,
formatter: "{value} %",
color: optionsSetup.labelColor,
fontSize: optionsSetup.labelFontSize,
fontWeight: optionsSetup.labelFontWeight,
};
series[0].data = data; series[0].data = data;
series[0].detail = detail;
}, },
}, },
}; };

@ -316,6 +316,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {

@ -16,7 +16,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -48,6 +47,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -135,7 +135,7 @@ export default {
rich: { rich: {
a: { a: {
padding: [-30, 15, -20, 15], padding: [-30, 15, -20, 15],
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
@ -181,11 +181,11 @@ export default {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const legend = this.options.legend; const legend = this.options.legend;
legend.show = optionsSetup.isShowLegend; legend.show = optionsSetup.isShowLegend;
legend.left = optionsSetup.lateralPosition == "left" ? 0 : "auto"; legend.left = optionsSetup.lateralPosition;
legend.right = optionsSetup.lateralPosition == "right" ? 0 : "auto"; legend.right = optionsSetup.lateralPosition;
legend.top = optionsSetup.longitudinalPosition == "top" ? 0 : "auto"; legend.top = optionsSetup.longitudinalPosition;
legend.bottom = legend.bottom =
optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto"; optionsSetup.longitudinalPosition;
legend.orient = optionsSetup.layoutFront; legend.orient = optionsSetup.layoutFront;
legend.textStyle = { legend.textStyle = {
color: optionsSetup.legendColor, color: optionsSetup.legendColor,

@ -145,7 +145,7 @@ export default {
rich: { rich: {
a: { a: {
padding: [-30, 15, -20, 15], padding: [-30, 15, -20, 15],
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
@ -179,11 +179,11 @@ export default {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const legend = this.options.legend; const legend = this.options.legend;
legend.show = optionsSetup.isShowLegend; legend.show = optionsSetup.isShowLegend;
legend.left = optionsSetup.lateralPosition == "left" ? 0 : "auto"; legend.left = optionsSetup.lateralPosition;
legend.right = optionsSetup.lateralPosition == "right" ? 0 : "auto"; legend.right = optionsSetup.lateralPosition;
legend.top = optionsSetup.longitudinalPosition == "top" ? 0 : "auto"; legend.top = optionsSetup.longitudinalPosition;
legend.bottom = legend.bottom =
optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto"; optionsSetup.longitudinalPosition;
legend.orient = optionsSetup.layoutFront; legend.orient = optionsSetup.layoutFront;
legend.textStyle = { legend.textStyle = {
color: optionsSetup.legendColor, color: optionsSetup.legendColor,

@ -13,7 +13,6 @@ export default {
props: { props: {
value: Object, value: Object,
ispreview: Boolean, ispreview: Boolean,
flagInter: null,
}, },
data() { data() {
return { return {
@ -29,6 +28,7 @@ export default {
optionsSetup: {}, optionsSetup: {},
optionsPosition: {}, optionsPosition: {},
optionsData: {}, optionsData: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -251,7 +251,7 @@ export default {
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
lineStyle: { lineStyle: {
@ -333,7 +333,7 @@ export default {
position: "top", position: "top",
distance: 10, distance: 10,
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.subTextColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
}, },
lineStyle: { lineStyle: {

@ -1,12 +1,12 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize/> <v-chart ref="myVChart" :options="options" autoresize/>
</div> </div>
</template> </template>
<script> <script>
import echarts from "echarts"; import echarts from "echarts";
import {eventBusParams} from "@/utils/screen"; import { targetWidgetLinkageLogic } from "@/views/bigscreenDesigner/designer/linkageLogic";
let scale = []; let scale = [];
let max; let max;
@ -193,6 +193,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -206,6 +207,9 @@ export default {
background: this.optionsSetup.background, background: this.optionsSetup.background,
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
}, },
watch: { watch: {
value: { value: {
@ -225,13 +229,7 @@ export default {
this.optionsCollapse = this.value.collapse; this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup; this.optionsSetup = this.value.setup;
this.editorOptions(); this.editorOptions();
eventBusParams( targetWidgetLinkageLogic(this); // -
this.optionsSetup,
this.optionsData,
(dynamicData, optionsSetup) => {
this.getEchartData(dynamicData, optionsSetup);
}
);
}, },
methods: { methods: {
// options // options
@ -448,8 +446,24 @@ export default {
}; };
this.options.grid = grid; this.options.grid = grid;
}, },
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined
const myDynamicData = optionsData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
optionsData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
optionsData.dataType == "staticData" optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData) ? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); : this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);

@ -1,11 +1,12 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize/> <v-chart ref="myVChart" :options="options" autoresize/>
</div> </div>
</template> </template>
<script> <script>
import echarts from "echarts"; import echarts from "echarts";
import {targetWidgetLinkageLogic} from "@/views/bigscreenDesigner/designer/linkageLogic";
let scale = []; let scale = [];
let max; let max;
@ -190,6 +191,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -203,6 +205,9 @@ export default {
background: this.optionsSetup.background, background: this.optionsSetup.background,
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
}, },
watch: { watch: {
value: { value: {
@ -222,6 +227,7 @@ export default {
this.optionsCollapse = this.value.collapse; this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup; this.optionsSetup = this.value.setup;
this.editorOptions(); this.editorOptions();
targetWidgetLinkageLogic(this); // -
}, },
methods: { methods: {
// options // options
@ -435,8 +441,24 @@ export default {
}; };
this.options.grid = grid; this.options.grid = grid;
}, },
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined
const myDynamicData = optionsData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
optionsData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
optionsData.dataType == "staticData" optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData) ? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); : this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);

@ -0,0 +1,48 @@
<template>
<div :style="styleObj">
<component :is="value.setup.showtype" :value="value"/>
</div>
</template>
<script>
export default ({
name: "widgetBorder",
components: {},
data() {
return {
optionsStyle: {}, //
}
},
props: {
value: Object,
ispreview: Boolean,
widgetIndex: {
type: Number,
default: 0,
}, // widgetInWorkbench
},
watch: {
value: {
handler(val) {
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.collapse;
this.optionsSetup = val.setup;
},
deep: true,
},
},
computed: {
styleObj() {
return {
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
};
},
}
})
</script>
<style scoped lang="scss">
</style>

@ -1,6 +1,6 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart ref="myVChart" :options="options" autoresize />
</div> </div>
</template> </template>

@ -0,0 +1,47 @@
<template>
<div :style="styleObj">
<component :is="value.setup.showtype" :value="value" :style="styleObj"/>
</div>
</template>
<script>
export default ({
name: "widgetDecoration",
components: {},
data() {
return {
optionsStyle: {}, //
}
},
props: {
value: Object,
ispreview: Boolean,
widgetIndex: {
type: Number,
default: 0,
}, // widgetInWorkbench
},
watch: {
value: {
handler(val) {
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.collapse;
this.optionsSetup = val.setup;
},
deep: true,
},
},
computed: {
styleObj() {
return {
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
};
},
}
})
</script>
<style scoped lang="scss"></style>

@ -34,7 +34,7 @@ import widgetBarStackChart from "./bar/widgetBarStackChart";
import widgetLineStackChart from "./line/widgetLineStackChart"; import widgetLineStackChart from "./line/widgetLineStackChart";
import widgetBarCompareChart from "./bar/widgetBarCompareChart"; import widgetBarCompareChart from "./bar/widgetBarCompareChart";
import widgetLineCompareChart from "./line/widgetLineCompareChart"; import widgetLineCompareChart from "./line/widgetLineCompareChart";
import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; import widgetDecoratePieChart from "./styleWidget/widgetDecoratePieChart.vue";
import widgetMoreBarLineChart from "./barline/widgetMoreBarLineChart"; import widgetMoreBarLineChart from "./barline/widgetMoreBarLineChart";
import widgetWordCloud from "./wordcloud/widgetWordCloud"; import widgetWordCloud from "./wordcloud/widgetWordCloud";
import widgetHeatmap from "./heatmap/widgetHeatmap"; import widgetHeatmap from "./heatmap/widgetHeatmap";
@ -46,12 +46,16 @@ import widgetFormTime from "./form/widgetFormTime.vue";
import widgetScaleVertical from "./scale/widgetScaleVertical.vue"; import widgetScaleVertical from "./scale/widgetScaleVertical.vue";
import widgetScaleHorizontal from "./scale/widgetScaleHorizontal.vue"; import widgetScaleHorizontal from "./scale/widgetScaleHorizontal.vue";
import widgetBarDoubleYaxisChart from "./bar/widgetBarDoubleYaxisChart.vue"; import widgetBarDoubleYaxisChart from "./bar/widgetBarDoubleYaxisChart.vue";
import widgetBorder from "./styleWidget/widgetBorder.vue";
import widgetDecoration from "./styleWidget/widgetDecoration.vue";
export default { export default {
name: "WidgetTemp", name: "WidgetTemp",
components: { components: {
widgetHref, widgetHref,
widgetText, widgetText,
widgetBorder,
widgetDecoration,
WidgetMarquee, WidgetMarquee,
widgetTime, widgetTime,
widgetImage, widgetImage,

@ -7,6 +7,8 @@
</template> </template>
<script> <script>
import {targetWidgetLinkageLogic} from "@/views/bigscreenDesigner/designer/linkageLogic";
export default { export default {
name: "WidgetMarquee", name: "WidgetMarquee",
components: {}, components: {},
@ -16,7 +18,8 @@ export default {
}, },
data() { data() {
return { return {
options: {} options: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -42,6 +45,9 @@ export default {
styleColor: this.transStyle.marqueeQuit styleColor: this.transStyle.marqueeQuit
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
isBehavior() { isBehavior() {
return this.styleColor.marqueeSet ? "start()" : "stop()"; return this.styleColor.marqueeSet ? "start()" : "stop()";
} }
@ -51,6 +57,7 @@ export default {
handler(val) { handler(val) {
this.options = val; this.options = val;
this.optionsData = val.data; this.optionsData = val.data;
targetWidgetLinkageLogic(this); // -
this.setOptionsData(); this.setOptionsData();
}, },
deep: true deep: true
@ -63,8 +70,25 @@ export default {
}, },
methods: { methods: {
// //
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
//
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined
const myDynamicData = optionsData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
optionsData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
//
if (optionsData.dataType == "dynamicData") { if (optionsData.dataType == "dynamicData") {
this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
} else {}; } else {};

@ -40,12 +40,15 @@
<script> <script>
import vue from "vue"; import vue from "vue";
import VueSuperSlide from "vue-superslide"; import VueSuperSlide from "vue-superslide";
import { targetWidgetLinkageLogic } from "@/views/bigscreenDesigner/designer/linkageLogic";
vue.use(VueSuperSlide); vue.use(VueSuperSlide);
export default { export default {
name: 'widgetTable',
components: {},
props: { props: {
value: Object, value: Object,
ispreview: Boolean ispreview: Boolean,
}, },
data() { data() {
return { return {
@ -64,7 +67,8 @@ export default {
list: [], list: [],
optionsSetUp: {}, optionsSetUp: {},
optionsPosition: {}, optionsPosition: {},
optionsData: {} optionsData: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -80,6 +84,9 @@ export default {
background: this.optionsSetUp.tableBgColor background: this.optionsSetUp.tableBgColor
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
headerTableStlye() { headerTableStlye() {
const headStyle = this.optionsSetUp; const headStyle = this.optionsSetUp;
return { return {
@ -122,12 +129,13 @@ export default {
this.optionsPosition = this.value.position; this.optionsPosition = this.value.position;
this.optionsData = this.value.data; this.optionsData = this.value.data;
this.initData(); this.initData();
targetWidgetLinkageLogic(this); // -
}, },
methods: { methods: {
initData() { initData() {
this.handlerRollFn(); this.handlerRollFn();
this.handlerHead(); this.handlerHead();
this.handlerData(); this.setOptionsData();
this.visConfig(); this.visConfig();
}, },
visConfig() { visConfig() {
@ -148,8 +156,25 @@ export default {
const head = this.optionsSetUp.dynamicAddTable; const head = this.optionsSetUp.dynamicAddTable;
this.header = head; this.header = head;
}, },
handlerData() { setOptionsData(e, paramsConfig) {
const tableData = this.optionsData; const tableData = this.optionsData;
tableData.dynamicData = tableData.dynamicData || {}; // dynamicData undefined
const myDynamicData = tableData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
tableData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
tableData.dataType == "staticData" tableData.dataType == "staticData"
? this.handlerStaticData(tableData.staticData) ? this.handlerStaticData(tableData.staticData)
: this.handlerDynamicData(tableData.dynamicData, tableData.refreshTime); : this.handlerDynamicData(tableData.dynamicData, tableData.refreshTime);

@ -7,8 +7,9 @@
<template> <template>
<div class="text" :style="styleColor">{{ styleColor.text }}</div> <div class="text" :style="styleColor">{{ styleColor.text }}</div>
</template> </template>
<script> <script>
import {targetWidgetLinkageLogic} from "@/views/bigscreenDesigner/designer/linkageLogic";
export default { export default {
name: "WidgetText", name: "WidgetText",
components: {}, components: {},
@ -19,7 +20,8 @@ export default {
data() { data() {
return { return {
options: {}, options: {},
optionsData: {} optionsData: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -40,9 +42,13 @@ export default {
height: this.transStyle.height + "px", height: this.transStyle.height + "px",
left: this.transStyle.left + "px", left: this.transStyle.left + "px",
top: this.transStyle.top + "px", top: this.transStyle.top + "px",
right: this.transStyle.right + "px" right: this.transStyle.right + "px",
whiteSpace: this.transStyle.whiteSpace ? "pre-line": "normal"
}; };
} },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
}, },
watch: { watch: {
value: { value: {
@ -57,12 +63,30 @@ export default {
mounted() { mounted() {
this.options = this.value; this.options = this.value;
this.optionsData = this.value.data; this.optionsData = this.value.data;
targetWidgetLinkageLogic(this); // -
this.setOptionsData(); this.setOptionsData();
}, },
methods: { methods: {
// //
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
//
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined
const myDynamicData = optionsData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
optionsData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
//
if (optionsData.dataType == "dynamicData") { if (optionsData.dataType == "dynamicData") {
this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
} else {}; } else {};

@ -41,7 +41,7 @@ import widgetBarStackChart from "./bar/widgetBarStackChart";
import widgetLineStackChart from "./line/widgetLineStackChart"; import widgetLineStackChart from "./line/widgetLineStackChart";
import widgetBarCompareChart from "./bar/widgetBarCompareChart"; import widgetBarCompareChart from "./bar/widgetBarCompareChart";
import widgetLineCompareChart from "./line/widgetLineCompareChart"; import widgetLineCompareChart from "./line/widgetLineCompareChart";
import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; import widgetDecoratePieChart from "./styleWidget/widgetDecoratePieChart.vue";
import widgetMoreBarLineChart from "./barline/widgetMoreBarLineChart"; import widgetMoreBarLineChart from "./barline/widgetMoreBarLineChart";
import widgetWordCloud from "./wordcloud/widgetWordCloud"; import widgetWordCloud from "./wordcloud/widgetWordCloud";
import widgetHeatmap from "./heatmap/widgetHeatmap"; import widgetHeatmap from "./heatmap/widgetHeatmap";
@ -53,12 +53,16 @@ import widgetFormTime from "./form/widgetFormTime.vue";
import widgetScaleVertical from "./scale/widgetScaleVertical.vue"; import widgetScaleVertical from "./scale/widgetScaleVertical.vue";
import widgetScaleHorizontal from "./scale/widgetScaleHorizontal.vue"; import widgetScaleHorizontal from "./scale/widgetScaleHorizontal.vue";
import widgetBarDoubleYaxisChart from "./bar/widgetBarDoubleYaxisChart.vue"; import widgetBarDoubleYaxisChart from "./bar/widgetBarDoubleYaxisChart.vue";
import widgetBorder from "./styleWidget/widgetBorder.vue";
import widgetDecoration from "./styleWidget/widgetDecoration.vue";
export default { export default {
name: "Widget", name: "Widget",
components: { components: {
widgetHref, widgetHref,
widgetText, widgetText,
widgetBorder,
widgetDecoration,
WidgetMarquee, WidgetMarquee,
widgetTime, widgetTime,
widgetImage, widgetImage,

@ -1,10 +1,12 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart ref="myVChart" :options="options" autoresize />
</div> </div>
</template> </template>
<script> <script>
import wordCloud from "../../../../../../static/wordCloud/echarts-wordcloud.min.js"; import wordCloud from "../../../../../../static/wordCloud/echarts-wordcloud.min.js";
import { targetWidgetLinkageLogic } from "@/views/bigscreenDesigner/designer/linkageLogic";
export default { export default {
name: "widgetWordCloud", name: "widgetWordCloud",
components: {}, components: {},
@ -67,6 +69,9 @@ export default {
background: this.optionsSetup.background, background: this.optionsSetup.background,
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
}, },
watch: { watch: {
value: { value: {
@ -86,6 +91,7 @@ export default {
this.optionsCollapse = this.value.setup; this.optionsCollapse = this.value.setup;
this.optionsSetup = this.value.setup; this.optionsSetup = this.value.setup;
this.editorOptions(); this.editorOptions();
targetWidgetLinkageLogic(this); // -
}, },
methods: { methods: {
// options // options
@ -148,8 +154,25 @@ export default {
this.options.tooltip = tooltip; this.options.tooltip = tooltip;
}, },
// //
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined
const myDynamicData = optionsData.dynamicData;
clearInterval(this.flagInter); //
if (
e &&
optionsData.dataType !== "staticData" &&
Object.keys(myDynamicData.contextData).length
) {
const keyArr = Object.keys(myDynamicData.contextData);
paramsConfig.forEach((conf) => {
if (keyArr.includes(conf.targetKey)) {
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
}
});
}
optionsData.dataType == "staticData" optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData) ? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); : this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);

@ -108,16 +108,17 @@ export default {
this.createSheet(); this.createSheet();
}, },
async download(val) { async download(val) {
if (val == "gaea_template_pdf") { // if (val == "gaea_template_pdf") {
this.$message("暂不支持pdf"); // this.$message("pdf");
return; // return;
} // }
const result = {}; const result = {};
result["reportCode"] = this.reportCode; result["reportCode"] = this.reportCode;
result["setParam"] = JSON.stringify(this.params.setParam); result["setParam"] = JSON.stringify(this.params.setParam);
if (val != "") { if (val != "") {
result["exportType"] = val; result["exportType"] = val;
} }
this.getCellStyleData(result);
const { code, message } = await exportExcel(result); const { code, message } = await exportExcel(result);
if (code != 200) return; if (code != 200) return;
this.$message.success(message); this.$message.success(message);
@ -192,8 +193,23 @@ export default {
$(function() { $(function() {
luckysheet.create(options); luckysheet.create(options);
}); });
},
getCellStyleData(result) {
const sheetData = luckysheet.getluckysheetfile(); //
const rowDatas = {};
for (let sheetIndex in sheetData) {
const sheet = sheetData[sheetIndex];
if (sheet && sheet.data) {
for (let rowIndex in sheet.data) {
const row = sheet.data[rowIndex];
rowDatas[rowIndex]=row;
} }
} }
}
result["rowDatas"] = JSON.stringify(rowDatas);;
},
}
}; };
</script> </script>

@ -3,7 +3,7 @@
<div class="admin-title" @click="goBigScreen"> <div class="admin-title" @click="goBigScreen">
<div class="con"> <div class="con">
<img src="../../../../../static/logo-dp.png" width="50" /> <img src="../../../../../static/logo-dp.png" width="50" />
<span class="version">V1.0.0</span> <span class="version">V1.1.0</span>
</div> </div>
</div> </div>
<el-menu <el-menu

Loading…
Cancel
Save