Merge branch 'dev' into pr@dev_eslint_auto_fix

This commit is contained in:
dataeaseShu 2022-10-11 15:13:55 +08:00
commit 10d2944554
7 changed files with 128 additions and 54 deletions

View File

@ -781,7 +781,7 @@ public class MysqlQueryProvider extends QueryProvider {
StringBuilder stringBuilder = new StringBuilder();
if (f.getDeExtractType() == 4) { // 处理 tinyint
stringBuilder.append("concat(`").append(f.getOriginName()).append("`,'') AS ").append(f.getDataeaseName());
} if (f.getDeExtractType() == 1 && f.getType().equalsIgnoreCase("YEAR")) { // 处理 YEAR
} else if (f.getDeExtractType() == 1 && f.getType().equalsIgnoreCase("YEAR")) { // 处理 YEAR
stringBuilder.append("").append(String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + f.getOriginName() + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT)).append(" AS ").append(f.getDataeaseName());
} else {
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());

View File

@ -1068,8 +1068,23 @@ public class DataSetTableService {
CCJSqlParserUtil.parse(sql, parser -> parser.withSquareBracketQuotation(true));
Statement statement = CCJSqlParserUtil.parse(sql);
Select select = (Select) statement;
PlainSelect plainSelect = ((PlainSelect) select.getSelectBody());
// 访问from
if (select.getSelectBody() instanceof PlainSelect) {
return handlePlainSelect((PlainSelect) select.getSelectBody(), select, dsType);
}else {
String result = "";
SetOperationList setOperationList = (SetOperationList) select.getSelectBody();
for (int i = 0; i < setOperationList.getSelects().size(); i++) {
result = result + handlePlainSelect((PlainSelect) setOperationList.getSelects().get(i), null, dsType);
if (i < setOperationList.getSelects().size() - 1) {
result = result + " " + setOperationList.getOperations().get(i).toString() + " ";
}
}
return result;
}
}
private String handlePlainSelect(PlainSelect plainSelect, Select statementSelect, String dsType) throws Exception {
FromItem fromItem = plainSelect.getFromItem();
if (fromItem instanceof SubSelect) {
SelectBody selectBody = ((SubSelect) fromItem).getSelectBody();
@ -1086,7 +1101,7 @@ public class DataSetTableService {
}
Expression expr = plainSelect.getWhere();
if (expr == null) {
return handleWith(plainSelect, select, dsType);
return handleWith(plainSelect, statementSelect, dsType);
}
StringBuilder stringBuilder = new StringBuilder();
BinaryExpression binaryExpression = null;
@ -1100,12 +1115,12 @@ public class DataSetTableService {
expr.accept(getExpressionDeParser(stringBuilder));
}
plainSelect.setWhere(CCJSqlParserUtil.parseCondExpression(stringBuilder.toString()));
return handleWith(plainSelect, select, dsType);
return handleWith(plainSelect, statementSelect, dsType);
}
private String handleWith(PlainSelect plainSelect, Select select, String dsType) throws Exception {
StringBuilder builder = new StringBuilder();
if (CollectionUtils.isNotEmpty(select.getWithItemsList())) {
if (select != null && CollectionUtils.isNotEmpty(select.getWithItemsList())) {
builder.append("WITH");
builder.append(" ");
for (Iterator<WithItem> iter = select.getWithItemsList().iterator(); iter.hasNext(); ) {

View File

@ -42,6 +42,10 @@ export default {
Editor
},
props: {
terminal: {
type: String,
default: 'pc'
},
propValue: {
type: String,
require: true
@ -96,11 +100,31 @@ export default {
}
},
computed: {
scale() {
return Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
},
editStatus() {
return this.editMode === 'edit' && !this.mobileLayoutStatus
},
autoStyle() {
return {
height: (100 / this.scale) + '%!important',
width: (100 / this.scale) + '%!important',
left: 50 * (1 - 1 / this.scale) + '%', // 2
top: 50 * (1 - 1 / this.scale) + '%',
transform: 'scale(' + this.scale + ')'
}
},
scaleCoefficient() {
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
return 1.1
} else {
return 4.5
}
},
...mapState([
'mobileLayoutStatus'
'mobileLayoutStatus',
'previewCanvasScale'
])
},
watch: {
@ -149,6 +173,7 @@ export default {
width: 100%;
height: 100%;
overflow-y: auto!important;
position: relative;
}
::-webkit-scrollbar {
width: 0px!important;

View File

@ -44,6 +44,11 @@ export default {
Editor
},
props: {
scale: {
type: Number,
required: false,
default: 1
},
element: {
type: Object
},
@ -88,9 +93,9 @@ export default {
plugins: 'advlist autolink link image lists charmap media wordcount table contextmenu directionality pagebreak', //
//
toolbar: 'undo redo |fontselect fontsizeselect |forecolor backcolor bold italic |underline strikethrough link| formatselect |' +
'alignleft aligncenter alignright | bullist numlist |' +
' blockquote subscript superscript removeformat | table image media | fullscreen ' +
'| bdmap indent2em lineheight formatpainter axupimgs',
'alignleft aligncenter alignright | bullist numlist |' +
' blockquote subscript superscript removeformat | table image media | fullscreen ' +
'| bdmap indent2em lineheight formatpainter axupimgs',
toolbar_location: '/',
font_formats: '微软雅黑=Microsoft YaHei;宋体=SimSun;黑体=SimHei;仿宋=FangSong;华文黑体=STHeiti;华文楷体=STKaiti;华文宋体=STSong;华文仿宋=STFangsong;Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings',
fontsize_formats: '12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px', //
@ -105,6 +110,15 @@ export default {
editStatus() {
return this.editMode === 'edit' && !this.mobileLayoutStatus
},
autoStyle() {
return {
height: (100 / this.scale) + '%!important',
width: (100 / this.scale) + '%!important',
left: 50 * (1 - 1 / this.scale) + '%', // 2
top: 50 * (1 - 1 / this.scale) + '%',
transform: 'scale(' + this.scale + ')'
}
},
...mapState([
'mobileLayoutStatus'
])
@ -217,40 +231,45 @@ export default {
</script>
<style lang="scss" scoped>
.rich-main-class {
width: 100%;
height: 100%;
overflow-y: auto!important;
}
::-webkit-scrollbar {
width: 0px!important;
height: 0px!important;
}
::v-deep ol {
display: block!important;
list-style-type: decimal;
margin-block-start: 1em!important;
margin-block-end: 1em!important;
margin-inline-start: 0px!important;
margin-inline-end: 0px!important;
padding-inline-start: 40px!important;
}
::v-deep ul {
display: block!important;
list-style-type: disc;
margin-block-start: 1em!important;
margin-block-end: 1em!important;
margin-inline-start: 0px!important;
margin-inline-end: 0px!important;
padding-inline-start: 40px!important;
}
::v-deep li {
display: list-item!important;
text-align: -webkit-match-parent!important;
}
.rich-main-class {
width: 100%;
height: 100%;
overflow-y: auto !important;
position: relative;
}
::v-deep .base-selected{
background-color: #b4d7ff
}
::-webkit-scrollbar {
width: 0px !important;
height: 0px !important;
}
::v-deep ol {
display: block !important;
list-style-type: decimal;
margin-block-start: 1em !important;
margin-block-end: 1em !important;
margin-inline-start: 0px !important;
margin-inline-end: 0px !important;
padding-inline-start: 40px !important;
}
::v-deep ul {
display: block !important;
list-style-type: disc;
margin-block-start: 1em !important;
margin-block-end: 1em !important;
margin-inline-start: 0px !important;
margin-inline-end: 0px !important;
padding-inline-start: 40px !important;
}
::v-deep li {
display: list-item !important;
text-align: -webkit-match-parent !important;
}
::v-deep .base-selected {
background-color: #b4d7ff
}
</style>

View File

@ -48,6 +48,7 @@
<de-rich-text-view
v-else-if="richTextViewShowFlag"
:ref="element.propValue.id"
:scale="scale"
:element="element"
:prop-value="element.propValue.textValue"
:active="active"

View File

@ -1,5 +1,5 @@
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { DEFAULT_YAXIS_EXT_STYLE } from '@/views/chart/chart/chart'
import { DEFAULT_XAXIS_STYLE, DEFAULT_YAXIS_EXT_STYLE, DEFAULT_YAXIS_STYLE } from '@/views/chart/chart/chart'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
let xAxisLabelFormatter = null
@ -284,12 +284,18 @@ export function seniorCfg(chart_option, chart) {
if (senior.assistLine && senior.assistLine.length > 0) {
if (chart_option.series && chart_option.series.length > 0) {
const customStyle = JSON.parse(chart.customStyle)
let xAxis, yAxis
let xAxis, yAxis, axisFormatterCfg
if (customStyle.xAxis) {
xAxis = JSON.parse(JSON.stringify(customStyle.xAxis))
if (chart.type.includes('horizontal')) {
axisFormatterCfg = xAxis.axisLabelFormatter ? xAxis.axisLabelFormatter : DEFAULT_XAXIS_STYLE.axisLabelFormatter
}
}
if (customStyle.yAxis) {
yAxis = JSON.parse(JSON.stringify(customStyle.yAxis))
if (!chart.type.includes('horizontal')) {
axisFormatterCfg = yAxis.axisLabelFormatter ? yAxis.axisLabelFormatter : DEFAULT_YAXIS_STYLE.axisLabelFormatter
}
}
const fixedLines = senior.assistLine.filter(ele => ele.field === '0')
@ -312,7 +318,7 @@ export function seniorCfg(chart_option, chart) {
fontSize: 10,
position: xAxis.position === 'bottom' ? 'insideStartTop' : 'insideEndTop',
formatter: function(param) {
return ele.name + ' : ' + param.value
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
}
},
tooltip: {
@ -334,7 +340,7 @@ export function seniorCfg(chart_option, chart) {
fontSize: 10,
position: yAxis.position === 'left' ? 'insideStartTop' : 'insideEndTop',
formatter: function(param) {
return ele.name + ' : ' + param.value
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
}
},
tooltip: {

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
import { DEFAULT_XAXIS_STYLE, DEFAULT_YAXIS_STYLE } from '@/views/chart/chart/chart'
export function getPadding(chart) {
if (chart.drill) {
@ -703,14 +704,20 @@ export function getAnalyse(chart) {
senior = JSON.parse(chart.senior)
if (senior.assistLine && senior.assistLine.length > 0) {
const customStyle = JSON.parse(chart.customStyle)
let xAxisPosition, yAxisPosition
let xAxisPosition, yAxisPosition, axisFormatterCfg
if (customStyle.xAxis) {
const a = JSON.parse(JSON.stringify(customStyle.xAxis))
xAxisPosition = transAxisPosition(chart, a)
if (chart.type.includes('horizontal')) {
axisFormatterCfg = a.axisLabelFormatter ? a.axisLabelFormatter : DEFAULT_XAXIS_STYLE.axisLabelFormatter
}
}
if (customStyle.yAxis) {
const a = JSON.parse(JSON.stringify(customStyle.yAxis))
yAxisPosition = transAxisPosition(chart, a)
if (!chart.type.includes('horizontal')) {
axisFormatterCfg = a.axisLabelFormatter ? a.axisLabelFormatter : DEFAULT_YAXIS_STYLE.axisLabelFormatter
}
}
const fixedLines = senior.assistLine.filter(ele => ele.field === '0')
@ -718,11 +725,12 @@ export function getAnalyse(chart) {
const lines = fixedLines.concat(dynamicLines)
lines.forEach(ele => {
const content = ele.name + ' : ' + parseFloat(ele.value)
const value = parseFloat(ele.value)
const content = ele.name + ' : ' + valueFormatter(value, axisFormatterCfg)
assistLine.push({
type: 'line',
start: ['start', parseFloat(ele.value)],
end: ['end', parseFloat(ele.value)],
start: ['start', value],
end: ['end', value],
style: {
stroke: ele.color,
lineDash: getLineDash(ele.lineType)
@ -731,7 +739,7 @@ export function getAnalyse(chart) {
if (!chart.type.includes('horizontal')) {
assistLine.push({
type: 'text',
position: [yAxisPosition === 'left' ? 'start' : 'end', parseFloat(ele.value)],
position: [yAxisPosition === 'left' ? 'start' : 'end', value],
content: content,
offsetY: -2,
offsetX: yAxisPosition === 'left' ? 2 : -10 * (content.length - 2),
@ -744,7 +752,7 @@ export function getAnalyse(chart) {
} else {
assistLine.push({
type: 'text',
position: [xAxisPosition === 'left' ? 'start' : 'end', parseFloat(ele.value)],
position: [xAxisPosition === 'left' ? 'start' : 'end', value],
content: content,
offsetY: xAxisPosition === 'left' ? -2 : -10 * (content.length - 2),
offsetX: 2,