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

This commit is contained in:
taojinlong 2022-04-26 15:39:26 +08:00
commit 657265cc2f
5 changed files with 61 additions and 48 deletions

View File

@ -227,7 +227,8 @@ export default {
this.onFocus = true this.onFocus = true
// //
this.$nextTick(() => { this.$nextTick(() => {
this.selectOptionWidth = event.srcElement.offsetWidth + 'px' // this.selectOptionWidth = event.srcElement.offsetWidth + 'px'
this.selectOptionWidth = event.srcElement.parentElement.parentElement.offsetWidth + 'px'
}) })
} }

View File

@ -674,8 +674,7 @@ export const BASE_CHART_STRING = {
legend: DEFAULT_LEGEND_STYLE, legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE, xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE, yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE, yAxisExt: DEFAULT_YAXIS_EXT_STYLE
background: DEFAULT_BACKGROUND_COLOR
}), }),
customFilter: '[]' customFilter: '[]'
} }
@ -698,8 +697,7 @@ export const BASE_CHART = {
legend: DEFAULT_LEGEND_STYLE, legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE, xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE, yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE, yAxisExt: DEFAULT_YAXIS_EXT_STYLE
background: DEFAULT_BACKGROUND_COLOR
}, },
customFilter: [] customFilter: []
} }

View File

