planList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. this.compareTime(item.startDate);
  59. return {
  60. id:item.id,
  61. name:item.name,
  62. startDate:item.startDate,
  63. endDate:item.endDate,
  64. status:item.status,
  65. isCompeleted:item.status==3?true:false,
  66. isContinued:item.status==2?true:false,
  67. toDistribute:item.toDistribute,
  68. }
  69. });
  70. console.log(this.firstFlag,'1111111')
  71. if(this.firstFlag==1){
  72. this.$refs.modal.show();
  73. }
  74. }
  75. });
  76. },
  77. methods: {
  78. compareTime(time){
  79. let myDate=new Date();
  80. let startDate=time.replace(/-/g,"/");
  81. startDate=Date.parse(startDate);
  82. if(myDate>startDate){
  83. this.listHeight=1200;
  84. }else{
  85. this.isShowDistribution=true;
  86. }
  87. },
  88. /**
  89. * 跳转页面-查核列表
  90. * @param {Boolean} multiple 是否批量编辑
  91. * @param {Number} checkId 查核id
  92. */
  93. gotoCheckList(multiple, currentObj){
  94. const { id, startDate, endDate } = currentObj;
  95. let _startDate = startDate ? startDate + ' 00:00' : ''; // 计划开始时间
  96. let _endDate = endDate ? endDate + ' 23:59' : ''; // 计划结束时间
  97. //跳转到查核列表
  98. uni.navigateTo({
  99. url: `/pages/editCheckList/editCheckList?situationId=${this.situationID}&checkId=${id}&checkGroupId=${this.checkGroupId}&startDate=${_startDate}&endDate=${_endDate}&multiple=${multiple}`
  100. });
  101. }
  102. },
  103. components: {
  104. modal,
  105. }
  106. }
  107. </script>
  108. <style lang="less">
  109. .planList-page{
  110. height: 100%;
  111. .list-box{
  112. // height: 1125rpx;
  113. .item-box{
  114. width: 100%;
  115. height: 125rpx;
  116. background: #FFFFFF;
  117. border: 0.62rpx solid #DADEE6;
  118. .row1{
  119. margin-top: 30rpx;
  120. margin-left: 25rpx;
  121. margin-right: 25rpx;
  122. .title{
  123. font-size: 25rpx;
  124. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  125. font-weight: bold;
  126. color: #292C33;
  127. float: left;
  128. }
  129. .compeleted-box{
  130. width: 75rpx;
  131. height: 31.25rpx;
  132. border-radius: 8px;
  133. background: rgba(41, 204, 150, 0.1);
  134. text-align: center;
  135. float: right;
  136. .compeleted-text{
  137. font-size: 17.5rpx;
  138. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  139. font-weight: 500;
  140. color: #29CC96;
  141. line-height: 31.25rpx;
  142. }
  143. }
  144. .continued-box{
  145. width: 75rpx;
  146. height: 31.25rpx;
  147. border-radius: 8px;
  148. background: rgba(255, 204, 102, 0.1);
  149. text-align: center;
  150. float: right;
  151. .continued-text{
  152. width: 75rpx;
  153. height: 31.25rpx;
  154. font-size: 17.5rpx;
  155. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  156. font-weight: 500;
  157. color: #FFAA00;
  158. line-height: 31.25rpx;
  159. }
  160. }
  161. }
  162. .row2{
  163. margin-left: 25rpx;
  164. margin-top: 75rpx;
  165. margin-right: 25rpx;
  166. .TobeDistributed{
  167. font-size: 20rpx;
  168. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  169. font-weight: 400;
  170. color: #666E80;
  171. float: left;
  172. }
  173. .startEndTime{
  174. font-size: 20rpx;
  175. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  176. font-weight: 400;
  177. color: #666E80;
  178. float: right;
  179. }
  180. }
  181. }
  182. }
  183. .btn-distribution {
  184. width: 750rpx;
  185. height: 75rpx;
  186. background: #3377FF;
  187. position: fixed;
  188. bottom: 0rpx;
  189. .btn-text {
  190. font-size: 22.5rpx;
  191. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  192. font-weight: 400;
  193. color: #FFFFFF;
  194. line-height: 75rpx;
  195. margin-left: 352.5rpx;
  196. }
  197. }
  198. }
  199. </style>