planList.vue 8.5 KB

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