修改大棚删除新增逻辑
parent
5fe01d3360
commit
af05f4f5e4
|
|
@ -42,3 +42,10 @@ export function delMessage(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function getMessages(query) {
|
||||||
|
return request({
|
||||||
|
url: '/warn/message/getMessage',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ export default {
|
||||||
addAgriMobile(this.formData).then((response) => {
|
addAgriMobile(this.formData).then((response) => {
|
||||||
if (response.code===200) {
|
if (response.code===200) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: `${response.data.code===1?"✅":"⚠️"}操作提示`,
|
title: `操作提示`,
|
||||||
content: `${response.data.msg}`,
|
content: `${response.data.msg}`,
|
||||||
showCancal: false,
|
showCancal: false,
|
||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
|
|
@ -102,9 +102,9 @@ export default {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.$emit("reload"); // 向父组件传值触发刷新
|
this.$emit("reload"); // 向父组件传值触发刷新
|
||||||
batchUnsubscribe({clientId: mqttUtil.getMqttState().clientId}).then(response => {
|
batchUnsubscribe({clientId: mqttUtil.getMqttState().clientId}).then(response => {
|
||||||
if (response.code === 200) {
|
|
||||||
updateSubscribeTopic();
|
}).finally(() => {
|
||||||
}
|
updateSubscribeTopic();
|
||||||
})
|
})
|
||||||
this.close(); // 关闭添加大棚的弹窗(移到这里)
|
this.close(); // 关闭添加大棚的弹窗(移到这里)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ export default {
|
||||||
const agriInfo = JSON.parse(decodedStr); // 反序列化为原对象
|
const agriInfo = JSON.parse(decodedStr); // 反序列化为原对象
|
||||||
this.value = agriInfo.imei;
|
this.value = agriInfo.imei;
|
||||||
this.selectedText = agriInfo.agriName;
|
this.selectedText = agriInfo.agriName;
|
||||||
this.agriId = agriInfo.agriId;
|
this.agriId = (String(agriInfo.agriId));
|
||||||
this.currentMode = (agriInfo.workMode === 1)
|
this.currentMode = (agriInfo.workMode === 1)
|
||||||
this.change(this.value)
|
this.change(this.value)
|
||||||
}
|
}
|
||||||
|
|
@ -238,11 +238,13 @@ export default {
|
||||||
if (!this.currentMode) {
|
if (!this.currentMode) {
|
||||||
// 最新温湿度数据
|
// 最新温湿度数据
|
||||||
findDtuDataByInfo(queryParams).then(response => {
|
findDtuDataByInfo(queryParams).then(response => {
|
||||||
Object.keys(response.data).forEach(key => {
|
if (response.code === 200 && response.data) {
|
||||||
this.liveData[key] = response.data[key] || '已离线..';
|
Object.keys(response.data).forEach(key => {
|
||||||
});
|
this.liveData[key] = response.data[key] || '已离线..';
|
||||||
this.liveData.temp = "最后更新时间:"+response.data.time;
|
});
|
||||||
this.fontStyle = 'font-size:16px;'
|
this.liveData.temp = "最后更新时间:"+response.data.time;
|
||||||
|
this.fontStyle = 'font-size:16px;'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.getAgriByImei();
|
this.getAgriByImei();
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,9 @@ import {getNewSpecialData} from "../api/data/specialData";
|
||||||
import AddAgri from "../components/addAgri/addAgri.vue";
|
import AddAgri from "../components/addAgri/addAgri.vue";
|
||||||
import {removeAgri} from "../api/system/assets/userAgri";
|
import {removeAgri} from "../api/system/assets/userAgri";
|
||||||
import * as mqttUtil from "../utils/mqtt";
|
import * as mqttUtil from "../utils/mqtt";
|
||||||
import {getAgriStatus} from "../api/system/mqtt";
|
import {batchUnsubscribe, getAgriStatus} from "../api/system/mqtt";
|
||||||
import UniPopup from "../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
|
import UniPopup from "../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
|
||||||
|
import {updateSubscribeTopic} from "../utils/mqtt";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -341,6 +342,7 @@ export default {
|
||||||
onDeleteItem(e, item) {
|
onDeleteItem(e, item) {
|
||||||
if (e.content.text === '重命名') { // 通过事件对象的 content.text 判断
|
if (e.content.text === '重命名') { // 通过事件对象的 content.text 判断
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
this.agriId = item.id;
|
||||||
this.agriName = item.agriName;
|
this.agriName = item.agriName;
|
||||||
this.imei = item.imei;
|
this.imei = item.imei;
|
||||||
this.$refs.renameAgri.open();
|
this.$refs.renameAgri.open();
|
||||||
|
|
@ -355,6 +357,10 @@ export default {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
removeAgri(item).then(response => {
|
removeAgri(item).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
|
batchUnsubscribe({clientId: mqttUtil.getMqttState().clientId}).then(response => {
|
||||||
|
}).finally(() => {
|
||||||
|
updateSubscribeTopic();
|
||||||
|
})
|
||||||
this.$modal.msgSuccess("删除成功!");
|
this.$modal.msgSuccess("删除成功!");
|
||||||
this.getListData();
|
this.getListData();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -522,7 +528,8 @@ export default {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
renameAgriName({
|
renameAgriName({
|
||||||
imei: this.imei,
|
imei: this.imei,
|
||||||
newAgriName: this.newAgriName
|
newAgriName: this.newAgriName,
|
||||||
|
agriId: this.agriId
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$modal.msgSuccess("大棚重命名成功!");
|
this.$modal.msgSuccess("大棚重命名成功!");
|
||||||
|
|
|
||||||
|
|
@ -20,24 +20,14 @@
|
||||||
class="message-item"
|
class="message-item"
|
||||||
>
|
>
|
||||||
<!-- 时间标签:如果是第一条或者与上一条时间不同才显示 -->
|
<!-- 时间标签:如果是第一条或者与上一条时间不同才显示 -->
|
||||||
<view class="time-label" v-if="index === 0 || !isSameMinute(item.time, messageList[index - 1].time)">
|
<view class="time-label" v-if="index === 0 || !isSameMinute(item.createTime, messageList[index - 1].createTime)">
|
||||||
{{ formatTime(item.time) }}
|
{{ formatTime(item.createTime) }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <!– 点赞消息卡片 –>
|
|
||||||
<view class="like-card" v-if="item.type === 'like'">
|
|
||||||
<view class="sender-info">
|
|
||||||
<image class="avatar" :src="item.avatar" mode="aspectFill"></image>
|
|
||||||
<text class="sender-text">{{ item.sender }} 刚刚赞了你</text>
|
|
||||||
</view>
|
|
||||||
<text class="arrow">></text>
|
|
||||||
</view>-->
|
|
||||||
|
|
||||||
<!-- 冠军通知卡片 -->
|
|
||||||
<view class="champion-card">
|
<view class="champion-card">
|
||||||
<view class="sender-info">
|
<view class="sender-info">
|
||||||
<image class="avatar" :src="item.avatar" mode="aspectFill"></image>
|
<image class="avatar" :src="avatar" mode="aspectFill"></image>
|
||||||
<text class="sender-text">{{ "item "+index+" " +item.id }}</text>
|
<text class="sender-text">{{ item.content }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -52,88 +42,15 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Uuid from "@/tuniao-ui/libs/function/uuid";
|
import Uuid from "@/tuniao-ui/libs/function/uuid";
|
||||||
|
import {getMessages, listMessage} from "@/api/warn/message";
|
||||||
|
import {formatDate} from "@/uni_modules/uni-dateformat/components/uni-dateformat/date-format";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
refreshing: false, // 下拉刷新状态
|
refreshing: false, // 下拉刷新状态
|
||||||
messageList: [
|
avatar: 'https://img.xiaoces.com/photos/logo200.png',
|
||||||
{
|
messageList: [],
|
||||||
id: 'msg1',
|
|
||||||
time: '2026-03-26 22:19:00',
|
|
||||||
type: 'champion',
|
|
||||||
avatar: 'https://picsum.photos/id/237/60/60',
|
|
||||||
sender: '王冕',
|
|
||||||
showTips: '03月26日排行榜冠军,恭喜你!'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg2',
|
|
||||||
time: '2026-03-25 22:19:00',
|
|
||||||
showTips: '03月25日排行榜冠军,恭喜你!'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg3',
|
|
||||||
time: '2026-03-16 22:19:00',
|
|
||||||
showTips: '03月25日排行榜冠军,恭喜你!'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg4',
|
|
||||||
time: '2026-03-26 05:36:00',
|
|
||||||
type: 'like',
|
|
||||||
avatar: 'https://picsum.photos/id/1005/60/60',
|
|
||||||
sender: 'JFather'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg5',
|
|
||||||
time: '2026-03-24 22:19:00',
|
|
||||||
type: 'step',
|
|
||||||
rank: 160,
|
|
||||||
steps: 1838
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg6',
|
|
||||||
time: '2026-03-27 05:36:00',
|
|
||||||
type: 'champion',
|
|
||||||
avatar: 'https://picsum.photos/id/1012/60/60',
|
|
||||||
sender: 'T薛策恒',
|
|
||||||
date: '03月24'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg7',
|
|
||||||
time: '2026-03-28 05:36:00',
|
|
||||||
type: 'like',
|
|
||||||
avatar: 'https://picsum.photos/id/1013/60/60',
|
|
||||||
sender: 'User7'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg8',
|
|
||||||
time: '2026-03-29 05:36:00',
|
|
||||||
type: 'champion',
|
|
||||||
avatar: 'https://picsum.photos/id/1014/60/60',
|
|
||||||
sender: 'User8'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg9',
|
|
||||||
time: '2026-03-30 05:36:00',
|
|
||||||
type: 'step',
|
|
||||||
rank: 200,
|
|
||||||
steps: 2000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg10',
|
|
||||||
time: '2026-03-31 05:36:00',
|
|
||||||
type: 'like',
|
|
||||||
avatar: 'https://picsum.photos/id/1015/60/60',
|
|
||||||
sender: 'User10'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'msg11',
|
|
||||||
time: '2026-04-01 05:36:00',
|
|
||||||
type: 'champion',
|
|
||||||
avatar: 'https://picsum.photos/id/1016/60/60',
|
|
||||||
sender: 'User11'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
isHaveOldData: true,
|
isHaveOldData: true,
|
||||||
scrollId: null
|
scrollId: null
|
||||||
}
|
}
|
||||||
|
|
@ -141,6 +58,7 @@ export default {
|
||||||
onShow() {
|
onShow() {
|
||||||
// 只允许查询七天以内消息默认展示今天
|
// 只允许查询七天以内消息默认展示今天
|
||||||
this.getSortDate();
|
this.getSortDate();
|
||||||
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
|
@ -226,18 +144,21 @@ export default {
|
||||||
this.refreshing = false;
|
this.refreshing = false;
|
||||||
}, 800);
|
}, 800);
|
||||||
},
|
},
|
||||||
|
getList() {
|
||||||
|
var query = {
|
||||||
|
msgType: "status",
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 5
|
||||||
|
}
|
||||||
|
listMessage(query).then(response => {
|
||||||
|
if (response.code === 200 && response.rows.length > 0) {
|
||||||
|
this.messageList = response.rows
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
gotoDevice(item) {
|
gotoDevice(item) {
|
||||||
this.$modal.msg("暂未开放!");
|
|
||||||
return;
|
this.$tab.navigateTo(item.linkUrl)
|
||||||
var agri = JSON.stringify(
|
|
||||||
{
|
|
||||||
imei:item.imei,
|
|
||||||
agriName:item.agriName,
|
|
||||||
agriId:item.id,
|
|
||||||
workMode: item.workMode
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.$tab.navigateTo('/pages/home/control/index?agriInfo='+encodeURIComponent(agri))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue