forked from github/dataease
Merge branch 'v1.7' of github.com:dataease/dataease into v1.7
This commit is contained in:
commit
f99e1488f5
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.service.wizard;
|
package io.dataease.service.wizard;
|
||||||
|
|
||||||
|
import io.dataease.commons.utils.HttpClientConfig;
|
||||||
import io.dataease.commons.utils.HttpClientUtil;
|
import io.dataease.commons.utils.HttpClientUtil;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
@ -23,8 +24,10 @@ public class ReptileService {
|
|||||||
public List lastActive() {
|
public List lastActive() {
|
||||||
List result = new ArrayList();
|
List result = new ArrayList();
|
||||||
try {
|
try {
|
||||||
|
HttpClientConfig config = new HttpClientConfig();
|
||||||
|
config.setCocketTimeout(5000);
|
||||||
//爬取最新数据
|
//爬取最新数据
|
||||||
Document doc = Jsoup.parse(HttpClientUtil.get(blogUrl, null));
|
Document doc = Jsoup.parse(HttpClientUtil.get(blogUrl, config));
|
||||||
Elements elementsContent = doc.getElementsByAttributeValue("rel", "bookmark");
|
Elements elementsContent = doc.getElementsByAttributeValue("rel", "bookmark");
|
||||||
Elements elementsTime = doc.getElementsByTag("time");
|
Elements elementsTime = doc.getElementsByTag("time");
|
||||||
for(int i = 0;i<infoCount;i++){
|
for(int i = 0;i<infoCount;i++){
|
||||||
@ -36,6 +39,7 @@ public class ReptileService {
|
|||||||
result.add(infoMap);
|
result.add(infoMap);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
//ignore
|
//ignore
|
||||||
Map<String, String> infoMap = new HashMap();
|
Map<String, String> infoMap = new HashMap();
|
||||||
infoMap.put("title","支持移动端展示,数据源新增对DB2的支持,DataEase开源数据可视化分析平台v1.6.0发布");
|
infoMap.put("title","支持移动端展示,数据源新增对DB2的支持,DataEase开源数据可视化分析平台v1.6.0发布");
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
:search-count="searchCount"
|
:search-count="searchCount"
|
||||||
:h="config.style.height"
|
:h="config.style.height"
|
||||||
:edit-mode="'preview'"
|
:edit-mode="'preview'"
|
||||||
|
:filters="filters"
|
||||||
:terminal="terminal"
|
:terminal="terminal"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -74,6 +75,10 @@ export default {
|
|||||||
terminal: {
|
terminal: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'pc'
|
default: 'pc'
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
:search-count="searchCount"
|
:search-count="searchCount"
|
||||||
:in-screen="inScreen"
|
:in-screen="inScreen"
|
||||||
:terminal="terminal"
|
:terminal="terminal"
|
||||||
|
:filters="filterMap[item.propValue && item.propValue.viewId]"
|
||||||
/>
|
/>
|
||||||
<!--视图详情-->
|
<!--视图详情-->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
@ -65,7 +66,7 @@ import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
|
|||||||
import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
|
import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
|
||||||
import UserViewMobileDialog from '@/components/canvas/custom-component/UserViewMobileDialog'
|
import UserViewMobileDialog from '@/components/canvas/custom-component/UserViewMobileDialog'
|
||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
|
import { buildFilterMap } from '@/utils/conditionUtil'
|
||||||
export default {
|
export default {
|
||||||
components: { UserViewMobileDialog, ComponentWrapper, UserViewDialog, CanvasOptBar },
|
components: { UserViewMobileDialog, ComponentWrapper, UserViewDialog, CanvasOptBar },
|
||||||
model: {
|
model: {
|
||||||
@ -193,7 +194,11 @@ export default {
|
|||||||
'componentData',
|
'componentData',
|
||||||
'canvasStyleData',
|
'canvasStyleData',
|
||||||
'componentGap'
|
'componentGap'
|
||||||
])
|
]),
|
||||||
|
filterMap() {
|
||||||
|
const map = buildFilterMap(this.componentData)
|
||||||
|
return map
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
componentData: {
|
componentData: {
|
||||||
|
@ -101,6 +101,7 @@
|
|||||||
:id="'component' + item.id"
|
:id="'component' + item.id"
|
||||||
ref="wrapperChild"
|
ref="wrapperChild"
|
||||||
class="component"
|
class="component"
|
||||||
|
:filters="filterMap[item.propValue.viewId]"
|
||||||
:style="getComponentStyleDefault(item.style)"
|
:style="getComponentStyleDefault(item.style)"
|
||||||
:prop-value="item.propValue"
|
:prop-value="item.propValue"
|
||||||
:element="item"
|
:element="item"
|
||||||
@ -191,7 +192,7 @@ import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
|
|||||||
import DragShadow from '@/components/DeDrag/shadow'
|
import DragShadow from '@/components/DeDrag/shadow'
|
||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import LinkJumpSet from '@/views/panel/LinkJumpSet'
|
import LinkJumpSet from '@/views/panel/LinkJumpSet'
|
||||||
|
import { buildFilterMap } from '@/utils/conditionUtil'
|
||||||
// 挤占式画布
|
// 挤占式画布
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
@ -930,6 +931,7 @@ export default {
|
|||||||
dragComponentInfo() {
|
dragComponentInfo() {
|
||||||
return this.$store.state.dragComponentInfo
|
return this.$store.state.dragComponentInfo
|
||||||
},
|
},
|
||||||
|
|
||||||
...mapState([
|
...mapState([
|
||||||
'componentData',
|
'componentData',
|
||||||
'curComponent',
|
'curComponent',
|
||||||
@ -941,7 +943,10 @@ export default {
|
|||||||
'componentGap',
|
'componentGap',
|
||||||
'mobileLayoutStatus',
|
'mobileLayoutStatus',
|
||||||
'curCanvasScale'
|
'curCanvasScale'
|
||||||
])
|
]),
|
||||||
|
filterMap() {
|
||||||
|
return buildFilterMap(this.componentData)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
customStyle: {
|
customStyle: {
|
||||||
|
@ -114,11 +114,15 @@ export default {
|
|||||||
terminal: {
|
terminal: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'pc'
|
default: 'pc'
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
filterInit: false, // 标记是否已经通过watch.filters 进行初始化,如果filterInit=true 则create放弃数据初始化防止数据覆盖
|
isFirstLoad: true, // 是否是第一次加载
|
||||||
refId: null,
|
refId: null,
|
||||||
chart: BASE_CHART_STRING,
|
chart: BASE_CHART_STRING,
|
||||||
requestStatus: 'success',
|
requestStatus: 'success',
|
||||||
@ -179,7 +183,7 @@ export default {
|
|||||||
},
|
},
|
||||||
filter() {
|
filter() {
|
||||||
const filter = {}
|
const filter = {}
|
||||||
filter.filter = this.element.filters
|
filter.filter = this.isFirstLoad ? this.filters : this.cfilters
|
||||||
filter.linkageFilters = this.element.linkageFilters
|
filter.linkageFilters = this.element.linkageFilters
|
||||||
filter.drill = this.drillClickDimensionList
|
filter.drill = this.drillClickDimensionList
|
||||||
filter.resultCount = this.resultCount
|
filter.resultCount = this.resultCount
|
||||||
@ -187,7 +191,7 @@ export default {
|
|||||||
filter.queryFrom = 'panel'
|
filter.queryFrom = 'panel'
|
||||||
return filter
|
return filter
|
||||||
},
|
},
|
||||||
filters() {
|
cfilters() {
|
||||||
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
|
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
|
||||||
if (!this.element.filters) return []
|
if (!this.element.filters) return []
|
||||||
return JSON.parse(JSON.stringify(this.element.filters))
|
return JSON.parse(JSON.stringify(this.element.filters))
|
||||||
@ -242,12 +246,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'filters': function(val1, val2) {
|
'cfilters': {
|
||||||
if (isChange(val1, val2)) {
|
handler: function(val1, val2) {
|
||||||
this.filterInit = true
|
if (isChange(val1, val2) && !this.isFirstLoad) {
|
||||||
this.getData(this.element.propValue.viewId)
|
this.getData(this.element.propValue.viewId)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
deep: true
|
||||||
|
},
|
||||||
linkageFilters: {
|
linkageFilters: {
|
||||||
handler(newVal, oldVal) {
|
handler(newVal, oldVal) {
|
||||||
if (isChange(newVal, oldVal)) {
|
if (isChange(newVal, oldVal)) {
|
||||||
@ -318,7 +324,8 @@ export default {
|
|||||||
this.refId = uuid.v1
|
this.refId = uuid.v1
|
||||||
if (this.element && this.element.propValue && this.element.propValue.viewId) {
|
if (this.element && this.element.propValue && this.element.propValue.viewId) {
|
||||||
// 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化
|
// 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化
|
||||||
!this.filterInit && this.getData(this.element.propValue.viewId, false)
|
|
||||||
|
this.getData(this.element.propValue.viewId, false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -399,6 +406,7 @@ export default {
|
|||||||
this.requestStatus = 'error'
|
this.requestStatus = 'error'
|
||||||
this.message = response.message
|
this.message = response.message
|
||||||
}
|
}
|
||||||
|
this.isFirstLoad = false
|
||||||
return true
|
return true
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.requestStatus = 'error'
|
this.requestStatus = 'error'
|
||||||
@ -413,6 +421,7 @@ export default {
|
|||||||
this.message = err
|
this.message = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.isFirstLoad = false
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,7 @@ export default {
|
|||||||
state.lastSaveSnapshotIndex = deepCopy(state.snapshotIndex)
|
state.lastSaveSnapshotIndex = deepCopy(state.snapshotIndex)
|
||||||
},
|
},
|
||||||
recordStyleChange(state) {
|
recordStyleChange(state) {
|
||||||
if (state.curComponent) {
|
|
||||||
state.styleChangeTimes++
|
state.styleChangeTimes++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -67,6 +67,39 @@ class NumberRangeServiceImpl extends WidgetService {
|
|||||||
return field['deType'] === 2 || field['deType'] === 3
|
return field['deType'] === 2 || field['deType'] === 3
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getParam(element) {
|
||||||
|
if (element.options.value && element.options.value.length > 0) {
|
||||||
|
const values = this.element.options.value
|
||||||
|
const min = values[0]
|
||||||
|
let max = null
|
||||||
|
if (values.length > 1) {
|
||||||
|
max = values[1]
|
||||||
|
}
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: [min, max],
|
||||||
|
operator: 'between'
|
||||||
|
}
|
||||||
|
if (min && max) {
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
if (!min && !max) {
|
||||||
|
param.value = []
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
if (min) {
|
||||||
|
param.value = [min]
|
||||||
|
param.operator = 'ge'
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
if (max) {
|
||||||
|
param.value = [max]
|
||||||
|
param.operator = 'le'
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const numberRangeServiceImpl = new NumberRangeServiceImpl()
|
const numberRangeServiceImpl = new NumberRangeServiceImpl()
|
||||||
export default numberRangeServiceImpl
|
export default numberRangeServiceImpl
|
||||||
|
@ -81,6 +81,15 @@ class NumberSelectGridServiceImpl extends WidgetService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
const value = element.options.value
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: !value ? [] : Array.isArray(value) ? value : value.toString().split(','),
|
||||||
|
operator: element.options.attrs.multiple ? 'in' : 'eq'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const numberSelectGridServiceImpl = new NumberSelectGridServiceImpl()
|
const numberSelectGridServiceImpl = new NumberSelectGridServiceImpl()
|
||||||
export default numberSelectGridServiceImpl
|
export default numberSelectGridServiceImpl
|
||||||
|
@ -82,6 +82,15 @@ class NumberSelectServiceImpl extends WidgetService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
const value = element.options.value
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: !value ? [] : Array.isArray(value) ? value : value.toString().split(','),
|
||||||
|
operator: element.options.attrs.multiple ? 'in' : 'eq'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const numberSelectServiceImpl = new NumberSelectServiceImpl()
|
const numberSelectServiceImpl = new NumberSelectServiceImpl()
|
||||||
export default numberSelectServiceImpl
|
export default numberSelectServiceImpl
|
||||||
|
@ -67,6 +67,15 @@ class TextInputServiceImpl extends WidgetService {
|
|||||||
return field['deType'] === 0
|
return field['deType'] === 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
const value = element.options.value
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: !value ? [] : Array.isArray(value) ? value : [value],
|
||||||
|
operator: 'like'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const textInputServiceImpl = new TextInputServiceImpl()
|
const textInputServiceImpl = new TextInputServiceImpl()
|
||||||
export default textInputServiceImpl
|
export default textInputServiceImpl
|
||||||
|
@ -81,6 +81,15 @@ class TextSelectGridServiceImpl extends WidgetService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
const value = element.options.value
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: !value ? [] : Array.isArray(value) ? value : value.toString().split(','),
|
||||||
|
operator: element.options.attrs.multiple ? 'in' : 'eq'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const textSelectGridServiceImpl = new TextSelectGridServiceImpl()
|
const textSelectGridServiceImpl = new TextSelectGridServiceImpl()
|
||||||
export default textSelectGridServiceImpl
|
export default textSelectGridServiceImpl
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
import { WidgetService } from '../service/WidgetService'
|
import { WidgetService } from '../service/WidgetService'
|
||||||
|
|
||||||
const leftPanel = {
|
const leftPanel = {
|
||||||
icon: 'iconfont icon-xialakuang',
|
icon: 'iconfont icon-xialakuang',
|
||||||
label: 'detextselect.label',
|
label: 'detextselect.label',
|
||||||
@ -81,6 +80,16 @@ class TextSelectServiceImpl extends WidgetService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getParam(element) {
|
||||||
|
const value = element.options.value
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: !value ? [] : Array.isArray(value) ? value : value.toString().split(','),
|
||||||
|
operator: element.options.attrs.multiple ? 'in' : 'eq'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const textSelectServiceImpl = new TextSelectServiceImpl()
|
const textSelectServiceImpl = new TextSelectServiceImpl()
|
||||||
export default textSelectServiceImpl
|
export default textSelectServiceImpl
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
WidgetService
|
WidgetService
|
||||||
} from '../service/WidgetService'
|
} from '../service/WidgetService'
|
||||||
|
import {
|
||||||
|
timeSection
|
||||||
|
} from '@/utils'
|
||||||
const leftPanel = {
|
const leftPanel = {
|
||||||
icon: 'iconfont icon-riqi',
|
icon: 'iconfont icon-riqi',
|
||||||
label: 'dedaterange.label',
|
label: 'dedaterange.label',
|
||||||
@ -222,6 +224,64 @@ class TimeDateRangeServiceImpl extends WidgetService {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
let timeArr = []
|
||||||
|
if (element.options.attrs.default.isDynamic) {
|
||||||
|
let value = this.dynamicDateFormNow(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
} else {
|
||||||
|
let value = this.fillValueDerfault(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
}
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: timeArr,
|
||||||
|
operator: 'between'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
fillValueDerfault(element) {
|
||||||
|
const defaultV = element.options.value === null ? '' : element.options.value.toString()
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return defaultV.split(',').map(item => parseFloat(item))
|
||||||
|
} else {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return parseFloat(defaultV.split(',')[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formatFilterValue(values) {
|
||||||
|
if (values === null) return []
|
||||||
|
if (Array.isArray(values)) return values
|
||||||
|
return [values]
|
||||||
|
}
|
||||||
|
formatValues(values, element) {
|
||||||
|
if (!values || values.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (values.length !== 2) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
let start = values[0]
|
||||||
|
let end = values[1]
|
||||||
|
start = timeSection(start, 'date')[0]
|
||||||
|
end = timeSection(end, 'date')[1]
|
||||||
|
const results = [start, end]
|
||||||
|
return results
|
||||||
|
} else {
|
||||||
|
const value = values[0]
|
||||||
|
return timeSection(parseFloat(value), element.options.attrs.type)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const timeDateRangeServiceImpl = new TimeDateRangeServiceImpl()
|
const timeDateRangeServiceImpl = new TimeDateRangeServiceImpl()
|
||||||
export default timeDateRangeServiceImpl
|
export default timeDateRangeServiceImpl
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
WidgetService
|
WidgetService
|
||||||
} from '../service/WidgetService'
|
} from '../service/WidgetService'
|
||||||
|
import {
|
||||||
|
timeSection
|
||||||
|
} from '@/utils'
|
||||||
const leftPanel = {
|
const leftPanel = {
|
||||||
icon: 'iconfont icon-ri',
|
icon: 'iconfont icon-ri',
|
||||||
label: 'dedate.label',
|
label: 'dedate.label',
|
||||||
@ -153,6 +155,64 @@ class TimeDateServiceImpl extends WidgetService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
let timeArr = []
|
||||||
|
if (element.options.attrs.default.isDynamic) {
|
||||||
|
let value = this.dynamicDateFormNow(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
} else {
|
||||||
|
let value = this.fillValueDerfault(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
}
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: timeArr,
|
||||||
|
operator: 'between'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
fillValueDerfault(element) {
|
||||||
|
const defaultV = element.options.value === null ? '' : element.options.value.toString()
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return defaultV.split(',').map(item => parseFloat(item))
|
||||||
|
} else {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return parseFloat(defaultV.split(',')[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formatFilterValue(values) {
|
||||||
|
if (values === null) return []
|
||||||
|
if (Array.isArray(values)) return values
|
||||||
|
return [values]
|
||||||
|
}
|
||||||
|
formatValues(values, element) {
|
||||||
|
if (!values || values.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (values.length !== 2) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
let start = values[0]
|
||||||
|
let end = values[1]
|
||||||
|
start = timeSection(start, 'date')[0]
|
||||||
|
end = timeSection(end, 'date')[1]
|
||||||
|
const results = [start, end]
|
||||||
|
return results
|
||||||
|
} else {
|
||||||
|
const value = values[0]
|
||||||
|
return timeSection(parseFloat(value), element.options.attrs.type)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const timeDateServiceImpl = new TimeDateServiceImpl({
|
const timeDateServiceImpl = new TimeDateServiceImpl({
|
||||||
name: 'timeDateWidget'
|
name: 'timeDateWidget'
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { WidgetService } from '../service/WidgetService'
|
import { WidgetService } from '../service/WidgetService'
|
||||||
|
import {
|
||||||
|
timeSection
|
||||||
|
} from '@/utils'
|
||||||
const leftPanel = {
|
const leftPanel = {
|
||||||
icon: 'iconfont icon-yue',
|
icon: 'iconfont icon-yue',
|
||||||
label: 'deyearmonth.label',
|
label: 'deyearmonth.label',
|
||||||
@ -119,6 +121,64 @@ class TimeMonthServiceImpl extends WidgetService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
let timeArr = []
|
||||||
|
if (element.options.attrs.default.isDynamic) {
|
||||||
|
let value = this.dynamicDateFormNow(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
} else {
|
||||||
|
let value = this.fillValueDerfault(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
}
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: timeArr,
|
||||||
|
operator: 'between'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
fillValueDerfault(element) {
|
||||||
|
const defaultV = element.options.value === null ? '' : element.options.value.toString()
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return defaultV.split(',').map(item => parseFloat(item))
|
||||||
|
} else {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return parseFloat(defaultV.split(',')[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formatFilterValue(values) {
|
||||||
|
if (values === null) return []
|
||||||
|
if (Array.isArray(values)) return values
|
||||||
|
return [values]
|
||||||
|
}
|
||||||
|
formatValues(values, element) {
|
||||||
|
if (!values || values.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (values.length !== 2) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
let start = values[0]
|
||||||
|
let end = values[1]
|
||||||
|
start = timeSection(start, 'date')[0]
|
||||||
|
end = timeSection(end, 'date')[1]
|
||||||
|
const results = [start, end]
|
||||||
|
return results
|
||||||
|
} else {
|
||||||
|
const value = values[0]
|
||||||
|
return timeSection(parseFloat(value), element.options.attrs.type)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const timeMonthServiceImpl = new TimeMonthServiceImpl()
|
const timeMonthServiceImpl = new TimeMonthServiceImpl()
|
||||||
export default timeMonthServiceImpl
|
export default timeMonthServiceImpl
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { WidgetService } from '../service/WidgetService'
|
import { WidgetService } from '../service/WidgetService'
|
||||||
|
import {
|
||||||
|
timeSection
|
||||||
|
} from '@/utils'
|
||||||
const leftPanel = {
|
const leftPanel = {
|
||||||
icon: 'iconfont icon-nian',
|
icon: 'iconfont icon-nian',
|
||||||
label: 'deyear.label',
|
label: 'deyear.label',
|
||||||
@ -110,6 +112,64 @@ class TimeYearServiceImpl extends WidgetService {
|
|||||||
return new Date(dynamicSuffix === 'before' ? (nowYear - dynamicPrefix) : (nowYear + dynamicPrefix), 0, 1).getTime()
|
return new Date(dynamicSuffix === 'before' ? (nowYear - dynamicPrefix) : (nowYear + dynamicPrefix), 0, 1).getTime()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getParam(element) {
|
||||||
|
let timeArr = []
|
||||||
|
if (element.options.attrs.default.isDynamic) {
|
||||||
|
let value = this.dynamicDateFormNow(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
} else {
|
||||||
|
let value = this.fillValueDerfault(element)
|
||||||
|
value = this.formatFilterValue(value)
|
||||||
|
timeArr = this.formatValues(value, element)
|
||||||
|
}
|
||||||
|
const param = {
|
||||||
|
component: element,
|
||||||
|
value: timeArr,
|
||||||
|
operator: 'between'
|
||||||
|
}
|
||||||
|
return param
|
||||||
|
}
|
||||||
|
fillValueDerfault(element) {
|
||||||
|
const defaultV = element.options.value === null ? '' : element.options.value.toString()
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return defaultV.split(',').map(item => parseFloat(item))
|
||||||
|
} else {
|
||||||
|
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV ===
|
||||||
|
'[object Object]') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return parseFloat(defaultV.split(',')[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formatFilterValue(values) {
|
||||||
|
if (values === null) return []
|
||||||
|
if (Array.isArray(values)) return values
|
||||||
|
return [values]
|
||||||
|
}
|
||||||
|
formatValues(values, element) {
|
||||||
|
if (!values || values.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (element.options.attrs.type === 'daterange') {
|
||||||
|
if (values.length !== 2) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
let start = values[0]
|
||||||
|
let end = values[1]
|
||||||
|
start = timeSection(start, 'date')[0]
|
||||||
|
end = timeSection(end, 'date')[1]
|
||||||
|
const results = [start, end]
|
||||||
|
return results
|
||||||
|
} else {
|
||||||
|
const value = values[0]
|
||||||
|
return timeSection(parseFloat(value), element.options.attrs.type)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const timeYearServiceImpl = new TimeYearServiceImpl()
|
const timeYearServiceImpl = new TimeYearServiceImpl()
|
||||||
export default timeYearServiceImpl
|
export default timeYearServiceImpl
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
import { Condition } from '@/components/widget/bean/Condition'
|
import { Condition } from '@/components/widget/bean/Condition'
|
||||||
|
import { ApplicationContext } from '@/utils/ApplicationContext'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断两个conditions数组是否相同
|
* 判断两个conditions数组是否相同
|
||||||
* @param {*} conditions1
|
* @param {*} conditions1
|
||||||
@ -36,3 +38,36 @@ export const formatLinkageCondition = obj => {
|
|||||||
const condition = new Condition(null, fieldId, operator, value, viewIds)
|
const condition = new Condition(null, fieldId, operator, value, viewIds)
|
||||||
return condition
|
return condition
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const buildFilterMap = panelItems => {
|
||||||
|
const viewIdMatch = (viewIds, viewId) => !viewIds || viewIds.length === 0 || viewIds.includes(viewId)
|
||||||
|
const result = {}
|
||||||
|
panelItems.forEach(element => {
|
||||||
|
if (element.type === 'view') {
|
||||||
|
result[element.propValue.viewId] = []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
panelItems.forEach(element => {
|
||||||
|
if (element.type !== 'custom') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const widget = ApplicationContext.getService(element.serviceName)
|
||||||
|
const param = widget.getParam(element)
|
||||||
|
const condition = formatCondition(param)
|
||||||
|
const vValid = valueValid(condition)
|
||||||
|
const filterComponentId = condition.componentId
|
||||||
|
Object.keys(result).forEach(viewId => {
|
||||||
|
const vidMatch = viewIdMatch(condition.viewIds, viewId)
|
||||||
|
const viewFilters = result[viewId]
|
||||||
|
let j = viewFilters.length
|
||||||
|
while (j--) {
|
||||||
|
const filter = viewFilters[j]
|
||||||
|
if (filter.componentId === filterComponentId) {
|
||||||
|
viewFilters.splice(j, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vidMatch && vValid && viewFilters.push(condition)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
@ -1860,29 +1860,29 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
addXaxis(e) {
|
addXaxis(e) {
|
||||||
if ((this.view.type === 'map' || this.view.type === 'word-cloud') && this.view.xaxis.length > 1) {
|
|
||||||
this.view.xaxis = [this.view.xaxis[0]]
|
|
||||||
}
|
|
||||||
if (this.view.type !== 'table-info') {
|
if (this.view.type !== 'table-info') {
|
||||||
this.dragCheckType(this.view.xaxis, 'd')
|
this.dragCheckType(this.view.xaxis, 'd')
|
||||||
}
|
}
|
||||||
this.dragMoveDuplicate(this.view.xaxis, e)
|
this.dragMoveDuplicate(this.view.xaxis, e)
|
||||||
|
if ((this.view.type === 'map' || this.view.type === 'word-cloud') && this.view.xaxis.length > 1) {
|
||||||
|
this.view.xaxis = [this.view.xaxis[0]]
|
||||||
|
}
|
||||||
this.calcData(true)
|
this.calcData(true)
|
||||||
},
|
},
|
||||||
addYaxis(e) {
|
addYaxis(e) {
|
||||||
|
this.dragCheckType(this.view.yaxis, 'q')
|
||||||
|
this.dragMoveDuplicate(this.view.yaxis, e)
|
||||||
if ((this.view.type === 'map' || this.view.type === 'waterfall' || this.view.type === 'word-cloud') && this.view.yaxis.length > 1) {
|
if ((this.view.type === 'map' || this.view.type === 'waterfall' || this.view.type === 'word-cloud') && this.view.yaxis.length > 1) {
|
||||||
this.view.yaxis = [this.view.yaxis[0]]
|
this.view.yaxis = [this.view.yaxis[0]]
|
||||||
}
|
}
|
||||||
this.dragCheckType(this.view.yaxis, 'q')
|
|
||||||
this.dragMoveDuplicate(this.view.yaxis, e)
|
|
||||||
this.calcData(true)
|
this.calcData(true)
|
||||||
},
|
},
|
||||||
addYaxisExt(e) {
|
addYaxisExt(e) {
|
||||||
|
this.dragCheckType(this.view.yaxisExt, 'q')
|
||||||
|
this.dragMoveDuplicate(this.view.yaxisExt, e)
|
||||||
if (this.view.type === 'map' && this.view.yaxisExt.length > 1) {
|
if (this.view.type === 'map' && this.view.yaxisExt.length > 1) {
|
||||||
this.view.yaxisExt = [this.view.yaxisExt[0]]
|
this.view.yaxisExt = [this.view.yaxisExt[0]]
|
||||||
}
|
}
|
||||||
this.dragCheckType(this.view.yaxisExt, 'q')
|
|
||||||
this.dragMoveDuplicate(this.view.yaxisExt, e)
|
|
||||||
this.calcData(true)
|
this.calcData(true)
|
||||||
},
|
},
|
||||||
moveToDimension(e) {
|
moveToDimension(e) {
|
||||||
|
@ -82,7 +82,7 @@ export default {
|
|||||||
color: var(--TextPrimary, #6D6D6D);
|
color: var(--TextPrimary, #6D6D6D);
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 8px;
|
bottom: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ export default {
|
|||||||
head: this.$t('wizard.online_document'),
|
head: this.$t('wizard.online_document'),
|
||||||
content: this.$t('wizard.online_document_hint'),
|
content: this.$t('wizard.online_document_hint'),
|
||||||
bottom: '',
|
bottom: '',
|
||||||
href: 'https://dataease.io/docs/dev_manual/dev_manual/',
|
href: 'https://dataease.io/docs/index.html',
|
||||||
component: 'CardDetail'
|
component: 'CardDetail'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user