planList.vue 4.7 KB

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