task.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <template>
  2. <div id="allocation">
  3. <div class="head taskHead">
  4. <mt-navbar v-model="selected" class="tab_head" v-on:click.native='getList'>
  5. <mt-tab-item id="tab1" :style="user.roles[0].roleDescribe == '部门领导'?'':'text-align:left;'">我的任务</mt-tab-item>
  6. <mt-tab-item id="tab2" v-if="user.roles[0].roleDescribe == '部门领导'">我发布的</mt-tab-item>
  7. </mt-navbar>
  8. <div class="filter">
  9. <img v-if="selected == 'tab2'" src="../../assets/image/add_black.png" v-on:click="register()">
  10. <img v-if="!isBlue" src="../../assets/image/filter.png" v-on:click="showFilter()">
  11. <img v-else src="../../assets/image/filter_blue.png" v-on:click="showFilter()">
  12. </div>
  13. </div>
  14. <div class="head taskHead headInput">
  15. <div class="searchbox">
  16. <img src="../../assets/image/search.png" class="searchbox_img">
  17. <input v-on:keypress="searchKeyword" type="text" v-model="keyWord" class="searchbox_text" placeholder="搜索"/>
  18. </div>
  19. </div>
  20. <section class="_sorting-address">
  21. <div class="filter_title">任务分类</div>
  22. <ul class="filter_body task_type">
  23. <li v-for="(item,index) in labels" :id="'btn'+item.id" v-bind:class="{'active':index==0}" v-on:click="chooseType(index,item.id)">{{item.name}}</li>
  24. </ul>
  25. <div class="filter_title">任务状态</div>
  26. <ul class="filter_body task_status">
  27. <li v-bind:class="{'active':status == -1}" v-on:click='chooseStatus(-1)'>全部</li>
  28. <li v-on:click='chooseStatus(0)'>待派发</li>
  29. <li v-on:click='chooseStatus(1)'>已派发</li>
  30. <li v-on:click='chooseStatus(2)'>已接收</li>
  31. <li v-on:click='chooseStatus(3)'>待审核</li>
  32. <li v-on:click='chooseStatus(4)'>未通过</li>
  33. <li v-on:click='chooseStatus(5)'>已完成</li>
  34. <li v-on:click='chooseStatus(6)'>已延期</li>
  35. <li v-on:click='chooseStatus(7)'>已失效</li>
  36. </ul>
  37. <div class="filter_title">任务日期</div>
  38. <div class="filter_body task_date">
  39. <mt-field label="" placeholder="开始日期" type="date" v-model="form.start"></mt-field>
  40. <div class="text">至</div>
  41. <mt-field label="" placeholder="结束日期" type="date" v-model="form.end"></mt-field>
  42. </div>
  43. <div class="filter_foot">
  44. <mt-button type="default" class="clearFilter" v-on:click.native='clearFilter'>清空</mt-button>
  45. <mt-button type="default" class="saveFilter" v-on:click.native='getList'>确认</mt-button>
  46. </div>
  47. </section>
  48. <div class="body">
  49. <div class="noList" v-if="list.length==0">
  50. <img src="../../assets/image/noList.png">
  51. </div>
  52. <ul v-else v-infinite-scroll="loadMore" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
  53. <li v-for="item in list" v-on:click="jumpTo(item.id)">
  54. <div class="text item_name">
  55. <span class="item_type item_span">({{item.tagName}})</span>
  56. {{item.name}}
  57. <span v-if="item.state==0" class="item_status item_span">待派发</span>
  58. <span v-if="item.state==1" class="item_status item_span">已派发</span>
  59. <span v-if="item.state==2" class="item_status item_span">已接收</span>
  60. <span v-if="item.state==3" class="item_status item_span">待审核</span>
  61. <span v-if="item.state==4" class="item_status item_span">未通过</span>
  62. <span v-if="item.state==5" class="item_status item_span">已完成</span>
  63. <span v-if="item.state==6" class="item_status item_span">已延期</span>
  64. <span v-if="item.state==7" class="item_status item_span">已失效</span>
  65. </div>
  66. <div class="text item_int">{{item.code}}</div>
  67. <div class="text item_content">
  68. {{item.content}}
  69. </div>
  70. <div class="text item_users">
  71. <div class="userInfo">
  72. <img src="../../assets/image/userHead.jpg">
  73. <span>{{item.publisherName}}&nbsp;&nbsp;{{item.indate}}</span>
  74. </div>
  75. <div class="allUsers">
  76. <a v-if="item.recipientId!=null">
  77. <img v-if="item.recipientHedaPic==null" src="../../assets/image/userHead.jpg">
  78. <img v-else :src="item.recipientHedaPic">
  79. </a>
  80. <a v-for="(head,num) in item.participantsVOS" v-if="head.userId != item.recipientId">
  81. <img v-if="head.headPic==null" src="../../assets/image/userHead.jpg">
  82. <img v-else :src="head.headPic">
  83. </a>
  84. </div>
  85. </div>
  86. </li>
  87. <div class="order" v-if="haveMore">
  88. <span class="line"></span>
  89. <span class="txt">没有更多了</span>
  90. <span class="line"></span>
  91. </div>
  92. </ul>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import util from '../../common/js/util'
  98. export default {
  99. data() {
  100. return {
  101. keyWord: "",
  102. user: JSON.parse(sessionStorage.getItem("user")),
  103. power: sessionStorage.getItem("power"),
  104. selected: sessionStorage.taskTab==''?"tab1":sessionStorage.taskTab,
  105. isBlue: false,
  106. type: -1,
  107. status: -1,
  108. start: '',
  109. end: '',
  110. form: {
  111. type: -1,
  112. status: -1,
  113. start: '',
  114. end: '',
  115. },
  116. list: [],
  117. labels: [],
  118. pageNum: 1,
  119. pages: 1,
  120. popupVisible: false,
  121. loading: false,
  122. haveMore: false,
  123. }
  124. },
  125. methods: {
  126. // 任务列表
  127. getList() {
  128. this.$indicator.open();
  129. $("._sorting-address").removeClass("fixed-top");
  130. $('._navbar').attr('style','position: fixed;top:0;');
  131. this.isBlue = false;
  132. sessionStorage.taskTab = this.selected;
  133. this.http.post(this.port.task.list, {
  134. 'keyName': this.keyWord,
  135. 'pageNum': 1,
  136. 'uid': this.user.id,
  137. 'tagId': this.form.type==-1?"":this.form.type,
  138. 'state': this.form.status==-1?"":this.form.status,
  139. 'startTime': this.form.start,
  140. 'endTime': this.form.end,
  141. 'type': this.selected=='tab1'?0:1
  142. } ,
  143. res => {
  144. this.$indicator.close();
  145. if (res.code == "ok") {
  146. this.list = res.data.list;
  147. this.pages = res.data.pages==0?1:res.data.pages;
  148. } else {
  149. this.$toast({
  150. message: res.msg,
  151. duration: 2000
  152. });
  153. }
  154. }, error => {
  155. this.$indicator.close();
  156. this.$toast({
  157. message: error,
  158. duration: 2000
  159. });
  160. })
  161. },
  162. loadMore() {
  163. if(this.pageNum == this.pages) {
  164. this.haveMore = true;
  165. } else if(this.pageNum < this.pages) {
  166. this.$indicator.open();
  167. this.http.post(this.port.task.list, {
  168. 'keyName': this.keyWord,
  169. 'pageNum': ++this.pageNum,
  170. 'uid': this.user.id,
  171. 'tagId': this.form.type==-1?"":this.form.type,
  172. 'state': this.form.status==-1?"":this.form.status,
  173. 'startTime': this.form.start,
  174. 'endTime': this.form.end,
  175. 'type': this.selected=='tab1'?0:1
  176. } ,
  177. res => {
  178. this.$indicator.close();
  179. if (res.code == "ok") {
  180. this.pages = res.data.pages==0?1:res.data.pages;
  181. if(res.data.list.length != 0) {
  182. for(var i in res.data.list) {
  183. this.list.push(res.data.list[i]);
  184. }
  185. }
  186. } else {
  187. this.$toast({
  188. message: res.msg,
  189. duration: 2000
  190. });
  191. }
  192. }, error => {
  193. this.$indicator.close();
  194. this.$toast({
  195. message: error,
  196. duration: 2000
  197. });
  198. })
  199. }
  200. },
  201. // 标签列表
  202. getLabels() {
  203. this.http.post(this.port.task.label, {} ,
  204. res => {
  205. if (res.code == "ok") {
  206. this.getList();
  207. var array = [{"id":-1 , "name": "全部"}];
  208. for(var i in res.data) {
  209. array.push(res.data[i]);
  210. }
  211. this.labels = array;
  212. } else {
  213. this.$toast({
  214. message: res.msg,
  215. duration: 2000
  216. });
  217. }
  218. }, error => {
  219. this.$toast({
  220. message: error,
  221. duration: 2000
  222. });
  223. })
  224. },
  225. // 关键词搜索
  226. searchKeyword(event) {
  227. if (event.keyCode == 13) {
  228. event.preventDefault();
  229. this.getList();
  230. }
  231. },
  232. // 标签筛选
  233. showFilter() {
  234. $("._sorting-medical").removeClass("fixed-top");
  235. if($("._sorting-address").hasClass("fixed-top")){
  236. $("._sorting-address").removeClass("fixed-top");
  237. $('._navbar').attr('style','position: fixed;top:0;');
  238. }else{
  239. $("._sorting-address").addClass("fixed-top");
  240. $('._navbar').attr('style','position: fixed;top:0;');
  241. }
  242. this.isBlue = !this.isBlue;
  243. },
  244. // 标签选择
  245. chooseType(type,id) {
  246. this.type = type;
  247. this.form.type = id;
  248. $(".task_type li:nth-child("+ (type+1) +")").addClass("active").siblings().removeClass("active")
  249. },
  250. // 清空标签
  251. clearFilter() {
  252. this.type = -1;
  253. this.status = -1;
  254. this.start = '';
  255. this.end = '';
  256. this.form = {
  257. type: -1,
  258. status: -1,
  259. start: '',
  260. end: '',
  261. };
  262. $(".task_type li:nth-child(1)").addClass("active").siblings().removeClass("active")
  263. $(".task_status li:nth-child(1)").addClass("active").siblings().removeClass("active")
  264. this.getList();
  265. },
  266. chooseStatus(status) {
  267. this.status = status;
  268. this.form.status = status;
  269. $(".task_status li:nth-child("+ (status+2) +")").addClass("active").siblings().removeClass("active")
  270. },
  271. jumpTo(id) {
  272. this.$router.push("/task/" + id);
  273. },
  274. register() {
  275. this.$router.push("/taskRegister");
  276. },
  277. globalClick(callback) {
  278. var _this = this;
  279. document.getElementById('allocation').onclick = function () {
  280. _this.popupVisible = false;
  281. }
  282. }
  283. },
  284. created() {
  285. this.getLabels();
  286. },
  287. mounted() {
  288. this.globalClick();
  289. }
  290. }
  291. </script>
  292. <style scoped>
  293. /* 新任务头部 START */
  294. .head {
  295. position: fixed;
  296. width: 100%;
  297. box-sizing:border-box;
  298. padding: 0.07rem 0.15rem 0 0.15rem;
  299. background: #ffffff;
  300. z-index: 105;
  301. }
  302. .headInput {
  303. margin-top: 0.44rem;
  304. border-bottom: 1px solid #dfdfdf;
  305. z-index: 1;
  306. }
  307. .taskHead .tab_head {
  308. width: 50%;
  309. display: inline-flex;
  310. }
  311. .filter {
  312. width: 50%;
  313. float: right;
  314. display: inline-block;
  315. text-align: right;
  316. padding: 0.08rem 0;
  317. }
  318. .filter img {
  319. width: 0.18rem;
  320. margin-right: 0.08rem;
  321. }
  322. .filter_foot {
  323. margin-top: 0.2rem;
  324. }
  325. .filter_foot > .mint-button--normal {
  326. width: 50%;
  327. float: left;
  328. border: none;
  329. box-shadow: none;
  330. border-radius: 0;
  331. font-size: 0.13rem;
  332. }
  333. .clearFilter {
  334. background: #fff;
  335. }
  336. .saveFilter {
  337. background: #36DE95;
  338. color: #fff;
  339. }
  340. .searchbox {
  341. display: inline-block;
  342. width: 100%;
  343. position: relative;
  344. margin-bottom: 0.05rem;
  345. }
  346. .searchbox img.searchbox_img {
  347. width:0.18rem;
  348. height: 0.18rem;
  349. position: absolute;
  350. left: 0.04rem;
  351. top: 0.05rem;
  352. }
  353. .searchbox input.searchbox_text {
  354. font-size: 0.14rem;
  355. height: 0.28rem;
  356. border-style:none;
  357. border: 1px solid #eee/*#2680EB*/;
  358. background: #eee;
  359. border-radius: 50px;
  360. box-sizing:border-box;
  361. width: 100%;
  362. padding: 0 0.45rem 0 0.33rem;
  363. }
  364. input.searchbox_text:focus{
  365. outline: none;
  366. }
  367. .searchbox button.searchbox_button {
  368. border: 0;
  369. background-color: transparent;
  370. outline: none;
  371. height: 0.28rem;
  372. font-size: 0.13rem;
  373. background: #2680EB;
  374. color: #fff;
  375. border-radius: 50px;
  376. padding: 0 0.12rem;
  377. position: absolute;
  378. right: -0.01rem;
  379. top: 0;
  380. }
  381. /* 新任务头部 END */
  382. /* 筛选栏 START */
  383. ._sorting-address {
  384. position:fixed;
  385. top: -80%;
  386. width: 100%;
  387. height: 80%;
  388. z-index: 1;
  389. -webkit-transition-duration: 0.4s;
  390. /* background: #fff; */
  391. background: #efefef;
  392. overflow: auto;
  393. }
  394. ._sorting-address .filter_title {
  395. color: #999;
  396. font-size: 0.13rem;
  397. padding: 0.08rem 0.12rem;
  398. }
  399. ._sorting-address > ul {
  400. margin: 0;
  401. padding: 0;
  402. overflow: auto;
  403. width: 100%;
  404. background: #fff;
  405. box-sizing:border-box;
  406. width: 100%;
  407. -webkit-transition-duration: 0.4s;
  408. }
  409. ._sorting-address > ul > li {
  410. display: inline-block;
  411. width: 25%;
  412. float: left;
  413. padding: 0.08rem;
  414. text-align: center;
  415. box-sizing:border-box;
  416. border: 1px solid #eee;
  417. }
  418. ._sorting-address > ul > li.active {
  419. color: #2680EB;
  420. border: 1px solid #2680EB;
  421. }
  422. .fixed-top{
  423. top: 0.44rem;
  424. }
  425. .fixed-top::after{
  426. content: "";
  427. width: 100%;
  428. /* height: 100%; */
  429. display: block;
  430. /* background:rgba(0,0,0,0.2); */
  431. background: #efefef;
  432. }
  433. .task_date {
  434. background: #fff;
  435. }
  436. .task_date .mint-field {
  437. display: inline-block;
  438. width: 46%;
  439. vertical-align: middle;
  440. }
  441. .task_date .text {
  442. display: inline-block;
  443. width: 5%;
  444. line-height: 48px;
  445. height: 48px;
  446. vertical-align: middle;
  447. }
  448. /* 筛选栏 END */
  449. /* 列表页 START */
  450. .body {
  451. -webkit-box-flex: 1;
  452. -webkit-flex: 1;
  453. -ms-flex: 1;
  454. flex: 1;
  455. width: 100%;
  456. padding: 0.85rem 0 0 0;
  457. height: calc(100% - 0.8rem);
  458. overflow-y: auto;
  459. background: #EFEFEF;
  460. }
  461. .body > ul {
  462. margin-top: 0;
  463. }
  464. .body > ul li {
  465. padding: 0.08rem 0.15rem;
  466. background: #fff;
  467. margin-bottom: 0.08rem;
  468. border-bottom: 1px solid #ddd;
  469. }
  470. .body > ul li .item_span {
  471. color: #2680eb;
  472. }
  473. .body > ul li .item_status {
  474. float: right;
  475. }
  476. .body > ul li .text {
  477. line-height: 0.23rem;
  478. margin: 0.05rem 0 0 0;
  479. }
  480. .body > ul li .item_content {
  481. word-wrap:break-word;
  482. color: #333;
  483. }
  484. .body > ul li .item_int {
  485. color: #B5B5B5;
  486. font-size: 0.12rem;
  487. line-height: 0.13rem;
  488. }
  489. .body > ul li .item_users img {
  490. width: 0.18rem;
  491. border-radius: 50%;
  492. vertical-align: middle;
  493. }
  494. .body > ul li .item_users span {
  495. vertical-align: middle;
  496. margin-right: 0.12rem;
  497. color: #999;
  498. }
  499. .body > ul li .userInfo {
  500. width: 80%;
  501. display: inline-block;
  502. }
  503. .body > ul li .userInfo span {
  504. font-size: 0.12rem;
  505. vertical-align: middle;
  506. margin-left: 0.05rem;
  507. }
  508. .body > ul li .allUsers {
  509. float: right;
  510. width: 20%;
  511. overflow: hidden;
  512. text-overflow: ellipsis;
  513. white-space: nowrap;
  514. color: #999;
  515. }
  516. .body > ul li .allUsers a:not(:first-child) {
  517. margin-left: -0.07rem;
  518. }
  519. .noList {
  520. text-align: center;
  521. padding: 1.5rem 0;
  522. }
  523. .noList img {
  524. width: 1.2rem;
  525. height: 1.2rem;
  526. }
  527. .order {
  528. height: 0.6rem;
  529. line-height: 0.6rem;
  530. text-align: center;
  531. }
  532. .order .line {
  533. display: inline-block;
  534. width: 1.2rem;
  535. border-top: 1px solid #ccc ;
  536. vertical-align: middle;
  537. }
  538. .order .txt {
  539. color: #ccc;
  540. font-size: 0.13rem;
  541. vertical-align: middle;
  542. }
  543. /* 列表页 END */
  544. </style>
  545. <style>
  546. .tab_head .mint-tab-item-label {
  547. font-size: 0.13rem;
  548. color: #999;
  549. }
  550. .taskHead .tab_head .mint-tab-item {
  551. padding: 0.08rem 0;
  552. }
  553. .taskHead .tab_head .mint-tab-item.is-selected {
  554. border: none;
  555. }
  556. .taskHead .tab_head .mint-tab-item.is-selected .mint-tab-item-label {
  557. color: #333;
  558. font-size: 0.16rem;
  559. font-weight: 700;
  560. }
  561. .task_date .mint-field input {
  562. text-align: center;
  563. }
  564. </style>