This commit is contained in:
zk
2023-12-20 10:25:06 +08:00
parent ce85f39c11
commit 3cc95902ae
12 changed files with 119 additions and 75 deletions
@@ -30,6 +30,7 @@
import $bus from '/@/utils/bus.ts'; import $bus from '/@/utils/bus.ts';
import { earlyWarning } from '/@/utils/busConstant.ts'; import { earlyWarning } from '/@/utils/busConstant.ts';
import { useRefresh } from '/@/hooks/autoRefresh'; import { useRefresh } from '/@/hooks/autoRefresh';
import { PAGE_SWITCH } from '/@/hooks/autoRefresh/pageRefreshTime.ts';
const props = defineProps({ const props = defineProps({
orgCode: String, orgCode: String,
@@ -96,7 +97,7 @@
// }, 3000); // }, 3000);
} }
const { refreshState } = useRefresh(3000, () => { const { refreshState } = useRefresh(PAGE_SWITCH, () => {
interval(); interval();
}); });
onUnmounted(() => { onUnmounted(() => {
@@ -18,7 +18,7 @@
</a-table> </a-table>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from 'vue'; import { nextTick, onMounted, ref, watch } from 'vue';
import { isFunction } from '/@/utils/is.ts'; import { isFunction } from '/@/utils/is.ts';
const props = defineProps({ const props = defineProps({
@@ -26,11 +26,14 @@
default: () => [], default: () => [],
}, },
api: { api: {
default: () => () => {}, type: Function,
}, },
apiParams: { apiParams: {
default: () => {}, default: () => {},
}, },
afterFetch: {
type: Function,
},
}); });
//分页相关 //分页相关
const current = ref(1); const current = ref(1);
@@ -53,30 +56,42 @@
getRecords(); getRecords();
} }
function setPage({ cur, size, sum }) {
current.value = cur;
pageSize.value = size;
total.value = sum;
}
function setDataSource(result) {
dataSource.value = result;
}
const dataSource = ref([]); const dataSource = ref([]);
async function getRecords() { async function getRecords() {
const { code, result } = await props.api({ pageSize: pageSize.value, pageNo: current.value, ...props.apiParams }); const { code, result } = await props.api({ ...props.apiParams, pageSize: pageSize.value, pageNo: current.value });
if (code == 200) { if (code == 200) {
console.log('list', result?.records); if (props.afterFetch && isFunction(props.afterFetch)) {
return props.afterFetch({ result, setPage: setPage, setDataSource: setDataSource });
} else {
dataSource.value = result?.records; dataSource.value = result?.records;
} }
} }
}
watch( watch(
props, props,
() => { () => {
console.log('change'); nextTick(() => {
pageSize.value = 10;
current.value = 1;
getRecords(); getRecords();
});
}, },
{ {
immediate: true, immediate: true,
} }
); );
onMounted(() => {
console.log('props', props.columns);
getRecords();
});
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
:deep(.ant-table-thead > tr > th) { :deep(.ant-table-thead > tr > th) {
@@ -1,6 +1,6 @@
<template> <template>
<public-title @change-v="changeV" @changeShowStatus="changeShowStatus" :keyType="keyType" :user-id="userId" /> <public-title @change-v="changeV" @changeShowStatus="changeShowStatus" :keyType="keyType" :user-id="userId" />
<div style="display: flex; justify-content: center" v-if="status"> <div class="item-three" style="display: flex; justify-content: center" v-if="status">
<div style="width: 15%; text-align: center"> <div style="width: 15%; text-align: center">
<div> <div>
<span style="font-size: 25px"> {{ maxInfo }}</span> <span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -26,7 +26,7 @@
<div v-if="status" ref="chartRef" style="min-height: 300px; width: 100%"></div> <div v-if="status" ref="chartRef" style="min-height: 300px; width: 100%"></div>
<BasicTable v-else :key="refresh" :columns="bloodOxygenColumns" :api="queryBloodOxygenStatisticsPageApi" /> <BasicTable v-else :key="refresh" :columns="bloodOxygenColumns" :api="queryBloodOxygenStatisticsPageApi" :api-params="apiParams" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, onMounted, ref } from 'vue'; import { nextTick, onMounted, ref } from 'vue';
@@ -83,9 +83,7 @@
function changeShowStatus(s: boolean) { function changeShowStatus(s: boolean) {
status.value = s; status.value = s;
if (s) { if (s) {
nextTick(() => {
initEchart('0'); initEchart('0');
});
} else { } else {
tableReload(); tableReload();
} }
@@ -114,11 +112,19 @@
const option = { const option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: true, boundaryGap: true,
data: xArr, data: xArr,
axisLabel: {
color: '#fff',
},
}, },
grid: { grid: {
top: 30, top: 30,
@@ -128,6 +134,9 @@
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
axisLabel: {
color: '#fff',
},
}, },
series: [ series: [
{ {
@@ -1,7 +1,7 @@
<template> <template>
<public-title @change-v="changeV" @changeShowStatus="changeShowStatus" :keyType="keyType" :user-id="userId" /> <public-title @change-v="changeV" @changeShowStatus="changeShowStatus" :keyType="keyType" :user-id="userId" />
<div style="display: flex; justify-content: center" v-if="status"> <div class="item-three" style="display: flex; justify-content: center" v-if="status">
<div style="width: 15%; text-align: center"> <div style="width: 15%; text-align: center">
<div> <div>
<span style="font-size: 25px"> {{ maxInfo }}</span> <span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -115,11 +115,19 @@
const option = { const option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: true, boundaryGap: true,
data: xArr, data: xArr,
axisLabel: {
color: '#fff',
},
}, },
grid: { grid: {
top: 30, top: 30,
@@ -129,6 +137,9 @@
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
axisLabel: {
color: '#fff',
},
}, },
series: [ series: [
{ {
@@ -175,7 +186,6 @@
params['dateYear'] = value.value; params['dateYear'] = value.value;
break; break;
} }
// TODO 待修改
return params; return params;
} }
@@ -7,7 +7,7 @@
:keyType="keyType" :keyType="keyType"
:user-id="userId" :user-id="userId"
/> />
<div style="display: flex; justify-content: center"> <div class="item-three" style="display: flex; justify-content: center">
<div style="width: 15%; text-align: center"> <div style="width: 15%; text-align: center">
<div> <div>
<span style="font-size: 25px"> {{ maxInfo > 1000 ? (maxInfo / 1000).toFixed(2) : maxInfo }}</span> <span style="font-size: 25px"> {{ maxInfo > 1000 ? (maxInfo / 1000).toFixed(2) : maxInfo }}</span>
@@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<BasicTable :key="refresh" :columns="motionColumns" :api="queryExercisePageApi" /> <BasicTable :key="refresh" :columns="motionColumns" :api="queryExercisePageApi" :api-params="apiParams" :afterFetch="afterFetch" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import PublicTitle from '/@/components/secondaryScreen/secondMap/components/userInfoModal/publicTitle.vue'; import PublicTitle from '/@/components/secondaryScreen/secondMap/components/userInfoModal/publicTitle.vue';
@@ -59,37 +59,14 @@
setRefresh(); setRefresh();
} }
// const { tableContext } = useListPage({ function afterFetch({ result, setPage, setDataSource }) {
// tableProps: { setPage({
// api: queryExercisePageApi, total: result?.page.total,
// columns: motionColumns, current: result?.page.current,
// beforeFetch: (params) => { pageSize: result?.page.size,
// let p = getParams(); });
// for (const pKey in p) { setDataSource(result?.page?.records);
// params[pKey] = p[pKey]; }
// }
// return params;
// },
// canResize: false,
// afterFetch: async () => {
// let res = getRawDataSource();
// maxInfo.value = res.totalDistance;
// minInfo.value = res.totalKcal;
// setPagination({
// total: res.page.total,
// current: res.page.current,
// pageSize: res.page.size,
// });
// return res.page.records;
// },
// showTableSetting: false,
// rowSelection: false,
// useSearchForm: false,
// showActionColumn: false,
// },
// });
//
// const [registerTable, { reload, getDataSource, getRawDataSource, setPagination, getPaginationRef }, {}] = tableContext;
function changeV(j: any) { function changeV(j: any) {
type.value = j.type; type.value = j.type;
@@ -1,6 +1,6 @@
<template> <template>
<public-title @change-v="changeV" @changeShowStatus="changeShowStatus" :keyType="keyType" :user-id="userId" /> <public-title @change-v="changeV" @changeShowStatus="changeShowStatus" :keyType="keyType" :user-id="userId" />
<div style="display: flex; justify-content: center" v-if="status"> <div class="item-three" style="display: flex; justify-content: center" v-if="status">
<div style="width: 15%; text-align: center"> <div style="width: 15%; text-align: center">
<div> <div>
<span style="font-size: 25px"> {{ maxInfo }}</span> <span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -111,11 +111,19 @@
const option = { const option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: true, boundaryGap: true,
data: xArr, data: xArr,
axisLabel: {
color: '#fff',
},
}, },
grid: { grid: {
top: 30, top: 30,
@@ -125,6 +133,9 @@
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
axisLabel: {
color: '#fff',
},
}, },
series: [ series: [
{ {
@@ -1,6 +1,6 @@
<template> <template>
<public-title :show-one="false" @change-v="changeV" @change-show-status="changeShowStatus" :keyType="keyType" :user-id="userId" /> <public-title :show-one="false" @change-v="changeV" @change-show-status="changeShowStatus" :keyType="keyType" :user-id="userId" />
<div style="display: flex; justify-content: center" v-if="status"> <div class="item-three" style="display: flex; justify-content: center" v-if="status">
<div style="width: 15%; text-align: center"> <div style="width: 15%; text-align: center">
<div> <div>
<span style="font-size: 25px"> {{ maxInfo }}</span> <span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -117,12 +117,20 @@
const option = { const option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
}, },
legend: {}, legend: {},
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: true, boundaryGap: true,
data: xArr, data: xArr,
axisLabel: {
color: '#fff',
},
}, },
grid: { grid: {
top: 30, top: 30,
@@ -132,6 +140,9 @@
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
axisLabel: {
color: '#fff',
},
}, },
series: [ series: [
{ {
@@ -116,26 +116,28 @@
const option = { const option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
// axisPointer: { textStyle: {
// type: 'cross', color: '#fff',
// crossStyle: { },
// color: '#999', backgroundColor: 'rgba(50,50,50,0.7)',
// }, borderColor: '#1b7ef2',
// },
}, },
xAxis: [ xAxis: [
{ {
type: 'category', type: 'category',
data: xArr, data: xArr,
axisLabel: {
color: '#fff',
},
}, },
], ],
yAxis: [ yAxis: [
{ {
type: 'value', type: 'value',
name: '温度', name: '温度',
// axisLabel: { axisLabel: {
// formatter: '{value} ml', color: '#fff',
// }, },
}, },
], ],
series: [ series: [
@@ -84,7 +84,7 @@
async function getInfo() { async function getInfo() {
await queryAllStatisticsApi({ type: paramsDate.value, userId: infoData.value?.userid || '1692086437685014530' }).then((res) => { await queryAllStatisticsApi({ type: paramsDate.value, userId: infoData.value?.userid || '1692086437685014530' }).then((res) => {
info.value = res; info.value = res?.result;
}); });
} }
@@ -76,8 +76,16 @@
const userInfoModal = ref(); const userInfoModal = ref();
function openUserInfoModal(item) { function openUserInfoModal(item) {
console.log(item); console.log('item', item);
userInfoModal.value.openModal(item); const data = {
...item,
username: item?.realName,
unit: item?.orgName,
department: item?.orgName1,
bindDate: item?.bindDate,
userid: item?.userId,
};
userInfoModal.value.openModal(data);
} }
defineExpose({ defineExpose({
@@ -303,14 +303,14 @@ export const columns = [
align: 'center', align: 'center',
key: 'workout', key: 'workout',
}, },
// { {
// title: '操作', title: '操作',
// dataIndex: 'operation', dataIndex: 'operation',
// align: 'center', align: 'center',
// key: 'operation', key: 'operation',
// fixed: 'right', fixed: 'right',
// width: 80, width: 80,
// }, },
]; ];
export function useChangeTable() { export function useChangeTable() {
+1 -1
View File
@@ -4,4 +4,4 @@ const BASIC_SECOND = 1000; //1s
//副屏 心率、血氧、压力、睡眠、步数 //副屏 心率、血氧、压力、睡眠、步数
export const DEFAULT_TIME = BASIC_MIN * 10; export const DEFAULT_TIME = BASIC_MIN * 10;
//预警分页切换 //预警分页切换
export const PAGE_SWITCH = BASIC_SECOND * 3; export const PAGE_SWITCH = BASIC_SECOND * 300;