diff --git a/package.json b/package.json index bc65987..92a666e 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,15 @@ "@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-types": "^0.0.15", "@arco-design/web-vue": "^2.44.7", + "@commitlint/load": "^19.8.0", "@vueuse/core": "^9.3.0", "@wangeditor/editor-for-vue": "^5.1.12", "arco-design-pro-vue": "^2.7.2", "axios": "^0.24.0", + "cosmiconfig": "^9.0.0", "dayjs": "^1.11.5", "echarts": "^5.4.0", + "event-source-polyfill": "^1.0.31", "exceljs": "^4.4.0", "file-saver": "^2.0.5", "lodash": "^4.17.21", diff --git a/src/api/dashboard.ts b/src/api/dashboard.ts index c26bbf5..523598c 100644 --- a/src/api/dashboard.ts +++ b/src/api/dashboard.ts @@ -3,20 +3,20 @@ import axios from 'axios'; // 获取设备信息 export function getDeviceInfo() { - return axios.get('/api/rest/device/status'); + return axios.get('/api/rest/device/sse/status'); } // 获取消息信息 export function getMessageInfo() { - return axios.get('/api/rest/device/record/status'); + return axios.get('/api/rest/device/sse/record/status'); } // 获取告警信息 export function getAlarmInfo() { - return axios.get('/api/rest/device/data/status'); + return axios.get('/api/rest/device/sse/data/status'); } // 获取产品信息 export function getProductInfo() { - return axios.get('/api/rest/product/status'); + return axios.get('/api/rest/product/sse/status'); } \ No newline at end of file diff --git a/src/api/product.ts b/src/api/product.ts index f527438..ad14eff 100644 --- a/src/api/product.ts +++ b/src/api/product.ts @@ -66,3 +66,13 @@ export function updateProduct(data: ProductUpdateRecord) { export function deleteProduct(id: number) { return axios.delete(`/api/rest/product/${id}`); } + +// 文件上传 +export function addAttachments(data: any) { + return axios.post(`/api/rest/product/upload`, data); +} + +// 文件删除 +export function deleteAttachment(id: number) { + return axios.delete(`/api/rest/product/attachments/${id}`); +} diff --git a/src/assets/images/device.png b/src/assets/images/device.png new file mode 100644 index 0000000..fa44fd6 Binary files /dev/null and b/src/assets/images/device.png differ diff --git a/src/views/dashboard/workplace/index.vue b/src/views/dashboard/workplace/index.vue index 4e45018..b5e1989 100644 --- a/src/views/dashboard/workplace/index.vue +++ b/src/views/dashboard/workplace/index.vue @@ -3,7 +3,7 @@
- +
@@ -21,8 +21,11 @@ diff --git a/src/views/iot/device/components/device-detail.vue b/src/views/iot/device/components/device-detail.vue index 2d99c4b..90309fb 100644 --- a/src/views/iot/device/components/device-detail.vue +++ b/src/views/iot/device/components/device-detail.vue @@ -84,7 +84,22 @@ - + + + + + + + + + + @@ -116,7 +131,8 @@ import { queryDeviceDetail, queryDeviceRecord, sendCommand } from '@/api/device'; import { queryServeDetail, queryServeList } from '@/api/tsl'; import useVisible from '@/hooks/visible'; - import dynamicForm from './dynamic-form.vue' + import dynamicForm from './dynamic-form.vue'; + import DeviceMap from './device-map.vue'; const route = useRoute(); const { visible, setVisible } = useVisible(); diff --git a/src/views/iot/device/components/device-map.vue b/src/views/iot/device/components/device-map.vue new file mode 100644 index 0000000..bfffda8 --- /dev/null +++ b/src/views/iot/device/components/device-map.vue @@ -0,0 +1,117 @@ + + + + + \ No newline at end of file diff --git a/src/views/iot/deviceMap/index.vue b/src/views/iot/deviceMap/index.vue index bbc5fbb..7c0bcd6 100644 --- a/src/views/iot/deviceMap/index.vue +++ b/src/views/iot/deviceMap/index.vue @@ -55,7 +55,7 @@ // 将标记点添加到地图上 map.setCenter(lngLat); - map.setZoom(16); + map.setZoom(20); map.add(marker); // const infoContent = ` diff --git a/src/views/iot/product/components/product-edit.vue b/src/views/iot/product/components/product-edit.vue index c722820..13be49c 100644 --- a/src/views/iot/product/components/product-edit.vue +++ b/src/views/iot/product/components/product-edit.vue @@ -30,7 +30,7 @@ + + + + + + + +
@@ -209,6 +237,7 @@ ProductCreateRecord, queryProductDetail, updateProduct, + addAttachments, deleteAttachment } from '@/api/product'; const props = defineProps({ @@ -298,6 +327,42 @@ formData.value = res.data; paramsData.value = res.data.params; }; + + // 预览图列表 + const fileList = computed(() => { + return formData.value.attachments?.map((item: any) => { + return { + name: item.fileName, + url: item.url, + uid: item.id, + }; + }); + }); + // 自定义预览图上传 + const customRequest = async (option: any) => { + const { fileItem, onSuccess, onError } = option; + const formDataFile = new FormData(); + formDataFile.append('file', fileItem.file); + formDataFile.append('type', '其他'); + const res = await addAttachments(formDataFile); + if (res.status === 200) { + onSuccess(res.data); + formData.value.attachmentIds?.push(res.data.id); + console.log(formData.value); + } else { + onError(res.data); + } + }; + // 删除图片 + const beforeRemove = async (file: any) => { + if (!file.uid) { + const res = await deleteAttachment(file.response.id); + return res.status === 200; + } + const res = await deleteAttachment(file.uid); + return res.status === 200; + }; + // 组件被点击 const handleClick = () => { setVisible(true); diff --git a/src/views/iot/product/components/product-tsl.vue b/src/views/iot/product/components/product-tsl.vue index 7ad602b..a181388 100644 --- a/src/views/iot/product/components/product-tsl.vue +++ b/src/views/iot/product/components/product-tsl.vue @@ -310,7 +310,7 @@ - + + + (() => [ + { + label: '大于', + value: 'GREATER', + }, + { + label: '小于', + value: 'LESS', + }, + { + label: '等于', + value: 'EQUAL', + }, + ]); const eventTypeOptions = computed(() => [ { label: '主动',