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.

486 lines
14 KiB
Vue

2 years ago
<template>
<el-dialog
2 years ago
class="setTimeDialog"
title="时间表设置"
:visible.sync="isShow"
:close-on-click-modal="false"
2 years ago
width="60%"
>
2 years ago
<el-tabs v-model="activeName" @tab-click="handleClick" v-loading="loading">
<el-tab-pane label="查询实际时间表" name="1">
2 years ago
<div class="flexnr">
<div class="w8">通道:</div>
<el-select v-model="selaccess" placeholder="请选择" class="mr20">
<el-option
v-for="item in accesslist"
2 years ago
:key="item.channelid"
:label="item.channelname"
:value="item.channelid"
></el-option>
2 years ago
</el-select>
<el-button type="primary" @click="inquirebtn()"></el-button>
</div>
<div class="flexno bt30">
<div class="w8">时间表:</div>
2 years ago
<div class="w80 flexonly" v-if="this.shedulenr.length !== 0">
<el-tag
class="mr10 mt10"
size="mini"
v-for="(val, index) in this.shedulenr"
:key="index"
>{{ val }}</el-tag
>
2 years ago
</div>
2 years ago
<div class="w80 flexonly" v-else></div>
2 years ago
</div>
</el-tab-pane>
<el-tab-pane label="设置时间表" name="2">
<div class="deviceTable">
<el-table
ref="multipleTable"
:data="deviceTableData"
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>
2 years ago
<el-table-column label="时间表类型" show-overflow-tooltip>
<template>时间表类型</template>
</el-table-column>
2 years ago
<el-table-column label="时间表规则" width="300">
2 years ago
<template slot-scope="scope">
2 years ago
<p
class="timeGz"
v-for="(val, index) in scope.row.list"
:key="index"
>
<span>{{ val.startTime }}</span> ~
<span>{{ val.endTime }}</span>
间隔<el-tag>{{ val.span }}分钟</el-tag>
</p>
<!-- <ul
2 years ago
class="rulesBox"
v-for="(item, value) in scope.row.list"
:key="value"
>
<li><span>开始时间</span>{{ item.startTime }}</li>
<li><span>结束时间</span>{{ item.endTime }}</li>
<li>
<span>时间间隔:</span>
<el-tag>{{ item.span }}</el-tag>
</li>
2 years ago
</ul> -->
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">
<el-button type="text" @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
>
<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>
<el-descriptions
title=""
:column="3"
border
v-for="(val, index) in scheduleInfo"
:key="index"
>
<el-descriptions-item label="开始时间">{{
val.startTime
}}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{
val.endTime
}}</el-descriptions-item>
2 years ago
<el-descriptions-item label="时间间隔(分)">
2 years ago
<el-tag size="small">{{ val.span }}</el-tag>
2 years ago
</el-descriptions-item>
</el-descriptions>
<h3>选择通道</h3>
<div class="checkBox">
2 years ago
<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
>
2 years ago
</el-checkbox-group>
</div>
</div>
</div>
2 years ago
<div slot="footer" class="dialog-footer">
<el-button @click="isShowset = false"> </el-button>
2 years ago
<el-button type="primary" v-debounce="submitForm"> </el-button>
2 years ago
</div>
</el-dialog>
</el-tab-pane>
</el-tabs>
</el-dialog>
</template>
<script>
import {
getChannelListJoggle,
getSchedulenr,
getScheduleRulelListJoggle,
setScheduleRulel,
getScheduleRulelAccessList,
} from "@/utils/api/index";
2 years ago
export default {
props: {
title: String,
2 years ago
},
data() {
return {
2 years ago
loading: true,
2 years ago
isShow: false,
isShowset: false,
activeName: "1", //选项卡
accesslist: [], //通道选择器
selaccess: "", //选中的通道
shedulenr: [], //查询的时间表
deviceTableData: [], //时间表-表格
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: [], //选中的通道
2 years ago
};
},
mounted() {},
2 years ago
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
//获取单个设备通道
getSingleAccess(id) {
this.selfacilityId = id;
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.inquirebtn();
})
.catch((err) => {});
2 years ago
},
//查询时间表
inquirebtn() {
getSchedulenr({
channelid: this.selaccess,
terminalid: this.selfacilityId,
2 years ago
})
.then((res) => {
this.$message.success("查询成功");
// this.shedulenr = res.data.list.join("; ")
this.shedulenr = res.data.list;
2 years ago
this.loading = false;
})
.catch((err) => {
this.$message.error("查询失败");
});
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;
2 years ago
console.log(this.deviceTableData);
2 years ago
this.loading = false;
})
.catch((err) => {});
2 years ago
},
//点击分页
handleCurrentChange(val) {
this.page = val;
this.deviceList();
},
//设置-获取所有通道
handleSet(val) {
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.list;
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,
zzname: this.listnr[0].list[0].list[0].name,
zzcmid: this.listnr[0].list[0].list[0].cmdid,
zzid: this.listnr[0].list[0].list[0].id,
};
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();
console.log("111111111111111111111");
console.log(this.deviceListData);
console.log(this.checkList);
console.log(this.scheduleid);
console.log("22222222222222222");
if (this.checkList.length == 0) {
this.$message.error("请选择通道");
} else {
setScheduleRulel({
scheduleid: this.scheduleid,
list: [
{
termid: this.deviceListData.zzid,
channelidlist: this.checkList,
},
],
2 years ago
})
2 years ago
.then((res) => {
this.isShowset = false;
this.$message.success("添加成功");
this.deviceList();
})
.catch((err) => {
this.$message.error("添加失败");
});
}
// if (this.parmsList.length == 0)
// return this.$message.error("通道不能为空");
// setScheduleRulel({ ruleid: this.scheduleid, list: this.parmsList })
// .then((res) => {
// this.isShowset = false;
// this.$message.success("添加成功");
// this.deviceList();
// })
// .catch((err) => {
// this.$message.error("添加失败");
// });
2 years ago
},
display() {
this.isShow = true;
2 years ago
},
hide() {
this.isShow = false;
},
},
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);
}
}
2 years ago
.flexonly {
display: flex;
flex-wrap: wrap;
2 years ago
align-content: flex-start;
2 years ago
}
.flexno {
display: flex;
2 years ago
margin-top: 24px;
padding: 0px 8px;
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: 8%;
}
.w80 {
2 years ago
width: 90%;
overflow-y: auto;
height: 300px;
2 years ago
}
.mr20 {
margin-right: 20px;
}
.bt30 {
margin-bottom: 30px;
}
.deviceTable {
padding: 16px 8px 0 8px;
2 years ago
height: calc(100% - 16px);
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
.timeGz {
line-height: 32px;
span {
margin: 0px 8px;
}
}
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
}
2 years ago
}
2 years ago
</style>