Commit 3df887c793e08a2634a69c5b6d02d4a825365673

Authored by loveumiko
1 parent 891cda5e

fix: 修改看板组件

@@ -26,8 +26,8 @@ export const option: PublicPresetOptions = { @@ -26,8 +26,8 @@ export const option: PublicPresetOptions = {
26 [ComponentConfigFieldEnum.POINTER_COLOR]: '#15E2C6', 26 [ComponentConfigFieldEnum.POINTER_COLOR]: '#15E2C6',
27 [ComponentConfigFieldEnum.INSTRUMENT_PANEL_COLOR]: '#61D4C5', 27 [ComponentConfigFieldEnum.INSTRUMENT_PANEL_COLOR]: '#61D4C5',
28 [ComponentConfigFieldEnum.GRADIENT_INFO]: [ 28 [ComponentConfigFieldEnum.GRADIENT_INFO]: [
29 - { key: Gradient.FIRST, value: 30, color: GradientColor.FIRST },  
30 - { key: Gradient.SECOND, value: 100, color: GradientColor.SECOND }, 29 + { key: Gradient.FIRST, value: 0, color: GradientColor.FIRST },
  30 + { key: Gradient.SECOND, value: 1, color: GradientColor.SECOND },
31 ], 31 ],
32 }; 32 };
33 33
@@ -55,32 +55,12 @@ @@ -55,32 +55,12 @@
55 defaultValue: GradientColor.FIRST, 55 defaultValue: GradientColor.FIRST,
56 }, 56 },
57 { 57 {
58 - field: ComponentConfigFieldEnum.FIRST_PHASE_VALUE,  
59 - label: '起始阀值',  
60 - component: 'InputNumber',  
61 - componentProps: {  
62 - placeholder: '请输入起始阀值',  
63 - min: 0,  
64 - },  
65 - },  
66 - {  
67 field: ComponentConfigFieldEnum.SECOND_PHASE_COLOR, 58 field: ComponentConfigFieldEnum.SECOND_PHASE_COLOR,
68 label: '结尾颜色', 59 label: '结尾颜色',
69 component: 'ColorPicker', 60 component: 'ColorPicker',
70 changeEvent: 'update:value', 61 changeEvent: 'update:value',
71 defaultValue: GradientColor.SECOND, 62 defaultValue: GradientColor.SECOND,
72 }, 63 },
73 - {  
74 - field: ComponentConfigFieldEnum.SECOND_PHASE_VALUE,  
75 - label: '结尾阀值',  
76 - component: 'InputNumber',  
77 - componentProps: ({ formModel }) => {  
78 - return {  
79 - placeholder: '请输入二阶段阀值',  
80 - min: formModel[ComponentConfigFieldEnum.FIRST_PHASE_VALUE],  
81 - };  
82 - },  
83 - },  
84 ], 64 ],
85 showActionButtonGroup: false, 65 showActionButtonGroup: false,
86 labelWidth: 120, 66 labelWidth: 120,
@@ -96,12 +76,12 @@ @@ -96,12 +76,12 @@
96 gradientInfo: [ 76 gradientInfo: [
97 { 77 {
98 key: Gradient.FIRST, 78 key: Gradient.FIRST,
99 - value: item[ComponentConfigFieldEnum.FIRST_PHASE_VALUE], 79 + value: 0,
100 color: item[ComponentConfigFieldEnum.FIRST_PHASE_COLOR], 80 color: item[ComponentConfigFieldEnum.FIRST_PHASE_COLOR],
101 }, 81 },
102 { 82 {
103 key: Gradient.SECOND, 83 key: Gradient.SECOND,
104 - value: item[ComponentConfigFieldEnum.SECOND_PHASE_VALUE], 84 + value: 1,
105 color: item[ComponentConfigFieldEnum.SECOND_PHASE_COLOR], 85 color: item[ComponentConfigFieldEnum.SECOND_PHASE_COLOR],
106 }, 86 },
107 ], 87 ],
@@ -122,9 +102,9 @@ @@ -122,9 +102,9 @@
122 [ComponentConfigFieldEnum.UNIT]: unit, 102 [ComponentConfigFieldEnum.UNIT]: unit,
123 [ComponentConfigFieldEnum.FONT_COLOR]: fontColor, 103 [ComponentConfigFieldEnum.FONT_COLOR]: fontColor,
124 [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: showDeviceName, 104 [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: showDeviceName,
125 - [ComponentConfigFieldEnum.FIRST_PHASE_VALUE]: firstRecord?.value, 105 + [ComponentConfigFieldEnum.FIRST_PHASE_VALUE]: 0,
126 [ComponentConfigFieldEnum.FIRST_PHASE_COLOR]: firstRecord?.color, 106 [ComponentConfigFieldEnum.FIRST_PHASE_COLOR]: firstRecord?.color,
127 - [ComponentConfigFieldEnum.SECOND_PHASE_VALUE]: secondRecord?.value, 107 + [ComponentConfigFieldEnum.SECOND_PHASE_VALUE]: 1,
128 [ComponentConfigFieldEnum.SECOND_PHASE_COLOR]: secondRecord?.color, 108 [ComponentConfigFieldEnum.SECOND_PHASE_COLOR]: secondRecord?.color,
129 [ComponentConfigFieldEnum.POINTER_COLOR]: pointerColor, 109 [ComponentConfigFieldEnum.POINTER_COLOR]: pointerColor,
130 }; 110 };
@@ -46,14 +46,19 @@ @@ -46,14 +46,19 @@
46 if (!isArray(array)) { 46 if (!isArray(array)) {
47 return; 47 return;
48 } 48 }
49 - const item: any = [];  
50 - array.forEach((value, index) => {  
51 - item[index] =  
52 - index == 0  
53 - ? { offset: value.value == 100 ? 1 : 0, color: value.color }  
54 - : { offset: Number((value.value / 100).toFixed(1)), color: value.color };  
55 - });  
56 - return item; 49 + // const item: any = [];
  50 + // array.forEach((value, index) => {
  51 + // item[index] =
  52 + // index == 0
  53 + // ? { offset: value.value == 100 ? 1 : 0, color: value.color }
  54 + // : { offset: Number((value.value / 100).toFixed(1)), color: value.color };
  55 + // });
  56 + const colorList = array.map((item) => ({
  57 + offset: item.value,
  58 + color: item.color,
  59 + }));
  60 + console.log(array, colorList);
  61 + return colorList as any;
