Merge pull request #5029 from dataease/dev

merge dev
This commit is contained in:
fit2cloudrd 2023-04-13 18:07:54 +08:00 committed by GitHub
commit 698dc63c5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 147 additions and 63 deletions

View File

@ -1,7 +1,7 @@
<p align="center"><a href="https://dataease.io"><img src="https://dataease.oss-cn-hangzhou.aliyuncs.com/img/dataease-logo.png" alt="DataEase" width="300" /></a></p>
<h3 align="center">人人可用的开源数据可视化分析工具</h3>
<p align="center">
<a href="https://www.gnu.org/licenses/old-licenses/gpl-3.0"><img src="https://img.shields.io/github/license/dataease/dataease?color=%231890FF" alt="License: GPL v3"></a>
<a href="https://www.gnu.org/licenses/gpl-3.0.html"><img src="https://img.shields.io/github/license/dataease/dataease?color=%231890FF" alt="License: GPL v3"></a>
<a href="https://app.codacy.com/gh/dataease/dataease?utm_source=github.com&utm_medium=referral&utm_content=dataease/dataease&utm_campaign=Badge_Grade_Dashboard"><img src="https://app.codacy.com/project/badge/Grade/da67574fd82b473992781d1386b937ef" alt="Codacy"></a>
<a href="https://github.com/dataease/dataease/releases/latest"><img src="https://img.shields.io/github/v/release/dataease/dataease" alt="Latest release"></a>
<a href="https://github.com/dataease/dataease"><img src="https://img.shields.io/github/stars/dataease/dataease?color=%231890FF&style=flat-square" alt="Stars"></a>

View File

