设备统计

This commit is contained in:
曹磊 2025-07-03 16:13:18 +08:00
parent 7b1590458b
commit bcaa572e87
8 changed files with 93 additions and 240 deletions

View File

@ -37,6 +37,19 @@
type: String, type: String,
default: '#1890ff', default: '#1890ff',
}, },
axisLabel: {
type: Object,
default: () => ({ rotate: 0}),
},
grid: {
type: Object,
default: () => ({
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
}),
},
// update-end--author:liaozhiyang---date:20240407---forQQYUN-8762echars // update-end--author:liaozhiyang---date:20240407---forQQYUN-8762echars
}, },
setup(props) { setup(props) {
@ -53,9 +66,11 @@
}, },
}, },
}, },
grid: props.grid,
xAxis: { xAxis: {
type: 'category', type: 'category',
data: [], data: [],
axisLabel: props.axisLabel,
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',

View File

@ -272,13 +272,13 @@ const handleBlock = (record) => {
onMounted(() => { onMounted(() => {
getHousingestates();
if (parmas.type == '1') { if (parmas.type == '1') {
parmas.beginTime = getPreviousDate(0) + ' 00:00:00'; parmas.beginTime = getPreviousDate(0) + ' 00:00:00';
parmas.endTime = getPreviousDate(0) + ' 23:59:59'; parmas.endTime = getPreviousDate(0) + ' 23:59:59';
} }
loadDate(); loadDate();
loadListDate(); loadListDate();
getHousingestates();
}) })
</script> </script>

View File

@ -95,12 +95,12 @@
} }
onMounted(() => { onMounted(() => {
getHousingestates();
if(parmas.type=='1'){ if(parmas.type=='1'){
parmas.beginTime=getPreviousDate(2)+' 00:00:00'; parmas.beginTime=getPreviousDate(2)+' 00:00:00';
parmas.endTime=getPreviousDate(0)+' 23:59:59'; parmas.endTime=getPreviousDate(0)+' 23:59:59';
} }
loadDate(); loadDate();
getHousingestates();
}) })
</script> </script>

View File

@ -74,11 +74,11 @@
} }
onMounted(() => { onMounted(() => {
getHousingestates();
if(parmas.dateString==''){ if(parmas.dateString==''){
parmas.dateString=getCurrent(); parmas.dateString=getCurrent();
} }
loadDate(); loadDate();
getHousingestates();
}) })
</script> </script>

View File

