1. 调整设备列表页面

This commit is contained in:
邱贞招 2024-04-18 11:18:33 +08:00
parent 8fa35003e7
commit b2cfaf1e0c

View File

@ -259,7 +259,7 @@
<el-option
v-for="item in modelOptions"
:key="item.modelId"
:label="item.modelName"
:label="item.model"
:value="item.modelId"
>
</el-option>
@ -294,8 +294,8 @@
<el-input v-model="form.mac" placeholder="请输入设备Mac号" :disabled="title=='修改设备'"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户" prop="userId" style="width: 100%">
<el-col :span="12" v-show="title=='修改设备'">
<el-form-item label="用户" prop="userId" style="width: 100%" >
<el-select
v-model="form.userId"
filterable
@ -451,8 +451,8 @@
<el-slider
:max="5"
v-model="form.waterIntensity"
:step="1"
:min="1"
:step="1"
:min="1"
show-stops
class="margin-40px switch-water"
>
@ -571,7 +571,7 @@
<div class="lt" @click="editds(item, index)">
<div class="tltle" style="font-size: 24px">
{{ item.startTime }} <span style="font-size: 18px;color:#ccc">{{ item.mode == 1 ? '单次浇水' : '循环浇水' }}</span>
</div>
</div>
<span>{{ item.displayedDays[index] }}</span>
<span
style="
@ -954,7 +954,7 @@ export default {
// { required: true, message: "", trigger: "blur" }
// ],
modelId: [{ required: true, message: "型号不能为空", trigger: "blur" }],
userId: [{ required: true, message: "用户不能为空", trigger: "blur" }],
// userId: [{ required: true, message: "", trigger: "blur" }],
mac: [{ required: true, message: "mac值不能为空", trigger: "blur" }],
},
};
@ -1060,10 +1060,10 @@ export default {
}
this.addflag2 = true;
},
convertToSecondsFromArray(arr) {
return parseInt(arr[0], 10) * 3600 + parseInt(arr[1], 10) * 60 + parseInt(arr[2], 10);
convertToSecondsFromArray(arr) {
return parseInt(arr[0], 10) * 3600 + parseInt(arr[1], 10) * 60 + parseInt(arr[2], 10);
},
btnedit(){
this.addlist.push(this.yiindex==''?0:this.yiindex, this.erindex==''?0:this.erindex, this.sanindex == '' ? 0:this.sanindex, this.siindex == '' ? 0 :this.siindex, this.wuindex == 0 ? 0 :this.wuindex, this.liuindex == '' ? 0 : this.liuindex,this.riindex == '' ? 0 :this.riindex)
console.log(this.addlist);
@ -1094,49 +1094,49 @@ export default {
this.checkedval = false
})
},
extractedTimeToArrays(originalDateString) {
//
const date = new Date(originalDateString);
if (isNaN(date)) {
console.error('无法解析日期字符串');
return null; //
}
//
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0');
//
return [hours, minutes, seconds];
extractedTimeToArrays(originalDateString) {
//
const date = new Date(originalDateString);
if (isNaN(date)) {
console.error('无法解析日期字符串');
return null; //
}
//
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0');
//
return [hours, minutes, seconds];
},
extractedTime(originalDateString) {
//
const date = new Date(originalDateString);
if (isNaN(date)) {
console.error('无法解析日期字符串');
return '';
}
//
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0');
//
return `${hours}:${minutes}:${seconds}`;
extractedTime(originalDateString) {
//
const date = new Date(originalDateString);
if (isNaN(date)) {
console.error('无法解析日期字符串');
return '';
}
//
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
const seconds = date.getSeconds().toString().padStart(2, '0');
//
return `${hours}:${minutes}:${seconds}`;
},
formatSeconds(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
// 使padStart
const formattedHours = String(hours).padStart(2, '0');
const formattedMinutes = String(minutes).padStart(2, '0');
const formattedSeconds = String(seconds).padStart(2, '0');
return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
formatSeconds(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
// 使padStart
const formattedHours = String(hours).padStart(2, '0');
const formattedMinutes = String(minutes).padStart(2, '0');
const formattedSeconds = String(seconds).padStart(2, '0');
return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
},
//
@ -1461,10 +1461,10 @@ export default {
this.$modal.msg(response.msg);
});
},
convertSecondsToString(seconds) {
const minutes = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${minutes.toString().padStart(2, '0') + '分'}${secs.toString().padStart(2, '0') + '秒'}`;
convertSecondsToString(seconds) {
const minutes = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${minutes.toString().padStart(2, '0') + '分'}${secs.toString().padStart(2, '0') + '秒'}`;
},
/** 提交按钮 */
submitForm() {
@ -1483,7 +1483,7 @@ export default {
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
@ -1532,7 +1532,7 @@ export default {
});
setTimeout(() => {
this.getgetregular(deviceid);
}, 2000);
}, 2000);
this.list = [];
this.result = [];
});