电表强控,工单跳转

This commit is contained in:
2025-11-12 14:12:01 +08:00
parent 7271c982d5
commit 422338f816
8 changed files with 141 additions and 60 deletions

View File

@@ -1,7 +1,8 @@
// pages/workBenchNew/components/workBenchMeter/index.js
import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index";
import { getParkMeterList, handleOperateMeterSwitch } from "../../../../service/meter"
import { getParkMeterList, handleOperateMeterMode } from "../../../../service/meter"
import { uploadMeterForce } from "../../../../service/public"
import request from "../../../../utils/request"
const { OK } = request
@@ -87,7 +88,34 @@ Page({
})
},
handleSubmit() {
const { } = this.data;
const that = this;
const { mode, days, reason, meter, meterName, url } = this.data;
if (mode === 2 && days == null) {
alertInfo("请填写天数")
return;
}
wx.showModal({
title: '提示',
content: `确定要对${meterName}进行${["预付费", "强控", "临时强控"][mode]}操作吗?`,
complete: async (res) => {
if (res.cancel) {
}
if (res.confirm) {
loadingFunc(async () => {
const { code, message } = await handleOperateMeterMode({ ids: [meter], mode, days: days == null ? undefined : Number(days), reason, images: url })
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("操作成功")
await that.init();
})
}
}
})
},
uploadImage() {
const that = this;
@@ -107,7 +135,7 @@ Page({
}
var tempFilePaths = path;
loadingFunc(async () => {
const { code, message, url } = await uploadInstallMeter(tempFilePaths)
const { code, message, url } = await uploadMeterForce(tempFilePaths)
if (code !== OK) {
alertError(message)
return
@@ -178,56 +206,6 @@ Page({
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();
})
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@@ -143,7 +143,7 @@
</searchSelectWrapper>
<view class="operate">
<view class="submit"> <van-button type="info" block bind:click="handleSubmit"> 提交 </van-button> </view>
<view class="submit"> <van-button type="info" block bind:click="handleSubmit"> 确认 </van-button> </view>
<view class="cancel"> <van-button block bind:tap="goback"> 返回 </van-button> </view>
</view>
</view>