Showing
28 changed files
with
156 additions
and
55 deletions
... | ... | @@ -3,11 +3,12 @@ |
3 | 3 | |
4 | 4 | defineProps<{ |
5 | 5 | config: ComponentPropsConfigType; |
6 | + getRatio?: string | number; | |
6 | 7 | }>(); |
7 | 8 | </script> |
8 | 9 | |
9 | 10 | <template> |
10 | - <div v-if="config.option?.componentInfo?.showDeviceName" class="h-8 font-semibold"> | |
11 | + <div v-if="config.option?.componentInfo?.showDeviceName" class="h-6 font-semibold"> | |
11 | 12 | {{ config.option.deviceRename || config.option.deviceName }} |
12 | 13 | </div> |
13 | 14 | </template> | ... | ... |
... | ... | @@ -11,7 +11,9 @@ |
11 | 11 | </script> |
12 | 12 | |
13 | 13 | <template> |
14 | - <div class="flex p-5 justify-center items-center text-gray-400 text-xs w-full dark:text-light-50"> | |
14 | + <div | |
15 | + class="flex p-2.5 justify-center items-center text-gray-400 text-xs w-full dark:text-light-50" | |
16 | + > | |
15 | 17 | <Tooltip :title="formatDate(time)"> |
16 | 18 | <div class="truncate px-1"> |
17 | 19 | <span>更新时间:</span> | ... | ... |
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | showTime: boolean; |
25 | 25 | status: IStatus; |
26 | 26 | time: number; |
27 | - fontSize?: number; | |
27 | + fontSize?: number | any; | |
28 | 28 | } |
29 | 29 | |
30 | 30 | const props = defineProps<{ |
... | ... | @@ -140,7 +140,7 @@ |
140 | 140 | showTime: item.showTime, |
141 | 141 | status: { text: '', color: '' }, |
142 | 142 | time: 0, |
143 | - fontSize: item.fontSize, | |
143 | + fontSize: item.fontSize || 14, | |
144 | 144 | }; |
145 | 145 | }) as any; |
146 | 146 | const { data, update } = message; |
... | ... | @@ -164,14 +164,16 @@ |
164 | 164 | |
165 | 165 | useCustomDataFetch(props, transformMessage, updateFn); |
166 | 166 | |
167 | - const { getScale } = useComponentScale(props); | |
167 | + const { getScale, getRatio } = useComponentScale(props); | |
168 | 168 | </script> |
169 | 169 | |
170 | 170 | <template> |
171 | 171 | <main :style="getScale" class="w-full h-full flex justify-center items-center"> |
172 | 172 | <div v-for="item in alarmStatusList" :key="item.id" class="flex flex-col items-center"> |
173 | 173 | <div class="flex justify-center items-center flex-col"> |
174 | - <div class="text-gray-500 truncate" :style="{ fontSize: item.fontSize + 'px' }" | |
174 | + <div | |
175 | + class="text-gray-500 truncate" | |
176 | + :style="{ fontSize: (getRatio ? getRatio * item.fontSize : item.fontSize) + 'px' }" | |
175 | 177 | >{{ |
176 | 178 | item.status.text |
177 | 179 | ? item.showDeviceName |
... | ... | @@ -180,7 +182,13 @@ |
180 | 182 | : '当前设备未发现告警' |
181 | 183 | }}{{ item.status.text }}</div |
182 | 184 | > |
183 | - <div :class="item.status.color"></div> | |
185 | + <div | |
186 | + :class="item.status.color" | |
187 | + :style="{ | |
188 | + height: (getRatio ? getRatio * 70 : 70) + 'px', | |
189 | + width: (getRatio ? getRatio * 70 : 70) + 'px', | |
190 | + }" | |
191 | + ></div> | |
184 | 192 | </div> |
185 | 193 | <UpdateTime v-show="item.showTime" :time="item.time" /> |
186 | 194 | </div> |
... | ... | @@ -190,8 +198,6 @@ |
190 | 198 | .alarm_state_critical { |
191 | 199 | background: #cf1322; |
192 | 200 | box-shadow: 0 -1px 7px 1px rgba(0, 0, 0, 0.2), inset 0 -1px 9px #304701, 0 2px 12px #cf1322; |
193 | - width: 60px; | |
194 | - height: 60px; | |
195 | 201 | border-radius: 50%; |
196 | 202 | margin: 10px 0; |
197 | 203 | } |
... | ... | @@ -199,8 +205,6 @@ |
199 | 205 | .alarm_state_major { |
200 | 206 | background: #ff6e03; |
201 | 207 | box-shadow: 0 -1px 7px 1px rgba(0, 0, 0, 0.2), inset 0 -1px 9px #304701, 0 2px 12px #ff6e03; |
202 | - width: 60px; | |
203 | - height: 60px; | |
204 | 208 | border-radius: 50%; |
205 | 209 | margin: 10px 0; |
206 | 210 | } |
... | ... | @@ -208,8 +212,6 @@ |
208 | 212 | .alarm_state_minor { |
209 | 213 | background: #ff0; |
210 | 214 | box-shadow: 0 -1px 7px 1px rgba(0, 0, 0, 0.2), inset 0 -1px 9px #304701, 0 2px 12px #ff0; |
211 | - width: 60px; | |
212 | - height: 60px; | |
213 | 215 | border-radius: 50%; |
214 | 216 | margin: 10px 0; |
215 | 217 | } |
... | ... | @@ -217,8 +219,6 @@ |
217 | 219 | .alarm_state_warning { |
218 | 220 | background: #edf760; |
219 | 221 | box-shadow: 0 -1px 7px 1px rgba(0, 0, 0, 0.2), inset 0 -1px 9px #304701, 0 2px 12px #edf760; |
220 | - width: 60px; | |
221 | - height: 60px; | |
222 | 222 | border-radius: 50%; |
223 | 223 | margin: 10px 0; |
224 | 224 | } |
... | ... | @@ -226,8 +226,6 @@ |
226 | 226 | .alarm_state_other { |
227 | 227 | background: #d3adf7; |
228 | 228 | box-shadow: 0 -1px 7px 1px rgba(0, 0, 0, 0.2), inset 0 -1px 9px #304701, 0 2px 12px #d3adf7; |
229 | - width: 60px; | |
230 | - height: 60px; | |
231 | 229 | border-radius: 50%; |
232 | 230 | margin: 10px 0; |
233 | 231 | } | ... | ... |
... | ... | @@ -49,6 +49,13 @@ export const formSchemas = (): FormSchema[] => { |
49 | 49 | }; |
50 | 50 | }, |
51 | 51 | }, |
52 | + | |
53 | + // { | |
54 | + // field: 'deviceIds', | |
55 | + // label: '设备id', | |
56 | + // show: false, | |
57 | + // component: 'Input', | |
58 | + // }, | |
52 | 59 | // { |
53 | 60 | // field: DataSourceField.DEVICE_PROFILE_ID, |
54 | 61 | // component: 'ApiSelect', |
... | ... | @@ -143,8 +150,10 @@ export const formSchemas = (): FormSchema[] => { |
143 | 150 | return []; |
144 | 151 | }, |
145 | 152 | onChange(_value, record: MasterDeviceList) { |
153 | + console.log(record, 'record'); | |
146 | 154 | setFieldsValue({ |
147 | 155 | [DataSourceField.DEVICE_NAME]: record?.label, |
156 | + deviceIds: record?.id, | |
148 | 157 | }); |
149 | 158 | }, |
150 | 159 | placeholder: '请选择设备', | ... | ... |
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | import { useAlarmContext } from '/@/views/visual/palette/hooks/useAlarmTime'; |
17 | 17 | |
18 | 18 | import { getMessage } from '../config'; |
19 | + // import { defHttp } from '/@/utils/http/axios'; | |
19 | 20 | |
20 | 21 | const props = defineProps<{ |
21 | 22 | config: ComponentPropsConfigType<typeof option>; |
... | ... | @@ -105,6 +106,13 @@ |
105 | 106 | columns: alarmColumns, |
106 | 107 | }); |
107 | 108 | |
109 | + // const getAlarmList = (params) => { | |
110 | + // return defHttp.post({ | |
111 | + // url: '/alarm/configuration/page', | |
112 | + // params, | |
113 | + // }); | |
114 | + // }; | |
115 | + | |
108 | 116 | const getDesign = computed(() => { |
109 | 117 | const { persetOption, option } = props.config; |
110 | 118 | const { dataSource = [] } = option || {}; |
... | ... | @@ -112,8 +120,15 @@ |
112 | 120 | return { |
113 | 121 | dataSource: dataSource?.map((item) => { |
114 | 122 | const { unit, showDeviceName } = item.componentInfo || {}; |
115 | - const { attribute, attributeName, attributeRename, deviceName, deviceRename, deviceId } = | |
116 | - item; | |
123 | + const { | |
124 | + attribute, | |
125 | + attributeName, | |
126 | + attributeRename, | |
127 | + deviceName, | |
128 | + deviceRename, | |
129 | + deviceId, | |
130 | + // deviceIds, | |
131 | + } = item; | |
117 | 132 | return { |
118 | 133 | unit: unit ?? presetUnit, |
119 | 134 | attribute, |
... | ... | @@ -123,6 +138,7 @@ |
123 | 138 | deviceName, |
124 | 139 | deviceRename, |
125 | 140 | id: deviceId, |
141 | + // deviceIds, | |
126 | 142 | }; |
127 | 143 | }), |
128 | 144 | }; |
... | ... | @@ -167,6 +183,20 @@ |
167 | 183 | useCustomDataFetch(props, transformMessage, updateFn); |
168 | 184 | |
169 | 185 | onMounted(async () => { |
186 | + // const deviceIds = unref(getDesign).dataSource.map((item) => item.deviceIds); | |
187 | + // let { startTs, endTs, time, pageSize }: any = unref(alarmForm) || {}; | |
188 | + // if (!startTs || !endTs) { | |
189 | + // startTs = Date.now() - time; | |
190 | + // endTs = Date.now(); | |
191 | + // } | |
192 | + // const values = { | |
193 | + // deviceIds, | |
194 | + // page: 1, | |
195 | + // pageSize, | |
196 | + // startTime: Number(startTs), | |
197 | + // endTime: Number(endTs), | |
198 | + // }; | |
199 | + | |
170 | 200 | await nextTick(); |
171 | 201 | resize(); |
172 | 202 | }); | ... | ... |
... | ... | @@ -56,6 +56,7 @@ |
56 | 56 | defaultValue: 14, |
57 | 57 | componentProps: { |
58 | 58 | min: 0, |
59 | + max: 100, | |
59 | 60 | formatter: (e) => { |
60 | 61 | const value = e.replace(/^0/g, ''); |
61 | 62 | if (value) { |
... | ... | @@ -73,6 +74,7 @@ |
73 | 74 | defaultValue: 14, |
74 | 75 | componentProps: { |
75 | 76 | min: 0, |
77 | + max: 100, | |
76 | 78 | formatter: (e) => { |
77 | 79 | const value = e.replace(/^0/g, ''); |
78 | 80 | if (value) { | ... | ... |
... | ... | @@ -62,6 +62,7 @@ |
62 | 62 | defaultValue: 14, |
63 | 63 | componentProps: { |
64 | 64 | min: 0, |
65 | + max: 100, | |
65 | 66 | formatter: (e) => { |
66 | 67 | const value = e.replace(/^0/g, ''); |
67 | 68 | if (value) { |
... | ... | @@ -79,6 +80,7 @@ |
79 | 80 | defaultValue: 14, |
80 | 81 | componentProps: { |
81 | 82 | min: 0, |
83 | + max: 100, | |
82 | 84 | formatter: (e) => { |
83 | 85 | const value = e.replace(/^0/g, ''); |
84 | 86 | if (value) { | ... | ... |
... | ... | @@ -56,6 +56,7 @@ |
56 | 56 | defaultValue: 14, |
57 | 57 | componentProps: { |
58 | 58 | min: 0, |
59 | + max: 100, | |
59 | 60 | formatter: (e) => { |
60 | 61 | const value = e.replace(/^0/g, ''); |
61 | 62 | if (value) { |
... | ... | @@ -73,6 +74,7 @@ |
73 | 74 | defaultValue: 14, |
74 | 75 | componentProps: { |
75 | 76 | min: 0, |
77 | + max: 100, | |
76 | 78 | formatter: (e) => { |
77 | 79 | const value = e.replace(/^0/g, ''); |
78 | 80 | if (value) { | ... | ... |
... | ... | @@ -70,6 +70,7 @@ |
70 | 70 | defaultValue: 14, |
71 | 71 | componentProps: { |
72 | 72 | min: 0, |
73 | + max: 100, | |
73 | 74 | formatter: (e) => { |
74 | 75 | const value = e.replace(/^0/g, ''); |
75 | 76 | if (value) { |
... | ... | @@ -87,6 +88,7 @@ |
87 | 88 | defaultValue: 14, |
88 | 89 | componentProps: { |
89 | 90 | min: 0, |
91 | + max: 100, | |
90 | 92 | formatter: (e) => { |
91 | 93 | const value = e.replace(/^0/g, ''); |
92 | 94 | if (value) { | ... | ... |
... | ... | @@ -49,6 +49,7 @@ |
49 | 49 | defaultValue: 14, |
50 | 50 | componentProps: { |
51 | 51 | min: 0, |
52 | + max: 100, | |
52 | 53 | formatter: (e) => { |
53 | 54 | const value = e.replace(/^0/g, ''); |
54 | 55 | if (value) { |
... | ... | @@ -66,6 +67,7 @@ |
66 | 67 | defaultValue: 14, |
67 | 68 | componentProps: { |
68 | 69 | min: 0, |
70 | + max: 100, | |
69 | 71 | formatter: (e) => { |
70 | 72 | const value = e.replace(/^0/g, ''); |
71 | 73 | if (value) { | ... | ... |
... | ... | @@ -60,6 +60,7 @@ |
60 | 60 | defaultValue: 14, |
61 | 61 | componentProps: { |
62 | 62 | min: 0, |
63 | + max: 100, | |
63 | 64 | formatter: (e) => { |
64 | 65 | const value = e.replace(/^0/g, ''); |
65 | 66 | if (value) { |
... | ... | @@ -77,6 +78,7 @@ |
77 | 78 | defaultValue: 14, |
78 | 79 | componentProps: { |
79 | 80 | min: 0, |
81 | + max: 100, | |
80 | 82 | formatter: (e) => { |
81 | 83 | const value = e.replace(/^0/g, ''); |
82 | 84 | if (value) { | ... | ... |
... | ... | @@ -83,6 +83,7 @@ |
83 | 83 | defaultValue: 14, |
84 | 84 | componentProps: { |
85 | 85 | min: 0, |
86 | + max: 100, | |
86 | 87 | formatter: (e) => { |
87 | 88 | const value = e.replace(/^0/g, ''); |
88 | 89 | if (value) { |
... | ... | @@ -100,6 +101,7 @@ |
100 | 101 | defaultValue: 14, |
101 | 102 | componentProps: { |
102 | 103 | min: 0, |
104 | + max: 100, | |
103 | 105 | formatter: (e) => { |
104 | 106 | const value = e.replace(/^0/g, ''); |
105 | 107 | if (value) { | ... | ... |
... | ... | @@ -61,7 +61,7 @@ |
61 | 61 | |
62 | 62 | useDataFetch(props, updateFn); |
63 | 63 | |
64 | - const { getScale } = useComponentScale(props); | |
64 | + const { getScale, getRatio } = useComponentScale(props); | |
65 | 65 | </script> |
66 | 66 | |
67 | 67 | <template> |
... | ... | @@ -77,12 +77,18 @@ |
77 | 77 | :style="{ |
78 | 78 | '--open-color': getDesign.openColor, |
79 | 79 | '--close-color': getDesign.closeColor, |
80 | + width: (getRatio ? getRatio * 70 : 70) + 'px', | |
81 | + height: (getRatio ? getRatio * 70 : 70) + 'px', | |
80 | 82 | }" |
81 | 83 | :class="isOpenClose ? 'switch_open' : 'switch_close'" |
82 | 84 | ></div> |
83 | - <div class="text-gray-500 truncate" :style="{ fontSize: getDesign.fontSize + 'px' }">{{ | |
84 | - getDesign.attribute | |
85 | - }}</div> | |
85 | + <div | |
86 | + class="text-gray-500 truncate" | |
87 | + :style="{ | |
88 | + fontSize: (getRatio ? getRatio * getDesign.fontSize : getDesign.fontSize) + 'px', | |
89 | + }" | |
90 | + >{{ getDesign.attribute }}</div | |
91 | + > | |
86 | 92 | </div> |
87 | 93 | <UpdateTime v-if="getDesign.showTime" :time="time" /> |
88 | 94 | </main> |
... | ... | @@ -91,8 +97,6 @@ |
91 | 97 | .switch_open { |
92 | 98 | background: var(--open-color); |
93 | 99 | box-shadow: var(--open-color) 0 0 10px 3px; |
94 | - width: 60px; | |
95 | - height: 60px; | |
96 | 100 | border-radius: 50%; |
97 | 101 | margin: 10px 0; |
98 | 102 | } |
... | ... | @@ -100,8 +104,6 @@ |
100 | 104 | .switch_close { |
101 | 105 | background-color: var(--close-color); |
102 | 106 | box-shadow: none; |
103 | - width: 42.023px; | |
104 | - height: 42.023px; | |
105 | 107 | border-radius: 50%; |
106 | 108 | margin: 10px 0; |
107 | 109 | } | ... | ... |
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | import { useDataFetch } from '../../../hook/socket/useSocket'; |
9 | 9 | import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; |
10 | 10 | import { useReceiveValue } from '../../../hook/useReceiveValue'; |
11 | + import { useComponentScale } from '../../../hook/useComponentScale'; | |
11 | 12 | |
12 | 13 | const props = defineProps<{ |
13 | 14 | config: ComponentPropsConfigType<typeof option>; |
... | ... | @@ -58,6 +59,8 @@ |
58 | 59 | }; |
59 | 60 | |
60 | 61 | useDataFetch(props, updateFn); |
62 | + | |
63 | + const { getRatio } = useComponentScale(props); | |
61 | 64 | </script> |
62 | 65 | |
63 | 66 | <template> |
... | ... | @@ -67,12 +70,16 @@ |
67 | 70 | <SvgIcon |
68 | 71 | :name="isOpenClose ? getDesign.icon : getDesign.iconClose" |
69 | 72 | prefix="iconfont" |
70 | - :size="60" | |
73 | + :size="getRatio ? getRatio * 70 : 70" | |
71 | 74 | :style="{ color: isOpenClose ? getDesign.iconColor : getDesign.iconColorClose }" |
72 | 75 | /> |
73 | - <div class="text-gray-500 truncate m-2" :style="{ fontSize: getDesign.fontSize + 'px' }">{{ | |
74 | - getDesign.attribute || '' | |
75 | - }}</div> | |
76 | + <div | |
77 | + class="text-gray-500 truncate m-2" | |
78 | + :style="{ | |
79 | + fontSize: (getRatio ? getRatio * getDesign.fontSize : getDesign.fontSize) + 'px', | |
80 | + }" | |
81 | + >{{ getDesign.attribute || '' }}</div | |
82 | + > | |
76 | 83 | </div> |
77 | 84 | <UpdateTime v-show="getDesign.showTime" :time="time" /> |
78 | 85 | </main> | ... | ... |
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | |
45 | 45 | useDataFetch(props, updateFn); |
46 | 46 | |
47 | - const { getScale } = useComponentScale(props); | |
47 | + const { getScale, getRatio } = useComponentScale(props); | |
48 | 48 | </script> |
49 | 49 | |
50 | 50 | <template> |
... | ... | @@ -53,13 +53,18 @@ |
53 | 53 | |
54 | 54 | <h1 |
55 | 55 | class="my-4 font-bold !my-2 truncate" |
56 | - :style="{ color: getDesign.fontColor, fontSize: getDesign.valueSize + 'px' }" | |
56 | + :style="{ | |
57 | + color: getDesign.fontColor, | |
58 | + fontSize: (getRatio ? getRatio * getDesign.valueSize : getDesign.valueSize) + 'px', | |
59 | + }" | |
57 | 60 | > |
58 | 61 | {{ currentValue || 0 }} |
59 | 62 | </h1> |
60 | - <div class="text-gray-500 truncate" :style="{ fontSize: getDesign.fontSize + 'px' }">{{ | |
61 | - getDesign.attribute || '温度' | |
62 | - }}</div> | |
63 | + <div | |
64 | + class="text-gray-500 truncate" | |
65 | + :style="{ fontSize: (getRatio ? getRatio * getDesign.fontSize : getDesign.fontSize) + 'px' }" | |
66 | + >{{ getDesign.attribute || '温度' }}</div | |
67 | + > | |
63 | 68 | <!-- <div v-if="config.option.componentInfo.showDeviceName"> |
64 | 69 | {{ config.option.deviceRename || config.option.deviceName }} |
65 | 70 | </div> --> | ... | ... |
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 | defaultValue: 20, |
27 | 27 | componentProps: { |
28 | 28 | min: 0, |
29 | + max: 100, | |
29 | 30 | formatter: (e) => { |
30 | 31 | const value = e.replace(/^0/g, ''); |
31 | 32 | if (value) { |
... | ... | @@ -43,6 +44,7 @@ |
43 | 44 | defaultValue: 14, |
44 | 45 | componentProps: { |
45 | 46 | min: 0, |
47 | + max: 100, | |
46 | 48 | formatter: (e) => { |
47 | 49 | const value = e.replace(/^0/g, ''); |
48 | 50 | if (value) { | ... | ... |
... | ... | @@ -48,23 +48,29 @@ |
48 | 48 | |
49 | 49 | useDataFetch(props, updateFn); |
50 | 50 | |
51 | - const { getScale } = useComponentScale(props); | |
51 | + const { getScale, getRatio } = useComponentScale(props); | |
52 | 52 | </script> |
53 | 53 | |
54 | 54 | <template> |
55 | 55 | <main class="w-full h-full flex flex-col justify-center items-center"> |
56 | 56 | <DeviceName :config="config" /> |
57 | - | |
58 | 57 | <div class="flex-1 flex justify-center items-center flex-col" :style="getScale"> |
59 | 58 | <h1 |
60 | 59 | class="my-4 font-bold !my-2 truncate" |
61 | - :style="{ color: getDesign.fontColor, fontSize: getDesign.valueSize + 'px' }" | |
60 | + :style="{ | |
61 | + color: getDesign.fontColor, | |
62 | + fontSize: (getRatio ? getRatio * getDesign.valueSize : getDesign.valueSize) + 'px', | |
63 | + }" | |
62 | 64 | > |
63 | 65 | {{ currentValue || 0 }} |
64 | 66 | </h1> |
65 | - <div class="text-gray-500 truncate" :style="{ fontSize: getDesign.fontSize + 'px' }">{{ | |
66 | - getDesign.attribute || '温度' | |
67 | - }}</div> | |
67 | + <div | |
68 | + class="text-gray-500 truncate" | |
69 | + :style="{ | |
70 | + fontSize: (getRatio ? getRatio * getDesign.fontSize : getDesign.fontSize) + 'px', | |
71 | + }" | |
72 | + >{{ getDesign.attribute || '温度' }}</div | |
73 | + > | |
68 | 74 | </div> |
69 | 75 | <UpdateTime :time="time" /> |
70 | 76 | </main> | ... | ... |
... | ... | @@ -31,6 +31,7 @@ |
31 | 31 | defaultValue: 20, |
32 | 32 | componentProps: { |
33 | 33 | min: 0, |
34 | + max: 100, | |
34 | 35 | formatter: (e) => { |
35 | 36 | const value = e.replace(/^0/g, ''); |
36 | 37 | if (value) { |
... | ... | @@ -48,6 +49,7 @@ |
48 | 49 | defaultValue: 14, |
49 | 50 | componentProps: { |
50 | 51 | min: 0, |
52 | + max: 100, | |
51 | 53 | formatter: (e) => { |
52 | 54 | const value = e.replace(/^0/g, ''); |
53 | 55 | if (value) { | ... | ... |
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | |
56 | 56 | useDataFetch(props, updateFn); |
57 | 57 | |
58 | - const { getScale } = useComponentScale(props); | |
58 | + const { getScale, getRatio } = useComponentScale(props); | |
59 | 59 | </script> |
60 | 60 | |
61 | 61 | <template> |
... | ... | @@ -65,19 +65,26 @@ |
65 | 65 | <SvgIcon |
66 | 66 | :name="getDesign.icon!" |
67 | 67 | prefix="iconfont" |
68 | - :size="60" | |
68 | + :size="getRatio ? getRatio * 70 : 70" | |
69 | 69 | :style="{ color: getDesign.iconColor }" |
70 | 70 | /> |
71 | 71 | <h1 |
72 | 72 | class="font-bold m-2 truncate" |
73 | - :style="{ color: getDesign.fontColor, fontSize: getDesign.valueSize + 'px' }" | |
73 | + :style="{ | |
74 | + color: getDesign.fontColor, | |
75 | + fontSize: (getRatio ? getRatio * getDesign.valueSize : getDesign.valueSize) + 'px', | |
76 | + }" | |
74 | 77 | > |
75 | 78 | <span> {{ currentValue || 0 }}</span> |
76 | 79 | <span>{{ getDesign.unit }} </span> |
77 | 80 | </h1> |
78 | - <div class="text-gray-500 truncate" :style="{ fontSize: getDesign.fontSize + 'px' }">{{ | |
79 | - getDesign.attribute || '温度' | |
80 | - }}</div> | |
81 | + <div | |
82 | + class="text-gray-500 truncate" | |
83 | + :style="{ | |
84 | + fontSize: (getRatio ? getRatio * getDesign.fontSize : getDesign.fontSize) + 'px', | |
85 | + }" | |
86 | + >{{ getDesign.attribute || '温度' }}</div | |
87 | + > | |
81 | 88 | </div> |
82 | 89 | <UpdateTime :time="time" /> |
83 | 90 | </main> | ... | ... |
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | defaultValue: 20, |
31 | 31 | componentProps: { |
32 | 32 | min: 0, |
33 | + max: 100, | |
33 | 34 | formatter: (e) => { |
34 | 35 | const value = e.replace(/^0/g, ''); |
35 | 36 | if (value) { |
... | ... | @@ -47,6 +48,7 @@ |
47 | 48 | defaultValue: 14, |
48 | 49 | componentProps: { |
49 | 50 | min: 0, |
51 | + max: 100, | |
50 | 52 | formatter: (e) => { |
51 | 53 | const value = e.replace(/^0/g, ''); |
52 | 54 | if (value) { | ... | ... |
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | |
52 | 52 | useDataFetch(props, updateFn); |
53 | 53 | |
54 | - const { getScale } = useComponentScale(props); | |
54 | + const { getScale, getRatio } = useComponentScale(props); | |
55 | 55 | </script> |
56 | 56 | |
57 | 57 | <template> |
... | ... | @@ -61,19 +61,26 @@ |
61 | 61 | <SvgIcon |
62 | 62 | :name="getDesign.icon!" |
63 | 63 | prefix="iconfont" |
64 | - :size="60" | |
64 | + :size="getRatio ? getRatio * 70 : 70" | |
65 | 65 | :style="{ color: getDesign.iconColor }" |
66 | 66 | /> |
67 | 67 | <h1 |
68 | 68 | class="my-4 font-bold !my-2 truncate" |
69 | - :style="{ color: getDesign.fontColor, fontSize: getDesign.valueSize + 'px' }" | |
69 | + :style="{ | |
70 | + color: getDesign.fontColor, | |
71 | + fontSize: (getRatio ? getRatio * getDesign.valueSize : getDesign.valueSize) + 'px', | |
72 | + }" | |
70 | 73 | > |
71 | 74 | <span>{{ currentValue || 0 }}</span> |
72 | 75 | <span>{{ getDesign.unit }}</span> |
73 | 76 | </h1> |
74 | - <div class="text-gray-500 truncate" :style="{ fontSize: getDesign.fontSize + 'px' }">{{ | |
75 | - getDesign.attribute || '温度' | |
76 | - }}</div> | |
77 | + <div | |
78 | + class="text-gray-500 truncate" | |
79 | + :style="{ | |
80 | + fontSize: (getRatio ? getRatio * getDesign.fontSize : getDesign.fontSize) + 'px', | |
81 | + }" | |
82 | + >{{ getDesign.attribute || '温度' }}</div | |
83 | + > | |
77 | 84 | </div> |
78 | 85 | </main> |
79 | 86 | </template> | ... | ... |
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | defaultValue: 20, |
33 | 33 | componentProps: { |
34 | 34 | min: 0, |
35 | + max: 100, | |
35 | 36 | formatter: (e) => { |
36 | 37 | const value = e.replace(/^0/g, ''); |
37 | 38 | if (value) { |
... | ... | @@ -49,6 +50,7 @@ |
49 | 50 | defaultValue: 14, |
50 | 51 | componentProps: { |
51 | 52 | min: 0, |
53 | + max: 100, | |
52 | 54 | formatter: (e) => { |
53 | 55 | const value = e.replace(/^0/g, ''); |
54 | 56 | if (value) { | ... | ... |
... | ... | @@ -149,7 +149,7 @@ |
149 | 149 | </script> |
150 | 150 | |
151 | 151 | <template> |
152 | - <section class="p-5 flex flex-col w-full"> | |
152 | + <section class="p-2.5 flex flex-col w-full"> | |
153 | 153 | <main class="flex w-full h-full h-7"> |
154 | 154 | <Tooltip :title="sourceInfo.name"> |
155 | 155 | <div class="flex-1 w-full h-full flex text-lg justify-center font-semibold truncate"> | ... | ... |