修改电表报表抄表记录
This commit is contained in:
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
|
||||
}
|
Reference in New Issue
Block a user