参数设置 卷膜开关计算风口长度
parent
ecad105f36
commit
551e5bcbd8
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询自动化卷膜风口大小设置列表
|
||||
export function listAir(query) {
|
||||
return request({
|
||||
url: '/assets/air/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询自动化卷膜风口大小设置详细
|
||||
export function getAir(id) {
|
||||
return request({
|
||||
url: '/assets/air/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增自动化卷膜风口大小设置
|
||||
export function addAir(data) {
|
||||
return request({
|
||||
url: '/assets/air',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改自动化卷膜风口大小设置
|
||||
export function updateAir(data) {
|
||||
return request({
|
||||
url: '/assets/air',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除自动化卷膜风口大小设置
|
||||
export function delAir(id) {
|
||||
return request({
|
||||
url: '/assets/air/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view v-if="showFlag" class="card-icon" :class="{ active: status[card.type] === 1 }"
|
||||
@click.stop="handleCardClick(1 - status[card.type], card.type)">
|
||||
@click.stop="handleCardClick(1 - status[card.type], card.type, 0)">
|
||||
<!-- 加@click.stop防止冒泡触发卡片点击的弹窗事件 -->
|
||||
<uni-icons
|
||||
:type="status[card.type] === 1 ? 'circle' : 'circle-filled'"
|
||||
|
|
@ -175,6 +175,25 @@
|
|||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<view class="card-grid">
|
||||
<view
|
||||
class="control-card"
|
||||
v-for="card in paramCard"
|
||||
:key="card.type">
|
||||
<view class="card-text">
|
||||
<text class="card-main" >{{ card.name }}</text>
|
||||
</view>
|
||||
<view class="card-icon" :class="{ active: status[card.type] === 1 }"
|
||||
@click.stop="handleCardClick(1 - status[card.type], card.type, 1)">
|
||||
<!-- 加@click.stop防止冒泡触发卡片点击的弹窗事件 -->
|
||||
<uni-icons
|
||||
:type="status[card.type] === 1 ? 'circle' : 'circle-filled'"
|
||||
size="24"
|
||||
color="#fff"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-forms-item label="手动设置:" prop="manualTotalLen" :labelWidth="95">
|
||||
<uni-easyinput type="number" placeholderStyle="font-size: 25rpx;" v-model="rollerParam.manualTotalLen"
|
||||
placeholder="可在此处手动校准风口长度"
|
||||
|
|
@ -301,6 +320,10 @@ export default {
|
|||
return {}
|
||||
}
|
||||
},
|
||||
ventTotalLen: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
limitTimes: {
|
||||
type: Object,
|
||||
default() {
|
||||
|
|
@ -335,6 +358,16 @@ export default {
|
|||
});
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
ventTotalLen: {
|
||||
deep: true, // 监听对象内部属性变化(防止数据是对象时监听不到)
|
||||
immediate: true, // 关键:进入组件就执行,不用等数据变化
|
||||
handler(newVal) {
|
||||
// 确保数据有值后执行方法
|
||||
if (newVal) {
|
||||
this.rollerParam.ventTotalLen = newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
@ -354,6 +387,10 @@ export default {
|
|||
{type: 'jlk', name: '卷帘开'},
|
||||
{type: 'jlg', name: '卷帘关'},
|
||||
],
|
||||
paramCard: [
|
||||
{type: '', name: '卷膜开'},
|
||||
{type: '', name: '卷膜关'}
|
||||
],
|
||||
// 优化:语义化变量名(替换原 hide: false)
|
||||
showStatusText: false,
|
||||
showFlag: true,
|
||||
|
|
@ -493,7 +530,8 @@ export default {
|
|||
refTemp: '请选择',
|
||||
autoTotalLen: null,
|
||||
manualTotalLen: null,
|
||||
reservedLen: null
|
||||
reservedLen: null,
|
||||
ventTotalLen: null
|
||||
},
|
||||
showTip:false
|
||||
};
|
||||
|
|
@ -549,6 +587,7 @@ export default {
|
|||
|
||||
});
|
||||
},
|
||||
// --------------------共同逻辑------------------------------
|
||||
// 修改运行时间以及设备备注弹窗
|
||||
openTimeModal(card) {
|
||||
if ((store.getters && store.getters.name !== 'admin')
|
||||
|
|
@ -562,7 +601,7 @@ export default {
|
|||
this.$refs.inputDialog.open()
|
||||
},
|
||||
// 设备控制
|
||||
handleCardClick(status, type) {
|
||||
handleCardClick(status, type, tag) {
|
||||
const funcMsg = "该功能用来开启或暂停设备,按钮亮为开启,按钮暗为暂停设备"
|
||||
if ((store.getters && store.getters.name !== 'admin')
|
||||
&& this.$auth.hasRole("test")) {
|
||||
|
|
@ -604,17 +643,25 @@ export default {
|
|||
this.$modal.msgError("设备控制失败!");
|
||||
return;
|
||||
}
|
||||
let content = `确定 ${status === 1 ? "运行" : "暂停"} 【${this.selectedText} - ${op}】设备?`;
|
||||
let emitFunction = "publicMsg";
|
||||
if (tag === 1) {
|
||||
if (type.slice(-1) === 'k' && status === 1) {
|
||||
content = `确定 ${status === 1 ? "运行" : "暂停"} 【${this.selectedText} - ${op}】之前已将该卷膜关到最低?`
|
||||
}
|
||||
emitFunction = "sendSettingMsg";
|
||||
}
|
||||
uni.showModal({
|
||||
title: '操作提示:',
|
||||
content: '确定' + (status === 1 ? "运行" : "暂停") + '【' + this.selectedText + '】设备?',
|
||||
content: `${content}`,
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 组装消息
|
||||
this.message = JSON.stringify({[`${type}1`]: status})
|
||||
// 控制设备
|
||||
this.$emit("publicMsg", this.message)
|
||||
|
||||
this.$emit(emitFunction, this.message);
|
||||
//todo
|
||||
// this.testAuto(type);
|
||||
|
||||
|
|
@ -732,6 +779,7 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
// --------------------共同逻辑------------------------------
|
||||
// 添加条件更新窗口高度
|
||||
updateSwiperHeight() {
|
||||
if (this.termList[this.current]['terms'].length>3) {
|
||||
|
|
@ -799,7 +847,12 @@ export default {
|
|||
this.selectTime = true;
|
||||
},
|
||||
openParamDialog() {
|
||||
this.rollerParam = JSON.parse(JSON.stringify(this.termList[this.current].config));
|
||||
var config = this.termList[this.current].config;
|
||||
this.rollerParam = JSON.parse(JSON.stringify(config));
|
||||
this.paramCard = [
|
||||
{type: `${config.roller}k`, name: '卷膜开'},
|
||||
{type: `${config.roller}g`, name: '卷膜关'}
|
||||
]
|
||||
this.$refs.autoParam.open();
|
||||
},
|
||||
// 卷膜参数设置
|
||||
|
|
@ -816,6 +869,10 @@ export default {
|
|||
"操作提示");
|
||||
return;
|
||||
}
|
||||
this.rollerParam.ventTotalLen = this.rollerParam.autoTotalLen;
|
||||
if (this.rollerParam.manualTotalLen > 0) {
|
||||
this.rollerParam.ventTotalLen = this.rollerParam.manualTotalLen;
|
||||
}
|
||||
this.termList[this.current]['config'] = {...this.rollerParam}
|
||||
this.$refs.autoParam.close();
|
||||
},
|
||||
|
|
@ -1102,6 +1159,13 @@ export default {
|
|||
}
|
||||
.modal-container_{
|
||||
padding: 30rpx 40rpx;
|
||||
.uni-forms-item:nth-child(1) {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.card-grid {
|
||||
padding: 20rpx 0;
|
||||
gap: 30rpx;
|
||||
}
|
||||
}
|
||||
.modal-title {
|
||||
font-size: 30rpx;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,10 @@
|
|||
:dtu_remark="dtu_remark"
|
||||
:selectedText="selectedText"
|
||||
:value="value"
|
||||
:ventTotalLen="ventTotalLen"
|
||||
:agriId="agriId"
|
||||
@publicMsg="publishMessage"
|
||||
@sendSettingMsg="sendSettingMsg"
|
||||
@getAgriRemark="getRemarkByImei"
|
||||
@getAgriLimit="getAgriByImei"
|
||||
/>
|
||||
|
|
@ -154,6 +156,7 @@ export default {
|
|||
jm3gLimit: 0
|
||||
},
|
||||
testMsg:'由于线上为真实数据。任何操作均可影响线上功能,故仅作演示',
|
||||
ventTotalLen:0
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
|
|
@ -380,6 +383,21 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
sendSettingMsg(message) {
|
||||
if (!this.connected || !message) {
|
||||
return
|
||||
}
|
||||
const clientId = mqttUtil.getMqttState().clientId;
|
||||
const controlTopic = `frontend/${clientId}/${this.imei}/config`;
|
||||
// 调用全局MQTT工具类发布消息
|
||||
const publishSuccess = mqttUtil.publishMqtt(controlTopic, message);
|
||||
if (publishSuccess) {
|
||||
this.addMessage(`【指令已发送】imei: ${controlTopic},指令: ${message}`);
|
||||
} else {
|
||||
this.addMessage(`发布失败:设备:[${controlTopic}]`)
|
||||
}
|
||||
},
|
||||
|
||||
// 消息回调逻辑完全保留(仅依赖全局工具类转发消息)
|
||||
ackMessage(topic, payload) {
|
||||
// 1. 先判断是否是目标订阅主题(如frontend/\\w+/control/\\w+")
|
||||
|
|
@ -458,6 +476,9 @@ export default {
|
|||
this.fontStyle = 'font-size:16px;'
|
||||
this.makeSpecialData(msgData, true);
|
||||
}
|
||||
if ("ventTotalLen" in msgData) {
|
||||
this.ventTotalLen = msgData.ventTotalLen;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ export default {
|
|||
}
|
||||
uni.showModal({
|
||||
title: '操作提示:',
|
||||
content: '确定' + (status === 1 ? "运行" : "暂停") + '【' + this.selectedText + '】设备?',
|
||||
content: `确定 ${status === 1 ? "运行" : "暂停"} 【${this.selectedText} - ${op}】设备?`,
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
success: (res) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue