1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| // import _ from 'lodash'
| import cloneDeep from 'lodash/cloneDeep'
| import ColorSelect from 'data-room-ui/ColorMultipleSelect/index.vue'
| const chartSettingMixins = {
| components: {
| ColorSelect
| },
| data () {
| return {
| customRules: {},
| colorScheme: [],
| colors: []
| }
| },
| computed: {
| },
| watch: {
| },
| mounted () {
| this.initColor()
| },
| methods: {
| initColor () {
| const colorSetting = this.config?.setting?.find(item => item.type === 'colorSelect')
| if (colorSetting && colorSetting.value && colorSetting.value.length) {
| this.colorScheme = cloneDeep(colorSetting.value)
| this.colors = cloneDeep(colorSetting.value)
| }
| },
| // 清空颜色
| delColor () {
| this.colors = []
| this.config.setting.forEach((set) => {
| if (set && set.type === 'colorSelect' && set.value && set.value.length) {
| set.value = []
| }
| })
| },
| addColor () {
| this.colors.push('')
| },
| updateColorScheme (colors) {
| this.colors = [...colors]
| this.config.setting.forEach((set) => {
| if (set && set.type === 'colorSelect') {
| set.value = [...colors]
| }
| })
| }
| }
| }
|
| export { chartSettingMixins }
|
|