设备统计

This commit is contained in:
曹磊 2025-07-07 16:23:32 +08:00
parent 1c3ff07cf9
commit 9b928f794f
3 changed files with 270 additions and 303 deletions

View File

@ -0,0 +1,155 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import {ref} from "vue";
//列表数据
export const tdcsColumns : BasicColumn[] =[
{
title: '序号',
dataIndex: 'rowNumber',
key: 'rowNumber',
align: 'center'
},
{
title: '小区名称',
dataIndex: 'housingestateName',
key: 'housingestateName',
align: 'center'
},
{
title: '设备地点',
dataIndex: 'content',
key: 'content',
align: 'center'
},
{
title: '投递次数',
dataIndex: 'value',
key: 'value',
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
width: '150px',
}
]
export const tdzlColumns : BasicColumn[] =[
{
title: '序号',
dataIndex: 'rowNumber',
key: 'rowNumber',
align: 'center'
},
{
title: '小区名称',
dataIndex: 'housingestateName',
key: 'housingestateName',
align: 'center'
},
{
title: '设备地点',
dataIndex: 'content',
key: 'content',
align: 'center'
},
{
title: '投递重量(公斤)',
dataIndex: 'value',
key: 'value',
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
width: '150px',
}
]
export const detailTdcsColumns : BasicColumn[] =[
{
title: '序号',
dataIndex: 'rowNumber',
key: 'rowNumber',
align: 'center'
},
{
title: '小区名称',
dataIndex: 'housingestateName',
key: 'housingestateName',
align: 'center'
},
{
title: '设备地点',
dataIndex: 'content',
key: 'content',
align: 'center'
},
{
title: '会员手机号',
dataIndex: 'phone',
key: 'phone',
align: 'center'
},
{
title: '投递时间',
dataIndex: 'addTime',
key: 'addTime',
align: 'center'
},
{
title: '重量',
dataIndex: 'weight',
key: 'weight',
align: 'center'
},
{
title: '金额',
dataIndex: 'money',
key: 'money',
align: 'center',
customRender: function ({ text, record, index}) {
return (record.money - record.deductMoney).toFixed(2)
}
},
// {
// title: '扣除金额',
// dataIndex: 'deductMoney',
// key: 'deductMoney',
// align: 'center'
// },
{
title: '订单状态',
dataIndex: 'invalid',
key: 'invalid',
align: 'center',
customRender: function ({ text }) {
if (text == '0') {
return '正常';
} else if (text == '1') {
return '违规';
} else if (text == '2') {
return '部分违规';
} else if (text == '3') {
return '待审核';
} else if (text == '4') {
return '异常';
} else if (text == '5') {
return '忽略';
}else{
return '';
}
},
},
{
title: '原因',
dataIndex: 'cause',
key: 'cause',
align: 'center'
},
]

View File

