diff --git a/app.json b/app.json index eb05e51..09a5502 100644 --- a/app.json +++ b/app.json @@ -39,10 +39,17 @@ "pages/billMeterDetail/index", "pages/meterBalanceRecord/index", "pages/workBenchNew/components/workBenchMeter/index", + "pages/workBenchNew/components/workBenchMeterControl/index", "pages/workBenchNew/components/workBenchTenement/index", "pages/workBenchNew/components/workBenchApprove/index", "pages/workBenchNew/components/workBenchWxUser/index", - "pages/workBenchNew/components/workBenchReading/index" + "pages/workBenchNew/components/workBenchReading/index", + "pages/workBenchNew/components/recharge/index", + "pages/workBenchNew/components/installMeter/index", + "pages/workBenchNew/components/uninstallMeter/index", + "pages/workBenchTodoList/index", + "pages/workBenchNew/components/kaihu/index", + "pages/workOrderDetail/index" ], "subPackages": [ { diff --git a/components/searchSelect/index.js b/components/searchSelect/index.js index c75c854..5702dcf 100644 --- a/components/searchSelect/index.js +++ b/components/searchSelect/index.js @@ -1,8 +1,10 @@ import { getLoginParkList, getParkBuildingList } from "../../service/park" -import { getParkSimpleMeterList } from "../../service/meter" +import { getParkSimpleMeterList, getParkBoxList, getCardList, getCollectionList, getInventoryMeter } from "../../service/meter" import { alertInfo } from "../../utils/index"; import request from "../../utils/request" -import { payWays, feeType } from "../../utils/data"; +import { payWays, feeType, meterType, noticeFlowType, noticeFlowStatus, + meterMode +} from "../../utils/data"; import { getTenementList, getWxTenementList } from "../../service/tenement"; const { OK } = request; @@ -18,10 +20,12 @@ Component({ show: Boolean, park: String, isBack: Boolean, + filterBind: Boolean, }, observers: { - "show,type": function(newShow, newType) { + "show,type,filterBind": function(newShow, newType) { if (newShow && newType) { + console.log("newShow", newShow,"newType", newType) this.onSearch() } } @@ -34,6 +38,10 @@ Component({ searchText: "", payWays, feeType, + meterType, + noticeFlowType, + noticeFlowStatus, + meterMode, }, lifetimes: { attached() { @@ -60,6 +68,7 @@ Component({ }, onConfirm(event) { const { index } = event.detail; + console.log("index", index) const { list = [], type } = this.data; const item = list[index]; if (!item) { @@ -71,7 +80,18 @@ Component({ list: [], searchText: "" }) - this.triggerEvent("confirm", { data: item, type } ); + this.triggerEvent("confirm", { data: item, type, index } ); + }, + onMeterModeConfirm(event) { + const { index } = event.detail; + const { meterMode = [], type } = this.data; + const item = meterMode[index]; + this.setData({ + columns: [], + list: [], + searchText: "" + }) + this.triggerEvent("confirm", { data: item, way: index, type } ); }, onPayConfirm(event) { const { index } = event.detail; @@ -84,6 +104,29 @@ Component({ }) this.triggerEvent("confirm", { data: item, way: index, type } ); }, + onNoticeFlowTypeConfirm(event) { + const { index } = event.detail; + const { noticeFlowType = [], type } = this.data; + const item = noticeFlowType[index]; + this.setData({ + columns: [], + list: [], + searchText: "" + }) + this.triggerEvent("confirm", { data: item, way: index + 1, type } ); + }, + onNoticeFlowStatusConfirm(event) { + const { index } = event.detail; + const { noticeFlowStatus = [], type } = this.data; + const item = noticeFlowStatus[index]; + this.setData({ + columns: [], + list: [], + searchText: "" + }) + console.log("{ data: item, way: index + 1, type }", { data: item, way: index + 1, type }) + this.triggerEvent("confirm", { data: item, way: index + 1, type } ); + }, onFeeTypeConfirm(event) { const { index } = event.detail; const { feeType = [], type } = this.data; @@ -95,8 +138,19 @@ Component({ }) this.triggerEvent("confirm", { data: item, way: index, type } ); }, + onMeterTypeConfirm(event) { + const { index } = event.detail; + const { meterType = [], type } = this.data; + const item = meterType[index]; + this.setData({ + columns: [], + list: [], + searchText: "" + }) + this.triggerEvent("confirm", { data: item, way: index, type } ); + }, onSearch() { - const { type } = this.data; + const { type, bind, filterBind } = this.data; switch(type) { case "park": this.onSearchPark(); @@ -104,12 +158,24 @@ Component({ case "meter": this.onSearchMeter(); return + case "inventoryMeter": + this.onSearchInventoryMeter(); + return case "tenement": this.onSearchTenement(); return; case "building": this.onSearchBuilding(); return; + case "meterBox": + this.onSearchMeterBox(); + return; + case "card": + this.onSearchCard(); + return; + case "collection": + this.onSearchCollection(); + return; } }, async onSearchPark() { @@ -124,9 +190,21 @@ Component({ list: parks, }) }, + async onSearchCollection() { + const { searchText = "" } = this.data; + const { code, message, data: parks = [] } = await getCollectionList({keyword: searchText, page: 1, status: 1}); + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ + columns: parks?.map(item => `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`), + list: parks, + }) + }, async onSearchMeter() { - const { searchText = "", park } = this.data; - const { code, message, data: parks = [] } = await getParkSimpleMeterList({keyword: searchText, park}); + const { searchText = "", park, filterBind } = this.data; + const { code, message, data: parks = [] } = await getParkSimpleMeterList({keyword: searchText, park, isNeedBind: !filterBind}); if (code !== OK) { alertInfo(message) return @@ -136,6 +214,18 @@ Component({ list: parks || [], }) }, + async onSearchInventoryMeter() { + const { searchText = "", park, filterBind } = this.data; + const { code, message, data: parks = [] } = await getInventoryMeter({keyword: searchText, park, isNeedBind: !filterBind}); + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ + columns: parks?.map(item => `${item.sn}`) || [], + list: parks || [], + }) + }, async onSearchTenement() { const { searchText = "", park, isBack } = this.data; const { code, message, data = [] } = isBack ? await getWxTenementList({keyword: searchText, park}) : await getTenementList({keyword: searchText, park}); @@ -160,6 +250,30 @@ Component({ list: data, }) }, + async onSearchMeterBox() { + const { park } = this.data; + const { code, message, data = [] } = await getParkBoxList({park}); + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ + columns: data?.length ? data?.map(item => item?.address) : [], + list: data, + }) + }, + async onSearchCard() { + const { park } = this.data; + const { code, message, data = [] } = await getCardList({park}); + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ + columns: data?.length ? data?.map(item => item?.sim_number) : [], + list: data, + }) + } } }) diff --git a/components/searchSelect/index.wxml b/components/searchSelect/index.wxml index 6f4c8bc..bfef00f 100644 --- a/components/searchSelect/index.wxml +++ b/components/searchSelect/index.wxml @@ -26,6 +26,46 @@ bind:confirm="onFeeTypeConfirm" /> + + + + + + + + + + + + - {{ label }} + *{{ label }} {{placeholder}} {{text}} + - {{ label }} + *{{ label }} 搜索 - {{ label }} + *{{ label }} + + + + *{{ label }} + + + \ No newline at end of file diff --git a/components/searchSelectWrapper/index.wxss b/components/searchSelectWrapper/index.wxss index cd7bdc4..eafae3e 100644 --- a/components/searchSelectWrapper/index.wxss +++ b/components/searchSelectWrapper/index.wxss @@ -8,24 +8,26 @@ .content { flex: 1; - margin-left: 30rpx; + margin-left: 20rpx; margin-right: 30rpx; display: flex; padding: 10rpx 20rpx; border-radius: 12rpx; border: 1rpx solid #ccc; background-color: #fff; + position: relative; } .inputContent { flex: 1; - margin-left: 30rpx; + margin-left: 20rpx; margin-right: 30rpx; display: flex; padding: 0 20rpx; border-radius: 12rpx; border: 1rpx solid #ccc; background-color: #fff; + position: relative; } .text { @@ -33,5 +35,11 @@ } .label { - width: 120rpx; -} \ No newline at end of file + width: 130rpx; +} + +.required { + color: rgb(209, 83, 25); + font-size: 30rpx; +} + diff --git a/pages/meterBalanceRecord/index.wxml b/pages/meterBalanceRecord/index.wxml index e22637d..81e16b7 100644 --- a/pages/meterBalanceRecord/index.wxml +++ b/pages/meterBalanceRecord/index.wxml @@ -11,46 +11,6 @@ - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/readingHistory/components/detailModal/index.wxss b/pages/readingHistory/components/detailModal/index.wxss new file mode 100644 index 0000000..4da0fd5 --- /dev/null +++ b/pages/readingHistory/components/detailModal/index.wxss @@ -0,0 +1 @@ +/* pages/readingHistory/components/detailModal/index.wxss */ \ No newline at end of file diff --git a/pages/readingHistory/index.js b/pages/readingHistory/index.js index f118ece..69586c7 100644 --- a/pages/readingHistory/index.js +++ b/pages/readingHistory/index.js @@ -104,6 +104,13 @@ Page({ type: "edit", }) }, + handleDetail(e) { + const { data } = e.currentTarget.dataset; + this.setData({ + detail: data, + detailVisible: true + }) + }, handleDelete(e) { const { data } = e.currentTarget.dataset; const that = this; diff --git a/pages/readingHistory/index.json b/pages/readingHistory/index.json index ea7b734..aed3603 100644 --- a/pages/readingHistory/index.json +++ b/pages/readingHistory/index.json @@ -6,7 +6,8 @@ "van-icon": "@vant/weapp/icon/index", "editModal": "./components/editModal/index", "pagination": "/components/pagination/index", - "empty": "/components/empty/index" + "empty": "/components/empty/index", + "detailModal": "./components/detailModal/index" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/readingHistory/index.wxml b/pages/readingHistory/index.wxml index 3fb5403..e005fff 100644 --- a/pages/readingHistory/index.wxml +++ b/pages/readingHistory/index.wxml @@ -14,8 +14,8 @@ 抄表时间 - 抄表读数 - 操作 + 抄表读数 + 操作 @@ -23,13 +23,14 @@ {{ item.readAt }} - + {{ item.overall }} - + + @@ -58,4 +59,9 @@ bind:ok="onEditFinish" startTime="{{startTime}}" routeId="{{routeId}}" +/> + + \ No newline at end of file diff --git a/pages/workBenchNew/components/installMeter/index.js b/pages/workBenchNew/components/installMeter/index.js new file mode 100644 index 0000000..72b9ae9 --- /dev/null +++ b/pages/workBenchNew/components/installMeter/index.js @@ -0,0 +1,431 @@ +// pages/workBenchNew/components/createMeter/index.js +import dayjs from "../../../../utils/dayjs" +import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index" +import { uploadInstallMeter } from "../../../../service/public" +import request from "../../../../utils/request" +import { installMeter } from "../../../../service/meter" +const { OK } = request + +Page({ + + /** + * 页面的初始数据 + */ + data: { + time: "", + area: "", + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + time: dayjs().format("YYYY-MM-DD HH:mm:ss") + }) + }, + 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: 'inventoryMeter' + }) + }, + onBuildingFocus() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "建筑", + type: 'building' + }) + }, + clearImage() { + this.setData({ + url: "" + }) + }, + onMeterBoxFocus() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "电表箱", + type: 'meterBox' + }) + }, + onMeterTypeFocus() { + this.setData({ + show: true, + title: "电表类型", + type: 'meterType' + }) + }, + onBindCard() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "卡", + type: 'card' + }) + }, + onBindCollectionA() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "互感器A", + type: 'collection', + collection: "A" + }) + }, + onBindCollectionB() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "互感器B", + type: 'collection', + collection: "B" + }) + }, + onBindCollectionC() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "互感器C", + type: 'collection', + collection: "C" + }) + }, + 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 + }) + }) + } + }) + }, + changeSn(e) { + this.setData({ + sn: e.detail, + }) + }, + onConfirm(e) { + console.log("e", e) + const { type, data = {}, way } = e.detail; + const {collection, park, tenement} = this.data; + switch(type) { + case "park": + this.setData({ + park: data.id, + parkName: data.name, + selfManagement: data.selfManagement, + }) + if (park !== data.id) { + this.setData({ + tenement: null, + tenementName: null, + building: null, + buildingName: null, + meterBox: null, + meterBoxName: null, + meter: null, + meterName: null, + card: null, + cardName: null, + collectionA: null, + collectionAName: null, + collectionB: null, + collectionBName: null, + collectionB: null, + collectionBName: null, + address: null, + sharp: null, + peak: null, + flat: null, + valley: null, + area: null, + }) + } + break; + case "tenement": + this.setData({ + tenement: data.id, + tenementName: data.name, + }) + break; + case "inventoryMeter": + this.setData({ + meter: data.id, + meterName: data?.sn, + }) + break; + case "building": + this.setData({ + building: data.id, + buildingName: data.name, + }); + break; + case "meterBox": + this.setData({ + meterBox: data.id, + meterBoxName: data.address, + }); + break; + case "tenement": + this.setData({ + tenement: data.id, + tenementName: data.name, + }) + break; + case "meterType": + this.setData({ + meterType: way, + meterTypeName: data, + }); + break; + case "meter": + this.setData({ + meter: data.id, + meterName: data.address, + }); + break; + case "card": + this.setData({ + card: data.id, + cardName: data.sim_number, + }); + break; + case "collection": + let newData = {} + if (collection === "A") { + newData = { + collectionA: data.id, + collectionAName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`, + collectionARatio: data.ratio, + } + } + if (collection === "B") { + newData = { + collectionB: data.id, + collectionBName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`, + collectionBRatio: data.ratio, + } + } + if (collection === "C") { + newData = { + collectionC: data.id, + collectionCName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`, + collectionCRatio: data.ratio, + } + } + this.setData(newData); + break; + } + this.onCancel(); + }, + changeAddress(e) { + this.setData({ + address: e.detail + }) + }, + changeArea(e) { + this.setData({ + area: e.detail + }) + }, + changeOverall(e) { + this.setData({ + overall: e.detail + }) + }, + changeSharp(e) { + this.setData({ + sharp: e.detail + }) + }, + changePeak(e) { + this.setData({ + peak: e.detail + }) + }, + changeFlat(e) { + this.setData({ + flat: e.detail + }) + }, + changeValley(e) { + this.setData({ + valley: e.detail + }) + }, + changeRatio(e) { + this.setData({ + ratio: e.detail, + }) + }, + onCancel() { + this.setData({ + show: false, + title: "", + type: "", + }) + }, + onTenementFocus(e) { + const { park } = this.data; + const that = this; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "商户", + type: 'tenement' + }) + }, + async handleSubmit() { + const { + park, meter, address, building, meterBox, meterType, + ratio, area, card, collectionA, collectionB, collectionC, + tenement, sharp, peak, flat, valley, overall, url, sn, + collectionARatio, collectionBRatio, collectionCRatio + } = this.data; + if (!park || !(meter || sn) || !address || meterType == null || !building || !meterBox) { + alertInfo("请填写必填项后保存") + return; + } + if ( + (collectionA == collectionB && collectionA != null && collectionB != null) || + (collectionA == collectionC&& collectionA != null && collectionC != null) || + (collectionC == collectionB && collectionB != null && collectionC != null) + ) { + alertInfo("互感器不能重复选择") + return; + } + if ( + (collectionARatio != collectionBRatio && collectionARatio != null && collectionBRatio != null) || + (collectionARatio != collectionCRatio&& collectionARatio != null && collectionCRatio != null) || + (collectionCRatio != collectionBRatio && collectionBRatio != null && collectionCRatio != null) + ) { + alertInfo("互感器倍率不一致") + return; + } + const { code, data, message } = await installMeter({ + park, meter, address, building, meterBox, meterType, + ratio, area, card, collectionA, collectionB, collectionC, + tenement, sharp, peak, flat, valley, overall, url, sn + }) + if (code !== OK) { + alertInfo(message) + return; + } + alertSuccess("新增成功") + }, + goback() { + wx.navigateBack() + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/workBenchNew/components/installMeter/index.json b/pages/workBenchNew/components/installMeter/index.json new file mode 100644 index 0000000..e28e099 --- /dev/null +++ b/pages/workBenchNew/components/installMeter/index.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "van-popup": "@vant/weapp/popup/index", + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "van-image": "@vant/weapp/image/index", + "searchSelectWrapper": "/components/searchSelectWrapper/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/workBenchNew/components/installMeter/index.wxml b/pages/workBenchNew/components/installMeter/index.wxml new file mode 100644 index 0000000..39fc91d --- /dev/null +++ b/pages/workBenchNew/components/installMeter/index.wxml @@ -0,0 +1,192 @@ + + + + + + {{time}} + + + + + + + + + + + + + + + + + + + + + + + + + 上传 + + 清除 + + + + + + + + 提交 + 返回 + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/workBenchNew/components/installMeter/index.wxss b/pages/workBenchNew/components/installMeter/index.wxss new file mode 100644 index 0000000..9af2e92 --- /dev/null +++ b/pages/workBenchNew/components/installMeter/index.wxss @@ -0,0 +1,15 @@ +/* pages/workBenchNew/components/createMeter/index.wxss */ + +.operate { + display: flex; + padding-top: 24rpx; + padding-bottom: 36rpx; +} + +.submit, .cancel { + flex: 1; +} + +.submit { + margin-right: 30rpx; +} \ No newline at end of file diff --git a/pages/workBenchNew/components/kaihu/index.js b/pages/workBenchNew/components/kaihu/index.js new file mode 100644 index 0000000..264a79b --- /dev/null +++ b/pages/workBenchNew/components/kaihu/index.js @@ -0,0 +1,149 @@ +// pages/workBenchNew/components/kaihu/index.js +import { alertInfo, alertSuccess } from "../../../../utils/index" +import { createBackTenement, updateTenementBackInfo } from "../../../../service/tenement" +import request from "../../../../utils/request" +import { payWays, feeType as feeTypeList } from "../../../../utils/data"; +const { OK } = request; +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + onParkFocus(e) { + this.setData({ + show: true, + title: "园区", + type: 'park' + }) + }, + onBuildingFocus() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "建筑", + type: 'building' + }) + }, + onChange(e) { + const { name } = e.currentTarget.dataset; + this.setData({ + [name]: e.detail + }) + }, + onFeeTypeFocus() { + this.setData({ + show: true, + title: "收费类型", + type: 'feeType' + }) + }, + onCancel() { + this.setData({ show: false }) + }, + async onSubmit() { + const { name, shortName, address, contact, + phone, building, feeType, park, editType, id, parkName, + + } = this.data; + const { code, message } = await createBackTenement(park, { name, shortName, address, contact, phone, building, feeType }) + if (code !== OK) { + alertInfo(message) + return + } + alertSuccess("开户成功") + // wx.navigateBack() + wx.redirectTo({ + url: `/pages/workBenchNew/components/workBenchTenement/index?park=${park}&parkName=${parkName}&name=${name}`, + }) + }, + handleBack() { + wx.navigateBack() + }, + onConfirm(e) { + const { type, data, way } = e.detail; + switch(type) { + case "park": + this.setData({ + park: data.id, + parkName: data.name, + show: false, + }) + return; + case "building": + this.setData({ + building: data.id, + buildingName: data.name, + show: false, + }) + return; + case "feeType": + this.setData({ + feeTypeName: data, + feeType: way, + show: false, + }) + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/workBenchNew/components/kaihu/index.json b/pages/workBenchNew/components/kaihu/index.json new file mode 100644 index 0000000..b46458f --- /dev/null +++ b/pages/workBenchNew/components/kaihu/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "navigator": "/components/navigator/index", + "van-dialog": "@vant/weapp/dialog/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/workBenchNew/components/kaihu/index.wxml b/pages/workBenchNew/components/kaihu/index.wxml new file mode 100644 index 0000000..ff351a5 --- /dev/null +++ b/pages/workBenchNew/components/kaihu/index.wxml @@ -0,0 +1,111 @@ + + + + + + 选择 + + + + + + + + + + 选择 + + + + + 选择 + + + + + + 保存 + 返回 + + + + \ No newline at end of file diff --git a/pages/workBenchNew/components/kaihu/index.wxss b/pages/workBenchNew/components/kaihu/index.wxss new file mode 100644 index 0000000..a604f74 --- /dev/null +++ b/pages/workBenchNew/components/kaihu/index.wxss @@ -0,0 +1 @@ +/* pages/workBenchNew/components/kaihu/index.wxss */ \ No newline at end of file diff --git a/pages/workBenchNew/components/operateButton/index.js b/pages/workBenchNew/components/operateButton/index.js new file mode 100644 index 0000000..8ad1d7e --- /dev/null +++ b/pages/workBenchNew/components/operateButton/index.js @@ -0,0 +1,27 @@ +// pages/workBenchNew/components/operateButton/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + text: String, + style: String, + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + handleClick() { + this.triggerEvent("click") + } + } +}) \ No newline at end of file diff --git a/pages/workBenchNew/components/operateButton/index.json b/pages/workBenchNew/components/operateButton/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/pages/workBenchNew/components/operateButton/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/workBenchNew/components/operateButton/index.wxml b/pages/workBenchNew/components/operateButton/index.wxml new file mode 100644 index 0000000..e58adc9 --- /dev/null +++ b/pages/workBenchNew/components/operateButton/index.wxml @@ -0,0 +1,2 @@ + + {{ text }} \ No newline at end of file diff --git a/pages/workBenchNew/components/operateButton/index.wxss b/pages/workBenchNew/components/operateButton/index.wxss new file mode 100644 index 0000000..9691159 --- /dev/null +++ b/pages/workBenchNew/components/operateButton/index.wxss @@ -0,0 +1,12 @@ +/* pages/workBenchNew/components/operateButton/index.wxss */ + +.buttonWrapper { + height: 100rpx; + display: flex; + justify-content: center; + align-items: center; + border: 1rpx solid #ccc; + border-radius: 10rpx; + margin-bottom: 24rpx; + margin-top: 24rpx; +} \ No newline at end of file diff --git a/pages/workBenchNew/components/recharge/index.js b/pages/workBenchNew/components/recharge/index.js new file mode 100644 index 0000000..6c39e8e --- /dev/null +++ b/pages/workBenchNew/components/recharge/index.js @@ -0,0 +1,192 @@ +// pages/workBenchNew/components/recharge/index.js +import { handleRecharge } from "../../../../service/recharge"; +import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index"; +import request from '../../../../utils/request' +const { OK } = request; +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + onParkFocus() { + this.setData({ + show: true, + title: "园区", + type: 'park' + }) + }, + onMeterFocus() { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "电表", + type: 'meter' + }) + }, + onConfirm(e) { + const { data, type, way } = e.detail; + switch(type) { + case "park": + this.setData({ + parkName: data.name, + park: data.id, + }) + break; + case "meter": + this.setData({ + meterName: `${data.meterNo}-${data.address}${data.tenement?.name ? '-' + data.tenement?.name : ''}`, + meter: data.id, + }) + break; + case "pay": + this.setData({ + payName: data, + way: way, + }); + break; + } + this.onCancel(); + }, + onCancel() { + this.setData({ + show: false, + title: "", + type: "", + }) + }, + onPayFocus() { + this.setData({ + show: true, + title: "付款方式", + type: 'pay' + }) + }, + onChangeMoney(e) { + this.setData({ money: e.detail }) + }, + onChangeVoucherNo(e) { + this.setData({ voucherNo: e.detail }) + }, + handleClear() { + this.setData({ + park: "", + parkName: "", + meter: "", + meterName: "", + way: "", + payName: "", + show: false, + title: "", + type: "", + money: null, + voucherNo: null + }) + }, + async handleSubmit() { + const that = this; + const { park, meter, money, way, voucherNo } = this.data; + if (!park) { + alertInfo("请选择园区"); + return; + } + if (!meter) { + alertInfo("请选择电表") + return; + } + if (!money) { + alertInfo("请输入金额") + return + } + if (!way && way !== 0) { + alertInfo("请选择付款方式") + return + } + if (!voucherNo) { + alertInfo("请输入凭证号") + return + } + loadingFunc(async () => { + const { code, message } = await handleRecharge(park, { + amount: `${money || ''}`, + meter, + paymentType: way, + voucherNo, + type: 0 + }) + if (code !== OK) { + alertInfo(message) + return + } + alertSuccess("充值成功") + setTimeout(() => { + that.handleClear() + that.setData({ + + }) + }, 500) + }) + + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/workBenchNew/components/recharge/index.json b/pages/workBenchNew/components/recharge/index.json new file mode 100644 index 0000000..4e12d5e --- /dev/null +++ b/pages/workBenchNew/components/recharge/index.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "van-popup": "@vant/weapp/popup/index", + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "searchSelectWrapper": "/components/searchSelectWrapper/index", + "navigator": "/components/navigator" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/workBenchNew/components/recharge/index.wxml b/pages/workBenchNew/components/recharge/index.wxml new file mode 100644 index 0000000..868329b --- /dev/null +++ b/pages/workBenchNew/components/recharge/index.wxml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + 确认 + 清空 + + \ No newline at end of file diff --git a/pages/workBenchNew/components/recharge/index.wxss b/pages/workBenchNew/components/recharge/index.wxss new file mode 100644 index 0000000..b1ed3a3 --- /dev/null +++ b/pages/workBenchNew/components/recharge/index.wxss @@ -0,0 +1 @@ +/* pages/workBenchNew/components/recharge/index.wxss */ \ No newline at end of file diff --git a/pages/workBenchNew/components/uninstallMeter/index.js b/pages/workBenchNew/components/uninstallMeter/index.js new file mode 100644 index 0000000..62ed294 --- /dev/null +++ b/pages/workBenchNew/components/uninstallMeter/index.js @@ -0,0 +1,243 @@ +// pages/workBenchNew/components/uninstallMeter/index.js +import { uninstallMeter, } from "../../../../service/meter"; +import dayjs from "../../../../utils/dayjs" +import request from "../../../../utils/request" +import { alertInfo, alertSuccess, loadingFunc} from "../../../../utils/index" +import { uploadUninstallMeter } from "../../../../service/public" + +const { OK } = request; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + 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 { type, data = {} } = e.detail; + const {collection} = this.data; + switch(type) { + case "park": + this.setData({ + park: data.id, + parkName: data.name, + }) + break; + case "tenement": + this.setData({ + tenement: data.id, + tenementName: data.name, + }) + break; + case "building": + this.setData({ + building: data.id, + buildingName: data.name, + }); + break; + case "meterBox": + this.setData({ + meterBox: data.id, + meterBoxName: data.address, + }); + break; + case "meterType": + this.setData({ + meterType: data.way, + meterTypeName: data, + }); + break; + case "meter": + this.setData({ + meter: data.id, + meterName: data.address, + meterInfo: data, + }); + break; + case "card": + this.setData({ + card: data.id, + cardName: data.sim_number, + }); + break; + case "collection": + let newData = {} + if (collection === "A") { + newData = { + collectionA: data.id, + collectionAName: data.name, + } + } + if (collection === "B") { + newData = { + collectionB: data.id, + collectionBName: data.name, + } + } + if (collection === "C") { + newData = { + collectionC: data.id, + collectionCName: data.name, + } + } + this.setData(newData); + break; + } + this.onCancel(); + }, + onCancel() { + this.setData({ + show: false, + title: "", + type: "", + }) + }, + async onSubmit() { + const { meter, reason, url, meterInfo } = this.data; + if (!meter) { + alertInfo("请选择表号") + return; + } + const { code, message } = await uninstallMeter({sn: meterInfo.meterSn, images: url, reason}) + 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 uploadUninstallMeter(tempFilePaths) + if (code !== OK) { + alertError(message) + return + } + that.setData({ + url: url + }) + }) + } + }) + }, + clearImage() { + this.setData({ + url: "" + }) + }, + showImage() { + this.setData({ + imageShow: true + }) + }, + onClose() { + this.setData({ + imageShow: false + }) + }, + goback() { + wx.navigateBack() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + time: dayjs().format("YYYY-MM-DD HH:mm:ss") + }) + }, + changeReason(e) { + this.setData({ + reason: e.detail, + }) + }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/workBenchNew/components/uninstallMeter/index.json b/pages/workBenchNew/components/uninstallMeter/index.json new file mode 100644 index 0000000..003c648 --- /dev/null +++ b/pages/workBenchNew/components/uninstallMeter/index.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "van-popup": "@vant/weapp/popup/index", + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "searchSelectWrapper": "/components/searchSelectWrapper/index", + "van-image": "@vant/weapp/image/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/workBenchNew/components/uninstallMeter/index.wxml b/pages/workBenchNew/components/uninstallMeter/index.wxml new file mode 100644 index 0000000..a3b5474 --- /dev/null +++ b/pages/workBenchNew/components/uninstallMeter/index.wxml @@ -0,0 +1,83 @@ + + + + + + {{time}} + + + + + + + + + 上传 + + 清除 + + + + + + + + 提交 + 返回 + + + + + + + + + + \ No newline at end of file diff --git a/pages/workBenchNew/components/uninstallMeter/index.wxss b/pages/workBenchNew/components/uninstallMeter/index.wxss new file mode 100644 index 0000000..7d468e2 --- /dev/null +++ b/pages/workBenchNew/components/uninstallMeter/index.wxss @@ -0,0 +1,15 @@ +/* pages/workBenchNew/components/uninstallMeter/index.wxss */ + +.operate { + display: flex; + padding-top: 24rpx; + padding-bottom: 36rpx; +} + +.submit, .cancel { + flex: 1; +} + +.submit { + margin-right: 30rpx; +} \ No newline at end of file diff --git a/pages/workBenchNew/components/workBenchApprove/index.wxml b/pages/workBenchNew/components/workBenchApprove/index.wxml index 1339053..66420fb 100644 --- a/pages/workBenchNew/components/workBenchApprove/index.wxml +++ b/pages/workBenchNew/components/workBenchApprove/index.wxml @@ -1,17 +1,14 @@ - + - + 待审核 - + 已审核 - - 充值 - diff --git a/pages/workBenchNew/components/workBenchMeterControl/index.js b/pages/workBenchNew/components/workBenchMeterControl/index.js new file mode 100644 index 0000000..7238e8b --- /dev/null +++ b/pages/workBenchNew/components/workBenchMeterControl/index.js @@ -0,0 +1,279 @@ +// 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' + }) + }, + onModeFocus(e) { + this.setData({ + show: true, + title: "强控类型", + type: 'meterMode' + }) + }, + onMeterFocus(e) { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "电表", + type: 'meter' + }) + }, + onConfirm(e) { + const { data, type, way } = e.detail; + const that = this; + switch(type) { + case "park": + this.setData({ + parkName: data.name, + park: data.id, + }) + break; + case "meterMode": + this.setData({ + modeName: data, + mode: way, + }) + 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 }) + }, + changeDays(e) { + this.setData({ + days: e.detail, + }) + }, + handleSubmit() { + const { } = this.data; + }, + 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: "" + }) + }, + changeReason(e) { + this.setData({ + reason: 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() { + + } +}) \ No newline at end of file diff --git a/pages/workBenchNew/components/workBenchMeterControl/index.json b/pages/workBenchNew/components/workBenchMeterControl/index.json new file mode 100644 index 0000000..cf25777 --- /dev/null +++ b/pages/workBenchNew/components/workBenchMeterControl/index.json @@ -0,0 +1,20 @@ +{ + "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", + "van-popup": "@vant/weapp/popup/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/workBenchNew/components/workBenchMeterControl/index.wxml b/pages/workBenchNew/components/workBenchMeterControl/index.wxml new file mode 100644 index 0000000..97a2091 --- /dev/null +++ b/pages/workBenchNew/components/workBenchMeterControl/index.wxml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + {{item.tenement.shortName}} + + {{item.tenement.name}} + + + + + + + + + 商户电表 + + 公摊电表 + + 园区电表 + 表号:{{item.meterNo}} + + + + + + + + {{item.address}} + + SN:{{item.meterSn}} + + + + + + + + 表字:{{item.amount}} + + 余额:{{item.money}} + + + + + + + + 合闸 + 拉闸 + + + + 在线 + 预付费 + 强控 + 临时强控 + + + + + 失联 + 预付费 + 强控 + 临时强控 + + + + + + + + + + + + + + + + + 上传 + + 清除 + + + + + + + + 提交 + 返回 + + + + + + + + diff --git a/pages/workBenchNew/components/workBenchMeterControl/index.wxss b/pages/workBenchNew/components/workBenchMeterControl/index.wxss new file mode 100644 index 0000000..d259093 --- /dev/null +++ b/pages/workBenchNew/components/workBenchMeterControl/index.wxss @@ -0,0 +1,78 @@ +/* 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; + } + + + .operate { + display: flex; + padding-top: 24rpx; + padding-bottom: 36rpx; +} + +.submit, .cancel { + flex: 1; +} + +.submit { + margin-right: 30rpx; +} diff --git a/pages/workBenchNew/components/workBenchReading/index.js b/pages/workBenchNew/components/workBenchReading/index.js index 6f02a68..b19578d 100644 --- a/pages/workBenchNew/components/workBenchReading/index.js +++ b/pages/workBenchNew/components/workBenchReading/index.js @@ -1,5 +1,5 @@ // pages/workBenchNew/components/workBenchReading/index.js -import { getMeterReadingRouteList, changeMeterRouteStatus } from "../../../../service/workBench" +import { getMeterReadingRouteList, changeMeterRouteStatus, checkReadingFinish } from "../../../../service/workBench" import { alertError, alertSuccess, loadingFunc } from "../../../../utils/index" import request from "../../../../utils/request" const { OK } = request @@ -72,6 +72,10 @@ Page({ that.jumpToReading({ currentTarget: { dataset: { id } } }) }, 500) }, + // async checkFinish(id) { + + // return {data, num}; + // }, async changeEndStatus(e) { const that = this; wx.showModal({ @@ -83,10 +87,38 @@ Page({ } if (res.confirm) { - const { id, routeid: routeId } = e.currentTarget.dataset; - const { code, message } = await changeMeterRouteStatus({ id, status: 0, routeId }) + const { id, routeid: routeId } = e.currentTarget.dataset; + const { code, message, data, num } = await checkReadingFinish(id || this.data.routeId); if (code !== OK) { alertError(message) + return; + } + console.log("data", data, "num", num) + if (!data) { + wx.showModal({ + title: '提示', + content: `该路线还有${num}块电表还没有抄完,是否确认结束结束抄表?`, + complete: async (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + const { code: cd, message } = await changeMeterRouteStatus({ id, status: 0, routeId }) + if (cd !== OK) { + alertError(message) + return + } + alertSuccess("操作成功") + that.init() + } + } + }) + return + } + const { code: c, message: m } = await changeMeterRouteStatus({ id, status: 0, routeId }) + if (c !== OK) { + alertError(m) return } alertSuccess("操作成功") diff --git a/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.js b/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.js index 75f4d98..9c14c04 100644 --- a/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.js +++ b/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.js @@ -107,12 +107,12 @@ Component({ return; } this.setData({ - overall: Number(data?.overall || 0), - critical: Number(data?.sharp || 0), - peak: Number(data?.peak || 0), - flat: Number(data?.flat || 0), - valley: Number(data?.valley || 0), - deepValley: Number(data?.deepValley || 0), + overall: data?.overall ? Number(data?.overall || 0) : null, + critical: data?.overall ? Number(data?.sharp || 0) : null, + peak: data?.overall ? Number(data?.peak || 0) : null, + flat: data?.overall ? Number(data?.flat || 0) : null, + valley: data?.overall ? Number(data?.valley || 0) : null, + deepValley: data?.deepValley ? Number(data?.deepValley || 0) : null, meter04kvType: data?.meter04kvType, status: data?.breakType ? '合闸' : "分闸", }) diff --git a/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.wxml b/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.wxml index be4eea3..96d2d15 100644 --- a/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.wxml +++ b/pages/workBenchNew/components/workBenchTenement/components/bindMeter/index.wxml @@ -122,6 +122,7 @@ park="{{park}}" bindconfirm="onConfirm" bindcancel="onCancel" + filterBind="{{true}}" /> - + + + 通用操作 + + + + + + + + + + + + + + + + + + + + + + + 现场操作 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 回到首页 diff --git a/pages/workBenchNew/index.wxss b/pages/workBenchNew/index.wxss index 421c238..c220f08 100644 --- a/pages/workBenchNew/index.wxss +++ b/pages/workBenchNew/index.wxss @@ -1,7 +1,7 @@ /* pages/workBench/index.wxss */ .wrapper { - margin: 20rpx 0rpx; + margin:20rpx 0rpx; } .contentWrapper { diff --git a/pages/workBenchTodoList/index.js b/pages/workBenchTodoList/index.js new file mode 100644 index 0000000..bedbce6 --- /dev/null +++ b/pages/workBenchTodoList/index.js @@ -0,0 +1,225 @@ +// pages/workBenchTodoList/index.js +import request from "../../utils/request" +import { getWorkOrderList } from "../../service/workBench" +import { alertInfo, loadingFunc } from "../../utils/index"; +import { noticeFlowType } from "../../utils/data" +const { OK } = request +Page({ + + /** + * 页面的初始数据 + */ + data: { + page: 1, + size: 20, + noticeFlowType, + actionItems: [{ + name: '确认', + value: 'status' + }], + }, + showActionMenu(e) { + console.log("e", e) + this.setData({ + currentActionSheet: e.currentTarget.dataset.id + }); +}, +hideActionMenu() { + this.setData({ + currentActionSheet: null + }); +}, +onMenuSelect(e) { + const { + value + } = e.detail; + const id = e.currentTarget.dataset.id; + + if (value === 'detail') { + this.jumpToDetail(id); + } +}, + jumpToDetail(id) { + + // wx.navigateTo({ + // url: '/pages/workOrderDetail/index?id=' + id, + // }) + }, + onConfirm(e) { + const { type, data = {}, way } = e.detail; + const that = this; + switch(type) { + case "park": + this.setData({ + park: data.id, + parkName: data.name, + }) + break; + case "tenement": + this.setData({ + tenement: data.id, + tenementName: data.name, + }) + break; + + case "noticeFlowType": + this.setData({ + noticeFlowType: data, + noticeFlowTypeName: data, + page: 1, + }, () => { + loadingFunc(async () => { + await that.init() + }) + }); + break; + case "noticeFlowStatus": + this.setData({ + noticeFlowStatus: data, + noticeFlowStatusName: data, + page: 1, + }, () => { + loadingFunc(async () => { + await that.init() + }) + }); + break; + case "meter": + this.setData({ + meter: data.id, + meterName: data.address, + meterInfo: data, + page: 1, + }, () => { + loadingFunc(async () => { + await that.init() + }) + }); + break; + } + this.onCancel(); + }, + onCancel() { + this.setData({ + show: false, + title: "", + type: "", + }) + }, + onParkFocus(e) { + this.setData({ + show: true, + title: "园区", + type: 'park' + }) + }, + onNoticeFlowFocus() { + this.setData({ + show: true, + title: "类型", + type: 'noticeFlowType' + }) + }, + onNoticeFlowStatusFocus() { + this.setData({ + show: true, + title: "确认状态", + type: 'noticeFlowStatus' + }) + }, + onMeterFocus(e) { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "电表", + type: 'meter' + }) + }, + onChangePage(e) { + const that = this; + this.setData({ + page: e.detail.currentIndex, + }, () => { + loadingFunc(async () => { + await that.init() + }) + }) + }, + async init() { + const { page, size, park, tenement, meter, noticeFlowType, noticeFlowStatus, time } = this.data; + const { code, message, data, total } = await getWorkOrderList({ page, size, park, tenement, meter, type: noticeFlowType, time, status: noticeFlowStatus }) + if (code !== OK) { + alertInfo(message) + return; + } + this.setData({ + list: data?.map(item => { + item.time = item?.created_at?.slice(0, 10) + item.address = item?.target?.meter_data?.address; + return item; + }), + totalPage: Math.ceil(total / size), + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + loadingFunc(async () => { + await this.init() + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/workBenchTodoList/index.json b/pages/workBenchTodoList/index.json new file mode 100644 index 0000000..ede92dd --- /dev/null +++ b/pages/workBenchTodoList/index.json @@ -0,0 +1,23 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "van-popup": "@vant/weapp/popup/index", + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index", + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "searchSelectWrapper": "/components/searchSelectWrapper/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-dialog": "@vant/weapp/dialog/index", + "van-icon": "@vant/weapp/icon/index", + "van-action-sheet": "@vant/weapp/action-sheet/index" + + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/workBenchTodoList/index.wxml b/pages/workBenchTodoList/index.wxml new file mode 100644 index 0000000..0d26819 --- /dev/null +++ b/pages/workBenchTodoList/index.wxml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + 时间 + 类型 + 电表地址 + 状态 + 操作 + + + + + + + {{ item.time }} + + + {{ noticeFlowType[item.types - 1] }} + + + + {{ item.address }} + + + {{ item.flow_status === 1 ? "处理中" : "已确认" }} + + + + 确认 + + + + + + + + + + + + + + + + + + + + diff --git a/pages/workBenchTodoList/index.wxss b/pages/workBenchTodoList/index.wxss new file mode 100644 index 0000000..ea6fa96 --- /dev/null +++ b/pages/workBenchTodoList/index.wxss @@ -0,0 +1,71 @@ +/* pages/workBenchTodoList/index.wxss */ + +.table { + width: 500rpx; + +} + +.tableWrapper { + width: 100vw; + overflow-x: auto; +} + +.thead { + + display: flex; + flex-wrap: nowrap; + +} + +.thead .th { + padding: 10rpx; + white-space: nowrap; + text-align: center; + box-sizing: border-box; +} + +.primaryTextBtn { + color: #1989fa; + } + +.tbody { + width: 500rpx; +} + +.tbody .tr { + padding: 10rpx; + border-bottom: 1rpx solid #EEEEEE; + display: flex; + align-items: center; + flex-wrap: nowrap; +} + +.tbody .tr { + word-break: break-all; + text-align: center; +} + +.more-icon { + padding: 20rpx; + color: #1989fa; + display: flex; + justify-content: center; + align-items: center; + } + +/* 基础标签样式 */ +.tag { + display: inline-block; + padding: 4px 5px; + margin-right: 0px; + border-radius: 16px; + background: #07c160; + color: white; + font-size: 25rpx; + } + + /* 激活状态样式 */ + .tag.active { + background: #07c160; + color: white; + } \ No newline at end of file diff --git a/pages/workOrderDetail/index.js b/pages/workOrderDetail/index.js new file mode 100644 index 0000000..9b339ba --- /dev/null +++ b/pages/workOrderDetail/index.js @@ -0,0 +1,66 @@ +// pages/workOrderDetail/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/workOrderDetail/index.json b/pages/workOrderDetail/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/workOrderDetail/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/workOrderDetail/index.wxml b/pages/workOrderDetail/index.wxml new file mode 100644 index 0000000..15d3210 --- /dev/null +++ b/pages/workOrderDetail/index.wxml @@ -0,0 +1,2 @@ + +pages/workOrderDetail/index.wxml \ No newline at end of file diff --git a/pages/workOrderDetail/index.wxss b/pages/workOrderDetail/index.wxss new file mode 100644 index 0000000..d1b82a2 --- /dev/null +++ b/pages/workOrderDetail/index.wxss @@ -0,0 +1 @@ +/* pages/workOrderDetail/index.wxss */ \ No newline at end of file diff --git a/pages/writeReading/components/photo/index.js b/pages/writeReading/components/photo/index.js index 93839f7..dc6a657 100644 --- a/pages/writeReading/components/photo/index.js +++ b/pages/writeReading/components/photo/index.js @@ -43,13 +43,13 @@ Component({ } var tempFilePaths = res.tempFilePath; loadingFunc(async () => { - const { code, message, data } = await uploadOcrFile(tempFilePaths) + const { code, message, data, url } = await uploadOcrFile(tempFilePaths) if (code !== OK) { alertError(message) return } setTimeout(() => { - that.triggerEvent("finish", { number: data?.integer + "." + data?.decimal || 0, success: data?.integer != null && data?.integer !== "" }) + that.triggerEvent("finish", { number: data?.integer + "." + data?.decimal || 0, success: data?.integer != null && data?.integer !== "", url }) }, 100) }) diff --git a/pages/writeReading/components/readingInfo/index.js b/pages/writeReading/components/readingInfo/index.js index bd56a56..95fcfa4 100644 --- a/pages/writeReading/components/readingInfo/index.js +++ b/pages/writeReading/components/readingInfo/index.js @@ -72,13 +72,14 @@ Component({ wx.navigateBack() }, onPhotoFinish(e) { - const { number, success } = e.detail; + const { number, success, url } = e.detail; const { meterInfo } = this.data; if (success) { this.setData({ currentNumber: `${Number(number)}`, calcNumber: isNaN(Number(number)) ? 0 : Number(number), - diff: isNaN(Number(number)) ? "-" : (Number(number || 0) - Number(meterInfo.overall)).toFixed(2) + diff: isNaN(Number(number)) ? "-" : (Number(number || 0) - Number(meterInfo.overall)).toFixed(2), + url, }) alertSuccess("获取成功") } else { @@ -86,13 +87,14 @@ Component({ } }, async onSubmit() { - const { meterInfo, currentNumber, routeId } = this.data; + const { meterInfo, currentNumber, routeId, url } = this.data; const { parkId, id } = meterInfo; const { code, message } = await createReading(parkId, id, routeId, { overall: `${currentNumber}`, flat: `${currentNumber}`, readAt: dayjs().format("YYYY-MM-DD HH:mm:ss"), source: 1, + url }) if (code !== OK) { alertError(message) diff --git a/project.private.config.json b/project.private.config.json index c2f655c..422eecd 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -24,8 +24,15 @@ "miniprogram": { "list": [ { - "name": "pages/workBenchNew/components/workBenchReading/index", - "pathName": "pages/workBenchNew/components/workBenchReading/index", + "name": "pages/workBenchTodoList/index", + "pathName": "pages/workBenchTodoList/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/workBenchNew/components/uninstallMeter/index", + "pathName": "pages/workBenchNew/components/uninstallMeter/index", "query": "", "launchMode": "default", "scene": null @@ -36,76 +43,6 @@ "query": "", "launchMode": "default", "scene": null - }, - { - "name": "pages/writeReading/index", - "pathName": "pages/writeReading/index", - "query": "id=PR00118027286020097", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/readingHistory/index", - "pathName": "pages/readingHistory/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/workBench/index", - "pathName": "pages/workBench/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/workBench/index", - "pathName": "pages/workBench/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "childPackage/pages/electricQuery/index", - "pathName": "childPackage/pages/electricQuery/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/workBench/index", - "pathName": "pages/workBench/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "childPackage/pages/electricQuery/index", - "pathName": "childPackage/pages/electricQuery/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/workBench/index", - "pathName": "pages/workBench/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "childPackage/pages/electricQuery/index", - "pathName": "childPackage/pages/electricQuery/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "childPackage/pages/electricQuery/index", - "pathName": "childPackage/pages/electricQuery/index", - "query": "", - "launchMode": "default", - "scene": null } ] } diff --git a/service/meter.js b/service/meter.js index 14d3b57..276cc0e 100644 --- a/service/meter.js +++ b/service/meter.js @@ -23,8 +23,8 @@ export const getParkMeterList = async function({park = "", keyword = "", page = } // 获取某一园区下的简洁电表列表 -export const getParkSimpleMeterList = async function({park = "", keyword = "", page = 1}) { - return await GET(`/work/getWorkMeter?page=${page}&park=${park}&keyword=${replaceSpecialIcon(keyword)}`); +export const getParkSimpleMeterList = async function({park = "", keyword = "", page = 1, isNeedBind}) { + return await GET(`/work/getWorkMeter?page=${page}&park=${park}&keyword=${replaceSpecialIcon(keyword)}&isNeedBind=${isNeedBind}`); } @@ -40,4 +40,36 @@ export const handleOperateMeterSwitch = async function({ ids = [], status }) { // 绑定时获取电表的最新信息 export const getWorkMeterDetail = async function(code = '') { return await GET(`/vx/getWorkMeterDetail?code=${code}`); +} + +// 获取某一园区下的电表箱列表 +export const getParkBoxList = async function({park = "", keyword = "", page = 1}) { + return await GET(`/box/${park}?page=${page}&keyword=${replaceSpecialIcon(keyword)}`); +} + +// 获取卡列表 +export const getCardList = async function({park = "", keyword = "", page = 1}) { + return await GET(`/equipment/getCardList?page=${page}&park=${park}&keyword=${replaceSpecialIcon(keyword)}`); +} + + +// 获取互感器列表 +export const getCollectionList = async function({park = "", keyword = "", page = 1}) { + return await GET(`/transformer/list/select?page=${page}&park=${park}&transformerId=${replaceSpecialIcon(keyword)}`); +} + + +// 获取库存电表列表 +export const getInventoryMeter = async function({park = "", keyword = "", page = 1}) { + return await GET(`/electricity/list?page=${page}&park=${park}&keyword=${replaceSpecialIcon(keyword)}`); +} + +// 新装电表 +export const installMeter = async function(data) { + return await POST(`/wx/workBench/installMeter`, data); +} + +// 拆表 +export const uninstallMeter = async function({sn = "", reason = "", images = ""}) { + return await DELETE(`/flow/doMeterRemoveApproval?sn=${sn}&reason=${reason}&images=${images}`); } \ No newline at end of file diff --git a/service/public.js b/service/public.js index 4b9d431..a7c1acd 100644 --- a/service/public.js +++ b/service/public.js @@ -43,6 +43,46 @@ export const uploadOcrFile = (filePath) => { }) } +export const uploadInstallMeter = (filePath) => { + const { api } = getConfigByEnv(); + return new Promise((resolve, reject) => { + wx.uploadFile({ + filePath: filePath, + name: 'data', + url: `${api}/image/meter/reading`, + header: { + authorization: 'Bearer ' + wx.getStorageSync("token") + }, + success: (res) => { + resolve(res?.data ? JSON.parse(res?.data) : res?.data); + }, + fail: (err) => { + reject(err); + } + }) + }) +} + +export const uploadUninstallMeter = (filePath) => { + const { api } = getConfigByEnv(); + return new Promise((resolve, reject) => { + wx.uploadFile({ + filePath: filePath, + name: 'data', + url: `${api}/image/meter/delete`, + header: { + authorization: 'Bearer ' + wx.getStorageSync("token") + }, + success: (res) => { + resolve(res?.data ? JSON.parse(res?.data) : res?.data); + }, + fail: (err) => { + reject(err); + } + }) + }) +} + export const uploadPublicFile = (filePath) => { const { api } = getConfigByEnv(); return new Promise((resolve, reject) => { diff --git a/service/workBench.js b/service/workBench.js index a079d17..61f0169 100644 --- a/service/workBench.js +++ b/service/workBench.js @@ -49,4 +49,11 @@ export const checkReadingFinish = async function(id) { // 获取工作台首页 export const getWorkBenchHome = async function() { return await GET(`/workHome/mainPage`,); +} + +// 获取工单列表 +export const getWorkOrderList = async function({ + page, size, park = "", meter = "", tenement = "", status = "", type = "", time = "" +}) { + return await GET(`/noticeFlow/getDisposeList?page=${page}&size=${size}&park=${park}&meter=${meter}&tenement=${tenement}&status=${status}&type=${type}&time=${time}`,); } \ No newline at end of file diff --git a/utils/data.js b/utils/data.js index 22c17b0..b9c09b9 100644 --- a/utils/data.js +++ b/utils/data.js @@ -9,4 +9,11 @@ export const getRechargeOperateWay = (num) => { return payWays[num]; } -export const feeType = ['华昌宝能收费', "物业代收1", "物业代收2", "物业代收线损"] \ No newline at end of file +export const feeType = ['华昌宝能收费', "物业代收1", "物业代收2", "物业代收线损"] + +export const meterType = ['商户电表', '园区电表', '公摊电表'] + +export const noticeFlowType = ['拆表', '装表', '开户', "解绑", "绑定"] +export const noticeFlowStatus = ["已确认", "待确认"] + +export const meterMode = ["预付费", "强控", "临时强控"] \ No newline at end of file