修改状态
This commit is contained in:
@@ -58,6 +58,12 @@ Page({
|
||||
const { token, ...user } = data
|
||||
wx.setStorageSync('user', user)
|
||||
wx.setStorageSync('token', data?.token)
|
||||
// if (user.workStatus) {
|
||||
// wx.redirectTo({
|
||||
// url: '/pages/workBenchNew/index',
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
wx.switchTab({
|
||||
url: '/pages/home/index',
|
||||
})
|
||||
|
@@ -20,12 +20,13 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log("options", options)
|
||||
const { meter, park, routeId } = options;
|
||||
const { meter, park, routeId, disabled } = options;
|
||||
const that = this;
|
||||
this.setData({
|
||||
meter,
|
||||
park,
|
||||
routeId,
|
||||
disabled
|
||||
}, () => {
|
||||
that.refresh();
|
||||
})
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<view class="text">
|
||||
抄表记录历史
|
||||
</view>
|
||||
<van-button type="info" size="small" icon="plus" bind:tap="handleCreate"> 新增记录 </van-button>
|
||||
<van-button disabled="{{disabled === 'true'}}" type="info" size="small" icon="plus" bind:tap="handleCreate"> 新增记录 </van-button>
|
||||
</view>
|
||||
<view>
|
||||
<view wx:if="{{list.length}}">
|
||||
@@ -28,8 +28,8 @@
|
||||
</view>
|
||||
|
||||
<view class="th" style="width: 25%; text-align: center; justify-content: center; display: flex; align-items: center;">
|
||||
<van-icon wx:if="{{item.isDelete}}" name="edit" size="40rpx" bind:tap="handleUpdate" data-data="{{item}}" color="#15755e" />
|
||||
<van-icon wx:if="{{item.isDelete}}" name="delete" size="40rpx" bind:tap="handleDelete" data-data="{{item}}" color="#15755e" custom-style="margin-left: 20rpx" />
|
||||
<van-icon wx:if="{{item.isDelete && disabled !== 'true'}}" name="edit" size="40rpx" bind:tap="handleUpdate" data-data="{{item}}" color="#15755e" />
|
||||
<van-icon wx:if="{{item.isDelete && disabled !== 'true'}}" name="delete" size="40rpx" bind:tap="handleDelete" data-data="{{item}}" color="#15755e" custom-style="margin-left: 20rpx" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@@ -53,9 +53,9 @@ Page({
|
||||
})
|
||||
},
|
||||
jumpToReading(e) {
|
||||
const { id } = e.currentTarget.dataset;
|
||||
const { id, type } = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: `/pages/writeReading/index?id=${id}`,
|
||||
url: `/pages/writeReading/index?id=${id}&type=${type}`,
|
||||
})
|
||||
},
|
||||
async changeStartStatus(e) {
|
||||
@@ -73,6 +73,16 @@ Page({
|
||||
}, 500)
|
||||
},
|
||||
async changeEndStatus(e) {
|
||||
const that = this;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确认要结束吗?',
|
||||
complete: async (res) => {
|
||||
if (res.cancel) {
|
||||
|
||||
}
|
||||
|
||||
if (res.confirm) {
|
||||
const { id, routeid: routeId } = e.currentTarget.dataset;
|
||||
const { code, message } = await changeMeterRouteStatus({ id, status: 0, routeId })
|
||||
if (code !== OK) {
|
||||
@@ -80,7 +90,11 @@ Page({
|
||||
return
|
||||
}
|
||||
alertSuccess("操作成功")
|
||||
this.init()
|
||||
that.init()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
|
@@ -32,6 +32,9 @@
|
||||
wx:key="id"
|
||||
title="{{item.readingRouteName}}"
|
||||
label="包含{{item.meterRoute}}个抄表点"
|
||||
data-id="{{item.id}}"
|
||||
data-type="look"
|
||||
bind:click="jumpToReading"
|
||||
>
|
||||
<view slot="right-icon">
|
||||
<van-button
|
||||
@@ -42,6 +45,7 @@
|
||||
data-routeId="{{item.readingRouteId}}"
|
||||
custom-style="margin-right: 20rpx;"
|
||||
data-id="{{item.id}}"
|
||||
|
||||
wx:if="{{item.status === 0}}"
|
||||
> 开始抄表 </van-button>
|
||||
<van-button
|
||||
@@ -49,6 +53,7 @@
|
||||
size="small"
|
||||
bind:tap="jumpToReading"
|
||||
data-id="{{item.id}}"
|
||||
data-type="edit"
|
||||
custom-style="margin-right: 20rpx;"
|
||||
wx:if="{{item.status === 1}}"
|
||||
> 去抄表 </van-button>
|
||||
|
@@ -18,6 +18,10 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.init()
|
||||
const user = wx.getStorageSync('user')
|
||||
this.setData({
|
||||
workStatus: !!user.workStatus
|
||||
})
|
||||
},
|
||||
async init() {
|
||||
const { code, message, data } = await getWorkBenchHome()
|
||||
|
@@ -7,6 +7,7 @@ Component({
|
||||
properties: {
|
||||
meterInfo: Object,
|
||||
routeId: String,
|
||||
disabled: Boolean,
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -21,10 +22,10 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
jumpToHistory() {
|
||||
const { meterInfo, routeId } = this.data;
|
||||
const { meterInfo, routeId, disabled } = this.data;
|
||||
console.log("meterInfo", meterInfo)
|
||||
wx.navigateTo({
|
||||
url: `/pages/readingHistory/index?meter=${meterInfo?.id}&park=${meterInfo?.parkId}&routeId=${routeId}`,
|
||||
url: `/pages/readingHistory/index?meter=${meterInfo?.id}&park=${meterInfo?.parkId}&routeId=${routeId}&disabled=${disabled}`,
|
||||
})
|
||||
},
|
||||
}
|
||||
|
@@ -15,7 +15,8 @@ Component({
|
||||
meterInfo: Object,
|
||||
showLeft: Boolean,
|
||||
showRight: Boolean,
|
||||
routeId: String
|
||||
routeId: String,
|
||||
disabled: Boolean,
|
||||
},
|
||||
observers: {
|
||||
"routeId": function(newValue) {
|
||||
|
@@ -52,14 +52,15 @@
|
||||
<view style="flex: 1;">
|
||||
<van-field
|
||||
value="{{currentNumber}}"
|
||||
placeholder="请输入本次读数"
|
||||
placeholder="{{ disabled ? '已抄表' : '请输入本次读数'}}"
|
||||
bind:change="onChange"
|
||||
border="{{false}}"
|
||||
custom-style="border: 1rpx solid #ccc; padding: 2px 14rpx; font-size: 32rpx; border-radius: 10rpx;flex: 1;"
|
||||
disabled="{{disabled}}"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<photo bind:finish="onPhotoFinish" />
|
||||
<photo bind:finish="onPhotoFinish" wx:if="{{!disabled}}" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="photo">
|
||||
@@ -79,10 +80,10 @@
|
||||
</view>
|
||||
<view class="operate">
|
||||
<view style="flex: 1;">
|
||||
<van-button type="info" block bind:click="handleCreateReading"> 确定录入 </van-button>
|
||||
<van-button disabled="{{disabled}}" type="info" block bind:click="handleCreateReading"> 确定录入 </van-button>
|
||||
</view>
|
||||
<view style="flex: 1; margin-left: 20rpx;">
|
||||
<van-button block bind:click="handleClear"> 清除记录 </van-button>
|
||||
<van-button disabled="{{disabled}}" block bind:click="handleClear"> 清除记录 </van-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@@ -18,7 +18,8 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { id } = options;
|
||||
const { id, type } = options;
|
||||
this.setData({ id, type })
|
||||
this.getMeterList(id)
|
||||
},
|
||||
async getMeterList(id) {
|
||||
|
@@ -8,7 +8,11 @@
|
||||
meterInfo="{{meterInfo}}"
|
||||
finishNumber="{{finishNumber}}"
|
||||
/>
|
||||
<meter-info meterInfo="{{meterInfo}}" routeId="{{routeId}}" />
|
||||
<meter-info
|
||||
meterInfo="{{meterInfo}}"
|
||||
routeId="{{routeId}}"
|
||||
disabled="{{meterInfo.status === 1}}"
|
||||
/>
|
||||
<reading-info
|
||||
meterInfo="{{meterInfo}}"
|
||||
showLeft="{{active !== 0}}"
|
||||
@@ -18,4 +22,5 @@
|
||||
routeId="{{routeId}}"
|
||||
bind:finishNumber="onSetFinishNumber"
|
||||
bind:onSubmit="onSubmit"
|
||||
disabled="{{meterInfo.status === 1}}"
|
||||
/>
|
@@ -23,6 +23,13 @@
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/workBenchNew/components/workBenchReading/index",
|
||||
"pathName": "pages/workBenchNew/components/workBenchReading/index",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/workBenchNew/index",
|
||||
"pathName": "pages/workBenchNew/index",
|
||||
|
Reference in New Issue
Block a user