InternetCompetition/.history/src/components/ChiCollection_2023103009392...

299 lines
9.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 采集点收集 -->
<template>
<div>
<div v-click-outside="closeMenu">
<!-- 设置树形控件 -->
<el-button type="info" plain @click="dialogVisible = true">斥候采集点设置</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>
<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="tag_id" label="TagID">
</el-table-column>
<el-table-column property="name" label="名称">
</el-table-column>
<el-table-column property="datas" label="地址">
<template slot-scope="scope">
<el-select v-model="scope.row.datas" placeholder="0X">
<el-option v-for="option in selectOptions" :key="option" :label="option"
:value="option"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column property="address" label="寄存地址(十进制)" width="150px">
<template slot-scope="scope">
<el-select v-model="scope.row.address" placeholder="1">
<el-option v-for="option in selectOptions" :key="option" :label="option"
:value="option"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column property="type" label="采集数据类型">
<template slot-scope="scope">
<el-select v-model="scope.row.type" placeholder="bool">
<el-option v-for="option in selectOptions" :key="option" :label="option"
:value="option"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column property="attribute" label="读写属性">
<template slot-scope="scope">
<el-select v-model="scope.row.attribute" placeholder="读写">
<el-option v-for="option in selectOptions" :key="option" :label="option"
:value="option"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column property="order" label="上传模式">
</el-table-column>
<el-table-column property="count" label="单位">
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
export default {
name: 'ChiCollection',
data() {
return {
activeIndex: '1',
value1: 1,
checked: "",
labelPosition: "left",
formLabelWidth: "116px",
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'
},
selectOptions: [],
tableData: [{
tag_id: 'tag0001',
name: '测试',
datas: "",
address: '1',
order: 'NUll',
type: "boolean",
attribute: "读写",
count: 1,
}],
};
},
mounted() {
},
methods: {
treeNodeClick() {
this.add_passage = true;
},
getDriveName() {
this.diag_drive = true;
},
handleSelect(key, keyPath) {
console.log(key, keyPath);
}
},
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 {
position: absolute;
left: 362px;
top: 95px;
width: 1066px;
height: 752px;
line-height: 20px;
border-radius: 3px;
background-color: rgba(255, 255, 255, 1);
// text-align: center;
border: 1px solid rgba(220, 220, 220, 1);
.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>