iam-todo-tabs.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <a-tabs ref="tabs" v-model="type" :class="[$style.todotabs, 'sd-has-table']">
  3. <template>
  4. <span slot="tabBarExtraContent" :class="$style.morebtn">
  5. <a-popover placement="bottom">
  6. <template v-slot:content>
  7. <a-button type="text" @click="viewByFlow('', type)">所有流程</a-button><br />
  8. <div v-for="tf in todolistFlow" :key="tf.flowId">
  9. <a-button type="text" @click="viewByFlow(tf.flowId, type)"
  10. >{{ tf.flowname }}({{ tf.amount }})</a-button
  11. >
  12. </div>
  13. </template>
  14. <template v-slot:title>
  15. <span>流程分组</span>
  16. </template>
  17. <a-button v-show="type === 'todo' || type === 'processed'" type="text">
  18. <a-icon type="sd-audit-advancesearch" theme="filled" />
  19. </a-button>
  20. </a-popover>
  21. </span>
  22. &nbsp;
  23. <a-icon slot="tabBarExtraContent" :class="$style.syncbtn" type="sync" @click="refresh" />
  24. <span slot="tabBarExtraContent" :class="$style.morebtn" @click="mored(type)">查看更多 ></span>
  25. </template>
  26. <a-tab-pane key="todo" :class="$style.panel">
  27. <span slot="tab">
  28. 待办<span :class="$style.todonums">({{ userInfo.todoNumbers }})</span></span
  29. >
  30. <iam-todo-list-card
  31. :items="todoData"
  32. typelist="todo"
  33. @golistUrl="awaitHandleUrl"
  34. ></iam-todo-list-card>
  35. </a-tab-pane>
  36. <a-tab-pane key="inform" :class="$style.panel">
  37. <span slot="tab">
  38. 待阅<span :class="$style.todonums">({{ userInfo.toReadNumbers }})</span></span
  39. >
  40. <iam-todo-list-card
  41. :items="informData"
  42. typelist="inform"
  43. @golistUrl="awaitHandleUrl"
  44. ></iam-todo-list-card>
  45. </a-tab-pane>
  46. <a-tab-pane key="processed" tab="已办" :class="$style.panel">
  47. <!-- <iam-todo-list-card
  48. :items="processedData"
  49. typelist="processed"
  50. @golistUrl="awaitHandleUrl"
  51. ></iam-todo-list-card> -->
  52. <todo-list ref="processed" list-type="processed" />
  53. </a-tab-pane>
  54. <a-tab-pane key="replied-inform" tab="已阅" :class="$style.panel">
  55. <!-- <iam-todo-list-card
  56. :items="repliedData"
  57. typelist="replied-inform"
  58. @golistUrl="awaitHandleUrl"
  59. ></iam-todo-list-card> -->
  60. <todo-list ref="replied-inform" list-type="replied-inform" />
  61. </a-tab-pane>
  62. </a-tabs>
  63. </template>
  64. <script>
  65. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  66. import TodoListService from '@/todo/todo-list-service'
  67. import { getUserInfo } from '@/common/store-mixin'
  68. import loginService from '@/login/login-service'
  69. import list from '@/todo/sd-todo-list'
  70. import components from './_import-components/iam-todo-tabs-import'
  71. import listCard from './todo/iam-todo-list-card.vue'
  72. import axios from '@/common/services/axios-instance'
  73. export default {
  74. name: 'IamTodoTabs',
  75. components: {
  76. ...components,
  77. 'iam-todo-list-card': listCard,
  78. 'todo-list': list,
  79. },
  80. mixins: [],
  81. data() {
  82. return {
  83. type: 'todo',
  84. todoData: [], // 待办数据
  85. processedData: [], // 已办数据
  86. informData: [], // 待阅数据
  87. repliedData: [], // 已阅数据
  88. userInfo: null,
  89. todolistFlow: [],
  90. todolistFilterFlowId: '',
  91. }
  92. },
  93. created() {
  94. // loginService.getUserInfo()
  95. this.userInfo = getUserInfo()
  96. this.getHandleListFn('todo') // 待办
  97. this.getHandleListFn('processed') // 已办
  98. this.getHandleListFn('inform') // 待阅
  99. this.getHandleListFn('replied-inform') // 已阅
  100. this.getTodoListFlowInfo('todo')
  101. },
  102. methods: {
  103. viewByFlow(flowId, type) {
  104. if (flowId) {
  105. this.todolistFilterFlowId = flowId
  106. } else {
  107. this.todolistFilterFlowId = ''
  108. }
  109. this.getHandleListFn(type)
  110. },
  111. getTodoListFlowInfo(type) {
  112. if (type === 'todo') {
  113. axios({
  114. url: 'api/xcoa-mobile/v1/statisticsTodolistGroupbyFlow',
  115. method: 'get',
  116. }).then((res) => {
  117. if (res.data) {
  118. this.todolistFlow = res.data
  119. console.log(res.data)
  120. }
  121. })
  122. }
  123. },
  124. mored(type) {
  125. if (type === 'todo' || type === 'processed') {
  126. this.$router.push(`/sd-frame/sd-mytodolist?type=${type}`)
  127. } else if (type === 'inform' || type === 'replied-inform') {
  128. this.$router.push(`/sd-frame/sd-mytoreadlist?type=${type}`)
  129. }
  130. },
  131. // 刷新工作台列表数据
  132. refresh() {
  133. this.getHandleListFn(this.type)
  134. },
  135. // 获取列表数据
  136. getHandleListFn(listType) {
  137. let expressions
  138. if (listType === 'todo' || listType === 'processed') {
  139. if (this.todolistFilterFlowId) {
  140. expressions = [
  141. {
  142. dataType: 'str',
  143. name: 'flowId',
  144. op: 'like',
  145. stringValue: this.todolistFilterFlowId + '%',
  146. },
  147. ]
  148. } else {
  149. expressions = []
  150. }
  151. } else {
  152. expressions = [
  153. {
  154. dataType: 'str',
  155. name: 'status',
  156. op: 'ne',
  157. stringValue: '2',
  158. },
  159. ]
  160. }
  161. const params = {
  162. columns: 'title',
  163. expressions: expressions,
  164. orderBy: 'sentDate desc',
  165. creatorDeptLevel: 'DEPARTMENT',
  166. }
  167. if (listType === 'processed') {
  168. params.orderBy = 'processDate desc'
  169. }
  170. TodoListService.getList({ current: 1, pageSize: 10, listType: listType, ...params }).then(
  171. (res) => {
  172. // this.updateTaskNumber({ total: res.total, type: listType })
  173. this.isskeleton = false
  174. if (listType === 'todo') {
  175. this.todoData = res.datas
  176. if (res.datas) {
  177. this.userInfo.todoNumbers = res.datas.length
  178. } else {
  179. this.userInfo.todoNumbers = 0
  180. }
  181. } else if (listType === 'processed') {
  182. this.processedData = res.datas
  183. } else if (listType === 'inform') {
  184. this.informData = res.datas
  185. if (res.datas) {
  186. this.userInfo.toReadNumbers = res.datas.length
  187. } else {
  188. this.userInfo.toReadNumbers = 0
  189. }
  190. } else if (listType === 'replied-inform') {
  191. this.repliedData = res.datas
  192. }
  193. }
  194. )
  195. },
  196. // 卡片列表详情
  197. awaitHandleUrl(data, type) {
  198. let url = TodoListService.makePath(data, type)
  199. url = `/sd-webflow/${url}`
  200. const p = TodoListService.openTaskItem(data, type)
  201. p.then((refreshFlag) => {
  202. if (refreshFlag) {
  203. // 处理后刷新对应列表
  204. // this.getHandleListFn(type) // todo 待办事项 inform 待阅文件
  205. this.getHandleListFn('todo') // 待办
  206. this.getHandleListFn('processed') // 已办
  207. this.getHandleListFn('inform') // 待阅
  208. this.getHandleListFn('replied-inform') // 已阅
  209. }
  210. })
  211. },
  212. },
  213. }
  214. </script>
  215. <style module lang="scss">
  216. @use '@/common/design' as *;
  217. $iconfont: 20px;
  218. .todotabs {
  219. :global(.ant-table-placeholder) {
  220. padding: 31px 16px;
  221. }
  222. :global(.ant-tabs-extra-content) {
  223. position: relative;
  224. z-index: 1;
  225. }
  226. :global(.ant-tabs-bar) {
  227. border-bottom: none;
  228. }
  229. :global(.ant-tabs-ink-bar-animated) {
  230. height: 5px;
  231. border-radius: 13px;
  232. }
  233. :global(.ant-tabs-nav) {
  234. height: 45px;
  235. }
  236. :global(.ant-tabs-tab-active) {
  237. font-weight: 600;
  238. color: #000;
  239. }
  240. :global(.ant-tabs-tab:hover) {
  241. color: #000;
  242. }
  243. }
  244. .syncbtn {
  245. margin-right: 10px;
  246. font-size: 14px;
  247. cursor: pointer;
  248. }
  249. .morebtn {
  250. // font-size: $iconfont;
  251. font-size: 14px;
  252. cursor: pointer;
  253. }
  254. .todonums {
  255. font-size: 12px;
  256. color: #959595;
  257. }
  258. </style>