Showing
5 changed files
with
11 additions
and
38 deletions
@@ -10,7 +10,8 @@ | @@ -10,7 +10,8 @@ | ||
10 | 10 | ||
11 | const alert = { | 11 | const alert = { |
12 | [PackagesCategoryEnum.MAP]: [ | 12 | [PackagesCategoryEnum.MAP]: [ |
13 | - '地图组件,需绑定两个数据源,且数据源为同一设备。第一数据源为经度,第二数据源为纬度,否则地图组件不能正常显示。', | 13 | + '1、绑定一种数据源,选择属性为结构体时,可以自行选择结构体里的值作为经纬度', |
14 | + '2、绑定两个数据源,且数据源为同一设备。第一数据源为经度,第二数据源为纬度,否则地图组件不能正常显示。', | ||
14 | ], | 15 | ], |
15 | }; | 16 | }; |
16 | 17 |
@@ -34,14 +34,6 @@ | @@ -34,14 +34,6 @@ | ||
34 | const { unit, fontColor, showDeviceName } = item.componentInfo || {}; | 34 | const { unit, fontColor, showDeviceName } = item.componentInfo || {}; |
35 | const { deviceName, deviceRename, attribute, attributeRename, deviceId, attributeName } = | 35 | const { deviceName, deviceRename, attribute, attributeRename, deviceId, attributeName } = |
36 | item; | 36 | item; |
37 | - // return { | ||
38 | - // unit: unit ?? persetUnit, | ||
39 | - // fontColor: fontColor ?? persetFontColor, | ||
40 | - // showDeviceName: showDeviceName ?? persetShowDeviceName, | ||
41 | - // attribute, | ||
42 | - // deviceName, | ||
43 | - // deviceRename, | ||
44 | - // }; | ||
45 | return { | 37 | return { |
46 | unit: unit ?? presetUnit, | 38 | unit: unit ?? presetUnit, |
47 | fontColor: fontColor ?? presetFontColor, | 39 | fontColor: fontColor ?? presetFontColor, |
@@ -58,7 +50,6 @@ | @@ -58,7 +50,6 @@ | ||
58 | }); | 50 | }); |
59 | 51 | ||
60 | const getOffset = (length: number, index: number) => { | 52 | const getOffset = (length: number, index: number) => { |
61 | - // try { | ||
62 | const offsetList = ref<any>([]); | 53 | const offsetList = ref<any>([]); |
63 | switch (length) { | 54 | switch (length) { |
64 | case 1: | 55 | case 1: |
@@ -147,7 +138,6 @@ | @@ -147,7 +138,6 @@ | ||
147 | break; | 138 | break; |
148 | } | 139 | } |
149 | return unref(offsetList); | 140 | return unref(offsetList); |
150 | - // } catch {} | ||
151 | }; | 141 | }; |
152 | 142 | ||
153 | const series = ref( | 143 | const series = ref( |
@@ -263,7 +253,6 @@ | @@ -263,7 +253,6 @@ | ||
263 | series.value.forEach((item) => { | 253 | series.value.forEach((item) => { |
264 | if (item.id === deviceId && item.attribute === attribute && value) { | 254 | if (item.id === deviceId && item.attribute === attribute && value) { |
265 | item.value = getNumberValue(value); | 255 | item.value = getNumberValue(value); |
266 | - // time.value = timespan; | ||
267 | } | 256 | } |
268 | }); | 257 | }); |
269 | }); | 258 | }); |
@@ -62,7 +62,6 @@ | @@ -62,7 +62,6 @@ | ||
62 | const options = (): EChartsOption => { | 62 | const options = (): EChartsOption => { |
63 | const { unit, fontColor, pointerColor, maxNumber, valueSize } = unref(getDesign); | 63 | const { unit, fontColor, pointerColor, maxNumber, valueSize } = unref(getDesign); |
64 | 64 | ||
65 | - // getStageColor(gradientInfo); | ||
66 | return { | 65 | return { |
67 | series: [ | 66 | series: [ |
68 | { | 67 | { |
@@ -103,14 +102,6 @@ | @@ -103,14 +102,6 @@ | ||
103 | color: pointerColor, | 102 | color: pointerColor, |
104 | }, | 103 | }, |
105 | }, | 104 | }, |
106 | - // anchor: { | ||
107 | - // show: true, | ||
108 | - // showAbove: true, | ||
109 | - // size: 10, | ||
110 | - // itemStyle: { | ||
111 | - // borderWidth: 4, | ||
112 | - // }, | ||
113 | - // }, | ||
114 | title: { | 105 | title: { |
115 | show: false, | 106 | show: false, |
116 | }, | 107 | }, |
@@ -19,6 +19,9 @@ | @@ -19,6 +19,9 @@ | ||
19 | ], | 19 | ], |
20 | }); | 20 | }); |
21 | 21 | ||
22 | + const loading = ref(false); | ||
23 | + const getDesign = ref(); | ||
24 | + | ||
22 | const getTwoMap = async (dataSource) => { | 25 | const getTwoMap = async (dataSource) => { |
23 | if (dataSource.length < 2) return; | 26 | if (dataSource.length < 2) return; |
24 | dataSource = dataSource.splice(0, 2); | 27 | dataSource = dataSource.splice(0, 2); |
@@ -87,8 +90,6 @@ | @@ -87,8 +90,6 @@ | ||
87 | }); | 90 | }); |
88 | }; | 91 | }; |
89 | 92 | ||
90 | - const getDesign = ref(); | ||
91 | - | ||
92 | const [registerModal, { closeModal }] = useModalInner(async (dataSource: DataSource[]) => { | 93 | const [registerModal, { closeModal }] = useModalInner(async (dataSource: DataSource[]) => { |
93 | try { | 94 | try { |
94 | getDesign.value = dataSource; | 95 | getDesign.value = dataSource; |
@@ -133,6 +134,7 @@ | @@ -133,6 +134,7 @@ | ||
133 | return track; | 134 | return track; |
134 | }; | 135 | }; |
135 | 136 | ||
137 | + // 单数据源选择结构体 | ||
136 | const getSingleDataSource = async (res) => { | 138 | const getSingleDataSource = async (res) => { |
137 | const [keys] = Object.keys(res); | 139 | const [keys] = Object.keys(res); |
138 | const track: Record<'lng' | 'lat', number>[] = []; | 140 | const track: Record<'lng' | 'lat', number>[] = []; |
@@ -152,7 +154,7 @@ | @@ -152,7 +154,7 @@ | ||
152 | list.push(item.value); | 154 | list.push(item.value); |
153 | } | 155 | } |
154 | }); | 156 | }); |
155 | - const { latitude, longitude } = unref(getDesign)?.[0]; //获取选择得经纬度选项 | 157 | + const { latitude, longitude } = unref(getDesign)?.[0]; //获取选择的经纬度选项 |
156 | 158 | ||
157 | list.forEach((item) => { | 159 | list.forEach((item) => { |
158 | const lng = item[longitude]; | 160 | const lng = item[longitude]; |
@@ -165,7 +167,6 @@ | @@ -165,7 +167,6 @@ | ||
165 | const validEffective = (value = '') => { | 167 | const validEffective = (value = '') => { |
166 | return !!(value && !isNaN(value as unknown as number)); | 168 | return !!(value && !isNaN(value as unknown as number)); |
167 | }; | 169 | }; |
168 | - const loading = ref(false); | ||
169 | const handleOk = async () => { | 170 | const handleOk = async () => { |
170 | try { | 171 | try { |
171 | await validate(); | 172 | await validate(); |
@@ -179,7 +180,7 @@ | @@ -179,7 +180,7 @@ | ||
179 | ...value, | 180 | ...value, |
180 | [SchemaFiled.KEYS]: value[SchemaFiled.KEYS].join(','), | 181 | [SchemaFiled.KEYS]: value[SchemaFiled.KEYS].join(','), |
181 | }); | 182 | }); |
182 | - const ifSingle = unref(getDesign).length === 1 && unref(getDesign)?.[0]?.lal; | 183 | + const ifSingle = unref(getDesign)?.length === 1 && unref(getDesign)?.[0]?.lal; |
183 | 184 | ||
184 | const track = ifSingle ? await getSingleDataSource(res) : await getMultipleDataSource(res); | 185 | const track = ifSingle ? await getSingleDataSource(res) : await getMultipleDataSource(res); |
185 | emit('ok', { track, value } as HistoryModalOkEmitParams); | 186 | emit('ok', { track, value } as HistoryModalOkEmitParams); |
@@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
78 | const bindMessage = data[deviceId]; | 78 | const bindMessage = data[deviceId]; |
79 | const [, values] = attribute && bindMessage?.[attribute][0]; | 79 | const [, values] = attribute && bindMessage?.[attribute][0]; |
80 | 80 | ||
81 | - const mapValues = values ? JSON.parse(values) : []; | 81 | + const mapValues = values ? JSON.parse(values) : {}; |
82 | const lng = longitude && mapValues[longitude]; | 82 | const lng = longitude && mapValues[longitude]; |
83 | const lat = latitude && mapValues[latitude]; | 83 | const lat = latitude && mapValues[latitude]; |
84 | 84 | ||
@@ -89,9 +89,8 @@ | @@ -89,9 +89,8 @@ | ||
89 | 89 | ||
90 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId) => { | 90 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId) => { |
91 | const { lal } = unref(getDesign)?.dataSource?.[0] || {}; | 91 | const { lal } = unref(getDesign)?.dataSource?.[0] || {}; |
92 | - | ||
93 | - // 属性选择结构体时 | ||
94 | - if (lal) { | 92 | + // 属性选择结构体类型时 |
93 | + if (lal && unref(getDesign)?.dataSource?.length == 1) { | ||
95 | getOneMap(message, deviceId); | 94 | getOneMap(message, deviceId); |
96 | return; | 95 | return; |
97 | } | 96 | } |
@@ -137,11 +136,3 @@ | @@ -137,11 +136,3 @@ | ||
137 | <div v-show="!loading" ref="wrapRef" :id="wrapId" class="w-full h-full no-drag"> </div> | 136 | <div v-show="!loading" ref="wrapRef" :id="wrapId" class="w-full h-full no-drag"> </div> |
138 | </main> | 137 | </main> |
139 | </template> | 138 | </template> |
140 | - | ||
141 | -<style lang="less" scoped> | ||
142 | - // .map-spin-wrapper { | ||
143 | - // :deep(.ant-spin-container) { | ||
144 | - // @apply justify-center items-center p-2 w-full h-full; | ||
145 | - // } | ||
146 | - // } | ||
147 | -</style> |