diff --git a/.env.development b/.env.development index 772a175..f3c5b0f 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,9 @@ # 王昊地址 VITE_GLOB_API_URL=http://192.168.1.6 #开发环境 -#VITE_GLOB_API_URL=http://cqyt.dev.yg.dt.io \ No newline at end of file +#VITE_GLOB_API_URL=http://cqyt.dev.yg.dt.io + +#应急求助-websocket +VITE_GLOB_API_YIN_JI=ws://192.168.1.6:7098/websocket/watchMonitor +#健康监测工具报警-websocket +VITE_GLOB_API_JIAN_CE=ws://192.168.1.6:7011/websocket/emergency diff --git a/.eslintignore b/.eslintignore index 348631b..787e9b3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -12,4 +12,4 @@ dist .husky .local /bin -Dockerfile +Dockerfile \ No newline at end of file diff --git a/package.json b/package.json index f2e0826..222cfa3 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --open", "build": "vue-tsc && vite build", "preview": "vite preview", "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"" }, "dependencies": { "@amap/amap-jsapi-loader": "^1.0.1", + "@iamzzg/data-view": "^2.10.0", "axios": "^1.6.2", "dayjs": "^1.11.10", "lodash-es": "^4.17.21", diff --git a/src/api/request.ts b/src/api/request.ts index 0360c96..69d1e7a 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -3,7 +3,7 @@ import { getAppEnvConfig } from '../utils/env.ts'; const { VITE_GLOB_API_URL } = getAppEnvConfig(); let token = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWRlbnRpZmllciI6ImU5Y2EyM2Q2OGQ4ODRkNGViYjE5ZDA3ODg5NzI3ZGFlIiwiZXhwIjoxNzAyMDA1MDQ4fQ.M1Xlecj3eUOgZUSofOlyBMoxJ5F01KH-tgJxaV2Femc\n'; + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWRlbnRpZmllciI6ImU5Y2EyM2Q2OGQ4ODRkNGViYjE5ZDA3ODg5NzI3ZGFlIiwiZXhwIjoxNzAzMjMyOTQ0fQ.de0NagvCsVmg_sZGoE5PirZcdDRXPX-j9yj3AqbV6t4'; const service = axios.create({ baseURL: VITE_GLOB_API_URL, timeout: 50000, diff --git a/src/assets/images/doctors1.png b/src/assets/images/doctors1.png index 07b4629..5d3acf0 100644 Binary files a/src/assets/images/doctors1.png and b/src/assets/images/doctors1.png differ diff --git a/src/assets/images/doctors2.png b/src/assets/images/doctors2.png index db3293c..51d7ddc 100644 Binary files a/src/assets/images/doctors2.png and b/src/assets/images/doctors2.png differ diff --git a/src/assets/images/doctors3.png b/src/assets/images/doctors3.png index 7945acc..d71ee51 100644 Binary files a/src/assets/images/doctors3.png and b/src/assets/images/doctors3.png differ diff --git a/src/assets/images/doctors4.png b/src/assets/images/doctors4.png index 81ff5d0..87f05f7 100644 Binary files a/src/assets/images/doctors4.png and b/src/assets/images/doctors4.png differ diff --git a/src/assets/less/amap-item.less b/src/assets/less/amap-item.less index 73eadee..a847eb7 100644 --- a/src/assets/less/amap-item.less +++ b/src/assets/less/amap-item.less @@ -1,59 +1,64 @@ //高德信息弹窗 .amap-info-contentContainer { - .amap-content-body { - background: #00152B; - border: 1px solid #129BFF; + .amap-content-body { + background: #00152B; + border: 1px solid #129BFF; - .amap-lib-infowindow { - background: #00152B; + .amap-lib-infowindow { + background: #00152B; - .amap-lib-infowindow-title { - color: #fff; - border-bottom: 1px solid #129BFF; - padding: 4px 0; - } + .amap-lib-infowindow-title { + color: #fff; + border-bottom: 1px solid #129BFF; + padding: 4px 0; + } - .amap-lib-infowindow-content { - color: #fff; - padding: 4px 0; - } + .amap-lib-infowindow-content { + color: #fff; + padding: 4px 0; + } + } + } + + .amap-combo-close { + top: 5px; + right: 7px; } - } } /*地图元素样式---start*/ //marker .amap-marker-label { - padding: 0; + padding: 0; } .alarm-content { - background-color: #263d5e; - color: #fff; - font-size: 14px; - padding: 7px 10px; - border: 1px solid #1b7ef2; - position: relative; - - .close-btn { - position: absolute; - top: -6px; - right: -8px; - width: 15px; - height: 15px; - font-size: 12px; - background: #ccc; - border-radius: 50%; + background-color: #263d5e; color: #fff; - text-align: center; - line-height: 15px; - box-shadow: -1px 1px 1px rgba(10, 10, 10, 0.2); - } + font-size: 14px; + padding: 7px 10px; + border: 1px solid #1b7ef2; + position: relative; - .close-btn:hover { - background: #666; - } + .close-btn { + position: absolute; + top: -6px; + right: -8px; + width: 15px; + height: 15px; + font-size: 12px; + background: #ccc; + border-radius: 50%; + color: #fff; + text-align: center; + line-height: 15px; + box-shadow: -1px 1px 1px rgba(10, 10, 10, 0.2); + } + + .close-btn:hover { + background: #666; + } } /*地图元素样式---end*/ \ No newline at end of file diff --git a/src/assets/less/index.less b/src/assets/less/index.less index 115b64d..7cda6d3 100644 --- a/src/assets/less/index.less +++ b/src/assets/less/index.less @@ -1,146 +1,149 @@ @import "./amap-item"; .type-time { - padding-right: 4%; - padding-top: 3%; - font-size: 16px; - display: flex; - justify-content: right; + padding-right: 4%; + padding-top: 3%; + font-size: 16px; + display: flex; + justify-content: right; - span { - padding: 0 2%; - cursor: pointer; - } - - .select { - color: #45a2ff; - position: relative; - - &:after { - content: ''; - position: absolute; - display: block; - width: 72%; - left: 6px; - bottom: -12px; - height: 6px; - background: url('../images/light.png') no-repeat; - background-size: 100% 100%; + span { + padding: 0 2%; + cursor: pointer; } - } - .unSelect { - color: #a3a4a4; - } + .select { + color: #45a2ff; + position: relative; + + &:after { + content: ''; + position: absolute; + display: block; + width: 72%; + left: 6px; + bottom: -12px; + height: 6px; + background: url('../images/light.png') no-repeat; + background-size: 100% 100%; + } + } + + .unSelect { + color: #a3a4a4; + } } *::-webkit-scrollbar { - width: 12px; - height: 12px; + width: 12px; + height: 12px; } *::-webkit-scrollbar-button { - width: 0; - height: 0; - display: none; + width: 0; + height: 0; + display: none; } *::-webkit-scrollbar-corner { - background-color: transparent; + background-color: transparent; } *::-webkit-scrollbar-thumb { - border: 4px solid rgba(0, 0, 0, 0); - height: 6px; - border-radius: 25px; - background-clip: padding-box; - background-color: rgba(0, 0, 0, 0.3); + border: 4px solid rgba(0, 0, 0, 0); + height: 6px; + border-radius: 25px; + background-clip: padding-box; + background-color: rgba(0, 0, 0, 0.3); } .nowrap { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .ant-modal-mask { - background-color: rgba(0, 0, 0, 0.65) !important; + background-color: rgba(0, 0, 0, 0.65) !important; } // 下拉框样式-start .ant-select-dropdown { - background-color: #00152b !important; - border-right: 1px solid #1b7ef2; - border-left: 1px solid #1b7ef2; - border-bottom: 1px solid #1b7ef2; + background-color: #00152b !important; + border-right: 1px solid #1b7ef2; + border-left: 1px solid #1b7ef2; + border-bottom: 1px solid #1b7ef2; } .ant-select-item { - color: #1b7ef2 !important; + color: #1b7ef2 !important; } //框背景色 .ant-select:not(.ant-select-customize-input) .ant-select-selector { - color: #1b7ef2 !important; - background-color: transparent !important; - border: 1px solid #1b7ef2 !important; + color: #1b7ef2 !important; + background-color: transparent !important; + border: 1px solid #1b7ef2 !important; } .ant-select-item-option-selected { - color: #ffffff !important; + color: #ffffff !important; } // 选中字体颜色 .ant-select-selection-item { - //color: #1b7ef2 !important; - color: #fff; + //color: #1b7ef2 !important; + color: #fff; } .ant-select-item-option-active { - background-color: transparent !important; + background-color: transparent !important; } .ant-select-item-option-active:hover { - background-color: #002e64 !important; + background-color: #002e64 !important; } // 箭头颜色 .ant-select-arrow { - color: #1b7ef2 !important; + color: #1b7ef2 !important; } .ant-select-item-option-selected:not(.ant-select-item-option-disabled) { - background-color: #002e64 !important; + background-color: #002e64 !important; } // 下拉框样式-end // 级联选择器样式-start .ant-cascader-menu-item { - color: #1b7ef2 !important; + color: #1b7ef2 !important; } .ant-cascader-menu-item:hover { - background-color: #002e64 !important; + background-color: #002e64 !important; } .ant-cascader-menu-item-active { - color: #fff !important; - background-color: #002e64 !important; + color: #fff !important; + background-color: #002e64 !important; } .ant-cascader-menu-item-expand .ant-cascader-menu-item-expand-icon, .ant-cascader-menu-item-loading-icon { - color: #1b7ef2 !important; + color: #1b7ef2 !important; } // 级联选择器样式-end +.ant-empty-description { + color: #fff; +} //直升机 .helicopter { - width: 60px; - height: 37px; - background: url("../img/helicopter.png") no-repeat; - background-size: 100% 100%; - margin-bottom: 4px; + width: 60px; + height: 37px; + background: url("../img/helicopter.png") no-repeat; + background-size: 100% 100%; + margin-bottom: 4px; } diff --git a/src/assets/mapUtils/map.ts b/src/assets/mapUtils/map.ts index bb1f742..5323cc9 100644 --- a/src/assets/mapUtils/map.ts +++ b/src/assets/mapUtils/map.ts @@ -3,6 +3,7 @@ import chinaInner from '/@/assets/lngLat/chinaInner.ts'; import { createCircle, createIcon, typeToIcon } from '/@/assets/mapUtils/commonFun.ts'; import { aircraftContent, alarmIcon } from '/@/components/chinaMap/chinaHooks.ts'; import { isFunction } from '/@/utils/is.ts'; +import { Callback, ExtDataType, InitMap, MarkerOption, ResultType } from '/@/assets/mapUtils/mapFunTypes.ts'; export const defaultOption = { center: [106.3, 37.87], //地图中心点 @@ -23,7 +24,7 @@ export const Map = { * @param el dom元素 id选择器 * @param option 地图配置 */ - initMap({ el, option }) { + initMap({ el, option }: InitMap) { const { zoom, center, mapStyle } = { ...defaultOption, ...option }; //基本地图加载 this.map = new AMap.Map(el, { @@ -43,7 +44,7 @@ export const Map = { drawOutLine() { let geoJson = new AMap.GeoJSON({ geoJSON: china, - getPolygon: function (geoJson, lngLats) { + getPolygon: function (geoJson: string, lngLats: any) { return new AMap.Polyline({ path: lngLats[0], strokeColor: '#6ccffe', @@ -62,7 +63,7 @@ export const Map = { drawInnerLine() { let geoJson = new AMap.GeoJSON({ geoJSON: chinaInner, - getPolygon: function (geoJson, lngLats) { + getPolygon: function (geoJson: string, lngLats: any) { return new AMap.Polyline({ path: lngLats[0], strokeColor: '#359de5', @@ -71,24 +72,35 @@ export const Map = { }, }); this.map.add(geoJson); - }, // 清空当前地图上除了边界线的覆盖物 + }, + /** + * @desc 设置地图级别与中心点 + * @param center 【lon,lat】 + * @param zoom 地图层级 + * */ + setZoomCenter(center, zoom = 12) { + this.map && this.map.setZoomAndCenter(zoom, center); + }, + /** + * @desc 清空当前地图上除了边界线的覆盖物 + */ removeOverlayGroup() { this.clearAircraft(); this.clearOverlay(); this.clearAirRange(); this.clearMarker(); // - if (this.airMarkerList.length > 0) { - for (let i = 0; i < this.airMarkerList.length; i++) { - this.airMarkerList[i].setMap(null); - } + if (this.airMarkerList) { + this.airMarkerList = []; } // this.map.remove(this.airMarkerList); }, // /** * @desc 创建覆盖物组,用于批量处理点 (控制显隐,点击事件等) * @param result + * @param extData + * @param callback */ - createOverlay(result, { extOption = {}, content }, callback) { + createOverlay(result: ResultType[], extData?: ExtDataType, callback?: Callback) { this.removeOverlayGroup(); this.overlayGroup = new AMap.OverlayGroup(); for (let i = 0; i < result.length; i++) { @@ -101,6 +113,7 @@ export const Map = { } // 创建一个 Icon let startIcon = typeToIcon(type); + // debugger; // 将 icon 传入 marker let startMarker = new AMap.Marker({ // 点的坐标 @@ -109,9 +122,9 @@ export const Map = { clickable: true, //点额外携带的数据,用户自定义属性,支持JavaScript API任意数据类型 extData: result[i], label: { - content: isFunction(content) && content(result[i]), + content: isFunction(extData?.content) && extData?.content(result[i]), }, - ...extOption, + ...extData?.extOption, }); // 可以调用setExtData()设置自定义属性 //将组 挂载到地图上 @@ -139,9 +152,11 @@ export const Map = { * @desc 创建直升机marker * @param result */ - createAircraft(result) { + createAircraft(result: ResultType[]) { + console.log('result', result); this.removeOverlayGroup(); this.clearActiveHospital(); + // debugger; if (!Array.isArray(result) && result.length == 0) return; this.createAirRange(result); let that = this; @@ -152,6 +167,7 @@ export const Map = { arr, { renderMarker: (context) => { + console.log('context', context); let factor = Math.pow(context.count / count, 1 / 18); let div = document.createElement('div'); div.className = 'render-air'; @@ -163,25 +179,26 @@ export const Map = { div.style.fontSize = '14px'; context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); context.marker.setContent(div); - this.airMarkerList.push(context.marker); - context.marker.on('click', () => { - console.log('data', context); - }); + // this.airMarkerList.push(context.marker); + // context.marker.on('click', () => { + // console.log('data', context); + // }); }, } ); - this.cluster.setMap(this.map); + // this.cluster.setMap(this.map); }, clearAircraft() { if (this.cluster) { - this.map.remove(this.cluster); - this.cluster = null; + this.cluster.setMap(null); + // this.map.remove(this.cluster); + // this.cluster = null; } } /** * @desc 飞机范围 * @param list */, - createAirRange(list) { + createAirRange(list: ResultType[]) { this.removeOverlayGroup(); this.circleGroup = new AMap.OverlayGroup(); for (let i = 0; i < list.length; i++) { @@ -223,17 +240,18 @@ export const Map = { this.placeSearch = null; } }, - createMarker(option, callbck: () => {}) { + createMarker(option: MarkerOption, callbck?: Callback) { this.clearMarker(); let { lon, lat, zoom = 12 } = option; const icon = createIcon({ icon: alarmIcon, iconSize: [36, 42], imageSize: [36, 42] }); + let str = option?.realName && option?.eventType_dictText ? `${option?.realName},${option?.eventType_dictText}` : `${option?.realName}`; this.marker = new AMap.Marker({ position: [lon, lat], icon: icon, offset: new AMap.Pixel(0, 0), //设置偏移量 label: { content: `