57 }; 62 };
58 63
59 const options = (): EChartsOption => { 64 const options = (): EChartsOption => {
@@ -25,8 +25,8 @@ export const option: PublicPresetOptions = { @@ -25,8 +25,8 @@ export const option: PublicPresetOptions = {
25 [ComponentConfigFieldEnum.POINTER_COLOR]: '#15E2C6', 25 [ComponentConfigFieldEnum.POINTER_COLOR]: '#15E2C6',
26 [ComponentConfigFieldEnum.INSTRUMENT_PANEL_COLOR]: '#61D4C5', 26 [ComponentConfigFieldEnum.INSTRUMENT_PANEL_COLOR]: '#61D4C5',
27 [ComponentConfigFieldEnum.GRADIENT_INFO]: [ 27 [ComponentConfigFieldEnum.GRADIENT_INFO]: [
28 - { key: Gradient.FIRST, value: 30, color: GradientColor.FIRST },  
29 - { key: Gradient.SECOND, value: 100, color: GradientColor.SECOND }, 28 + { key: Gradient.FIRST, value: 0, color: GradientColor.FIRST },
  29 + { key: Gradient.SECOND, value: 1, color: GradientColor.SECOND },
30 ], 30 ],
31 }; 31 };
32 32
@@ -47,32 +47,12 @@ @@ -47,32 +47,12 @@
47 defaultValue: GradientColor.FIRST, 47 defaultValue: GradientColor.FIRST,
48 }, 48 },
49 { 49 {
50 - field: ComponentConfigFieldEnum.FIRST_PHASE_VALUE,  
51 - label: '起始阀值',  
52 - component: 'InputNumber',  
53 - componentProps: {  
54 - placeholder: '请输入起始阀值',  
55 - min: 0,  
56 - },  
57 - },  
58 - {  
59 field: ComponentConfigFieldEnum.SECOND_PHASE_COLOR, 50 field: ComponentConfigFieldEnum.SECOND_PHASE_COLOR,
60 label: '结尾颜色', 51 label: '结尾颜色',
61 component: 'ColorPicker', 52 component: 'ColorPicker',
62 changeEvent: 'update:value', 53 changeEvent: 'update:value',
63 defaultValue: GradientColor.SECOND, 54 defaultValue: GradientColor.SECOND,
64 }, 55 },
65 - {  
66 - field: ComponentConfigFieldEnum.SECOND_PHASE_VALUE,  
67 - label: '结尾阀值',  
68 - component: 'InputNumber',  
69 - componentProps: ({ formModel }) => {  
70 - return {  
71 - placeholder: '请输入二阶段阀值',  
72 - min: formModel[ComponentConfigFieldEnum.FIRST_PHASE_VALUE],  
73 - };  
74 - },  
75 - },  
76 ], 56 ],
77 showActionButtonGroup: false, 57 showActionButtonGroup: false,
78 labelWidth: 120, 58 labelWidth: 120,
@@ -88,12 +68,12 @@ @@ -88,12 +68,12 @@
88 gradientInfo: [ 68 gradientInfo: [
89 { 69 {
90 key: Gradient.FIRST, 70 key: Gradient.FIRST,
91 - value: item[ComponentConfigFieldEnum.FIRST_PHASE_VALUE], 71 + value: 0,
92 color: item[ComponentConfigFieldEnum.FIRST_PHASE_COLOR], 72 color: item[ComponentConfigFieldEnum.FIRST_PHASE_COLOR],
93 }, 73 },
94 { 74 {
95 key: Gradient.SECOND, 75 key: Gradient.SECOND,
96 - value: item[ComponentConfigFieldEnum.SECOND_PHASE_VALUE], 76 + value: 1,
97 color: item[ComponentConfigFieldEnum.SECOND_PHASE_COLOR], 77 color: item[ComponentConfigFieldEnum.SECOND_PHASE_COLOR],
98 }, 78 },
99 ], 79 ],
@@ -114,12 +94,13 @@ @@ -114,12 +94,13 @@
114 [ComponentConfigFieldEnum.UNIT]: unit, 94 [ComponentConfigFieldEnum.UNIT]: unit,
115 [ComponentConfigFieldEnum.FONT_COLOR]: fontColor, 95 [ComponentConfigFieldEnum.FONT_COLOR]: fontColor,
116 [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: showDeviceName, 96 [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: showDeviceName,
117 - [ComponentConfigFieldEnum.FIRST_PHASE_VALUE]: firstRecord?.value, 97 + [ComponentConfigFieldEnum.FIRST_PHASE_VALUE]: 0,
118 [ComponentConfigFieldEnum.FIRST_PHASE_COLOR]: firstRecord?.color, 98 [ComponentConfigFieldEnum.FIRST_PHASE_COLOR]: firstRecord?.color,
119 - [ComponentConfigFieldEnum.SECOND_PHASE_VALUE]: secondRecord?.value, 99 + [ComponentConfigFieldEnum.SECOND_PHASE_VALUE]: 1,
120 [ComponentConfigFieldEnum.SECOND_PHASE_COLOR]: secondRecord?.color, 100 [ComponentConfigFieldEnum.SECOND_PHASE_COLOR]: secondRecord?.color,
121 [ComponentConfigFieldEnum.PROGRESS_BAR_CIRCLE]: progressBarCircle, 101 [ComponentConfigFieldEnum.PROGRESS_BAR_CIRCLE]: progressBarCircle,
122 }; 102 };
  103 + console.log(value, 'value');
123 return setFieldsValue(value); 104 return setFieldsValue(value);
124 }; 105 };
125 106
@@ -48,14 +48,11 @@ @@ -48,14 +48,11 @@
48 if (!isArray(array)) { 48 if (!isArray(array)) {
49 return; 49 return;
50 } 50 }
51 - const item: any = [];  
52 - array.forEach((value, index) => {  
53 - item[index] =  
54 - index == 0  
55 - ? { offset: value.value == 100 ? 1 : 0, color: value.color }  
56 - : { offset: Number((value.value / 100).toFixed(1)), color: value.color };  
57 - });  
58 - return item; 51 + const colorList = array.map((item) => ({
  52 + offset: item.value,
  53 + color: item.color,
  54 + }));
  55 + return colorList as any;
59 }; 56 };
60 57
61 const titleValue = ref<number>(20); 58 const titleValue = ref<number>(20);