planList.vue 5.6 KB

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