工作台代码提交

This commit is contained in:
2025-11-09 17:33:32 +08:00
parent 0d38e006e1
commit 639f92540f
27 changed files with 1257 additions and 27 deletions

View File

@@ -1,6 +1,11 @@
// pages/workBenchNew/components/uninstallMeter/index.js
import { uninstallMeter } from "../../../../service/meter";
import dayjs from "../../../../utils/dayjs"
import { alertInfo, } from "../../../../utils/index"
import request from "../../../../utils/request"
import { alertInfo, alertSuccess, } from "../../../../utils/index"
const { OK } = request;
Page({
/**
@@ -66,6 +71,7 @@ Page({
this.setData({
meter: data.id,
meterName: data.address,
meterInfo: data,
});
break;
case "card":
@@ -106,6 +112,59 @@ Page({
type: "",
})
},
async onSubmit() {
const { meter, } = this.data;
if (!meter) {
alertInfo("请选择表号")
return;
}
const { code, message } = await uninstallMeter(meter)
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("拆除成功")
setTimeout(() => {
wx.navigateTo({
url: '/pages/workBenchTodoList/index',
})
}, 300)
},
uploadImage() {
const that = this;
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: async function(res) {
console.log("res", res)
const path = res.tempFiles?.[0]?.tempFilePath.toLowerCase()
if (!/(\.jpg|\.png|\.jpeg)$/.test(path)) {
wx.showToast({
title: '请上传jpg、png或jpeg格式的图片',
icon: 'none',
});
return;
}
var tempFilePaths = path;
loadingFunc(async () => {
const { code, message, url } = await uploadInstallMeter(tempFilePaths)
if (code !== OK) {
alertError(message)
return
}
that.setData({
url: url
})
})
}
})
},
clearImage() {
this.setData({
url: ""
})
},
goback() {
wx.navigateBack()
},

View File

@@ -39,11 +39,19 @@
type=""
hideBorder="{{true}}"
>
<van-button wx:if="{{!image}}" type="info" size="small"> 上传 </van-button>
<view style="display: flex; align-items: center;">
<view>
<van-button type="info" size="small" bind:click="uploadImage" custom-style="margin-right: 20rpx;"> 上传 </van-button>
<view style="margin-top: 20rpx" wx:if="{{!!url}}">
<van-button type="danger" size="small" bind:click="clearImage" custom-style="margin-right: 20rpx;"> 清除 </van-button>
</view>
</view>
<van-image wx:if="{{!!url}}" width="100" height="100" src="{{url}}" custom-style="margin-left: 20rpx;" />
</view>
</searchSelectWrapper>
<view class="operate">
<view class="submit"> <van-button type="info" block> 提交 </van-button> </view>
<view class="submit"> <van-button type="info" block bind:click="onSubmit"> 提交 </van-button> </view>
<view class="cancel"> <van-button block bind:tap="goback"> 返回 </van-button> </view>
</view>
</view>