新装电表参数问题

This commit is contained in:
2025-11-04 17:14:04 +08:00
parent 5573c78b23
commit c5a8bdfd81
3 changed files with 65 additions and 16 deletions

View File

@@ -62,6 +62,7 @@ Component({
}, },
onConfirm(event) { onConfirm(event) {
const { index } = event.detail; const { index } = event.detail;
console.log("index", index)
const { list = [], type } = this.data; const { list = [], type } = this.data;
const item = list[index]; const item = list[index];
if (!item) { if (!item) {
@@ -73,7 +74,7 @@ Component({
list: [], list: [],
searchText: "" searchText: ""
}) })
this.triggerEvent("confirm", { data: item, type } ); this.triggerEvent("confirm", { data: item, type, index } );
}, },
onPayConfirm(event) { onPayConfirm(event) {
const { index } = event.detail; const { index } = event.detail;
@@ -156,7 +157,6 @@ Component({
alertInfo(message) alertInfo(message)
return return
} }
console.log("parks", parks)
this.setData({ this.setData({
columns: parks?.map(item => `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`), columns: parks?.map(item => `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`),
list: parks, list: parks,

View File

@@ -174,14 +174,21 @@ Page({
} }
}) })
}, },
changeSn(e) {
this.setData({
sn: e.detail,
})
},
onConfirm(e) { onConfirm(e) {
const { type, data = {} } = e.detail; console.log("e", e)
const { type, data = {}, way } = e.detail;
const {collection, park, tenement} = this.data; const {collection, park, tenement} = this.data;
switch(type) { switch(type) {
case "park": case "park":
this.setData({ this.setData({
park: data.id, park: data.id,
parkName: data.name, parkName: data.name,
selfManagement: data.selfManagement,
}) })
if (park !== data.id) { if (park !== data.id) {
this.setData({ this.setData({
@@ -193,6 +200,20 @@ Page({
meterBoxName: null, meterBoxName: null,
meter: null, meter: null,
meterName: 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; break;
@@ -228,7 +249,7 @@ Page({
break; break;
case "meterType": case "meterType":
this.setData({ this.setData({
meterType: data.way, meterType: way,
meterTypeName: data, meterTypeName: data,
}); });
break; break;
@@ -249,19 +270,22 @@ Page({
if (collection === "A") { if (collection === "A") {
newData = { newData = {
collectionA: data.id, collectionA: data.id,
collectionAName: `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`, collectionAName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`,
collectionARatio: data.ratio,
} }
} }
if (collection === "B") { if (collection === "B") {
newData = { newData = {
collectionB: data.id, collectionB: data.id,
collectionBName: `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`, collectionBName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`,
collectionBRatio: data.ratio,
} }
} }
if (collection === "C") { if (collection === "C") {
newData = { newData = {
collectionC: data.id, collectionC: data.id,
collectionCName: `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`, collectionCName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`,
collectionCRatio: data.ratio,
} }
} }
this.setData(newData); this.setData(newData);
@@ -291,7 +315,7 @@ Page({
}, },
changePeak(e) { changePeak(e) {
this.setData({ this.setData({
sharp: e.detail peak: e.detail
}) })
}, },
changeFlat(e) { changeFlat(e) {
@@ -333,17 +357,33 @@ Page({
const { const {
park, meter, address, building, meterBox, meterType, park, meter, address, building, meterBox, meterType,
ratio, area, card, collectionA, collectionB, collectionC, 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; } = this.data;
if (!park || !meter || !address || meterType == null) { if (!park || !(meter || sn) || !address || meterType == null) {
alertInfo("请填写必填项后保存") alertInfo("请填写必填项后保存")
return; 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({ const { code, data, message } = await installMeter({
park, meter, address, building, meterBox, meterType, park, meter, address, building, meterBox, meterType,
ratio, area, card, collectionA, collectionB, collectionC, ratio, area, card, collectionA, collectionB, collectionC,
tenement, sharp, peak, flat, valley, overall, url tenement, sharp, peak, flat, valley, overall, url, sn
}) })
if (code !== OK) { if (code !== OK) {
alertInfo(message) alertInfo(message)

View File

@@ -25,8 +25,17 @@
text="{{meterName}}" text="{{meterName}}"
bind:search="onMeterFocus" bind:search="onMeterFocus"
required="{{true}}" required="{{true}}"
wx:if="{{selfManagement === 0}}"
/>
<searchSelectWrapper
label="SN"
placeholder="请输入sn"
text="{{sn}}"
type="input"
bind:changeText="changeSn"
required="{{true}}"
wx:if="{{selfManagement === 1}}"
/> />
<searchSelectWrapper <searchSelectWrapper
label="选择建筑" label="选择建筑"
placeholder="请选择建筑" placeholder="请选择建筑"
@@ -78,19 +87,19 @@
<searchSelectWrapper <searchSelectWrapper
label="采集器A" label="采集器A"
placeholder="请选择采集器绑定(选填)" placeholder="请选择采集器绑定(选填)"
text="{{collectionA}}" text="{{collectionAName}}"
bind:search="onBindCollectionA" bind:search="onBindCollectionA"
/> />
<searchSelectWrapper <searchSelectWrapper
label="采集器B" label="采集器B"
placeholder="请选择采集器绑定(选填)" placeholder="请选择采集器绑定(选填)"
text="{{collectionB}}" text="{{collectionBName}}"
bind:search="onBindCollectionB" bind:search="onBindCollectionB"
/> />
<searchSelectWrapper <searchSelectWrapper
label="采集器C" label="采集器C"
placeholder="请选择采集器绑定(选填)" placeholder="请选择采集器绑定(选填)"
text="{{collectionC}}" text="{{collectionCName}}"
bind:search="onBindCollectionC" bind:search="onBindCollectionC"
/> />
<searchSelectWrapper <searchSelectWrapper