|
|
|
@ -20,12 +20,12 @@
|
|
|
|
|
<div class="addtimeBox" ref="timescrollref">
|
|
|
|
|
<div
|
|
|
|
|
class="timeBoxArr"
|
|
|
|
|
v-for="(item, index) in ruleForm.list"
|
|
|
|
|
v-for="(item, index) in ruleForm.listTime"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="时间"
|
|
|
|
|
:prop="'list.' + index + '.time'"
|
|
|
|
|
:prop="'listTime.' + index + '.time'"
|
|
|
|
|
:rules="{ required: true, message: '请选择时间', trigger: 'blur' }"
|
|
|
|
|
>
|
|
|
|
|
<el-time-picker
|
|
|
|
@ -35,11 +35,13 @@
|
|
|
|
|
start-placeholder="开始时间"
|
|
|
|
|
end-placeholder="结束时间"
|
|
|
|
|
format="HH:mm"
|
|
|
|
|
value-format="HH:mm"
|
|
|
|
|
>
|
|
|
|
|
</el-time-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="间隔(分)" :prop="'list.' + index + '.span'">
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="间隔(分)"
|
|
|
|
|
:prop="'listTime.' + index + '.span'"
|
|
|
|
|
>
|
|
|
|
|
<!-- <el-input v-model="ruleForm.span" autocomplete="off" type="number"></el-input> -->
|
|
|
|
|
<el-input-number v-model="item.span" :min="1"></el-input-number>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -54,7 +56,7 @@
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="addModule()"
|
|
|
|
|
v-if="index + 1 == ruleForm.list.length"
|
|
|
|
|
v-if="index + 1 == ruleForm.listTime.length"
|
|
|
|
|
></el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -71,7 +73,6 @@
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { addScheduleRulel, updateScheduleRulel } from "@/utils/api/index";
|
|
|
|
|
import moment from "moment";
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
title: String,
|
|
|
|
@ -92,26 +93,25 @@ export default {
|
|
|
|
|
if (val == null) {
|
|
|
|
|
return (this.ruleForm = {
|
|
|
|
|
name: "",
|
|
|
|
|
list: [
|
|
|
|
|
listTime: [
|
|
|
|
|
{
|
|
|
|
|
time: "",
|
|
|
|
|
span: "",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
list: [],
|
|
|
|
|
remark: "",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//this.ruleForm = val;
|
|
|
|
|
this.ruleForm = JSON.parse(JSON.stringify(val));
|
|
|
|
|
this.ruleForm.list.forEach((val) => {
|
|
|
|
|
this.ruleForm.listTime.forEach((val) => {
|
|
|
|
|
this.$set(val, "time", [val.startTime, val.endTime]);
|
|
|
|
|
console.log(val.startTime);
|
|
|
|
|
console.log(val.endTime);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addModule() {
|
|
|
|
|
//新增一行
|
|
|
|
|
this.ruleForm.list.push({
|
|
|
|
|
this.ruleForm.listTime.push({
|
|
|
|
|
time: "",
|
|
|
|
|
span: "",
|
|
|
|
|
});
|
|
|
|
@ -138,48 +138,41 @@ export default {
|
|
|
|
|
this.$refs.formInfo.validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
// delete this.ruleForm.time;
|
|
|
|
|
this.ruleForm.list.forEach((val) => {
|
|
|
|
|
this.$set(val, "startTime", val.time[0]);
|
|
|
|
|
this.$set(val, "endTime", val.time[1]);
|
|
|
|
|
});
|
|
|
|
|
// console.log(this.ruleForm.list[0].startTime);
|
|
|
|
|
let arr = [];
|
|
|
|
|
for (var i = 0; i < this.ruleForm.list.length; i++) {
|
|
|
|
|
console.log(this.ruleForm.list[i].startTime.split(":")[0]);
|
|
|
|
|
console.log(this.ruleForm.list[i].startTime.split(":")[1]);
|
|
|
|
|
console.log(this.ruleForm.list[i].endTime.split(":")[0]);
|
|
|
|
|
console.log(this.ruleForm.list[i].endTime.split(":")[1]);
|
|
|
|
|
|
|
|
|
|
// let str = moment(new Date()).format("hh:mm");
|
|
|
|
|
// console.log(typeof str);
|
|
|
|
|
// console.log(this.ruleForm.list[i].startTime);
|
|
|
|
|
this.ruleForm.listTime.forEach((val) => {
|
|
|
|
|
this.$set(val, "startTime", new Date(val.time[0]));
|
|
|
|
|
this.$set(val, "endTime", new Date(val.time[1]));
|
|
|
|
|
// console.log(val.time[0]);
|
|
|
|
|
// console.log(typeof val.time[0]);
|
|
|
|
|
// console.log(new Date(val.time[0]));
|
|
|
|
|
// console.log(new Date(val.time[1]));
|
|
|
|
|
// console.log(new Date(val.time[0]).getHours());
|
|
|
|
|
// console.log(new Date(val.time[0]).getMinutes());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// console.log(typeof this.ruleForm.list[i].startTime);
|
|
|
|
|
// var Stime = this.ruleForm.list[i].startTime;
|
|
|
|
|
// var Etime = this.ruleForm.list[i].endTime;
|
|
|
|
|
// console.log(Stime, Etime);
|
|
|
|
|
// var date = new Date(Stime);
|
|
|
|
|
// console.log(date);
|
|
|
|
|
// moment(date).format("YYYY-MM-DD HH:mm:ss")
|
|
|
|
|
let arr = [];
|
|
|
|
|
for (var i = 0; i < this.ruleForm.listTime.length; i++) {
|
|
|
|
|
console.log(this.ruleForm.listTime);
|
|
|
|
|
|
|
|
|
|
arr.push(
|
|
|
|
|
{
|
|
|
|
|
hour: Math.floor(this.ruleForm.list[i].span / 60),
|
|
|
|
|
minute: this.ruleForm.list[i].span % 60,
|
|
|
|
|
hour: Math.floor(this.ruleForm.listTime[i].span / 60),
|
|
|
|
|
minute: this.ruleForm.listTime[i].span % 60,
|
|
|
|
|
preset: 255,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hour: this.ruleForm.list[i].startTime.split(":")[0],
|
|
|
|
|
minute: this.ruleForm.list[i].startTime.split(":")[1],
|
|
|
|
|
hour: this.ruleForm.listTime[i].startTime.getHours(),
|
|
|
|
|
minute: this.ruleForm.listTime[i].startTime.getMinutes(),
|
|
|
|
|
preset: 255,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hour: this.ruleForm.list[i].endTime.split(":")[0],
|
|
|
|
|
minute: this.ruleForm.list[i].endTime.split(":")[1],
|
|
|
|
|
hour: this.ruleForm.listTime[i].endTime.getHours(),
|
|
|
|
|
minute: this.ruleForm.listTime[i].endTime.getMinutes(),
|
|
|
|
|
preset: 255,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
console.log(arr);
|
|
|
|
|
this.ruleForm.list = arr;
|
|
|
|
|
if (this.title == "新增") {
|
|
|
|
|
addScheduleRulel(this.ruleForm)
|
|
|
|
@ -258,20 +251,3 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
paramsFn() { this.params.push( { name: "act", value: "schedule", }, { name:
|
|
|
|
|
"channel", value: this.checkedAisle, }, { name: "group", value: this.groupNum, }
|
|
|
|
|
); this.setTermFn(this.params); }, setTermFn(dataParams) {
|
|
|
|
|
console.log("点击了统一的接口", "runningstatus"); console.log(dataParams);
|
|
|
|
|
setTermCamera({ termId: 10027, list: dataParams, }) .then((res) => {
|
|
|
|
|
console.log(res); this.requestid = res.data.requestId;
|
|
|
|
|
clearInterval(this.timer); this.timer = window.setInterval(() => {
|
|
|
|
|
this.getinfo(); this.imun++; }, 1000); }) .catch((err) => {}); }, getinfo() {
|
|
|
|
|
getTermCameraRequest({ requestid: this.requestid }) .then((res) => { if
|
|
|
|
|
(res.data.success == 1) { window.clearInterval(this.timer); this.timer = null;
|
|
|
|
|
this.imun = 0; console.log("终止轮询"); // && res.data.result == 255
|
|
|
|
|
console.log(JSON.parse(res.data.data)); this.$message({ duration: 1500,
|
|
|
|
|
showClose: true, message: "信息已更新", type: "success", }); } else if
|
|
|
|
|
(this.imun > 9) { window.clearInterval(this.timer); this.timer = null; this.imun
|
|
|
|
|
= 0; this.$message({ duration: 1500, showClose: true, message:
|
|
|
|
|
"暂未获取到信息,请稍后再试!!", type: "warning", }); } }) .catch((err) => {});
|
|
|
|
|
},
|
|
|
|
|