参数设置 卷膜开关计算风口长度

feasure
lld 2026-03-04 17:31:59 +08:00
parent ecad105f36
commit 551e5bcbd8
4 changed files with 137 additions and 8 deletions

View File

@ -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'
})
}

View File

@ -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;

View File

@ -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;
}
}
},

View File

@ -319,7 +319,7 @@ export default {
}
uni.showModal({
title: '操作提示:',
content: '确定' + (status === 1 ? "运行" : "暂停") + '【' + this.selectedText + '】设备?',
content: `确定 ${status === 1 ? "运行" : "暂停"}${this.selectedText} - ${op}】设备?`,
cancelText: '取消',
confirmText: '确定',
success: (res) => {