新装电表参数问题

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) {
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,

View File

@@ -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)

View File

@@ -25,8 +25,17 @@
text="{{meterName}}"
bind:search="onMeterFocus"
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
label="选择建筑"
placeholder="请选择建筑"
@@ -78,19 +87,19 @@
<searchSelectWrapper
label="采集器A"
placeholder="请选择采集器绑定(选填)"
text="{{collectionA}}"
text="{{collectionAName}}"
bind:search="onBindCollectionA"
/>
<searchSelectWrapper
label="采集器B"
placeholder="请选择采集器绑定(选填)"
text="{{collectionB}}"
text="{{collectionBName}}"
bind:search="onBindCollectionB"
/>
<searchSelectWrapper
label="采集器C"
placeholder="请选择采集器绑定(选填)"
text="{{collectionC}}"
text="{{collectionCName}}"
bind:search="onBindCollectionC"
/>
<searchSelectWrapper