Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
wangjiahao
2021-06-10 17:12:45 +08:00
72 changed files with 1575 additions and 596 deletions

View File

@@ -19,6 +19,10 @@ export default {
className: {
type: String,
default: ''
},
customClass: {
type: String,
default: ''
}
},
computed: {
@@ -31,9 +35,11 @@ export default {
svgClass() {
if (this.className) {
return 'svg-icon ' + this.className
} else {
return 'svg-icon'
}
if (this.customClass) {
return this.customClass
}
return 'svg-icon'
},
styleExternalIcon() {
return {

View File

@@ -17,7 +17,6 @@
:style="getStyle(config.style)"
:prop-value="config.propValue"
:element="config"
:filter="filter"
/>
</div>
</template>
@@ -32,11 +31,13 @@ export default {
props: {
config: {
type: Object,
require: true
require: true,
default: null
},
filter: {
type: Object,
require: false
require: false,
default: null
}
},
mounted() {

View File

@@ -89,7 +89,7 @@ export default {
deleteCurCondition() {
if (this.curComponent.type === 'custom') {
this.$store.dispatch('conditions/delete', { componentId: this.curComponent.id })
this.$store.commit('removeViewFilter', this.curComponent.id)
bus.$emit('delete-condition', { componentId: this.curComponent.id })
}
},

View File

@@ -102,7 +102,7 @@ export default {
},
created() {
// 先清除查询条件
this.$store.dispatch('conditions/clear')
// this.$store.dispatch('conditions/clear')
},
methods: {
changeStyleWithScale,

View File

@@ -36,15 +36,18 @@ export default {
},
element: {
require: true,
type: Object
type: Object,
default: null
},
defaultStyle: {
require: true,
type: Object
type: Object,
default: null
},
index: {
require: true,
type: [Number, String]
type: [Number, String],
default: null
}
},
data() {
@@ -200,6 +203,7 @@ export default {
pointList.forEach(point => {
const angle = mod360(initialAngle[point] + rotate)
const len = angleToCursor.length
// eslint-disable-next-line no-constant-condition
while (true) {
lastMatchIndex = (lastMatchIndex + 1) % len
const angleLimit = angleToCursor[lastMatchIndex]

View File

@@ -50,7 +50,6 @@
:style="getComponentStyle(item.style)"
:prop-value="item.propValue"
:element="item"
:filter="filter"
:out-style="getShapeStyleInt(item.style)"
/>
<component
@@ -109,8 +108,6 @@ import Area from './Area'
import eventBus from '@/components/canvas/utils/eventBus'
import Grid from './Grid'
import { changeStyleWithScale } from '@/components/canvas/utils/translate'
import { Condition } from '@/components/widget/bean/Condition'
import bus from '@/utils/bus'
export default {
components: { Shape, ContextMenu, MarkLine, Area, Grid, DeDrag },
@@ -119,13 +116,11 @@ export default {
type: Boolean,
default: true
},
filter: {
type: Object,
require: false
},
outStyle: {
type: Object,
require: false
require: false,
default: null
}
},
data() {
@@ -171,20 +166,6 @@ export default {
hLine: []
}
},
watch: {
outStyle: {
handler(newVal, oldVla) {
this.changeScale()
},
deep: true
},
canvasStyleData: {
handler(newVal, oldVla) {
this.changeScale()
},
deep: true
}
},
computed: {
customStyle() {
let style = {
@@ -218,6 +199,26 @@ export default {
'editor'
])
},
watch: {
outStyle: {
handler(newVal, oldVla) {
this.changeScale()
},
deep: true
},
canvasStyleData: {
handler(newVal, oldVla) {
this.changeScale()
},
deep: true
},
componentData: {
handler(newVal, oldVla) {
console.log('11111')
},
deep: true
}
},
mounted() {
// 获取编辑器元素
@@ -226,12 +227,12 @@ export default {
eventBus.$on('hideArea', () => {
this.hideArea()
})
bus.$on('delete-condition', condition => {
this.deleteCondition(condition)
})
// bus.$on('delete-condition', condition => {
// this.deleteCondition(condition)
// })
},
created() {
this.$store.dispatch('conditions/clear')
// this.$store.dispatch('conditions/clear')
},
methods: {
changeStyleWithScale,
@@ -446,40 +447,6 @@ export default {
return height > newHeight ? height : newHeight
},
filterValueChange(value) {
// console.log('emit:' + value)
},
setConditionValue(obj) {
const { component, value, operator } = obj
const fieldId = component.options.attrs.fieldId
const viewIds = component.options.attrs.viewIds
const condition = new Condition(component.id, fieldId, operator, value, viewIds)
this.addCondition(condition)
},
addCondition(condition) {
let conditionExist = false
for (let index = 0; index < this.conditions.length; index++) {
const element = this.conditions[index]
if (condition.componentId === element.componentId) {
this.conditions[index] = condition
conditionExist = true
}
}
!conditionExist && this.conditions.push(condition)
this.executeSearch()
},
deleteCondition(condition) {
this.conditions = this.conditions.filter(item => {
const componentIdSuitable = !condition.componentId || (item.componentId === condition.componentId)
const fieldIdSuitable = !condition.fieldId || (item.fieldId === condition.fieldId)
return !(componentIdSuitable && fieldIdSuitable)
})
this.executeSearch()
},
executeSearch() {
// console.log('当前查询条件是: ' + JSON.stringify(this.conditions))
},
format(value, scale) {
// 自适应画布区域 返回原值
if (this.canvasStyleData.selfAdaption) {

View File

@@ -22,7 +22,7 @@ import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
import { uuid } from 'vue-uuid'
import { mapState } from 'vuex'
import { isChange } from '@/utils/conditionUtil'
import {
DEFAULT_COLOR_CASE,
DEFAULT_SIZE,
@@ -40,17 +40,14 @@ export default {
components: { ChartComponent, TableNormal, LabelNormal },
props: {
element: {
type: Object
},
filter: {
type: Object,
required: false,
default: function() {
return {
filter: []
}
}
default: null
},
// filters: {
// type: Array,
// required: false,
// default: null
// },
outStyle: {
type: Object,
required: false,
@@ -59,38 +56,6 @@ export default {
}
}
},
watch: {
'$store.getters.conditions': function(newVal, oldVal) {
this.filter.filter = newVal
this.getData(this.element.propValue.viewId)
},
filter(val) {
this.getData(this.element.propValue.viewId)
},
// deep监听panel 如果改变 提交到 store
canvasStyleData: {
handler(newVal, oldVla) {
// this.chart.stylePriority == panel 优先使用仪表板样式
this.mergeStyle()
},
deep: true
},
// 监听外部的样式变化
outStyle: {
handler(newVal, oldVla) {
if (this.$refs[this.element.propValue.id]) {
this.$refs[this.element.propValue.id].chartResize()
}
},
deep: true
}
},
created() {
this.refId = uuid.v1
},
computed: mapState([
'canvasStyleData'
]),
data() {
return {
refId: null,
@@ -120,8 +85,49 @@ export default {
message: null
}
},
computed: {
filter() {
const filter = {}
filter.filter = this.element.filters
return filter
},
filters() {
// 必要 勿删勿该 watch数组哪怕发生变化 oldValue等于newValue ,深拷贝解决
if (!this.element.filters) return []
return JSON.parse(JSON.stringify(this.element.filters))
},
...mapState([
'canvasStyleData'
])
},
watch: {
'filters': function(val1, val2) {
// this.getData(this.element.propValue.viewId)
isChange(val1, val2) && this.getData(this.element.propValue.viewId)
},
// deep监听panel 如果改变 提交到 store
canvasStyleData: {
handler(newVal, oldVla) {
// this.chart.stylePriority == panel 优先使用仪表板样式
this.mergeStyle()
},
deep: true
},
// 监听外部的样式变化
outStyle: {
handler(newVal, oldVla) {
if (this.$refs[this.element.propValue.id]) {
this.$refs[this.element.propValue.id].chartResize()
}
},
deep: true
}
},
created() {
this.filter.filter = this.$store.getters.conditions
this.refId = uuid.v1
// this.filter.filter = this.$store.getters.conditions
this.getData(this.element.propValue.viewId)
},
mounted() {
@@ -173,6 +179,9 @@ export default {
return true
})
}
},
viewIdMatch(viewIds, viewId) {
return !viewIds || viewIds.length === 0 || viewIds.includes(viewId)
}
}
}

View File

@@ -47,7 +47,7 @@ export default {
operator: this.operator
}
param.value = this.formatValues(param.value)
this.inDraw && this.$store.dispatch('conditions/add', param)
this.inDraw && this.$store.commit('addViewFilter', param)
},
dateChange(value) {
this.setCondition()

View File

@@ -49,7 +49,7 @@ export default {
value: [this.options.value],
operator: this.operator
}
this.inDraw && this.$store.dispatch('conditions/add', param)
this.inDraw && this.$store.commit('addViewFilter', param)
},
setEdit() {
this.canEdit = true

View File

@@ -37,8 +37,6 @@ export default {
data() {
return {
options: null,
// operator: 'eq',
values: null,
showNumber: false
}
},
@@ -49,26 +47,32 @@ export default {
},
watch: {
'options.attrs.multiple': function(value) {
const sourceValue = this.options.value
if (value) {
this.values = []
!sourceValue && (this.options.value = [])
sourceValue && !Array.isArray(sourceValue) && (this.options.value = sourceValue.split(','))
!this.inDraw && (this.options.value = [])
} else {
this.values = null
!sourceValue && (this.options.value = null)
sourceValue && Array.isArray(sourceValue) && (this.options.value = sourceValue[0])
!this.inDraw && (this.options.value = null)
}
}
},
created() {
this.options = this.element.options
this.setCondition()
// this.setCondition()
},
mounted() {
this.$nextTick(() => {
})
// this.$nextTick(() => {
// this.options && this.options.value && this.changeValue(this.options.value)
// })
this.options && this.options.value && this.changeValue(this.options.value)
},
methods: {
changeValue(value) {
this.setCondition()
// this.inDraw && this.$emit('set-condition-value', { component: this.element, value: [value], operator: this.operator })
this.showNumber = false
this.$nextTick(() => {
if (!this.$refs.deSelect.$refs.tags || !this.options.attrs.multiple) {
@@ -89,7 +93,7 @@ export default {
value: Array.isArray(this.options.value) ? this.options.value : [this.options.value],
operator: this.operator
}
this.inDraw && this.$store.dispatch('conditions/add', param)
this.inDraw && this.$store.commit('addViewFilter', param)
}
}
}

View File

@@ -27,7 +27,7 @@ const drawPanel = {
type: 'custom',
style: {
width: 300,
height: 47,
height: 38,
fontSize: 14,
fontWeight: 500,
lineHeight: '',