index - 副本.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="content" style="height: 100vh;" @touchstart="start" @touchend="end">
  3. <view class="subsection">
  4. <view class="division">
  5. <u-search placeholder="请输入任务处理人" v-model="name" :showAction="false" @input="search"></u-search>
  6. </view>
  7. <view class="subsection_ul">
  8. <view :class="current==index?'subsection_li subsection_li_act':'subsection_li'" title="" note=""
  9. v-for="(item,index) in list" :key="index" @click="sectionChange(index)">
  10. {{item}}
  11. </view>
  12. </view>
  13. </view>
  14. <u-loading-page loading-text="加载中..." :loading="loading" font-size="16"></u-loading-page>
  15. <view class="taskbox">
  16. <view class="hisbox_hint" v-if="tasklist.length==0">
  17. 暂无数据
  18. </view>
  19. <view class="taskbox_item" v-for="item,index in tasklist" :key="index" @click="totask(item.task_id)">
  20. <view class="taskbox_item_t">
  21. <view class="taskbox_item_t_l">
  22. {{item.task_type}}
  23. </view>
  24. <view class="taskbox_item_t_r">
  25. {{item.start_time}}
  26. </view>
  27. </view>
  28. <view class="taskbox_item_c">
  29. {{item.tesk_msg}}
  30. </view>
  31. <view class="taskbox_item_l">
  32. <view class="taskbox_item_l_l">
  33. <view class="taskbox_item_l_l_l">
  34. 处理人:{{item.operator_user}}
  35. </view>
  36. <view class="taskbox_item_l_l_r" v-if="item.task_status=='未开始'">
  37. {{item.diff_day}}天后开始
  38. </view>
  39. <view class="taskbox_item_l_l_r" v-if="item.task_status=='处理中'">
  40. 剩余{{item.diff_day}}天
  41. </view>
  42. <view class="taskbox_item_l_l_ri" v-if="item.task_status=='未处理'">
  43. 逾期{{item.diff_day}}天
  44. </view>
  45. </view>
  46. <view class="taskbox_item_l_r"
  47. :style="{color:colors(item.task_status),borderColor:colors(item.task_status)}">
  48. {{item.task_status}}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <uni-calendar :insert="false" ref="calendar" :range="true" @confirm="confirm" />
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. Debounce
  59. } from "../../util/anitthro.js"
  60. export default {
  61. data() {
  62. return {
  63. list: ['待处理', '未完成', '已完成'],
  64. current: 0,
  65. tasklist: [],
  66. status: "待处理",
  67. loading: false,
  68. page: 1,
  69. start_time: "",
  70. end_time: "",
  71. keyword: "",
  72. name: "",
  73. startData:{
  74. clientX:0,
  75. clientY:0
  76. }
  77. }
  78. },
  79. onShow() {
  80. this.page = 1
  81. this.tasklist = []
  82. this.gettaskdata()
  83. },
  84. onLoad() {},
  85. onReachBottom() {
  86. this.page++
  87. this.gettaskdata()
  88. },
  89. onPullDownRefresh() {
  90. this.tasklist = []
  91. this.page = 1
  92. this.start_time = ""
  93. this.end_time = ""
  94. this.gettaskdata()
  95. setTimeout(() => {
  96. uni.stopPullDownRefresh()
  97. }, 1000)
  98. },
  99. onNavigationBarButtonTap(e) {
  100. if (this.current == 2) {
  101. this.opencale()
  102. }
  103. },
  104. watch: {
  105. videoData(news, old) {
  106. console.log('触发了2222222222222222222222')
  107. console.log(news)
  108. uni.switchTab({
  109. url: '../response/index'
  110. })
  111. // if (news) {
  112. // }
  113. },
  114. },
  115. computed: {
  116. // 视频消息
  117. videoData() {
  118. return this.$store.state.video
  119. },
  120. },
  121. methods: {
  122. sectionChange(e) {
  123. this.current = e
  124. this.status = this.list[e]
  125. this.tasklist = []
  126. this.name = ""
  127. this.page = 1
  128. let pages = getCurrentPages();
  129. var page = pages[pages.length - 1];
  130. var currentWebview = page.$getAppWebview();
  131. if (e == 2) {
  132. currentWebview.setTitleNViewButtonStyle(0, {
  133. text: "搜索",
  134. });
  135. } else {
  136. currentWebview.setTitleNViewButtonStyle(0, {
  137. text: " ",
  138. });
  139. }
  140. this.gettaskdata()
  141. },
  142. colors(type) {
  143. if (type == '未开始' || type == '未处理') {
  144. return '#ffaa00';
  145. } else if (type == '已完成') {
  146. return '#02C644';
  147. } else if (type == '逾期完成') {
  148. return '#ff0000';
  149. } else if (type == '处理中') {
  150. return '#409EFF';
  151. }
  152. },
  153. async gettaskdata() {
  154. this.loading = true
  155. const res = await this.$myRequest({
  156. url: '/api/api_gateway?method=app.task.task_list',
  157. data: {
  158. page: this.page, // 否 页码, 默认1
  159. page_item: "10", //
  160. status: this.status,
  161. start_time: this
  162. .start_time, // 非必填 开始时间
  163. end_time: this.end_time,
  164. operator_user_name: this.name
  165. }
  166. })
  167. // this.tasklist = res.page_list
  168. for (var i = 0; i < res.page_list.length; i++) {
  169. this.tasklist.push(res.page_list[i])
  170. }
  171. // console.log(res)
  172. this.loading = false
  173. },
  174. totask(id) {
  175. uni.navigateTo({
  176. url: "./harmfultask?id=" + id + "&current=" + this.current
  177. })
  178. },
  179. opencale() {
  180. this.$refs.calendar.open();
  181. },
  182. confirm(e) {
  183. this.start_time = e.range.before
  184. this.end_time = e.range.after
  185. this.tasklist = []
  186. this.page = 1
  187. this.gettaskdata()
  188. },
  189. search() {
  190. Debounce(() => {
  191. this.tasklist = []
  192. this.page = 1
  193. this.gettaskdata()
  194. }, 1000)()
  195. },
  196. start(e) {
  197. // console.log("滑动222")
  198. this.startData.clientX = e.changedTouches[0].clientX;
  199. this.startData.clientY = e.changedTouches[0].clientY;
  200. },
  201. end(e) {
  202. console.log("滑动")
  203. const subX = e.changedTouches[0].clientX - this.startData.clientX;
  204. const subY = e.changedTouches[0].clientY - this.startData.clientY;
  205. if (subY > 50 || subY < -50) {
  206. console.log('上下滑')
  207. } else {
  208. if (subX > 50) {
  209. console.log('右滑')
  210. if(this.current!=0){
  211. this.current--
  212. this.sectionChange(this.current)
  213. }
  214. } else if (subX < -50) {
  215. console.log('左滑')
  216. if(this.current!=2){
  217. this.current++
  218. this.sectionChange(this.current)
  219. }
  220. } else {
  221. console.log('无效')
  222. }
  223. }
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="less" scoped>
  229. .subsection {
  230. width: 100%;
  231. position: fixed;
  232. top: 0rpx;
  233. height: 70rpx;
  234. z-index: 9;
  235. padding-top: 10px;
  236. background-color: #fff;
  237. .division {
  238. width: 90%;
  239. display: flex;
  240. margin: 0 auto;
  241. background-color: #fff;
  242. padding: 20rpx 0;
  243. .screen {
  244. // position: fixed;
  245. // top: -20rpx;
  246. // right: 20rpx;
  247. // z-index: 9999999999;
  248. }
  249. }
  250. .subsection_ul {
  251. height: 70rpx;
  252. display: flex;
  253. justify-content: space-around;
  254. border-bottom: 1px solid #F6F6F6;
  255. background-color: #fff;
  256. .subsection_li {
  257. height: 70rpx;
  258. text-align: center;
  259. line-height: 70rpx;
  260. }
  261. .subsection_li_act {
  262. color: #409EFF;
  263. border-bottom: 3px solid #409EFF;
  264. }
  265. }
  266. }
  267. /deep/.u-subsection {
  268. background-color: #f7f7f7 !important;
  269. // margin: 20rpx 0;
  270. .u-subsection__bar {
  271. background-color: #fff;
  272. }
  273. }
  274. .taskbox {
  275. // margin-top: 88rpx;
  276. width: 90%;
  277. margin: 180rpx auto 0;
  278. .hisbox_hint {
  279. width: 100%;
  280. text-align: center;
  281. font-size: 28rpx;
  282. height: 100rpx;
  283. line-height: 100rpx;
  284. color: #999999;
  285. }
  286. .taskbox_item {
  287. width: 100%;
  288. font-size: 28rpx;
  289. border-bottom: 1px solid #F6F6F6;
  290. padding: 40rpx 0;
  291. .taskbox_item_t,
  292. .taskbox_item_l {
  293. width: 100%;
  294. display: flex;
  295. justify-content: space-between;
  296. margin-bottom: 20rpx;
  297. }
  298. .taskbox_item_c {
  299. margin-bottom: 20rpx;
  300. text-overflow: -o-ellipsis-lastline;
  301. overflow: hidden;
  302. text-overflow: ellipsis;
  303. display: -webkit-box;
  304. -webkit-line-clamp: 2;
  305. line-clamp: 2;
  306. -webkit-box-orient: vertical;
  307. }
  308. .taskbox_item_t_l {
  309. font-weight: 700;
  310. }
  311. .taskbox_item_t_r {
  312. color: #999999;
  313. }
  314. .taskbox_item_l_l {
  315. display: flex;
  316. }
  317. .taskbox_item_l_l_l {
  318. padding: 8rpx;
  319. font-size: 24rpx;
  320. background-color: rgba(64, 158, 255, 0.15);
  321. font-weight: 700;
  322. color: #409EFF;
  323. margin-right: 10rpx;
  324. border-radius: 10rpx;
  325. }
  326. .taskbox_item_l_l_r {
  327. padding: 8rpx;
  328. font-size: 24rpx;
  329. background-color: rgba(2, 198, 68, 0.15);
  330. font-weight: 700;
  331. color: #02C644;
  332. border-radius: 10rpx;
  333. }
  334. .taskbox_item_l_l_ri {
  335. padding: 8rpx;
  336. font-size: 24rpx;
  337. background-color: rgba(255, 0, 0, 0.1);
  338. font-weight: 700;
  339. color: #f00;
  340. border-radius: 10rpx;
  341. }
  342. .taskbox_item_l_r {
  343. padding: 8rpx;
  344. font-size: 24rpx;
  345. border: 1px solid;
  346. border-radius: 10rpx;
  347. }
  348. }
  349. }
  350. </style>