开始做工作台,调整用电查询分页

This commit is contained in:
qiaomu 2024-11-08 18:24:05 +08:00
parent 08ef87ce33
commit b9d1ee34a7
32 changed files with 384 additions and 16 deletions

View File

@ -21,7 +21,8 @@
"pages/publicTransfer/index",
"pages/special/index",
"pages/encyclopedia/index",
"pages/encyclopediaDetail/index"
"pages/encyclopediaDetail/index",
"pages/workBench/index"
],
"subPackages": [
{

View File

@ -0,0 +1,53 @@
// childPackage/pages/electricQuery/components/listTable/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array,
watch(newVal) {
console.log("newVal ------", newVal)
}
},
header: Array,
totalPage: Number,
},
observers: {
'list': function(val) {
this.setData({
tempList: (this.data.list || [])?.slice(0, 20),
page: 1,
})
}
},
/**
* 组件的初始数据
*/
data: {
page: 1,
tempList: [],
},
lifetimes: {
attached() {
console.log('this.data', this.data.list)
this.setData({
tempList: (this.data.list || [])?.slice(0, 20),
})
}
},
/**
* 组件的方法列表
*/
methods: {
async onChangePage(e) {
const page = e.detail.currentIndex;
const that = this;
this.setData({
page,
tempList: (this.data.list || [])?.slice((page - 1) * 20, page * 20)
})
},
}
})

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"table": "/components/table/table",
"empty": "/components/empty/index",
"pagination": "/components/pagination/index"
}
}

View File

@ -0,0 +1,11 @@
<!--childPackage/pages/electricQuery/components/listTable/index.wxml-->
<view wx:if="{{list.length}}">
<table header="{{header}}" list="{{tempList}}" />
<pagination
currentIndex="{{page}}"
totalPage="{{totalPage}}"
bind:pagingChange="onChangePage"
/>
</view>
<empty bind:refresh="init" wx:else />

View File

@ -0,0 +1 @@
/* childPackage/pages/electricQuery/components/listTable/index.wxss */

View File

@ -48,13 +48,20 @@ Page({
this.setData({ queryType: type },() => {
switch(type) {
case 0:
this.init()
loadingFunc(async () => {
await this.init()
})
break;
case 1:
this.getReadingList();
loadingFunc(async () => {
await this.getReadingList();
})
break;
case 2:
this.getAccountingBalanceList();
loadingFunc(async () => {
await this.getAccountingBalanceList();
})
break;
}
@ -69,8 +76,11 @@ Page({
},
changeTimeType(e) {
const { type } = e.currentTarget.dataset
const that = this;
this.setData({ timeType: type }, () => {
this.init()
loadingFunc(async () => {
await that.init()
})
})
},
@ -78,7 +88,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
loadingFunc(async () => {
await this.init()
})
},
async init() {
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay, page } = this.data;
@ -251,13 +263,20 @@ Page({
const { queryType, } = this.data;
switch(queryType) {
case 1:
this.getReadingList();
loadingFunc(async () => {
await this.getReadingList();
})
break;
case 2:
this.getAccountingBalanceList();
loadingFunc(async () => {
await this.getAccountingBalanceList();
})
break;
default:
this.init();
loadingFunc(async () => {
await this.init();
})
break;
}
})
@ -273,13 +292,17 @@ Page({
switch(type) {
case "year":
this.setData({ year: time, visible: false, }, () => {
this.init();
loadingFunc(async () => {
await this.init();
})
});
break;
case "month":
const [year, month] = time.split("-")
this.setData({ yearMonth: time, yearMonthStamp: new Date(Number(year), Number(month) - 1, 1).getTime(), visible: false }, () => {
this.init();
loadingFunc(async () => {
await this.init();
})
});
break;
case "day":
@ -289,7 +312,9 @@ Page({
visible: false,
page: 1,
}, () => {
this.init();
loadingFunc(async () => {
await this.init();
})
})
break;
}

View File

@ -11,7 +11,8 @@
"timePicker": "/components/timePicker/index",
"accountingCard": "./components/accountingCard/index",
"pagination": "/components/pagination/index",
"echarts": "/childPackage/components/echarts/ec-canvas"
"echarts": "/childPackage/components/echarts/ec-canvas",
"listTable": "./components/listTable/index"
},
"navigationStyle": "custom"
}

View File

@ -70,7 +70,7 @@
</view>
<view wx:if="{{queryType === 0}}">
<view style="margin: 30rpx;">
<view wx:if="{{list.length}}">
<!-- <view wx:if="{{list.length}}">
<table header="{{header}}" list="{{list}}" />
<pagination
currentIndex="{{page}}"
@ -79,7 +79,9 @@
wx:if="{{timeType === 0}}"
/>
</view>
<empty bind:refresh="init" wx:else />
<empty bind:refresh="init" wx:else /> -->
<listTable list="{{list}}" header="{{header}}" totalPage="{{totalPage}}" />
</view>
<view class="sum">
合计:表计数量:{{meterNumber}},耗电量:{{electricNumber}}
@ -87,7 +89,7 @@
</view>
<view wx:if="{{queryType === 1}}">
<view style="margin: 30rpx;">
<view wx:if="{{meterReadingList.length}}" >
<view wx:if="{{meterReadingList.length}}">
<table
header="{{meterReadingHeader}}"
list="{{meterReadingList}}"

View File

@ -0,0 +1,24 @@
// components/searchSelect/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index",
"van-picker": "@vant/weapp/picker/index"
}
}

View File

@ -0,0 +1,14 @@
<!--components/searchSelect/index.wxml-->
<van-popup
show="{{ true }}"
bind:click="onClickHide"
>
<!-- <view style="height: 100%; width: 100%; display: flex;align-items: center; justify-content: center;">
<van-picker
custom-style="width: 100%;"
columns="{{ columns }}"
bind:change="onChange"
/>
</view> -->
111
</van-popup>

View File

@ -0,0 +1 @@
/* components/searchSelect/index.wxss */

View File

@ -386,4 +386,5 @@ Page({
}
})
},
})

