464 lines
17 KiB
Vue
464 lines
17 KiB
Vue
<!-- 串口通道 -->
|
||
<template>
|
||
<div class="Clone">
|
||
<!-- 设置树形控件 -->
|
||
<div v-click-outside="closeMenu">
|
||
<el-button type="info" plain @click="dialogVisible = !dialogVisible">MQTT云</el-button>
|
||
<div v-show="dialogVisible" class="tree_menu">
|
||
<el-tree :data="datas" :props="defaultProps" @node-click="treeNodeClick"></el-tree>
|
||
<!-- 树形控件右键组件 -->
|
||
</div>
|
||
</div>
|
||
<div class="pas_params" v-show="add_passage">
|
||
<div class="content">
|
||
<div class="con_left">
|
||
<el-form :label-position="labelPosition" :rules="rules" ref="ruleForm">
|
||
<el-row>
|
||
<el-col :span="24">
|
||
<el-form-item>
|
||
<el-checkbox v-model="checked1">启动</el-checkbox>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row>
|
||
<el-col :span="12">
|
||
<el-form-item label="服务器IP:" :label-width="formLabelWidth" prop="server_ip">
|
||
<el-row>
|
||
<el-col :span="5">
|
||
<el-input v-model="input1" style="width: 43px; height: 30px;"></el-input>
|
||
</el-col>
|
||
<el-col :span="1">.
|
||
</el-col>
|
||
<el-col :span="5">
|
||
<el-input v-model="input1" style="width: 43px; height: 30px;"></el-input>
|
||
</el-col>
|
||
<el-col :span="1">.</el-col>
|
||
<el-col :span="5">
|
||
<el-input v-model="input1" style="width: 43px; height: 30px;"></el-input>
|
||
</el-col>
|
||
<el-col :span="1">.</el-col>
|
||
<el-col :span="5">
|
||
<el-input v-model="input1" style="width: 43px; height: 30px;"></el-input>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row>
|
||
<el-col :span="24">
|
||
<el-form-item label="端口号:" :label-width="formLabelWidth" prop="port_number">
|
||
<el-input v-model="input1" placeholder="" style="width: 200px;height:30px"></el-input>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row>
|
||
<el-col :span="24">
|
||
<el-form-item label="网关SND:" :label-width="formLabelWidth" prop="gateway_id">
|
||
<el-input v-model="input1" placeholder="" style="width: 200px;height:30px"></el-input>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-divider></el-divider>
|
||
<el-form-item label="实时数据发布的主题:" label-width="168px" prop="data_theme">
|
||
</el-form-item>
|
||
<el-row>
|
||
|
||
<el-col :span="12">
|
||
<el-form-item>
|
||
<el-row>
|
||
<el-col :span="15">
|
||
<el-input v-model="input1" placeholder="" style="width: 200px;"></el-input>
|
||
</el-col>
|
||
<el-col :span="9">
|
||
<el-select v-model="value" placeholder="请选择" style="width: 99px;">
|
||
<el-option v-for="item in options1" :key="item.value" :label="item.label"
|
||
:value="item.value">
|
||
</el-option>
|
||
</el-select>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="retained:" :label-width="formLabelWidth" prop="retained">
|
||
<el-switch v-model="value1"></el-switch>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row>
|
||
<el-col :span="12">
|
||
<el-form-item label="上传模式:" :label-width="formLabelWidth" prop="upload_mode">
|
||
<el-input v-model="input1" placeholder="" style="width: 200px;height:30px"></el-input>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="上传周期(s):" label-width="108px" prop="upload_week">
|
||
<el-input v-model="input1" placeholder="" style="width: 200px;height:30px"></el-input>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row>
|
||
<el-col :span="24">
|
||
<el-form-item label="数据过滤:" :label-width="formLabelWidth" prop="data_filter">
|
||
<el-checkbox-group v-model="checkList">
|
||
<el-checkbox label="值改变"></el-checkbox>
|
||
<el-checkbox label="采集成功"></el-checkbox>
|
||
<el-checkbox label="时间戳改变"></el-checkbox>
|
||
</el-checkbox-group>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<div class="con_left_footer">
|
||
<el-button type="primary" @click="choose_point = false">保 存</el-button>
|
||
<el-button @click="choose_point = false">取 消</el-button>
|
||
</div>
|
||
</el-form>
|
||
</div>
|
||
<div>
|
||
<div class="con_right">
|
||
<el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect">
|
||
<el-menu-item index="1">添加</el-menu-item>
|
||
<el-menu-item index="2">保存</el-menu-item>
|
||
<el-menu-item index="3">删除</el-menu-item>
|
||
</el-menu>
|
||
</div>
|
||
<el-table ref="singleTable" :data="tableData" style="width: 100%">
|
||
<el-table-column type="index">
|
||
</el-table-column>
|
||
<el-table-column property="name" label="设备名称">
|
||
</el-table-column>
|
||
<el-table-column property="tag_id" label="TagID">
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- 添加按钮下显示出来的弹框信息 -->
|
||
<div>
|
||
<el-dialog title="选择点" :visible.sync="choose_point" width="30%">
|
||
<el-tree :data="points" show-checkbox node-key="id" :default-expanded-keys="[1, 2, 3, 4, 5]"
|
||
:default-checked-keys="[4, 5, 6, 7, 8, 9]" :props="defaultProps">
|
||
</el-tree>
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="choose_point = false">保 存</el-button>
|
||
<el-button @click="choose_point = false">取 消</el-button>
|
||
</span>
|
||
</el-dialog>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
name: 'CloneView',
|
||
|
||
data() {
|
||
return {
|
||
options1: [{
|
||
value: "qos0",
|
||
label: "qos0"
|
||
},
|
||
{
|
||
value: "qos1",
|
||
label: "qos1"
|
||
}, {
|
||
value: "qos2",
|
||
label: "qos2"
|
||
}],
|
||
options2: [{
|
||
value: "周期上传",
|
||
label: "周期上传"
|
||
},
|
||
{
|
||
value: "整点上传",
|
||
label: "整点上传"
|
||
}],
|
||
points: [{
|
||
id: 1,
|
||
label: '一级 1',
|
||
children: [{
|
||
id: 4,
|
||
label: '二级 1-1',
|
||
children: [{
|
||
id: 9,
|
||
label: '三级 1-1-1'
|
||
}, {
|
||
id: 10,
|
||
label: '三级 1-1-2'
|
||
}]
|
||
}]
|
||
}, {
|
||
id: 2,
|
||
label: '一级 2',
|
||
children: [{
|
||
id: 5,
|
||
label: '二级 2-1',
|
||
children: [{
|
||
id: 11,
|
||
label: '三级 2-1-1'
|
||
}, {
|
||
id: 12,
|
||
label: '三级 2-1-2'
|
||
}]
|
||
}, {
|
||
id: 6,
|
||
label: '二级 2-2'
|
||
}]
|
||
}, {
|
||
id: 3,
|
||
label: '一级 3',
|
||
children: [{
|
||
id: 7,
|
||
label: '二级 3-1'
|
||
}, {
|
||
id: 8,
|
||
label: '二级 3-2'
|
||
}]
|
||
}],
|
||
choose_point: false,
|
||
checkList: ['采集成功'],
|
||
checked1: "",
|
||
options: [{
|
||
value: '选项1',
|
||
label: '选项1'
|
||
}, {
|
||
value: '选项2',
|
||
label: '选项2'
|
||
}],
|
||
value: 'qos0',
|
||
activeIndex: '1',
|
||
value1: 0,
|
||
checked: "",
|
||
labelPosition: "left",
|
||
formLabelWidth: "88px",
|
||
input1: 192,
|
||
add_passage: false,
|
||
rightMenu: "",
|
||
dialogVisible: false,
|
||
menuShow: false,
|
||
datas: [{
|
||
label: '一级 1',
|
||
children: [{
|
||
label: '二级 1-1',
|
||
children: [{
|
||
label: '三级 1-1-1'
|
||
}]
|
||
}]
|
||
}, {
|
||
label: '一级 2',
|
||
children: [{
|
||
label: '二级 2-1',
|
||
children: [{
|
||
label: '三级 2-1-1'
|
||
}]
|
||
}, {
|
||
label: '二级 2-2',
|
||
children: [{
|
||
label: '三级 2-2-1'
|
||
}]
|
||
}]
|
||
}, {
|
||
label: '一级 3',
|
||
children: [{
|
||
label: '二级 3-1',
|
||
children: [{
|
||
label: '三级 3-1-1'
|
||
}]
|
||
}, {
|
||
label: '二级 3-2',
|
||
children: [{
|
||
label: '三级 3-2-1'
|
||
}]
|
||
}]
|
||
}],
|
||
defaultProps: {
|
||
children: 'children',
|
||
label: 'label'
|
||
},
|
||
tableData: [{
|
||
tag_id: 'tag0001',
|
||
name: '测试',
|
||
}],
|
||
rules: {
|
||
server_ip: [
|
||
{ required: true, message: '请输入服务器IP', trigger: 'blur' },
|
||
],
|
||
port_number: [
|
||
{ required: true, message: '请输入端口', trigger: 'blur' },
|
||
],
|
||
gateway_id: [
|
||
{ required: true, message: '请输入网关ID', trigger: 'blur' },
|
||
],
|
||
data_theme: [
|
||
{ required: true, message: '请输入主题', trigger: 'blur' },
|
||
],
|
||
upload_mode: [
|
||
{ required: true, message: '请输入上传模式', trigger: 'blur' },
|
||
],
|
||
upload_week: [
|
||
{ required: true, message: '请输入上传周期', trigger: 'blur' },
|
||
],
|
||
data_filter: [
|
||
{ required: true, message: '请输入数据过滤', trigger: 'blur' },
|
||
],
|
||
},
|
||
};
|
||
},
|
||
|
||
mounted() {
|
||
|
||
},
|
||
|
||
methods: {
|
||
treeNodeClick() {
|
||
this.add_passage = true;
|
||
},
|
||
getDriveName() {
|
||
this.diag_drive = true;
|
||
},
|
||
handleSelect(key) {
|
||
console.log(key);
|
||
if (key == 1) {
|
||
this.choose_point = true;
|
||
}
|
||
},
|
||
closeMenu(ev) {
|
||
console.log({ ev });
|
||
this.dialogVisible = false;
|
||
}
|
||
},
|
||
directives: {
|
||
'click-outside': {
|
||
bind: function (el, binding, vnode) {
|
||
console.log('el', el);
|
||
console.log("binding", binding);
|
||
el.event = function (event) {
|
||
// 检查点击是否发生在节点之内(包括子节点)
|
||
if (!(el == event.target || el.contains(event.target))) {
|
||
// 如果没有,则触发调用
|
||
// 若绑定值为函数,则执行
|
||
// 这里我们可以通过钩子函数中的 vnode.context,来获取当前组件的作用域
|
||
if (typeof vnode.context[binding.expression] == 'function') {
|
||
vnode.context[binding.expression](event)
|
||
}
|
||
}
|
||
}
|
||
// 绑定事件
|
||
// 设置为true,代表在DOM树中,注册了该listener的元素,会先于它下方的任何事件目标,接收到该事件。
|
||
document.body.addEventListener('click', el.event, true)
|
||
},
|
||
unbind: function (el) {
|
||
// 解绑事件
|
||
document.body.removeEventListener('click', el.event, true)
|
||
},
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.tree_menu {
|
||
position: absolute;
|
||
width: 286px;
|
||
height: 753px;
|
||
left: 64px;
|
||
top: 104px;
|
||
width: 286px;
|
||
height: 753px;
|
||
line-height: 20px;
|
||
border-radius: 3px;
|
||
background-color: rgba(255, 255, 255, 1);
|
||
text-align: center;
|
||
border: 1px solid rgba(220, 220, 220, 1);
|
||
}
|
||
|
||
/deep/ .pas_params {
|
||
.el-button {
|
||
width: 80px;
|
||
height: 30px;
|
||
line-height: 0.5;
|
||
}
|
||
|
||
.el-col-12:last-child {
|
||
padding-right: 150px;
|
||
}
|
||
|
||
.el-col-12:first-child {
|
||
padding-right: 54px;
|
||
}
|
||
|
||
.el-row {
|
||
height: 40px;
|
||
display: flex;
|
||
align-items: flex-start;
|
||
|
||
.el-col-1 {
|
||
text-align: center;
|
||
line-height: 20px;
|
||
height: 20px;
|
||
}
|
||
|
||
.el-col-9 {
|
||
padding-left: 30px;
|
||
}
|
||
}
|
||
|
||
.el-input__inner {
|
||
height: 30px;
|
||
text-align: left;
|
||
padding: 0px 8px;
|
||
}
|
||
|
||
|
||
|
||
.content {
|
||
position: absolute;
|
||
left: 377px;
|
||
top: 69px;
|
||
width: 1220px;
|
||
height: 836px;
|
||
line-height: 20px;
|
||
padding-left: 36px;
|
||
background-color: rgba(255, 255, 255, 1);
|
||
color: rgba(16, 16, 16, 1);
|
||
font-size: 14px;
|
||
border: 1px solid rgba(187, 187, 187, 1);
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
align-items: flex-start;
|
||
|
||
.el-form-item {
|
||
margin-bottom: 0px;
|
||
}
|
||
|
||
/deep/ .con_left {
|
||
.el-con-5 {
|
||
width: 43px;
|
||
}
|
||
}
|
||
|
||
.con_left {
|
||
width: 709px;
|
||
position: relative;
|
||
|
||
.con_left_footer {
|
||
position: absolute;
|
||
left: 499px;
|
||
top: 777px;
|
||
}
|
||
}
|
||
|
||
.con_right {
|
||
width: 480px;
|
||
|
||
.dialog-footer {
|
||
.el-button {
|
||
width: 80px;
|
||
height: 30px;
|
||
line-height: 0.5;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style> |