index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="container uni-container">
  3. <view class="uni-padding-wrap uni-common-mt">
  4. <uni-segmented-control :current="current" :values="items" style-type="text" active-color="rgb(25, 146, 148)"
  5. @clickItem="onClickItem" />
  6. </view>
  7. <view class="content">
  8. <view v-if="current === 0">
  9. <u-list @scrolltolower="scrolltolower">
  10. <u-list-item v-for="(item, index) in tableData" :key="index" @click.native="onClick(item)" link>
  11. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  12. <uni-col :span="24" class="text-xl font-weight-700">{{item.name}}</uni-col>
  13. </uni-row>
  14. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  15. <uni-col :span="24" class="text-cut text-grey1">
  16. 任务介绍:{{item.introduction}}</uni-col>
  17. </uni-row>
  18. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  19. <uni-col :span="24" class="text-cut text-grey1">发布单位:{{item.unit}}</uni-col>
  20. </uni-row>
  21. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  22. <uni-col :span="18" class="text-cut text-grey1">截止时间:{{item.cutofftime}}</uni-col>
  23. <uni-col :span="6" class="justify-end flex ">
  24. <u-button size="small" :color="item.status==='0'||item.status==='3'?'red':item.status==='1'?'green':'blue'" style="width: 160rpx;">{{statusListTran(item.status)}}</u-button>
  25. </uni-col>
  26. </uni-row>
  27. <u-line></u-line>
  28. </u-list-item>
  29. </u-list>
  30. </view>
  31. <view v-if="current === 1">
  32. <u-list @scrolltolower="scrolltolower">
  33. <u-list-item v-for="(item, index) in tableData" :key="index" @click.native="onClick(item)" link>
  34. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  35. <uni-col :span="24" class="text-xl font-weight-700">任务管理名称</uni-col>
  36. </uni-row>
  37. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  38. <uni-col :span="24" class="text-cut text-grey1">
  39. 任务介绍:好烦VN额覅额我去彷佛哦【鹏举了看到女方的妇女的妇女了肯定是离开了分开了圣诞福利MV查询VMvxvm</uni-col>
  40. </uni-row>
  41. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  42. <uni-col :span="24" class="text-cut text-grey1">发布单位:消防大队</uni-col>
  43. </uni-row>
  44. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  45. <uni-col :span="18" class="text-cut text-grey1">截止时间:2022/11/20</uni-col>
  46. <uni-col :span="6" class="justify-end flex ">
  47. <u-button size="small" type="error" style="width: 160rpx;">未完成</u-button>
  48. </uni-col>
  49. </uni-row>
  50. <u-line></u-line>
  51. </u-list-item>
  52. </u-list>
  53. </view>
  54. <view v-if="current === 2">
  55. <u-list @scrolltolower="scrolltolower">
  56. <u-list-item v-for="(item, index) in tableData" :key="index" @click.native="onClick(item)" link>
  57. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  58. <uni-col :span="24" class="text-xl font-weight-700">任务管理名称</uni-col>
  59. </uni-row>
  60. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  61. <uni-col :span="24" class="text-cut text-grey1">
  62. 任务介绍:好烦VN额覅额我去彷佛哦【鹏举了看到女方的妇女的妇女了肯定是离开了分开了圣诞福利MV查询VMvxvm</uni-col>
  63. </uni-row>
  64. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  65. <uni-col :span="24" class="text-cut text-grey1">发布单位:消防大队</uni-col>
  66. </uni-row>
  67. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  68. <uni-col :span="18" class="text-cut text-grey1">截止时间:2022/11/20</uni-col>
  69. <uni-col :span="6" class="justify-end flex ">
  70. <u-button size="small" type="primary" style="width: 160rpx;">审核中</u-button>
  71. </uni-col>
  72. </uni-row>
  73. <u-line></u-line>
  74. </u-list-item>
  75. </u-list>
  76. </view>
  77. <view v-if="current === 3">
  78. <u-list @scrolltolower="scrolltolower">
  79. <u-list-item v-for="(item, index) in tableData" :key="index" @click.native="onClick(item)" link>
  80. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  81. <uni-col :span="24" class="text-xl font-weight-700">任务管理名称</uni-col>
  82. </uni-row>
  83. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  84. <uni-col :span="24" class="text-cut text-grey1">
  85. 任务介绍:好烦VN额覅额我去彷佛哦【鹏举了看到女方的妇女的妇女了肯定是离开了分开了圣诞福利MV查询VMvxvm</uni-col>
  86. </uni-row>
  87. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  88. <uni-col :span="24" class="text-cut text-grey1">发布单位:消防大队</uni-col>
  89. </uni-row>
  90. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  91. <uni-col :span="18" class="text-cut text-grey1">截止时间:2022/11/20</uni-col>
  92. <uni-col :span="6" class="justify-end flex ">
  93. <u-button size="small" type="success" style="width: 160rpx;">已完成</u-button>
  94. </uni-col>
  95. </uni-row>
  96. <u-line></u-line>
  97. </u-list-item>
  98. </u-list>
  99. <!-- <view class=" ">
  100. <uni-card v-for="(item, index) in tableData" :key="index" title="已完成任务清单名称" :sub-title="item.code"
  101. extra="去完成" @click="onClick(item)">
  102. <view class=" flex flex-direction">
  103. <text class="text-cut">任务介绍:{{item.name}}</text>
  104. <text class="text-cut">任务数量:{{item.dataScope}}</text>
  105. <text class="text-cut">截止日期:{{item.createTime}}</text>
  106. </view>
  107. </uni-card>
  108. </view> -->
  109. </view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. let that = null;
  115. import {
  116. getTask
  117. } from "@/api/task";
  118. import { getUserId} from '@/utils/auth' //获取UserId
  119. export default {
  120. data() {
  121. return {
  122. current: 0,
  123. items: ['全部', '未完成', '审核中', '已完成'],
  124. // 数据
  125. tableData: [],
  126. // 每页数据量
  127. pageSize: 20,
  128. // 当前页
  129. pageNo: 1,
  130. // 数据总量
  131. total: 0,
  132. // tableData数据加载中
  133. loading: false,
  134. statusList:{
  135. 0: "未完成" ,
  136. 1: "已完成" ,
  137. 2: "审核中",
  138. 3: "审核未通过"
  139. },
  140. }
  141. },
  142. // 在 vue页面,向起始页通过事件传递数据
  143. onLoad: function(option) {
  144. this.getData(1)
  145. },
  146. methods: {
  147. // =================数据转换==================
  148. statusListTran(val){ //status状态转换
  149. return this.statusList[val]
  150. },
  151. // ================================
  152. // tab头部点击
  153. onClickItem(e) {
  154. if (this.current !== e.currentIndex) {
  155. this.current = e.currentIndex
  156. }
  157. },
  158. // 获取数据
  159. getData(pageNo, value = '') {
  160. this.loading = true
  161. this.pageNo = pageNo
  162. getTask({
  163. pageNo: this.pageNo,
  164. pageSize: this.pageSize,
  165. userId:2,
  166. // 'tenant-id':'',
  167. // status:'1',
  168. }).then(response => {
  169. // 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
  170. this.tableData = [...this.tableData, ...response.data.list]
  171. // this.tableData = response.data.list;
  172. this.total = response.data.total;
  173. this.loading = false;
  174. });
  175. },
  176. onClick(val) {
  177. uni.navigateTo({
  178. url: '/pages/fire/check_tasks/tasks_details/tasks_details?id='+val.id,
  179. // events: {
  180. // // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  181. // acceptDataFromOpenedPage: function(val) {
  182. // console.log(val)
  183. // },
  184. // },
  185. // success: function(res) {
  186. // // 通过eventChannel向被打开页面传送数据
  187. // res.eventChannel.emit('acceptDataFromOpenerPage', val)
  188. // }
  189. })
  190. },
  191. // 触底的事件
  192. scrolltolower() {
  193. // 判断是否还有下一页数据
  194. if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  195. title: `数据加载完毕`
  196. })
  197. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  198. if (this.loading) return
  199. this.pageNo += 1
  200. this.getData(this.pageNo)
  201. },
  202. // 触底的事件
  203. // onReachBottom() {
  204. // // 判断是否还有下一页数据
  205. // if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  206. // title: `数据加载完毕`
  207. // })
  208. // // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  209. // if (this.loading) return
  210. // this.pageNo += 1
  211. // this.getData(this.pageNo)
  212. // }
  213. }
  214. }
  215. </script>
  216. <style>
  217. </style>