supervise.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-16 14:35:18
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-16 17:07:46
  6. * @Description: file content
  7. * @FilePath: \oms\pages\schedule\components\supervise.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="showDesc(v)">
  28. <u-row>
  29. <u-col span="12">
  30. <view class="header">
  31. <u-row>
  32. <u-col span="12">
  33. <view class="flex_l">
  34. <image class="todo-img" src="../../../static/images/todo-img.png" mode="scaleToFill" />
  35. <text class="tit-txt flex_1">
  36. {{ v.taskTitle }}
  37. </text>
  38. <view class="do-status" :class="'status' + v.taskStatus">{{ setTaskStatus(v.taskStatus) }}</view>
  39. </view>
  40. </u-col>
  41. </u-row>
  42. <view class="content flex">
  43. <text class="content-txt text-ellipsis">
  44. {{ v.taskDesc }}
  45. </text>
  46. </view>
  47. <view class="content-footer flex_l">
  48. <text class="date mr10">
  49. {{ parseTime(v.taskStartDate, '{m}-{d} {h}:{i}') }}
  50. </text>
  51. <text class="date mr10">-</text>
  52. <text class="date">{{ parseTime(v.taskEndDate, '{m}-{d} {h}:{i}') }}</text>
  53. </view>
  54. </view>
  55. </u-col>
  56. </u-row>
  57. </view>
  58. <u-loadmore :status="loadStatus" />
  59. </scroll-view>
  60. </view>
  61. <u-modal :show="showModal" :content="content" @confirm="showModal = false"></u-modal>
  62. </view>
  63. </template>
  64. <script>
  65. import taskApi from '../../../api/task'
  66. import to from 'await-to-js'
  67. export default {
  68. name: 'omsTodo',
  69. data() {
  70. return {
  71. curTabIndex: 1, //tabs状态
  72. loadStatus: '', //加载状态
  73. list: [
  74. {
  75. name: '我的待办',
  76. status: 1,
  77. },
  78. {
  79. name: '我发起的',
  80. status: 2,
  81. },
  82. {
  83. name: '我处理的',
  84. status: 3,
  85. },
  86. ],
  87. pageNum: 0,
  88. pageSize: 10,
  89. taskList: [], //客户列表
  90. taskTotal: 0, //列表元素数量
  91. showModal: false,
  92. content: '', //modal内容
  93. }
  94. },
  95. mounted() {
  96. this.getSuperviseData()
  97. },
  98. methods: {
  99. // 上拉滚动
  100. lower() {
  101. if (this.taskList.length < this.taskTotal && this.loadStatus != 'loading') {
  102. this.$u.throttle(this.getSuperviseData(), 2000, false)
  103. }
  104. },
  105. showDesc(v) {
  106. console.log(v.taskDesc)
  107. if (v.taskDesc) {
  108. this.showModal = true
  109. this.content = v.taskDesc
  110. }
  111. },
  112. searchList() {
  113. this.pageNum = 0
  114. this.getSuperviseData(true)
  115. },
  116. async getSuperviseData(reset) {
  117. this.loadStatus = 'loading'
  118. this.pageNum++
  119. let params = {
  120. operateType: '' + this.curTabIndex,
  121. pageNum: this.pageNum,
  122. pageSize: this.pageSize,
  123. }
  124. const [err, res] = await to(taskApi.getList(params))
  125. if (err) {
  126. this.loadStatus = 'nomore'
  127. return
  128. }
  129. if (res && res.code == 200) {
  130. if (reset) {
  131. this.taskList = res.data.list || []
  132. } else {
  133. this.taskList = [...this.taskList, ...(res.data.list || [])]
  134. }
  135. this.taskTotal = res.data.total
  136. this.loadStatus = this.taskList.length == this.taskTotal ? 'nomore' : 'loadmore'
  137. console.log(this.loadStatus)
  138. } else {
  139. this.loadStatus = 'nomore'
  140. }
  141. },
  142. // 改变tab
  143. changeTabs(data) {
  144. console.log(data)
  145. this.curTabIndex = data.status
  146. this.searchList(true)
  147. },
  148. setTaskStatus(status) {
  149. let statusObj = {
  150. 10: '已发起',
  151. 20: '进行中',
  152. 30: '已完成',
  153. }
  154. return statusObj[status]
  155. },
  156. },
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .supervise-main {
  161. height: 100%;
  162. .data-scroll-wrap {
  163. height: calc(100vh - 366rpx);
  164. padding: 30rpx 0;
  165. .data-list {
  166. width: 100%;
  167. height: 100%;
  168. background: #ffffff;
  169. overflow: auto;
  170. .todo-item {
  171. padding: 12rpx 40rpx 12rpx 46rpx;
  172. background: #f2f3f5;
  173. border-radius: 15rpx;
  174. margin-bottom: 32rpx;
  175. .tit-txt {
  176. font-size: 28rpx;
  177. font-weight: bold;
  178. color: #323232;
  179. }
  180. .content-txt {
  181. font-size: 28rpx;
  182. color: #646464;
  183. }
  184. .user-txt {
  185. font-size: 20rpx;
  186. color: #646464;
  187. }
  188. .header {
  189. .todo-img {
  190. flex: 0 0 24rpx;
  191. height: 24rpx;
  192. margin-right: 12rpx;
  193. }
  194. .do-status {
  195. width: 70rpx;
  196. height: 30rpx;
  197. border-radius: 0rpx 15rpx 0rpx 0rpx;
  198. text-align: center;
  199. line-height: 30rpx;
  200. font-size: 18rpx;
  201. }
  202. }
  203. .content {
  204. padding: 12rpx 0 12rpx 40rpx;
  205. font-size: 28rpx;
  206. color: #646464;
  207. }
  208. .content-footer {
  209. padding: 0 0 12rpx 40rpx;
  210. .date {
  211. font-size: 24rpx;
  212. color: #969696;
  213. }
  214. .user-img {
  215. width: 46rpx;
  216. height: 46rpx;
  217. border-radius: 50%;
  218. margin-right: 15rpx;
  219. }
  220. }
  221. }
  222. .status10 {
  223. color: #4096fb;
  224. background: rgba(64, 150, 251, 0.2);
  225. }
  226. .status20 {
  227. background: rgba(255, 184, 60, 0.2);
  228. color: #ffb83c;
  229. }
  230. .status30 {
  231. color: #fe6936;
  232. background: rgba(254, 105, 54, 0.2);
  233. }
  234. }
  235. }
  236. .mr10 {
  237. margin-right: 10rpx;
  238. }
  239. }
  240. </style>