@ -8,6 +8,8 @@ import io.dataease.commons.model.excel.ExcelSheetModel;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -29,6 +31,9 @@ public class ExcelUtils {
List<List<String>> details = sheet.getData();
details.add(0, sheet.getHeads());
String sheetName = sheet.getSheetName();
Pattern pattern = Pattern.compile("[\\s\\\\/:\\*\\?\\\"<>\\|]");
Matcher matcher = pattern.matcher(sheetName);
sheetName = matcher.replaceAll("-");
Sheet curSheet = wb.createSheet(sheetName);
if (StringUtils.isBlank(fileName)) {
String cName = sheetName + suffix;

View File

@ -1215,7 +1215,8 @@ public class OracleQueryProvider extends QueryProvider {
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, format);
}
if (field.getDeExtractType() == 1) {
whereName = String.format(OracleConstants.TO_CHAR, format);
whereName = originName;
// whereName = String.format(OracleConstants.TO_CHAR, originName, format);
}
} else if (field.getDeType() == 2 || field.getDeType() == 3) {
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {

View File

@ -63,7 +63,7 @@ public class ViewExportExcel {
String panelStyle = panelDto.getPanelStyle();
Map map = gson.fromJson(panelStyle, Map.class);
Map panelMap = (LinkedTreeMap) map.get("panel");
double resultCount = Double.parseDouble(panelMap.get("resultCount").toString());
double resultCount = ObjectUtils.isEmpty(panelMap.get("resultCount")) ? 1000 : Double.parseDouble(panelMap.get("resultCount").toString());
String resultMode = null;
if (ObjectUtils.isNotEmpty(panelMap.get("resultMode"))) {
resultMode = panelMap.get("resultMode").toString();

View File

@ -141,10 +141,10 @@
style="position: absolute;right: 70px;top:15px"
>
<el-button
v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && showChartInfo.type !== 'symbol-map'"
v-if="showChartInfoType==='enlarge' && hasDataPermission('export',panelInfo.privileges)&& showChartInfo && !equalsAny(showChartInfo.type, 'symbol-map', 'flow-map')"
class="el-icon-picture-outline"
size="mini"
:disabled ="imageDownloading"
:disabled="imageDownloading"
@click="exportViewImg"
>
{{ $t('chart.export_img') }}
@ -152,7 +152,7 @@
<el-button
v-if="showChartInfoType==='details' && hasDataPermission('export',panelInfo.privileges)"
size="mini"
:disabled="$store.getters.loadingMap[$store.getters.currentPath]"
:disabled="$store.getters.loadingMap[$store.getters.currentPath] || dialogLoading"
@click="exportExcel"
>
<svg-icon
@ -218,6 +218,7 @@ import Vue from 'vue'
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
import UserViewDialog from '@/components/canvas/customComponent/UserViewDialog'
import UserViewMobileDialog from '@/components/canvas/customComponent/UserViewMobileDialog'
import { equalsAny } from '@/utils/StringUtils'
export default {
name: 'UserView',
@ -308,6 +309,7 @@ export default {
},
data() {
return {
dialogLoading: false,
imageDownloading: false,
innerRefreshTimer: null,
mobileChartDetailsVisible: false,
@ -576,6 +578,7 @@ export default {
}
},
methods: {
equalsAny,
tabSwitch(tabCanvasId) {
if (this.charViewS2ShowFlag && tabCanvasId === this.canvasId && this.$refs[this.element.propValue.id]) {
this.$refs[this.element.propValue.id].chartResize()
@ -601,7 +604,10 @@ export default {
}
},
exportExcel() {
this.$refs['userViewDialog'].exportExcel()
this.dialogLoading = true
this.$refs['userViewDialog'].exportExcel(() => {
this.dialogLoading = false
})
},
exportViewImg() {
this.imageDownloading = true

View File

@ -1,6 +1,6 @@
<template>
<de-container
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
v-loading="$store.getters.loadingMap[$store.getters.currentPath] || linkLoading"
:class="isAbsoluteContainer ? 'abs-container' : ''"
>
<de-main-container
@ -120,7 +120,8 @@ export default {
return {
refId: null,
element: {},
lastMapChart: null
lastMapChart: null,
linkLoading: false
}
},
computed: {
@ -239,28 +240,28 @@ export default {
mounted() {
},
methods: {
exportExcel() {
exportExcel(callBack) {
const _this = this
if (this.isOnlyDetails) {
_this.exportExcelDownload()
_this.exportExcelDownload(null, null, null, callBack)
} else {
if (this.showChartCanvas) {
html2canvas(document.getElementById('chartCanvas')).then(canvas => {
const snapshot = canvas.toDataURL('image/jpeg', 1)
_this.exportExcelDownload(snapshot, canvas.width, canvas.height)
_this.exportExcelDownload(snapshot, canvas.width, canvas.height, callBack)
})
} else {
_this.exportExcelDownload()
_this.exportExcelDownload(null, null, null, callBack)
}
}
},
exportViewImg(callback) {
exportImg(this.chart.name,callback)
exportImg(this.chart.name, callback)
},
setLastMapChart(data) {
this.lastMapChart = JSON.parse(JSON.stringify(data))
},
exportExcelDownload(snapshot, width, height) {
exportExcelDownload(snapshot, width, height, callBack) {
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
const excelTypes = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.deType)
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)
@ -291,7 +292,7 @@ export default {
})
}
const request = {
proxy:null,
proxy: null,
viewId: this.chart.id,
viewName: excelName,
header: excelHeader,
@ -309,6 +310,7 @@ export default {
const linkToken = this.$store.getters.linkToken || getLinkToken()
if (!token && linkToken) {
method = exportDetails
this.linkLoading = true
}
if (this.panelInfo.proxy) {
@ -323,6 +325,11 @@ export default {
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
this.linkLoading = false
callBack && callBack()
}).catch(() => {
this.linkLoading = false
callBack && callBack()
})
},

View File

@ -27,7 +27,7 @@ import { ApplicationContext } from '@/utils/ApplicationContext'
import { timeSection } from '@/utils'
import bus from '@/utils/bus'
import customInput from '@/components/widget/deWidget/customInput'
import { mapState } from 'vuex'
export default {
mixins: [customInput],
props: {
@ -59,7 +59,8 @@ export default {
operator: 'between',
values: null,
onFocus: false,
show: true
show: true,
timer: null
}
},
computed: {
@ -126,10 +127,19 @@ export default {
return ['00:00:00', '23:59:59']
}
return null
}
},
...mapState([
'canvasStyleData'
])
},
watch: {
canvasStyleData: {
handler(newVal, oldVla) {
this.canvasStyleDataInit()
},
deep: true
},
'viewIds': function(value, old) {
if (typeof value === 'undefined' || value === old) return
this.setCondition()
@ -163,18 +173,8 @@ export default {
}
},
created() {
if (this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) {
if (this.element.options.attrs.default) {
const widget = ApplicationContext.getService(this.element.serviceName)
this.values = widget.dynamicDateFormNow(this.element)
this.dateChange(this.values)
}
return
}
if (this.element.options.value) {
this.values = this.fillValueDerfault()
this.dateChange(this.values)
}
this.loadInit()
this.canvasStyleDataInit()
},
mounted() {
bus.$on('onScroll', this.onScroll)
@ -187,6 +187,38 @@ export default {
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
loadInit() {
if (this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) {
if (this.element.options.attrs.default) {
const widget = ApplicationContext.getService(this.element.serviceName)
this.values = widget.dynamicDateFormNow(this.element)
this.dateChange(this.values)
}
return
}
if (this.element.options.value) {
this.values = this.fillValueDerfault()
this.dateChange(this.values)
}
},
canvasStyleDataInit() {
if (this.inDraw && this.canvasStyleData.refreshViewEnable && this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) {
this.searchCount = 0
this.timer && clearInterval(this.timer)
let refreshTime = 300000
if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) {
if (this.canvasStyleData.refreshUnit === 'second') {
refreshTime = this.canvasStyleData.refreshTime * 1000
} else {
refreshTime = this.canvasStyleData.refreshTime * 60000
}
}
this.timer = setInterval(() => {
this.loadInit()
this.searchCount++
}, refreshTime)
}
},
clearHandler() {
this.values = null
},

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 714 KiB

After

Width:  |  Height:  |  Size: 673 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 712 KiB

After

Width:  |  Height:  |  Size: 672 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -364,7 +364,7 @@ export function getTooltip(chart) {
res = valueFormatter(param.value, formatterItem)
}
}
} else if (includesAny(chart.type, 'bar', 'line', 'scatter', 'radar', 'area') && !chart.type.includes('group')) {
} else if (includesAny(chart.type, 'bar', 'scatter', 'radar', 'area') && !chart.type.includes('group')) {
obj = { name: param.category, value: param.value }
for (let i = 0; i < yAxis.length; i++) {
const f = yAxis[i]
@ -377,6 +377,20 @@ export function getTooltip(chart) {
break
}
}
} else if (chart.type === 'line') {
obj = { name: param.category, value: param.value }
const xAxisExt = JSON.parse(chart.xaxisExt)
for (let i = 0; i < yAxis.length; i++) {
const f = yAxis[i]
if (f.name === param.category || (yAxis.length && xAxisExt.length)) {
if (f.formatterCfg) {
res = valueFormatter(param.value, f.formatterCfg)
} else {
res = valueFormatter(param.value, formatterItem)
}
break
}
}
} else if (chart.type.includes('group')) {
if (chart.type === 'bar-group') {
obj = { name: param.category, value: param.value }

View File

@ -3220,7 +3220,7 @@ export const TYPE_CONFIGS = [
category: 'chart.chart_type_space',
value: 'map',
title: 'chart.chart_map',
icon: 'map',
icon: 'map_mini',
properties: [
'color-selector',
'label-selector',
@ -3367,19 +3367,21 @@ export function getColors(chart, colors, reset) {
}
} else if (equalsAny(chart.type, 'bar-group', 'line')) {
// 拿到data中的category并去重然后构建seriesColor
const data = chart.data.data
const s = []
data.forEach((cur) => {
if (s.indexOf(cur.category) < 0) {
s.push(cur.category)
}
})
for (let i = 0; i < s.length; i++) {
seriesColors.push({
name: s[i],
color: colors[i % colors.length],
isCustom: false
if (chart.data) {
const data = chart.data.data
const s = []
data.forEach((cur) => {
if (s.indexOf(cur.category) < 0) {
s.push(cur.category)
}
})
for (let i = 0; i < s.length; i++) {
seriesColors.push({
name: s[i],
color: colors[i % colors.length],
isCustom: false
})
}
}
} else {
if (chart.data) {

View File

@ -243,7 +243,7 @@ export default {
fieldOptions() {
const xaxis = this.view.xaxis
const yaxis = this.view.yaxis
const locationIds = this.view.viewFields.filter(item => item.busiType === 'locationXaxis' || item.busiType === 'locationYaxis').map(item => item.id)
const locationIds = this.view.viewFields ? this.view.viewFields.filter(item => item.busiType === 'locationXaxis' || item.busiType === 'locationYaxis').map(item => item.id) : []
const xIds = xaxis ? xaxis.map(item => item.id) : []
const yIds = yaxis ? yaxis.map(item => item.id) : []
const disableIds = [...xIds, ...yIds, ...locationIds]

View File

@ -19,7 +19,6 @@
v-for="(item, idx) in container"
:key="idx"
style="position: relative;display: block;"
:style="{'top': item.isPlugin ? '5px' : '0'}"
>
<el-radio
v-if="item.placeholder"

View File

@ -1,6 +1,6 @@
<template>
<div class="de-dataset-form">
<div class="top">
<div class="top" v-loading="loading">
<span class="name">
<i
class="el-icon-arrow-left"
@ -57,6 +57,7 @@
:origin-name="originName"
:name-list="nameList"
@setTableNum="(val) => (tableNum = val)"
@datasourceLoading="(val) => loading = val"
/>
</div>
</div>
@ -79,9 +80,9 @@ export default {
return {
originName: '',
tableNum: 0,
loading: false,
showInput: false,
editType: '',
loading: false,
selectDatasets: [],
tData: [],
datasetType: '',
@ -217,6 +218,7 @@ export default {
)
},
initTable(id) {
this.loading = true
post('/dataset/table/getWithPermission/' + id, null)
.then((response) => {
const { sceneId: id, id: tableId, name } = response.data || {}
@ -232,7 +234,10 @@ export default {
this.table.editType = +this.editType
}
})
.catch(() => {})
.catch(() => { })
.finally(() => {
this.loading = false
})
},
switchComponent(c) {
switch (c) {

View File

@ -905,6 +905,7 @@ export default {
initTableInfo() {
const tableId = this.param.tableId || this.$route.query.id
if (tableId) {
this.$emit('datasourceLoading', true)
getTable(tableId).then((response) => {
const table = response.data
this.dataSource = table.dataSourceId
@ -919,6 +920,8 @@ export default {
).sql
}
this.variables = JSON.parse(table.sqlVariableDetails)
}).finally(() => {
this.$emit('datasourceLoading', false)
})
}
},

View File

@ -549,7 +549,7 @@ export default {
if (name2Auto) {
name2Auto.push(nameIdMap[ele])
}
name2Id = name2Id.replace(ele, nameIdMap[ele])
name2Id = name2Id.replace(`[${ele}]`, `[${nameIdMap[ele]}]`)
})
}
return name2Id

View File

@ -722,6 +722,7 @@
:visible.sync="editCalcField"
class="de-dialog-form de-center-dialog"
width="980px"
:before-close="closeCalcField"
:title="
currEditField.id
? $t('dataset.edit_calc_field')
@ -730,6 +731,7 @@
append-to-body
>
<calc-field-edit
ref="calcFieldEdit"
:param="param"
:table-fields="tableFields"
:field="currEditField"
@ -893,6 +895,7 @@ export default {
closeCalcField() {
this.editCalcField = false
this.$refs.calcFieldEdit.resetField()
this.initField()
},

View File

@ -626,6 +626,8 @@ export default {
<style lang="scss">
.de-el-dropdown-menu {
.dimension {
max-height: 200px;
overflow-y: auto;
padding: 0;
li {
font-family: Alibaba-PuHuiTi-Regular, Helvetica Neue, Helvetica, Arial,

View File

@ -49,7 +49,7 @@
<api-variable
@editScenarioAdvance="editScenarioAdvance"
:scenario-definition="scenarioDefinition"
:with-mor-setting="true"
:with-more-setting="true"
:is-read-only="isReadOnly"
:isShowEnable="isShowEnable"
:parameters="request.arguments"

View File

@ -420,8 +420,11 @@ export default {
return
}
const regep = new RegExp(/^1[3-9]\d{9}$/)
if (!regep.test(value)) {
let phoneNumber = value
if (value.length > 3 && value.startsWith('+86')) {
phoneNumber = value.substr(3)
}
if (!regep.test(phoneNumber)) {
const msg = this.$t('user.phone_format')
callback(new Error(msg))
} else {