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 { earlyWarning } from '/@/utils/busConstant.ts';
import { useRefresh } from '/@/hooks/autoRefresh';
import { PAGE_SWITCH } from '/@/hooks/autoRefresh/pageRefreshTime.ts';
const props = defineProps({
orgCode: String,
@@ -96,7 +97,7 @@
// }, 3000);
}
const { refreshState } = useRefresh(3000, () => {
const { refreshState } = useRefresh(PAGE_SWITCH, () => {
interval();
});
onUnmounted(() => {
@@ -18,7 +18,7 @@
</a-table>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue';
import { nextTick, onMounted, ref, watch } from 'vue';
import { isFunction } from '/@/utils/is.ts';
const props = defineProps({
@@ -26,11 +26,14 @@
default: () => [],
},
api: {
default: () => () => {},
type: Function,
},
apiParams: {
default: () => {},
},
afterFetch: {
type: Function,
},
});
//分页相关
const current = ref(1);
@@ -53,30 +56,42 @@
getRecords();
}
function setPage({ cur, size, sum }) {
current.value = cur;
pageSize.value = size;
total.value = sum;
}
function setDataSource(result) {
dataSource.value = result;
}
const dataSource = ref([]);
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) {
console.log('list', result?.records);
dataSource.value = result?.records;
if (props.afterFetch && isFunction(props.afterFetch)) {
return props.afterFetch({ result, setPage: setPage, setDataSource: setDataSource });
} else {
dataSource.value = result?.records;
}
}
}
watch(
props,
() => {
console.log('change');
getRecords();
nextTick(() => {
pageSize.value = 10;
current.value = 1;
getRecords();
});
},
{
immediate: true,
}
);
onMounted(() => {
console.log('props', props.columns);
getRecords();
});
</script>
<style scoped lang="less">
:deep(.ant-table-thead > tr > th) {
@@ -1,6 +1,6 @@
<template>
<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>
<span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -26,7 +26,7 @@
<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>
<script setup lang="ts">
import { nextTick, onMounted, ref } from 'vue';
@@ -83,9 +83,7 @@
function changeShowStatus(s: boolean) {
status.value = s;
if (s) {
nextTick(() => {
initEchart('0');
});
initEchart('0');
} else {
tableReload();
}
@@ -114,11 +112,19 @@
const option = {
tooltip: {
trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
xAxis: {
type: 'category',
boundaryGap: true,
data: xArr,
axisLabel: {
color: '#fff',
},
},
grid: {
top: 30,
@@ -128,6 +134,9 @@
},
yAxis: {
type: 'value',
axisLabel: {
color: '#fff',
},
},
series: [
{
@@ -1,7 +1,7 @@
<template>
<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>
<span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -115,11 +115,19 @@
const option = {
tooltip: {
trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
xAxis: {
type: 'category',
boundaryGap: true,
data: xArr,
axisLabel: {
color: '#fff',
},
},
grid: {
top: 30,
@@ -129,6 +137,9 @@
},
yAxis: {
type: 'value',
axisLabel: {
color: '#fff',
},
},
series: [
{
@@ -175,7 +186,6 @@
params['dateYear'] = value.value;
break;
}
// TODO 待修改
return params;
}
@@ -7,7 +7,7 @@
:keyType="keyType"
: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>
<span style="font-size: 25px"> {{ maxInfo > 1000 ? (maxInfo / 1000).toFixed(2) : maxInfo }}</span>
@@ -24,7 +24,7 @@
</div>
</div>
<BasicTable :key="refresh" :columns="motionColumns" :api="queryExercisePageApi" />
<BasicTable :key="refresh" :columns="motionColumns" :api="queryExercisePageApi" :api-params="apiParams" :afterFetch="afterFetch" />
</template>
<script setup lang="ts">
import PublicTitle from '/@/components/secondaryScreen/secondMap/components/userInfoModal/publicTitle.vue';
@@ -59,37 +59,14 @@
setRefresh();
}
// const { tableContext } = useListPage({
// tableProps: {
// api: queryExercisePageApi,
// columns: motionColumns,
// beforeFetch: (params) => {
// let p = getParams();
// for (const pKey in p) {
// 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 afterFetch({ result, setPage, setDataSource }) {
setPage({
total: result?.page.total,
current: result?.page.current,
pageSize: result?.page.size,
});
setDataSource(result?.page?.records);
}
function changeV(j: any) {
type.value = j.type;
@@ -1,6 +1,6 @@
<template>
<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>
<span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -111,11 +111,19 @@
const option = {
tooltip: {
trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
xAxis: {
type: 'category',
boundaryGap: true,
data: xArr,
axisLabel: {
color: '#fff',
},
},
grid: {
top: 30,
@@ -125,6 +133,9 @@
},
yAxis: {
type: 'value',
axisLabel: {
color: '#fff',
},
},
series: [
{
@@ -1,6 +1,6 @@
<template>
<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>
<span style="font-size: 25px"> {{ maxInfo }}</span>
@@ -117,12 +117,20 @@
const option = {
tooltip: {
trigger: 'axis',
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
legend: {},
xAxis: {
type: 'category',
boundaryGap: true,
data: xArr,
axisLabel: {
color: '#fff',
},
},
grid: {
top: 30,
@@ -132,6 +140,9 @@
},
yAxis: {
type: 'value',
axisLabel: {
color: '#fff',
},
},
series: [
{
@@ -116,26 +116,28 @@
const option = {
tooltip: {
trigger: 'axis',
// axisPointer: {
// type: 'cross',
// crossStyle: {
// color: '#999',
// },
// },
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
xAxis: [
{
type: 'category',
data: xArr,
axisLabel: {
color: '#fff',
},
},
],
yAxis: [
{
type: 'value',
name: '温度',
// axisLabel: {
// formatter: '{value} ml',
// },
axisLabel: {
color: '#fff',
},
},
],
series: [
@@ -84,7 +84,7 @@
async function getInfo() {
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();
function openUserInfoModal(item) {
console.log(item);
userInfoModal.value.openModal(item);
console.log('item', item);
const data = {
...item,
username: item?.realName,
unit: item?.orgName,
department: item?.orgName1,
bindDate: item?.bindDate,
userid: item?.userId,
};
userInfoModal.value.openModal(data);
}
defineExpose({
@@ -303,14 +303,14 @@ export const columns = [
align: 'center',
key: 'workout',
},
// {
// title: '操作',
// dataIndex: 'operation',
// align: 'center',
// key: 'operation',
// fixed: 'right',
// width: 80,
// },
{
title: '操作',
dataIndex: 'operation',
align: 'center',
key: 'operation',
fixed: 'right',
width: 80,
},
];
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 PAGE_SWITCH = BASIC_SECOND * 3;
export const PAGE_SWITCH = BASIC_SECOND * 300;