参数弹窗添加装置编号

ds1.0
fanluyan 2 years ago
parent 3d2f772f15
commit b64ae957ba

@ -258,3 +258,20 @@ 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) => {});
},

@ -0,0 +1,508 @@
<template>
<el-dialog
class="photoSetDialog"
title="设置"
:visible.sync="isShow"
:close-on-click-modal="false"
width="1020px"
@close="handleclose"
>
<div class="setTimeTd" v-loading="timeboxLoading">
<div class="headTitle">
<div class="rulesInfo">
<h3>时间表规则</h3>
<div class="timeBox" v-for="(val, index) in rulesList" :key="index">
<div class="timeSlot">
{{
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()
}}
~
{{
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()
}}
</div>
<div class="timespan">
间隔<b>{{ val.span }}分钟</b>
</div>
</div>
</div>
</div>
<div class="mathFloor">
<span class="mathTitle">设置偏移量(max:10)</span>
<el-input-number v-model="mathMam" :min="0" :max="10"></el-input-number>
<el-button type="primary" @click="setMathFloor()"></el-button>
</div>
<div class="channelBox">
<span class="channelTitle">选择通道</span>
<div class="checkBox" v-if="channelList.length !== 0">
<el-radio-group v-model="checkedAisle" @change="handleChange">
<el-radio
:label="val.id"
border
v-for="val in channelList"
:key="val.id"
>{{ val.name }}</el-radio
>
</el-radio-group>
</div>
</div>
<div class="treebox" v-loading="treeloading">
<el-tree
ref="tree"
:data="treeList"
:props="defaultProps"
show-checkbox
node-key="id"
default-expand-all
:expand-on-click-node="false"
@check="getCheckedNodes"
>
<div
class="custom-tree-node"
slot-scope="{ node, data }"
v-if="!data.list"
>
<span class="zzCmdidbox">{{
data.name == null ? data.cmdid : data.name
}}</span
>-- <span>{{ data.id }}</span
>-- <span>{{ data.onlinestatus == 0 ? "离线" : "在线" }}</span
>--
<span>{{ data.protocol }}</span>
<div class="math">
偏移时间()
<el-input-number
v-model="data.offsetNum"
:min="0"
:max="mathMam"
></el-input-number>
</div>
<div class="xfBack" v-if="allCheckNode.indexOf(data) != -1">
<el-tag v-if="data.xfloading"
><i class="el-icon-loading"></i>下发中</el-tag
>
<el-tag v-if="data.xferror" type="danger"
><i class="el-icon-error"></i>下发失败</el-tag
>
<el-tag v-if="data.xfsuccess" type="success"
><i class="el-icon-success"></i>下发成功</el-tag
>
<el-button size="mini" v-if="data.xferror" @click="reissue(data)"
>重新下发</el-button
>
</div>
</div>
<div v-else class="custom-tree-node" slot-scope="{ data }">
<span>{{ data.name == null ? data.cmdid : data.name }}</span>
</div>
</el-tree>
</div>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="getCheckedNodes"></el-button> -->
<el-button @click="handleclose"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {
setScheduleRulel,
getScheduleRulelAccessList,
getTermListByChannelJoggle,
//setTermCamera,
//getTermCameraRequest,
getCmaSchelduleUpload,
} from "@/utils/api/index";
// import moment from "moment";
export default {
data() {
return {
isShow: false,
timeboxLoading: false,
rulesTimeList: "", //
rulesList: [],
rulesid: "", //id
mathMam: 0, //0
checkedAisle: 1, //
channelList: [], //
treeloading: false,
treeList: [], //
defaultProps: {
children: "list",
label: "name",
disabled: this.disabledFn,
},
allCheckNode: [], //
groupNum: "", //
xfloading: false,
xferror: false,
xfsuccess: false,
requestList: [], //requesids
timer: null,
imun: 0,
successTermid: [], //
errorTermid: [], //
};
},
mounted() {},
methods: {
//
getdataform(val) {
console.log(val);
this.rulesTimeList = val;
this.rulesid = val.id;
this.rulesList = val.listTime;
this.timeboxLoading = true;
this.getChannelList();
},
//
setMathFloor() {
console.log(this.mathMam);
this.handleChange();
},
//线
disabledFn(data, node) {
if (node.level == 3) {
if (!data.onlinestatus) {
//
return true;
} else {
return false;
}
}
},
// //
getCheckedNodes(nodeObj) {
console.log(nodeObj);
this.allCheckNode = this.$refs.tree.getCheckedNodes();
console.log(this.allCheckNode);
// console.log(nodeObj);
// console.log(this.allCheckNode);
// this.isactive = nodeObj.id || nodeObj.termid;
// this.isCheck = this.$refs.tree.getCheckedNodes().indexOf(nodeObj) > -1;
// console.log(this.isCheck);
// this.showtag = false;
},
// offsetNum
getChildren(data) {
//console.log(data);
return data.map((item) => {
//console.log(item);
item = Object.assign({}, item);
item.offsetNum = Math.floor(Math.random() * 10);
item.xfsuccess = false;
item.xferror = false;
item.xfloading = false;
if (!!item.list && item.list.length > 0) {
item.list = this.getChildren(item.list);
}
return item;
});
},
//
submitForm() {
console.log(this.allCheckNode);
this.xfloading = true;
var ruleBox = []; //
//
for (let i = 0; i < this.allCheckNode.length; i++) {
if (
this.allCheckNode[i].bsManufacturer == null ||
this.allCheckNode[i].bsManufacturer == undefined
) {
this.allCheckNode[i].xfloading = true;
let timearr = [];
let dayArr = [];
for (let j = 0; j < this.rulesList.length; j++) {
var Stime = this.$moment(this.rulesList[j].startTime).add(
this.allCheckNode[i].offsetNum,
"minute"
);
var Etime = this.$moment(this.rulesList[j].endTime).add(
this.allCheckNode[i].offsetNum,
"minute"
);
var spanTime = this.rulesList[j].span;
console.log(Stime, Etime, spanTime);
//
if (this.allCheckNode[i].protocol == "65283") {
timearr.push(
{
hour: Math.floor(spanTime / 60),
minute: spanTime % 60,
preset: 255,
},
{
hour: Stime.hour(),
minute: Etime.minute(),
preset: 255,
},
{
hour: Stime.hour(),
minute: Etime.minute(),
preset: 255,
}
);
console.log(timearr);
} else {
//
let startDay = Stime;
let endDay = Etime;
let startVal = this.$moment(new Date(startDay)).format(
"YYYY-MM-DD HH:mm"
);
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(dayArr);
for (var k = 0; k < dayArr.length; k++) {
//console.log(moment(dayArr[k]).hour());
timearr.push({
hour: this.$moment(dayArr[k]).hour(),
minute: this.$moment(dayArr[k]).minute(),
preset: 255,
});
}
console.log(timearr);
var parmsobj = {
termid: this.allCheckNode[i].id,
channelid: this.checkedAisle,
offset: this.allCheckNode[i].offsetNum,
list: timearr,
};
ruleBox.push(parmsobj);
}
}
//
setScheduleRulel({
list: ruleBox,
scheduleid: this.rulesid,
})
.then((res) => {
console.log(res);
this.requestList = res.data.list;
// this.requestTime();
this.timer = window.setInterval(() => {
//console.log(this.requestList);
this.requestTime();
this.imun++;
}, 3000);
})
.catch((err) => {});
},
//requestid
requestTime() {
this.sureloading = true;
getCmaSchelduleUpload({
list: this.requestList,
})
.then((res) => {
this.requestArr = res.data.list;
console.log(this.requestList);
this.requestList = this.requestArr.filter(function (
value,
index,
arr
) {
console.log(value, index, arr);
return value.status !== 1;
});
if (this.requestList.length == 0) {
console.log(this.successTermid);
console.log(this.errorTermid);
this.$message.success("下发成功");
clearInterval(this.timer);
this.timer = null;
} else if (this.imun > 9) {
console.log(this.requestList);
for (let m = 0; m < this.requestList.length; m++) {
console.log(this.requestList[m]);
this.errorTermid.push(this.requestList[m].termid);
}
console.log(this.errorTermid);
clearInterval(this.timer);
this.timer = null;
this.imun = 0;
// this.$message.warning("");
}
})
.catch((err) => {});
},
//
reissue(val) {
console.log(val);
val.xfloading = true;
val.xferror = false;
setTimeout(() => {
val.xfloading = false;
val.xfsuccess = true;
val.xferror = false;
}, 2000);
},
//
getChannelList() {
getScheduleRulelAccessList({})
.then((res) => {
console.log(res);
this.channelList = res.data.channellist;
this.handleChange();
})
.catch((err) => {});
},
//
handleChange() {
console.log(this.checkedAisle);
this.treeloading = true;
getTermListByChannelJoggle({
id: this.checkedAisle,
})
.then((res) => {
console.log(res);
this.timeboxLoading = false;
//this.treeList = res.data.list;
this.treeList = this.getChildren(res.data.list);
this.treeloading = false;
})
.catch((err) => {});
},
display() {
this.isShow = true;
},
clearfn() {},
handleclose() {
this.isShow = false;
},
},
};
</script>
<style lang="less">
.photoSetDialog {
.setTimeTd {
//background-color: #fcc;
.headTitle {
.rulesInfo {
display: flex;
align-items: center;
line-height: 32px;
h3 {
font-size: 14px;
font-weight: normal;
}
.timeBox {
display: flex;
align-items: center;
font-size: 14px;
margin-right: 8px;
.timeSlot {
font-size: 14px;
margin-right: 8px;
}
.timespan {
b {
font-size: 14px;
font-weight: normal;
color: #169e8c;
}
}
}
}
}
.mathFloor {
margin-top: 8px;
.mathTitle {
font-size: 14px;
font-weight: normal;
}
.el-button {
margin-left: 8px;
}
}
.channelBox {
display: flex;
align-items: center;
line-height: 32px;
margin-top: 8px;
.channelTitle {
font-size: 14px;
}
.el-radio {
margin-right: 8px;
}
}
.treebox {
margin-top: 8px;
background-color: #169e8c;
height: 366px;
// overflow: auto;
display: flex;
align-items: flex-start;
border: 1px solid #eee;
padding: 8px;
border-radius: 4px;
position: relative;
.el-tree {
width: 100%;
height: 100%;
overflow: auto;
.el-tree-node {
.el-tree-node__content {
height: 32px;
border-bottom: 1px solid #eee;
}
}
.custom-tree-node {
display: flex;
align-items: center;
.zzCmdidbox {
width: 180px;
}
.math {
margin-left: 32px;
}
.xfBack {
margin-left: 32px;
}
.el-input-number--small {
line-height: 26px;
}
.el-input--small .el-input__inner {
height: 26px;
line-height: 26px;
}
.el-input-number__increase {
height: 24px;
}
}
}
}
}
}
</style>

@ -1,248 +0,0 @@
<template>
<el-dialog
class="photoSetDialog"
title="设置"
:visible.sync="isShow"
:close-on-click-modal="false"
width="1020px"
@close="handleclose"
>
<div class="setTimeTd" v-loading="timeboxLoading">
<div class="headTitle">
<div class="rulesInfo">
<h3>时间表规则</h3>
<div
class="timeBox"
v-for="(val, index) in rulesTimeList.listTime"
:key="index"
>
<div class="timeSlot">
{{
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()
}}
~
{{
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()
}}
</div>
<div class="timespan">
间隔<b>{{ val.span }}分钟</b>
</div>
</div>
</div>
</div>
<div class="mathFloor">
<span class="mathTitle">设置偏移量(max:10)</span>
<el-input-number v-model="mathMam" :min="0" :max="10"></el-input-number>
<el-button type="primary" @click="setMathFloor()"></el-button>
</div>
<div class="channelBox">
<span class="channelTitle">选择通道</span>
<div class="checkBox" v-if="channelList.length !== 0">
<el-radio-group v-model="checkedAisle" @change="handleChange">
<el-radio
:label="val.id"
border
v-for="val in channelList"
:key="val.id"
>{{ val.name }}</el-radio
>
</el-radio-group>
</div>
</div>
<div class="treebox" v-loading="treeloading">
<el-tree
:data="treeList"
:props="defaultProps"
show-checkbox
node-key="id"
default-expand-all
:expand-on-click-node="false"
:check-on-click-node="true"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ data.name == null ? data.cmdid : data.name }}</span
>-- <span>{{ data.id }}</span
>-- <span>{{ data.onlinestatus == 0 ? "离线" : "在线" }}</span
>--
<span>{{ data.protocol }}</span>
</span>
</el-tree>
</div>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="getCheckedNodes"></el-button> -->
<el-button @click="handleclose"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {
// setScheduleRulel,
getScheduleRulelAccessList,
getTermListByChannelJoggle,
// getCmaSchelduleUpload,
} from "@/utils/api/index";
// import moment from "moment";
export default {
data() {
return {
isShow: false,
timeboxLoading: false,
rulesTimeList: "", //
mathMam: 0, //0
checkedAisle: 1, //
channelList: [], //
treeloading: false,
treeList: [], //
defaultProps: {
children: "list",
label: "name",
disabled: this.disabledFn,
},
};
},
mounted() {},
methods: {
//
getdataform(val) {
console.log(val);
this.rulesTimeList = val;
this.timeboxLoading = true;
this.getChannelList();
},
//
submitForm() {},
//
getChannelList() {
getScheduleRulelAccessList({})
.then((res) => {
console.log(res);
this.channelList = res.data.channellist;
this.handleChange();
})
.catch((err) => {});
},
//
handleChange() {
console.log(this.checkedAisle);
this.treeloading = true;
getTermListByChannelJoggle({
id: this.checkedAisle,
})
.then((res) => {
console.log(res);
this.timeboxLoading = false;
this.treeList = res.data.list;
this.treeloading = false;
})
.catch((err) => {});
},
display() {
this.isShow = true;
},
clearfn() {},
handleclose() {
this.isShow = false;
},
},
};
</script>
<style lang="less">
.photoSetDialog {
.setTimeTd {
//background-color: #fcc;
.headTitle {
.rulesInfo {
display: flex;
align-items: center;
line-height: 32px;
h3 {
font-size: 14px;
font-weight: normal;
}
.timeBox {
display: flex;
align-items: center;
font-size: 14px;
margin-right: 8px;
.timeSlot {
font-size: 14px;
margin-right: 8px;
}
.timespan {
b {
font-size: 14px;
font-weight: normal;
color: #169e8c;
}
}
}
}
}
.mathFloor {
margin-top: 8px;
.mathTitle {
font-size: 14px;
font-weight: normal;
}
.el-button {
margin-left: 8px;
}
}
.channelBox {
display: flex;
align-items: center;
line-height: 32px;
margin-top: 8px;
.channelTitle {
font-size: 14px;
}
.el-radio {
margin-right: 8px;
}
}
.treebox {
margin-top: 8px;
background-color: #169e8c;
height: 360px;
// overflow: auto;
display: flex;
align-items: flex-start;
border: 1px solid #eee;
padding: 8px;
border-radius: 4px;
position: relative;
.el-tree {
width: 100%;
height: 100%;
overflow: auto;
.el-tree-node {
.el-tree-node__content {
height: 32px;
border-bottom: 1px solid #eee;
}
}
}
}
}
}
</style>

@ -7,6 +7,7 @@
width="1100px"
@close="handleclose"
>
<div class="zzinfo">装置编号{{ rowData.cmdid }}</div>
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
<!-- <el-tab-pane label="装置时间" name="1">
<div class="deviceTime">
@ -1211,6 +1212,11 @@ export default {
</script>
<style lang="less">
.parameterSetDialog {
.zzinfo {
position: absolute;
top: 22px;
left: 126px;
}
.el-tabs__content {
height: 436px;
.deviceTime {

Loading…
Cancel
Save