update: 大屏接口

This commit is contained in:
xf
2025-07-08 15:52:42 +08:00
parent a2da7e4be7
commit 07f14c7703
8 changed files with 465 additions and 37 deletions
+128 -8
View File
@@ -1,5 +1,5 @@
<template>
<Dialog class="index-modal" :openVis="visible" width="60%" :title="dialogTitle" @close="closeDialog" :maskClosable="false">
<Dialog class="index-modal" :openVis="visible" width="60%" :title="dialogTitle" @close="handleClose" :maskClosable="false">
<template #container>
<div v-if="useForm" class="form-container">
<Form :model="formRecord" v-bind="formItemLayout">
@@ -22,7 +22,7 @@
<slot name="searchSecond"></slot>
</Form>
<div class="form-btn">
<a-button @click="handleClicksearch" style="border-color: #00ccff">重置</a-button>
<a-button @click="handleClickReset" style="border-color: #00ccff">重置</a-button>
<a-button
@click="handleClicksearch"
:loading="loading"
@@ -32,7 +32,23 @@
</a-button>
</div>
</div>
<BasicTable @table-load="tableLoad" ref="registerTable" class="table-container" :key="visible" :columns="column" :apiParams="formState" />
<div class="top-bottom-center" v-if="twoROnly">
<div class="date-change">
<span :class="dataActity == 1 ? 'date-item' : ''" @click="handleDataChange(1)">今日</span>
<span :class="dataActity == 2 ? 'date-item' : ''" @click="handleDataChange(2)">本月</span>
</div>
<div style="margin: 0 20px"> {{ dataActity == 1 ? '今日' : '本月' }}打卡总人数{{ normalNum }} </div>
<div> 异常人数{{ abnormalNum }} </div>
</div>
<BasicTable
@table-load="tableLoad"
ref="registerTable"
class="table-container"
:api="api"
:key="visible"
:columns="column"
:apiParams="formState"
/>
</template>
</Dialog>
</template>
@@ -64,13 +80,23 @@
type: Array,
default: () => [],
},
api: {
type: Function,
default: () => {},
},
twoROnly: {
type: Object,
},
apiParams: {
type: Object,
},
});
const loading = ref<boolean>(false);
const formState = ref();
const registerTable = ref();
const dialogTitle = ref('');
const formRecord = ref({
sex: SexType.all,
});
const formRecord = ref({});
const dataActity = ref(1);
function changeDept() {
if (!orgCode.value) {
return message.warning('请先选择单位');
@@ -79,6 +105,10 @@
onMounted(() => {
getSecondDept();
});
function handleDataChange(type) {
if (type == dataActity.value) return;
dataActity.value = type;
}
function getSecondDept() {
getSecondaryDepartmentList().then((res) => {
console.log(res, 'shshakjhdsjbjanmdjka');
@@ -99,9 +129,52 @@
};
watch(props, () => {
dialogTitle.value = props.title;
formState.value = {
...formState.value,
...props.apiParams,
};
if (props.twoROnly) {
twoROnlyFun();
}
getField();
getSecondDept();
});
const normalNum = ref();
const abnormalNum = ref();
function twoROnlyFun() {
normalNum.value = '';
abnormalNum.value = '';
dataActity.value = props.twoROnly.date;
const twoRData = localStorage.getItem('twoRList');
const newData = JSON.parse(twoRData);
if (newData) {
if (props.twoROnly.type == 1) {
if (props.twoROnly.date == 1) {
normalNum.value = newData.weightLossCountDay;
abnormalNum.value = newData.weightLossAbnormalCountDay;
} else {
normalNum.value = newData.weightLossCountMonth;
abnormalNum.value = newData.weightLossCountMonth;
}
} else if (props.twoROnly.type == 2) {
if (props.twoROnly.date == 1) {
normalNum.value = newData.bloodSugarCountDay;
abnormalNum.value = newData.bloodSugarAbnormalCountDay;
} else {
normalNum.value = newData.bloodSugarCountMonth;
abnormalNum.value = newData.bloodSugarAbnormalCountMonth;
}
} else {
if (props.twoROnly.date == 1) {
normalNum.value = newData.bloodPressureCountDay;
abnormalNum.value = newData.bloodPressureAbnormalCountDay;
} else {
normalNum.value = newData.bloodPressureCountMonth;
abnormalNum.value = newData.bloodPressureAbnormalCountMonth;
}
}
}
}
function tableLoad(b: boolean) {
loading.value = b;
@@ -120,11 +193,28 @@
console.log(formRecord.value);
}
function handleClicksearch() {
console.log(formRecord.value);
formState.value = {
...formState.value,
...formRecord.value,
};
// registerTable.value.getRecords();
}
const { orgCode, option, fieldNames, setOrgCode } = useDepart();
const { visible, closeDialog, openDialog } = useDialog({ title: dialogTitle.value });
function handleClose() {
formRecord.value = {};
closeDialog();
}
function handleClickReset() {
getField();
formState.value = {
...formState.value,
...formRecord.value,
};
console.log(formState.value, formRecord.value);
}
defineExpose({
openDialog,
});
@@ -156,6 +246,7 @@
display: flex;
.ant-form-item {
flex: 1;
margin-bottom: 0 !important;
}
}
.form-btn {
@@ -170,7 +261,7 @@
}
}
.table-container {
margin: 0 10px;
margin: 10px 10px 0;
}
}
@@ -181,4 +272,33 @@
:deep(.ant-form-item-control) {
margin-right: 20px !important;
}
.top-bottom-center {
margin-top: 10px;
padding: 0 10px;
display: flex;
align-items: center;
.date-change {
> span {
display: inline-block;
cursor: pointer;
width: 80px;
text-align: center;
line-height: 30px;
background: #072246;
border: 1px solid #1684fc;
&:nth-child(1) {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
&:nth-child(2) {
border-left: none;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
}
.date-item {
background: #02ccfc;
}
}
}
</style>