331 lines
10 KiB
Vue
331 lines
10 KiB
Vue
<!-- 采集点收集 -->
|
||
<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">
|
||
<template slot-scope="scope">
|
||
<el-select v-model="scope.row.tag_id" placeholder="0X">
|
||
<el-option v-for="option in options1" :key="option" :label="option.label" :value="option.value"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column property="name" label="名称">
|
||
<template slot-scope="scope">
|
||
<el-select v-model="scope.row.name" placeholder="0X">
|
||
<el-option v-for="option in options2" :key="option" :label="option.label" :value="option.value"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</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 options2" :key="option" :label="option.label" :value="option.value"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column property="address" label="寄存地址(十进制)" width="150px">
|
||
</el-table-column>
|
||
<el-table-column property="type" label="采集数据类型">
|
||
<template slot-scope="scope">
|
||
<el-select v-model="scope.row.type" placeholder="0X">
|
||
<el-option v-for="option in options3" :key="option" :label="option" :value="option"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column property="order" label="自节序">
|
||
<template slot-scope="scope">
|
||
<el-select v-model="scope.row.order" placeholder="0X">
|
||
<el-option v-for="option in options2" :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="0X">
|
||
<el-option v-for="option in options2" :key="option" :label="option" :value="option"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column property="count" label="倍率">
|
||
<template slot-scope="scope">
|
||
<el-select v-model="scope.row.count" placeholder="0X">
|
||
<el-option v-for="option in options2" :key="option" :label="option" :value="option"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
name: 'DeviceView',
|
||
|
||
data() {
|
||
return {
|
||
options1: [{
|
||
value: "MachinePamHID909",
|
||
label: "MachinePamHID909",
|
||
}, {
|
||
value: "MachinePamHID910",
|
||
label: "MachinePamHID910",
|
||
}, {
|
||
value: "MachinePamHID911",
|
||
label: "MachinePamHID911",
|
||
}, {
|
||
value: "MachinePamHID912",
|
||
label: "MachinePamHID912",
|
||
}],
|
||
options2: [{
|
||
value: "急停状态",
|
||
label: "急停状态",
|
||
}, {
|
||
value: "进给速度",
|
||
label: "进给速度",
|
||
}],
|
||
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'
|
||
},
|
||
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);
|
||
},
|
||
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 {
|
||
position: absolute;
|
||
left: 362px;
|
||
top: 125px;
|
||
width: 1066px;
|
||
height: 716px;
|
||
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> |