planList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="planList-page">
  3. <scroll-view class="list-box" scroll-y="true" :style="{'height':listHeight+'rpx'}">
  4. <view class="item-box" v-for="(item,index) in planList" @click="gotoCheckList">
  5. <view class="row1">
  6. <text class="title">{{item.name}}</text>
  7. <view class="compeleted-box" v-if="item.isCompeleted">
  8. <text class="compeleted-text" >已完成</text>
  9. </view>
  10. <view class="continued-box" v-if="item.isContinued">
  11. <text class="continued-text" >进行中</text>
  12. </view>
  13. </view>
  14. <view class="row2">
  15. <text class="TobeDistributed">剩余1个单位待分配</text>
  16. <text class="startEndTime">起止时间:2020-12-26 ~ 2020-12-18</text>
  17. </view>
  18. </view>
  19. </scroll-view>
  20. <view class="btn-distribution" @click="gotoCheckList" v-if="isShowDistribution">
  21. <text class="btn-text">批量分配</text>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. situationID:'',//情境id
  30. planList:[],//计划列表
  31. firstFlag:1,//是否为第一次分配的标志,为1时表示是第一次,弹框提示
  32. isShowDistribution:true,//是否显示批量分配按钮
  33. listHeight:1125,//列表高度
  34. }
  35. },
  36. onLoad({ situationId }){ // situationId:情景id
  37. this.situationID=situationId;
  38. },
  39. created: function() {
  40. this.$store.dispatch({
  41. type: 'planList/commActions',
  42. payload: {
  43. key: 'planList',
  44. data:{
  45. situationId:this.situationID
  46. }
  47. }
  48. }).then((data) => {
  49. if (data) {
  50. this.planList=data.map((item,index)=>{
  51. if(item.empList.length!=item.toDistribute){
  52. this.firstFlag=0;
  53. }
  54. if(!this.compareTime(item.startDate)){
  55. this.isShowDistribution=false;
  56. this.listHeight=1200;
  57. }
  58. return {
  59. id:item.id,
  60. name:item.name,
  61. startDate:item.startDate,
  62. endDate:item.endDate,
  63. status:item.status,
  64. isCompeleted:item.status==3?true:false,
  65. isContinued:item.status==2?true:false,
  66. toDistribute:item.toDistribute,
  67. }
  68. });
  69. if(this.firstFlag==1){
  70. uni.showModal({
  71. title:'提示',
  72. content:'您的分配工作量较大,建议使用批量分配功能',
  73. showCancel:false
  74. })
  75. }
  76. }
  77. });
  78. },
  79. methods: {
  80. compareTime(time){
  81. let myDate=new Date();
  82. let startDate=time.replace(/-/g,"/");
  83. startDate=Date.parse(startDate);
  84. if(myDate>startDate){
  85. return false;
  86. }else{
  87. return true;
  88. }
  89. },
  90. gotoCheckList(){
  91. //跳转到查核列表
  92. uni.navigateTo({
  93. url: `/pages/checkList/checkList?situationId=${this.situationID}`
  94. });
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="less">
  100. .planList-page{
  101. height: 100%;
  102. .list-box{
  103. // height: 1125rpx;
  104. .item-box{
  105. width: 100%;
  106. height: 125rpx;
  107. background: #FFFFFF;
  108. border: 0.62rpx solid #DADEE6;
  109. .row1{
  110. margin-top: 30rpx;
  111. margin-left: 25rpx;
  112. margin-right: 25rpx;
  113. .title{
  114. font-size: 25rpx;
  115. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  116. font-weight: bold;
  117. color: #292C33;
  118. float: left;
  119. }
  120. .compeleted-box{
  121. width: 75rpx;
  122. height: 31.25rpx;
  123. border-radius: 8px;
  124. background: rgba(41, 204, 150, 0.1);
  125. text-align: center;
  126. float: right;
  127. .compeleted-text{
  128. font-size: 17.5rpx;
  129. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  130. font-weight: 500;
  131. color: #29CC96;
  132. line-height: 31.25rpx;
  133. }
  134. }
  135. .continued-box{
  136. width: 75rpx;
  137. height: 31.25rpx;
  138. border-radius: 8px;
  139. background: rgba(255, 204, 102, 0.1);
  140. text-align: center;
  141. float: right;
  142. .continued-text{
  143. width: 75rpx;
  144. height: 31.25rpx;
  145. font-size: 17.5rpx;
  146. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  147. font-weight: 500;
  148. color: #FFAA00;
  149. line-height: 31.25rpx;
  150. }
  151. }
  152. }
  153. .row2{
  154. margin-left: 25rpx;
  155. margin-top: 75rpx;
  156. margin-right: 25rpx;
  157. .TobeDistributed{
  158. font-size: 20rpx;
  159. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  160. font-weight: 400;
  161. color: #666E80;
  162. float: left;
  163. }
  164. .startEndTime{
  165. font-size: 20rpx;
  166. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  167. font-weight: 400;
  168. color: #666E80;
  169. float: right;
  170. }
  171. }
  172. }
  173. }
  174. .btn-distribution {
  175. width: 750rpx;
  176. height: 75rpx;
  177. background: #3377FF;
  178. position: fixed;
  179. bottom: 0rpx;
  180. .btn-text {
  181. font-size: 22.5rpx;
  182. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  183. font-weight: 400;
  184. color: #FFFFFF;
  185. line-height: 75rpx;
  186. margin-left: 352.5rpx;
  187. }
  188. }
  189. }
  190. </style>