瀏覽代碼

标签页不显示内容

mengy 11 月之前
父節點
當前提交
83ecdffb2a
共有 2 個文件被更改,包括 71 次插入36 次删除
  1. 8 1
      src/api/equipConfig/tabsManagement/index.js
  2. 63 35
      src/views/equipConfig/tabsManagement/index.vue

+ 8 - 1
src/api/equipConfig/tabsManagement/index.js

@@ -32,4 +32,11 @@ export function updateLabelItem(data) {
32 32
     method: 'post',
33 33
     data,
34 34
   })
35
-}
35
+}
36
+// 获取所有一级
37
+export function getParentsList() {
38
+  return request({
39
+    url: smart + `/label-info/getParentsList`,
40
+    method: 'get',
41
+  })
42
+}

+ 63 - 35
src/views/equipConfig/tabsManagement/index.vue

@@ -23,35 +23,40 @@
23 23
         </el-form-item>
24 24
       </el-form>
25 25
     </div>
26
-    <van-list>
27
-      <!-- <van-cell v-for="item in list" :key="item" :title="item" /> -->
28
-      <div class="list boxShadow" v-for="(item,index) in list" :key="index">
29
-        <div class="list-main">
30
-
31
-          <div class="list-content">
32
-            <div class="list-title">{{ item.labelName}}</div>
33
-            <van-row class="content-1">
34
-              <van-col span="6">标签编号: <span>{{item.labelCode}}</span></van-col>
35
-              <van-col span="6">绑定设备: <span>{{item.type}}</span></van-col>
36
-              <van-col span="6">创建日期: <span>{{item.adress}} </span></van-col>
37
-              <!-- <van-col span="6">是否存在异常:<span><strong>{{item.isAbnormal}}</strong> </span></van-col> -->
38
-            </van-row>
39
-            <van-row class="content-1">
40
-              <van-col span="6">标签类别: <span>{{item.labelClass}} </span></van-col>
41
-              <!-- <van-col span="6">创建人: <span>{{item.operator}} </span></van-col> -->
42
-              <van-col span="6">描述: <span>{{item.labelRefer}} </span></van-col>
43
-              <van-col span="6"></van-col>
44
-            </van-row>
45
-          </div>
46
-          <div class="list-btns">
47
-            <el-button type="primary" @click="handleDetail(item)">详情</el-button>
48
-            <el-button type="primary" @click="handleEdit(item)">修改</el-button>
49
-            <el-button type="primary" @click="handleDelete(item)">删除</el-button>
26
+     <!-- 使用vant收缩组件 -->
27
+        <van-list>
28
+          <div class="list boxShadow">
29
+            <div class="list-main">
30
+              <div class="list-content">
31
+                <van-collapse v-model="activeNames" v-for="(item, index) in list" :key="index">
32
+                  <div class="list-title">{{ item.title }}</div>
33
+                  <van-collapse-item :name="index">
34
+                    <!-- 自定义标题内容 (#title === v-slot:title) -->
35
+                    <!--<template #title>-->
36
+                    <template v-slot:title>
37
+                      <van-row class="content-1">
38
+                        <van-col span="6">标签编号: <span>{{item.labelCode}}</span></van-col>
39
+                        <van-col span="6">绑定设备: <span>{{item.type}}</span></van-col>
40
+                        <van-col span="6">创建日期: <span>{{item.adress}} </span></van-col>
41
+                        <!-- <van-col span="6">是否存在异常:<span><strong>{{item.isAbnormal}}</strong> </span></van-col> -->
42
+                      </van-row>
43
+                      <!-- 展开部分的样式 -->
44
+                      <div v-for="(value, ind) in item.children" :key="ind" class="children">
45
+                        <van-row class="content-1">
46
+                        <van-col span="6">标签类别: <span>{{item.labelClass}} </span></van-col>
47
+                        <!-- <van-col span="6">创建人: <span>{{item.operator}} </span></van-col> -->
48
+                        <van-col span="6">描述: <span>{{item.labelRefer}} </span></van-col>
49
+                        <van-col span="6"></van-col>
50
+                      </van-row>
51
+              </div>
52
+              <div class="list-btns">
53
+                <el-button type="primary" @click="handleDetail(item)">详情</el-button>
54
+                <el-button type="primary" @click="handleEdit(item)">修改</el-button>
55
+                <el-button type="primary" @click="handleDelete(item)">删除</el-button>
56
+              </div>
57
+            </div>
50 58
           </div>
51
-        </div>
52
-
53
-      </div>
54
-    </van-list>
59
+        </van-list>
55 60
     <div class="pagination-container">
56 61
       <el-pagination class="right" background :current-page.sync="listQuery.page" :page-size="listQuery.limit" :page-sizes="[5, 10, 20, 30]" :total="listQuery.total" @size-change="sizeChange" @current-change="pageChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
57 62
     </div>
@@ -59,7 +64,11 @@
59 64
 </template>
60 65
 
61 66
 <script>
62
-import { getLabelList, deleteLabelItem } from '@/api/equipConfig/tabsManagement/index'
67
+import {
68
+  getLabelList,
69
+  deleteLabelItem,
70
+  getParentsList
71
+ } from '@/api/equipConfig/tabsManagement/index'
63 72
 
64 73
 export default {
65 74
   filters: {
@@ -67,20 +76,28 @@ export default {
67 76
   },
68 77
   data () {
69 78
     return {
79
+      value: '',
80
+      activeNames: [''], // 默认展开的项 默认不展开
70 81
       notice: false,
71 82
       formInline: {
72 83
         labelCode: '',
73 84
         labelName: '',
74 85
         labelClass: ''
75 86
       },
76
-      list: [
77
-        {
78
-          title: '通风设备标签01', number: '1001', type: '45', adress: '2021-01-12', state: '蓝牙', operator: '王全德', runTime: '6h'
79
-        },
80
-      ],
87
+      list: [{}],
81 88
       loading: 'false',
82 89
       finished: 'false',
83
-
90
+      isAdd: false,
91
+      dialogFormVisible: false,
92
+      diaForm: {
93
+        id: '',
94
+        labelName: '',
95
+        labelCode: '',
96
+        parentId: '',
97
+        children: []
98
+      },
99
+      parents: [],
100
+      formLabelWidth: '100px',
84 101
       listQuery: {
85 102
         condition: "",
86 103
         page: 1,
@@ -157,14 +174,25 @@ export default {
157 174
       this.getList()
158 175
     },
159 176
     handleAdd () {
177
+      this.ThisGetParentsList();
160 178
       this.$router.push({ name: 'TabsManagementAdd' })
161 179
     },
162 180
     handleDetail (data) {
163 181
       this.$router.push({ name: 'TabsManagementDetail', params: { data: data } })
164 182
     },
165 183
     handleEdit (data) {
184
+      this.ThisGetParentsList();
166 185
       this.$router.push({ name: 'TabsManagementEdit', params: { data: data } })
167 186
     },
187
+    ThisGetParentsList() {
188
+     getParentsList().then(res => {
189
+       if (res.code === 200) {
190
+        this.parents = res.data;
191
+       }
192
+       }).catch(err => {
193
+        console.log(err)
194
+     });
195
+    },
168 196
     sizeChange (v) {
169 197
       this.listQuery.limit = v
170 198
       console.log(`每页 ${v} 条`);