MyoaTabs.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div id="MyoaTbas">
  3. <a-tabs default-active-key="1" @change="callback" style="background:white;;padding:8px;">
  4. <a-tab-pane key="1" tab="待办事项" style="margin:10px;">
  5. <div class="dataV">
  6. <dv-scroll-board
  7. class="board"
  8. :config="todoConfig"
  9. style="cursor: pointer;width:100%;height:148px;color:#333;"
  10. @click="todoClick"
  11. />
  12. </div>
  13. </a-tab-pane>
  14. <a-tab-pane key="2" tab="已发事项" force-render>
  15. <div class="dataV">
  16. <dv-scroll-board
  17. class="board"
  18. :config="applyConfig"
  19. style="cursor: pointer;width:100%;height:166px;color:#333;"
  20. @click="applyClick"
  21. />
  22. </div>
  23. </a-tab-pane>
  24. <a-tab-pane key="3" tab="已办事项">
  25. <div class="dataV">
  26. <dv-scroll-board
  27. class="board"
  28. :config="doneConfig"
  29. style="cursor: pointer;width:100%;height:166px;color:#333;"
  30. @click="doneClick"
  31. />
  32. </div>
  33. </a-tab-pane>
  34. </a-tabs>
  35. </div>
  36. </template>
  37. <script>
  38. import { getAction } from '@/api/manage'
  39. export default {
  40. name: 'MyoaTabs',
  41. data () {
  42. return {
  43. // header: ['列1', '列2', '列3'],
  44. todoConfig: {},
  45. applyConfig: {},
  46. doneConfig: {},
  47. todoList: {},
  48. url: {
  49. list: '/actBusiness/listData',
  50. doneList: '/actTask/doneList'
  51. }
  52. }
  53. },
  54. created () {
  55. this.getTodoList()
  56. this.getApplyList()
  57. this.getDoneList()
  58. },
  59. methods: {
  60. // 待办事项
  61. getTodoList () {
  62. this.postFormAction('/actTask/todoList', {}).then(res => {
  63. if (res.success) {
  64. console.log('待办列表-->', res.result)
  65. this.todoList = res.result
  66. let scrollData = [] // 轮播表数据
  67. this.todoList.map(item => {
  68. // 优先级
  69. var priorityCode = ''
  70. if (item.priority == '0') {
  71. priorityCode = '<span style="color:green;">普通</span>'
  72. }
  73. if (item.priority == '1') {
  74. priorityCode = '<span style="color:orange;">重要</span>'
  75. }
  76. if (item.priority == '2') {
  77. priorityCode = '<span style="color:red;">紧急</span>'
  78. }
  79. var list = [item.id, item.name, item.processName,item.applyer, priorityCode, item.createTime]
  80. scrollData.push(list)
  81. })
  82. this.todoConfig = {
  83. oddRowBGC: 'white',
  84. evenRowBGC: 'white',
  85. columnWidth: [150, 190,190, 190, 120, 300],
  86. align: ['center'],
  87. rowNum: 5,
  88. waitTime: 9000,
  89. data: scrollData // 双向绑定(轮播表数据 绑定到配置的 data数据中)
  90. }
  91. }
  92. })
  93. },
  94. // 已发事项
  95. getApplyList () {
  96. getAction(this.url.list, {}).then(res => {
  97. if (res.success) {
  98. console.log('申请列表-->', res.result)
  99. this.applyList = res.result
  100. let scrollData = [] // 轮播表数据
  101. // 结果
  102. this.applyList.map(item => {
  103. var resultCode = ''
  104. if (item.result == '0') {
  105. resultCode = '<span style="color:orange;">未提交</span>'
  106. }
  107. if (item.result == '1') {
  108. resultCode = '<span style="color:#37a2da;">处理中</span>'
  109. }
  110. if (item.result == '2') {
  111. resultCode = '<span style="color:green;">通过</span>'
  112. }
  113. if (item.result == '3') {
  114. resultCode = '<span style="color:red;">驳回</span>'
  115. }
  116. // var list = [item.id, item.title, item.processName, item.description,item.currTaskName, resultCode, item.applyTime]
  117. var list = [item.id, item.processName,item.currTaskName, resultCode, item.applyTime]
  118. scrollData.push(list)
  119. })
  120. this.applyConfig = {
  121. oddRowBGC: 'white',
  122. evenRowBGC: 'white',
  123. // columnWidth: [150, 200, 200, 200, 200, 150, 300],
  124. columnWidth: [150, 200, 200, 120, 300],
  125. align: ['center'],
  126. rowNum: 5,
  127. waitTime: 2000,
  128. data: scrollData
  129. }
  130. }
  131. })
  132. },
  133. // 已办事项
  134. getDoneList () {
  135. getAction(this.url.doneList, {}).then(res => {
  136. if (res.success) {
  137. console.log('已办列表-->', res.result)
  138. this.doneList = res.result
  139. let scrollData = [] // 轮播表数据
  140. this.doneList.map(item => {
  141. var reallyResult = ''
  142. if (item.deleteReason == '审批通过') {
  143. reallyResult = '<span style="color:green">审批通过</span>'
  144. } else if(item.deleteReason == '审批驳回'){
  145. reallyResult = '<span style="color:red">审批驳回</span>'
  146. }else{
  147. reallyResult = item.deleteReason
  148. }
  149. var list = [item.id, item.name, item.processName,item.applyer, reallyResult, item.createTime]
  150. scrollData.push(list)
  151. })
  152. this.doneConfig = {
  153. oddRowBGC: 'white',
  154. evenRowBGC: 'white',
  155. columnWidth: [150, 200, 200, 150, 150, 300],
  156. align: ['center'],
  157. rowNum: 5,
  158. waitTime: 2000,
  159. data: scrollData
  160. }
  161. }
  162. })
  163. },
  164. // 轮播图 点击事件
  165. todoClick (item) {
  166. console.log(item)
  167. this.$router.push('/activiti/todoManage')
  168. },
  169. applyClick (item) {
  170. this.$router.push('/activiti/applyList')
  171. },
  172. doneClick (item) {
  173. this.$router.push('/activiti/doneManage')
  174. },
  175. // 我的待办 tabs
  176. callback (key) {
  177. // console.log(key)
  178. if (key == '1') {
  179. this.getTodoList()
  180. }
  181. if (key == '2') {
  182. this.getApplyList()
  183. }
  184. if (key == '3') {
  185. this.getDoneList()
  186. }
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="less" scoped>
  192. // 单独创建页面写样式 如下
  193. @import '~@assets/less/mytodo.less';
  194. @import '~@assets/less/common.less';
  195. /deep/ .ant-tabs-nav .ant-tabs-tab {
  196. font-size: 16px;
  197. }
  198. /deep/ .ant-tabs-tab-active {
  199. // color: #1890ff !important;
  200. font-size: 16px;
  201. }
  202. </style>