index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-02-22 11:11:21
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-03-06 15:47:47
  6. * @Description: file content
  7. * @FilePath: \oms\pages\schedule\supervise\index.vue
  8. -->
  9. <template>
  10. <view class="supervise-main">
  11. <u-tabs
  12. :list="list"
  13. @change="changeTabs"
  14. :current="curTabIndex - 1"
  15. :scrollable="false"
  16. :activeStyle="{
  17. color: '#323232',
  18. fontWeight: 'bold',
  19. }"
  20. :inactiveStyle="{
  21. color: '#969696',
  22. }"></u-tabs>
  23. <!-- 列表 -->
  24. <view class="data-scroll-wrap">
  25. <u-empty mode="list" text="暂无督办数据" v-if="taskList.length == 0"></u-empty>
  26. <scroll-view v-else class="data-list" :scroll-top="scrollTop" :scroll-y="true" @scrolltolower="lower">
  27. <view class="todo-item" v-for="(v, i) in taskList" :key="i" @click="linkToDetail(v)">
  28. <u-row>
  29. <u-col span="12">
  30. <view class="header">
  31. <u-text color="#272C36" bold :text="v.taskTitle"></u-text>
  32. <view class="flex mt20">
  33. <view class="flex_1">
  34. <u-text color="#272C36" size="26rpx" :text="selectDictLabel(taskTypeOption, v.taskType)"></u-text>
  35. </view>
  36. <view>
  37. <u-text color="#AEB3BB" size="26rpx" :text="parseTime(v.taskStartDate, '{y}-{m}-{d}')"></u-text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="content">
  42. <u-row type="flex" customStyle="padding:10rpx 0">
  43. <u-col :span="3"><u-text text="状态" size="26rpx" color="#AEB3BB"></u-text></u-col>
  44. <u-col :span="9">
  45. <u-text
  46. :text="selectDictLabel(taskStatusOption, v.taskStatus)"
  47. size="26rpx"
  48. color="#272C36"></u-text>
  49. </u-col>
  50. </u-row>
  51. <u-row type="flex" customStyle="padding:10rpx 0">
  52. <u-col :span="3"><u-text text="督办来源" size="26rpx" color="#AEB3BB"></u-text></u-col>
  53. <u-col :span="9">
  54. <u-text :text="selectDictLabel(sourceOption, v.source)" size="26rpx" color="#272C36"></u-text>
  55. </u-col>
  56. </u-row>
  57. <u-row type="flex" customStyle="padding:10rpx 0">
  58. <u-col :span="3"><u-text text="是否超期" size="26rpx" color="#AEB3BB"></u-text></u-col>
  59. <u-col :span="9">
  60. <u-text
  61. :text="isNotOverdue(parseTime(v.taskEndDate, '{y}-{m}-{d} 23:59:59')) ? '否' : '是'"
  62. size="26rpx"
  63. color="#272C36"></u-text>
  64. </u-col>
  65. </u-row>
  66. <u-row type="flex" customStyle="padding:10rpx 0">
  67. <u-col :span="3"><u-text text="督办内容" size="26rpx" color="#AEB3BB"></u-text></u-col>
  68. <u-col :span="9"><u-text :text="v.taskDesc" size="26rpx" color="#272C36"></u-text></u-col>
  69. </u-row>
  70. <u-row type="flex" customStyle="padding:10rpx 0">
  71. <u-col :span="3"><u-text text="负责人" size="26rpx" color="#AEB3BB"></u-text></u-col>
  72. <u-col :span="9">
  73. <u-text :text="selectDictLabel(userList, v.mainUserId)" size="26rpx" color="#272C36"></u-text>
  74. </u-col>
  75. </u-row>
  76. <u-row type="flex" customStyle="padding:10rpx 0">
  77. <u-col :span="3"><u-text text="协办人" size="26rpx" color="#AEB3BB"></u-text></u-col>
  78. <u-col :span="9">
  79. <u-text :text="generateOwnerUser(v.ownerUserId)" size="26rpx" color="#272C36"></u-text>
  80. </u-col>
  81. </u-row>
  82. <u-row type="flex" customStyle="padding:10rpx 0">
  83. <u-col :span="3"><u-text text="监办人" size="26rpx" color="#AEB3BB"></u-text></u-col>
  84. <u-col :span="9">
  85. <u-text :text="selectDictLabel(userList, v.watchUserId)" size="26rpx" color="#272C36"></u-text>
  86. </u-col>
  87. </u-row>
  88. <u-row type="flex" customStyle="padding:10rpx 0">
  89. <u-col :span="3"><u-text text="督办人" size="26rpx" color="#AEB3BB"></u-text></u-col>
  90. <u-col :span="9">
  91. <u-text :text="selectDictLabel(userList, v.supervisorUserId)" size="26rpx" color="#272C36"></u-text>
  92. </u-col>
  93. </u-row>
  94. </view>
  95. </u-col>
  96. </u-row>
  97. </view>
  98. <u-loadmore :status="loadStatus" />
  99. </scroll-view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import taskApi from '@/api/task'
  105. import userApi from '@/api/system/user'
  106. import to from 'await-to-js'
  107. export default {
  108. name: 'omsTodo',
  109. data() {
  110. return {
  111. curTabIndex: 1, //tabs状态
  112. loadStatus: '', //加载状态
  113. list: [
  114. {
  115. name: '我的待办',
  116. status: 1,
  117. },
  118. {
  119. name: '我发起的',
  120. status: 2,
  121. },
  122. {
  123. name: '我处理的',
  124. status: 3,
  125. },
  126. ],
  127. pageNum: 0,
  128. pageSize: 10,
  129. taskList: [], //督办列表
  130. taskTotal: 0, //列表元素数量
  131. taskTypeOption: [], //督办类型
  132. sourceOption: [], //来源列表
  133. userList: [], //用户列表
  134. taskStatusOption: [
  135. {
  136. key: '10',
  137. value: '发起',
  138. },
  139. {
  140. key: '20',
  141. value: '进行中',
  142. },
  143. {
  144. key: '30',
  145. value: '流程完成',
  146. },
  147. {
  148. key: '40',
  149. value: '审批拒绝',
  150. },
  151. {
  152. key: '50',
  153. value: '撤销',
  154. },
  155. ], //督办状态
  156. }
  157. },
  158. mounted() {
  159. this.getOptions()
  160. },
  161. methods: {
  162. getOptions() {
  163. Promise.all([this.getDicts('task_type'), this.getDicts('plat_task_source'), userApi.getList()])
  164. .then(([types, source, user]) => {
  165. this.taskTypeOption = types.data.values || []
  166. this.sourceOption = source.data.values || []
  167. this.userList = user.data.list.map((item) => ({ key: '' + item.id, value: item.nickName }))
  168. this.getSuperviseData()
  169. })
  170. .catch((err) => console.log(err))
  171. },
  172. // 判断是否没有超期
  173. isNotOverdue(date) {
  174. return new Date() <= new Date(date)
  175. },
  176. // 协办人
  177. generateOwnerUser(ids = null) {
  178. let nameArr = []
  179. if (ids) {
  180. let idList = ids.split(',')
  181. idList.forEach((item) => {
  182. let findUser = this.userList.find((user) => user.key == item)
  183. if (findUser && findUser.value) nameArr.push(findUser.value)
  184. })
  185. }
  186. return nameArr.join(',')
  187. },
  188. // 上拉滚动
  189. lower() {
  190. if (this.taskList.length < this.taskTotal && this.loadStatus != 'loading') {
  191. this.$u.throttle(this.getSuperviseData(), 2000, false)
  192. }
  193. },
  194. linkToDetail(v) {
  195. uni.navigateTo({
  196. //保留当前页面,跳转到应用内的某个页面
  197. url: '/pages/schedule/supervise/details?id=' + v.id + '&type=' + this.curTabIndex,
  198. })
  199. },
  200. searchList() {
  201. this.pageNum = 0
  202. this.getSuperviseData(true)
  203. },
  204. async getSuperviseData(reset) {
  205. this.loadStatus = 'loading'
  206. this.pageNum++
  207. let params = {
  208. operateType: '' + this.curTabIndex,
  209. pageNum: this.pageNum,
  210. pageSize: this.pageSize,
  211. }
  212. const [err, res] = await to(taskApi.getList(params))
  213. if (err) {
  214. this.loadStatus = 'nomore'
  215. return
  216. }
  217. if (res && res.code == 200) {
  218. if (reset) {
  219. this.taskList = res.data.list || []
  220. } else {
  221. this.taskList = [...this.taskList, ...(res.data.list || [])]
  222. }
  223. this.taskTotal = res.data.total
  224. this.loadStatus = this.taskList.length == this.taskTotal ? 'nomore' : 'loadmore'
  225. } else {
  226. this.loadStatus = 'nomore'
  227. }
  228. },
  229. // 改变tab
  230. changeTabs(data) {
  231. this.curTabIndex = data.status
  232. this.searchList(true)
  233. },
  234. },
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. .supervise-main {
  239. height: 100%;
  240. .data-scroll-wrap {
  241. height: calc(100vh - 366rpx);
  242. padding: 30rpx 0;
  243. .data-list {
  244. width: 100%;
  245. height: 100%;
  246. background: #ffffff;
  247. overflow: auto;
  248. .todo-item {
  249. background: #f6f7fb;
  250. border: 1px solid #ceccca;
  251. border-radius: 20rpx;
  252. margin-bottom: 32rpx;
  253. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  254. .header {
  255. padding: 30rpx 30rpx 15rpx;
  256. border-bottom: 2rpx solid #ceccca;
  257. }
  258. .content {
  259. padding: 15rpx 30rpx 30rpx;
  260. }
  261. }
  262. }
  263. }
  264. .mr10 {
  265. margin-right: 10rpx;
  266. }
  267. .mt20 {
  268. margin-top: 20rpx;
  269. }
  270. }
  271. </style>