planList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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">起止时间:2020-12-26 ~ 2020-12-18</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. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. situationID:'',//情境id
  30. planList:[],//计划列表
  31. firstFlag:1,//是否为第一次分配的标志,为1时表示是第一次,弹框提示
  32. isShowDistribution:false,//是否显示批量分配按钮
  33. listHeight:1125,//列表高度
  34. checkGroupId: 0 // 查核组id
  35. }
  36. },
  37. onLoad({ situationId, checkGroupId }){ // situationId:情景id checkGroupId: 查核组id
  38. this.situationID=situationId;
  39. this.checkGroupId = checkGroupId;
  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. return {
  57. id:item.id,
  58. name:item.name,
  59. startDate:item.startDate,
  60. endDate:item.endDate,
  61. status:item.status,
  62. isCompeleted:item.status==3?true:false,
  63. isContinued:item.status==2?true:false,
  64. toDistribute:item.toDistribute,
  65. }
  66. });
  67. if(this.firstFlag==1){
  68. uni.showModal({
  69. title:'提示',
  70. content:'您的分配工作量较大,建议使用批量分配功能',
  71. showCancel:false
  72. })
  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} type 是否批量编辑
  91. * @param {Number} checkId 查核id
  92. */
  93. gotoCheckList(type, currentObj){
  94. const { id, startDate, endDate } = currentObj;
  95. //跳转到查核列表
  96. uni.navigateTo({
  97. url: `/pages/editCheckList/editCheckList?situationId=${type ? this.situationID : 0}&checkId=${id}&checkGroupId=${this.checkGroupId}&startDate=${startDate}&endDate=${endDate}`
  98. });
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="less">
  104. .planList-page{
  105. height: 100%;
  106. .list-box{
  107. // height: 1125rpx;
  108. .item-box{
  109. width: 100%;
  110. height: 125rpx;
  111. background: #FFFFFF;
  112. border: 0.62rpx solid #DADEE6;
  113. .row1{
  114. margin-top: 30rpx;
  115. margin-left: 25rpx;
  116. margin-right: 25rpx;
  117. .title{
  118. font-size: 25rpx;
  119. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  120. font-weight: bold;
  121. color: #292C33;
  122. float: left;
  123. }
  124. .compeleted-box{
  125. width: 75rpx;
  126. height: 31.25rpx;
  127. border-radius: 8px;
  128. background: rgba(41, 204, 150, 0.1);
  129. text-align: center;
  130. float: right;
  131. .compeleted-text{
  132. font-size: 17.5rpx;
  133. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  134. font-weight: 500;
  135. color: #29CC96;
  136. line-height: 31.25rpx;
  137. }
  138. }
  139. .continued-box{
  140. width: 75rpx;
  141. height: 31.25rpx;
  142. border-radius: 8px;
  143. background: rgba(255, 204, 102, 0.1);
  144. text-align: center;
  145. float: right;
  146. .continued-text{
  147. width: 75rpx;
  148. height: 31.25rpx;
  149. font-size: 17.5rpx;
  150. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  151. font-weight: 500;
  152. color: #FFAA00;
  153. line-height: 31.25rpx;
  154. }
  155. }
  156. }
  157. .row2{
  158. margin-left: 25rpx;
  159. margin-top: 75rpx;
  160. margin-right: 25rpx;
  161. .TobeDistributed{
  162. font-size: 20rpx;
  163. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  164. font-weight: 400;
  165. color: #666E80;
  166. float: left;
  167. }
  168. .startEndTime{
  169. font-size: 20rpx;
  170. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  171. font-weight: 400;
  172. color: #666E80;
  173. float: right;
  174. }
  175. }
  176. }
  177. }
  178. .btn-distribution {
  179. width: 750rpx;
  180. height: 75rpx;
  181. background: #3377FF;
  182. position: fixed;
  183. bottom: 0rpx;
  184. .btn-text {
  185. font-size: 22.5rpx;
  186. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  187. font-weight: 400;
  188. color: #FFFFFF;
  189. line-height: 75rpx;
  190. margin-left: 352.5rpx;
  191. }
  192. }
  193. }
  194. </style>