2025-07-02 19:30:00 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="p-4">
|
|
|
|
|
<a-card :bordered="false" style="height: 100%">
|
|
|
|
|
<a-row>
|
|
|
|
|
<a-col :span="20">
|
|
|
|
|
<a-radio-group v-model:value="parmas.type" @change="changeType">
|
|
|
|
|
<a-radio-button value="0">当天</a-radio-button>
|
|
|
|
|
<a-radio-button value="1">近3天</a-radio-button>
|
|
|
|
|
<a-radio-button value="2">近7天</a-radio-button>
|
|
|
|
|
<a-radio-button value="3">近30天</a-radio-button>
|
|
|
|
|
<a-radio-button value="4">自定义</a-radio-button>
|
|
|
|
|
</a-radio-group>
|
|
|
|
|
<span v-show="parmas.type=='4'" style="margin-left: 5px;">
|
|
|
|
|
<a-range-picker :value-format="valueFormat" @change="changeDate" />
|
|
|
|
|
</span>
|
|
|
|
|
<!-- <a-select ref="select"
|
|
|
|
|
placeholder="请选区域"
|
|
|
|
|
v-model:value="parmas.housingestateId"
|
|
|
|
|
style="width: 200px;margin-left: 5px;"
|
|
|
|
|
@change="handleHousinges">
|
|
|
|
|
<a-select-option value="" >全部</a-select-option>
|
|
|
|
|
<a-select-option :value="item.housingestateId" v-for="item in housingestates" :key="item.housingestateId">{{item.housingestateName}}</a-select-option>
|
|
|
|
|
</a-select> -->
|
|
|
|
|
</a-col>
|
2025-07-03 15:33:55 +08:00
|
|
|
|
<a-col :span="3">
|
|
|
|
|
<a-radio-group v-model:value="izList" button-style="solid" @change="loadDate">
|
|
|
|
|
<a-radio-button :value="false">统计图</a-radio-button>
|
|
|
|
|
<a-radio-button :value="true">列表页</a-radio-button>
|
|
|
|
|
</a-radio-group>
|
|
|
|
|
</a-col>
|
2025-07-02 19:30:00 +08:00
|
|
|
|
</a-row>
|
2025-07-14 10:46:29 +08:00
|
|
|
|
<Bar v-show="!izList" :chartData="dataSource" height="75vh" :option="{ title: { text: '小区新增会员统计', left: 'center' }}" :itemStyle="{ normal: {label : {show: true, position: 'top'}}}" :seriesName="'新增会员'"></Bar>
|
2025-07-03 15:33:55 +08:00
|
|
|
|
<div v-show="izList" style="margin-top: 20px;">
|
2025-07-04 15:44:54 +08:00
|
|
|
|
<a-table :dataSource="dataSource" :columns="xzrsColumns">
|
2025-07-03 15:33:55 +08:00
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
|
<template v-if="column.key === 'action'">
|
|
|
|
|
<a-button type="link" @click="handleView(record)">查看</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</a-table>
|
|
|
|
|
</div>
|
2025-07-02 19:30:00 +08:00
|
|
|
|
</a-card>
|
2025-07-03 19:36:12 +08:00
|
|
|
|
<!-- 查看详情弹窗 -->
|
|
|
|
|
<a-modal v-model:visible="detailVisible" title="新增会员详情" width="80%" :footer="null">
|
2025-07-11 16:12:13 +08:00
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
|
|
<a-table :dataSource="detailData" :columns="detailXzhyColumns" rowKey="rowNumber">
|
|
|
|
|
</a-table>
|
|
|
|
|
</a-spin>
|
2025-07-03 19:36:12 +08:00
|
|
|
|
</a-modal>
|
2025-07-02 19:30:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import {ref, unref, reactive, onMounted} from 'vue';
|
|
|
|
|
import Bar from '/@/components/chart/Bar.vue';
|
2025-07-03 19:36:12 +08:00
|
|
|
|
import { queryXqHyXzList,housingestateList,queryXzhyDetailList } from './HousingestateInfo.api';
|
2025-07-02 19:30:00 +08:00
|
|
|
|
import type { Dayjs } from 'dayjs';
|
2025-07-03 19:36:12 +08:00
|
|
|
|
import { xzrsColumns, detailXzhyColumns } from './HousingestateInfo.data';
|
2025-07-02 19:30:00 +08:00
|
|
|
|
const valueFormat = 'YYYY-MM-DD';
|
|
|
|
|
const dataSource = ref([]);
|
|
|
|
|
const dateValue = ref();
|
|
|
|
|
const housingestates = ref();
|
2025-07-04 15:44:54 +08:00
|
|
|
|
const izList = ref(false)
|
|
|
|
|
const detailVisible = ref(false);
|
2025-07-11 16:12:13 +08:00
|
|
|
|
const confirmLoading = ref(false);
|
2025-07-04 15:44:54 +08:00
|
|
|
|
const detailData = ref([]);
|
|
|
|
|
|
2025-07-02 19:30:00 +08:00
|
|
|
|
const parmas = reactive<any>({
|
|
|
|
|
beginTime: '',
|
|
|
|
|
endTime: '',
|
|
|
|
|
type: '0',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function getHousingestates(){
|
|
|
|
|
housingestates.value = await housingestateList(null);
|
|
|
|
|
}
|
|
|
|
|
function changeType (){
|
|
|
|
|
parmas.endTime=getPreviousDate(0)+' 23:59:59';
|
|
|
|
|
if (parmas.type === '0') {
|
|
|
|
|
parmas.beginTime=getPreviousDate(0)+' 00:00:00';
|
|
|
|
|
loadDate();
|
|
|
|
|
}
|
|
|
|
|
if (parmas.type === '1') {
|
|
|
|
|
parmas.beginTime=getPreviousDate(2)+' 00:00:00';
|
|
|
|
|
loadDate();
|
|
|
|
|
}
|
|
|
|
|
if (parmas.type === '2') {
|
|
|
|
|
parmas.beginTime=getPreviousDate(6)+' 00:00:00';
|
|
|
|
|
loadDate();
|
|
|
|
|
}
|
|
|
|
|
if (parmas.type === '3') {
|
|
|
|
|
parmas.beginTime=getPreviousDate(29)+' 00:00:00';
|
|
|
|
|
loadDate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const changeDate = (date, dateString) => {
|
|
|
|
|
parmas.beginTime=dateString[0]+' 00:00:00';
|
|
|
|
|
parmas.endTime=dateString[1]+' 23:59:59';
|
|
|
|
|
loadDate();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function handleHousinges(){
|
|
|
|
|
loadDate();
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-03 19:36:12 +08:00
|
|
|
|
|
|
|
|
|
// 查看详情
|
|
|
|
|
const handleView = async (record) => {
|
2025-07-11 16:12:13 +08:00
|
|
|
|
detailVisible.value = true;
|
2025-07-03 19:36:12 +08:00
|
|
|
|
try {
|
2025-07-11 16:12:13 +08:00
|
|
|
|
confirmLoading.value = true;
|
2025-07-04 15:44:54 +08:00
|
|
|
|
detailData.value = [];
|
2025-07-03 19:36:12 +08:00
|
|
|
|
const res = await queryXzhyDetailList({ housingestateId: record.housingestateId,beginTime:parmas.beginTime,endTime:parmas.endTime,pageSize: -1 });
|
|
|
|
|
detailData.value = res.records;
|
2025-07-11 16:12:13 +08:00
|
|
|
|
confirmLoading.value = false;
|
2025-07-03 19:36:12 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取详情失败:', error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-02 19:30:00 +08:00
|
|
|
|
async function loadDate() {
|
2025-07-03 15:33:55 +08:00
|
|
|
|
if(izList.value){
|
|
|
|
|
parmas.pageSize=-1
|
|
|
|
|
}else{
|
|
|
|
|
parmas.pageSize=10
|
|
|
|
|
}
|
|
|
|
|
const resData = await queryXqHyXzList(parmas);
|
|
|
|
|
const res = resData.records;
|
2025-07-02 19:30:00 +08:00
|
|
|
|
dataSource.value = [];
|
|
|
|
|
for (let i = 0; i < res.length; i++) {
|
|
|
|
|
dataSource.value.push({
|
2025-07-04 15:44:54 +08:00
|
|
|
|
rowNumber: res[i].rowNumber,
|
2025-07-03 15:21:42 +08:00
|
|
|
|
name: `${res[i].housingestateName}`,
|
2025-07-02 19:30:00 +08:00
|
|
|
|
value: res[i].cn,
|
2025-07-03 19:36:12 +08:00
|
|
|
|
housingestateId: res[i].housingestateId,
|
2025-07-02 19:30:00 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPreviousDate(days){
|
|
|
|
|
const date = new Date();
|
|
|
|
|
date.setDate(date.getDate() - days);
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份+1(0-indexed)并补零
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0'); // 日期补零
|
|
|
|
|
const formattedDate = `${year}-${month}-${day}`;
|
|
|
|
|
return formattedDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
// getHousingestates();
|
|
|
|
|
if(parmas.type=='0'){
|
2025-07-03 15:21:42 +08:00
|
|
|
|
parmas.beginTime=getPreviousDate(0)+' 00:00:00';
|
2025-07-02 19:30:00 +08:00
|
|
|
|
parmas.endTime=getPreviousDate(0)+' 23:59:59';
|
2025-07-03 15:33:55 +08:00
|
|
|
|
parmas.pageSize=10
|
2025-07-02 19:30:00 +08:00
|
|
|
|
}
|
|
|
|
|
loadDate();
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
</script>
|