.
This commit is contained in:
parent
a635ac4d69
commit
be7220a679
@ -85,6 +85,21 @@ export function getIrrigateScenario(id) {
|
||||
})
|
||||
}
|
||||
|
||||
// 禁用轮灌-轮灌方案(逻辑)
|
||||
export function disabled(id) {
|
||||
return request({
|
||||
url: `/system/irrigateScenario/disabled/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 启用轮灌-轮灌方案(逻辑)
|
||||
export function undisabled(id) {
|
||||
return request({
|
||||
url: `/system/irrigateScenario/undisabled/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,12 +115,4 @@ export function updateIrrigateScenario(data) {
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除轮灌-轮灌方案
|
||||
export function delIrrigateScenario(id) {
|
||||
return request({
|
||||
url: '/irrigate/irrigateScenario/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -125,71 +125,62 @@
|
||||
// 删除
|
||||
removeItem(item) {
|
||||
this.$showConfirm(`删除"${item.groupName}"?`).then(res => {
|
||||
if (res.confirm) {
|
||||
isApi.removeBatchControl(item.id).then(res => {
|
||||
this.queryList();
|
||||
this.$toast("删除成功")
|
||||
});
|
||||
}
|
||||
})
|
||||
isApi.removeBatchControl(item.id).then(res => {
|
||||
this.queryList();
|
||||
this.$toast("删除成功")
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 开阀
|
||||
batchControlExec(isMemory, item) {
|
||||
this.$showConfirm("执行批量开阀?").then(res => {
|
||||
if (res.confirm) {
|
||||
this.disabled = true;
|
||||
isApi.batchControlExec(isMemory, item.id).then(res => {
|
||||
this.disabled = false;
|
||||
if (res.data && res.data.length) {
|
||||
this.$toast(`"${res.data.toString()}"以上阀门执行异常`)
|
||||
this.disabled = true;
|
||||
isApi.batchControlExec(isMemory, item.id).then(res => {
|
||||
this.disabled = false;
|
||||
if (res.data && res.data.length) {
|
||||
this.$toast(`"${res.data.toString()}"以上阀门执行异常`)
|
||||
}
|
||||
uni.showModal({
|
||||
title: '开阀完成',
|
||||
content: "仅表示命令发送成功,不代表阀门执行成功,请留意阀门状态,以阀门上报状态为准。",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
uni.showModal({
|
||||
title: '开阀完成',
|
||||
content: "仅表示命令发送成功,不代表阀门执行成功,请留意阀门状态,以阀门上报状态为准。",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 关阀
|
||||
batchControlClose(item) {
|
||||
this.$showConfirm("执行批量关阀?").then(res => {
|
||||
if (res.confirm) {
|
||||
this.disabled = true;
|
||||
isApi.batchControlClose(item.id).then(res => {
|
||||
this.disabled = false;
|
||||
if (res.data && res.data.length) {
|
||||
this.$toast(`"${res.data.toString()}"以上阀门执行异常`)
|
||||
this.disabled = true;
|
||||
isApi.batchControlClose(item.id).then(res => {
|
||||
this.disabled = false;
|
||||
if (res.data && res.data.length) {
|
||||
this.$toast(`"${res.data.toString()}"以上阀门执行异常`)
|
||||
}
|
||||
uni.showModal({
|
||||
title: '关阀完成',
|
||||
content: "仅表示命令发送成功,不代表阀门执行成功,请留意阀门状态,以阀门上报状态为准。",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
uni.showModal({
|
||||
title: '关阀完成',
|
||||
content: "仅表示命令发送成功,不代表阀门执行成功,请留意阀门状态,以阀门上报状态为准。",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 角度记忆
|
||||
saveBatchControlAngle(item) {
|
||||
this.$showConfirm("执行角度记忆?").then(res => {
|
||||
if (res.confirm) {
|
||||
this.disabled = true;
|
||||
isApi.saveBatchControlAngle(item.id).then(res => {
|
||||
this.disabled = false;
|
||||
this.$toast("记忆成功");
|
||||
this.queryList();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.disabled = true;
|
||||
isApi.saveBatchControlAngle(item.id).then(res => {
|
||||
this.disabled = false;
|
||||
this.$toast("记忆成功");
|
||||
this.queryList();
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 分享
|
||||
share() {
|
||||
|
@ -284,12 +284,10 @@
|
||||
// 下发列表
|
||||
sendTopoList(item) {
|
||||
this.$showConfirm("下发列表").then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.gvl(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.gvl(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 修改频段
|
||||
SLF(item) {
|
||||
@ -301,12 +299,10 @@
|
||||
// 获取配置
|
||||
getStationConfig(item) {
|
||||
this.$showConfirm("获取配置").then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.gsc(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.gsc(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 压力校准
|
||||
pressureCalibrationTopo(item) {
|
||||
@ -325,12 +321,10 @@
|
||||
// 升级
|
||||
upgradeStation(item) {
|
||||
this.$showConfirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.upgradeStation(item.deviceCode, item.newDeviceVersionId).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.upgradeStation(item.deviceCode, item.newDeviceVersionId).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 设备升级
|
||||
upgradeTopoValve(item) {
|
||||
@ -349,18 +343,16 @@
|
||||
// }
|
||||
let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode }】的频段为【${this.rolaFrequency.new}】?`;
|
||||
this.$showConfirm(msg).then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.slf({
|
||||
deviceCode: this.rolaFrequency.item.deviceCode,
|
||||
oldFrequency: this.rolaFrequency.old,
|
||||
newFrequency: this.rolaFrequency.new
|
||||
}).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
} else {
|
||||
this.pop.rolaFrequency = true;
|
||||
}
|
||||
})
|
||||
DevOpsApi.slf({
|
||||
deviceCode: this.rolaFrequency.item.deviceCode,
|
||||
oldFrequency: this.rolaFrequency.old,
|
||||
newFrequency: this.rolaFrequency.new
|
||||
}).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {
|
||||
this.pop.rolaFrequency = true;
|
||||
});
|
||||
},
|
||||
|
||||
/************************************************** 4G阀门 **************************************************/
|
||||
@ -374,14 +366,11 @@
|
||||
},
|
||||
// 设备升级
|
||||
upgradeValve4(item) {
|
||||
console.error("设备升级:", item);
|
||||
this.$showConfirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.upgradeValve4G(item.deviceCode, item.newDeviceVersionId).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.upgradeValve4G(item.deviceCode, item.newDeviceVersionId).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 压力校准
|
||||
pressureCalibrationValve4(item) {
|
||||
|
@ -189,12 +189,10 @@
|
||||
// 下发列表
|
||||
sendList(item) {
|
||||
this.$showConfirm("下发列表").then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.gvl(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.gvl(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 修改频段
|
||||
editRolaFrequency(item) {
|
||||
@ -206,12 +204,10 @@
|
||||
// 获取配置
|
||||
getConfig(item) {
|
||||
this.$showConfirm("获取配置").then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.gsc(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.gsc(item.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 压力校准
|
||||
pressureCalibration(item) {
|
||||
@ -230,12 +226,10 @@
|
||||
// 升级
|
||||
upgrade(item) {
|
||||
this.$showConfirm("基站升级").then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.stationUpgrade(item.deviceCode, item.newDeviceVersionId).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.stationUpgrade(item.deviceCode, item.newDeviceVersionId).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 设备升级
|
||||
valveUpgrade(item) {
|
||||
@ -257,18 +251,16 @@
|
||||
// }
|
||||
let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode }】的频段为【${this.rolaFrequency.new}】?`;
|
||||
this.$showConfirm(msg).then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.slf({
|
||||
deviceCode: this.rolaFrequency.item.deviceCode,
|
||||
oldFrequency: this.rolaFrequency.old,
|
||||
newFrequency: this.rolaFrequency.new
|
||||
}).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
} else {
|
||||
this.pop.rolaFrequency = true;
|
||||
}
|
||||
})
|
||||
DevOpsApi.slf({
|
||||
deviceCode: this.rolaFrequency.item.deviceCode,
|
||||
oldFrequency: this.rolaFrequency.old,
|
||||
newFrequency: this.rolaFrequency.new
|
||||
}).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {
|
||||
this.pop.rolaFrequency = true;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@
|
||||
// that.mqttConnected = e.connected;
|
||||
} else if (e.type == "msg") {
|
||||
if (e.topic.includes("jsy/iot/deviceConfig/2/") || e.topic.includes(
|
||||
"jsy/iot/deviceConfig/13/")) {
|
||||
"jsy/iot/deviceConfig/13/")) {
|
||||
const arr = e.topic.split("/");
|
||||
const deviceCode = arr[4];
|
||||
let obj = that.dataObj[deviceCode] || {};
|
||||
@ -159,7 +159,7 @@
|
||||
lf: e.data.data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
that.dataObj[deviceCode] = obj;
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,8 @@
|
||||
if (rows && rows.length) {
|
||||
let topic = [];
|
||||
rows.forEach(item => {
|
||||
topic.push(`jsy/iot/deviceConfig/${item.device.deviceTypeId}/${item.device.deviceCode}`);//获取配置
|
||||
topic.push(
|
||||
`jsy/iot/deviceConfig/${item.device.deviceTypeId}/${item.device.deviceCode}`); //获取配置
|
||||
});
|
||||
this.topics = topic;
|
||||
getApp().mqttSubscribes(this.topics);
|
||||
@ -202,12 +203,10 @@
|
||||
// 获取配置
|
||||
getConfig(item) {
|
||||
this.$showConfirm("获取配置").then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.gvc(item.device.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
DevOpsApi.gvc(item.device.deviceCode).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 关闭弹出层
|
||||
close() {
|
||||
@ -226,19 +225,17 @@
|
||||
// }
|
||||
let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode}】的频段为【${this.rolaFrequency.new}】?`;
|
||||
this.$showConfirm(msg).then(res => {
|
||||
if (res.confirm) {
|
||||
DevOpsApi.vlf({
|
||||
stationCode: this.station.deviceCode,
|
||||
deviceCode: this.rolaFrequency.item.deviceCode,
|
||||
oldFrequency: this.rolaFrequency.old,
|
||||
newFrequency: this.rolaFrequency.new
|
||||
}).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
} else {
|
||||
this.pop.rolaFrequency = true;
|
||||
}
|
||||
})
|
||||
DevOpsApi.vlf({
|
||||
stationCode: this.station.deviceCode,
|
||||
deviceCode: this.rolaFrequency.item.deviceCode,
|
||||
oldFrequency: this.rolaFrequency.old,
|
||||
newFrequency: this.rolaFrequency.new
|
||||
}).then(res => {
|
||||
this.$toast(res.msg)
|
||||
})
|
||||
}).catch(() => {
|
||||
this.pop.rolaFrequency = true;
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
|
@ -692,32 +692,30 @@
|
||||
//导航
|
||||
mapNavigation() {
|
||||
this.$showConfirm(`导航至"${this.title}"?`).then(res => {
|
||||
if (res.confirm) {
|
||||
const centerPoint = JSON.parse(this.mapObj.landMap.centerPoint);
|
||||
const lat = centerPoint[1]
|
||||
const lng = centerPoint[0]
|
||||
let url = '';
|
||||
const appName = appInfo.name; // 替换为你的应用名
|
||||
const name = this.title; // 名称
|
||||
// 高德地图
|
||||
if (uni.getSystemInfoSync().platform === 'android') { // Android 平台
|
||||
url =
|
||||
`androidamap://route/plan/?sourceApplication=${appName}&sid=BGVIS1&did=BGVIS2&dlat=${lat}&dlon=${lng}&dname=${encodeURIComponent(name)}&mode=driving`;
|
||||
} else if (uni.getSystemInfoSync().platform === 'ios') { // iOS 平台
|
||||
url = `iosamap://path?sourceApplication=${appName}&mldl=${lat},${lng}`;
|
||||
}
|
||||
|
||||
// // 百度地图 mode:driving:驾车模式。walking:步行模式。transit:公交模式。
|
||||
// url = `baidumap://map/direction?destination=latlng:${lat},${lng}|name:${encodeURIComponent(name)}&mode=driving`;
|
||||
// 尝试打开地图
|
||||
plus.runtime.openURL(url, function(err) {
|
||||
uni.showToast({
|
||||
title: '未安装应用',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
const centerPoint = JSON.parse(this.mapObj.landMap.centerPoint);
|
||||
const lat = centerPoint[1]
|
||||
const lng = centerPoint[0]
|
||||
let url = '';
|
||||
const appName = appInfo.name; // 替换为你的应用名
|
||||
const name = this.title; // 名称
|
||||
// 高德地图
|
||||
if (uni.getSystemInfoSync().platform === 'android') { // Android 平台
|
||||
url =
|
||||
`androidamap://route/plan/?sourceApplication=${appName}&sid=BGVIS1&did=BGVIS2&dlat=${lat}&dlon=${lng}&dname=${encodeURIComponent(name)}&mode=driving`;
|
||||
} else if (uni.getSystemInfoSync().platform === 'ios') { // iOS 平台
|
||||
url = `iosamap://path?sourceApplication=${appName}&mldl=${lat},${lng}`;
|
||||
}
|
||||
});
|
||||
|
||||
// // 百度地图 mode:driving:驾车模式。walking:步行模式。transit:公交模式。
|
||||
// url = `baidumap://map/direction?destination=latlng:${lat},${lng}|name:${encodeURIComponent(name)}&mode=driving`;
|
||||
// 尝试打开地图
|
||||
plus.runtime.openURL(url, function(err) {
|
||||
uni.showToast({
|
||||
title: '未安装应用',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 测距
|
||||
mapRanging() {
|
||||
@ -727,10 +725,8 @@
|
||||
return;
|
||||
}
|
||||
this.$showConfirm(`开启测距,开启后再次点击关闭。`).then(res => {
|
||||
if (res.confirm) {
|
||||
this.mapObj.ranging = true;
|
||||
}
|
||||
});
|
||||
this.mapObj.ranging = true;
|
||||
}).catch(() => {});
|
||||
},
|
||||
//设备状态更新
|
||||
mapUpdateMarker(e) {
|
||||
@ -769,28 +765,26 @@
|
||||
case 'sfj':
|
||||
case 'sb':
|
||||
this.$showConfirm("确定打开首部设备?").then(res => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading()
|
||||
getHeadDevice(e.device.deviceId).then((res) => {
|
||||
uni.hideLoading()
|
||||
if (res.data.deviceTypeId === 4) {
|
||||
if (res.data.controlMode == 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/head/fertilizerapplicator/detail?item=${JSON.stringify(res.data)}`,
|
||||
});
|
||||
} else if (item.controlMode == 2) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/head/fertilizerapplicator/detailkl?item=${JSON.stringify(res.data)}`,
|
||||
});
|
||||
} else {}
|
||||
} else if (res.data.deviceTypeId === 5) {
|
||||
uni.showLoading()
|
||||
getHeadDevice(e.device.deviceId).then((res) => {
|
||||
uni.hideLoading()
|
||||
if (res.data.deviceTypeId === 4) {
|
||||
if (res.data.controlMode == 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/head/headdevice/detail?item=${JSON.stringify(res.data)}`,
|
||||
url: `/pages/head/fertilizerapplicator/detail?item=${JSON.stringify(res.data)}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (item.controlMode == 2) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/head/fertilizerapplicator/detailkl?item=${JSON.stringify(res.data)}`,
|
||||
});
|
||||
} else {}
|
||||
} else if (res.data.deviceTypeId === 5) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/head/headdevice/detail?item=${JSON.stringify(res.data)}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(() => {});
|
||||
|
||||
break;
|
||||
case 'qxz':
|
||||
@ -799,36 +793,34 @@
|
||||
case 'sxt':
|
||||
case 'scd':
|
||||
this.$showConfirm("确定打开农情设备?").then(res => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading()
|
||||
getOtherDevice(e.device.deviceId).then((res) => {
|
||||
uni.hideLoading()
|
||||
let url = null;
|
||||
if (res.data.deviceTypeId === 6) {
|
||||
url =
|
||||
`/pages/fourmonitor/weatherstation?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 7) {
|
||||
url =
|
||||
`/pages/fourmonitor/pest?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 8) {
|
||||
url =
|
||||
`/pages/fourmonitor/spore?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 9) {
|
||||
if (!res.data.ezopenUrl1 || !res.data.ezopenUrl2) {
|
||||
this.$toast("获取播放地址失败!")
|
||||
return;
|
||||
}
|
||||
url =
|
||||
`/pages/fourmonitor/camera?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 10) {}
|
||||
if (url) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
uni.showLoading()
|
||||
getOtherDevice(e.device.deviceId).then((res) => {
|
||||
uni.hideLoading()
|
||||
let url = null;
|
||||
if (res.data.deviceTypeId === 6) {
|
||||
url =
|
||||
`/pages/fourmonitor/weatherstation?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 7) {
|
||||
url =
|
||||
`/pages/fourmonitor/pest?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 8) {
|
||||
url =
|
||||
`/pages/fourmonitor/spore?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 9) {
|
||||
if (!res.data.ezopenUrl1 || !res.data.ezopenUrl2) {
|
||||
this.$toast("获取播放地址失败!")
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
url =
|
||||
`/pages/fourmonitor/camera?item=${encodeURIComponent(JSON.stringify(res.data))}`;
|
||||
} else if (res.data.deviceTypeId === 10) {}
|
||||
if (url) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(() => {});
|
||||
break;
|
||||
case 'sq':
|
||||
this.$refs.mpRef.show(this.ijs.land, e.device.id);
|
||||
|
@ -3,7 +3,9 @@
|
||||
<custom-nav-bar :left="false" leftText="" @leftClick="" title="轮灌">
|
||||
<template v-slot:right>
|
||||
<view class="fixed">
|
||||
<view align="right" class="iconfont icon-jia1 icon" @click="add"></view>
|
||||
<view align="right" class="iconfont icon-jia1 icon" @click="editTask()" v-show="tab.current === 0" />
|
||||
<view align="right" class="iconfont icon-jia1 icon" @click="editScenario()" v-show="tab.current === 1"
|
||||
v-hasPermi="['irrigate:irrigateScenario:saveIrrigateScenario']" />
|
||||
</view>
|
||||
</template>
|
||||
</custom-nav-bar>
|
||||
@ -128,6 +130,10 @@
|
||||
<view>
|
||||
<view class="text">方案名称:{{item.scenarioName}}</view>
|
||||
</view>
|
||||
<view class="title-r">
|
||||
<uni-tag class="bg-green" :circle="true" text="启用" v-if="item.delFlag == '0'" />
|
||||
<uni-tag class="bg-red" :circle="true" text="禁用" v-else />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content">
|
||||
@ -135,56 +141,28 @@
|
||||
<view class="txt-list" @click="irrigationgroup(item)">
|
||||
<view class="list2">
|
||||
<view><text>轮灌组数量:</text>{{item.groupNum}}</view>
|
||||
<view><text>压力:</text>{{item.pressureMin}}-{{item.pressureMax}}</view>
|
||||
<view><text>总时长:</text>{{item.irrigateTotalDuration}}</view>
|
||||
<view><text>自动调压:</text>{{item.isAutoAdjust == 0 ? '否':'是'}}</view>
|
||||
<view><text>压力:</text>{{`${item.pressureMin} - ${item.pressureMax}`}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="iconfont icon-you">
|
||||
</view>
|
||||
<view class="iconfont icon-you" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-font">
|
||||
<u-button type="success" size="mini" text="编辑" @click="editScenario(item)" />
|
||||
<u-button type="success" size="mini" text="启用" />
|
||||
<u-button type="success" size="mini" text="禁用" />
|
||||
<u-button v-hasPermi="['irrigate:irrigateScenario:saveIrrigateScenario']"
|
||||
type="success" size="mini" text="编辑" @click="editScenario(item)" />
|
||||
<u-button v-hasPermi="['irrigate:irrigateScenario:delFlag']" size="mini"
|
||||
type="error" text="禁用" @click="updateScenario(item,true)"
|
||||
v-if="item.delFlag == '0'" />
|
||||
<u-button v-hasPermi="['irrigate:irrigateScenario:delFlag']" size="mini"
|
||||
type="success" text="启用" @click="updateScenario(item,false)" v-else />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</view>
|
||||
<!-- <view class="card">
|
||||
<uni-collapse>
|
||||
<uni-collapse-item title-border="none" :border="false" :show-arrow="false">
|
||||
<template v-slot:title>
|
||||
<view class="cards-title">
|
||||
<view>
|
||||
<view class="text">方案名称:006</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<view class="content">
|
||||
<view class="cards-content">
|
||||
<view class="txt-list">
|
||||
<view class="list2">
|
||||
<view><text>轮灌组数量:</text>5</view>
|
||||
<view><text>压力:</text>0.2</view>
|
||||
<view><text>总时长:</text>10</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="iconfont icon-you">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-font">
|
||||
<u-button class="bg-red" type="success" size="mini" text="禁用" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</view> -->
|
||||
</z-paging>
|
||||
</view>
|
||||
</view>
|
||||
@ -221,23 +199,16 @@
|
||||
isApi.list({
|
||||
scenarioType: 2,
|
||||
status: "0",
|
||||
delFlag: "0",
|
||||
// delFlag: "0",
|
||||
}).then(res => {
|
||||
this.scenario = res.rows;
|
||||
this.$refs.pagingScenario.completeByTotal(res.rows, res.total);
|
||||
})
|
||||
},
|
||||
add() {
|
||||
if (this.tab.current === 0) { //新增任务
|
||||
|
||||
}
|
||||
if (this.tab.current === 1) { //新增轮灌
|
||||
uni.navigateTo({
|
||||
url: '/pages/irrigation/scenario/scenario'
|
||||
});
|
||||
}
|
||||
},
|
||||
/********************************* 任务 *********************************/
|
||||
editTask(item = null) {
|
||||
|
||||
},
|
||||
//页面跳转
|
||||
taskdetails() {
|
||||
uni.navigateTo({
|
||||
@ -246,17 +217,40 @@
|
||||
},
|
||||
|
||||
/********************************* 方案 *********************************/
|
||||
//方案编辑
|
||||
editScenario(item = null) {
|
||||
let url = `/pages/irrigation/scenario/scenario`
|
||||
if (item) {
|
||||
url = `${url}?id=${item.id}`
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
//方案详情
|
||||
irrigationgroup(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/irrigation/scenario/detail?id=${item.id}`
|
||||
});
|
||||
},
|
||||
editScenario(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/irrigation/scenario/scenario?id=${item.id}`
|
||||
});
|
||||
},
|
||||
//方案删除
|
||||
updateScenario(item, disabled) {
|
||||
if (disabled) {
|
||||
this.$showConfirm(`禁用"${item.scenarioName}"?`).then(() => {
|
||||
isApi.disabled(item.id).then(res => {
|
||||
this.$toast("禁用成功");
|
||||
this.queryScenario();
|
||||
})
|
||||
}).catch(() => {});
|
||||
} else {
|
||||
this.$showConfirm(`启用"${item.scenarioName}"?`).then(() => {
|
||||
isApi.undisabled(item.id).then(res => {
|
||||
this.$toast("启用成功");
|
||||
this.queryScenario();
|
||||
})
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -342,15 +342,13 @@
|
||||
itemChange(wo, vItem) {
|
||||
if (this.selected[`${wo.id}_${vItem.valveNo}`]) {
|
||||
this.$showConfirm("更换到当前轮灌组?").then(res => {
|
||||
if (res.confirm) {
|
||||
//删除之前存储的组中的数据
|
||||
this.removeWo(this.selected[`${wo.id}_${vItem.valveNo}`].gIndex, wo.id, vItem.valveNo);
|
||||
delete this.selected[`${wo.id}_${vItem.valveNo}`];
|
||||
//删除之前存储的组中的数据
|
||||
this.removeWo(this.selected[`${wo.id}_${vItem.valveNo}`].gIndex, wo.id, vItem.valveNo);
|
||||
delete this.selected[`${wo.id}_${vItem.valveNo}`];
|
||||
|
||||
//添加新选中的
|
||||
this.setSelect(wo, vItem);
|
||||
}
|
||||
})
|
||||
//添加新选中的
|
||||
this.setSelect(wo, vItem);
|
||||
}).catch(() => {});
|
||||
return;
|
||||
}
|
||||
//添加新选中的
|
||||
@ -490,40 +488,39 @@
|
||||
this.groupPop = false;
|
||||
const groupName = this.formData.groups[index].groupName;
|
||||
this.$showConfirm(`删除"${groupName}"?`).then(res => {
|
||||
this.groupPop = true;
|
||||
if (res.confirm) {
|
||||
//删除轮灌组
|
||||
this.formData.groups[index]._isHide = true;
|
||||
let i = 0;
|
||||
this.formData.groups.forEach(item => {
|
||||
if (item._isHide) {
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
item.groupName = `轮灌组${i}`;
|
||||
item.sort = i;
|
||||
});
|
||||
this.formData.groupNum = i;
|
||||
this.calcAVGDuration();
|
||||
//删除轮灌组
|
||||
this.formData.groups[index]._isHide = true;
|
||||
let i = 0;
|
||||
this.formData.groups.forEach(item => {
|
||||
if (item._isHide) {
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
item.groupName = `轮灌组${i}`;
|
||||
item.sort = i;
|
||||
});
|
||||
this.formData.groupNum = i;
|
||||
this.calcAVGDuration();
|
||||
|
||||
//删除存储的数据
|
||||
if (this.gIndex == index) { //删除的是当前的组
|
||||
this.select = {};
|
||||
} else { //不是当前组
|
||||
for (var key in this.selected) {
|
||||
let item = this.selected[key];
|
||||
if (item.gIndex == index) {
|
||||
delete this.selected[key];
|
||||
} else {
|
||||
this.selected[key].text = this.formData.groups[item.gIndex].groupName;
|
||||
}
|
||||
//删除存储的数据
|
||||
if (this.gIndex == index) { //删除的是当前的组
|
||||
this.select = {};
|
||||
} else { //不是当前组
|
||||
for (var key in this.selected) {
|
||||
let item = this.selected[key];
|
||||
if (item.gIndex == index) {
|
||||
delete this.selected[key];
|
||||
} else {
|
||||
this.selected[key].text = this.formData.groups[item.gIndex].groupName;
|
||||
}
|
||||
}
|
||||
|
||||
//新的编辑组索引
|
||||
this.selectIndex = true;
|
||||
this.$toast("删除成功,轮灌组重新排序")
|
||||
}
|
||||
|
||||
//新的编辑组索引
|
||||
this.selectIndex = true;
|
||||
this.$toast("删除成功,轮灌组重新排序")
|
||||
}).catch(() => {
|
||||
this.groupPop = true;
|
||||
});
|
||||
},
|
||||
//新增轮灌组
|
||||
@ -554,17 +551,21 @@
|
||||
this.$toast(`"${title}"未选择出水口`)
|
||||
return;
|
||||
}
|
||||
formData.groups.forEach((item, index) => {
|
||||
item.wos = item.wos.slice().sort((v1, v2) => woSort(v1, v2, "woName"));
|
||||
item.wos.forEach((_item, _index) => {
|
||||
_item.sort = (_index + 1)
|
||||
})
|
||||
})
|
||||
this.$showConfirm("保存轮灌方案?").then(res => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading();
|
||||
isApi.saveIrrigateScenario(formData).then(res => {
|
||||
uni.hideLoading();
|
||||
uni.switchTab({
|
||||
url: '/pages/irrigation/index'
|
||||
});
|
||||
uni.showLoading();
|
||||
isApi.saveIrrigateScenario(formData).then(res => {
|
||||
uni.hideLoading();
|
||||
uni.switchTab({
|
||||
url: '/pages/irrigation/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,11 @@ export function showConfirm(content) {
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
success: function(res) {
|
||||
resolve(res)
|
||||
if (res.confirm) {
|
||||
resolve(res)
|
||||
} else {
|
||||
reject(res);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user