todoList.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <view class="content">
  3. <view class="top-fixed">
  4. <!-- 事项列表 -->
  5. <view class="filter">
  6. <view :class="isShow==false?'time-box':'time-box active'" @tap="openCalendar()">
  7. <view class="title">选择日期</view>
  8. <image :src="isShow==false?'/static/images/company/time_arrow_icon.png':'/static/images/company/time_arrow_blue_icon.png'" class="w24 h24"></image>
  9. </view>
  10. <view class="list-box">
  11. <image src="/static/images/company/list_matters_icon.png" class="w32 h32"></image>
  12. <view class="title">事项列表</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="top-fixed2">
  17. <!-- tab切换 -->
  18. <view class="pub-tab-box">
  19. <view class="tab-inner">
  20. <view v-for="(item,index) in taskType" :key="index"
  21. :class="item.val == showType?'item active':'item'" @click="orderStatusChange(item)">
  22. <view class="text">
  23. {{ item.name }}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <u-popup :show="isShow" mode="top" :round="12" customStyle="top: 110rpx;" @close="close">
  30. <view class="calendar-box">
  31. <pushangyuqi-calendar @onDayClick="onDayClick"></pushangyuqi-calendar>
  32. </view>
  33. </u-popup>
  34. <mescroll-body top="200upx" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  35. <view class="sms-list">
  36. <view v-for="(item,index) in dataList" :key="index" class="item" @click="showDetail(item)">
  37. <view class="justify-between align-center">
  38. <view class="title">{{item.title}}</view>
  39. <view class="state" :style="{'color':item.status==0?'#FF5030':item.status==1?'#FDBD27':'#2CAE5C'}">
  40. {{item.statusText}}</view>
  41. </view>
  42. <view class="personnel">
  43. {{item.assigneeName}}
  44. </view>
  45. </view>
  46. </view>
  47. <view class="h20"></view>
  48. </mescroll-body>
  49. </view>
  50. </template>
  51. <script>
  52. import pushangyuqiCalendar from '../components/pushangyuqi-calendar/pushangyuqi-calendar.vue'
  53. import {
  54. getToDoList
  55. } from '@/api/companyUser.js'
  56. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  57. export default {
  58. mixins: [MescrollMixin],
  59. components:{
  60. pushangyuqiCalendar
  61. },
  62. data() {
  63. return {
  64. taskType: [{
  65. name: "全部",
  66. val: null
  67. },
  68. {
  69. name: "固定任务",
  70. val: 0
  71. },
  72. {
  73. name: "工作计划",
  74. val: 1
  75. },
  76. ],
  77. isShow:false,
  78. showType: null,
  79. mescroll: null,
  80. // 上拉加载的配置
  81. upOption: {
  82. onScroll: true,
  83. use: true, // 是否启用上拉加载; 默认true
  84. page: {
  85. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  86. size: 10 // 每页数据的数量,默认10
  87. },
  88. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  89. empty: {
  90. icon: '/static/images/no_data.png',
  91. tip: '暂无数据'
  92. }
  93. },
  94. dataList: [],
  95. }
  96. },
  97. onLoad(opt) {
  98. if(opt.type!==null){
  99. this.showType=opt.type
  100. }
  101. uni.$on('refreshToDoList', () => {
  102. this.mescroll.resetUpScroll()
  103. })
  104. },
  105. methods: {
  106. //时间筛选
  107. openCalendar(){
  108. this.isShow=!this.isShow
  109. },
  110. close(){
  111. this.isShow=false
  112. },
  113. //日历
  114. onDayClick(data){
  115. this.curDate = data;
  116. this.isShow = false
  117. },
  118. navgetTo(index) {
  119. // uni.navigateTo({
  120. // url: index == 0 ? '/pages_health/addServe' : '/pages_health/addCompetitors'
  121. // })
  122. },
  123. // tab切换
  124. orderStatusChange(item) {
  125. this.showType = item.val
  126. this.mescroll.resetUpScroll()
  127. },
  128. mescrollInit(mescroll) {
  129. this.mescroll = mescroll;
  130. },
  131. /*下拉刷新的回调 */
  132. downCallback(mescroll) {
  133. mescroll.resetUpScroll()
  134. },
  135. upCallback(page) {
  136. //联网加载数据
  137. var that = this;
  138. var data = {
  139. cateId: this.showType,
  140. pageNum: page.num,
  141. pageSize: page.size
  142. };
  143. getToDoList(data).then(res => {
  144. if(res.code==200){
  145. //设置列表数据
  146. if (page.num == 1) {
  147. that.dataList = res.data.list;
  148. } else {
  149. that.dataList = that.dataList.concat(res.data.list);
  150. }
  151. that.mescroll.endBySize(res.data.list.length, res.data.total);
  152. }else{
  153. uni.showToast({
  154. icon:'none',
  155. title: "请求失败",
  156. });
  157. that.dataList = null;
  158. that.mescroll.endErr();
  159. }
  160. });
  161. },
  162. showDetail(item) {
  163. // if (item.orderType == 1) {
  164. uni.navigateTo({
  165. url: '/pages_company/todoDetail?type=edit&id=' + item.id
  166. })
  167. // }
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss">
  173. page{
  174. background-color:#EFF3F7;
  175. background: #EFF3F7;
  176. }
  177. .calendar-box{
  178. padding:0 30rpx;
  179. }
  180. .content {
  181. padding: 20upx;
  182. .top-fixed {
  183. width: 100%;
  184. position: fixed;
  185. top: 0;
  186. left: 0;
  187. z-index:10076;
  188. }
  189. .top-fixed2 {
  190. width: 100%;
  191. position: fixed;
  192. top: 110rpx;
  193. left: 0;
  194. z-index: 10;
  195. }
  196. .filter{
  197. background: #FFFFFF;
  198. padding: 20rpx;
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. .time-box{
  203. display: flex;
  204. align-items: center;
  205. padding:16rpx 48rpx;
  206. background: #F5F7FA;
  207. border-radius: 32rpx 32rpx 32rpx 32rpx;
  208. .title{
  209. font-family: PingFang SC;
  210. font-weight: 400;
  211. font-size: 28rpx;
  212. color: #626468;
  213. text-align: center;
  214. padding-right: 20rpx;
  215. }
  216. &.active{
  217. background: #F0FAFF;
  218. .title{
  219. color:#008FD3
  220. }
  221. }
  222. }
  223. .list-box{
  224. display: flex;
  225. align-items: center;
  226. .title{
  227. font-family: PingFang SC;
  228. font-weight: 400;
  229. font-size: 28rpx;
  230. color: #222426;
  231. text-align: center;
  232. padding-left: 16rpx;
  233. }
  234. }
  235. }
  236. .pub-tab-box {
  237. box-sizing: border-box;
  238. width: 100%;
  239. padding: 0 20upx;
  240. background-color: #EFF3F7;
  241. .tab-inner {
  242. height: 110upx;
  243. line-height: 110upx;
  244. display: flex;
  245. align-items: center;
  246. // justify-content: space-between;
  247. overflow-x: auto;
  248. }
  249. .item {
  250. // flex: 1;
  251. font-size: 28upx;
  252. white-space: nowrap;
  253. line-height: 1;
  254. font-family: PingFang SC;
  255. font-weight: 400;
  256. color: #222426;
  257. margin-right: 16upx;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. background: #FFFFFF;
  262. border-radius: 36rpx 36rpx 36rpx 36rpx;
  263. padding:16rpx 48rpx;
  264. &:last-child {
  265. margin-right: 0;
  266. }
  267. &.active {
  268. font-weight: bold;
  269. color: #fff;
  270. background: linear-gradient(120deg, #31A1FE 0%, #008FD3 100%);
  271. }
  272. .text {
  273. position: relative;
  274. z-index: 1;
  275. }
  276. .tab-bg {
  277. width: 72upx;
  278. height: 28upx;
  279. position: absolute;
  280. top: 17upx;
  281. left: 50%;
  282. transform: translateX(-36upx);
  283. z-index: -1;
  284. }
  285. }
  286. }
  287. .btn-box2 {
  288. z-index: 9999;
  289. width: 100%;
  290. padding: 30upx;
  291. position: fixed;
  292. bottom: 0;
  293. left: 0;
  294. box-sizing: border-box;
  295. // background: #FFFFFF;
  296. .sub-btn {
  297. width: 100%;
  298. height: 88upx;
  299. line-height: 88upx;
  300. text-align: center;
  301. font-size: 30upx;
  302. font-family: PingFang SC;
  303. font-weight: bold;
  304. color: #FFFFFF;
  305. background: #008FD3;
  306. border-radius: 44upx;
  307. display: flex;
  308. align-items: center;
  309. justify-content: center;
  310. image {
  311. margin-right: 16rpx;
  312. }
  313. }
  314. }
  315. .sms-list {
  316. .item {
  317. padding: 30rpx;
  318. background: #FFFFFF;
  319. border-radius: 16rpx 16rpx 16rpx 16rpx;
  320. margin-bottom: 20rpx;
  321. .title {
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. font-size: 32rpx;
  325. color: #222426;
  326. text-align: left;
  327. }
  328. .title {
  329. font-family: PingFang SC;
  330. font-weight: 500;
  331. font-size: 32rpx;
  332. color: #222426;
  333. text-align: left;
  334. }
  335. .state {
  336. font-family: PingFang SC;
  337. font-weight: 400;
  338. font-size: 26rpx;
  339. text-align: right;
  340. }
  341. .personnel {
  342. font-family: PingFang SC;
  343. font-weight: 400;
  344. font-size: 28rpx;
  345. color: #898E91;
  346. text-align: left;
  347. margin-top: 16rpx;
  348. }
  349. }
  350. }
  351. }
  352. </style>