Quellcode durchsuchen

refactor(portrait): adjust page card titles and optimize code format

1. adjust the card titles in employee profile page to match actual content
2. format code in SearchBar and deptProfile page, fix spacing and syntax issues
3. add init-done event binding for SearchBar in dept profile page
4. add debug log for department team stats data
huoyi vor 3 Wochen
Ursprung
Commit
fcab3447bf

+ 52 - 47
src/views/portraitManagement/components/SearchBar.vue

@@ -1,45 +1,48 @@
1 1
 <template>
2 2
   <div class="ep-topbar" @click="visible = false">
3 3
     <div class="ep-topbar-content">
4
-    <div class="time-btns">
5
-      <div :class="currentTime === 'week' ? 'primary' : 'default'" @click="selectTime('week')">近一周</div>
6
-      <div :class="currentTime === 'month' ? 'primary' : 'default'" @click="selectTime('month')">近一月</div>
7
-      <div :class="currentTime === 'quarter' ? 'primary' : 'default'" @click="selectTime('quarter')">近三月</div>
8
-      <div :class="currentTime === 'year' ? 'primary' : 'default'" @click="selectTime('year')">近一年</div>
9
-      <div :class="currentTime === 'custom' ? 'primary' : 'default'" @click="selectTime('custom')">自定义时间范围</div>
10
-      <div class="custom-style-date-picker-wrap" v-if="currentTime === 'custom'">
11
-        <el-date-picker class="custom-style-date-picker" v-model="dateRange" type="daterange" range-separator="至"
12
-          start-placeholder="开始" end-placeholder="结束" style="width:320px" @change="() => searchHandler()" />
13
-      </div>
14
-    </div>
15
-    <el-popover class="popover" title="" :visible="visible" placement="bottom-start" trigger="click" width="45vw">
16
-      <template #reference>
17
-        <div class="primary" style="border-radius: 6px;" @click.stop="visible = !visible">{{ props.deptType === 'user' ?
18
-          '组织架构/模糊搜索' : '部门选择' }}</div>
19
-      </template>
20
-
21
-      <div class="custom-el-style">
22
-        <div>
23
-          <el-autocomplete v-model="personName" :fetch-suggestions="props.deptType === 'user' ? queryUsers : queryDept"
24
-            :placeholder="props.deptType === 'user' ? '搜索员工/团队画像' : '搜索部门'" style="width:320px;" clearable
25
-            @select="handleSelect">
26
-            <template #suffix><el-icon>
27
-                <Search />
28
-              </el-icon></template>
29
-            <template #default="{ item }">
30
-              <span>{{ item.nickName || item.deptName }}</span>
31
-              <span v-if="item.deptName && item.nickName" style="font-size:12px;color:#999;margin-left:8px">{{
32
-                item.deptName }}</span>
33
-            </template>
34
-          </el-autocomplete>
35
-          <!-- <div class="primary" style="border-radius: 6px;" @click="() => searchHandler()">模糊搜索</div> -->
36
-        </div>
37
-        <div style="margin-top: 20px;">
38
-          <el-tree ref="treeRef" :data="departments" :default-expanded-keys="[100]" node-key="id"
39
-            :current-node-key="currentKey" :props="{ value: 'id', showPrefix: false }" accordion @node-click="handleNodeClick" />
4
+      <div class="time-btns">
5
+        <div :class="currentTime === 'week' ? 'primary' : 'default'" @click="selectTime('week')">近一周</div>
6
+        <div :class="currentTime === 'month' ? 'primary' : 'default'" @click="selectTime('month')">近一月</div>
7
+        <div :class="currentTime === 'quarter' ? 'primary' : 'default'" @click="selectTime('quarter')">近三月</div>
8
+        <div :class="currentTime === 'year' ? 'primary' : 'default'" @click="selectTime('year')">近一年</div>
9
+        <div :class="currentTime === 'custom' ? 'primary' : 'default'" @click="selectTime('custom')">自定义时间范围</div>
10
+        <div class="custom-style-date-picker-wrap" v-if="currentTime === 'custom'">
11
+          <el-date-picker class="custom-style-date-picker" v-model="dateRange" type="daterange" range-separator="至"
12
+            start-placeholder="开始" end-placeholder="结束" style="width:320px" @change="() => searchHandler()" />
40 13
         </div>
