导入抄表记录完成电表列表部分(未调试)

This commit is contained in:
2025-09-08 17:31:03 +08:00
parent 71ad4995c8
commit 70737fa2b8
16 changed files with 249 additions and 46 deletions

View File

@@ -1,4 +1,9 @@
// pages/workBench/components/reading/index.js // pages/workBench/components/reading/index.js
import { getMeterReadingRouteList } from "../../../../service/workBench"
import { alertError, loadingFunc } from "../../../../utils/index"
import request from "../../../../utils/request"
const { OK } = request
Component({ Component({
/** /**
@@ -12,7 +17,8 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
park: "",
parkName: ""
}, },
/** /**
@@ -27,7 +33,15 @@ Component({
}) })
}, },
async init() { async init() {
const { parkName, park } = this.data;
const { code, message, data } = await getMeterReadingRouteList(parkName)
if (code !== OK) {
alertError(message)
return
}
this.setData({
list: data
})
}, },
onConfirm(e) { onConfirm(e) {
const { data } = e.detail; const { data } = e.detail;
@@ -51,7 +65,6 @@ Component({
}, },
jumpToReading(e) { jumpToReading(e) {
const { id } = e.currentTarget.dataset; const { id } = e.currentTarget.dataset;
console.log("id", id, "e", e)
wx.navigateTo({ wx.navigateTo({
url: '/pages/writeReading/index', url: '/pages/writeReading/index',
}) })

View File

@@ -22,27 +22,17 @@
bindcancel="onConcal" bindcancel="onConcal"
/> />
<van-empty description="请先选择园区" wx:if="{{!park}}" />
<van-cell <view wx:else>
title="路线1" <van-cell
label="包含12个抄表点" wx:for="{{list}}"
> wx:key="id"
<view slot="right-icon"> title="路线1"
<!-- <van-icon name="search" class="search-icon" /> --> label="包含12个抄表点"
<van-button type="primary" size="small" type="primary"> 去抄表 </van-button> >
</view> <view slot="right-icon">
</van-cell> <van-button type="primary" size="small" type="primary"> 去抄表 </van-button>
<van-cell </view>
title="路线2" </van-cell>
label="包含12个抄表点" </view>
>
<view slot="right-icon">
<!-- <van-icon name="search" class="search-icon" /> -->
<van-button
type="primary"
size="small"
bind:tap="jumpToReading"
data-id="1234"
> 去抄表 </van-button>
</view>
</van-cell>

View File

@@ -1,4 +1,8 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {
"van-tag": "@vant/weapp/tag/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
} }

View File

@@ -1,2 +1,61 @@
<!--pages/writeReading/components/meterInfo/index.wxml--> <!--pages/writeReading/components/meterInfo/index.wxml-->
<text>pages/writeReading/components/meterInfo/index.wxml</text> <view class="wrapper">
<view class="title">
<text> 电表列表 </text>
</view>
<view class="info">
<view class="title">
<view class="address">
标1东-307
</view>
<view class="meterType">
<van-tag type="primary">华昌宝能收费</van-tag>
</view>
</view>
<view class="detail">
<van-row gutter="20">
<van-col span="12">
<view class="text">
<view>
编号
</view>
<view>
1202312423524
</view>
</view>
</van-col>
<van-col span="12">
<view class="text">
<view>
编号
</view>
<view>
1202312423524
</view>
</view>
</van-col>
<van-col span="12">
<view class="text">
<view>
编号
</view>
<view>
1202312423524
</view>
</view>
</van-col>
<van-col span="12">
<view class="text">
<view>
编号
</view>
<view>
1202312423524
</view>
</view>
</van-col>
</van-row>
</view>
</view>
</view>

View File

@@ -1 +1,33 @@
/* pages/writeReading/components/meterInfo/index.wxss */ /* pages/writeReading/components/meterInfo/index.wxss */
.wrapper {
padding: 0 20rpx 20rpx;
}
.info {
margin-top: 20rpx;
padding: 20rpx;
border-radius: 15rpx;
background-color: white;
}
.info .title {
display: flex;
align-items: center;
justify-content: space-between;
}
.info .title .address {
font-size: 36rpx;
font-weight: 800;
}
.info .detail {
margin-top: 20rpx;
}
.info .detail .text {
display: flex;
justify-content: space-between;
font-size: 30rpx;
}

View File

@@ -0,0 +1,32 @@
// pages/writeReading/components/meterList/components/meterItem/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
active: Boolean,
},
observers: {
"active": function (newValue) {
this.setData({
isDeep: newValue
})
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
onClick: function() {
this.triggerEvent("click")
}
}
})

View File

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

View File

@@ -0,0 +1,4 @@
<!--pages/writeReading/components/meterList/components/meterItem/index.wxml-->
<view class="wrapper {{isDeep ? 'deepBg' : ''}}" bind:tap="onClick">
标1东-3071312452636756756857
</view>

View File

@@ -0,0 +1,22 @@
/* pages/writeReading/components/meterList/components/meterItem/index.wxss */
.wrapper {
border-radius: 20rpx;
padding: 20rpx;
margin-bottom: 30rpx;
width: 200rpx;
box-sizing: border-box;
margin-right: 20rpx;
background-color: white;
word-break: break-all;
overflow: hidden;
font-size: 32rpx;
height: 150rpx;
display: flex;
align-items: center;
}
.deepBg {
background-color: var(--deep-green);
color: white;
}

View File

@@ -13,7 +13,7 @@ Component({
*/ */
data: { data: {
animationData: {}, // 存储动画数据 animationData: {}, // 存储动画数据
position: -100 position: 0
}, },
lifetimes: { lifetimes: {
attached() { attached() {
@@ -31,11 +31,35 @@ Component({
methods: { methods: {
handleLeft() { handleLeft() {
// 将动画数据设置到 data 中,从而触发视图更新 // 将动画数据设置到 data 中,从而触发视图更新
const currentPosition = this.data.position
if (currentPosition === 0) {
this.setData({
position: currentPosition,
});
return;
}
this.setData({ this.setData({
position: this.data.position - 100, position: this.data.position + 300,
}); });
},
handleRight() {
// // 将动画数据设置到 data 中,从而触发视图更新
// const currentPosition = this.data.position
// if (currentPosition === 0) {
// this.setData({
// position: currentPosition,
// });
// return;
// }
this.setData({
position: this.data.position - 300,
});
},
onChangeMeter() {
console.log("---------------")
} }
} }
}) })

View File

@@ -1,6 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-icon": "@vant/weapp/icon/index",
"meter-item": "./components/meterItem/index"
} }
} }

View File

@@ -4,21 +4,26 @@
<view class="title"> <view class="title">
<text> 电表列表 </text> <text> 电表列表 </text>
</view> </view>
<view style="display: flex; align-items: center;"> <view style="display: flex; align-items: center;margin-top: 20rpx;">
<view bind:tap="handleLeft"> <van-icon name="arrow-left" size="50rpx" bind:tap="handleLeft" />
</view>
<scroll-view <scroll-view
scroll-x="{{true}}" scroll-x="{{true}}"
class="meterListScrollView" class="meterListScrollView"
> >
<view style="width: 1000px; margin-left: {{position}}rpx"> <view style="margin-left: {{position}}rpx; display: flex;">
12345623425346356356356 12345623425346356356356 12345623425346356356356 12345623425346356356356 <meter-item active="{{true}}" />
<meter-item active="{{false}}" bind:click="onChangeMeter" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
<meter-item active="{{false}}" />
</view> </view>
</scroll-view> </scroll-view>
<view> <van-icon name="arrow" size="50rpx" bind:tap="handleRight" />
</view>
</view> </view>
</view> </view>

View File

@@ -1,7 +1,7 @@
/* pages/writeReading/components/meterList/index.wxss */ /* pages/writeReading/components/meterList/index.wxss */
.wrapper { .wrapper {
padding: 0 20rpx; padding: 0 20rpx 20rpx;
} }
.title { .title {
@@ -12,5 +12,9 @@
flex: 1; flex: 1;
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 20rpx; margin-right: 20rpx;
overflow: hidden; overflow-x: hidden;
}
page {
background-color: #ebedf0;
} }

View File

@@ -1,7 +1,8 @@
{ {
"usingComponents": { "usingComponents": {
"navigator": "/components/navigator/index", "navigator": "/components/navigator/index",
"meter-list": "./components/meterList/index" "meter-list": "./components/meterList/index",
"meter-info": "./components/meterInfo/index"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }

View File

@@ -1,3 +1,4 @@
<!--pages/writeReading/index.wxml--> <!--pages/writeReading/index.wxml-->
<navigator title="录入抄表记录" canBack="{{true}}" /> <navigator title="录入抄表记录" canBack="{{true}}" />
<meter-list /> <meter-list />
<meter-info />

7
service/workBench.js Normal file
View File

@@ -0,0 +1,7 @@
import apis from '../utils/request';
const { GET, POST, PUT, DELETE } = apis
// 检索园区路线列表
export const getMeterReadingRouteList = async function(keyword) {
return await GET(`/park/route/list?keyword=${keyword}`);
}