工作台修改

This commit is contained in:
2025-09-19 17:34:28 +08:00
parent 9b00bb3561
commit d4f357d624
63 changed files with 3615 additions and 15 deletions

View File

@@ -0,0 +1,218 @@
// pages/workBenchNew/components/workBenchMeter/index.js
import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index";
import { getParkMeterList, handleOperateMeterSwitch } from "../../../../service/meter"
import request from "../../../../utils/request"
const { OK } = request
Page({
/**
* 页面的初始数据
*/
data: {
keyword: "",
keywordTemp: "",
page: 1,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onParkFocus(e) {
this.setData({
show: true,
title: "园区",
type: 'park'
})
},
onMeterFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "电表",
type: 'meter'
})
},
onConfirm(e) {
const { data, type } = e.detail;
const that = this;
switch(type) {
case "park":
this.setData({
parkName: data.name,
park: data.id,
})
break;
case "meter":
this.setData({
meterName: data.address,
meter: data.id,
}, () => {
loadingFunc(async () => {
await that.init();
})
})
break;
}
this.onCancel();
},
onChangeKeyword(e) {
this.setData({ keywordTemp: e.detail })
},
onSearch() {
const that = this;
that.setData({
keyword: that.data.keywordTemp
}, () => {
loadingFunc(async () => {
await that.init();
})
})
},
async init() {
const { page, park, meter } = this.data;
if (!park) {
return;
}
const { code, message, data, total } = await getParkMeterList({ park, keyword: meter, page })
if (code !== OK) {
alertInfo(message);
return;
}
this.setData({
list: data,
total: total,
totalPage: Math.ceil(total / 20)
})
},
async onChangePage(e) {
const page = e.detail.currentIndex;
const that = this;
this.setData({
page
}, () => {
loadingFunc(async () => {
await that.init();
})
})
},
onCancel() {
this.setData({
show: false,
title: "",
type: "",
})
},
onChangeSelectMeter(e) {
this.setData({
meter: e.detail
})
},
async handleMeterSwitchOn() {
const that = this;
const { meter, meterName } = this.data;
wx.showModal({
title: '提示',
content: `您确认要对${meterName || 当前电表}进行合闸吗?`,
complete: async (res) => {
if (res.cancel) {
}
if (res.confirm) {
loadingFunc(async () => {
const { code, message } = await handleOperateMeterSwitch({ ids: [meter], status: 0 })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("合闸成功")
that.init();
})
}
}
})
},
async handleMeterSwitchOff() {
const that = this;
const { meter, meterName } = this.data;
wx.showModal({
title: '提示',
content: `您确认要对${meterName || 当前电表}进行拉闸吗?`,
complete: async (res) => {
if (res.cancel) {
return;
}
if (res.confirm) {
loadingFunc(async () => {
const { code, message } = await handleOperateMeterSwitch({ ids: [meter], status: 1 })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("拉闸成功")
that.init();
})
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,19 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"search-select": "/components/searchSelect/index",
"van-empty": "@vant/weapp/empty/index",
"table": "/components/table/table",
"pagination": "/components/pagination/index",
"empty": "/components/empty/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-tag": "@vant/weapp/tag/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"navigator": "/components/navigator/index",
"searchSelectWrapper": "/components/searchSelectWrapper/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,102 @@
<!--pages/workBench/components/record/index.wxml-->
<navigator title="电表信息" canBack="{{true}}" />
<searchSelectWrapper
label="园区"
placeholder="请选择园区"
text="{{parkName}}"
bind:search="onParkFocus"
/>
<searchSelectWrapper
label="电表"
placeholder="请选择电表"
text="{{meterName}}"
bind:search="onMeterFocus"
/>
<van-empty wx:if="{{!meter}}" description="选择电表后查看" />
<view wx:else>
<view wx:if="{{list.length}}">
<view class="operate">
<view style="margin-top: 24rpx; margin-bottom: 24rpx;display: flex; justify-content: center; align-items: center;">
<van-button
type="info"
size="small"
style="margin-right: 30rpx;"
bind:click="handleMeterSwitchOn"
disabled="{{!meter}}"
> 合闸 </van-button>
<van-button size="small" bind:click="handleClear" disabled="{{!meter}}" bind:click="handleMeterSwitchOff"> 拉闸 </van-button>
</view>
</view>
<view class="customTable" wx:for="{{list}}" wx:key="id">
<view class="customTableTile">
<van-row>
<van-col span="8">
<view style="text-align: center;"> {{item.tenement.shortName}} </view>
</van-col>
<van-col span="16"><view style="margin-left: 16rpx;">{{item.tenement.name}}</view> </van-col>
</van-row>
</view>
<view class="customTableContent">
<van-row >
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8" wx:if="{{item.type === 0}}">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 商户电表 </view></van-col>
<van-col span="8" wx:elif="{{item.type === 2}}">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 公摊电表 </view></van-col>
<van-col span="8" wx:else>
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 园区电表 </view></van-col>
<van-col span="16">表号:{{item.meterNo}}</van-col>
</van-row>
</view>
</van-col>
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> {{item.address}} </view>
</van-col>
<van-col span="16">SN{{item.meterSn}}</van-col>
</van-row>
</view>
</van-col>
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 表字:{{item.amount}} </view>
</van-col>
<van-col span="16">余额:{{item.money}}</van-col>
</van-row>
</view>
</van-col>
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8" wx:if="{{item.onPosition === 0}}">
<view style="text-align: center;border-right: 1rpx solid #ccc;">合闸</view> </van-col>
<van-col span="8" wx:else><view style="text-align: center;border-right: 1rpx solid #ccc;">拉闸</view> </van-col>
<van-col span="8" wx:if="{{item.canConnect}}"><view style="text-align: center;">在线</view> </van-col>
<van-col span="8" wx:else><view style="text-align: center;">失联</view> </van-col>
</van-row>
</view>
</van-col>
</van-row>
</view>
</view>
</view>
<empty bind:refresh="init" wx:else />
</view>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
wx:if="{{show}}"
/>

View File

@@ -0,0 +1,63 @@
/* pages/workBench/components/record/index.wxss */
.table {
width: 890rpx;
}
.classWrapper {
width: 100vw;
overflow-x: auto;
}
.thead {
display: flex;
flex-wrap: nowrap;
border-bottom: 1rpx solid #EEEEEE;
}
.thead .th {
padding: 20rpx;
white-space: nowrap;
text-align: center;
box-sizing: border-box;
}
.tbody {
width: 890rpx;
}
.tbody .tr {
padding: 20rpx;
border-bottom: 1rpx solid #EEEEEE;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tbody .th {
word-break: break-all;
text-align: center;
}
.customTable {
margin: 20rpx;
}
.customTableTile {
background-color: var(--light-green);
padding: 16rpx;
box-sizing: border-box;
font-weight: 700;
}
.tableRow {
padding: 16rpx;
border: 1rpx solid #ccc;
border-top: 0rpx;
}
page {
background-color: rgb(228,240,236);
font-size: 32rpx;
}