41 14
       </div>
42
-    </el-popover>
15
+      <el-popover class="popover" title="" :visible="visible" placement="bottom-start" trigger="click" width="45vw">
16
+        <template #reference>
17
+          <div class="primary" style="border-radius: 6px;" @click.stop="visible = !visible">{{ props.deptType === 'user'
18
+            ?
19
+            '组织架构/模糊搜索' : '部门选择' }}</div>
20
+        </template>
21
+
22
+        <div class="custom-el-style">
23
+          <div>
24
+            <el-autocomplete v-model="personName"
25
+              :fetch-suggestions="props.deptType === 'user' ? queryUsers : queryDept"
26
+              :placeholder="props.deptType === 'user' ? '搜索员工/团队画像' : '搜索部门'" style="width:320px;" clearable
27
+              @select="handleSelect">
28
+              <template #suffix><el-icon>
29
+                  <Search />
30
+                </el-icon></template>
31
+              <template #default="{ item }">
32
+                <span>{{ item.nickName || item.deptName }}</span>
33
+                <span v-if="item.deptName && item.nickName" style="font-size:12px;color:#999;margin-left:8px">{{
34
+                  item.deptName }}</span>
35
+              </template>
36
+            </el-autocomplete>
37
+            <!-- <div class="primary" style="border-radius: 6px;" @click="() => searchHandler()">模糊搜索</div> -->
38
+          </div>
39
+          <div style="margin-top: 20px;">
40
+            <el-tree ref="treeRef" :data="departments" :default-expanded-keys="[100]" node-key="id"
41
+              :current-node-key="currentKey" :props="{ value: 'id', showPrefix: false }" accordion
42
+              @node-click="handleNodeClick" />
43
+          </div>
44
+        </div>
45
+      </el-popover>
43 46
     </div>
44 47
   </div>
45 48
 </template>
@@ -47,7 +50,7 @@
47 50
 <script setup>
48 51
 import { ref, nextTick, onMounted, onUnmounted } from 'vue'
49 52
 import { searchPortraitUsers } from '@/api/score/index'
50
-import { getDeptList,getDeptUserTree } from '@/api/item/items'
53
+import { getDeptList, getDeptUserTree } from '@/api/item/items'
51 54
 import { listDept } from '@/api/system/dept'
52 55
 
