Sfoglia il codice sorgente

refactor(selfCheck): 优化巡检项展示逻辑,替换位置字段显示

1.  将原有的location字段替换为终端名称、区域名称和通道名称的组合展示,使用斜杠分隔非空项
2.  完善formatDeviceItem方法,保留原字段的同时展开传入的item对象
3.  修复代码格式问题,调整缩进和空格规范
huoyi 4 settimane fa
parent
commit
6089d3b179
2 ha cambiato i file con 23 aggiunte e 21 eliminazioni
  1. 12 5
      src/pages/home-new/components/selfCheck.vue
  2. 11 16
      src/pages/selfCheck/index.vue

+ 12 - 5
src/pages/home-new/components/selfCheck.vue

@@ -21,7 +21,9 @@
21 21
                             <text class="item-date">{{ item.date }}</text>
22 22
                         </view>
23 23
                         <view class="item-row">
24
-                            <text class="item-label">{{ item.location }}</text>
24
+                            <text class="item-label">{{ item.terminlName }}{{ item.terminlName ? '/' : '' }}{{
25
+                                item.regionalName
26
+                            }}{{ item.regionalName ? '/' : '' }}{{ item.channelName }}</text>
25 27
                             <text class="item-role">{{ item.role }}</text>
26 28
                         </view>
27 29
                     </view>
@@ -43,7 +45,9 @@
43 45
                             <text class="item-date">{{ item.date }}</text>
44 46
                         </view>
45 47
                         <view class="item-row">
46
-                            <text class="item-label">{{ item.location }}</text>
48
+                            <text class="item-label">{{ item.terminlName }}{{ item.terminlName ? '/' : '' }}{{
49
+                                item.regionalName
50
+                            }}{{ item.regionalName ? '/' : '' }}{{ item.channelName }}</text>
47 51
                             <text class="item-role">{{ item.role }}</text>
48 52
                         </view>
49 53
                     </view>
@@ -65,7 +69,9 @@
65 69
                             <text class="item-date">{{ item.date }}</text>
66 70
                         </view>
67 71
                         <view class="item-row">
68
-                            <text class="item-label">{{ item.location }}</text>
72
+                            <text class="item-label">{{ item.terminlName }}{{ item.terminlName ? '/' : '' }}{{
73
+                                item.regionalName
74
+                            }}{{ item.regionalName ? '/' : '' }}{{ item.channelName }}</text>
69 75
                             <text class="item-role">{{ item.role }}</text>
70 76
                         </view>
71 77
                     </view>
@@ -124,11 +130,12 @@ export default {
124 130
         },
125 131
         formatDeviceItem(item) {
126 132
             return {
133
+                ...item,
127 134
                 name: item.equipmentName || '空',
128 135
                 serialNumber: item.equipmentCode || '空',
129 136
                 location: item.installationLocation || '空',
130
-                role:`${item.inspectionTeamLeaderName || ''}、${item.inspectionTeamMember1Name || ''}、${item.inspectionTeamMember2Name || ''}`|| '空',
131
-                date: this.formatDate(item.nextInspectionDueDate)|| '空'
137
+                role: `${item.inspectionTeamLeaderName || ''}、${item.inspectionTeamMember1Name || ''}、${item.inspectionTeamMember2Name || ''}` || '空',
138
+                date: this.formatDate(item.nextInspectionDueDate) || '空'
132 139
             };
133 140
         },
134 141
         formatDate(dateStr) {

+ 11 - 16
src/pages/selfCheck/index.vue

@@ -1,11 +1,10 @@
1 1
 <template>
2
-    <home-container :customStyle="{ background: 'none',padding: '0' }" >
2
+    <home-container :customStyle="{ background: 'none', padding: '0' }">
3 3
         <view class="self-check-page">
4 4
             <!-- 标签页区域 -->
5 5
             <view class="tabs-section">
6 6
                 <view v-for="(tab, index) in tabs" :key="index"
7
-                    :class="['tab-item', { 'active': currentTab === tab.value }]"
8
-                    @click="switchTab(tab.value)">
7
+                    :class="['tab-item', { 'active': currentTab === tab.value }]" @click="switchTab(tab.value)">
9 8
                     <text class="tab-text">{{ tab.label }}</text>
10 9
                 </view>
11 10
             </view>
@@ -20,7 +19,7 @@
20 19
                             <text class="card-date">{{ item.date }}</text>
21 20
                         </view>
22 21
                         <view class="card-row" style="justify-content: flex-start;">
23
-                            <text class="card-label">{{ item.location }}</text>
22
+                            <text class="item-label">{{ item.terminlName }}{{ item.terminlName ? '/' : '' }}{{item.regionalName}}{{ item.regionalName ? '/' : '' }}{{ item.channelName }}</text>
24 23
                             <text class="card-role" style="margin-left: 10px;">{{ item.role }}</text>
25 24
                         </view>
26 25
                     </view>
@@ -66,7 +65,7 @@ export default {
66 65
     },
67 66
     computed: {
68 67
         filteredItems() {
69
-            switch(this.currentTab) {
68
+            switch (this.currentTab) {
70 69
                 case 'all':
71 70
                     return this.allItems;
72 71
                 case 'expired':
@@ -86,7 +85,7 @@ export default {
86 85
             this.fetchDeviceList();
87 86
         },
88 87
         getStatusClass(colorType) {
89
-            switch(colorType) {
88
+            switch (colorType) {
90 89
                 case 'RED':
91 90
                     return 'expired';
92 91
                 case 'ORANGE':
@@ -98,7 +97,7 @@ export default {
98 97
             }
99 98
         },
100 99
         getStatusText(colorType) {
101
-            switch(colorType) {
100
+            switch (colorType) {
102 101
                 case 'RED':
103 102
                     return '已过期';
104 103
                 case 'ORANGE':
@@ -112,7 +111,7 @@ export default {
112 111
         fetchDeviceList() {
113 112
             // 根据当前 tab 请求不同的接口
114 113
             let colorType = '';
115
-            switch(this.currentTab) {
114
+            switch (this.currentTab) {
116 115
                 case 'all':
117 116
                     colorType = 'MIXED';
118 117
                     break;
@@ -126,11 +125,11 @@ export default {
126 125
                     colorType = 'YELLOW';
127 126
                     break;
128 127
             }
129
-            
128
+
130 129
             getDeviceList({ colorType }).then(res => {
131 130
                 if (res.code === 200) {
132 131
                     const data = res.data || [];
133
-                    switch(this.currentTab) {
132
+                    switch (this.currentTab) {
134 133
                         case 'all':
135 134
                             this.allItems = data.map(item => this.formatDeviceItem(item));
136 135
                             break;
@@ -151,6 +150,7 @@ export default {
151 150
         },
152 151
         formatDeviceItem(item) {
153 152
             return {
153
+                ...item,
154 154
                 name: item.equipmentName || '空',
155 155
                 serialNumber: item.equipmentCode || '空',
156 156
                 location: item.installationLocation || '空',
@@ -259,7 +259,7 @@ export default {
259 259
 
260 260
 .status-tag {
261 261
     padding: 4px 12px;
262
-    border-radius:10px 0  10px 0;
262
+    border-radius: 10px 0 10px 0;
263 263
     font-size: 14px;
264 264
     font-weight: bold;
265 265
     margin: -12px -12px -12px 0;
@@ -281,8 +281,3 @@ export default {
281 281
     color: #333;
282 282
 }
283 283
 </style>
284
-
285
-
286
-
287
-
288
-