@ -16,8 +16,7 @@
<a-select ref="select" placeholder="请选区域" v-model:value="parmas.housingestateId" <a-select ref="select" placeholder="请选区域" v-model:value="parmas.housingestateId"
style="width: 200px;margin-left: 5px;" @change="handleHousinges"> style="width: 200px;margin-left: 5px;" @change="handleHousinges">
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option :value="item.housingestateId" v-for="item in housingestates" :key="item.housingestateId">{{ <a-select-option :value="item.housingestateId" v-for="item in housingestates" :key="item.housingestateId">{{item.housingestateName }}</a-select-option>
item.housingestateName }}</a-select-option>
</a-select> </a-select>
</a-col> </a-col>
<a-col :span="21" v-show="izList"> <a-col :span="21" v-show="izList">
@ -41,7 +40,9 @@
</a-row> </a-row>
<Bar v-show="!izList" :chartData="dataSource" height="80vh" <Bar v-show="!izList" :chartData="dataSource" height="80vh"
:option="{ title: { text: '设备投递次数排行榜', left: 'center' } }" :option="{ title: { text: '设备投递次数排行榜', left: 'center' } }"
:itemStyle="{ normal: { label: { show: true, position: 'top' } } }" :seriesName="'投递次数'"></Bar> :itemStyle="{ normal: { label: { show: true, position: 'top' } } }"
:axisLabel="{ rotate: 45}"
:seriesName="'次数'"></Bar>
<a-table v-show="izList" :dataSource="tableData" :columns="columns"> <a-table v-show="izList" :dataSource="tableData" :columns="columns">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
@ -211,8 +212,12 @@ async function loadDate() {
const res = await tdcsList(parmas); const res = await tdcsList(parmas);
dataSource.value = []; dataSource.value = [];
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
let name = res[i].imei;
if(res[i].housingestateName!=null&&res[i].content!=null){
name = res[i].housingestateName+'-'+res[i].content;
}
dataSource.value.push({ dataSource.value.push({
name: `${res[i].imei}`, name: `${name}`,
value: res[i].cn, value: res[i].cn,
}); });
} }
@ -272,13 +277,13 @@ const handleBlock = (record) => {
onMounted(() => { onMounted(() => {
getHousingestates();
if (parmas.type == '1') { if (parmas.type == '1') {
parmas.beginTime = getPreviousDate(0) + ' 00:00:00'; parmas.beginTime = getPreviousDate(0) + ' 00:00:00';
parmas.endTime = getPreviousDate(0) + ' 23:59:59'; parmas.endTime = getPreviousDate(0) + ' 23:59:59';
} }
loadDate(); loadDate();
loadListDate(); loadListDate();
getHousingestates();
}) })
</script> </script>

View File

@ -1,66 +1,17 @@
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api { enum Api {
list = '/deviceinfo/deviceInfo/list', list = '/zh/shebei/list',
save='/deviceinfo/deviceInfo/add', save='/zh/shebei/add',
edit='/deviceinfo/deviceInfo/edit', edit='/zh/shebei/edit',
deleteOne = '/deviceinfo/deviceInfo/delete',
deleteBatch = '/deviceinfo/deviceInfo/deleteBatch',
importExcel = '/deviceinfo/deviceInfo/importExcel',
exportXls = '/deviceinfo/deviceInfo/exportXls',
} }
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/** /**
* *
* @param params * @param params
*/ */
export const list = (params) => defHttp.get({ url: Api.list, params }); export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/** /**
* *
* @param params * @param params

View File

@ -1,8 +1,5 @@
import { BasicColumn } from '/@/components/Table'; 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';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
@ -10,25 +7,7 @@ export const columns: BasicColumn[] = [
align: 'center', align: 'center',
dataIndex: 'imei', dataIndex: 'imei',
}, },
{
title: 'ICCID',
align: 'center',
dataIndex: 'iccid',
},
{
title: '是否在线',
align: 'center',
dataIndex: 'isOnline',
format(text, record, index) {
console.log("🌊 ~ format ~ text:", text)
if (text == 'true') {
return '在线';
} else {
return '离线';
}
},
},
{ {
title: '区域名称', title: '区域名称',
align: 'center', align: 'center',
@ -44,32 +23,43 @@ export const columns: BasicColumn[] = [
align: 'center', align: 'center',
dataIndex: 'boxNum', dataIndex: 'boxNum',
}, },
{
title: '注册会员数',
align: "center",
dataIndex: 'hyCount'
},
{
title: '投递次数',
align: "center",
dataIndex: 'tdcsCount'
},
{
title: 'ICCID',
align: 'center',
dataIndex: 'iccid',
},
{
title: '是否在线',
align: 'center',
dataIndex: 'isOnline',
format(text) {
if (text == 'true') {
return '在线';
} else {
return '离线';
}
},
},
{ {
title: '是否在仓库中', title: '是否在仓库中',
align: 'center', align: 'center',
dataIndex: 'inWarehouse', dataIndex: 'inWarehouse',
format(text, record, index) { format(text, record, index) {
if (text == 0) { if (text == '0') {
return '0待翻译'; return '离仓';
} else { } else {
return '1待翻译'; return '在仓';
} }
}, },
}, },
// {
// title: '区域ID',
// align: 'center',
// dataIndex: 'housingestateId',
// },
]; ];
// 高级查询数据
export const superQuerySchema = {
imei: { title: '设备编码', order: 0, view: 'text', type: 'string' },
iccid: { title: 'ICCID', order: 1, view: 'text', type: 'string' },
isOnline: { title: '是否在线', order: 2, view: 'text', type: 'string' },
content: { title: '设备点位', order: 3, view: 'text', type: 'string' },
boxNum: { title: '桶数量', order: 4, view: 'text', type: 'string' },
inWarehouse: { title: '是否在仓库中', order: 5, view: 'text', type: 'string' },
housingestateId: { title: '区域ID', order: 6, view: 'text', type: 'string' },
};

View File

@ -5,43 +5,47 @@
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol"> :wrapper-col="wrapperCol">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :lg="6"> <a-col :span="6">
<a-form-item name="imei"> <a-form-item name="imei">
<template #label><span title="设备编码">设备编码</span></template> <template #label><span title="设备编码">设备编码</span></template>
<a-input placeholder="请输入设备编码" v-model:value="queryParam.imei" allow-clear></a-input> <a-input placeholder="请输入设备编码" v-model:value="queryParam.imei" allow-clear></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <!-- <a-col :lg="6">
<a-form-item name="iccid"> <a-form-item name="iccid">
<template #label><span title="ICCID">ICCI</span></template> <template #label><span title="ICCID">ICCI</span></template>
<a-input placeholder="请输入ICCID" v-model:value="queryParam.iccid" allow-clear></a-input> <a-input placeholder="请输入ICCID" v-model:value="queryParam.iccid" allow-clear></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>-->
<a-col :lg="6"> <a-col :span="4">
<a-form-item name="isOnline"> <a-form-item name="isOnline">
<template #label><span title="是否在线">是否在线</span></template> <template #label><span title="是否在线">在线</span></template>
<a-select ref="select" v-model:value="queryParam.isOnline" style="width: 120px" placeholder="请选择是否在线"> <a-select ref="select" v-model:value="queryParam.isOnline" style="width: 120px" placeholder="请选择是否在线">
<a-select-option :value="true">在线</a-select-option> <a-select-option :value="true">在线</a-select-option>
<a-select-option :value="false">离线</a-select-option> <a-select-option :value="false">离线</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <a-col :span="4">
<a-form-item name="inWarehouse"> <a-form-item name="inWarehouse">
<template #label><span title="是否在仓库中">是否在仓</span></template> <template #label><span title="是否在仓库中">在仓</span></template>
<a-select ref="select" v-model:value="queryParam.inWarehouse" style="width: 120px" placeholder="请选择是否在仓库中"> <a-select ref="select" v-model:value="queryParam.inWarehouse" style="width: 120px" placeholder="请选择是否在仓库中">
<a-select-option :value="0">0待翻译</a-select-option> <a-select-option :value="0">离仓</a-select-option>
<a-select-option :value="1">1待翻译</a-select-option> <a-select-option :value="1">在仓</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <a-col :span="6">
<a-form-item name="housingestateId"> <a-form-item name="housingestateId">
<template #label><span title="区域名称">区域名称</span></template> <template #label><span title="区域名称">区域名称</span></template>
<a-input placeholder="请输入区域名称" v-model:value="queryParam.housingestateName" allow-clear></a-input> <a-select ref="select" placeholder="请选区域" v-model:value="queryParam.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-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :span="4">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons"> <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6"> <a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button> <a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
@ -71,20 +75,20 @@
</template> </template>
<script lang="ts" name="deviceinfo-deviceInfo" setup> <script lang="ts" name="deviceinfo-deviceInfo" setup>
import { ref, reactive } from 'vue'; import {ref, reactive, onMounted} from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './DeviceInfo.data'; import { columns } from './DeviceInfo.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './DeviceInfo.api'; import { list } from './DeviceInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import DeviceInfoModal from './components/DeviceInfoModal.vue' import DeviceInfoModal from './components/DeviceInfoModal.vue'
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import { cloneDeep } from "lodash-es"; import {housingestateList} from "@/views/zh/hy/hy.api";
const formRef = ref(); const formRef = ref();
const queryParam = reactive<any>({}); const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false); const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref(); const registerModal = ref();
const housingestates = ref();
const userStore = useUserStore(); const userStore = useUserStore();
//table //table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
@ -95,24 +99,15 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
canResize: false, canResize: false,
useSearchForm: false, useSearchForm: false,
showActionColumn: false, showActionColumn: false,
showIndexColumn: true,
actionColumn: { actionColumn: {
width: 120, width: 120,
fixed: 'right', fixed: 'right',
}, },
beforeFetch: async (params) => { beforeFetch: async (params) => {
let rangerQuery = await setRangeQuery(); return Object.assign(params, queryParam);
return Object.assign(params, rangerQuery);
}, },
}, },
exportConfig: {
name: "设备信息",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
}); });
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({ const labelCol = reactive({
@ -126,57 +121,6 @@ const wrapperCol = reactive({
sm: 20, sm: 20,
}); });
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/** /**
* 成功回调 * 成功回调
*/ */
@ -184,39 +128,6 @@ function handleSuccess() {
(selectedRowKeys.value = []) && reload(); (selectedRowKeys.value = []) && reload();
} }
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'deviceinfo:bl_device_info:edit'
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'deviceinfo:bl_device_info:delete'
}
]
}
/** /**
* 查询 * 查询
*/ */
@ -234,33 +145,14 @@ function searchReset() {
reload(); reload();
} }
async function getHousingestates() {
housingestates.value = await housingestateList();
let rangeField = ''
/**
* 设置范围查询条件
*/
async function setRangeQuery() {
let queryParamClone = cloneDeep(queryParam);
if (rangeField) {
let fieldsValue = rangeField.split(',');
fieldsValue.forEach(item => {
if (queryParamClone[item]) {
let range = queryParamClone[item];
queryParamClone[item + '_begin'] = range[0];
queryParamClone[item + '_end'] = range[1];
delete queryParamClone[item];
} else {
queryParamClone[item + '_begin'] = '';
queryParamClone[item + '_end'] = '';
}
})
}
return queryParamClone;
} }
onMounted(() => {
getHousingestates();
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>