FlowMixin.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /**
  2. * opType
  3. * -1 - 我发起的新建/编辑
  4. * 0 - 我发起的详情
  5. * 1 - 待签事宜
  6. * 2 - 待办事宜
  7. * 3 - 在办事宜
  8. * 4 - 已办事宜
  9. * 5 - 抄送事宜
  10. * 6 - 流程监控
  11. */
  12. const statusMap = {
  13. 1: [{
  14. name: '全部',
  15. status: ''
  16. },
  17. {
  18. name: '协办',
  19. status: '7'
  20. },
  21. {
  22. name: '退回',
  23. status: '5'
  24. },
  25. {
  26. name: '超时',
  27. status: '-2'
  28. }
  29. ],
  30. 2: [{
  31. name: '全部',
  32. status: ''
  33. },
  34. {
  35. name: '协办',
  36. status: '7'
  37. },
  38. {
  39. name: '退回',
  40. status: '5'
  41. },
  42. {
  43. name: '超时',
  44. status: '-2'
  45. }
  46. ],
  47. 3: [{
  48. name: '全部',
  49. status: ''
  50. },
  51. {
  52. name: '待提交',
  53. status: '0'
  54. },
  55. {
  56. name: '进行中',
  57. status: '1'
  58. },
  59. {
  60. name: '已完成',
  61. status: '2'
  62. }
  63. ],
  64. 4: [{
  65. name: '全部',
  66. status: ''
  67. },
  68. {
  69. name: '同意',
  70. status: '1'
  71. },
  72. {
  73. name: '拒绝',
  74. status: '2'
  75. },
  76. {
  77. name: '转审',
  78. status: '3'
  79. },
  80. {
  81. name: '加签',
  82. status: '4'
  83. },
  84. {
  85. name: '退回',
  86. status: '5'
  87. }
  88. ],
  89. 5: [{
  90. name: '全部',
  91. status: ''
  92. },
  93. {
  94. name: '已读',
  95. status: '1'
  96. },
  97. {
  98. name: '未读',
  99. status: '0'
  100. }
  101. ]
  102. };
  103. import {
  104. getOperatorList,
  105. getFlowLaunchList
  106. } from '@/api/workFlow/template'
  107. const sysConfigInfo = uni.getStorageSync('sysConfigInfo')
  108. export default {
  109. data() {
  110. return {
  111. mescrollTop: 206,
  112. statusList: [],
  113. tabsList: [{
  114. fullName: '在办',
  115. category: '2',
  116. key: 2
  117. }, {
  118. fullName: '发起',
  119. category: null,
  120. key: 3
  121. }, {
  122. fullName: '已办',
  123. category: '3',
  124. key: 4
  125. }, {
  126. fullName: '抄送',
  127. category: '4',
  128. key: 5
  129. }],
  130. current: 0,
  131. subsectionIndex: 0,
  132. status: ''
  133. }
  134. },
  135. watch: {
  136. current: {
  137. handler(val) {
  138. if (sysConfigInfo.flowSign == 1 && val == 0) return this.statusList = []
  139. this.statusList = statusMap[this.tabsList[val].key]
  140. this.category = this.tabsList[this.current].category
  141. },
  142. immediate: true,
  143. deep: true
  144. },
  145. },
  146. onLoad(e) {
  147. this.config = e?.data && JSON.parse(decodeURIComponent(e?.data))
  148. this.addTabList()
  149. this.getContentHeight()
  150. if (e?.data) this.change(this.config.tabIndex)
  151. },
  152. methods: {
  153. addTabList() {
  154. const configToCheck = [{
  155. key: 'flowTodo',
  156. tab: {
  157. fullName: '待办',
  158. category: '1',
  159. key: 1
  160. }
  161. },
  162. {
  163. key: 'flowSign',
  164. tab: {
  165. fullName: '待签',
  166. category: '0',
  167. key: 0
  168. }
  169. }
  170. ];
  171. configToCheck.forEach(config => {
  172. if (sysConfigInfo[config.key] === 1) return this.tabsList.unshift(config.tab);
  173. });
  174. },
  175. /* tab1 */
  176. change(index) {
  177. let i = this.tabsList.findIndex(o => o.key === index)
  178. let item = this.tabsList[this.config?.portal ? i : index]
  179. this.current = Number(this.config?.portal ? i : index);
  180. this.status = ''
  181. this.keyword = ''
  182. this.subsectionIndex = 0
  183. this.category = item.category
  184. this.$nextTick(() => {
  185. this.list = [];
  186. this.mescroll.resetUpScroll();
  187. })
  188. },
  189. /* tab2 */
  190. subsection(e) {
  191. let item = this.statusList[e]
  192. this.status = item.status
  193. this.subsectionIndex = e
  194. this.$nextTick(() => {
  195. this.list = [];
  196. this.mescroll.resetUpScroll();
  197. })
  198. },
  199. /* 列表数据 */
  200. upCallback(page) {
  201. let methods = this.category ? getOperatorList : getFlowLaunchList;
  202. let query = {
  203. currentPage: page.num,
  204. pageSize: page.size,
  205. keyword: this.keyword,
  206. category: this.tabsList[this.current].category,
  207. status: this.status
  208. }
  209. methods(query, {
  210. load: page.num == 1
  211. }).then(res => {
  212. this.mescroll.endSuccess(res.data.list.length);
  213. if (page.num == 1) this.list = [];
  214. let flowStatus;
  215. const list = res.data.list.map(o => ({
  216. 'flowStatus': this.getFlowStatus(o.status),
  217. 'opType': this.setOpType(o.status),
  218. 'swipeAction': this.swipeAction(o.status),
  219. ...o
  220. }))
  221. this.list = this.list.concat(list);
  222. }).catch(() => {
  223. this.mescroll.endErr();
  224. })
  225. },
  226. swipeAction(status) {
  227. let swipeAction = true
  228. if (this.tabsList[this.current].key === 3 && !this.category && (status == '0' || status == '9'))
  229. swipeAction = false
  230. return swipeAction
  231. },
  232. /* 设置opType */
  233. setOpType(status) {
  234. if (this.tabsList[this.current].key == 3) return status == '0' || status == '9' || status == '8' ? '-1' : 0
  235. if (this.tabsList[this.current].key == 0) return 1
  236. if (this.tabsList[this.current].key == 1) return 2
  237. if (this.tabsList[this.current].key == 2) return 3
  238. if (this.tabsList[this.current].key == 4) return 4
  239. if (this.tabsList[this.current].key == 5) return 5
  240. }
  241. }
  242. }