新装电表参数问题
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user