planList.vue 5.1 KB

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