planList.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="planList-page">
  3. <scroll-view class="list-box" scroll-y="true" :style="{'height':listHeight+'rpx'}">
  4. <uni-swipe-action>
  5. <uni-swipe-action-item v-for="(item,index) in planList" :key="index"
  6. :disabled="!item.planFlag"
  7. :threshold="20" :right-options="options" @click="delPlanHandle(item)" >
  8. <view class="item-box" @click.stop="gotoCheckList(false,item)">
  9. <view class="row1">
  10. <text class="title">{{item.name}}</text>
  11. <view class="compeleted-box" v-if="item.isCompeleted">
  12. <text class="compeleted-text">已完成</text>
  13. </view>
  14. <view class="continued-box" v-if="item.isContinued">
  15. <text class="continued-text">进行中</text>
  16. </view>
  17. </view>
  18. <view class="row2">
  19. <text class="TobeDistributed">剩余{{item.toDistribute}}个单位待分配</text>
  20. <text class="startEndTime">起止时间:{{item.startDate}} ~ {{item.endDate}}</text>
  21. </view>
  22. </view>
  23. </uni-swipe-action-item>
  24. </uni-swipe-action>
  25. </scroll-view>
  26. <view class="btn-distribution" @click="gotoCheckList(true, planList[0])" v-if="isShowDistribution">
  27. <text class="btn-text">批量分配</text>
  28. </view>
  29. <modal v-if="showModal" v-on:callback="callback"></modal>
  30. </view>
  31. </template>
  32. <script>
  33. import modal from './components/modal.vue'
  34. import moment from 'moment';
  35. import {
  36. mapState,
  37. mapGetters
  38. } from 'vuex';
  39. export default {
  40. data() {
  41. return {
  42. options: [{
  43. text: '删除',
  44. style: {
  45. backgroundColor: '#F56C6C'
  46. }
  47. }],
  48. situationID: '', //情境id
  49. planList: [], //计划列表
  50. firstFlag: 1, //是否为第一次分配的标志,为1时表示是第一次,弹框提示
  51. isShowDistribution: true, //是否显示批量分配按钮
  52. listHeight: 1125, //列表高度
  53. checkGroupId: 0, // 查核组id
  54. showModal: false,
  55. }
  56. },
  57. computed: {
  58. ...mapState({
  59. ifReloadData: state => {
  60. return !state.planList.ifReloadData ? false : true;
  61. },
  62. })
  63. },
  64. watch: {
  65. ifReloadData(newVal, oldVal) {
  66. if (newVal != oldVal) {
  67. this.getPlanList();
  68. }
  69. },
  70. },
  71. onShow() {
  72. this.getPlanList(); //刷新数据
  73. },
  74. onLoad({
  75. situationId,
  76. checkGroupId,
  77. situationType,
  78. systemSituationType,
  79. }) { // situationId:情景id checkGroupId: 查核组id
  80. this.situationID = situationId;
  81. this.checkGroupId = checkGroupId;
  82. this.situationType = situationType;
  83. this.systemSituationType = systemSituationType;
  84. this.getPlanList();
  85. },
  86. methods: {
  87. delPlanHandle(data){
  88. this.$store.dispatch({
  89. type: 'planList/commActions',
  90. payload: {
  91. key: 'delOutofPlan',
  92. data:{
  93. situationId:data.id,
  94. }
  95. }
  96. }).then(()=>{
  97. this.getPlanList();
  98. })
  99. },
  100. callback(flage) {
  101. this.showModal = false;
  102. if (flage && this.planList.length > 0) {
  103. this.gotoCheckList(true, this.planList[0]);
  104. }
  105. },
  106. getPlanList() {
  107. this.$store.dispatch({
  108. type: 'planList/commActions',
  109. payload: {
  110. key: 'planList',
  111. data: {
  112. situationId: this.situationID,
  113. type:this.systemSituationType == 2 ? 1 : 0 , //0 普通的 1自查督查
  114. }
  115. }
  116. }).then((data) => {
  117. if (data) {
  118. this.compareTime(data);
  119. this.planList = data.map((item, index) => {
  120. if (item.empList.length != item.toDistribute) {
  121. this.firstFlag = 0;
  122. }
  123. return {
  124. id: item.id,
  125. name: item.name,
  126. startDate: item.startDate,
  127. endDate: item.endDate,
  128. status: item.status,
  129. planFlag:item.planFlag,
  130. situationType: item.situationType,
  131. checkNo: item.checkNo,
  132. isCompeleted: item.status == 3 ? true : false,
  133. isContinued: item.status == 2 ? true : false,
  134. toDistribute: item.toDistribute,
  135. departmentId:item.departmentId,
  136. departmentType:item.departmentType,
  137. empList:item.empList,
  138. }
  139. });
  140. if (this.firstFlag == 1&&data.length > 0) {
  141. this.showModal = true;
  142. }
  143. }
  144. });
  145. },
  146. compareTime(planList) {
  147. this.$store.dispatch({
  148. type: "commActions",
  149. key: "getDateStr",
  150. }).then((dateStr) => {
  151. if (dateStr) {
  152. if (planList.some((item) => moment(item.startDate).valueOf() < moment(dateStr).valueOf())) {
  153. this.listHeight = 1200;
  154. } else {
  155. this.isShowDistribution = true;
  156. }
  157. }
  158. });
  159. },
  160. /**
  161. * 跳转页面-查核列表
  162. * @param {Boolean} multiple 是否批量编辑
  163. * @param {Number} checkId 查核id
  164. */
  165. gotoCheckList(multiple, currentObj) {
  166. const {
  167. id,
  168. startDate,
  169. endDate,
  170. situationType,
  171. checkNo,
  172. departmentId,
  173. departmentType,
  174. empList
  175. } = currentObj;
  176. let _startDate = startDate ? startDate + ' 00:00' : ''; // 计划开始时间
  177. let _endDate = endDate ? endDate + ' 23:59' : ''; // 计划结束时间
  178. if(this.systemSituationType != 2){
  179. //非自查督查
  180. //跳转到查核列表
  181. this.$store.commit('planList/comChangeState', {
  182. key: 'ifReloadData',
  183. data: false
  184. });
  185. uni.navigateTo({
  186. url: `/pages/editCheckList/editCheckList?situationId=${this.situationID}&checkId=${id}&checkGroupId=${this.checkGroupId}&startDate=${_startDate}&endDate=${_endDate}&multiple=${multiple}&situationType=${situationType}&checkNo=${checkNo}`
  187. });
  188. }
  189. if(this.systemSituationType == 2){
  190. //自查督查
  191. let ids = multiple?(this.planList.map(item=>Number(item.id))):[Number(id)];
  192. const details = {
  193. situationId:this.situationId,
  194. endDate:_endDate,
  195. startDate:_startDate,
  196. situationType:situationType,
  197. isZichaducha:true,
  198. departmentId:departmentId,
  199. departmentType:departmentType,
  200. ids:ids,
  201. empId:(empList.map(item=>item.empId)).join(','),
  202. empName:(empList.map(item=>item.empName)).join(','),
  203. }
  204. const _details = encodeURIComponent(JSON.stringify(details))
  205. uni.navigateTo({
  206. url: `/pages/batchDistribution/batchDistribution?multiple=${multiple}&details=${_details}`
  207. });
  208. }
  209. }
  210. },
  211. components: {
  212. modal,
  213. }
  214. }
  215. </script>
  216. <style lang="less" scoped>
  217. .planList-page {
  218. height: 100%;
  219. .list-box {
  220. padding-bottom: 80rpx;
  221. .item-box {
  222. width: 100%;
  223. height: 125rpx;
  224. background: #FFFFFF;
  225. border: 0.62rpx solid #DADEE6;
  226. .row1 {
  227. margin-top: 30rpx;
  228. margin-left: 25rpx;
  229. margin-right: 25rpx;
  230. .title {
  231. font-size: 25rpx;
  232. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  233. font-weight: bold;
  234. color: #292C33;
  235. float: left;
  236. }
  237. .compeleted-box {
  238. width: 75rpx;
  239. height: 31.25rpx;
  240. border-radius: 8px;
  241. background: rgba(41, 204, 150, 0.1);
  242. text-align: center;
  243. float: right;
  244. .compeleted-text {
  245. font-size: 17.5rpx;
  246. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  247. font-weight: 500;
  248. color: #29CC96;
  249. line-height: 31.25rpx;
  250. }
  251. }
  252. .continued-box {
  253. width: 75rpx;
  254. height: 31.25rpx;
  255. border-radius: 8px;
  256. background: rgba(255, 204, 102, 0.1);
  257. text-align: center;
  258. float: right;
  259. .continued-text {
  260. width: 75rpx;
  261. height: 31.25rpx;
  262. font-size: 17.5rpx;
  263. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  264. font-weight: 500;
  265. color: #FFAA00;
  266. line-height: 31.25rpx;
  267. }
  268. }
  269. }
  270. .row2 {
  271. margin-left: 25rpx;
  272. margin-top: 75rpx;
  273. margin-right: 25rpx;
  274. .TobeDistributed {
  275. font-size: 20rpx;
  276. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  277. font-weight: 400;
  278. color: #666E80;
  279. float: left;
  280. }
  281. .startEndTime {
  282. font-size: 20rpx;
  283. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  284. font-weight: 400;
  285. color: #666E80;
  286. float: right;
  287. }
  288. }
  289. }
  290. }
  291. .btn-distribution {
  292. width: 750rpx;
  293. height: 75rpx;
  294. background: #3377FF;
  295. position: fixed;
  296. bottom: 0rpx;
  297. .btn-text {
  298. font-size: 22.5rpx;
  299. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  300. font-weight: 400;
  301. color: #FFFFFF;
  302. line-height: 75rpx;
  303. margin-left: 352.5rpx;
  304. }
  305. }
  306. }
  307. </style>