郑州规约

wp1.0
fanluyan 2 years ago
parent d55766a160
commit a9dfc8bc51

@ -20,12 +20,12 @@
<div class="addtimeBox" ref="timescrollref"> <div class="addtimeBox" ref="timescrollref">
<div <div
class="timeBoxArr" class="timeBoxArr"
v-for="(item, index) in ruleForm.list" v-for="(item, index) in ruleForm.listTime"
:key="index" :key="index"
> >
<el-form-item <el-form-item
label="时间" label="时间"
:prop="'list.' + index + '.time'" :prop="'listTime.' + index + '.time'"
:rules="{ required: true, message: '请选择时间', trigger: 'blur' }" :rules="{ required: true, message: '请选择时间', trigger: 'blur' }"
> >
<el-time-picker <el-time-picker
@ -35,11 +35,13 @@
start-placeholder="开始时间" start-placeholder="开始时间"
end-placeholder="结束时间" end-placeholder="结束时间"
format="HH:mm" format="HH:mm"
value-format="HH:mm"
> >
</el-time-picker> </el-time-picker>
</el-form-item> </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 v-model="ruleForm.span" autocomplete="off" type="number"></el-input> -->
<el-input-number v-model="item.span" :min="1"></el-input-number> <el-input-number v-model="item.span" :min="1"></el-input-number>
</el-form-item> </el-form-item>
@ -54,7 +56,7 @@
icon="el-icon-plus" icon="el-icon-plus"
type="primary" type="primary"
@click="addModule()" @click="addModule()"
v-if="index + 1 == ruleForm.list.length" v-if="index + 1 == ruleForm.listTime.length"
></el-button> ></el-button>
</div> </div>
</div> </div>
@ -71,7 +73,6 @@
</template> </template>
<script> <script>
import { addScheduleRulel, updateScheduleRulel } from "@/utils/api/index"; import { addScheduleRulel, updateScheduleRulel } from "@/utils/api/index";
import moment from "moment";
export default { export default {
props: { props: {
title: String, title: String,
@ -92,26 +93,25 @@ export default {
if (val == null) { if (val == null) {
return (this.ruleForm = { return (this.ruleForm = {
name: "", name: "",
list: [ listTime: [
{ {
time: "", time: "",
span: "", span: "",
}, },
], ],
list: [],
remark: "", remark: "",
}); });
} }
//this.ruleForm = val; //this.ruleForm = val;
this.ruleForm = JSON.parse(JSON.stringify(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]); this.$set(val, "time", [val.startTime, val.endTime]);
console.log(val.startTime);
console.log(val.endTime);
}); });
}, },
addModule() { addModule() {
// //
this.ruleForm.list.push({ this.ruleForm.listTime.push({
time: "", time: "",
span: "", span: "",
}); });
@ -138,48 +138,41 @@ export default {
this.$refs.formInfo.validate((valid) => { this.$refs.formInfo.validate((valid) => {
if (valid) { if (valid) {
// delete this.ruleForm.time; // 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"); this.ruleForm.listTime.forEach((val) => {
// console.log(typeof str); this.$set(val, "startTime", new Date(val.time[0]));
// console.log(this.ruleForm.list[i].startTime); 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); let arr = [];
// var Stime = this.ruleForm.list[i].startTime; for (var i = 0; i < this.ruleForm.listTime.length; i++) {
// var Etime = this.ruleForm.list[i].endTime; console.log(this.ruleForm.listTime);
// console.log(Stime, Etime);
// var date = new Date(Stime);
// console.log(date);
// moment(date).format("YYYY-MM-DD HH:mm:ss")
arr.push( arr.push(
{ {
hour: Math.floor(this.ruleForm.list[i].span / 60), hour: Math.floor(this.ruleForm.listTime[i].span / 60),
minute: this.ruleForm.list[i].span % 60, minute: this.ruleForm.listTime[i].span % 60,
preset: 255, preset: 255,
}, },
{ {
hour: this.ruleForm.list[i].startTime.split(":")[0], hour: this.ruleForm.listTime[i].startTime.getHours(),
minute: this.ruleForm.list[i].startTime.split(":")[1], minute: this.ruleForm.listTime[i].startTime.getMinutes(),
preset: 255, preset: 255,
}, },
{ {
hour: this.ruleForm.list[i].endTime.split(":")[0], hour: this.ruleForm.listTime[i].endTime.getHours(),
minute: this.ruleForm.list[i].endTime.split(":")[1], minute: this.ruleForm.listTime[i].endTime.getMinutes(),
preset: 255, preset: 255,
} }
); );
} }
console.log(arr);
this.ruleForm.list = arr; this.ruleForm.list = arr;
if (this.title == "新增") { if (this.title == "新增") {
addScheduleRulel(this.ruleForm) addScheduleRulel(this.ruleForm)
@ -258,20 +251,3 @@ export default {
} }
} }
</style> </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" :visible.sync="isShow"
:close-on-click-modal="false" :close-on-click-modal="false"
width="670px" width="670px"
@close="handleclose"
> >
<el-form <el-form
label-position="left" label-position="left"
@ -25,20 +24,37 @@
> >
<el-form-item <el-form-item
label="时间" label="时间"
:prop="'listTime.' + index + '.time'"
:rules="{ required: true, message: '请选择时间', trigger: 'blur' }" :rules="{ required: true, message: '请选择时间', trigger: 'blur' }"
> >
<el-time-picker <!-- <el-time-picker
is-range is-range
:picker-options="pickerOptions"
v-model="item.time" v-model="item.time"
range-separator="至" range-separator="至"
start-placeholder="开始时间" start-placeholder="开始时间"
end-placeholder="结束时间" end-placeholder="结束时间"
format="HH:mm" 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>
<el-form-item <el-form-item
class="spanRight"
label="间隔(分)" label="间隔(分)"
:prop="'listTime.' + index + '.span'" :prop="'listTime.' + index + '.span'"
> >
@ -80,6 +96,12 @@ export default {
data() { data() {
return { return {
isShow: false, isShow: false,
pickerOptions: {
disabledDate(time) {
//
return false;
},
},
rules: { rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }], name: [{ required: true, message: "请输入名称", trigger: "blur" }],
}, },
@ -95,7 +117,8 @@ export default {
name: "", name: "",
listTime: [ listTime: [
{ {
time: "", startTime: "",
endTime: "",
span: "", span: "",
}, },
], ],
@ -105,15 +128,27 @@ export default {
} }
//this.ruleForm = val; //this.ruleForm = val;
this.ruleForm = JSON.parse(JSON.stringify(val)); this.ruleForm = JSON.parse(JSON.stringify(val));
this.ruleForm.listTime.forEach((val) => { console.log(this.ruleForm.listTime);
this.$set(val, "time", [val.startTime, val.endTime]); 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() { addModule() {
// //
this.ruleForm.listTime.push({ this.ruleForm.listTime.push({
time: "", startTime: "",
span: "", endTime: "",
timeSpan: "",
}); });
console.log(this.$refs.timescrollref); console.log(this.$refs.timescrollref);
this.$nextTick(() => { this.$nextTick(() => {
@ -138,22 +173,15 @@ export default {
this.$refs.formInfo.validate((valid) => { this.$refs.formInfo.validate((valid) => {
if (valid) { if (valid) {
// delete this.ruleForm.time; // delete this.ruleForm.time;
this.ruleForm.listTime.forEach((val) => { this.ruleForm.listTime.forEach((val) => {
this.$set(val, "startTime", new Date(val.time[0])); console.log(val);
this.$set(val, "endTime", new Date(val.time[1])); this.$set(val, "startTime", new Date(val.startTime));
// console.log(val.time[0]); this.$set(val, "endTime", new Date(val.endTime));
// 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());
}); });
let arr = []; let arr = [];
for (var i = 0; i < this.ruleForm.listTime.length; i++) { for (var i = 0; i < this.ruleForm.listTime.length; i++) {
console.log(this.ruleForm.listTime); console.log(this.ruleForm.listTime);
console.log(this.ruleForm.listTime[i].startTime);
arr.push( arr.push(
{ {
hour: Math.floor(this.ruleForm.listTime[i].span / 60), hour: Math.floor(this.ruleForm.listTime[i].span / 60),
@ -216,9 +244,9 @@ export default {
hide() { hide() {
this.isShow = false; this.isShow = false;
}, },
handleclose() { // handleclose() {
this.$parent.deviceList(); // this.$parent.getruleList();
}, // },
}, },
mounted() {}, mounted() {},
}; };
@ -247,7 +275,24 @@ export default {
width: 30px; 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> </style>

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

Loading…
Cancel
Save