index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view>
  3. <view class="u-demo-block">
  4. <view>
  5. <view class="taskType uni-list-cell taskType-new" @click="isNewTaskShow">
  6. <view class="uni-list-cell-left">
  7. 新任务
  8. </view>
  9. <view>
  10. <u-icon v-if="newTaskShow" name="arrow-down"></u-icon>
  11. <u-icon v-if="!newTaskShow" name="arrow-right"></u-icon>
  12. </view>
  13. </view>
  14. <view v-if="newTaskShow" v-for="item in data" style="padding: 0 10px;">
  15. <view v-if="item.taskStatus === 1"
  16. style="border-radius: 10px;padding: 15px; margin: 5px;background-color: #ffffff;"
  17. @click="toDetails(item.yqTaskId)">
  18. <view v-if="item.isRead === 0" style="position: absolute;right: 10px;">
  19. <view>
  20. <u-tag type="error" text="新任务"> </u-tag>
  21. </view>
  22. </view>
  23. <u-row style="margin-bottom: 5px;">
  24. <u-col>
  25. <u-text size="18" :text="item.taskNo+':'+item.taskTitle" bold></u-text>
  26. </u-col>
  27. </u-row>
  28. <u-row>
  29. <u-col span="2">
  30. <u-text text="地点:"></u-text>
  31. </u-col>
  32. <u-col span="6">
  33. <u-text :text="item.taskAddress"></u-text>
  34. </u-col>
  35. </u-row>
  36. <u-row>
  37. <u-col span="2">
  38. <u-text text="开始:"></u-text>
  39. </u-col>
  40. <u-col span="6">
  41. <u-text :text="item.planStartTime"></u-text>
  42. </u-col>
  43. </u-row>
  44. <u-row>
  45. <u-col span="2">
  46. <u-text text="结束:"></u-text>
  47. </u-col>
  48. <u-col span="7">
  49. <u-text :text="item.planEndTime"></u-text>
  50. </u-col>
  51. <u-tag plain plainFill v-if="item.taskStatus == 5" text="进行中"></u-tag>
  52. <u-tag plain plainFill v-if="item.taskStatus == 1" text="未开始"></u-tag>
  53. <u-tag type="success" plain plainFill v-if="item.taskStatus == 2" text="已结束"></u-tag>
  54. <u-tag type="warning" plain plainFill v-if="item.taskStatus==3" text="暂停"></u-tag>
  55. <u-tag type="error" plain plainFill v-if="item.taskStatus == 4" text="异常"></u-tag>
  56. </u-row>
  57. </view>
  58. </view>
  59. </view>
  60. <view>
  61. <view class="taskType uni-list-cell taskType-beBing" @click="isBeBeingTaskShowTaskShow">
  62. <view class="uni-list-cell-left">
  63. 进行中
  64. </view>
  65. <view>
  66. <u-icon v-if="beBeingTaskShow" name="arrow-down"></u-icon>
  67. <u-icon v-if="!beBeingTaskShow" name="arrow-right"></u-icon>
  68. </view>
  69. </view>
  70. <view v-if="beBeingTaskShow" v-for="item in data" style="padding: 0 10px;">
  71. <view v-if="item.taskStatus === 5"
  72. style="border-radius: 10px;padding: 15px; margin: 5px;background-color: #ffffff;"
  73. @click="toDetails(item.yqTaskId)">
  74. <u-row style="margin-bottom: 5px;">
  75. <u-col>
  76. <u-text size="18" :text="item.taskNo+':'+item.taskTitle" bold></u-text>
  77. </u-col>
  78. </u-row>
  79. <u-row>
  80. <u-col span="2">
  81. <u-text text="地点:"></u-text>
  82. </u-col>
  83. <u-col span="6">
  84. <u-text :text="item.taskAddress"></u-text>
  85. </u-col>
  86. </u-row>
  87. <u-row>
  88. <u-col span="2">
  89. <u-text text="开始:"></u-text>
  90. </u-col>
  91. <u-col span="6">
  92. <u-text :text="item.planStartTime"></u-text>
  93. </u-col>
  94. </u-row>
  95. <u-row>
  96. <u-col span="2">
  97. <u-text text="结束:"></u-text>
  98. </u-col>
  99. <u-col span="7">
  100. <u-text :text="item.planEndTime"></u-text>
  101. </u-col>
  102. <u-tag plain plainFill v-if="item.taskStatus == 5" text="进行中"></u-tag>
  103. <u-tag plain plainFill v-if="item.taskStatus == 1" text="未开始"></u-tag>
  104. <u-tag type="success" plain plainFill v-if="item.taskStatus == 2" text="已结束"></u-tag>
  105. <u-tag type="warning" plain plainFill v-if="item.taskStatus==3" text="暂停"></u-tag>
  106. <u-tag type="error" plain plainFill v-if="item.taskStatus == 4" text="异常"></u-tag>
  107. </u-row>
  108. </view>
  109. </view>
  110. </view>
  111. <view>
  112. <view class="taskType uni-list-cell taskType-end" @click="isEndTaskShowTaskShow">
  113. <view class="uni-list-cell-left">
  114. 已结束
  115. </view>
  116. <view>
  117. <u-icon v-if="endTaskShow" name="arrow-down"></u-icon>
  118. <u-icon v-if="!endTaskShow" name="arrow-right"></u-icon>
  119. </view>
  120. </view>
  121. <view v-if="endTaskShow" v-for="item in data" style="padding: 0 10px;">
  122. <view v-if="item.taskStatus === 2"
  123. style="border-radius: 10px;padding: 15px; margin: 5px;background-color: #ffffff;"
  124. @click="toDetails(item.yqTaskId)">
  125. <u-row style="margin-bottom: 5px;">
  126. <u-col>
  127. <u-text size="18" :text="item.taskNo+':'+item.taskTitle" bold></u-text>
  128. </u-col>
  129. </u-row>
  130. <u-row>
  131. <u-col span="2">
  132. <u-text text="地点:"></u-text>
  133. </u-col>
  134. <u-col span="6">
  135. <u-text :text="item.taskAddress"></u-text>
  136. </u-col>
  137. </u-row>
  138. <u-row>
  139. <u-col span="2">
  140. <u-text text="开始:"></u-text>
  141. </u-col>
  142. <u-col span="6">
  143. <u-text :text="item.planStartTime"></u-text>
  144. </u-col>
  145. </u-row>
  146. <u-row>
  147. <u-col span="2">
  148. <u-text text="结束:"></u-text>
  149. </u-col>
  150. <u-col span="7">
  151. <u-text :text="item.planEndTime"></u-text>
  152. </u-col>
  153. <u-tag plain plainFill v-if="item.taskStatus == 5" text="进行中"></u-tag>
  154. <u-tag plain plainFill v-if="item.taskStatus == 1" text="未开始"></u-tag>
  155. <u-tag type="success" plain plainFill v-if="item.taskStatus == 2" text="已结束"></u-tag>
  156. <u-tag type="warning" plain plainFill v-if="item.taskStatus==3" text="暂停"></u-tag>
  157. <u-tag type="error" plain plainFill v-if="item.taskStatus == 4" text="异常"></u-tag>
  158. </u-row>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. export default {
  167. data() {
  168. return {
  169. data: [],
  170. newTaskShow: false,
  171. beBeingTaskShow: false,
  172. endTaskShow: false,
  173. }
  174. },
  175. onShow() {
  176. this.getNotRead()
  177. },
  178. onHide() {
  179. },
  180. methods: {
  181. isNewTaskShow() {
  182. if (this.newTaskShow) {
  183. this.newTaskShow = false
  184. } else {
  185. this.newTaskShow = true
  186. }
  187. },
  188. isBeBeingTaskShowTaskShow() {
  189. if (this.beBeingTaskShow) {
  190. this.beBeingTaskShow = false
  191. } else {
  192. this.beBeingTaskShow = true
  193. }
  194. },
  195. isEndTaskShowTaskShow() {
  196. if (this.endTaskShow) {
  197. this.endTaskShow = false
  198. } else {
  199. this.endTaskShow = true
  200. }
  201. },
  202. async getNotRead() {
  203. const {
  204. data: res
  205. } = await this.$httpRequest({
  206. url: '/api/yq/readTask/?userNo=' + uni.getStorageSync("setUserName") +
  207. "&orgNo=" + uni.getStorageSync("orgInfo").organizationCode,
  208. method: 'get',
  209. })
  210. if (res.code == 200) {
  211. const data = res.data
  212. console.log(data)
  213. const count = data.count
  214. if (0 == count) {
  215. uni.removeTabBarBadge({
  216. index: 1
  217. })
  218. } else {
  219. uni.setTabBarBadge({
  220. index: 1,
  221. text: count + ""
  222. })
  223. }
  224. this.data = data.data
  225. } else {
  226. uni.showToast({
  227. icon: 'none',
  228. title: res.msg
  229. })
  230. }
  231. },
  232. toDetails(taskId) {
  233. uni.setStorageSync("taskId", taskId)
  234. this.$goto('details')
  235. }
  236. }
  237. }
  238. </script>
  239. <style>
  240. page {
  241. background-color: #eeeeee;
  242. }
  243. .taskType {
  244. padding: 10px;
  245. font-size: 18px;
  246. border-bottom: 1px solid #dedede;
  247. border-top: 1px solid #dedede;
  248. background-color: #ffffff;
  249. }
  250. .taskType-new {
  251. background-color: #ffffff;
  252. }
  253. .taskType-beBing {
  254. background-color: #ffffff;
  255. }
  256. .taskType-end {
  257. background-color: #ffffff;
  258. }
  259. </style>