@ -1,4 +1,9 @@
export function getItemType(dimensionData, quotaData, item) { export function getItemType(dimensionData, quotaData, item) {
// Check whether the current view is in template status
// ( dimensionData and quotaData have no data). If yes, return 'success' directly
if (dimensionData.length === 0 && quotaData.length === 0) {
return 'success'
}
// 将item的字段在数据集维度、指标字段中查询一遍如果遇到id不存在、字段类型不一致、维度指标不一致则提示 // 将item的字段在数据集维度、指标字段中查询一遍如果遇到id不存在、字段类型不一致、维度指标不一致则提示
const status = item.groupType const status = item.groupType
let checked = false let checked = false

View File

@ -175,37 +175,38 @@ export default {
if (this.chart.senior) { if (this.chart.senior) {
const senior = JSON.parse(this.chart.senior) const senior = JSON.parse(this.chart.senior)
if (senior.threshold && senior.threshold.labelThreshold && senior.threshold.labelThreshold.length > 0) { if (senior.threshold && senior.threshold.labelThreshold && senior.threshold.labelThreshold.length > 0) {
const value = this.chart.data.series[0].data[0] const value = parseFloat(this.chart.data.series[0].data[0])
for (let i = 0; i < senior.threshold.labelThreshold.length; i++) { for (let i = 0; i < senior.threshold.labelThreshold.length; i++) {
let flag = false let flag = false
const t = senior.threshold.labelThreshold[i] const t = senior.threshold.labelThreshold[i]
const tv = parseFloat(t.value)
if (t.term === 'eq') { if (t.term === 'eq') {
if (value === t.value) { if (value === tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'not_eq') { } else if (t.term === 'not_eq') {
if (value !== t.value) { if (value !== tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'lt') { } else if (t.term === 'lt') {
if (value < t.value) { if (value < tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'gt') { } else if (t.term === 'gt') {
if (value > t.value) { if (value > tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'le') { } else if (t.term === 'le') {
if (value <= t.value) { if (value <= tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'ge') { } else if (t.term === 'ge') {
if (value >= t.value) { if (value >= tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }

View File

@ -1178,7 +1178,6 @@ import bus from '@/utils/bus'
import DatasetChartDetail from '../../dataset/common/DatasetChartDetail' import DatasetChartDetail from '../../dataset/common/DatasetChartDetail'
// shape attr,component style // shape attr,component style
import { import {
DEFAULT_BACKGROUND_COLOR,
DEFAULT_COLOR_CASE, DEFAULT_COLOR_CASE,
DEFAULT_FUNCTION_CFG, DEFAULT_FUNCTION_CFG,
DEFAULT_LABEL, DEFAULT_LABEL,
@ -1333,7 +1332,6 @@ export default {
xAxis: DEFAULT_XAXIS_STYLE, xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE, yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE, yAxisExt: DEFAULT_YAXIS_EXT_STYLE,
background: DEFAULT_BACKGROUND_COLOR,
split: DEFAULT_SPLIT split: DEFAULT_SPLIT
}, },
senior: { senior: {
@ -1472,7 +1470,8 @@ export default {
}) })
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions] this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
}, },
emptyTableData() { emptyTableData(id) {
console.log('emptyTableData:' + id)
this.table = {} this.table = {}
this.dimension = [] this.dimension = []
this.quota = [] this.quota = []
@ -1500,8 +1499,11 @@ export default {
initTableData(id, optType) { initTableData(id, optType) {
if (id != null) { if (id != null) {
post('/dataset/table/getWithPermission/' + id, null).then(response => { post('/dataset/table/getWithPermission/' + id, null).then(response => {
this.table = response.data // If click too fast on the panel, the data here may be inconsistent, so make a verification
this.initTableField(id, optType) if (this.view.tableId === id) {
this.table = response.data
this.initTableField(id, optType)
}
}).catch(err => { }).catch(err => {
this.table = null this.table = null
this.resetDatasetField() this.resetDatasetField()
@ -1514,17 +1516,20 @@ export default {
initTableField(id, optType) { initTableField(id, optType) {
if (this.table) { if (this.table) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => { post('/dataset/table/getFieldsFromDE', this.table).then(response => {
this.dimension = response.data.dimension // If click too fast on the panel, the data here may be inconsistent, so make a verification
this.quota = response.data.quota if (this.view.tableId === id) {
this.dimensionData = JSON.parse(JSON.stringify(this.dimension)) this.dimension = response.data.dimension
this.quotaData = JSON.parse(JSON.stringify(this.quota)) this.quota = response.data.quota
this.fieldFilter(this.searchField) this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
if (optType === 'change') { this.quotaData = JSON.parse(JSON.stringify(this.quota))
this.resetChangeTable() this.fieldFilter(this.searchField)
this.$nextTick(() => { if (optType === 'change') {
bus.$emit('reset-change-table', 'change') this.resetChangeTable()
this.calcData() this.$nextTick(() => {
}) bus.$emit('reset-change-table', 'change')
this.calcData()
})
}
} }
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
@ -1911,27 +1916,30 @@ export default {
getChart(id, queryFrom = 'panel_edit') { getChart(id, queryFrom = 'panel_edit') {
if (id) { if (id) {
getChartDetails(id, this.panelInfo.id, { queryFrom: queryFrom }).then(response => { getChartDetails(id, this.panelInfo.id, { queryFrom: queryFrom }).then(response => {
if (response.data.dataFrom === 'template') { // If click too fast on the panel, the data here may be inconsistent, so make a verification
this.emptyTableData() if (response.data.id === this.param.id) {
} else { if (response.data.dataFrom === 'template') {
this.initTableData(response.data.tableId) this.emptyTableData(response.data.id)
} } else {
this.view = JSON.parse(JSON.stringify(response.data)) this.initTableData(response.data.tableId)
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : [] }
this.view.xaxisExt = this.view.xaxisExt ? JSON.parse(this.view.xaxisExt) : [] this.view = JSON.parse(JSON.stringify(response.data))
this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : [] this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
this.view.yaxisExt = this.view.yaxisExt ? JSON.parse(this.view.yaxisExt) : [] this.view.xaxisExt = this.view.xaxisExt ? JSON.parse(this.view.xaxisExt) : []
this.view.extStack = this.view.extStack ? JSON.parse(this.view.extStack) : [] this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : []
this.view.drillFields = this.view.drillFields ? JSON.parse(this.view.drillFields) : [] this.view.yaxisExt = this.view.yaxisExt ? JSON.parse(this.view.yaxisExt) : []
this.view.extBubble = this.view.extBubble ? JSON.parse(this.view.extBubble) : [] this.view.extStack = this.view.extStack ? JSON.parse(this.view.extStack) : []
this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {} this.view.drillFields = this.view.drillFields ? JSON.parse(this.view.drillFields) : []
this.view.customStyle = this.view.customStyle ? JSON.parse(this.view.customStyle) : {} this.view.extBubble = this.view.extBubble ? JSON.parse(this.view.extBubble) : []
this.view.customFilter = this.view.customFilter ? JSON.parse(this.view.customFilter) : {} this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}
this.view.senior = this.view.senior ? JSON.parse(this.view.senior) : {} this.view.customStyle = this.view.customStyle ? JSON.parse(this.view.customStyle) : {}
this.view.customFilter = this.view.customFilter ? JSON.parse(this.view.customFilter) : {}
this.view.senior = this.view.senior ? JSON.parse(this.view.senior) : {}
// echart // echart
this.chart = response.data this.chart = response.data
this.data = response.data.data this.data = response.data.data
}
}).catch(err => { }).catch(err => {
this.httpRequest.status = err.response.data.success this.httpRequest.status = err.response.data.success
this.httpRequest.msg = err.response.data.message this.httpRequest.msg = err.response.data.message