recordCountList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="uni-app">
  3. <view class="status-bar" />
  4. <view class="main-container">
  5. <wk-nav-bar :title="navTitle" />
  6. <view class="container">
  7. <view class="cell-wrapper">
  8. <view
  9. v-for="(item, index) in navList"
  10. :key="index"
  11. class="cell"
  12. @click="handleShowList(item)">
  13. <view class="cell-left">
  14. {{ item.label }}
  15. </view>
  16. <view class="cell-body">
  17. {{ item.num }}条
  18. </view>
  19. <view class="cell-right">
  20. <text class="wk wk-arrow-right" />
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import { QueryRecordCount } from 'API/crm/work'
  30. import { QueryLogRecordCount } from 'API/oa/journal'
  31. import { isArray } from '@/utils/types.js'
  32. export default {
  33. name: 'RecordCountList',
  34. data() {
  35. return {
  36. routerQuery: {},
  37. navList: [
  38. { type: 1, label: '线索模块', num: 0 },
  39. { type: 2, label: '客户模块', num: 0 },
  40. { type: 3, label: '联系人模块', num: 0 },
  41. { type: 5, label: '商机模块', num: 0 },
  42. { type: 6, label: '合同模块', num: 0 }
  43. ],
  44. }
  45. },
  46. computed: {
  47. navTitle() {
  48. if (!this.routerQuery.logId) {
  49. return '新增的跟进记录'
  50. }
  51. return this.routerQuery.title
  52. }
  53. },
  54. onLoad(options = {}) {
  55. this.routerQuery = options
  56. this.getDataNum()
  57. },
  58. methods: {
  59. getDataNum() {
  60. let requset
  61. let params
  62. if (this.routerQuery.logId) {
  63. params = {
  64. type: 5,
  65. logId: this.routerQuery.logId
  66. }
  67. requset = QueryLogRecordCount
  68. } else {
  69. if (this.routerQuery.userList && !isArray(this.routerQuery.userList)) {
  70. this.routerQuery.userList = this.routerQuery.userList.split(',')
  71. }
  72. if (this.routerQuery.deptList && !isArray(this.routerQuery.deptList)) {
  73. this.routerQuery.deptList = this.routerQuery.deptList.split(',')
  74. }
  75. params = this.routerQuery
  76. requset = QueryRecordCount
  77. }
  78. requset(params).then(res => {
  79. this.navList.forEach((item, index) => {
  80. let findRes = res.find(o => o.crmType == item.type)
  81. if (findRes) {
  82. item.num = findRes.count || 0
  83. this.$set(this.navList, index, item)
  84. }
  85. })
  86. }).catch(() => {})
  87. },
  88. handleShowList(nav) {
  89. if (nav.num === 0) return
  90. this.$Router.navigateTo({
  91. url: '/pages_crm/homeReport/recordDetailList',
  92. query: {
  93. ...this.routerQuery,
  94. crmType: nav.type
  95. }
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. .cell-wrapper {
  103. background-color: white;
  104. padding: 0 32rpx;
  105. margin-top: 20rpx;
  106. .cell {
  107. font-size: 28rpx;
  108. border-bottom: 1rpx solid $border-color;
  109. padding: 25rpx 0;
  110. @include left;
  111. .cell-left {
  112. width: 200rpx;
  113. font-size: 30rpx;
  114. }
  115. .cell-body {
  116. flex: 1;
  117. color: $gray;
  118. text-align: right;
  119. }
  120. .cell-right {
  121. color: $light;
  122. margin-left: 10rpx;
  123. }
  124. }
  125. }
  126. </style>