郑州规约

wp1.0
fanluyan 2 years ago
parent d55766a160
commit a9dfc8bc51

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

@ -5,7 +5,6 @@
:visible.sync="isShow"
:close-on-click-modal="false"
width="670px"
@close="handleclose"
>
<el-form
label-position="left"
@ -25,20 +24,37 @@
>
<el-form-item
label="时间"
:prop="'listTime.' + index + '.time'"
:rules="{ required: true, message: '请选择时间', trigger: 'blur' }"
>
<el-time-picker
<!-- <el-time-picker
is-range
:picker-options="pickerOptions"
v-model="item.time"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
format="HH:mm"
@change="handleTimeChange"
>
</el-time-picker>
</el-time-picker> -->
<div class="timeBoxList">
<el-time-picker
v-model="item.startTime"
placeholder="开始时间"
format="HH:mm"
>
</el-time-picker>
<i class="split">~</i>
<el-time-picker
v-model="item.endTime"
placeholder="结束时间"
format="HH:mm"
>
</el-time-picker>
</div>
</el-form-item>
<el-form-item
class="spanRight"
label="间隔(分)"
:prop="'listTime.' + index + '.span'"
>
@ -80,6 +96,12 @@ export default {
data() {
return {
isShow: false,
pickerOptions: {
disabledDate(time) {
//
return false;
},
},
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
@ -95,7 +117,8 @@ export default {
name: "",
listTime: [
{
time: "",
startTime: "",
endTime: "",
span: "",
},
],
@ -105,15 +128,27 @@ export default {
}
//this.ruleForm = val;
this.ruleForm = JSON.parse(JSON.stringify(val));
this.ruleForm.listTime.forEach((val) => {
this.$set(val, "time", [val.startTime, val.endTime]);
console.log(this.ruleForm.listTime);
this.ruleForm.listTime.forEach((item) => {
this.$set(item, "startTime", this.$moment(item.startTime, "HH:mm"));
this.$set(item, "endTime", this.$moment(item.endTime, "HH:mm"));
//this.$set(item, "time", [item.startTime, item.endTime]);
});
},
handleTimeChange(value) {
console.log(value);
// this.item.time = value;
// // pickerOptions使
// this.pickerOptions.disabledDate = (time) => {
// return time.getTime() < this.item.time[0].getTime();
// };
},
addModule() {
//
this.ruleForm.listTime.push({
time: "",
span: "",
startTime: "",
endTime: "",
timeSpan: "",
});
console.log(this.$refs.timescrollref);
this.$nextTick(() => {
@ -138,22 +173,15 @@ export default {
this.$refs.formInfo.validate((valid) => {
if (valid) {
// delete this.ruleForm.time;
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(val);
this.$set(val, "startTime", new Date(val.startTime));
this.$set(val, "endTime", new Date(val.endTime));
});
let arr = [];
for (var i = 0; i < this.ruleForm.listTime.length; i++) {
console.log(this.ruleForm.listTime);
console.log(this.ruleForm.listTime[i].startTime);
arr.push(
{
hour: Math.floor(this.ruleForm.listTime[i].span / 60),
@ -216,9 +244,9 @@ export default {
hide() {
this.isShow = false;
},
handleclose() {
this.$parent.deviceList();
},
// handleclose() {
// this.$parent.getruleList();
// },
},
mounted() {},
};
@ -247,7 +275,24 @@ export default {
width: 30px;
}
}
.timeBoxList {
display: flex;
.el-date-editor.el-input,
.el-date-editor.el-input__inner {
width: 100px;
margin-right: 0px;
}
.split {
padding: 0 4px;
}
}
.spanRight {
margin-left: 14px;
}
}
}
}
.el-time-spinner__item.disabled {
cursor: pointer;
}
</style>

@ -58,7 +58,11 @@
>{{ val.substring(val.length - 5) }}</el-tag
>
<el-tag
v-if="timeProtocol == '65286' || timeProtocol == '65282'"
v-if="
timeProtocol == '65286' ||
timeProtocol == '65282' ||
timeProtocol == '65281'
"
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.shedulenr"
@ -83,7 +87,11 @@
>{{ val.substring(val.length - 5) }}</el-tag
>
<el-tag
v-if="timeProtocol == '65286' || timeProtocol == '65282'"
v-if="
timeProtocol == '65286' ||
timeProtocol == '65282' ||
timeProtocol == '65281'
"
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.newshedulenr"
@ -469,7 +477,8 @@ export default {
//
if (
this.timeProtocol == "65286" ||
this.timeProtocol == "65282"
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南规约");
var hnarr = [];
@ -578,7 +587,11 @@ export default {
}
}
//
if (this.timeProtocol == "65286" || this.timeProtocol == "65282") {
if (
this.timeProtocol == "65286" ||
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南规约");
var hnarr = [];
for (var i = 0; i < this.shedulenr.length; i++) {
@ -696,15 +709,54 @@ export default {
let startVal = this.$moment(new Date(startDay)).format(
"YYYY-MM-DD HH:mm"
);
console.log(startVal);
while (this.$moment(startVal).isBefore(endDay)) {
dayArr.push(startVal);
//
startVal = this.$moment(new Date(startVal))
.add(hnarr[k].span, "minute")
.format("YYYY-MM-DD HH:mm");
console.log(startVal);
let endVal = this.$moment(new Date(endDay)).format(
"YYYY-MM-DD HH:mm"
);
console.log(startVal, endVal);
if (this.$moment(endVal).isBefore(this.$moment(startVal))) {
let zeroEnd = this.$moment("23:59", "HH:mm").format(
"YYYY-MM-DD HH:mm"
);
let zeroStart = this.$moment("00:00", "HH:mm").format(
"YYYY-MM-DD HH:mm"
);
while (
this.$moment(startVal).isBefore(this.$moment(zeroEnd)) ||
this.$moment(startVal).isSame(this.$moment(zeroEnd))
) {
dayArr.push(startVal);
startVal = this.$moment(startVal)
.add(hnarr[k].span, "minute")
.format("YYYY-MM-DD HH:mm");
}
while (
this.$moment(zeroStart).isBefore(this.$moment(endVal)) ||
this.$moment(zeroStart).isSame(this.$moment(endVal))
) {
dayArr.push(zeroStart);
zeroStart = this.$moment(zeroStart)
.add(hnarr[k].span, "minute")
.format("YYYY-MM-DD HH:mm");
}
} else {
while (
this.$moment(startVal).isBefore(this.$moment(endVal)) ||
this.$moment(startVal).isSame(this.$moment(endVal))
) {
dayArr.push(startVal);
startVal = this.$moment(startVal)
.add(hnarr[k].span, "minute")
.format("YYYY-MM-DD HH:mm");
}
}
// while (this.$moment(startVal).isBefore(endDay)) {
// dayArr.push(startVal);
// //
// startVal = this.$moment(new Date(startVal))
// .add(hnarr[k].span, "minute")
// .format("YYYY-MM-DD HH:mm");
// console.log(startVal);
// }
// //
@ -719,7 +771,8 @@ export default {
//
if (
this.timeProtocol == "65286" ||
this.timeProtocol == "65282"
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南规约");
var hnarr = [];
@ -1057,7 +1110,8 @@ export default {
////
if (
this.deviceListData.zzprotocol == "65286" ||
this.timeProtocol == "65282"
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南规约");
//

Loading…
Cancel
Save