@ -19,20 +19,8 @@
<a-select-option :value="item.housingestateId" v-for="item in housingestates" :key="item.housingestateId">{{item.housingestateName }}</a-select-option>
</a-select>
</a-col>
<a-col :span="21" v-show="izList">
<a-form layout="inline" :model="parmas" :labelCol="{ style: { width: 'auto', paddingRight: '90px' } }"
:wrapperCol="{ style: { display: 'flex', alignItems: 'center' } }">
<a-form-item label="投递次数">
<a-input-number v-model:value="parmas.countMin" placeholder="最小次数" :min="0" />
<span class="ant-form-text" style="margin: 0 8px;"></span>
<a-input-number v-model:value="parmas.countMax" placeholder="最大次数" :min="0" />
</a-form-item>
</a-form>
<a-button type="link" @click="loadListDate">查询</a-button>
<a-button type="link" @click="resetListData">重置</a-button>
</a-col>
<a-col :span="3">
<a-radio-group v-model:value="izList" button-style="solid">
<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>
@ -43,25 +31,38 @@
:itemStyle="{ normal: { label: { show: true, position: 'top' } } }"
:axisLabel="{ rotate: 45}"
:seriesName="'投递次数'"></Bar>
<a-table v-show="izList" :dataSource="tableData" :columns="columns">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-button type="link" @click="handleView(record)">查看</a-button>
<div v-show="izList" style="margin-top: 20px;">
<a-table :dataSource="dataSource" :columns="tdcsColumns">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-button type="link" @click="handleView(record)">查看</a-button>
</template>
</template>
</template>
</a-table>
</a-table>
</div>
</a-card>
<!-- 查看详情弹窗 -->
<a-modal v-model:visible="detailVisible" title="会员投递详情" width="80%" :footer="null">
<a-table :dataSource="detailData" :columns="detailColumns" rowKey="phone">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link" @click="handleMark(record)">标记</a-button>
<a-button type="link" danger @click="handleBlock(record)">屏蔽</a-button>
</a-space>
</template>
</template>
<a-modal v-model:visible="detailVisible" title="投递次数详情" width="80%" :footer="null">
<a-row>
<a-col :span="20">
<div style="margin: 5px 0px 5px 20px">订单状态
<a-select ref="select"
placeholder="请选订单状态"
v-model:value="detailParmas.invalid"
style="width: 200px;margin-left: 5px;"
@change="loadDetailDate">
<a-select-option value="" >全部</a-select-option>
<a-select-option value="0">正常</a-select-option>
<a-select-option value="1">违规</a-select-option>
<a-select-option value="2">部分违规</a-select-option>
<a-select-option value="3">待审核</a-select-option>
<a-select-option value="4">异常</a-select-option>
<a-select-option value="5">忽略</a-select-option>
</a-select>
</div>
</a-col>
</a-row>
<a-table :dataSource="detailData" :columns="detailTdcsColumns" rowKey="rowNumber">
</a-table>
</a-modal>
</div>
@ -70,7 +71,8 @@
<script lang="ts" setup>
import { ref, unref, reactive, onMounted } from 'vue';
import Bar from '/@/components/chart/Bar.vue';
import { tdcsList, allTdcsList, housingestateList, queryHyjlList } from '../shebei.api';
import { tdcsList, housingestateList, queryHyjlList } from '../shebei.api';
import { tdcsColumns,detailTdcsColumns } from '../shebei.data';
import type { Dayjs } from 'dayjs';
const valueFormat = 'YYYY-MM-DD';
@ -78,94 +80,9 @@ const dataSource = ref([]);
const dateValue = ref();
const housingestates = ref();
const izList = ref(false)
const tableData = ref([])
const detailVisible = ref(false);
const detailData = ref([]);
const columns = ref([
{
title: '会员',
dataIndex: 'name',
key: 'name',
align: 'center'
},
{
title: '投递次数',
dataIndex: 'value',
key: 'value',
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
width: '150px',
}
])
const detailColumns = ref([
{
title: '会员手机号',
dataIndex: 'phone',
key: 'phone',
align: 'center'
},
{
title: '金额',
dataIndex: 'money',
key: 'money',
align: 'center'
},
{
title: '重量',
dataIndex: 'weight',
key: 'weight',
align: 'center'
},
{
title: '投递时间',
dataIndex: 'addTime',
key: 'addTime',
align: 'center'
},
{
title: '订单是否有效',
dataIndex: 'invalid',
key: 'invalid',
align: 'center'
},
{
title: '订单开始重量',
dataIndex: 'startWeight',
key: 'startWeight',
align: 'center'
},
{
title: '订单结束重量',
dataIndex: 'endWeight',
key: 'endWeight',
align: 'center'
},
{
title: '厂家更新时间',
dataIndex: 'updatedAt',
key: 'updatedAt',
align: 'center'
},
{
title: '扣除金额',
dataIndex: 'deductMoney',
key: 'deductMoney',
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
width: '200px',
}
]);
async function getHousingestates() {
housingestates.value = await housingestateList();
}
@ -174,8 +91,13 @@ const parmas = reactive<any>({
beginTime: '',
endTime: '',
type: '1',
countMin: null,
countMax: null,
housingestateId: '',
pageSize: 10,
})
const detailParmas = reactive<any>({
imei: '',
invalid: '',
})
function changeType() {
@ -209,7 +131,13 @@ function handleHousinges() {
};
async function loadDate() {
const res = await tdcsList(parmas);
if(izList.value){
parmas.pageSize=-1
}else{
parmas.pageSize=10
}
const resData = await tdcsList(parmas);
const res = resData.records;
dataSource.value = [];
for (let i = 0; i < res.length; i++) {
let name = res[i].imei;
@ -217,40 +145,33 @@ async function loadDate() {
name = res[i].housingestateName+'-'+res[i].content;
}
dataSource.value.push({
rowNumber: res[i].rowNumber,
housingestateName: `${res[i].housingestateName}`,
content: `${res[i].content}`,
imei: `${res[i].imei}`,
name: `${name}`,
value: res[i].cn,
});
}
}
async function loadListDate() {
const res = await allTdcsList(parmas);
tableData.value = [];
for (let i = 0; i < res.length; i++) {
tableData.value.push({
name: `${res[i].imei}`,
value: res[i].cn,
});
}
}
//
function resetListData() {
parmas.countMin = null
parmas.countMax = null
loadListDate()
//
const handleView = async (record) => {
detailParmas.imei = record.imei;
loadDetailDate();
}
//
const handleView = async (record) => {
async function loadDetailDate(){
try {
const res = await queryHyjlList({ phone: record.name });
detailData.value = [];
const res = await queryHyjlList({ beginTime:parmas.beginTime,endTime:parmas.endTime,imei:detailParmas.imei,invalid:detailParmas.invalid });
detailData.value = res;
detailVisible.value = true;
} catch (error) {
console.error('获取详情失败:', error);
}
};
}
function getPreviousDate(days) {
const date = new Date();
@ -262,27 +183,12 @@ function getPreviousDate(days) {
return formattedDate;
}
//
const handleMark = (record) => {
console.log('标记记录:', record);
// API
// : markRecord(record.phone);
};
const handleBlock = (record) => {
console.log('屏蔽记录:', record);
// API
// : blockRecord(record.phone);
};
onMounted(() => {
if (parmas.type == '1') {
parmas.beginTime = getPreviousDate(0) + ' 00:00:00';
parmas.endTime = getPreviousDate(0) + ' 23:59:59';
}
loadDate();
loadListDate();
getHousingestates();
})

View File

@ -19,20 +19,8 @@
<a-select-option :value="item.housingestateId" v-for="item in housingestates" :key="item.housingestateId">{{item.housingestateName }}</a-select-option>
</a-select>
</a-col>
<a-col :span="21" v-show="izList">
<a-form layout="inline" :model="parmas" :labelCol="{ style: { width: 'auto', paddingRight: '90px' } }"
:wrapperCol="{ style: { display: 'flex', alignItems: 'center' } }">
<a-form-item label="投递重量">
<a-input-number v-model:value="parmas.countMin" placeholder="最小次数" :min="0" />
<span class="ant-form-text" style="margin: 0 8px;"></span>
<a-input-number v-model:value="parmas.countMax" placeholder="最大次数" :min="0" />
</a-form-item>
</a-form>
<a-button type="link" @click="loadListDate">查询</a-button>
<a-button type="link" @click="resetListData">重置</a-button>
</a-col>
<a-col :span="3">
<a-radio-group v-model:value="izList" button-style="solid">
<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>
@ -43,25 +31,38 @@
:itemStyle="{ normal: { label: { show: true, position: 'top' } } }"
:axisLabel="{ rotate: 45}"
:seriesName="'投递重量'"></Bar>
<a-table v-show="izList" :dataSource="tableData" :columns="columns">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-button type="link" @click="handleView(record)">查看</a-button>
<div v-show="izList" style="margin-top: 20px;">
<a-table :dataSource="dataSource" :columns="tdzlColumns">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-button type="link" @click="handleView(record)">查看</a-button>
</template>
</template>
</template>
</a-table>
</a-table>
</div>
</a-card>
<!-- 查看详情弹窗 -->
<a-modal v-model:visible="detailVisible" title="会员投递详情" width="80%" :footer="null">
<a-table :dataSource="detailData" :columns="detailColumns" rowKey="phone">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<a-space>
<a-button type="link" @click="handleMark(record)">标记</a-button>
<a-button type="link" danger @click="handleBlock(record)">屏蔽</a-button>
</a-space>
</template>
</template>
<a-row>
<a-col :span="20">
<div style="margin: 5px 0px 5px 20px">订单状态
<a-select ref="select"
placeholder="请选订单状态"
v-model:value="detailParmas.invalid"
style="width: 200px;margin-left: 5px;"
@change="loadDetailDate">
<a-select-option value="" >全部</a-select-option>
<a-select-option value="0">正常</a-select-option>
<a-select-option value="1">违规</a-select-option>
<a-select-option value="2">部分违规</a-select-option>
<a-select-option value="3">待审核</a-select-option>
<a-select-option value="4">异常</a-select-option>
<a-select-option value="5">忽略</a-select-option>
</a-select>
</div>
</a-col>
</a-row>
<a-table :dataSource="detailData" :columns="detailTdcsColumns" rowKey="rowNumber">
</a-table>
</a-modal>
</div>
@ -70,101 +71,17 @@
<script lang="ts" setup>
import { ref, unref, reactive, onMounted } from 'vue';
import Bar from '/@/components/chart/Bar.vue';
import { tdzlList, allTdcsList, housingestateList, queryHyjlList } from '../shebei.api';
import { tdzlList, housingestateList, queryHyjlList } from '../shebei.api';
import { tdzlColumns,detailTdcsColumns } from '../shebei.data';
const valueFormat = 'YYYY-MM-DD';
const dataSource = ref([]);
const dateValue = ref();
const housingestates = ref();
const izList = ref(false)
const tableData = ref([])
const detailVisible = ref(false);
const detailData = ref([]);
const columns = ref([
{
title: '会员',
dataIndex: 'name',
key: 'name',
align: 'center'
},
{
title: '投递次数',
dataIndex: 'value',
key: 'value',
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
width: '150px',
}
])
const detailColumns = ref([
{
title: '会员手机号',
dataIndex: 'phone',
key: 'phone',
align: 'center'
},
{
title: '金额',
dataIndex: 'money',
key: 'money',
align: 'center'
},
{
title: '重量',
dataIndex: 'weight',
key: 'weight',
align: 'center'
},
{
title: '投递时间',
dataIndex: 'addTime',
key: 'addTime',
align: 'center'
},
{
title: '订单是否有效',
dataIndex: 'invalid',
key: 'invalid',
align: 'center'
},
{
title: '订单开始重量',
dataIndex: 'startWeight',
key: 'startWeight',
align: 'center'
},
{
title: '订单结束重量',
dataIndex: 'endWeight',
key: 'endWeight',
align: 'center'
},
{
title: '厂家更新时间',
dataIndex: 'updatedAt',
key: 'updatedAt',
align: 'center'
},
{
title: '扣除金额',
dataIndex: 'deductMoney',
key: 'deductMoney',
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
width: '200px',
}
]);
async function getHousingestates() {
housingestates.value = await housingestateList();
}
@ -173,8 +90,13 @@ const parmas = reactive<any>({
beginTime: '',
endTime: '',
type: '1',
countMin: null,
countMax: null,
housingestateId: '',
pageSize: 10,
})
const detailParmas = reactive<any>({
imei: '',
invalid: '',
})
function changeType() {
@ -208,7 +130,13 @@ function handleHousinges() {
};
async function loadDate() {
const res = await tdzlList(parmas);
if(izList.value){
parmas.pageSize=-1
}else{
parmas.pageSize=10
}
const resData = await tdzlList(parmas);
const res = resData.records;
dataSource.value = [];
for (let i = 0; i < res.length; i++) {
let name = res[i].imei;
@ -216,40 +144,33 @@ async function loadDate() {
name = res[i].housingestateName+'-'+res[i].content;
}
dataSource.value.push({
rowNumber: res[i].rowNumber,
housingestateName: `${res[i].housingestateName}`,
content: `${res[i].content}`,
imei: `${res[i].imei}`,
name: `${name}`,
value: res[i].weight,
});
}
}
async function loadListDate() {
const res = await allTdcsList(parmas);
tableData.value = [];
for (let i = 0; i < res.length; i++) {
tableData.value.push({
name: `${res[i].imei}`,
value: res[i].cn,
});
}
}
//
function resetListData() {
parmas.countMin = null
parmas.countMax = null
loadListDate()
//
const handleView = async (record) => {
detailParmas.imei = record.imei;
loadDetailDate();
}
//
const handleView = async (record) => {
async function loadDetailDate(){
try {
const res = await queryHyjlList({ phone: record.name });
detailData.value = [];
const res = await queryHyjlList({ beginTime:parmas.beginTime,endTime:parmas.endTime,imei:detailParmas.imei,invalid:detailParmas.invalid });
detailData.value = res;
detailVisible.value = true;
} catch (error) {
console.error('获取详情失败:', error);
}
};
}
function getPreviousDate(days) {
const date = new Date();
@ -261,27 +182,12 @@ function getPreviousDate(days) {
return formattedDate;
}
//
const handleMark = (record) => {
console.log('标记记录:', record);
// API
// : markRecord(record.phone);
};
const handleBlock = (record) => {
console.log('屏蔽记录:', record);
// API
// : blockRecord(record.phone);
};
onMounted(() => {
if (parmas.type == '1') {
parmas.beginTime = getPreviousDate(0) + ' 00:00:00';
parmas.endTime = getPreviousDate(0) + ' 23:59:59';
}
loadDate();
loadListDate();
getHousingestates();
})