修改电表报表抄表记录
This commit is contained in:
parent
2b653ea3ed
commit
24f2ec9ead
102
childPackage/pages/electricQuery/components/reading/index.js
Normal file
102
childPackage/pages/electricQuery/components/reading/index.js
Normal file
|
@ -0,0 +1,102 @@
|
|||
// childPackage/pages/electricQuery/components/reading/index.js
|
||||
import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../../../service/accounting";
|
||||
import { getTenementMeterList } from "../../../../../service/meter";
|
||||
import dayjs from "../../../../../utils/dayjs";
|
||||
import request from '../../../../../utils/request';
|
||||
import { alertInfo, getPixelRatio, loadingFunc } from "../../../../../utils/index";
|
||||
const { OK } = request;
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
meter: String,
|
||||
},
|
||||
observers: {
|
||||
'meter': function() {
|
||||
loadingFunc(async () => {
|
||||
await this.getReadingList();
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
readingDetailShow: false,
|
||||
readingDetail: {},
|
||||
meterReadingHeader: [
|
||||
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '倍率', key: 'ratio' },
|
||||
{ key: 'number', title: '抄表记录' },
|
||||
],
|
||||
meterReadingList: [],
|
||||
yearMonthDayReading: dayjs().format("YYYY-MM-DD"),
|
||||
yearMonthDayReadingStamp: new Date().getTime(),
|
||||
readingPage: 1,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
clickReadingTime() {
|
||||
this.setData({
|
||||
readingVisible: true
|
||||
})
|
||||
},
|
||||
async getReadingList() {
|
||||
const { meter, yearMonthDayReading, readingPage } = this.data;
|
||||
const { code, message, data, total } = await getMeterReadingList({
|
||||
id: meter,
|
||||
time: yearMonthDayReading,
|
||||
page: readingPage
|
||||
})
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ meterReadingList: data, totalPage: Math.ceil(total / 20) })
|
||||
},
|
||||
onReadingTimeClose() {
|
||||
this.setData({ readingVisible: false })
|
||||
},
|
||||
onReadingTimeCancel() {
|
||||
this.setData({ readingVisible: false })
|
||||
},
|
||||
onReadingTimeConfirm(e) {
|
||||
const { time } = e.detail;
|
||||
|
||||
this.setData({
|
||||
yearMonthDayReading: time,
|
||||
yearMonthDayReadingStamp: new Date(time).getTime(),
|
||||
readingVisible: false,
|
||||
readingPage: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await this.getReadingList();
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
showDetail(e) {
|
||||
const { index, data = {} } = e.detail;
|
||||
this.setData({
|
||||
readingDetailShow: true,
|
||||
readingDetail: data || {}
|
||||
})
|
||||
},
|
||||
async onChangePage(e) {
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
readingPage: page
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.getReadingList();
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"custom-picker": "/components/picker/index",
|
||||
"table": "/components/table/table",
|
||||
"empty": "/components/empty/index",
|
||||
"timePicker": "/components/timePicker/index",
|
||||
"pagination": "/components/pagination/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-icon": "@vant/weapp/icon/index"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<!--childPackage/pages/electricQuery/components/reading/index.wxml-->
|
||||
<view style="margin-left: 30rpx;">
|
||||
<view class="timeChooseWrapper">
|
||||
<view> 选择时间 </view>
|
||||
<view class="time" bind:tap="clickReadingTime">
|
||||
<view class="timeText"> {{yearMonthDayReading}} </view>
|
||||
<van-icon name="arrow-down" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="margin: 30rpx;">
|
||||
<view wx:if="{{meterReadingList.length}}">
|
||||
<table
|
||||
header="{{meterReadingHeader}}"
|
||||
list="{{meterReadingList}}"
|
||||
bind:onClick="showDetail"
|
||||
/>
|
||||
<pagination
|
||||
currentIndex="{{readingPage}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<empty bind:refresh="getReadingList" wx:else />
|
||||
</view>
|
||||
|
||||
<timePicker
|
||||
type="day"
|
||||
day="{{yearMonthDayReadingStamp}}"
|
||||
show="{{readingVisible}}"
|
||||
bind:cancel="onReadingTimeCancel"
|
||||
bind:close="onReadingTimeClose"
|
||||
bind:confirm="onReadingTimeConfirm"
|
||||
/>
|
||||
|
||||
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="抄表记录详情"
|
||||
show="{{ readingDetailShow }}"
|
||||
bind:close="onClose"
|
||||
>
|
||||
<view style="margin-top: 10px;">
|
||||
<van-cell-group>
|
||||
<van-field
|
||||
value="{{ readingDetail.meter.address }}"
|
||||
border="{{ false }}"
|
||||
label="地址"
|
||||
readonly
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.readAt }}"
|
||||
border="{{ false }}"
|
||||
label="时间"
|
||||
readonly
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.ratio }}"
|
||||
border="{{ false }}"
|
||||
label="倍率"
|
||||
readonly
|
||||
/>
|
||||
<van-field
|
||||
value="{{ readingDetail.number }}"
|
||||
border="{{ false }}"
|
||||
label="表字"
|
||||
readonly
|
||||
/>
|
||||
</van-cell-group>
|
||||
</view>
|
||||
</van-dialog>
|
|
@ -0,0 +1,95 @@
|
|||
/* childPackage/pages/electricQuery/components/reading/index.wxss */
|
||||
|
||||
/* pages/electricQuery/index.wxss */
|
||||
page {
|
||||
background-color: var(--transparent-green);
|
||||
}
|
||||
|
||||
.queryWrapper {
|
||||
margin: 20rpx 0rpx;
|
||||
background-color: #fff;
|
||||
padding:15rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
width: 180rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.sum {
|
||||
margin-bottom: 30rpx;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
padding-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.query {
|
||||
margin: 20rpx 0rpx;
|
||||
}
|
||||
|
||||
.typeQueryText {
|
||||
text-align: center;
|
||||
padding: 20rpx;
|
||||
background-color: var(--light-green);
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.select {
|
||||
border: 1rpx solid #ccc;
|
||||
padding: 12rpx;
|
||||
border-radius: 12rpx;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.timeQueryText {
|
||||
text-align: center;
|
||||
padding: 20rpx;
|
||||
background-color: rgb(242,248,246);
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
margin: 20rpx 0;
|
||||
font-size: 28rpx;
|
||||
color: rgb(97, 93, 93);
|
||||
}
|
||||
.timeChooseWrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.time {
|
||||
flex: 1;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 30rpx;
|
||||
display: flex;
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.timeText {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.mychart-bar::after{
|
||||
content:"";
|
||||
display:block;
|
||||
clear:both
|
||||
}
|
|
@ -22,26 +22,26 @@ Page({
|
|||
year: dayjs().format('YYYY'),
|
||||
yearMonth: dayjs().format("YYYY-MM"),
|
||||
yearMonthDay: dayjs().format("YYYY-MM-DD"),
|
||||
|
||||
yearStamp: new Date().getTime(),
|
||||
yearMonthStamp: new Date().getTime(),
|
||||
yearMonthDayStamp: new Date().getTime(),
|
||||
|
||||
|
||||
header: [
|
||||
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '时间',renderBody: (item) => { return item.time } },
|
||||
{ key: 'number', title: '耗量' },
|
||||
],
|
||||
meterReadingHeader: [
|
||||
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
|
||||
{ title: '倍率', key: 'ratio' },
|
||||
{ key: 'number', title: '抄表记录' },
|
||||
],
|
||||
|
||||
list: [],
|
||||
visible: false,
|
||||
meterReadingList: [],
|
||||
|
||||
accountingList: [],
|
||||
electricNumber: 0,
|
||||
meterNumber: 0,
|
||||
page: 1,
|
||||
readingPage: 1,
|
||||
},
|
||||
changeQueryType(e) {
|
||||
const { type } = e.currentTarget.dataset
|
||||
|
@ -53,10 +53,10 @@ Page({
|
|||
})
|
||||
break;
|
||||
case 1:
|
||||
loadingFunc(async () => {
|
||||
await this.getReadingList();
|
||||
})
|
||||
break;
|
||||
// loadingFunc(async () => {
|
||||
// await this.getReadingList();
|
||||
// })
|
||||
// break;
|
||||
case 2:
|
||||
loadingFunc(async () => {
|
||||
await this.getAccountingBalanceList();
|
||||
|
@ -74,6 +74,7 @@ Page({
|
|||
visible: true
|
||||
})
|
||||
},
|
||||
|
||||
changeTimeType(e) {
|
||||
const { type } = e.currentTarget.dataset
|
||||
const that = this;
|
||||
|
@ -164,15 +165,7 @@ Page({
|
|||
return pieChart;
|
||||
});
|
||||
},
|
||||
async getReadingList() {
|
||||
const { meterId } = this.data;
|
||||
const { code, message, data } = await getMeterReadingList(meterId)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ meterReadingList: data, totalPage: 1 })
|
||||
},
|
||||
|
||||
async export() {
|
||||
loadingFunc(async () => {
|
||||
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
|
||||
|
@ -287,6 +280,7 @@ Page({
|
|||
onTimeCancel() {
|
||||
this.setData({ visible: false })
|
||||
},
|
||||
|
||||
onTimeConfirm(e) {
|
||||
const { type, time } = e.detail;
|
||||
switch(type) {
|
||||
|
@ -319,6 +313,7 @@ Page({
|
|||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
"accountingCard": "./components/accountingCard/index",
|
||||
"pagination": "/components/pagination/index",
|
||||
"echarts": "/childPackage/components/echarts/ec-canvas",
|
||||
"listTable": "./components/listTable/index"
|
||||
"listTable": "./components/listTable/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"reading": "./components/reading/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
|
@ -57,9 +57,9 @@
|
|||
</view>
|
||||
</view>
|
||||
<view wx:elif="{{queryType === 1}}">
|
||||
<view class="tooltip">
|
||||
<!-- <view class="tooltip">
|
||||
显示为最新的一条抄表记录。电表更新数据有延迟,仅供参考,实际以电表上显示为准。
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view wx:elif="{{queryType === 2}}">
|
||||
<view class="tooltip">
|
||||
|
@ -88,19 +88,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view wx:if="{{queryType === 1}}">
|
||||
<view style="margin: 30rpx;">
|
||||
<view wx:if="{{meterReadingList.length}}">
|
||||
<table
|
||||
header="{{meterReadingHeader}}"
|
||||
list="{{meterReadingList}}"
|
||||
/>
|
||||
|
||||
</view>
|
||||
|
||||
<empty bind:refresh="getReadingList" wx:else />
|
||||
</view>
|
||||
|
||||
|
||||
<reading meter="{{meterId}}" />
|
||||
</view>
|
||||
<view wx:if="{{queryType === 2}}">
|
||||
<view style="margin: 30rpx;">
|
||||
|
@ -140,3 +128,4 @@
|
|||
bind:close="onTimeClose"
|
||||
bind:confirm="onTimeConfirm"
|
||||
/>
|
||||
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
<discount-coupon data="{{item}}" type="{{1}}" bind:get="getCanGet" />
|
||||
</view>
|
||||
</view>
|
||||
<empty bind:refresh="getCanGet" />
|
||||
<empty wx:else bind:refresh="getCanGet" />
|
||||
</van-tab>
|
||||
</van-tabs>
|
|
@ -38,7 +38,7 @@ Component({
|
|||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ detail: {...data,name: wx.getStorageSync('tenement')?.name, },editType: 'detail', })
|
||||
this.setData({ detail: {...data,name: data?.name || wx.getStorageSync('tenement')?.name, },editType: 'detail', })
|
||||
},
|
||||
async getUser() {
|
||||
const tenement = wx.getStorageSync('tenement')
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// pages/meterList/index.js
|
||||
import { getTenementMeterList } from "../../service/meter";
|
||||
import dayjs from "../../utils/dayjs";
|
||||
import { alertInfo, loadingFunc } from "../../utils/index";
|
||||
import request from '../../utils/request';
|
||||
const { OK } = request;
|
||||
|
@ -14,7 +15,7 @@ Page({
|
|||
{ key: "money", title: '电表余额', },
|
||||
{ key: 'overall', title: '电表总量' },
|
||||
],
|
||||
list: [{}],
|
||||
list: [],
|
||||
},
|
||||
async getMeters({ id }) {
|
||||
const { code, message, data } = await getTenementMeterList(id);
|
||||
|
@ -35,7 +36,6 @@ Page({
|
|||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log('options', options)
|
||||
loadingFunc(async () => {
|
||||
await this.getMeters({ id: options?.id })
|
||||
})
|
||||
|
@ -52,7 +52,9 @@ Page({
|
|||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
this.setData({
|
||||
time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!--pages/meterList/index.wxml-->
|
||||
<navigator title="电表列表" canBack="{{true}}" />
|
||||
<table header="{{header}}" list="{{list}}" />
|
||||
<view style="margin: 20rpx"> 当前时间:{{ time }} </view>
|
||||
<table header="{{header}}" list="{{list}}" border="{{true}}" />
|
|
@ -10,6 +10,13 @@
|
|||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "childPackage/pages/electricQuery/index",
|
||||
"pathName": "childPackage/pages/electricQuery/index",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/handleLogin/index",
|
||||
"pathName": "pages/handleLogin/index",
|
||||
|
|
|
@ -15,9 +15,9 @@ export const getElectricityList = async function({ meter, type, time, page }) {
|
|||
}
|
||||
|
||||
// 抄表记录列表
|
||||
export const getMeterReadingList = async function(meter) {
|
||||
export const getMeterReadingList = async function({ id = '', time, page }) {
|
||||
const tenement = wx.getStorageSync('tenement')?.id || ""
|
||||
return await GET(`/wx/getMeterReadingList?tenement=${tenement}&meter=${meter}`);
|
||||
return await GET(`/wx/getMeterReadingList?tenement=${tenement}&meter=${id}&page=${page}&readAt=${time}`);
|
||||
}
|
||||
// 账务余额列表
|
||||
export const getAccountingList = async function(meter) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user