1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
| <template>
| <div class="device-page">
| <div class="device-left">
| <el-input placeholder="输入设备名称" suffix-icon="el-icon-search" v-model="deviceName" size="small"
| @keyup.enter="geList"
| style="margin-bottom: 5px;" clearable @change="geList"></el-input>
| <el-tree :data="list" ref="tree" :props="{ children: 'children', label: 'label' }" node-key="id" @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen"
| @node-collapse="nodeClose" v-loading="loading" :expand-on-click-node="false"
| :default-expanded-keys="expandedKeys"
| style="height:calc(100% - 46px);overflow-y: scroll;scrollbar-width: none;">
| <div class="custom-tree-node" slot-scope="{ node, data }">
| <el-row style="width: 100%;">
| <el-col :span="21" :title="data.label">
| <span class="single-line-ellipsis" style="width: 100%;display: inline-block;">
| <i :class="`node_i ${data.children != undefined ? (data.code==='[1]'?'el-icon-folder-opened':'el-icon-folder') : 'el-icon-tickets'}`"></i>
| {{ data.label }}
| </span>
| </el-col>
| </el-row>
| </div>
| </el-tree>
| </div>
| <div class="device-right">
| <el-radio-group v-model="currentPage" size="small">
| <el-radio-button :label="item.id" v-for="(item,index) in tabList" :key="index"
| size="small">{{ item.title }}</el-radio-button>
| </el-radio-group>
| <div class="device-right-content">
| <component :is="currentPage"></component>
| </div>
| </div>
| </div>
| </template>
|
| <script>
| import operationOverview from '../do/a6-device/operation-overview.vue';
| import files from '../do/a6-device/files.vue';
| import checkAndAccept from '../do/a6-device/check-and-accept.vue';
| import calibration from '../do/a6-device/calibration.vue';
| import check from '../do/a6-device/check.vue';
| import maintenance from '../do/a6-device/maintenance.vue';
| import borrow from "../do/a6-device/borrow.vue";
| import fault from "../do/a6-device/fault.vue";
| import record from '../do/a6-device/record.vue';
| import state from '../do/a6-device/state.vue';
| export default {
| components:{
| operationOverview,
| files,
| checkAndAccept,
| calibration,
| check,
| maintenance,
| borrow,
| fault,
| record,
| state,
| },
| data(){
| return {
| deviceName:'',
| loading:false,
| tabList:[
| {
| id:'operationOverview',
| title:'设备运行总览',
| },
| {
| id:'files',
| title:'设备档案',
| },
| {
| id:'checkAndAccept',
| title:'设备验收',
| },
| {
| id:'calibration',
| title:'设备校准',
| },
| {
| id:'check',
| title:'设备核查',
| },
| {
| id:'maintenance',
| title:'设备维护',
| },
| {
| id:'borrow',
| title:'设备借用',
| },
| {
| id:'fault',
| title:'设备故障',
| },
| {
| id:'record',
| title:'使用记录',
| },
| {
| id:'state',
| title:'设备停用/启用',
| },
| ],
| currentPage:'operationOverview',
| expandedKeys:[],
| selectTree:'',
| list:[]
| }
| },
| mounted(){
| this.geList()
| },
| methods:{
| geList(){
| this.loading = true;
| this.$axios.get(this.$api.deviceScope.treeDevice+'?deviceName='+this.deviceName).then(res => {
| this.loading = false;
| let data = res.data
| data.forEach((item,index) => {
| item.id = index +1
| item.label = item.largeCategory
| item.children.forEach((m,i)=>{
| m.label = m.deviceName
| })
| })
| this.list = data
| })
| },
| handleNodeClick(val, node, el) { //树的值
| this.selectTree = ''
| this.getNodeParent(node)
| this.selectTree = this.selectTree.replace(' - ', '')
| let data = this.selectTree.split(' - ')
| let data2 = ''
| for (let index = data.length - 1; index >= 0; index--) {
| data2 += " - " + data[index]
| }
| this.selectTree = data2.replace(' - ', '')
|
| this.currentPage = 'operationOverview';
| },
| getNodeParent(val) {
| if (val.parent != null) {
| if(val.data.children === null){
| this.selectTree += ' - ' + val.label + ' - ' + 'null'
| }else{
| this.selectTree += ' - ' + val.label
| }
| this.getNodeParent(val.parent)
| }
| },
| nodeOpen(data, node, el) {
| $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened')
| },
| nodeClose(data, node, el) {
| $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder')
| },
| }
| }
| </script>
|
| <style scoped>
| .device-page{
| display: flex;
| padding-top: 10px;
| padding-bottom: 10px;
| box-sizing: border-box;
| width: 100%;
| }
| .device-left{
| width: 200px;
| height: 100%;
| background: #fff;
| margin-right: 10px;
| border-radius: 16px;
| box-sizing: border-box;
| padding: 10px 16px;
| }
| .device-right{
| background: #fff;
| flex: 1;
| border-radius: 16px;
| box-sizing: border-box;
| padding: 10px 16px;
| }
| .device-right-content{
| margin-top: 10px;
| height: calc(100% - 42px);
| width: 100%;
| }
| .custom-tree-node {
| width: 100%;
| /* line-height: 32px; */
| font-size: 14px;
| }
|
| .node_i {
| color: orange;
| font-size: 18px;
| }
| </style>
|
|