index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <home-container ref="homeContainer" :customStyle="{ background: 'none' }" @scroll="handleScroll"
  3. @scroll-end="handleScrollEnd">
  4. <div class="eikon-statistics-container">
  5. <!-- 个人模式显示选项卡 -->
  6. <h-tabs v-if="hasTabs" v-model="currentTab" :tabs="tabList" value-key="type" label-key="title"
  7. @change="handleTabChange" class="h-tabs-fixed" />
  8. <topInfo @department-change="handleDepartmentChange"
  9. :class="['top-info-fixed', hasTabs ? 'with-tabs' : 'without-tabs']" :currentTab="currentTab" />
  10. <!-- 总体概览和详细内容区域 -->
  11. <div class="content-section" :class="hasTabs ? 'with-tabs' : 'without-tabs'">
  12. <!-- 总体概览 -->
  13. <div class="overview-section">
  14. <div class="section-title">总体概览</div>
  15. <general-overview :overview-data="overviewData" />
  16. </div>
  17. <!-- 详细内容 -->
  18. <div class="detail-section">
  19. <div class="section-title">详细内容</div>
  20. <!-- 资质能力 -->
  21. <qualification />
  22. <!-- 工作履历 -->
  23. <work-experience />
  24. <!-- 出勤投入 -->
  25. <attendance />
  26. <!-- 工作产出 -->
  27. <work-output />
  28. <!-- 标准执行 -->
  29. <standard-execution />
  30. <!-- 学习成长 -->
  31. <learning-growth />
  32. <!-- 协同配合 -->
  33. <collaboration />
  34. <!-- 主观印象 -->
  35. <subjective-impression />
  36. <!-- 成员明细 -->
  37. <member-details v-if="!isPersonal" @nameClick="handleNameClick" />
  38. </div>
  39. </div>
  40. </div>
  41. <!-- 返回上一级按钮 -->
  42. <div v-if="hasOldLevel" class="back-button" :class="{ 'back-button-hidden': isScrolling }">
  43. <div class="back-circle" @click="goBack">
  44. <div class="back-icon">
  45. <uni-icons type="back" size="40rpx" color="#ffffff"></uni-icons>
  46. </div>
  47. <div class="back-text">返回上一级</div>
  48. </div>
  49. </div>
  50. </home-container>
  51. </template>
  52. <script>
  53. import { mapActions, mapState, mapGetters } from 'vuex'
  54. import HomeContainer from "@/components/HomeContainer.vue";
  55. import HTabs from "@/components/h-tabs/h-tabs.vue";
  56. import { getInfo } from "@/api/login"
  57. import topInfo from "@/pages/eikonStatistics/components/topInfo.vue"
  58. import GeneralOverview from "@/pages/eikonStatistics/components/general-overview.vue"
  59. import StandardExecution from "@/pages/eikonStatistics/components/standard-execution.vue"
  60. import Collaboration from "@/pages/eikonStatistics/components/collaboration.vue"
  61. import Qualification from "@/pages/eikonStatistics/components/Qualification.vue"
  62. import WorkExperience from "@/pages/eikonStatistics/components/WorkExperience.vue"
  63. import Attendance from "@/pages/eikonStatistics/components/Attendance.vue"
  64. import WorkOutput from "@/pages/eikonStatistics/components/WorkOutput.vue"
  65. import LearningGrowth from "@/pages/eikonStatistics/components/LearningGrowth.vue"
  66. import SubjectiveImpression from "@/pages/eikonStatistics/components/SubjectiveImpression.vue"
  67. import MemberDetails from "@/pages/eikonStatistics/components/MemberDetails.vue"
  68. import { getModuleMetrics } from "@/api/eikonStatistics/eikonStatistics"
  69. export default {
  70. components: { HomeContainer, HTabs, topInfo, GeneralOverview, StandardExecution, Collaboration, Qualification, WorkExperience, Attendance, WorkOutput, LearningGrowth, SubjectiveImpression, MemberDetails },
  71. data() {
  72. return {
  73. currentTab: 'personal', // 当前选中的选项卡
  74. isScrolling: false, // 是否正在滚动
  75. // 选项卡列表
  76. tabList: [
  77. {
  78. type: 'personal',
  79. title: '个人'
  80. },
  81. {
  82. type: 'team',
  83. title: '班组'
  84. }
  85. ],
  86. // 概览数据
  87. overviewData: {
  88. // 左侧数据
  89. qualificationAbility: 0,
  90. attendanceInput: 0,
  91. standardExecution: 0,
  92. coordination: 0,
  93. // 右侧数据
  94. workHistory: 0,
  95. workOutput: 0,
  96. learningGrowth: 0,
  97. subjectiveImpression: 0
  98. },
  99. };
  100. },
  101. computed: {
  102. ...mapState({
  103. userInfo: state => state.user.userInfo,
  104. userRoles: state => state.user.roles || [],
  105. currentLevel: state => state.eikonLevel.currentLevel,
  106. currentLevelId: state => state.eikonLevel.currentLevelId,
  107. oldLevel: state => state.eikonLevel.oldLevel,
  108. oldLevelId: state => state.eikonLevel.oldLevelId,
  109. allData: state => state.eikonLevel.allData,
  110. systemData: state => state.eikonLevel.systemData
  111. }),
  112. ...mapGetters('eikonLevel', ['isPersonal', 'isZhanZhang', 'isKeZhang', 'isBanZuZhang']),
  113. hasOldLevel() {
  114. return this.oldLevel && this.oldLevelId
  115. },
  116. hasTabs() {
  117. return this.userRoles.includes('SecurityCheck') || this.userRoles.includes('banzuzhang')
  118. }
  119. },
  120. async onLoad() {
  121. // 设置初始级别
  122. await this.setInitialLevel();
  123. // 加载初始数据
  124. await this.loadPageData();
  125. console.log(this.userInfo, "userInfo")
  126. },
  127. methods: {
  128. ...mapActions('eikonLevel', ['changeLevel', 'initLevel', 'saveAllData', 'loadData']),
  129. //根据不同的登录角色,赋予初始级别
  130. async setInitialLevel() {
  131. let isZhanZhang = this.userRoles && this.userRoles.includes('test')
  132. let isKeZhang = this.userRoles && this.userRoles.includes('kezhang')
  133. let isZhiJian = this.userRoles && this.userRoles.includes('zhijianke')
  134. if (isKeZhang || isZhanZhang ||isZhiJian) {
  135. this.initLevel({ level: isKeZhang ? 'department' : 'station', levelId: isKeZhang ? this.userInfo.departmentId : this.userInfo.stationId })
  136. } else {
  137. this.initLevel({ level: 'personal', levelId: this.userInfo.userId })
  138. }
  139. },
  140. // 选项卡切换处理
  141. async handleTabChange(tabType, tabItem) {
  142. this.currentTab = tabType;
  143. if (tabType === 'team') {
  144. this.initLevel({ level: 'team', levelId: this.userInfo.teamsId })
  145. } else {
  146. this.initLevel({ level: 'personal', levelId: this.userInfo.userId })
  147. }
  148. // 根据选项卡类型加载不同的数据
  149. await this.loadPageData();
  150. // 滚动到顶部
  151. this.scrollToTop()
  152. },
  153. handleNameClick(row) {
  154. // 滚动到顶部
  155. this.scrollToTop()
  156. },
  157. scrollToTop() {
  158. this.$nextTick(() => {
  159. if (this.$refs.homeContainer && this.$refs.homeContainer.scrollToTop) {
  160. this.$refs.homeContainer.scrollToTop();
  161. }
  162. });
  163. },
  164. // 部门选择变化处理
  165. async handleDepartmentChange(selectedDepartment) {
  166. console.log('部门选择变化:', selectedDepartment);
  167. const { deptType } = selectedDepartment
  168. if (deptType == 'STATION') {
  169. this.initLevel({ level: 'station', levelId: selectedDepartment.id })
  170. }
  171. if (deptType == 'DEPARTMENT') {
  172. this.initLevel({ level: 'department', levelId: selectedDepartment.id })
  173. }
  174. if (deptType == 'TEAMS') {
  175. this.initLevel({ level: 'team', levelId: selectedDepartment.id })
  176. }
  177. if (deptType == 'BRIGADE') {
  178. this.initLevel({ level: 'brigade', levelId: selectedDepartment.id })
  179. }
  180. if (!deptType) {
  181. this.initLevel({ level: 'personal', levelId: selectedDepartment.id })
  182. }
  183. // 重新加载数据
  184. await this.loadPageData();
  185. },
  186. // 加载数据方法
  187. async loadPageData() {
  188. try {
  189. await this.loadData()
  190. } catch (error) {
  191. console.error('加载数据失败:', error);
  192. uni.showToast({
  193. title: '数据加载失败',
  194. icon: 'none'
  195. });
  196. }
  197. },
  198. // 滚动处理
  199. handleScroll() {
  200. this.isScrolling = true
  201. },
  202. // 滚动停止处理
  203. handleScrollEnd() {
  204. this.isScrolling = false
  205. },
  206. // 返回上一级
  207. async goBack() {
  208. this.initLevel({
  209. level: this.oldLevel,
  210. levelId: this.oldLevelId
  211. })
  212. // 重新加载数据
  213. await this.loadPageData();
  214. }
  215. }
  216. }</script>
  217. <style lang="scss" scoped>
  218. .eikon-statistics-container {
  219. padding: 20rpx;
  220. }
  221. // 固定选项卡样式
  222. .h-tabs-fixed {
  223. padding: 22rpx 44rpx;
  224. position: fixed;
  225. top: 78rpx;
  226. left: 0;
  227. right: 0;
  228. z-index: 998;
  229. background: #ffffff;
  230. }
  231. // 固定顶部信息样式
  232. .top-info-fixed {
  233. position: fixed;
  234. left: 0;
  235. right: 0;
  236. z-index: 998;
  237. background: #ffffff;
  238. }
  239. // 当h-tabs显示时,topInfo的top位置
  240. .top-info-fixed.with-tabs {
  241. top: 160rpx;
  242. }
  243. // 当h-tabs不显示时,topInfo的top位置
  244. .top-info-fixed.without-tabs {
  245. top: 78rpx;
  246. }
  247. // 总体概览和详细内容区域样式
  248. .content-section {
  249. /* 为固定的h-tabs和topInfo预留空间 */
  250. }
  251. // 当h-tabs显示时,content-section的margin-top
  252. .content-section.with-tabs {
  253. margin-top: 290rpx;
  254. }
  255. // 当h-tabs不显示时,content-section的margin-top
  256. .content-section.without-tabs {
  257. margin-top: 210rpx;
  258. }
  259. .overview-section,
  260. .detail-section {
  261. margin-bottom: 40rpx;
  262. }
  263. .section-title {
  264. font-size: 32rpx;
  265. font-weight: bold;
  266. color: #333333;
  267. text-align: left;
  268. margin-bottom: 24rpx;
  269. }
  270. .overview-content {
  271. display: flex;
  272. justify-content: space-between;
  273. background: #ffffff;
  274. border-radius: 16rpx;
  275. padding: 32rpx;
  276. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  277. }
  278. .overview-item {
  279. text-align: center;
  280. flex: 1;
  281. }
  282. .overview-number {
  283. font-size: 48rpx;
  284. font-weight: bold;
  285. color: #1890ff;
  286. margin-bottom: 8rpx;
  287. }
  288. .overview-label {
  289. font-size: 24rpx;
  290. color: #666666;
  291. }
  292. .detail-item {
  293. padding: 24rpx 0;
  294. border-bottom: 1rpx solid #f0f0f0;
  295. &:last-child {
  296. border-bottom: none;
  297. }
  298. }
  299. .detail-header {
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. margin-bottom: 16rpx;
  304. }
  305. .detail-title {
  306. font-size: 28rpx;
  307. font-weight: 500;
  308. color: #333333;
  309. }
  310. .detail-time {
  311. font-size: 24rpx;
  312. color: #999999;
  313. }
  314. .detail-description {
  315. font-size: 26rpx;
  316. color: #666666;
  317. line-height: 1.5;
  318. }
  319. /* 折叠面板内容样式 */
  320. .collapse-content {
  321. padding: 20rpx;
  322. }
  323. .content-item {
  324. display: flex;
  325. align-items: flex-start;
  326. margin-bottom: 16rpx;
  327. &:last-child {
  328. margin-bottom: 0;
  329. }
  330. }
  331. .item-label {
  332. font-size: 26rpx;
  333. color: #333333;
  334. font-weight: 500;
  335. min-width: 120rpx;
  336. margin-right: 16rpx;
  337. }
  338. .item-value {
  339. font-size: 26rpx;
  340. color: #999999;
  341. flex: 1;
  342. line-height: 1.5;
  343. }
  344. /* 查获排名样式 */
  345. .seize-ranking-section {
  346. margin-top: 30rpx;
  347. border-top: 1rpx solid #f0f0f0;
  348. padding-top: 20rpx;
  349. }
  350. .ranking-header {
  351. display: flex;
  352. justify-content: space-between;
  353. align-items: center;
  354. margin-bottom: 20rpx;
  355. }
  356. .ranking-title {
  357. font-size: 28rpx;
  358. font-weight: bold;
  359. color: #333333;
  360. }
  361. .ranking-content {
  362. background: #f8f9fa;
  363. border-radius: 12rpx;
  364. padding: 20rpx;
  365. }
  366. .ranking-list {
  367. display: flex;
  368. flex-direction: column;
  369. gap: 16rpx;
  370. }
  371. .ranking-item {
  372. display: flex;
  373. align-items: center;
  374. padding: 12rpx 16rpx;
  375. background: #ffffff;
  376. border-radius: 8rpx;
  377. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
  378. }
  379. .rank-number {
  380. width: 40rpx;
  381. height: 40rpx;
  382. background: #4873E3;
  383. color: #ffffff;
  384. border-radius: 50%;
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. font-size: 24rpx;
  389. font-weight: bold;
  390. margin-right: 16rpx;
  391. }
  392. .rank-name {
  393. flex: 1;
  394. font-size: 26rpx;
  395. color: #333333;
  396. font-weight: 500;
  397. }
  398. .rank-count {
  399. font-size: 26rpx;
  400. color: #4873E3;
  401. font-weight: bold;
  402. }
  403. /* 查获排名进度条样式 */
  404. .ranking-progress {
  405. margin-top: 20rpx;
  406. padding: 20rpx;
  407. background: #ffffff;
  408. border-radius: 12rpx;
  409. .progress-text {
  410. font-size: 28rpx;
  411. color: #333;
  412. font-weight: 500;
  413. }
  414. }
  415. /* 学习成长样式 */
  416. .learning-ranking-section {}
  417. /* 返回按钮样式 */
  418. .back-button {
  419. position: fixed;
  420. right: 30rpx;
  421. bottom: 120rpx;
  422. z-index: 999;
  423. transition: transform 0.3s ease-in-out;
  424. }
  425. .back-button-hidden {
  426. transform: translateX(120rpx);
  427. }
  428. .back-circle {
  429. width: 120rpx;
  430. height: 120rpx;
  431. background: linear-gradient(135deg, #4873E3 0%, #6A8EE8 100%);
  432. border-radius: 50%;
  433. display: flex;
  434. flex-direction: column;
  435. align-items: center;
  436. justify-content: center;
  437. box-shadow: 0 8rpx 24rpx rgba(72, 115, 227, 0.3);
  438. cursor: pointer;
  439. transition: all 0.3s ease;
  440. }
  441. .back-circle:active {
  442. transform: scale(0.95);
  443. box-shadow: 0 4rpx 12rpx rgba(72, 115, 227, 0.4);
  444. }
  445. .back-icon {
  446. margin-bottom: 8rpx;
  447. }
  448. .back-text {
  449. font-size: 20rpx;
  450. color: #ffffff;
  451. font-weight: 500;
  452. text-align: center;
  453. margin-bottom: 20rpx;
  454. line-height: 1.2;
  455. }
  456. </style>