From 549b7bf511a1825d8aa975887b30c6d6403dea8d Mon Sep 17 00:00:00 2001 From: Iruka <1017819588@qq.com> Date: Thu, 20 Feb 2025 11:34:19 +0800 Subject: [PATCH] . --- api/dev-ops/index.js | 8 ++++++++ pages/batch-control/index.vue | 8 ++++---- pages/dev-ops/device.vue | 16 ++++++++++------ pages/dev-ops/station.vue | 8 ++++---- pages/dev-ops/valve.vue | 4 ++-- pages/index-map.vue | 8 ++++---- pages/irrigation/index.vue | 10 +++++----- pages/irrigation/scenario/scenarioGroup.vue | 6 +++--- pages/irrigation/task/detail.vue | 6 +++--- pages/irrigation/task/task.vue | 2 +- plugins/modal.js | 3 ++- 11 files changed, 46 insertions(+), 33 deletions(-) diff --git a/api/dev-ops/index.js b/api/dev-ops/index.js index de2bcb7..0dfc920 100644 --- a/api/dev-ops/index.js +++ b/api/dev-ops/index.js @@ -70,4 +70,12 @@ export function upgradeValve4G(code, dvId) { url: `/system/dev-ops/upgradeValve4G/${code}/${dvId}`, method: 'get' }) +} + +// 基站升级 +export function resetStationDevice(code, dvId) { + return request({ + url: `/system/dev-ops/resetStationDevice/${code}`, + method: 'get' + }) } \ No newline at end of file diff --git a/pages/batch-control/index.vue b/pages/batch-control/index.vue index cc2c068..7a15992 100644 --- a/pages/batch-control/index.vue +++ b/pages/batch-control/index.vue @@ -131,7 +131,7 @@ }, // 删除 removeItem(item) { - this.$showConfirm(`删除"${item.groupName}"?`).then(res => { + plugins.modal.confirm(`删除"${item.groupName}"?`).then(() => { isApi.removeBatchControl(item.id).then(res => { this.queryList(); plugins.modal.msg("删除成功") @@ -140,7 +140,7 @@ }, // 开阀 batchControlExec(isMemory, item) { - this.$showConfirm("执行批量开阀?").then(res => { + plugins.modal.confirm(`执行批量开阀?`).then(() => { this.disabled = true; isApi.batchControlExec(isMemory, item.id).then(res => { this.disabled = false; @@ -160,7 +160,7 @@ }, // 关阀 batchControlClose(item) { - this.$showConfirm("执行批量关阀?").then(res => { + plugins.modal.confirm(`执行批量关阀?`).then(() => { this.disabled = true; isApi.batchControlClose(item.id).then(res => { this.disabled = false; @@ -180,7 +180,7 @@ }, // 角度记忆 saveBatchControlAngle(item) { - this.$showConfirm("执行角度记忆?").then(res => { + plugins.modal.confirm(`执行角度记忆?`).then(() => { this.disabled = true; isApi.saveBatchControlAngle(item.id).then(res => { this.disabled = false; diff --git a/pages/dev-ops/device.vue b/pages/dev-ops/device.vue index 667d4d2..396f1bd 100644 --- a/pages/dev-ops/device.vue +++ b/pages/dev-ops/device.vue @@ -662,7 +662,7 @@ }, // 下发列表 sendTopoList(item) { - this.$showConfirm("下发列表").then(res => { + plugins.modal.confirm(`下发列表`).then(() => { DevOpsApi.gvl(item.deviceCode).then(res => { plugins.modal.msg(res.msg) }) @@ -677,7 +677,7 @@ }, // 获取配置 getStationConfig(item) { - this.$showConfirm("获取配置").then(res => { + plugins.modal.confirm(`获取配置`).then(() => { DevOpsApi.gsc(item.deviceCode).then(res => { plugins.modal.msg(res.msg) }) @@ -690,6 +690,8 @@ // 重启 restartStation(item) { console.error("重启:", item); + + }, // 子设备 topoDevice(item) { @@ -699,7 +701,7 @@ }, // 升级 upgradeStation(item) { - this.$showConfirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(res => { + plugins.modal.confirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(() => { DevOpsApi.upgradeStation(item.deviceCode, item.newDeviceVersionId).then(res => { plugins.modal.msg(res.msg) }) @@ -721,7 +723,7 @@ // return; // } let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode }】的频段为【${this.rolaFrequency.new}】?`; - this.$showConfirm(msg).then(res => { + plugins.modal.confirm(msg).then(() => { DevOpsApi.slf({ deviceCode: this.rolaFrequency.item.deviceCode, oldFrequency: this.rolaFrequency.old, @@ -745,7 +747,7 @@ }, // 设备升级 upgradeValve4(item) { - this.$showConfirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(res => { + plugins.modal.confirm(`升级"${item.deviceCode}"到"${item.newVersionName}"版本?`).then(() => { DevOpsApi.upgradeValve4G(item.deviceCode, item.newDeviceVersionId).then(res => { plugins.modal.msg(res.msg) }) @@ -805,9 +807,11 @@ deviceCode: item.deviceCode, controlValve: item.data.items.m.value == 1 ? 0 : 1 }; - this.$showConfirm(`切换运行模式为"${(m == 1 ? "自动" : "手动" )}"?`).then(res => { + plugins.modal.confirm(`切换运行模式为"${(m == 1 ? "自动" : "手动" )}"?`).then(() => { controlHeadSwitch(par).then(res => { item.data.items.m.value = m; + }) controlHeadSwitch(par).then(res => { + item.data.items.m.value = m; }) }).catch(() => {}); }, diff --git a/pages/dev-ops/station.vue b/pages/dev-ops/station.vue index d2ad8f9..b4d295f 100644 --- a/pages/dev-ops/station.vue +++ b/pages/dev-ops/station.vue @@ -189,7 +189,7 @@ }, // 下发列表 sendList(item) { - this.$showConfirm("下发列表").then(res => { + plugins.modal.confirm("下发列表").then(() => { DevOpsApi.gvl(item.deviceCode).then(res => { plugins.modal.msg(res.msg) }) @@ -204,7 +204,7 @@ }, // 获取配置 getConfig(item) { - this.$showConfirm("获取配置").then(res => { + plugins.modal.confirm("获取配置").then(() => { DevOpsApi.gsc(item.deviceCode).then(res => { plugins.modal.msg(res.msg) }) @@ -226,7 +226,7 @@ }, // 升级 upgrade(item) { - this.$showConfirm("基站升级").then(res => { + plugins.modal.confirm("基站升级").then(() => { DevOpsApi.stationUpgrade(item.deviceCode, item.newDeviceVersionId).then(res => { plugins.modal.msg(res.msg) }) @@ -251,7 +251,7 @@ // return; // } let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode }】的频段为【${this.rolaFrequency.new}】?`; - this.$showConfirm(msg).then(res => { + plugins.modal.confirm(msg).then(() => { DevOpsApi.slf({ deviceCode: this.rolaFrequency.item.deviceCode, oldFrequency: this.rolaFrequency.old, diff --git a/pages/dev-ops/valve.vue b/pages/dev-ops/valve.vue index 52ca5d1..8761a19 100644 --- a/pages/dev-ops/valve.vue +++ b/pages/dev-ops/valve.vue @@ -202,7 +202,7 @@ }, // 获取配置 getConfig(item) { - this.$showConfirm("获取配置").then(res => { + plugins.modal.confirm("获取配置").then(() => { DevOpsApi.gvc(item.device.deviceCode).then(res => { plugins.modal.msg(res.msg) }) @@ -224,7 +224,7 @@ // return; // } let msg = `您确定要修改【${this.rolaFrequency.item.deviceCode}】的频段为【${this.rolaFrequency.new}】?`; - this.$showConfirm(msg).then(res => { + plugins.modal.confirm(msg).then(() => { DevOpsApi.vlf({ stationCode: this.station.deviceCode, deviceCode: this.rolaFrequency.item.deviceCode, diff --git a/pages/index-map.vue b/pages/index-map.vue index 6fe7ddd..6b001ad 100644 --- a/pages/index-map.vue +++ b/pages/index-map.vue @@ -699,7 +699,7 @@ }, //导航 mapNavigation() { - this.$showConfirm(`导航至"${this.title}"?`).then(res => { + plugins.modal.confirm(`导航至"${this.title}"?`).then(() => { const centerPoint = JSON.parse(this.mapObj.landMap.centerPoint); const lat = centerPoint[1] const lng = centerPoint[0] @@ -732,7 +732,7 @@ plugins.modal.msg("测距已关闭") return; } - this.$showConfirm(`开启测距,开启后再次点击关闭。`).then(res => { + plugins.modal.confirm(`开启测距,开启后再次点击关闭。`).then(() => { this.mapObj.ranging = true; }).catch(() => {}); }, @@ -772,7 +772,7 @@ break; case 'sfj': case 'sb': - this.$showConfirm("确定打开首部设备?").then(res => { + plugins.modal.confirm("确定打开首部设备?").then(() => { uni.showLoading() getHeadDevice(e.device.deviceId).then((res) => { uni.hideLoading() @@ -800,7 +800,7 @@ case 'bz': case 'sxt': case 'scd': - this.$showConfirm("确定打开农情设备?").then(res => { + plugins.modal.confirm("确定打开农情设备?").then(() => { uni.showLoading() getOtherDevice(e.device.deviceId).then((res) => { uni.hideLoading() diff --git a/pages/irrigation/index.vue b/pages/irrigation/index.vue index f013f3d..6478fb8 100644 --- a/pages/irrigation/index.vue +++ b/pages/irrigation/index.vue @@ -196,14 +196,14 @@ }, //删除任务 delTask(item) { - this.$showConfirm(`删除"${item.taskName}"?`).then(() => { + plugins.modal.confirm(`删除"${item.taskName}"?`).then(() => { taskApi.delTask(item.id).then(res => { plugins.modal.msg("删除成功") this.reload(); }).catch(err => { - this.$showConfirm(err, false).then(() => { + plugins.modal.confirm(err, false).then(() => { this.reload(); - }) + }).catch(() => {}); }) }).catch(() => {}); }, @@ -236,14 +236,14 @@ //方案删除 updateScenario(item, disabled) { if (disabled) { - this.$showConfirm(`禁用"${item.scenarioName}"?`).then(() => { + plugins.modal.confirm(`禁用"${item.scenarioName}"?`).then(() => { isApi.disabled(item.id).then(res => { plugins.modal.msg("禁用成功") this.reload(); }) }).catch(() => {}); } else { - this.$showConfirm(`启用"${item.scenarioName}"?`).then(() => { + plugins.modal.confirm(`启用"${item.scenarioName}"?`).then(() => { isApi.enable(item.id).then(res => { plugins.modal.msg("启用成功") this.reload(); diff --git a/pages/irrigation/scenario/scenarioGroup.vue b/pages/irrigation/scenario/scenarioGroup.vue index ad1aa13..b00864e 100644 --- a/pages/irrigation/scenario/scenarioGroup.vue +++ b/pages/irrigation/scenario/scenarioGroup.vue @@ -342,7 +342,7 @@ // 选中数据 itemChange(wo, vItem) { if (this.selected[`${wo.id}_${vItem.valveNo}`]) { - this.$showConfirm("更换到当前轮灌组?").then(res => { + plugins.modal.confirm("更换到当前轮灌组?").then(() => { //删除之前存储的组中的数据 this.removeWo(this.selected[`${wo.id}_${vItem.valveNo}`].gIndex, wo.id, vItem.valveNo); delete this.selected[`${wo.id}_${vItem.valveNo}`]; @@ -488,7 +488,7 @@ removeGroup(index) { this.groupPop = false; const groupName = this.formData.groups[index].groupName; - this.$showConfirm(`删除"${groupName}"?`).then(res => { + plugins.modal.confirm(`删除"${groupName}"?`).then(() => { //删除轮灌组 this.formData.groups[index]._isHide = true; let i = 0; @@ -558,7 +558,7 @@ _item.sort = (_index + 1) }) }) - this.$showConfirm("保存轮灌方案?").then(res => { + plugins.modal.confirm("保存轮灌方案?").then(() => { uni.showLoading(); isApi.saveIrrigateScenario(formData).then(res => { uni.hideLoading(); diff --git a/pages/irrigation/task/detail.vue b/pages/irrigation/task/detail.vue index 501b4f2..68b2121 100644 --- a/pages/irrigation/task/detail.vue +++ b/pages/irrigation/task/detail.vue @@ -106,7 +106,7 @@ title = "暂停执行?" break; } - this.$showConfirm(title).then(() => { + plugins.modal.confirm(title).then(() => { taskApi.updateTask({ id: this.task.id, status: status @@ -114,9 +114,9 @@ plugins.modal.msg("删除成功") this.loadData(); }).catch(err => { - this.$showConfirm(err, false).then(() => { + plugins.modal.confirm(err, false).then(() => { this.loadData(); - }) + }).catch(() => {}); }) }).catch(() => {}); }, diff --git a/pages/irrigation/task/task.vue b/pages/irrigation/task/task.vue index 6f97163..a7082ae 100644 --- a/pages/irrigation/task/task.vue +++ b/pages/irrigation/task/task.vue @@ -268,7 +268,7 @@ confirm() { this.$refs.formRef.validate().then(valid => { if (valid) { - this.$showConfirm("立即执行?").then(() => { + plugins.modal.confirm("立即执行?").then(() => { taskApi.addTask(this.formData).then(res => { uni.navigateBack(); }); diff --git a/plugins/modal.js b/plugins/modal.js index 2024b3e..5ce34d6 100644 --- a/plugins/modal.js +++ b/plugins/modal.js @@ -41,13 +41,14 @@ export default { }) }, // 确认窗体 - confirm(text) { + confirm(text, showCancel = true) { return new Promise((resolve, reject) => { uni.showModal({ title: '系统提示', content: text, cancelText: '取消', confirmText: '确定', + showCancel: showCancel, success: function(res) { if (res.confirm) { resolve(res.confirm)