diff --git a/components/searchSelect/index.js b/components/searchSelect/index.js index c30dd46..88d9507 100644 --- a/components/searchSelect/index.js +++ b/components/searchSelect/index.js @@ -62,6 +62,7 @@ Component({ }, onConfirm(event) { const { index } = event.detail; + console.log("index", index) const { list = [], type } = this.data; const item = list[index]; if (!item) { @@ -73,7 +74,7 @@ Component({ list: [], searchText: "" }) - this.triggerEvent("confirm", { data: item, type } ); + this.triggerEvent("confirm", { data: item, type, index } ); }, onPayConfirm(event) { const { index } = event.detail; @@ -156,7 +157,6 @@ Component({ alertInfo(message) return } - console.log("parks", parks) this.setData({ columns: parks?.map(item => `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`), list: parks, diff --git a/pages/workBenchNew/components/installMeter/index.js b/pages/workBenchNew/components/installMeter/index.js index f53ca81..8fa9355 100644 --- a/pages/workBenchNew/components/installMeter/index.js +++ b/pages/workBenchNew/components/installMeter/index.js @@ -174,14 +174,21 @@ Page({ } }) }, + changeSn(e) { + this.setData({ + sn: e.detail, + }) + }, onConfirm(e) { - const { type, data = {} } = e.detail; + 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({ @@ -193,6 +200,20 @@ Page({ 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; @@ -228,7 +249,7 @@ Page({ break; case "meterType": this.setData({ - meterType: data.way, + meterType: way, meterTypeName: data, }); break; @@ -249,19 +270,22 @@ Page({ if (collection === "A") { newData = { collectionA: data.id, - collectionAName: `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`, + collectionAName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`, + collectionARatio: data.ratio, } } if (collection === "B") { newData = { collectionB: data.id, - collectionBName: `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`, + collectionBName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`, + collectionBRatio: data.ratio, } } if (collection === "C") { newData = { collectionC: data.id, - collectionCName: `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`, + collectionCName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`, + collectionCRatio: data.ratio, } } this.setData(newData); @@ -291,7 +315,7 @@ Page({ }, changePeak(e) { this.setData({ - sharp: e.detail + peak: e.detail }) }, changeFlat(e) { @@ -333,17 +357,33 @@ Page({ const { park, meter, address, building, meterBox, meterType, ratio, area, card, collectionA, collectionB, collectionC, - tenement, sharp, peak, flat, valley, overall, url + tenement, sharp, peak, flat, valley, overall, url, sn, + collectionARatio, collectionBRatio, collectionCRatio } = this.data; - if (!park || !meter || !address || meterType == null) { + if (!park || !(meter || sn) || !address || meterType == null) { alertInfo("请填写必填项后保存") return; } - console.log("data", this.data) + 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 + tenement, sharp, peak, flat, valley, overall, url, sn }) if (code !== OK) { alertInfo(message) diff --git a/pages/workBenchNew/components/installMeter/index.wxml b/pages/workBenchNew/components/installMeter/index.wxml index 1390b99..f01674a 100644 --- a/pages/workBenchNew/components/installMeter/index.wxml +++ b/pages/workBenchNew/components/installMeter/index.wxml @@ -25,8 +25,17 @@ text="{{meterName}}" bind:search="onMeterFocus" required="{{true}}" + wx:if="{{selfManagement === 0}}" +/> + -