53 56
 const props = defineProps({
@@ -142,12 +145,12 @@ const filterDeptTree = (data, targetType) => {
142 145
 const getTimeRange = () => {
143 146
   if (currentTime.value === 'custom') {
144 147
     if (dateRange.value?.length === 2) {
145
-      if(props.deptType === 'user'){
148
+      if (props.deptType === 'user') {
146 149
         return { beginTime: formatDate(dateRange.value[0]), endTime: formatDate(dateRange.value[1]) }
147
-      }else{
150
+      } else {
148 151
         return { startDate: formatDate(dateRange.value[0]), endDate: formatDate(dateRange.value[1]) }
149 152
       }
150
-     
153
+
151 154
     }
152 155
     return {}
153 156
   }
@@ -156,9 +159,9 @@ const getTimeRange = () => {
156 159
   else if (currentTime.value === 'month') begin.setMonth(end.getMonth() - 1)
157 160
   else if (currentTime.value === 'quarter') begin.setMonth(end.getMonth() - 3)
158 161
   else begin.setFullYear(end.getFullYear() - 1)
159
-  if(props.deptType === 'user'){
162
+  if (props.deptType === 'user') {
160 163
     return { beginTime: formatDate(begin), endTime: formatDate(end) }
161
-  }else{
164
+  } else {
162 165
     return { startDate: formatDate(begin), endDate: formatDate(end) }
163 166
   }
164 167
 }
@@ -195,15 +198,15 @@ const handleNodeClick = (node) => {
195 198
     if (node.deptType === props.deptType) {
196 199
       personName.value = node.deptName || node.name || node.label;
197 200
       let obj = {}
198
-      
199
-      if (props.deptType === 'BRIGADE'||props.deptType === 'STATION') {
201
+
202
+      if (props.deptType === 'BRIGADE' || props.deptType === 'STATION') {
200 203
         obj = { deptId: node.deptId || node.id }
201 204
       }
202 205
       if (props.deptType === 'MANAGER') {
203
-        obj = { teamId: node.deptId || node.id, deptId:  node.deptId || node.id }
206
+        obj = { teamId: node.deptId || node.id, deptId: node.deptId || node.id }
204 207
       }
205 208
       if (props.deptType === 'TEAMS') {
206
-        obj = { groupId: node.deptId || node.id, deptId:  node.deptId || node.id }
209
+        obj = { groupId: node.deptId || node.id, deptId: node.deptId || node.id }
207 210
       }
208 211
       searchHandler(obj)
209 212
     }
@@ -276,8 +279,10 @@ onUnmounted(() => {
276 279
 
277 280
 defineExpose({
278 281
   getDefQuery() {
282
+   
279 283
     return {
280 284
       ...getTimeRange(),
285
+    
281 286
     }
282 287
   }
283 288
 })

+ 133 - 131
src/views/portraitManagement/deptProfile/index.vue

@@ -1,10 +1,10 @@
1 1
 <template>
2 2
   <div class="group-profile-page">
3 3
     <Page title="安检人事管理可视化大屏" :tabs="['能力画像', '运行数据']" @tab-change="handleTabChange">
4
-      <SearchBar v-model:visible="searchVisible" ref="searchBar" @search="handleSearch" :deptType="'BRIGADE'"/>
4
+      <SearchBar v-model:visible="searchVisible" ref="searchBar" @search="handleSearch" @init-done="handleInitDone" :deptType="'BRIGADE'" />
5 5
       <PentagonGroup :items="pentagonItems" />
6 6
       <Profile v-if="activeTab === 0" :query-params="queryParams" />
7
-      <RunData v-else :query-params="queryParams"/>
7
+      <RunData v-else :query-params="queryParams" />
8 8
     </Page>
9 9
 
10 10
   </div>
@@ -32,134 +32,135 @@ const teamStatsData = ref(null)
32 32
 const invokerCountDeptTeamStats = (params) => {
33 33
   countDeptTeamStats(params).then(res => {
34 34
     if (res.code === 200 && res.data) {
35
+      console.log(res.data)
35 36
       teamStatsData.value = [
36
-  {
37
-    value: '88',
38
-    label: '综合得分',
39
-    iconPath: zongheIcon,
40
-    cornerRadius: 20,
41
-    vertices: {
42
-      topLeft: { x: 0, y: 0 },
43
-      topRight: { x: 300, y: 0 },
44
-      bottomRight: { x: 260, y: 200 },
45
-      bottomLeft: { x: 0, y: 200 }
46
-    },
47
-    cardContentStyle: {
48
-      gap: '100px'
49
-    },
50
-    edgeGradients: {
51
-      top: { start: '#0f46fa', end: 'transparent' },
52
-      right: { start: 'transparent', end: '#9903C1' },
53
-      bottom: { start: '#9903C1', end: 'transparent' },
54
-      left: { start: 'transparent', end: '#0f46fa' }
55
-    },
56
-    bgGradientStart: 'rgba(33,33,58,0.95)',
57
-    bgGradientEnd: 'rgba(15,70,250,0.2)'
58
-  },
59
-  {
60
-    value: '10',
61
-    label: '人员数量',
62
-    iconPath: renyuanIcon,
63
-    cornerRadius: 20,
64
-    vertices: {
65
-      topLeft: { x: 10, y: 0 },
66
-      topRight: { x: 300, y: 0 },
67
-      bottomRight: { x: 260, y: 200 },
68
-      bottomLeft: { x: -30, y: 200 }
69
-    }, cardContentStyle: {
70
-      gap: '100px'
71
-    },
72
-    edgeGradients: {
73
-      top: { start: '#0f46fa', end: 'transparent' },
74
-      right: { start: 'transparent', end: '#9903C1' },
75
-      bottom: { start: '#9903C1', end: 'transparent' },
76
-      left: { start: 'transparent', end: '#0f46fa' }
77
-    },
78
-    bgGradientStart: 'rgba(33,33,58,0.95)',
79
-    bgGradientEnd: 'rgba(15,70,250,0.2)'
80
-  },
81
-  {
82
-    value: '周游波小组',
83
-    label: '',
84
-    iconPath: zu02Icon,
85
-    iconStyle: {
86
-      width: '250px',
87
-      height: '250px'
88
-    },
89
-    valueStyle: {
90
-      fontSize: '48px',
91
-      bottom: '26px',
92
-      position: 'relative'
93
-    },
94
-    vertical: true,
95
-    cornerRadius: 20,
96
-    vertices: {
97
-      topLeft: { x: 10, y: 0 },
98
-      topRight: { x: 280, y: 0 },
99
-      bottomRight: { x: 320, y: 200 },
100
-      bottomLeft: { x: -30, y: 200 }
101
-    },
102
-    cardContentStyle: {
103
-      gap: '0px',
104
-      position: 'relative',
105
-      bottom: '65px'
106
-    },
107
-    edgeGradients: {
108
-      top: { start: '#0f46fa', end: 'transparent' },
109
-      right: { start: 'transparent', end: '#9903C1' },
110
-      bottom: { start: '#9903C1', end: 'transparent' },
111
-      left: { start: 'transparent', end: '#0f46fa' }
112
-    },
113
-    bgGradientStart: 'rgba(33,33,58,0.95)',
114
-    bgGradientEnd: 'rgba(15,70,250,0.2)'
115
-  },
116
-  {
117
-    value: '28',
118
-    label: '平均年龄',
119
-    iconPath: nianlingIcon,
120
-    cornerRadius: 20,
121
-    vertices: {
122
-      topLeft: { x: -10, y: 0 },
123
-      topRight: { x: 290, y: 0 },
124
-      bottomRight: { x: 330, y: 200 },
125
-      bottomLeft: { x: 30, y: 200 }
126
-    },
127
-    cardContentStyle: {
128
-      gap: '100px'
129
-    },
130
-    edgeGradients: {
131
-      top: { start: '#0f46fa', end: 'transparent' },
132
-      right: { start: 'transparent', end: '#9903C1' },
133
-      bottom: { start: '#9903C1', end: 'transparent' },
134
-      left: { start: 'transparent', end: '#0f46fa' }
135
-    },
136
-    bgGradientStart: 'rgba(33,33,58,0.95)',
137
-    bgGradientEnd: 'rgba(15,70,250,0.2)'
138
-  },
139
-  {
140
-    value: '3.5',
141
-    label: '平均司龄',
142
-    iconPath: silingIcon,
143
-    cornerRadius: 20,
144
-    vertices: {
145
-      topLeft: { x: 0, y: 0 },
146
-      topRight: { x: 300, y: 0 },
147
-      bottomRight: { x: 300, y: 200 },
148
-      bottomLeft: { x: 40, y: 200 }
149
-    },
150
-    cardContentStyle: {
151
-      gap: '100px'
152
-    },
153
-    edgeGradients: {
154
-      top: { start: '#0f46fa', end: 'transparent' },
155
-      right: { start: 'transparent', end: '#9903C1' },
156
-      bottom: { start: '#9903C1', end: 'transparent' },
157
-      left: { start: 'transparent', end: '#0f46fa' }
158
-    },
159
-    bgGradientStart: 'rgba(33,33,58,0.95)',
160
-    bgGradientEnd: 'rgba(15,70,250,0.2)'
161
-  }
162
-]
37
+        {
38
+          value: '88',
39
+          label: '综合得分',
40
+          iconPath: zongheIcon,
41
+          cornerRadius: 20,
42
+          vertices: {
43
+            topLeft: { x: 0, y: 0 },
44
+            topRight: { x: 300, y: 0 },
45
+            bottomRight: { x: 260, y: 200 },
46
+            bottomLeft: { x: 0, y: 200 }
47
+          },
48
+          cardContentStyle: {
49
+            gap: '100px'
50
+          },
51
+          edgeGradients: {
52
+            top: { start: '#0f46fa', end: 'transparent' },
53
+            right: { start: 'transparent', end: '#9903C1' },
54
+            bottom: { start: '#9903C1', end: 'transparent' },
55
+            left: { start: 'transparent', end: '#0f46fa' }
56
+          },
57
+          bgGradientStart: 'rgba(33,33,58,0.95)',
58
+          bgGradientEnd: 'rgba(15,70,250,0.2)'
59
+        },
60
+        {
61
+          value: '10',
62
+          label: '人员数量',
63
+          iconPath: renyuanIcon,
64
+          cornerRadius: 20,
65
+          vertices: {
66
+            topLeft: { x: 10, y: 0 },
67
+            topRight: { x: 300, y: 0 },
68
+            bottomRight: { x: 260, y: 200 },
69
+            bottomLeft: { x: -30, y: 200 }
70
+          }, cardContentStyle: {
71
+            gap: '100px'
72
+          },
73
+          edgeGradients: {
74
+            top: { start: '#0f46fa', end: 'transparent' },
75
+            right: { start: 'transparent', end: '#9903C1' },
76
+            bottom: { start: '#9903C1', end: 'transparent' },
77
+            left: { start: 'transparent', end: '#0f46fa' }
78
+          },
79
+          bgGradientStart: 'rgba(33,33,58,0.95)',
80
+          bgGradientEnd: 'rgba(15,70,250,0.2)'
81
+        },
82
+        {
83
+          value: '周游波小组',
84
+          label: '',
85
+          iconPath: zu02Icon,
86
+          iconStyle: {
87
+            width: '250px',
88
+            height: '250px'
89
+          },
90
+          valueStyle: {
91
+            fontSize: '48px',
92
+            bottom: '26px',
93
+            position: 'relative'
94
+          },
95
+          vertical: true,
96
+          cornerRadius: 20,
97
+          vertices: {
98
+            topLeft: { x: 10, y: 0 },
99
+            topRight: { x: 280, y: 0 },
100
+            bottomRight: { x: 320, y: 200 },
101
+            bottomLeft: { x: -30, y: 200 }
102
+          },
103
+          cardContentStyle: {
104
+            gap: '0px',
105
+            position: 'relative',
106
+            bottom: '65px'
107
+          },
108
+          edgeGradients: {
109
+            top: { start: '#0f46fa', end: 'transparent' },
110
+            right: { start: 'transparent', end: '#9903C1' },
111
+            bottom: { start: '#9903C1', end: 'transparent' },
112
+            left: { start: 'transparent', end: '#0f46fa' }
113
+          },
114
+          bgGradientStart: 'rgba(33,33,58,0.95)',
115
+          bgGradientEnd: 'rgba(15,70,250,0.2)'
116
+        },
117
+        {
118
+          value: '28',
119
+          label: '平均年龄',
120
+          iconPath: nianlingIcon,
121
+          cornerRadius: 20,
122
+          vertices: {
123
+            topLeft: { x: -10, y: 0 },
124
+            topRight: { x: 290, y: 0 },
125
+            bottomRight: { x: 330, y: 200 },
126
+            bottomLeft: { x: 30, y: 200 }
127
+          },
128
+          cardContentStyle: {
129
+            gap: '100px'
130
+          },
131
+          edgeGradients: {
132
+            top: { start: '#0f46fa', end: 'transparent' },
133
+            right: { start: 'transparent', end: '#9903C1' },
134
+            bottom: { start: '#9903C1', end: 'transparent' },
135
+            left: { start: 'transparent', end: '#0f46fa' }
136
+          },
137
+          bgGradientStart: 'rgba(33,33,58,0.95)',
138
+          bgGradientEnd: 'rgba(15,70,250,0.2)'
139
+        },
140
+        {
141
+          value: '3.5',
142
+          label: '平均司龄',
143
+          iconPath: silingIcon,
144
+          cornerRadius: 20,
145
+          vertices: {
146
+            topLeft: { x: 0, y: 0 },
147
+            topRight: { x: 300, y: 0 },
148
+            bottomRight: { x: 300, y: 200 },
149
+            bottomLeft: { x: 40, y: 200 }
150
+          },
151
+          cardContentStyle: {
152
+            gap: '100px'
153
+          },
154
+          edgeGradients: {
155
+            top: { start: '#0f46fa', end: 'transparent' },
156
+            right: { start: 'transparent', end: '#9903C1' },
157
+            bottom: { start: '#9903C1', end: 'transparent' },
158
+            left: { start: 'transparent', end: '#0f46fa' }
159
+          },
160
+          bgGradientStart: 'rgba(33,33,58,0.95)',
161
+          bgGradientEnd: 'rgba(15,70,250,0.2)'
162
+        }
163
+      ]
163 164
     }
164 165
   })
165 166
 }
@@ -167,7 +168,7 @@ const invokerCountDeptTeamStats = (params) => {
167 168
 
168 169
 
169 170
 const pentagonItems = ref([
170
-  
171
+
171 172
 ])
172 173
 
173 174
 const handleSearch = (params) => {
@@ -181,9 +182,10 @@ const handleTabChange = (index) => {
181 182
 
182 183
 const searchBar = ref(null)
183 184
 onMounted(() => {
185
+
184 186
   const defParams = Object.assign({ deptId: '' }, searchBar.value.getDefQuery())
185 187
   queryParams.value = defParams
186
-  invokerCountDeptTeamStats(defParams)
188
+ 
187 189
 })
188 190
 
189 191
 </script>

+ 4 - 4
src/views/portraitManagement/employeeProfile/index.vue

@@ -105,7 +105,7 @@
105 105
         </div>
106 106
         <div v-show="portrait.personName" class="content-bottom">
107 107
           <div class="content-bottom-left">
108
-            <Card title="个人基本信息">
108
+            <Card title="工作履历">
109 109
               <div class="work-history">
110 110
                 <span v-if="portrait.startWorkingDate">
111 111
                   {{ formatWorkDate(portrait.startWorkingDate)  }}入职 | 司龄{{ portrait.workYears != null ? portrait.workYears : '-' }}年 | 开机年限{{ portrait.securityCheckYears != null ? portrait.securityCheckYears : '-'
@@ -116,7 +116,7 @@
116 116
                 <span v-else>暂无数据</span>
117 117
               </div>
118 118
             </Card>
119
-            <Card title="个人基本信息">
119
+            <Card title="获奖记录">
120 120
               <div class="honor-item" v-for="(value, index) in portrait.awards" :key="index">
121 121
                 <div :style="{'--indexBgColor': value.color}">
122 122
                   <div :data-index="index + 1"></div>
@@ -127,12 +127,12 @@
127 127
             </Card>
128 128
           </div>
129 129
           <div class="content-bottom-center">
130
-            <Card title="个人基本信息">
130
+            <Card title="个人能力">
131 131
               <div ref="abilityChart" class="chart-box" />
132 132
             </Card>
133 133
           </div>
134 134
           <div class="content-bottom-right">
135
-            <Card title="个人基本信息">
135
+            <Card title="补充信息">
136 136
               <div class="supp-item">
137 137
                 <span class="s-lbl">政治面貌:</span>
138 138
                 <span class="s-val">{{ portrait.politicalStatusText || '-' }}</span>