Преглед изворни кода

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

1.  将原有的location字段替换为终端名称、区域名称和通道名称的组合展示,使用斜杠分隔非空项
2.  完善formatDeviceItem方法,保留原字段的同时展开传入的item对象
3.  修复代码格式问题,调整缩进和空格规范
huoyi пре 4 недеља
родитељ
комит
6089d3b179
2 измењених фајлова са 23 додато и 21 уклоњено
  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
                             <text class="item-date">{{ item.date }}</text>
21
                             <text class="item-date">{{ item.date }}</text>
22
                         </view>
22
                         </view>
23
                         <view class="item-row">
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
                             <text class="item-role">{{ item.role }}</text>
27
                             <text class="item-role">{{ item.role }}</text>
26
                         </view>
28
                         </view>
27
                     </view>
29
                     </view>
@@ -43,7 +45,9 @@
43
                             <text class="item-date">{{ item.date }}</text>
45
                             <text class="item-date">{{ item.date }}</text>
44
                         </view>
46
                         </view>
45
                         <view class="item-row">
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
                             <text class="item-role">{{ item.role }}</text>
51
                             <text class="item-role">{{ item.role }}</text>
48
                         </view>
52
                         </view>
49
                     </view>
53
                     </view>
@@ -65,7 +69,9 @@
65
                             <text class="item-date">{{ item.date }}</text>
69
                             <text class="item-date">{{ item.date }}</text>
66
                         </view>
70
                         </view>
67
                         <view class="item-row">
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
                             <text class="item-role">{{ item.role }}</text>
75
                             <text class="item-role">{{ item.role }}</text>
70
                         </view>
76
                         </view>
71
                     </view>
77
                     </view>
@@ -124,11 +130,12 @@ export default {
124
         },
130
         },
125
         formatDeviceItem(item) {
131
         formatDeviceItem(item) {
126
             return {
132
             return {
133
+                ...item,
127
                 name: item.equipmentName || '空',
134
                 name: item.equipmentName || '空',
128
                 serialNumber: item.equipmentCode || '空',
135
                 serialNumber: item.equipmentCode || '空',
129
                 location: item.installationLocation || '空',
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
         formatDate(dateStr) {
141
         formatDate(dateStr) {

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

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