View File

@ -39,6 +39,11 @@ Page({
})
},
jumpToQrCode() {
const { user = {} } = this.data;
if (!user?.id) {
alertInfo("请先登录")
return;
}
wx.navigateTo({
url: '/pages/qrCode/index',
})
@ -73,6 +78,11 @@ Page({
url: '/pages/invoiceList/index?tab=2',
})
},
jumpToWorkBench() {
wx.navigateTo({
url: '/pages/workBench/index',
})
},
async getUnReadNumber() {
const dot = await getDot();
this.setData({
@ -117,4 +127,8 @@ Page({
});
},
// onTabItemTap(item) {
// console.log('------------', item)
// }
})

View File

@ -14,6 +14,7 @@
<van-cell title="发票抬头" value="" is-link bind:tap="jumpToUpdateInvoice" />
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
<van-cell title="常见问题" value="" is-link bind:tap="jumpToQuestions" />
<van-cell title="工作台" wx:if="{{user.workStatus}}" value="" is-link bind:tap="jumpToWorkBench" />
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
<van-dialog id="van-dialog" />

View File

@ -0,0 +1,24 @@
// pages/workBench/components/approve/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,2 @@
<!--pages/workBench/components/approve/index.wxml-->
<text>pages/workBench/components/approve/index.wxml</text>

View File

@ -0,0 +1 @@
/* pages/workBench/components/approve/index.wxss */

View File

@ -0,0 +1,24 @@
// pages/workBench/components/recharge/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-popup": "@vant/weapp/popup/index"
}
}

View File

@ -0,0 +1,3 @@
<!--pages/workBench/components/recharge/index.wxml-->
充值
<searchSelect />

View File

@ -0,0 +1 @@
/* pages/workBench/components/recharge/index.wxss */

View File

@ -0,0 +1,24 @@
// pages/workBench/components/record/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,2 @@
<!--pages/workBench/components/record/index.wxml-->
<text>pages/workBench/components/record/index.wxml</text>

View File

@ -0,0 +1 @@
/* pages/workBench/components/record/index.wxss */

68
pages/workBench/index.js Normal file
View File

@ -0,0 +1,68 @@
// pages/workBench/index.js
Page({
/**
* 页面的初始数据
*/
data: {
active: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onTabChange(e) {
this.setData({ active: e.detail.index })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,11 @@
{
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"navigator": "/components/navigator/index",
"approve": "./components/approve/index",
"recharge": "./components/recharge/index",
"record": "./components/record/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,13 @@
<!--pages/workBench/index.wxml-->
<navigator title="工作台" canBack="true" />
<van-tabs active="{{ active }}" bind:change="onTabChange">
<van-tab title="充值">
<recharge />
</van-tab>
<van-tab title="查询">
<record />
</van-tab>
<van-tab title="审核">
<approve />
</van-tab>
</van-tabs>

View File

@ -0,0 +1 @@
/* pages/workBench/index.wxss */

View File

@ -10,6 +10,20 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "childPackage/pages/electricQuery/index",
"pathName": "childPackage/pages/electricQuery/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/workBench/index",
"pathName": "pages/workBench/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/publicTransfer/index",
"pathName": "pages/publicTransfer/index",