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.

455 lines
11 KiB
Vue

2 years ago
<template>
2 years ago
<el-dialog
2 years ago
class="photoSetDialog"
2 years ago
title="设置"
:visible.sync="isShow"
:close-on-click-modal="false"
2 years ago
width="1020px"
@close="handleclose"
2 years ago
>
<div class="setTimeTd">
2 years ago
<div class="ruleBox">
<h3>时间表规则</h3>
<div class="flexTimeGz">
<p class="timeGz" v-for="(val, index) in ruleSchedule" :key="index">
<span>
{{
val.startTime.substring(0, val.startTime.lastIndexOf(":"))
}}</span
>
~
<span>{{
val.endTime.substring(0, val.endTime.lastIndexOf(":"))
}}</span>
间隔<b>{{ val.span }}分钟</b>
</p>
</div>
2 years ago
</div>
2 years ago
<!-- <h3>设置通道</h3> -->
2 years ago
<div class="chooseTDBox">
2 years ago
<label>选择通道:</label>
2 years ago
<div class="checkBox">
2 years ago
<el-radio-group v-model="checkedAisle" @change="handleChange">
<el-radio
:label="val.id"
border
v-for="val in aisleList"
:key="val.id"
>{{ val.name }}</el-radio
>
</el-radio-group>
2 years ago
</div>
</div>
<div class="flexnr" v-loading="loading" v-if="newzzList.length !== 0">
2 years ago
<el-tree
:data="newzzList"
show-checkbox
:props="defaultProps"
ref="tree"
node-key="id"
:default-expand-all="true"
2 years ago
@check-change="getCheckedNodes"
2 years ago
>
2 years ago
<div
2 years ago
v-if="!data.list"
2 years ago
class="custom-tree-node nodelist"
2 years ago
slot-scope="{ data }"
>
<span class="mr10">{{ data.name }}</span>
2 years ago
<div class="math">
偏移时间()
<el-input-number
v-model="data.offsetNum"
:min="0"
:max="9"
></el-input-number>
</div>
2 years ago
<div
class="deStatus"
v-if="allCheckNode.indexOf(data) != -1 && showtag"
>
<!-- <el-tag type="success">下发成功</el-tag> -->
<el-tag type=""><i class="el-icon-loading"></i>下发中</el-tag>
<!-- <el-tag type="danger">下发失败</el-tag> -->
</div>
2 years ago
</div>
<span v-else class="custom-tree-node" slot-scope="{ data }">
2 years ago
<span>{{ data.name }}</span>
</span>
</el-tree>
</div>
<div class="flexnr" v-else>
2 years ago
<p class="nochannel">暂无图像监测装置</p>
2 years ago
</div>
2 years ago
</div>
2 years ago
<div slot="footer" class="dialog-footer">
2 years ago
<!-- <el-button @click="getCheckedNodes"></el-button> -->
<el-button @click="handleclose"> </el-button>
<el-button type="primary" @click="submitForm()" :loading="sureloading"
> </el-button
>
2 years ago
</div>
</el-dialog>
</template>
<script>
2 years ago
import {
setScheduleRulel,
getScheduleRulelAccessList,
2 years ago
getTermListByChannelJoggle,
2 years ago
getCmaSchelduleUpload,
2 years ago
} from "@/utils/api/index";
2 years ago
export default {
props: {
2 years ago
title: String,
2 years ago
},
data() {
return {
2 years ago
isactive: "",
2 years ago
contentStyle: { width: "90px" },
2 years ago
isShow: false,
2 years ago
selid: 0, //选中时间表id
ruleSchedule: [], //时间表规则
checkedAisle: "", //选中通道数据
aisleList: [], //通道数据内容
listnr: [], //通道树状结构
2 years ago
defaultProps: {
2 years ago
children: "list",
label: "name",
2 years ago
},
2 years ago
termidArr: [],
ruleid: "",
2 years ago
parmsList: [], //选中的通道
multipleSelection: [],
2 years ago
//新是数据结构参数
newzzList: [],
2 years ago
zzListCheck: [],
loading: false,
2 years ago
2 years ago
//全选
checkAll: true,
isIndeterminate: true, //全选设置默认选中
2 years ago
timer: null,
termidArrNum: -1,
2 years ago
requestList: [],
timer: null,
i: 0,
2 years ago
isCheck: false,
checkNode: null,
2 years ago
zzsuccess: false,
zzpending: false,
zzerror: false,
2 years ago
allCheckNode: [], //获取选中的节点
requestArr: [], //通过requestid获取状态
termzzid: [],
flag: false,
sureloading: false,
2 years ago
showtag: false,
2 years ago
};
},
2 years ago
mounted() {},
2 years ago
methods: {
//判断
2 years ago
getdataform(val) {
this.selid = val.id;
2 years ago
this.ruleSchedule = val.list;
console.log(this.ruleSchedule, "时间规则");
2 years ago
this.getlistnr();
2 years ago
},
//获取所有通道
2 years ago
getlistnr() {
getScheduleRulelAccessList({})
.then((res) => {
this.listnr = res.data.list;
2 years ago
this.aisleList = res.data.channellist;
2 years ago
})
.catch((err) => {});
2 years ago
},
2 years ago
2 years ago
//选择通道
2 years ago
handleChange() {
console.log(this.checkedAisle);
this.loading = true;
2 years ago
getTermListByChannelJoggle({
id: this.checkedAisle,
})
.then((res) => {
console.log(res);
this.newzzList = res.data.list;
2 years ago
console.log(this.newzzList);
2 years ago
//console.log(a);
this.newzzList = this.getChildren(this.newzzList);
console.log(this.newzzList);
this.loading = false;
2 years ago
})
.catch((err) => {});
2 years ago
},
2 years ago
//// 给数组里的每一个对象都添加一个isEdit属性
getChildren(data) {
console.log(data);
return data.map((item) => {
console.log(item);
item = Object.assign({}, item);
item.offsetNum = Math.floor(Math.random() * 10);
if (!!item.list && item.list.length > 0) {
item.list = this.getChildren(item.list);
}
return item;
});
},
handleCheckBox() {
console.log(this.zzListCheck);
},
2 years ago
2 years ago
// //获取所选值
2 years ago
getCheckedNodes(nodeObj) {
2 years ago
this.allCheckNode = this.$refs.tree.getCheckedNodes();
2 years ago
// console.log(this.allCheckNode);
console.log(nodeObj);
this.isactive = nodeObj.id;
this.isCheck = this.$refs.tree.getCheckedNodes().indexOf(nodeObj) > -1;
console.log(this.isCheck);
2 years ago
},
2 years ago
2 years ago
// 保存确定操作
submitForm() {
2 years ago
//console.log(this.termidArr);
2 years ago
this.sureSum();
2 years ago
this.showtag = true;
2 years ago
},
//时间表
sureSum() {
2 years ago
//console.log(this.termidArr);
2 years ago
console.log(this.checkedAisle);
var ruleBox = [];
2 years ago
for (var i = 0; i < this.allCheckNode.length; i++) {
2 years ago
var parmsobj = {
2 years ago
termid: this.allCheckNode[i].id,
2 years ago
channelidlist: [this.checkedAisle],
2 years ago
offset: this.allCheckNode[i].offsetNum,
2 years ago
};
console.log(parmsobj);
ruleBox.push(parmsobj);
}
console.log(ruleBox);
2 years ago
setScheduleRulel({
2 years ago
list: ruleBox,
2 years ago
scheduleid: this.selid,
})
.then((res) => {
2 years ago
console.log(res);
2 years ago
this.requestList = res.data.list;
this.requestTime();
this.timer = window.setInterval(() => {
//console.log(this.requestList);
this.requestTime();
this.i++;
}, 3000);
})
2 years ago
.catch((err) => {
2 years ago
this.$message({
duration: 1500,
2 years ago
showClose: true,
message: "添加失败",
type: "error",
});
2 years ago
});
2 years ago
},
2 years ago
//根据requestid查询时间表下发状态
requestTime() {
this.sureloading = true;
2 years ago
getCmaSchelduleUpload({
list: this.requestList,
})
.then((res) => {
2 years ago
this.requestArr = res.data.list;
this.requestList = this.requestArr.filter(function (
value,
index,
arr
) {
console.log(value, index, arr);
2 years ago
return value.status !== 1;
});
if (this.requestList.length == 0) {
this.zzsuccess = true;
this.$message.success("下发成功");
clearInterval(this.timer);
this.timer = null;
this.isShow = false;
this.sureloading = false;
2 years ago
this.showtag = false;
} else if (this.i > 9) {
this.zzerror = true;
this.i = 0;
this.$message.warning("下发失败,请稍后再试!");
clearInterval(this.timer);
this.timer = null;
this.isShow = false;
2 years ago
this.showtag = false;
this.sureloading = false;
2 years ago
}
})
.catch((err) => {});
},
2 years ago
display() {
2 years ago
this.isShow = true;
2 years ago
},
handleclose() {
2 years ago
this.isShow = false;
this.newzzList = [];
this.checkedAisle = "";
console.log(this.allCheckNode, "1111111111");
2 years ago
clearTimeout(this.timer);
this.timer = null;
2 years ago
this.sureloading = false;
2 years ago
this.showtag = false;
2 years ago
},
},
2 years ago
};
</script>
2 years ago
<style lang="less">
2 years ago
.photoSetDialog {
2 years ago
.el-dialog__body {
// height: 360px;
// overflow: auto;
}
2 years ago
.flexnr {
2 years ago
height: 360px;
overflow: auto;
2 years ago
display: flex;
align-items: flex-start;
2 years ago
border: 1px solid #eee;
padding: 16px;
border-radius: 4px;
2 years ago
.el-tree {
flex: 1;
border: 1px solid #eee;
.el-tree-node {
.el-tree-node__content {
height: 40px;
border-bottom: 1px solid #eee;
.mr10 {
margin-right: 10px;
width: 180px;
}
.nodelist {
display: flex;
align-items: center;
.math {
margin-left: 32px;
}
.deStatus {
margin-left: 24px;
}
}
}
}
}
2 years ago
.dybox {
h4 {
font-size: 14px;
color: #333;
line-height: 24px;
font-weight: normal;
}
.xlbox {
h4 {
font-size: 14px;
color: #333;
line-height: 24px;
font-weight: normal;
}
margin-left: 16px;
.zzbox {
2 years ago
h4 {
}
.el-checkbox-group {
2 years ago
// display: flex;
// flex-direction: column;
2 years ago
margin-left: 22px;
.el-checkbox {
2 years ago
line-height: 28px;
//width: 196px;
.el-checkbox__label {
b {
margin-left: 18px;
font-weight: normal;
font-size: 12px;
}
}
}
}
}
}
}
.nochannel {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
2 years ago
}
2 years ago
}
.w50 {
width: 50px;
}
.setTimeTd {
2 years ago
.ruleBox {
display: flex;
align-items: center;
}
h3 {
margin: 8px 0px;
font-size: 16px;
line-height: 24px;
}
2 years ago
.flexTimeGz {
display: flex;
flex-wrap: wrap;
.timeGz {
line-height: 32px;
margin-right: 16px;
b {
font-weight: normal;
2 years ago
color: @color-primary;
2 years ago
}
span {
margin: 0px 8px;
}
2 years ago
}
}
2 years ago
.setCheckbox {
.el-table__header .el-table-column--selection .cell .el-checkbox:after {
color: #333;
content: "全选";
font-size: 16px;
margin-left: 12px;
font-weight: bold;
}
}
}
2 years ago
.chooseTDBox {
display: flex;
align-items: center;
2 years ago
margin-bottom: 8px;
2 years ago
margin-top: 12px;
2 years ago
label {
margin-right: 8px;
}
}
.treeTable {
margin-top: 16px;
}
2 years ago
}
</style>