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