report.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="uni-app">
  3. <view class="status-bar" />
  4. <view v-if="typeObj" class="main-container">
  5. <wk-nav-bar :title="navTitle" />
  6. <view class="list-view">
  7. <wk-scroll-view
  8. :status="listStatus"
  9. class="list-scroll"
  10. @refresh="getList({}, true)"
  11. @loadmore="getList()">
  12. <template v-for="(item, index) in listData">
  13. <customer-item
  14. v-if="typeObj.comName === 'CustomerItem'"
  15. :key="index"
  16. :item-data="item" />
  17. <contacts-item
  18. v-if="typeObj.comName === 'ContactsItem'"
  19. :key="index"
  20. :index="index"
  21. :item-data="item" />
  22. <business-item
  23. v-if="typeObj.comName === 'BusinessItem'"
  24. :key="index"
  25. :item-data="item" />
  26. <contract-item
  27. v-if="typeObj.comName === 'ContractItem'"
  28. :key="index"
  29. :item-data="item" />
  30. <received-item
  31. v-if="typeObj.comName === 'ReceivedItem'"
  32. :key="index"
  33. :item-data="item" />
  34. </template>
  35. </wk-scroll-view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { BulletinList } from 'API/crm/work'
  42. import { QueryLogBulletinByType } from 'API/oa/journal'
  43. import CustomerItem from '../customer/components/customerItem.vue'
  44. import ContactsItem from '../contacts/components/contactsItem.vue'
  45. import BusinessItem from '../business/components/businessItem.vue'
  46. import ContractItem from '../contract/components/contractItem.vue'
  47. import ReceivedItem from '../receivables/components/receivedItem.vue'
  48. import { mapGetters } from 'vuex'
  49. import mainListMixins from '@/mixins/mainList.js'
  50. import { isArray } from '@/utils/types.js'
  51. export default {
  52. name: 'HomeReport',
  53. components: {
  54. CustomerItem,
  55. ContactsItem,
  56. BusinessItem,
  57. ContractItem,
  58. ReceivedItem
  59. },
  60. mixins: [mainListMixins],
  61. data() {
  62. return {
  63. type: null,
  64. routerQuery: {},
  65. GetListFn: BulletinList
  66. }
  67. },
  68. computed: {
  69. typeObj() {
  70. if (!this.type) return null
  71. if (this.routerQuery.logId) {
  72. return {
  73. customer: {type: 1, comName: 'CustomerItem'},
  74. business: {type: 2, comName: 'BusinessItem'},
  75. contract: {type: 3, comName: 'ContractItem'},
  76. receivables_money: {type: 4, comName: 'ReceivedItem'}
  77. }[this.type] || null
  78. }
  79. const typeMap = {
  80. customer: {title: '新增的客户', label: 2, comName: 'CustomerItem'},
  81. contacts: {title: '新增的联系人', label: 3, comName: 'ContactsItem'},
  82. business: {title: '新增的商机', label: 5, comName: 'BusinessItem'},
  83. contract: {title: '新增的合同', label: 6, comName: 'ContractItem'},
  84. contract_money: {title: '合同金额', label: 6, comName: 'ContractItem'},
  85. business_money: {title: '商机金额', label: 5, comName: 'BusinessItem'},
  86. receivables_money: {title: '回款金额', label: 7, comName: 'ReceivedItem'}
  87. }
  88. if (!typeMap.hasOwnProperty(this.type)) return null
  89. return typeMap[this.type]
  90. },
  91. navTitle() {
  92. if (this.routerQuery.logId) {
  93. // eslint-disable-next-line vue/no-side-effects-in-computed-properties
  94. this.GetListFn = QueryLogBulletinByType
  95. return this.routerQuery.title
  96. }
  97. return this.typeObj.title
  98. }
  99. },
  100. onLoad(options = {}) {
  101. this.type = options.module
  102. this.routerQuery = options
  103. // 如果是日志
  104. if (this.routerQuery.logId) {
  105. this.GetListFn = QueryLogBulletinByType
  106. }
  107. this.getList()
  108. },
  109. methods: {
  110. getParams() {
  111. if (this.routerQuery.logId) {
  112. return {
  113. logId: this.routerQuery.logId,
  114. type: this.typeObj.type
  115. }
  116. }
  117. if (this.routerQuery.userList && !isArray(this.routerQuery.userList)) {
  118. this.routerQuery.userList = this.routerQuery.userList.split(',')
  119. }
  120. if (this.routerQuery.deptList && !isArray(this.routerQuery.deptList)) {
  121. this.routerQuery.deptList = this.routerQuery.deptList.split(',')
  122. }
  123. let query = {
  124. label: this.typeObj.label,
  125. ...this.routerQuery
  126. }
  127. delete query.module
  128. switch (this.type) {
  129. case 'contract_money':
  130. query = {
  131. ...query,
  132. checkStatus: 1,
  133. moneyType: 1
  134. }
  135. break;
  136. case 'business_money':
  137. break;
  138. case 'receivables_money':
  139. query = {
  140. ...query,
  141. checkStatus: 1,
  142. moneyType: 2
  143. }
  144. break;
  145. }
  146. return query
  147. }
  148. }
  149. }
  150. </script>
  151. <style scoped lang="scss">
  152. .list-view {
  153. flex: 1;
  154. overflow: hidden;
  155. .list-scroll {
  156. position: relative;
  157. width: 100%;
  158. height: 100%;
  159. overflow: hidden;
  160. }
  161. }
  162. </style>