From 019eb184f335d57b610c8929a7b3820b1358ce60 Mon Sep 17 00:00:00 2001
From: 18650502300 <18650502300@163.com>
Date: Wed, 19 Feb 2025 09:47:48 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/views/device/device/index.vue | 501 +----
.../src/views/device/device/index_bak.vue | 1976 +++++++++++++++++
.../service/impl/AsDeviceServiceImpl.java | 3 +
3 files changed, 1986 insertions(+), 494 deletions(-)
create mode 100644 AutoSprout-ui/src/views/device/device/index_bak.vue
diff --git a/AutoSprout-ui/src/views/device/device/index.vue b/AutoSprout-ui/src/views/device/device/index.vue
index cb1581e..f18a03a 100644
--- a/AutoSprout-ui/src/views/device/device/index.vue
+++ b/AutoSprout-ui/src/views/device/device/index.vue
@@ -197,14 +197,6 @@
v-hasPermi="['device:device:remove']"
>删除
- 定时
@@ -323,229 +315,13 @@
-
-
-
-
-
- 按照间隔时间进行定时浇水
-
- 启动时间:
- 分
-
- 时
-
-
-
- 喷洒时间:
- 秒
-
- 分
-
-
-
- 单次浇水时间不可超过20分钟,防止电机过度发热,浇水量大可缩短浇水间隔时间
-
-
-
-
-
-
-
-
- 开启设备将自动调整土壤湿度
- 启动土壤湿度
-
-
- 停止土壤湿度
-
-
-
-
-
-
-
-
-
- 开启脉冲将会浇水停止相互循环
-
- 喷洒时间:
- 秒
-
-
-
- 间隔时间:
- 秒
-
-
-
-
-
-
-
-
-
- 水流强度分为5档
- 当前水流强度分为{{form.waterIntensity}}档
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
- -
-
-
- {{ item.startTime }} {{ item.mode == 1 ? '单次浇水' : '循环浇水' }}
-
-
{{ item.displayedDays[index] }}
-
-
{{ item.minutes }}分{{
- item.seconds < 10 ? "0" + item.seconds : item.seconds
- }}秒
-
-
- 删 除
-
-
-
-
-
-
- 确 定
- 取 消
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ dayyi }} {{ dayer }} {{ daysan }} {{ daysi }} {{ daywu }}
- {{ dayliu }} {{ dayri }}
-
-
- 一
- 二
- 三
- 四
- 五
- 六
- 日
-
-
-
-
- 确定添加
- 取消
-
-
-
-
-
-
-
-
- 启动时间
-
-
-
-
- 浇水时长
-
-
-
-
- 定时模式
-
-
-
-
-
-
-
-
-
- {{ dayyi }} {{ dayer }} {{ daysan }} {{ daysi }} {{ daywu }}
- {{ dayliu }} {{ dayri }}
-
-
- 一
- 二
- 三
- 四
- 五
- 六
- 日
-
-
-
-
- 确定修改
- 取消
-
-
-
-
-
@@ -1295,25 +861,6 @@ export default {
// 表单重置
reset() {
this.form = {
- sprayTimeMin: null, //喷洒时间分钟
- sprayTimeSec: null, //喷洒时间秒
- /**1.定时浇水开关*/
- //定时浇水json {"intervalTime":{"hour":1,"min":1},"sprayTime":{"min":1,"sec":1}}
- regularWateringJsonObj: {
- startHour: null,
- startMin: null,
- sprayTime: null,
- },
- regularWateringJson: null,
- /**2.智能土壤湿度开关*/
- soilMoisture: false,
-
- /**3.脉冲模式开关*/
- //脉冲模式 {"sprayTime":1,"endTime":1}
- pulseModeParamObj: {
- sprayTime: null,
- intervalTime: null,
- },
pulseModeParam: null,
/**3.水流强度开关*/
waterIntensitySwitch: false,
@@ -1445,20 +992,6 @@ export default {
this.getInitData();
getDevice(deviceId).then((response) => {
this.form = response.data;
- /** 参数解析成对象*/
- this.form.pulseModeParamObj = JSON.parse(this.form.pulseModeParam);
- this.form.regularWateringJsonObj = JSON.parse(
- this.form.regularWateringJson
- );
- const sprayTime = this.form.regularWateringJsonObj.sprayTime;
- this.form.sprayTimeMin = Math.trunc(sprayTime / 60);
- this.form.sprayTimeSec = sprayTime % 60;
- this.form.regularWatering = JSON.parse(this.form.regularWatering);
- this.form.pulseMode = JSON.parse(this.form.pulseMode);
- this.form.soilMoisture = JSON.parse(this.form.soilMoisture);
- this.form.waterIntensitySwitch = JSON.parse(
- this.form.waterIntensitySwitch
- );
this.open = true;
this.title = "修改设备";
});
@@ -1480,25 +1013,6 @@ export default {
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
- this.form.regularWateringJsonObj.sprayTime =
- this.form.sprayTimeMin * 60 + this.form.sprayTimeSec;
- // this.form.pulseModeParam = JSON.stringify(this.form.pulseModeParamObj);
- // console.log(JSON.stringify(this.form.pulseModeParamObj.jg_sec));
- if(JSON.stringify(this.form.pulseModeParamObj.sprayTime) && JSON.stringify(this.form.pulseModeParamObj.intervalTime)){
- this.form.pulseModeParamObj.jg_sec = this.convertSecondsToString(JSON.stringify(this.form.pulseModeParamObj.sprayTime))
- this.form.pulseModeParamObj.js_sec = this.convertSecondsToString(JSON.stringify(this.form.pulseModeParamObj.intervalTime))
- this.form.pulseModeParam = JSON.stringify(this.form.pulseModeParamObj)
- }else{
- this.form.pulseModeParamObj.jg_sec = this.convertSecondsToString(JSON.stringify(this.form.pulseModeParamObj.jg_sec))
- this.form.pulseModeParamObj.js_sec = this.convertSecondsToString(JSON.stringify(this.form.pulseModeParamObj.js_sec))
- this.form.pulseModeParam = JSON.stringify(this.form.pulseModeParamObj)
- }
-
-
- this.form.regularWateringJson = JSON.stringify(
- this.form.regularWateringJsonObj
- );
- this.form.week = this.weeknumber;
if (this.form.deviceId != null) {
updateDevice(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
@@ -1559,7 +1073,6 @@ export default {
);
},
addqutj() {
- // this.addlist = [];
this.addflag = false;
this.sizeForm.date1 = "";
this.sizeForm.date2 = "";
diff --git a/AutoSprout-ui/src/views/device/device/index_bak.vue b/AutoSprout-ui/src/views/device/device/index_bak.vue
new file mode 100644
index 0000000..cb1581e
--- /dev/null
+++ b/AutoSprout-ui/src/views/device/device/index_bak.vue
@@ -0,0 +1,1976 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ parseTime(scope.row.activationTime, "{y}-{m}-{d}") }}
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.userName }}
+
+
+
+
+
+
+ 修改
+ 删除
+ 定时
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 按照间隔时间进行定时浇水
+
+ 启动时间:
+ 分
+
+ 时
+
+
+
+ 喷洒时间:
+ 秒
+
+ 分
+
+
+
+ 单次浇水时间不可超过20分钟,防止电机过度发热,浇水量大可缩短浇水间隔时间
+
+
+
+
+
+
+
+
+ 开启设备将自动调整土壤湿度
+ 启动土壤湿度
+
+
+ 停止土壤湿度
+
+
+
+
+
+
+
+
+
+ 开启脉冲将会浇水停止相互循环
+
+ 喷洒时间:
+ 秒
+
+
+
+ 间隔时间:
+ 秒
+
+
+
+
+
+
+
+
+
+ 水流强度分为5档
+ 当前水流强度分为{{form.waterIntensity}}档
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ {{ item.startTime }} {{ item.mode == 1 ? '单次浇水' : '循环浇水' }}
+
+
{{ item.displayedDays[index] }}
+
+
{{ item.minutes }}分{{
+ item.seconds < 10 ? "0" + item.seconds : item.seconds
+ }}秒
+
+
+ 删 除
+
+
+
+
+
+
+ 确 定
+ 取 消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dayyi }} {{ dayer }} {{ daysan }} {{ daysi }} {{ daywu }}
+ {{ dayliu }} {{ dayri }}
+
+
+ 一
+ 二
+ 三
+ 四
+ 五
+ 六
+ 日
+
+
+
+
+ 确定添加
+ 取消
+
+
+
+
+
+
+
+
+ 启动时间
+
+
+
+
+ 浇水时长
+
+
+
+
+ 定时模式
+
+
+
+
+
+
+
+
+
+ {{ dayyi }} {{ dayer }} {{ daysan }} {{ daysi }} {{ daywu }}
+ {{ dayliu }} {{ dayri }}
+
+
+ 一
+ 二
+ 三
+ 四
+ 五
+ 六
+ 日
+
+
+
+
+ 确定修改
+ 取消
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java
index 7f6d775..7abb9d2 100644
--- a/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java
+++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceServiceImpl.java
@@ -486,6 +486,9 @@ public class AsDeviceServiceImpl extends ServiceImpl i
throw new ServiceException("该设备已经绑定用户,请先解绑!");
}
device.setUserId(asDevice.getUserId());
+ AsUser asUser = asUserService.selectUserById(asDevice.getUserId());
+ ServiceUtil.assertion(ObjectUtils.isEmpty(asUser), "用户不存在!");
+ device.setUserName(asUser.getUserName());
device.setBluetoothId(asDevice.getBluetoothId());
device.setBluetoothName(asDevice.getBluetoothName());
int i = asDeviceMapper.updateAsDevice(device);