planList.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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:{
  94. situationId:data.id,
  95. }
  96. }
  97. }).then(()=>{
  98. this.getPlanList();
  99. })
  100. },
  101. callback(flage) {
  102. this.showModal = false;
  103. if (flage && this.planList.length > 0) {
  104. this.gotoCheckList(true, this.planList[0]);
  105. }
  106. },
  107. getPlanList() {
  108. this.$store.dispatch({
  109. type: 'planList/commActions',
  110. payload: {
  111. key: 'planList',
  112. data: {
  113. situationId: this.situationID,
  114. type:this.systemSituationType == 2 ? 1 : 0 , //0 普通的 1自查督查
  115. }
  116. }
  117. }).then((data) => {
  118. if (data) {
  119. this.compareTime(data);
  120. this.planList = data.map((item, index) => {
  121. if (item.empList.length != item.toDistribute) {
  122. this.firstFlag = 0;
  123. }
  124. return {
  125. id: item.id,
  126. name: item.name,
  127. startDate: item.startDate,
  128. endDate: item.endDate,
  129. status: item.status,
  130. planFlag:item.planFlag,
  131. situationType: item.situationType,
  132. checkNo: item.checkNo,
  133. isCompeleted: item.status == 3 ? true : false,
  134. isContinued: item.status == 2 ? true : false,
  135. toDistribute: item.toDistribute,
  136. departmentId:item.departmentId,
  137. departmentType:item.departmentType,
  138. empList:item.empList,
  139. }
  140. });
  141. if (this.firstFlag == 1&&data.length > 0) {
  142. this.showModal = true;
  143. }
  144. }
  145. });
  146. },
  147. compareTime(planList) {
  148. this.$store.dispatch({
  149. type: "commActions",
  150. key: "getDateStr",
  151. }).then((dateStr) => {
  152. if (dateStr) {
  153. if (planList.some((item) => moment(item.startDate).valueOf() < moment(dateStr).valueOf())) {
  154. this.listHeight = 1200;
  155. } else {
  156. this.isShowDistribution = true;
  157. }
  158. }
  159. });
  160. },
  161. /**
  162. * 跳转页面-查核列表
  163. * @param {Boolean} multiple 是否批量编辑
  164. * @param {Number} checkId 查核id
  165. */
  166. gotoCheckList(multiple, currentObj) {
  167. const {
  168. id,
  169. startDate,
  170. endDate,
  171. situationType,
  172. checkNo,
  173. departmentId,
  174. departmentType,
  175. empList
  176. } = currentObj;
  177. let _startDate = startDate ? startDate + ' 00:00' : ''; // 计划开始时间
  178. let _endDate = endDate ? endDate + ' 23:59' : ''; // 计划结束时间
  179. if(this.systemSituationType != 2){
  180. //非自查督查
  181. //跳转到查核列表
  182. this.$store.commit('planList/comChangeState', {
  183. key: 'ifReloadData',
  184. data: false
  185. });
  186. uni.navigateTo({
  187. url: `/pages/editCheckList/editCheckList?situationId=${this.situationID}&checkId=${id}&checkGroupId=${this.checkGroupId}&startDate=${_startDate}&endDate=${_endDate}&multiple=${multiple}&situationType=${situationType}&checkNo=${checkNo}`
  188. });
  189. }
  190. if(this.systemSituationType == 2){
  191. //自查督查
  192. let ids = multiple?(this.planList.map(item=>Number(item.id))):[Number(id)];
  193. const details = {
  194. situationId:this.situationId,
  195. endDate:_endDate,
  196. startDate:_startDate,
  197. situationType:situationType,
  198. isZichaducha:true,
  199. departmentId:departmentId,
  200. departmentType:departmentType,
  201. ids:ids,
  202. empId:(empList.map(item=>item.empId)).join(','),
  203. empName:(empList.map(item=>item.empName)).join(','),
  204. }
  205. const _details = encodeURIComponent(JSON.stringify(details))
  206. uni.navigateTo({
  207. url: `/pages/batchDistribution/batchDistribution?multiple=${multiple}&details=${_details}`
  208. });
  209. }
  210. }
  211. },
  212. components: {
  213. modal,
  214. }
  215. }
  216. </script>
  217. <style lang="less" scoped>
  218. .planList-page {
  219. height: 100%;
  220. .list-box {
  221. padding-bottom: 80rpx;
  222. .item-box {
  223. width: 100%;
  224. height: 125rpx;
  225. background: #FFFFFF;
  226. border: 0.62rpx solid #DADEE6;
  227. .row1 {
  228. margin-top: 30rpx;
  229. margin-left: 25rpx;
  230. margin-right: 25rpx;
  231. .title {
  232. font-size: 25rpx;
  233. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  234. font-weight: bold;
  235. color: #292C33;
  236. float: left;
  237. }
  238. .compeleted-box {
  239. width: 75rpx;
  240. height: 31.25rpx;
  241. border-radius: 8px;
  242. background: rgba(41, 204, 150, 0.1);
  243. text-align: center;
  244. float: right;
  245. .compeleted-text {
  246. font-size: 17.5rpx;
  247. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  248. font-weight: 500;
  249. color: #29CC96;
  250. line-height: 31.25rpx;
  251. }
  252. }
  253. .continued-box {
  254. width: 75rpx;
  255. height: 31.25rpx;
  256. border-radius: 8px;
  257. background: rgba(255, 204, 102, 0.1);
  258. text-align: center;
  259. float: right;
  260. .continued-text {
  261. width: 75rpx;
  262. height: 31.25rpx;
  263. font-size: 17.5rpx;
  264. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  265. font-weight: 500;
  266. color: #FFAA00;
  267. line-height: 31.25rpx;
  268. }
  269. }
  270. }
  271. .row2 {
  272. margin-left: 25rpx;
  273. margin-top: 75rpx;
  274. margin-right: 25rpx;
  275. .TobeDistributed {
  276. font-size: 20rpx;
  277. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  278. font-weight: 400;
  279. color: #666E80;
  280. float: left;
  281. }
  282. .startEndTime {
  283. font-size: 20rpx;
  284. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  285. font-weight: 400;
  286. color: #666E80;
  287. float: right;
  288. }
  289. }
  290. }
  291. }
  292. .btn-distribution {
  293. width: 750rpx;
  294. height: 75rpx;
  295. background: #3377FF;
  296. position: fixed;
  297. bottom: 0rpx;
  298. .btn-text {
  299. font-size: 22.5rpx;
  300. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  301. font-weight: 400;
  302. color: #FFFFFF;
  303. line-height: 75rpx;
  304. margin-left: 352.5rpx;
  305. }
  306. }
  307. }
  308. </style>