Commit c5f9c1e9fb2ad12c2d65f7c6342d1d97e423356e
Merge branch 'ww' into 'main'
fix: system dict control add permission See merge request huang/yun-teng-iot-front!344
Showing
2 changed files
with
21 additions
and
4 deletions
@@ -96,7 +96,7 @@ | @@ -96,7 +96,7 @@ | ||
96 | deviceProfile: { default: boolean; enabled: boolean; name: string; transportType: string }; | 96 | deviceProfile: { default: boolean; enabled: boolean; name: string; transportType: string }; |
97 | deviceInfo: { longitude: string; latitude: string; address: string }; | 97 | deviceInfo: { longitude: string; latitude: string; address: string }; |
98 | } | 98 | } |
99 | - type MarkerList = DeviceInfo & { marker: any }; | 99 | + type MarkerList = DeviceInfo & { marker: any; label: any }; |
100 | 100 | ||
101 | export default defineComponent({ | 101 | export default defineComponent({ |
102 | name: 'BaiduMap', | 102 | name: 'BaiduMap', |
@@ -154,6 +154,7 @@ | @@ -154,6 +154,7 @@ | ||
154 | const markerList: MarkerList[] = []; | 154 | const markerList: MarkerList[] = []; |
155 | data.forEach((item) => { | 155 | data.forEach((item) => { |
156 | const { | 156 | const { |
157 | + name, | ||
157 | deviceState, | 158 | deviceState, |
158 | deviceInfo: { longitude, latitude }, | 159 | deviceInfo: { longitude, latitude }, |
159 | } = item; | 160 | } = item; |
@@ -161,11 +162,22 @@ | @@ -161,11 +162,22 @@ | ||
161 | const rivet = deviceState === 'INACTIVE' ? djx : deviceState === 'ONLINE' ? zx : lx; | 162 | const rivet = deviceState === 'INACTIVE' ? djx : deviceState === 'ONLINE' ? zx : lx; |
162 | const myIcon = new BMap.Icon(rivet, new BMap.Size(20, 30)); | 163 | const myIcon = new BMap.Icon(rivet, new BMap.Size(20, 30)); |
163 | const marker = new BMap.Marker(point, { icon: myIcon }); | 164 | const marker = new BMap.Marker(point, { icon: myIcon }); |
164 | - markerList.push({ ...item, marker }); | 165 | + const label = new BMap.Label(name, { |
166 | + position: point, | ||
167 | + offset: new BMap.Size(-15, -45), | ||
168 | + }); | ||
169 | + label.setStyle({ | ||
170 | + color: '#000', | ||
171 | + borderRadius: '5px', | ||
172 | + borderColor: '#ccc', | ||
173 | + padding: '5px', | ||
174 | + }); | ||
175 | + markerList.push({ ...item, marker, label }); | ||
165 | }); | 176 | }); |
166 | 177 | ||
167 | markerList.forEach((record) => { | 178 | markerList.forEach((record) => { |
168 | unref(BMapInstance).addOverlay(record.marker); | 179 | unref(BMapInstance).addOverlay(record.marker); |
180 | + unref(BMapInstance).addOverlay(record.label); | ||
169 | const isAlarmStatus = !!record.alarmStatus; | 181 | const isAlarmStatus = !!record.alarmStatus; |
170 | if (isAlarmStatus) { | 182 | if (isAlarmStatus) { |
171 | const alarmStatusClassName = 'device-status__alarm'; | 183 | const alarmStatusClassName = 'device-status__alarm'; |
@@ -4,7 +4,9 @@ | @@ -4,7 +4,9 @@ | ||
4 | <div style="background-color: #f0f2f5"> | 4 | <div style="background-color: #f0f2f5"> |
5 | <BasicTable @register="registerTable"> | 5 | <BasicTable @register="registerTable"> |
6 | <template #toolbar> | 6 | <template #toolbar> |
7 | - <a-button type="primary" @click="handleCreate"> 新增字典值 </a-button> | 7 | + <Authority value="api:yt:dictItem:post"> |
8 | + <a-button type="primary" @click="handleCreate"> 新增字典值 </a-button> | ||
9 | + </Authority> | ||
8 | </template> | 10 | </template> |
9 | <template #action="{ record }"> | 11 | <template #action="{ record }"> |
10 | <TableAction | 12 | <TableAction |
@@ -12,12 +14,14 @@ | @@ -12,12 +14,14 @@ | ||
12 | { | 14 | { |
13 | label: '编辑', | 15 | label: '编辑', |
14 | icon: 'clarity:note-edit-line', | 16 | icon: 'clarity:note-edit-line', |
17 | + auth: 'api:yt:dictItem:update', | ||
15 | onClick: handleEdit.bind(null, record), | 18 | onClick: handleEdit.bind(null, record), |
16 | }, | 19 | }, |
17 | { | 20 | { |
18 | label: '删除', | 21 | label: '删除', |
19 | icon: 'ant-design:delete-outlined', | 22 | icon: 'ant-design:delete-outlined', |
20 | color: 'error', | 23 | color: 'error', |
24 | + auth: 'api:yt:dictItem:delete', | ||
21 | popConfirm: { | 25 | popConfirm: { |
22 | title: '是否确认删除', | 26 | title: '是否确认删除', |
23 | confirm: handleDelete.bind(null, record), | 27 | confirm: handleDelete.bind(null, record), |
@@ -44,10 +48,11 @@ | @@ -44,10 +48,11 @@ | ||
44 | 48 | ||
45 | import { columns, searchFormSchema } from './dict.item.data'; | 49 | import { columns, searchFormSchema } from './dict.item.data'; |
46 | import { useMessage } from '/@/hooks/web/useMessage'; | 50 | import { useMessage } from '/@/hooks/web/useMessage'; |
51 | + import Authority from '/@/components/Authority/src/Authority.vue'; | ||
47 | 52 | ||
48 | export default defineComponent({ | 53 | export default defineComponent({ |
49 | name: 'ItemIndex', | 54 | name: 'ItemIndex', |
50 | - components: { BasicDrawer, BasicTable, ItemDrawer, TableAction }, | 55 | + components: { BasicDrawer, BasicTable, ItemDrawer, TableAction, Authority }, |
51 | setup() { | 56 | setup() { |
52 | let dictId; | 57 | let dictId; |
53 | const { createMessage } = useMessage(); | 58 | const { createMessage } = useMessage(); |