You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1378 lines
46 KiB
Vue

2 years ago
<template>
<el-dialog
2 years ago
class="setTimeDialog"
2 years ago
title="拍照时间表设置"
:visible.sync="isShow"
:close-on-click-modal="false"
2 years ago
@close="handleclose"
width="1000px"
>
2 years ago
<el-tabs v-model="activeName" @tab-click="handleClick" v-loading="loading">
<el-tab-pane label="拍照时间表" name="1">
<div class="timebox">
<div class="flexnr">
<div class="w8">选择通道:</div>
<el-select
v-model="selaccess"
placeholder="请选择"
class="mr20"
@change="changeSelect"
>
<el-option
v-for="item in accesslist"
:key="item.channelid"
2 years ago
:label="
item.alias !== null && item.alias !== ''
? item.alias
: item.channelname
"
:value="item.channelid"
2 years ago
>
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channelname
}}
</el-option>
</el-select>
<!-- <el-button type="primary" @click="inquireRealbtn()"
>查询实际时间表</el-button
2 years ago
> -->
2 years ago
</div>
<div class="flexno bt30">
2 years ago
<!-- <div class="timehead">
<label>时间表规则:</label>
<p>ssssssssssss</p>
2 years ago
</div> -->
<div class="timeShow" v-loading="loading">
<div class="leftTime" v-if="shedulenr.length !== 0">
<div class="w8">时间表:</div>
<div class="w80 flexonly" v-loading="timeloading">
<el-tag
v-if="timeProtocol == '65283'"
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.shedulenr"
:key="index"
>{{ val.substring(val.length - 5) }}</el-tag
>
<el-tag
v-if="timeProtocol == '65286' || timeProtocol == '65282'"
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.shedulenr"
:key="index"
>{{ $moment(val).format("HH:mm") }}</el-tag
>
<!-- {{ val.substring(val.length - 5) }} -->
</div>
</div>
<div class="rightTime" v-if="newshedulenr.length !== 0">
<div class="w8">装置时间表:</div>
2 years ago
<span class="offtime" v-if="offsetnum !== null"
2 years ago
>(偏移时间{{ offsetnum }}分钟)</span
>
<div class="w80 flexonly" v-loading="timeloading">
<el-tag
v-if="timeProtocol == '65283'"
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.newshedulenr"
:key="index"
>{{ val.substring(val.length - 5) }}</el-tag
>
<el-tag
2 years ago
v-if="
timeProtocol == '65286' ||
timeProtocol == '65282' ||
timeProtocol == '65281'
"
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.newshedulenr"
:key="index"
>{{ $moment(val).format("HH:mm") }}</el-tag
>
</div>
</div>
<div v-if="shedulenr.length == 0 && newshedulenr.length == 0">
暂无拍照时间表
</div>
</div>
</div>
2 years ago
<el-button
class="searchBtn"
type="text"
:loading="compareloading"
@click="inquirebtn()"
>装置时间表对比</el-button
>
2 years ago
</div>
</el-tab-pane>
<el-tab-pane label="拍照时间表下发" name="2">
2 years ago
<div class="deviceTable">
<el-table
ref="multipleTable"
:data="newList"
tooltip-effect="dark"
2 years ago
stripe
style="width: 100%"
height="calc(100% - 40px)"
>
2 years ago
<el-table-column label="名称" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<!-- <el-table-column label="时间表类型" show-overflow-tooltip>
<template>按时间段</template>
</el-table-column> -->
<el-table-column label="时间表规则" width="360px">
2 years ago
<template slot-scope="scope">
2 years ago
<p
class="timeGz"
v-for="(val, index) in scope.row.listTime"
2 years ago
:key="index"
>
2 years ago
<span>
{{
new Date(val.startTime).getHours() < 10
? "0" + new Date(val.startTime).getHours()
: new Date(val.startTime).getHours()
}}:
{{
new Date(val.startTime).getMinutes() < 10
? "0" + new Date(val.startTime).getMinutes()
: new Date(val.startTime).getMinutes()
2 years ago
}}</span
>
2 years ago
~
<span
>{{
new Date(val.endTime).getHours() < 10
? "0" + new Date(val.endTime).getHours()
: new Date(val.endTime).getHours()
}}:
{{
new Date(val.endTime).getMinutes() < 10
? "0" + new Date(val.endTime).getMinutes()
: new Date(val.endTime).getMinutes()
}}</span
>
2 years ago
间隔<b>{{ val.span }}分钟</b>
2 years ago
</p>
2 years ago
</template>
</el-table-column>
2 years ago
<el-table-column
prop="remark"
label="备注"
show-overflow-tooltip
></el-table-column>
2 years ago
<el-table-column fixed="right" label="操作">
2 years ago
<template slot-scope="scope">
2 years ago
<el-button
type="primary"
@click.native.stop="handleSet(scope.row)"
>设置</el-button
>
2 years ago
</template>
</el-table-column>
</el-table>
<div class="pageNation">
<el-pagination
:current-page="page"
:page-size="pageSize"
layout=" prev, pager, next, jumper,total"
@current-change="handleCurrentChange"
:total="total"
background
>
2 years ago
</el-pagination>
</div>
</div>
<el-dialog
2 years ago
class="setRoadDialog"
title="设置"
:visible.sync="isShowset"
:close-on-click-modal="false"
width="680px"
append-to-body
@close="closebtn"
>
<div class="setTimeTd">
<div class="tdSetBox">
2 years ago
<h3>装置信息</h3>
<el-descriptions title="" :column="3" border>
2 years ago
<el-descriptions-item label="电压等级">{{
deviceListData.dyname
}}</el-descriptions-item>
<el-descriptions-item label="线路名称">
2 years ago
{{ deviceListData.xlname }}</el-descriptions-item
>
<el-descriptions-item label="装置名称">
2 years ago
{{ deviceListData.zzname }}
</el-descriptions-item>
</el-descriptions>
2 years ago
<h3>时间表规则</h3>
2 years ago
<p class="timename">时间表名称{{ timeName }}</p>
2 years ago
<div class="flexTimeGz">
<p
class="timeGz"
v-for="(val, index) in scheduleInfo"
:key="index"
>
<span
>{{
new Date(val.startTime).getHours() < 10
? "0" + new Date(val.startTime).getHours()
: new Date(val.startTime).getHours()
}}:
{{
new Date(val.startTime).getMinutes() < 10
? "0" + new Date(val.startTime).getMinutes()
: new Date(val.startTime).getMinutes()
}}</span
>
~
<span
>{{
new Date(val.endTime).getHours() < 10
? "0" + new Date(val.endTime).getHours()
: new Date(val.endTime).getHours()
}}:
{{
new Date(val.endTime).getMinutes() < 10
? "0" + new Date(val.endTime).getMinutes()
: new Date(val.endTime).getMinutes()
}}</span
>
2 years ago
间隔<b>{{ val.span }}分钟</b>
</p>
</div>
2 years ago
<div class="math">
偏移时间()
<el-input-number
v-model="setNum"
:min="0"
:max="9"
></el-input-number>
</div>
<h3>选择通道</h3>
<div class="checkBox">
<el-radio-group v-model="checkList" @change="handleChange">
<el-radio
:label="val.id"
border
v-for="val in zzchannel"
:key="val.id"
>{{ val.name }}</el-radio
>
</el-radio-group>
<!-- <el-checkbox-group v-model="checkList" @change="handleChange">
2 years ago
<el-checkbox
2 years ago
:label="val.id"
2 years ago
border
2 years ago
v-for="val in zzchannel"
:key="val.id"
>{{ val.name }}</el-checkbox
2 years ago
>
</el-checkbox-group> -->
</div>
</div>
</div>
2 years ago
<div slot="footer" class="dialog-footer">
2 years ago
<el-button @click="closebtn"> </el-button>
<el-button
type="primary"
v-debounce="submitForm"
:loading="sureloading"
> </el-button
>
2 years ago
</div>
</el-dialog>
</el-tab-pane>
</el-tabs>
</el-dialog>
</template>
<script>
import {
getChannelListJoggle,
getSchedulenr,
getScheduleRulelListJoggle,
setScheduleRulel,
getScheduleRulelAccessList,
cmaSchelduleDetials,
getCmaSchelduleDetials,
getCmaSchelduleUpload,
2 years ago
getTermStatus,
} from "@/utils/api/index";
import moment from "moment";
2 years ago
export default {
props: {
title: String,
2 years ago
},
data() {
return {
loading: false,
2 years ago
isShow: false,
isShowset: false,
activeName: "1", //选项卡
accesslist: [], //通道选择器
selaccess: "", //选中的通道
shedulenr: [], //查询的时间表
deviceTableData: [], //时间表-表格
newList: [],
listTime: [],
2 years ago
page: 1, // 当前页数
pageSize: 10, // 每页数量
total: 0, //总条数
listnr: [], //通道树结构
2 years ago
defaultProps: {
children: "list",
label: "name",
2 years ago
},
selfacilityId: "", //所选设备id
ruleid: "", //线路id
2 years ago
parmsList: [], //所选装置下通道参数
2 years ago
scheduleid: 0, //所选时间表id
2 years ago
//设置-获取所有通道
timeName: "",
scheduleInfo: [],
2 years ago
//获取当前装置内容
deviceListData: {}, //当前装置信息
zzchannel: [], //当前装置通道
checkList: "", //选中的通道
newcmdzzid: "",
2 years ago
newrequestId: "",
2 years ago
timer: null, //定时器
timers: null,
2 years ago
timernum: 0,
i: 0,
2 years ago
timeloading: false,
requestId: "",
newshedulenr: [], //装置时间表
requestList: [],
requestArr: [], //通过requestid获取状态
sureloading: false,
2 years ago
offsetnum: "",
2 years ago
setNum: Math.floor(Math.random() * 10),
2 years ago
compareloading: false,
timeProtocol: "",
2 years ago
};
},
2 years ago
mounted() {
console.log(this.selaccess);
},
2 years ago
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
//获取单个设备通道
getSingleAccess(id, zzid, protocol) {
this.newcmdzzid = zzid;
this.selfacilityId = id;
this.timeProtocol = protocol;
console.log(this.timeProtocol);
getChannelListJoggle({ termid: id })
.then((res) => {
this.accesslist = res.data.list;
2 years ago
console.log(this.accesslist);
2 years ago
this.selaccess = res.data.list[0].channelid;
2 years ago
//this.inquireRealbtn();
console.log(this.selaccess);
this.loading = true;
getSchedulenr({
channelid: this.selaccess,
terminalid: this.selfacilityId,
})
.then((res) => {
this.shedulenr = res.data.list;
console.log(res.data.offset);
this.offsetnum = res.data.offset;
console.log(this.offsetnum);
console.log("aaaaa");
console.log(this.shedulenr);
//湖南规约
if (this.timeProtocol == "65283") {
console.log("1111111111111111111111111111111111111");
var hnarr = [];
for (var i = 0; i < this.shedulenr.length; i++) {
if (i % 3 == 0) {
var hnobj = {};
hnobj.span =
this.shedulenr[i].hour * 60 + this.shedulenr[i].minute;
console.log("时间间隔");
} else if (i % 3 == 1) {
console.log("开始时间");
console.log("a");
let timeDate = new Date();
timeDate.setHours(this.shedulenr[i].hour);
timeDate.setMinutes(this.shedulenr[i].minute);
console.log(timeDate);
hnobj.startTime = timeDate;
} else if (i % 3 == 2) {
console.log("结束时间");
hnobj.endTime =
this.shedulenr[i].hour + ":" + this.shedulenr[i].minute;
let timeDate = new Date();
timeDate.setHours(this.shedulenr[i].hour);
timeDate.setMinutes(this.shedulenr[i].minute);
// hnobj.endTime = c.toJSON();
let timeHour =
timeDate.getHours() < 10
? "0" + timeDate.getHours()
: timeDate.getHours();
let timeMinute =
timeDate.getMinutes() < 10
? "0" + timeDate.getMinutes()
: timeDate.getMinutes();
hnobj.endTime = timeDate;
hnarr.push(hnobj);
}
}
console.log("222222222222222222");
console.log(hnarr);
console.log("22222222222222222222222");
let dayArr = [];
//根据开始时间结束时间生产数组
for (let k = 0; k < hnarr.length; k++) {
console.log(hnarr[k].startTime);
console.log(hnarr[k].endTime);
console.log(hnarr[k].span);
let startDay = hnarr[k].startTime;
let endDay = hnarr[k].endTime;
console.log(startDay, endDay);
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);
}
// // 将结束日期的天放进数组
dayArr.push(
this.$moment(new Date(endDay)).format("YYYY-MM-DD HH:mm")
);
console.log(dayArr);
this.shedulenr = dayArr;
}
}
//河南规约
if (
this.timeProtocol == "65286" ||
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南规约");
var hnarr = [];
for (var i = 0; i < this.shedulenr.length; i++) {
console.log(this.shedulenr[i].hour);
let timeDate = new Date();
timeDate.setHours(this.shedulenr[i].hour);
timeDate.setMinutes(this.shedulenr[i].minute);
console.log(timeDate);
hnarr.push(timeDate);
}
console.log(hnarr);
this.shedulenr = hnarr;
}
2 years ago
this.loading = false;
})
.catch((err) => {
this.$message.error("查询失败");
});
})
.catch((err) => {});
2 years ago
},
//changeSelect\选择通道
changeSelect() {
console.log(this.selaccess);
2 years ago
this.loading = true;
this.newshedulenr = [];
getSchedulenr({
channelid: this.selaccess,
terminalid: this.selfacilityId,
2 years ago
})
.then((res) => {
this.shedulenr = res.data.list;
console.log(this.shedulenr);
//湖南规约
if (this.timeProtocol == "65283") {
console.log("1111111111111111111111111111111111111");
var hnarr = [];
for (var i = 0; i < this.shedulenr.length; i++) {
if (i % 3 == 0) {
var hnobj = {};
hnobj.span =
this.shedulenr[i].hour * 60 + this.shedulenr[i].minute;
console.log("时间间隔");
} else if (i % 3 == 1) {
console.log("开始时间");
console.log("a");
let timeDate = new Date();
timeDate.setHours(this.shedulenr[i].hour);
timeDate.setMinutes(this.shedulenr[i].minute);
console.log(timeDate);
hnobj.startTime = timeDate;
} else if (i % 3 == 2) {
console.log("结束时间");
hnobj.endTime =
this.shedulenr[i].hour + ":" + this.shedulenr[i].minute;
let timeDate = new Date();
timeDate.setHours(this.shedulenr[i].hour);
timeDate.setMinutes(this.shedulenr[i].minute);
// hnobj.endTime = c.toJSON();
let timeHour =
timeDate.getHours() < 10
? "0" + timeDate.getHours()
: timeDate.getHours();
let timeMinute =
timeDate.getMinutes() < 10
? "0" + timeDate.getMinutes()
: timeDate.getMinutes();
hnobj.endTime = timeDate;
hnarr.push(hnobj);
}
}
console.log("222222222222222222");
console.log(hnarr);
console.log("22222222222222222222222");
let dayArr = [];
//根据开始时间结束时间生产数组
for (let k = 0; k < hnarr.length; k++) {
console.log(hnarr[k].startTime);
console.log(hnarr[k].endTime);
console.log(hnarr[k].span);
let startDay = hnarr[k].startTime;
let endDay = hnarr[k].endTime;
console.log(startDay, endDay);
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);
}
// // 将结束日期的天放进数组
dayArr.push(
this.$moment(new Date(endDay)).format("YYYY-MM-DD HH:mm")
);
console.log(dayArr);
this.shedulenr = dayArr;
}
}
//河南规约
if (
this.timeProtocol == "65286" ||
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南安徽规约");
var hnarr = [];
for (var i = 0; i < this.shedulenr.length; i++) {
console.log(this.shedulenr[i].hour);
let timeDate = new Date();
timeDate.setHours(this.shedulenr[i].hour);
timeDate.setMinutes(this.shedulenr[i].minute);
console.log(timeDate);
hnarr.push(timeDate);
}
console.log(hnarr);
this.shedulenr = hnarr;
}
2 years ago
this.offsetnum = res.data.offset;
2 years ago
this.loading = false;
})
.catch((err) => {
this.$message.error("查询失败");
});
2 years ago
},
//查询时间表
inquirebtn() {
console.log(this.selaccess, this.selfacilityId);
2 years ago
this.compareloading = true;
cmaSchelduleDetials({
channelid: this.selaccess,
terminalid: this.selfacilityId,
})
.then((res) => {
console.log(res);
this.requestId = res.data.requestId;
this.realNewtime();
this.timer = window.setInterval(() => {
//console.log(this.requestList);
this.realNewtime();
this.timernum++;
}, 3000);
})
.catch((err) => {
this.$message.error("查询失败");
});
},
2 years ago
//查询真是时间时间表
realNewtime() {
getCmaSchelduleDetials({
requestid: this.requestId,
})
.then((res) => {
if (res.code == 200) {
if (res.data.isNew == true) {
// this.shedulenr = res.data.list.join("; ")
2 years ago
this.compareloading = false;
this.newshedulenr = res.data.list;
this.offsetnum = res.data.offset;
console.log("qqqqqqqqqqqqqqqqqqqqqq");
console.log(this.offsetnum);
//湖南规约
if (this.timeProtocol == "65283") {
console.log("湖南规约");
console.log("1111111111111111111111111111111111111");
var hnarr = [];
for (var i = 0; i < this.newshedulenr.length; i++) {
if (i % 3 == 0) {
var hnobj = {};
hnobj.span =
this.newshedulenr[i].hour * 60 +
this.newshedulenr[i].minute;
console.log("时间间隔");
} else if (i % 3 == 1) {
console.log("开始时间");
console.log("a");
let timeDate = new Date();
timeDate.setHours(this.newshedulenr[i].hour);
timeDate.setMinutes(this.newshedulenr[i].minute);
console.log(timeDate);
hnobj.startTime = timeDate;
} else if (i % 3 == 2) {
console.log("结束时间");
hnobj.endTime =
this.newshedulenr[i].hour +
":" +
this.newshedulenr[i].minute;
let timeDate = new Date();
timeDate.setHours(this.newshedulenr[i].hour);
timeDate.setMinutes(this.newshedulenr[i].minute);
// hnobj.endTime = c.toJSON();
let timeHour =
timeDate.getHours() < 10
? "0" + timeDate.getHours()
: timeDate.getHours();
let timeMinute =
timeDate.getMinutes() < 10
? "0" + timeDate.getMinutes()
: timeDate.getMinutes();
hnobj.endTime = timeDate;
hnarr.push(hnobj);
}
}
console.log("222222222222222222");
console.log(hnarr);
console.log("22222222222222222222222");
let dayArr = [];
//根据开始时间结束时间生产数组
for (let k = 0; k < hnarr.length; k++) {
console.log(hnarr[k].startTime);
console.log(hnarr[k].endTime);
console.log(hnarr[k].span);
let startDay = hnarr[k].startTime;
let endDay = hnarr[k].endTime;
console.log(startDay, endDay);
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);
}
// // 将结束日期的天放进数组
dayArr.push(
this.$moment(new Date(endDay)).format("YYYY-MM-DD HH:mm")
);
console.log(dayArr);
this.newshedulenr = dayArr;
}
}
//河南规约
if (
this.timeProtocol == "65286" ||
2 years ago
this.timeProtocol == "65282" ||
this.timeProtocol == "65281"
) {
console.log("河南安徽规约");
var hnarr = [];
for (var i = 0; i < this.newshedulenr.length; i++) {
console.log(this.newshedulenr[i].hour);
let timeDate = new Date();
timeDate.setHours(this.newshedulenr[i].hour);
timeDate.setMinutes(this.newshedulenr[i].minute);
console.log(timeDate);
hnarr.push(timeDate);
}
console.log(hnarr);
this.newshedulenr = hnarr;
}
this.timernum = 0;
// this.$message.success("查询成功");
clearInterval(this.timer);
this.timer = null;
} else if (this.timernum > 9) {
2 years ago
this.compareloading = false;
this.searchloading = false;
this.timernum = 0;
2 years ago
this.$message.warning("暂无拍照时间表!");
clearInterval(this.timer);
this.timer = null;
}
} else {
this.$message.error(res.code.msg);
}
})
.catch((err) => {
2 years ago
this.compareloading = false;
this.$message.error("查询失败");
clearInterval(this.timer);
this.timer = null;
});
},
2 years ago
//获取线路列表数据
deviceList() {
getScheduleRulelListJoggle({
pageindex: this.page,
pagesize: this.pageSize,
2 years ago
})
.then((res) => {
// this.deviceTableData = res.data.list;
// this.total = res.data.total;
// console.log(this.deviceTableData);
// this.loading = false;
this.newList = [];
this.deviceTableData = res.data.list;
this.total = res.data.total;
2 years ago
this.loading = false;
// for (var i = 0; i < this.deviceTableData.list.length; i++) {
// console.log(this.deviceTableData.list[i]);
// }
// console.log(this.deviceTableData);
for (var i = 0; i < this.deviceTableData.length; i++) {
var arr = [];
console.log(this.deviceTableData[i]);
for (var k = 0; k < this.deviceTableData[i].list.length; k++) {
if (k % 3 == 0) {
var obj = {};
obj.span =
this.deviceTableData[i].list[k].hour * 60 +
this.deviceTableData[i].list[k].minute;
console.log("时间间隔");
} else if (k % 3 == 1) {
console.log("开始时间");
console.log("a");
// obj.startTime =
// this.deviceTableData[i].list[k].hour +
// ":" +
// this.deviceTableData[i].list[k].minute;
// console.log(new Date());
let timeDate = new Date();
timeDate.setHours(this.deviceTableData[i].list[k].hour);
timeDate.setMinutes(this.deviceTableData[i].list[k].minute);
console.log(timeDate);
// console.log(new Date().getHours());
// console.log(
// new Date().setHours(this.deviceTableData[i].list[k].hour)
// );
// console.log(d.getHours() + ":" + d.getMinutes());
// if (timeDate.getHours() < 10) {
// console.log(timeDate.getHours());
// obj.startTime =
// "0" + timeDate.getHours() + ":" + timeDate.getMinutes();
// } else {
// }
// let timeHour =
// timeDate.getHours() < 10
// ? "0" + timeDate.getHours()
// : timeDate.getHours();
// let timeMinute =
// timeDate.getMinutes() < 10
// ? "0" + timeDate.getMinutes()
// : timeDate.getMinutes();
obj.startTime = timeDate.toUTCString();
} else if (k % 3 == 2) {
console.log("结束时间");
obj.endTime =
this.deviceTableData[i].list[k].hour +
":" +
this.deviceTableData[i].list[k].minute;
let timeDate = new Date();
timeDate.setHours(this.deviceTableData[i].list[k].hour);
timeDate.setMinutes(this.deviceTableData[i].list[k].minute);
// obj.endTime = c.toJSON();
let timeHour =
timeDate.getHours() < 10
? "0" + timeDate.getHours()
: timeDate.getHours();
let timeMinute =
timeDate.getMinutes() < 10
? "0" + timeDate.getMinutes()
: timeDate.getMinutes();
//obj.startTime = timeHour + ":" + timeMinute;
// obj.endTime = timeHour + ":" + timeMinute;
obj.endTime = timeDate.toUTCString();
arr.push(obj);
}
console.log(this.deviceTableData[i].list[k]);
}
this.newList.push({
id: this.deviceTableData[i].id,
list: this.deviceTableData[i].list,
name: this.deviceTableData[i].name,
remark: this.deviceTableData[i].remark,
listTime: arr,
});
}
console.log("this.newList");
console.log(this.newList);
})
.catch((err) => {});
2 years ago
},
//点击分页
handleCurrentChange(val) {
this.page = val;
this.deviceList();
},
//设置-获取所有通道
handleSet(val) {
console.log(this.setNum);
var deviceOffsetnum = this.setNum;
2 years ago
this.loading = true;
2 years ago
this.scheduleid = val.id;
this.isShowset = true;
2 years ago
console.log(val);
this.scheduleInfo = val.listTime;
console.log("1111111", deviceOffsetnum);
2 years ago
this.timeName = val.name;
getScheduleRulelAccessList({ termid: this.selfacilityId })
.then((res) => {
this.listnr = res.data.list;
2 years ago
console.log("1111111111111111111");
console.log(this.listnr);
2 years ago
this.deviceListData = {
dyname: this.listnr[0].name,
dyid: this.listnr[0].id,
xlname: this.listnr[0].list[0].name,
xlid: this.listnr[0].list[0].id,
2 years ago
zzname:
this.listnr[0].list[0].list[0].name == null
? this.listnr[0].list[0].list[0].cmdid
: this.listnr[0].list[0].list[0].name,
2 years ago
zzcmid: this.listnr[0].list[0].list[0].cmdid,
zzid: this.listnr[0].list[0].list[0].id,
zzprotocol: this.timeProtocol,
offsetNum: deviceOffsetnum,
2 years ago
};
this.zzchannel = this.listnr[0].list[0].list[0].list;
console.log(this.deviceListData);
console.log(this.zzchannel);
this.this.loading = false;
})
.catch((err) => {});
2 years ago
},
//获取所选值
getCheckedNodes() {
2 years ago
this.parmsList = [];
const checkedNodes = this.$refs.tree.getCheckedNodes(false, true); //若节点可被选择,则返回目前被选中的节点所组成的数组
//const checkedParam = []; //定义选中的数组
let index = -1;
2 years ago
// console.log(checkedNodes);
if (checkedNodes.length !== 0) {
checkedNodes.forEach((item) => {
// 父节点结构的情况 判断是否有list子节点如果有定义数组结构
if (item.list !== undefined) {
index++;
this.parmsList[index] = {
//name: item.name,
termid: item.id,
channelidlist: [],
};
} else {
//如果没有list 把子节点id push到 定义的数组channelidlist中
this.parmsList[index].channelidlist.push(item.id);
}
//通过bsManufacturer 判断是否是 线路 获取线路id
2 years ago
// if (item.bsManufacturer !== undefined) {
// this.ruleid = item.id;
// console.log(this.ruleid);
// }
});
}
2 years ago
// console.log(this.parmsList);
//遍历删除没有channelichilddlist的数据只留下通道
this.parmsList = this.parmsList
.filter((item) => item.channelidlist.length !== 0)
.map((item) => {
return {
termid: item.termid,
channelidlist: item.channelidlist,
};
});
2 years ago
// console.log(this.parmsList);
return this.parmsList;
2 years ago
},
2 years ago
//选择通道
handleChange() {
//console.log(this.listnr);
console.log(this.checkList);
// this.$refs.tree.setCheckedKeys(this.checkedAisle);
},
2 years ago
// 保存确定操作
submitForm() {
2 years ago
//this.getCheckedNodes();
2 years ago
console.log(this.deviceListData);
console.log(this.checkList);
console.log(this.scheduleid);
2 years ago
if (this.checkList.length == 0) {
this.$message.error("请选择通道");
} else {
2 years ago
getTermStatus({ termId: this.deviceListData.zzid }).then((res) => {
console.log(res);
if (res.data.isonline) {
var ruleBox = [];
//循环装置
//循环时间规则
let timearr = [];
let dayArr = [];
console.log(this.scheduleInfo);
for (var j = 0; j < this.scheduleInfo.length; j++) {
var Stime = moment(this.scheduleInfo[j].startTime)
.add(this.deviceListData.offsetNum, "minute")
.format();
var Etime = moment(this.scheduleInfo[j].endTime)
.add(this.deviceListData.offsetNum, "minute")
.format();
var lastETime = moment(this.scheduleInfo[j].endTime).format();
var spanTime = this.scheduleInfo[j].span;
console.log(Stime, Etime, spanTime);
console.log(moment(this.scheduleInfo[j].endTime).hour());
//判断湖南规约
if (this.deviceListData.zzprotocol == "65283") {
console.log("湖南规约");
console.log(Stime, Etime);
console.log(typeof Stime);
console.log(
moment(this.scheduleInfo[j].endTime)
.add(this.deviceListData.offsetNum, "minute")
.hour()
);
console.log(
moment(this.scheduleInfo[j].endTime)
.add(this.deviceListData.offsetNum, "minute")
.minute()
);
if (moment().isSame(moment(Etime), "day")) {
//如果是同一天
timearr.push(
{
hour: Math.floor(this.scheduleInfo[j].span / 60),
minute: this.scheduleInfo[j].span % 60,
preset: 255,
},
{
hour: moment(this.scheduleInfo[j].startTime)
.add(this.deviceListData.offsetNum, "minute")
.hour(),
minute: moment(this.scheduleInfo[j].startTime)
.add(this.deviceListData.offsetNum, "minute")
.minute(),
preset: 255,
},
{
hour: moment(this.scheduleInfo[j].endTime)
.add(this.deviceListData.offsetNum, "minute")
.hour(),
minute: moment(this.scheduleInfo[j].endTime)
.add(this.deviceListData.offsetNum, "minute")
.minute(),
preset: 255,
}
);
} else {
timearr.push(
{
hour: Math.floor(this.scheduleInfo[j].span / 60),
minute: this.scheduleInfo[j].span % 60,
preset: 255,
},
{
hour: moment(this.scheduleInfo[j].startTime)
.add(this.deviceListData.offsetNum, "minute")
.hour(),
minute: moment(this.scheduleInfo[j].startTime)
.add(this.deviceListData.offsetNum, "minute")
.minute(),
preset: 255,
},
{
hour: moment(this.scheduleInfo[j].endTime).hour(),
minute: moment(this.scheduleInfo[j].endTime).minute(),
preset: 255,
}
);
}
console.log(timearr);
}
}
////判断河南规约
if (
this.deviceListData.zzprotocol == "65286" ||
2 years ago
this.deviceListData.zzprotocol == "65282" ||
this.deviceListData.zzprotocol == "65281"
) {
console.log("河南规约");
//偏移时间
//this.getDayArr(startDay, endDay);
let startDay = Stime;
let endDay = Etime;
var lastendDay = lastETime;
console.log(startDay, endDay);
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(spanTime, "minute")
.format("YYYY-MM-DD HH:mm");
console.log(startVal);
}
// // 将结束日期的天放进数组
if (!moment().isSame(moment(endDay), "day")) {
dayArr.push(
this.$moment(new Date(lastETime)).format("YYYY-MM-DD HH:mm")
);
}
console.log(dayArr);
for (var k = 0; k < dayArr.length; k++) {
//console.log(moment(dayArr[k]).hour());
timearr.push({
hour: moment(dayArr[k]).hour(),
minute: moment(dayArr[k]).minute(),
preset: 255,
});
}
// return dayArr;
}
var parmsobj = {
termid: this.deviceListData.zzid,
channelid: this.checkList,
offset: this.deviceListData.offsetNum,
list: timearr,
};
console.log(parmsobj);
ruleBox.push(parmsobj);
console.log(ruleBox);
2 years ago
setScheduleRulel({
scheduleid: this.scheduleid,
list: ruleBox,
2 years ago
})
.then((res) => {
console.log(res);
this.requestList = res.data.list;
this.requestTime();
this.timers = window.setInterval(() => {
//console.log(this.requestList);
this.requestTime();
this.i++;
}, 3000);
})
.catch((err) => {
this.$message({
duration: 1500,
showClose: true,
message: "添加失败",
type: "error",
});
});
} else {
2 years ago
this.$message({
duration: 1500,
2 years ago
showClose: true,
2 years ago
message: "装置下线,发送指令失败",
2 years ago
type: "error",
});
2 years ago
}
});
2 years ago
}
2 years ago
},
//下发时间表
requestTime() {
//
this.sureloading = true;
getCmaSchelduleUpload({
list: this.requestList,
})
.then((res) => {
console.log("aaaaaaaaaaaaaaaaaaaaaaaa");
this.requestArr = res.data.list;
this.requestList = this.requestArr.filter(function (
value,
index,
arr
) {
console.log(value, index, arr);
return value.status !== 1;
});
console.log(this.requestArr);
if (this.requestList.length == 0) {
this.isShowset = false;
this.sureloading = false;
this.$message.success("下发成功");
clearInterval(this.timers);
this.timers = null;
} else if (this.i > 9) {
this.isShowset = false;
this.sureloading = false;
this.i = 0;
this.$message.warning("下发失败,请稍后再试!");
clearInterval(this.timers);
this.timers = null;
}
})
.catch((err) => {});
},
2 years ago
closebtn() {
this.isShowset = false;
2 years ago
this.deviceListData = [];
this.checkList = "";
// this.setNum = this.offsetnum;
2 years ago
this.deviceList();
clearInterval(this.timers);
this.timers = null;
2 years ago
},
2 years ago
display() {
this.isShow = true;
2 years ago
},
hide() {
this.isShow = false;
},
2 years ago
handleclose() {
this.newshedulenr = [];
this.shedulenr = [];
2 years ago
console.log("关闭轮询");
clearInterval(this.timers);
this.timers = null;
2 years ago
},
},
2 years ago
};
</script>
<style lang="less">
2 years ago
.setTimeDialog {
2 years ago
.el-tabs__content {
2 years ago
height: 400px;
2 years ago
overflow: auto;
.el-tab-pane {
height: calc(100% - 16px);
}
}
.timebox {
//width: 410px;
margin: auto;
}
2 years ago
.flexonly {
display: flex;
flex-wrap: wrap;
2 years ago
align-content: flex-start;
2 years ago
}
.flexno {
display: flex;
margin-top: 16px;
2 years ago
padding: 0px 8px;
flex-direction: column;
height: 294px;
.timehead {
display: flex;
line-height: 32px;
margin-bottom: 8px;
label {
margin-right: 6px;
width: 80px;
}
}
.timeShow {
//display: flex;
.leftTime {
width: 50%;
float: left;
}
.rightTime {
width: 50%;
float: right;
2 years ago
position: relative;
.offtime {
position: absolute;
top: 0px;
left: 78px;
}
}
}
}
.searchBtn {
font-size: 14px;
2 years ago
display: flex;
margin-left: auto;
2 years ago
span {
text-decoration-line: underline;
}
2 years ago
}
.flexnr {
display: flex;
align-items: center;
2 years ago
margin-top: 16px;
padding: 0px 8px;
2 years ago
}
.mt10 {
2 years ago
margin-bottom: 10px;
2 years ago
}
.mr10 {
margin-right: 10px;
}
.w8 {
width: 80px;
margin-bottom: 8px;
2 years ago
}
.w80 {
width: 80%;
2 years ago
overflow-y: auto;
2 years ago
height: 210px;
2 years ago
}
.mr20 {
margin-right: 20px;
}
2 years ago
.deviceTable {
padding: 16px 8px 0 8px;
2 years ago
height: calc(100% - 16px);
.el-table--small {
margin-bottom: 8px;
}
2 years ago
.rulesBox {
display: flex;
flex-direction: row;
li {
list-style: none;
margin-right: 24px;
line-height: 24px;
span {
margin-right: 4px;
}
.el-tag--small {
height: 16px;
padding: 0 8px;
line-height: 16px;
}
}
}
2 years ago
2 years ago
.timeGz {
2 years ago
line-height: 26px;
2 years ago
2 years ago
span {
margin: 0px 8px;
}
b {
font-weight: normal;
color: @color-primary;
}
2 years ago
}
2 years ago
2 years ago
.pageNation {
justify-content: flex-start;
}
2 years ago
}
}
.setRoadDialog {
.el-dialog__body {
2 years ago
height: 400px;
2 years ago
overflow: auto;
.el-form {
height: 100%;
//background: #fcc;
}
.setTimeTd {
h3 {
margin: 8px 0px;
font-size: 16px;
line-height: 24px;
}
2 years ago
.timename {
margin: 8px 0px;
}
2 years ago
.flexTimeGz {
display: flex;
flex-wrap: wrap;
.timeGz {
line-height: 32px;
margin-right: 16px;
span {
margin: 0px 8px;
}
b {
font-weight: normal;
color: @color-primary;
}
2 years ago
}
}
2 years ago
.math {
margin-top: 12px;
margin-bottom: 12px;
}
}
2 years ago
}
2 years ago
}
2 years ago
</style>