This commit is contained in:
zk
2023-12-19 10:46:50 +08:00
parent 8cb7d4baf8
commit 9b5be1af25
11 changed files with 76 additions and 58 deletions
+14 -3
View File
@@ -1,7 +1,18 @@
#后台地址 #后台地址
VITE_GLOB_API_URL=https://api.cqygjk.com #VITE_GLOB_API_URL=https://api.cqygjk.com
#应急求助-websocket #应急求助-websocket
VITE_GLOB_API_YIN_JI=wss://api.cqygjk.com/health-watch/websocket/watchMonitor #VITE_GLOB_API_YIN_JI=wss://api.cqygjk.com/health-watch/websocket/watchMonitor
#健康监测工具报警-websocket #健康监测工具报警-websocket
VITE_GLOB_API_JIAN_CE=wss://api.cqygjk.com/health-emergency/websocket/emergency #VITE_GLOB_API_JIAN_CE=wss://api.cqygjk.com/health-emergency/websocket/emergency
# 王昊地址
#VITE_GLOB_API_URL=http://192.168.1.3
#开发环境
VITE_GLOB_API_URL=http://cqyt.dev.yg.dt.io
#应急求助-websocket
VITE_GLOB_API_YIN_JI=ws://cqyt.dev.yg.dt.io/health-watch/websocket/watchMonitor
#健康监测工具报警-websocket
VITE_GLOB_API_JIAN_CE=ws://cqyt.dev.yg.dt.io/health-emergency/websocket/emergency
+1 -1
View File
@@ -14,7 +14,7 @@
</script> </script>
<!-- <script type="text/javascript"--> <!-- <script type="text/javascript"-->
<!-- src="https://webapi.amap.com/maps?v=2.0&key=4bbcb216b889f2d612cbed05ae6979c8&plugin=AMap.Driving,AMap.ToolBar,AMap.Driving,AMap.GeoJSON,AMap.MarkerCluster"></script>--> <!-- src="https://webapi.amap.com/maps?v=2.0&key=4bbcb216b889f2d612cbed05ae6979c8&plugin=AMap.Driving,AMap.ToolBar,AMap.Driving,AMap.GeoJSON,AMap.MarkerCluster"></script>-->
<script type="text/javascript" src="./public/amap.js"></script> <script type="module" src="./public/amap.js"></script>
</head> </head>
<style> <style>
html, body, #app { html, body, #app {
+1 -1
View File
@@ -8,7 +8,7 @@
"build": "vite build", "build": "vite build",
"build:dev": "vite build --mode dev", "build:dev": "vite build --mode dev",
"build:test": "vite build --mode test", "build:test": "vite build --mode test",
"preview": "vite preview", "preview": "vite build && vite preview",
"type:check": "vue-tsc --noEmit --skipLibCheck", "type:check": "vue-tsc --noEmit --skipLibCheck",
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"" "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
}, },
@@ -5,7 +5,7 @@
<slot name="rightForm"></slot> <slot name="rightForm"></slot>
</div> </div>
<div style="flex: 1; overflow: hidden; margin: 0 0 10px; height: 100%"> <div style="flex: 1; overflow: hidden; margin: 0 0 10px; height: 100%">
<div id="mapContainer" class="mapContainer"></div> <div id="mapSecondMap" class="mapSecondMap"></div>
</div> </div>
<div v-show="false" id="container"></div> <div v-show="false" id="container"></div>
<div v-show="false" id="panel"></div> <div v-show="false" id="panel"></div>
@@ -53,8 +53,8 @@
const { isShow, className, setIsShow } = useMoveClass(); const { isShow, className, setIsShow } = useMoveClass();
function init() { function init() {
let mapContainer = document.querySelector('.mapContainer'); let mapContainer = document.querySelector('.mapSecondMap');
mapContainer && Map.initMap({ el: 'mapContainer' }); mapContainer && Map.initMap({ el: 'mapSecondMap' });
getMapList(); getMapList();
} }
@@ -154,7 +154,7 @@
z-index: 1; z-index: 1;
} }
.mapContainer { .mapSecondMap {
height: calc(100% + 20px); height: calc(100% + 20px);
margin: 10px 0; margin: 10px 0;
} }
@@ -37,7 +37,7 @@ export function useDepart() {
}; };
} }
export function useTimeType(t) { export function useTimeType(t: string) {
const type = ref(t || ''); const type = ref(t || '');
const timeRangeOption = [ const timeRangeOption = [
{ {
+19 -5
View File
@@ -1,14 +1,18 @@
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import { isFunction } from '/@/utils/is.ts';
export function useRefresh(time = 3000, callback) { /**
* @desc 定时刷新
* @param time
* @param callback
*/
export function useRefresh(time = 3000, callback?: Function) {
const refreshState = ref(false); const refreshState = ref(false);
const timer = ref(null); const timer = ref(null);
function setRefreshState() { function setRefreshState() {
timer.value = setInterval(() => { startRefresh();
refreshState.value = !refreshState.value;
callback();
}, time);
} }
function stopRefresh() { function stopRefresh() {
@@ -16,6 +20,15 @@ export function useRefresh(time = 3000, callback) {
timer.value = null; timer.value = null;
} }
function startRefresh() {
timer.value = setInterval(() => {
refreshState.value = !refreshState.value;
if (callback && isFunction(callback)) {
callback();
}
}, time);
}
onMounted(() => { onMounted(() => {
if (timer.value != null) { if (timer.value != null) {
timer.value = null; timer.value = null;
@@ -29,5 +42,6 @@ export function useRefresh(time = 3000, callback) {
return { return {
refreshState, refreshState,
stopRefresh, stopRefresh,
startRefresh,
}; };
} }
+7 -3
View File
@@ -1,3 +1,7 @@
export default { // 更新频率
//预警 const BASIC_MIN = 60 * 1000; //1min
}; const BASIC_SECOND = 1000; //1s
//副屏 心率、血氧、压力、睡眠、步数
export const DEFAULT_TIME = BASIC_MIN * 10;
//预警分页切换
export const PAGE_SWITCH = BASIC_SECOND * 3;
+3 -2
View File
@@ -1,4 +1,4 @@
import { createApp } from 'vue'; import {createApp} from 'vue';
import App from './App.vue'; import App from './App.vue';
import './assets/less/index.less'; import './assets/less/index.less';
import router from './router'; import router from './router';
@@ -6,7 +6,8 @@ import router from './router';
import('ant-design-vue/dist/antd.less'); import('ant-design-vue/dist/antd.less');
import registerGlobComp from './assets/ts/antd.ts'; import registerGlobComp from './assets/ts/antd.ts';
import directiveMethods from './assets/ts/directive'; import directiveMethods from './assets/ts/directive';
import { setupStore } from './store/index.ts'; import {setupStore} from './store/index.ts';
const app = createApp(App); const app = createApp(App);
// 注册自定义事件 // 注册自定义事件
+1 -1
View File
@@ -1,4 +1,4 @@
import * as dayjs from 'dayjs'; import dayjs from 'dayjs';
export function getZero(num: any) { export function getZero(num: any) {
if (num < 10) { if (num < 10) {
+20 -34
View File
@@ -25,16 +25,14 @@
class="type-select" class="type-select"
:options="option" :options="option"
:field-names="fieldNames" :field-names="fieldNames"
@change="orgChange"
></a-select> ></a-select>
<!-- <a-cascader v-model:value="treeValue" :options="treeOption" placeholder="选择单位" :open="true" :changeOnSelect="true" />-->
<a-select placeholder="选择时间范围" v-model:value="type" class="type-select" :options="timeRangeOption"></a-select> <a-select placeholder="选择时间范围" v-model:value="type" class="type-select" :options="timeRangeOption"></a-select>
</template> </template>
</SecondMap> </SecondMap>
</div> </div>
<div class="body-d-right"> <div class="body-d-right">
<one-r :orgCode="orgCode" :type="type" :key="refreshState" /> <one-r :orgCode="orgCode" :type="type" :key="refreshState" />
<two-r :orgCode="orgCode" :type="type" /> <two-r :orgCode="orgCode" :type="type" :key="refreshState" />
<three-r :orgCode="orgCode" :type="type" /> <three-r :orgCode="orgCode" :type="type" />
</div> </div>
</div> </div>
@@ -43,22 +41,33 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { RollbackOutlined } from '@ant-design/icons-vue'; import { RollbackOutlined } from '@ant-design/icons-vue';
import { nextTick, onMounted, ref, watch } from 'vue'; import { nextTick, onMounted, ref } from 'vue';
import OneR from '/@/components/secondaryScreen/screen-right/oneR.vue'; import OneR from '/@/components/secondaryScreen/screen-right/oneR.vue';
import TwoR from '/@/components/secondaryScreen/screen-right/twoR.vue'; import TwoR from '/@/components/secondaryScreen/screen-right/twoR.vue';
import ThreeR from '/@/components/secondaryScreen/screen-right/threeR.vue'; import ThreeR from '/@/components/secondaryScreen/screen-right/threeR.vue';
import SecondMap from '/@/components/secondaryScreen/secondMap/secondMap'; import SecondMap from '/@/components/secondaryScreen/secondMap/secondMap.vue';
import screenLeft from '/@/components/secondaryScreen/screen-left/screenLeft.vue'; import screenLeft from '/@/components/secondaryScreen/screen-left/screenLeft.vue';
import router from '/@/router'; import router from '/@/router';
import { useDepart, useTimeType, useTree } from '/@/components/secondaryScreen/secondMap/secondMapHooks.ts'; import { useDepart, useTimeType } from '/@/components/secondaryScreen/secondMap/secondMapHooks.ts';
import { useTopTime } from '/@/utils/utils.ts'; import { useTopTime } from '/@/utils/utils.ts';
import { useUserStore } from '/@/store/modules/user.ts'; import { useUserStore } from '/@/store/modules/user.ts';
import { useRefresh } from '/@/hooks/autoRefresh'; import { useRefresh } from '/@/hooks/autoRefresh';
import { DEFAULT_TIME } from '/@/hooks/autoRefresh/pageRefreshTime.ts';
const { refreshState } = useRefresh(3000); const { refreshState } = useRefresh(DEFAULT_TIME);
const useStore = useUserStore(); const useStore = useUserStore();
const dayTimeT = ref(); const { orgCode, option, fieldNames, setOrgCode } = useDepart();
onMounted(() => {
const userInfo = useStore.getUserInfo;
let orgCode = userInfo?.secondDepart?.orgCode;
if (orgCode) {
nextTick(() => {
setOrgCode(orgCode);
});
}
init();
});
const { type, timeRangeOption } = useTimeType('week');
function init() { function init() {
getTime(); getTime();
@@ -67,6 +76,8 @@
}, 1000); }, 1000);
} }
const dayTimeT = ref();
function getTime() { function getTime() {
const { timeRight } = useTopTime(); const { timeRight } = useTopTime();
dayTimeT.value = timeRight; dayTimeT.value = timeRight;
@@ -75,31 +86,6 @@
function clickBack() { function clickBack() {
router.go(-1); router.go(-1);
} }
const { orgCode, option, fieldNames, setOrgCode } = useDepart({});
// const reloadPage = ref(true);
onMounted(() => {
const userInfo = useStore.getUserInfo;
console.log('465', userInfo);
let orgCode = userInfo?.secondDepart?.orgCode;
console.log('9999', orgCode);
if (orgCode) {
nextTick(() => {
setOrgCode(orgCode);
init();
});
}
// setInterval(() => {
// reloadPage.value = !reloadPage.value;
// }, 3000);
});
function orgChange(val, option) {
console.log('val', val);
console.log('option', option);
}
const { type, timeRangeOption } = useTimeType('week');
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.outer { .outer {
+5 -3
View File
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite'; import {defineConfig} from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import { resolve } from 'path'; import {resolve} from 'path';
function pathResolve(dir: string) { function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir); return resolve(process.cwd(), '.', dir);
@@ -8,7 +8,9 @@ function pathResolve(dir: string) {
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [
vue(),
],
css: { css: {
preprocessorOptions: { preprocessorOptions: {
less: { less: {