diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/utils/validate.ts b/src/utils/validate.ts index c59fdc6..8965a33 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -38,7 +38,24 @@ } return true } - +/** + * 判断IP和端口 + * @param ipPort 待判断 + * @returns 是否合法 + */ +export function validateIPPort(ipPort: string) { + const ipRegex = /^(?(\d{1,3}\.){3}\d{1,3})(?:\d{1,5})?$/ + const match = ipRegex.exec(ipPort) + if (!match) { + return false + } + const { port } = match.groups + if (port && port.length > 0) { + const portNumber = parseInt(port.slice(1), 10) + return portNumber >= 1 && portNumber <= 65535 + } + return true +} // /** * 判断整数范围 diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/utils/validate.ts b/src/utils/validate.ts index c59fdc6..8965a33 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -38,7 +38,24 @@ } return true } - +/** + * 判断IP和端口 + * @param ipPort 待判断 + * @returns 是否合法 + */ +export function validateIPPort(ipPort: string) { + const ipRegex = /^(?(\d{1,3}\.){3}\d{1,3})(?:\d{1,5})?$/ + const match = ipRegex.exec(ipPort) + if (!match) { + return false + } + const { port } = match.groups + if (port && port.length > 0) { + const portNumber = parseInt(port.slice(1), 10) + return portNumber >= 1 && portNumber <= 65535 + } + return true +} // /** * 判断整数范围 diff --git a/src/views/home/dashboard/components/detailInfoDialog.vue b/src/views/home/dashboard/components/detailInfoDialog.vue new file mode 100644 index 0000000..cfcf4f6 --- /dev/null +++ b/src/views/home/dashboard/components/detailInfoDialog.vue @@ -0,0 +1,63 @@ + + + + + + diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/utils/validate.ts b/src/utils/validate.ts index c59fdc6..8965a33 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -38,7 +38,24 @@ } return true } - +/** + * 判断IP和端口 + * @param ipPort 待判断 + * @returns 是否合法 + */ +export function validateIPPort(ipPort: string) { + const ipRegex = /^(?(\d{1,3}\.){3}\d{1,3})(?:\d{1,5})?$/ + const match = ipRegex.exec(ipPort) + if (!match) { + return false + } + const { port } = match.groups + if (port && port.length > 0) { + const portNumber = parseInt(port.slice(1), 10) + return portNumber >= 1 && portNumber <= 65535 + } + return true +} // /** * 判断整数范围 diff --git a/src/views/home/dashboard/components/detailInfoDialog.vue b/src/views/home/dashboard/components/detailInfoDialog.vue new file mode 100644 index 0000000..cfcf4f6 --- /dev/null +++ b/src/views/home/dashboard/components/detailInfoDialog.vue @@ -0,0 +1,63 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen-bak.vue b/src/views/home/dashboard/fullScreen-bak.vue new file mode 100644 index 0000000..a706cc8 --- /dev/null +++ b/src/views/home/dashboard/fullScreen-bak.vue @@ -0,0 +1,61 @@ + + + + + + diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/utils/validate.ts b/src/utils/validate.ts index c59fdc6..8965a33 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -38,7 +38,24 @@ } return true } - +/** + * 判断IP和端口 + * @param ipPort 待判断 + * @returns 是否合法 + */ +export function validateIPPort(ipPort: string) { + const ipRegex = /^(?(\d{1,3}\.){3}\d{1,3})(?:\d{1,5})?$/ + const match = ipRegex.exec(ipPort) + if (!match) { + return false + } + const { port } = match.groups + if (port && port.length > 0) { + const portNumber = parseInt(port.slice(1), 10) + return portNumber >= 1 && portNumber <= 65535 + } + return true +} // /** * 判断整数范围 diff --git a/src/views/home/dashboard/components/detailInfoDialog.vue b/src/views/home/dashboard/components/detailInfoDialog.vue new file mode 100644 index 0000000..cfcf4f6 --- /dev/null +++ b/src/views/home/dashboard/components/detailInfoDialog.vue @@ -0,0 +1,63 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen-bak.vue b/src/views/home/dashboard/fullScreen-bak.vue new file mode 100644 index 0000000..a706cc8 --- /dev/null +++ b/src/views/home/dashboard/fullScreen-bak.vue @@ -0,0 +1,61 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen.vue b/src/views/home/dashboard/fullScreen.vue index 4abc479..bba597c 100644 --- a/src/views/home/dashboard/fullScreen.vue +++ b/src/views/home/dashboard/fullScreen.vue @@ -1,26 +1,29 @@ @@ -58,4 +310,60 @@ width: 100%; height: 100vh; } + +.none { + opacity: 0; +} + +.amap-legend { + position: fixed; + bottom: 10px; + left: 10px; + background: rgb(68 66 66 / 60%); + color: #fff; + padding: 10px; + + .legend-item { + display: flex; + + .value { + &:hover { + cursor: pointer; + } + } + } +} + +.close { + width: 150px; + height: 70px; + position: fixed; + top: 0; + right: 0; + + /* background-color: antiquewhite; */ + &:hover { + .icon { + display: block; + } + } + + .icon { + display: none; + width: 50px; + height: 50px; + background: rgb(145 144 144 / 60%); + border-radius: 50%; + line-height: 50px; + text-align: center; + font-size: 18px; + font-weight: 700; + color: #ccc; + margin: 10px auto; + + &:hover { + cursor: pointer; + } + } +} diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/utils/validate.ts b/src/utils/validate.ts index c59fdc6..8965a33 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -38,7 +38,24 @@ } return true } - +/** + * 判断IP和端口 + * @param ipPort 待判断 + * @returns 是否合法 + */ +export function validateIPPort(ipPort: string) { + const ipRegex = /^(?(\d{1,3}\.){3}\d{1,3})(?:\d{1,5})?$/ + const match = ipRegex.exec(ipPort) + if (!match) { + return false + } + const { port } = match.groups + if (port && port.length > 0) { + const portNumber = parseInt(port.slice(1), 10) + return portNumber >= 1 && portNumber <= 65535 + } + return true +} // /** * 判断整数范围 diff --git a/src/views/home/dashboard/components/detailInfoDialog.vue b/src/views/home/dashboard/components/detailInfoDialog.vue new file mode 100644 index 0000000..cfcf4f6 --- /dev/null +++ b/src/views/home/dashboard/components/detailInfoDialog.vue @@ -0,0 +1,63 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen-bak.vue b/src/views/home/dashboard/fullScreen-bak.vue new file mode 100644 index 0000000..a706cc8 --- /dev/null +++ b/src/views/home/dashboard/fullScreen-bak.vue @@ -0,0 +1,61 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen.vue b/src/views/home/dashboard/fullScreen.vue index 4abc479..bba597c 100644 --- a/src/views/home/dashboard/fullScreen.vue +++ b/src/views/home/dashboard/fullScreen.vue @@ -1,26 +1,29 @@ @@ -58,4 +310,60 @@ width: 100%; height: 100vh; } + +.none { + opacity: 0; +} + +.amap-legend { + position: fixed; + bottom: 10px; + left: 10px; + background: rgb(68 66 66 / 60%); + color: #fff; + padding: 10px; + + .legend-item { + display: flex; + + .value { + &:hover { + cursor: pointer; + } + } + } +} + +.close { + width: 150px; + height: 70px; + position: fixed; + top: 0; + right: 0; + + /* background-color: antiquewhite; */ + &:hover { + .icon { + display: block; + } + } + + .icon { + display: none; + width: 50px; + height: 50px; + background: rgb(145 144 144 / 60%); + border-radius: 50%; + line-height: 50px; + text-align: center; + font-size: 18px; + font-weight: 700; + color: #ccc; + margin: 10px auto; + + &:hover { + cursor: pointer; + } + } +} diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index ca77803..485b182 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -1,3 +1,182 @@ + + + diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts new file mode 100644 index 0000000..c51fe9e --- /dev/null +++ b/src/api/home/device/device.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备管理接口 + */ +import request from '@/api/index' + +// 设备管理基础列表 +export function getDeviceListPage(data: any) { + return request({ + url: `/system/busDevice/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备 +export function removeDevice(data: any) { + return request({ + url: '/system/busDevice/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备 +export function addDevice(data: any) { + return request({ + url: '/system/busDevice/add', + method: 'post', + data, + }) +} +// 编辑设备 +export function editDevice(data: any) { + return request({ + url: '/system/busDevice/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/device/product.ts b/src/api/home/device/product.ts new file mode 100644 index 0000000..80292cb --- /dev/null +++ b/src/api/home/device/product.ts @@ -0,0 +1,48 @@ +/** + * 设备管理--产品管理接口 + */ +import request from '@/api/index' + +// 产品管理基础列表 +export function getProductListPage(data: any) { + return request({ + url: `/system/baseProduct/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除产品 +export function removeProduct(data: any) { + return request({ + url: '/system/baseProduct/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建产品 +export function addProduct(data: any) { + return request({ + url: '/system/baseProduct/add', + method: 'post', + data, + }) +} +// 编辑产品 +export function editProduct(data: any) { + return request({ + url: '/system/baseProduct/edit', + method: 'post', + data, + }) +} + +// 厂商列表 +export function getManufacturerListPage() { + return request({ + url: `/system/busManufacturer/listPage?limit=${1}&offset=${99999}`, + method: 'post', + }) +} + diff --git a/src/api/home/device/type.ts b/src/api/home/device/type.ts new file mode 100644 index 0000000..46b1988 --- /dev/null +++ b/src/api/home/device/type.ts @@ -0,0 +1,39 @@ +/** + * 设备管理--设备类型管理接口 + */ +import request from '@/api/index' + +// 设备类型管理基础列表 +export function getDeviceTypeListPage(data: any) { + return request({ + url: `/system/baseDeviceType/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 删除设备类型 +export function removeDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建设备类型 +export function addDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/add', + method: 'post', + data, + }) +} +// 编辑设备类型 +export function editDeviceType(data: any) { + return request({ + url: '/system/baseDeviceType/edit', + method: 'post', + data, + }) +} diff --git a/src/api/home/rule/agreement.ts b/src/api/home/rule/agreement.ts new file mode 100644 index 0000000..88f28c9 --- /dev/null +++ b/src/api/home/rule/agreement.ts @@ -0,0 +1,40 @@ +/** + * 规则引擎--协议管理接口 + */ +import request from '@/api/index' + +// 协议管理基础列表 +export function getAgreementListPage(data: any) { + return request({ + url: `/system/busProtocol/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} + +// 删除协议 +export function removeAgreement(data: any) { + return request({ + url: '/system/busProtocol/batchDelete', + method: 'post', + data: { + ids: data, + }, + }) +} +// 新建协议 +export function addAgreement(data: any) { + return request({ + url: '/system/busProtocol/add', + method: 'post', + data, + }) +} +// 编辑协议 +export function editAgreement(data: any) { + return request({ + url: '/system/busProtocol/edit', + method: 'post', + data, + }) +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index de24f71..5c2472d 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -246,6 +246,7 @@ } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { + if (!props.needContextmenu) { return } document.getElementById('custom-menu').style.display = 'none' }) // 添加行 diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 620c813..0b3c3d0 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -22,7 +22,7 @@ default: 9, }, }) -const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick']) +const $emits = defineEmits(['complete', 'marke', 'markerClick', 'lineClick', 'polygonClick', 'massMarksClick']) const loading = ref(true) // 设置安全密钥 window._AMapSecurityConfig = { @@ -31,6 +31,8 @@ // 地图实例 const map = shallowRef() const AMap = ref() +// 地图缩放等级 +const zoom = ref(0) // 图层 const layer = ref() // 图层标识 @@ -74,6 +76,11 @@ }) // 地图绑定右击事件 map.value.on('mousedown', clickHandler) + // 地图zoom + map.value.on('zoomend', () => { + zoom.value = map.value.getZoom() // 获取当前缩放级别 + console.log('当前缩放级别:', zoom.value) + }) }) .catch((e) => { console.log(e, '地图加载失败') @@ -127,7 +134,7 @@ strokeStyle: style.strokeStyle, strokeDasharray: style.strokeDasharray, }) - polygonAllList.value.push(polygon) + polygon.on('mouseover', () => { polygon.setOptions({ fillOpacity: style.fillOpacity + 0.2, @@ -141,13 +148,13 @@ }) }) polygon.on('mousedown', clickHandler) - if (style.dbclickSetCenter) { - polygon.on('dblclick', () => { - console.log(`当前点击的是${style.name}`) - map.value.setCenter(style.dbclickCenter) - map.value.setZoom(9.6) - }) - } + // if (style.dbclickSetCenter) { + polygon.on('dblclick', (e) => { + console.log(`当前点击的是${style.name}`) + $emits('polygonClick', { event: e, map: map.value, style }) + }) + polygonAllList.value.push(polygon) + // } map.value.add(polygon) } // 移除多边形 @@ -268,14 +275,14 @@ zIndex: 50, */ var polyline = new AMap.value.Polyline({ - path: data.path, + path: data.path.map((item: any) => (new AMap.value.LngLat(Number(item[0]), Number(item[1])))), ...data.style, }) - lineAllList.value.push(polyline) polyline.on('click', (e) => { console.log('点击了线') $emits('lineClick', { event: e, map: map.value, data, polyline }) }) + lineAllList.value.push(polyline) map.value.add([polyline]) } // 移除折线 @@ -292,20 +299,17 @@ const massMarksAllList = ref([]) // 添加点标记(海量点) const addMassMarks = (data: any) => { - /** - * data - * path: 折线点位数据 [{lnglat: [116.402394,39.937182],name: "南锣鼓巷", style: 1,}, ] - * style 样式 - * zooms: 在指定地图缩放级别范围内展示海量点图层 - * zIndex: 海量点图层叠加的顺序 - */ var massMarks = new AMap.value.MassMarks(data.path, { zIndex: data.zIndex, // 海量点图层叠加的顺序 zooms: data.zooms, // 在指定地图缩放级别范围内展示海量点图层 style: data.style, // 设置样式对象 }) massMarksAllList.value.push(massMarks) - massMarks.setMap(map) + massMarks.setMap(map.value) + massMarks.on('click', (e) => { + console.log('点击了海量点标记') + $emits('massMarksClick', { event: e, map: map.value, data, massMarks }) + }) } // 移除点标记(海量点) const removeMassMarks = () => { @@ -315,6 +319,40 @@ massMarksAllList.value = [] } // ------------------------------------------------------------------------------------------------ + +// -------------------------------------绘线操作---------------------------------------------------- +const massLineAllList = ref([]) // 海量线数组 +// 添加折线(海量) +const addMassLine = (data: any) => { + /** + * data + * path: 折线点位数据 [[],[],[]] + * style 折线样式 + * style样式参考 + strokeColor: "#3366FF", + strokeWeight: 6, + // 折线样式还支持 'dashed' + strokeStyle: "solid", + zIndex: 50, + zoomLevels: [1,18] + */ + // const multiPolyline = new AMap.value.MultiPolyline({ + // map: map.value, + // styles: { + // ...data.style, + // }, + // }) + // massLineAllList.value.push(multiPolyline) + // multiPolyline.setPaths(data.path) +} +// 移除折线 +const removeMassLine = () => { + // massLineAllList.value.forEach((item: any) => { + // item.setMap(null) + // }) + // massLineAllList.value = [] +} +// ------------------------------------------------------------------------------------------------ onMounted(() => { loading.value = true initMap() @@ -325,8 +363,12 @@ } }) defineExpose({ + map, + AMap, + zoom, // 当前缩放等级 changeLayerGrop, // 切换图层 layerFlag, // 当前图层标识 + polygonAllList, // 多边形区域数据 addPolygon, // 绘制多边形区域 removePolygon, // 移除多边形 addText, // 添加标记文字 @@ -334,9 +376,13 @@ addMarker, // 添加点标记 (一般点标记) removeMarker, // 移除点标记 (一般点标记) addPolyline, // 添加折线 + lineAllList, // 折线数组 removePolyline, // 移除折线 addMassMarks, // 添加点标记(海量点) + massMarksAllList, removeMassMarks, // 移除点标记(海量点) + addMassLine, // 添加折线(海量线) + removeMassLine, // 移除折线(海量线) }) diff --git a/src/main.ts b/src/main.ts index cb80c5d..4317af5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { createApp } from 'vue' import ElementPlus from 'element-plus' -import print from 'vue3-print-nb' +// import print from 'vue3-print-nb' import axios from 'axios' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import dayjs from 'dayjs' @@ -40,7 +40,7 @@ app.config.globalProperties.hasPerm = hasPermission app.config.globalProperties.buttonPerm = buttonPerm app.config.globalProperties.dayjs = dayjs - app.use(print) + // app.use(print) app.use(ElementPlus) app.use(pinia) app.use(router) diff --git a/src/router/modules/home.ts b/src/router/modules/home.ts index 73bfa05..aff4b8e 100644 --- a/src/router/modules/home.ts +++ b/src/router/modules/home.ts @@ -275,19 +275,19 @@ auth: '/device/manage', }, }, - { - path: 'operation', - component: () => import('@/views/home/device/operation/index.vue'), - name: 'DeviceOperation', - meta: { - title: '运维管理', - icon: 'ep:key', - sidebar: true, - breadcrumb: true, - activeMenu: '/device/operation', - auth: '/device/operation', - }, - }, + // { + // path: 'operation', + // component: () => import('@/views/home/device/operation/index.vue'), + // name: 'DeviceOperation', + // meta: { + // title: '运维管理', + // icon: 'ep:key', + // sidebar: true, + // breadcrumb: true, + // activeMenu: '/device/operation', + // auth: '/device/operation', + // }, + // }, { path: 'instruction', component: () => import('@/views/home/device/instruction/index.vue'), diff --git a/src/utils/validate.ts b/src/utils/validate.ts index c59fdc6..8965a33 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -38,7 +38,24 @@ } return true } - +/** + * 判断IP和端口 + * @param ipPort 待判断 + * @returns 是否合法 + */ +export function validateIPPort(ipPort: string) { + const ipRegex = /^(?(\d{1,3}\.){3}\d{1,3})(?:\d{1,5})?$/ + const match = ipRegex.exec(ipPort) + if (!match) { + return false + } + const { port } = match.groups + if (port && port.length > 0) { + const portNumber = parseInt(port.slice(1), 10) + return portNumber >= 1 && portNumber <= 65535 + } + return true +} // /** * 判断整数范围 diff --git a/src/views/home/dashboard/components/detailInfoDialog.vue b/src/views/home/dashboard/components/detailInfoDialog.vue new file mode 100644 index 0000000..cfcf4f6 --- /dev/null +++ b/src/views/home/dashboard/components/detailInfoDialog.vue @@ -0,0 +1,63 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen-bak.vue b/src/views/home/dashboard/fullScreen-bak.vue new file mode 100644 index 0000000..a706cc8 --- /dev/null +++ b/src/views/home/dashboard/fullScreen-bak.vue @@ -0,0 +1,61 @@ + + + + + + diff --git a/src/views/home/dashboard/fullScreen.vue b/src/views/home/dashboard/fullScreen.vue index 4abc479..bba597c 100644 --- a/src/views/home/dashboard/fullScreen.vue +++ b/src/views/home/dashboard/fullScreen.vue @@ -1,26 +1,29 @@ @@ -58,4 +310,60 @@ width: 100%; height: 100vh; } + +.none { + opacity: 0; +} + +.amap-legend { + position: fixed; + bottom: 10px; + left: 10px; + background: rgb(68 66 66 / 60%); + color: #fff; + padding: 10px; + + .legend-item { + display: flex; + + .value { + &:hover { + cursor: pointer; + } + } + } +} + +.close { + width: 150px; + height: 70px; + position: fixed; + top: 0; + right: 0; + + /* background-color: antiquewhite; */ + &:hover { + .icon { + display: block; + } + } + + .icon { + display: none; + width: 50px; + height: 50px; + background: rgb(145 144 144 / 60%); + border-radius: 50%; + line-height: 50px; + text-align: center; + font-size: 18px; + font-weight: 700; + color: #ccc; + margin: 10px auto; + + &:hover { + cursor: pointer; + } + } +} diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index ca77803..485b182 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -1,3 +1,182 @@ + + + diff --git a/src/views/home/device/product/components/editDialog.vue b/src/views/home/device/product/components/editDialog.vue index 9dd5b06..93a7363 100644 --- a/src/views/home/device/product/components/editDialog.vue +++ b/src/views/home/device/product/components/editDialog.vue @@ -1,31 +1,56 @@