planList.vue 5.4 KB

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