planList.vue 6.5 KB

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