editCheckList.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="check-map-list">
  3. <view class="item"
  4. v-for="(item, index) in checkList"
  5. :key="index">
  6. <view class="title-wrap">
  7. <text>{{item.deptName}}</text>
  8. <view>
  9. <image src="../../static/icon-map.png"></image>
  10. <text>{{item.deptClassName}}</text>
  11. </view>
  12. </view>
  13. <view class="content">
  14. <text>{{item.decs}}</text>
  15. <text>
  16. 要点概览:{{item.checkPointNames}}
  17. </text>
  18. </view>
  19. <view class="footer">
  20. <view class="row" @click="checkEdit(item, index, '指派查核人员')">
  21. <text class="label">查核人</text>
  22. <view class="content">
  23. <text :class="['base-text', item.empName ? 'black-color' : '']">
  24. {{ item.empName ? item.empName : '选择查核成员'}}
  25. </text>
  26. </view>
  27. <image class="arrow" src="/static/images/icon-more.png"></image>
  28. </view>
  29. <view class="row" @click="checkEdit(item, index, '设置查核时间')">
  30. <text class="label">计划时间</text>
  31. <view class="content">
  32. <text :class="['base-text', item.startDate ? 'black-color' : '']">
  33. {{ item.startDate ? item.startDate : '选择起始时间' }}
  34. </text>
  35. <text class="center-text">至</text>
  36. <text :class="['base-text', item.endDate ? 'black-color' : '']">
  37. {{ item.endDate ? item.endDate : '选择结束时间' }}
  38. </text>
  39. </view>
  40. <image class="arrow" src="/static/images/icon-more.png"></image>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- <view class="null" v-if="checkList.length === 0">暂无数据</view> -->
  45. </view>
  46. </template>
  47. <script>
  48. // 查核列表(查核人和计划时间可编辑)
  49. import { mapState } from "vuex";
  50. import moment from 'moment';
  51. export default {
  52. computed: {
  53. ...mapState({
  54. checkList: state => state.editCheckList.checkList
  55. })
  56. },
  57. data() {
  58. return {
  59. // 查核组id
  60. checkGroupId: 0,
  61. // 情境id (批量修改有,不然为0)
  62. situationId: 0,
  63. // 查核id
  64. checkId: 0,
  65. // 计划开始时间
  66. startDate: '',
  67. // 计划结束时间
  68. endDate: ''
  69. };
  70. },
  71. onLoad({ situationId, checkId, checkGroupId, startDate, endDate }){
  72. console.log(99999)
  73. this.getCheckList(checkId);
  74. this.checkGroupId = checkGroupId;
  75. this.situationId = situationId;
  76. this.checkId = checkId;
  77. this.startDate = startDate;
  78. this.endDate = endDate;
  79. },
  80. methods: {
  81. checkEdit(data, index, title) {
  82. if(data.startDate){ // 分配开始时间有,需要与当前时间做对比
  83. this.$store.dispatch({
  84. type: "commActions",
  85. key: "getDateStr" ,
  86. }).then((dateStr) => {
  87. if(dateStr) {
  88. if (moment(data.startDate).valueOf() > moment(dateStr).valueOf()) { // 弹窗提示
  89. uni.showModal({
  90. content: '因查核计划已开始,故不可修改',
  91. showCancel: false
  92. });
  93. }else {
  94. this.gotoAllocationPerson(data, index, title);
  95. }
  96. }
  97. });
  98. }else {// 跳转编辑页面
  99. this.gotoAllocationPerson(data, index, title);
  100. }
  101. },
  102. // 打开人员列表页面
  103. gotoAllocationPerson(data, index, title) {
  104. let details = {
  105. index, // 修改的下标
  106. title, // 标题
  107. situationId: this.situationId,
  108. checkId: this.checkId,
  109. checkGroupId: this.checkGroupId,
  110. planStartDate: this.startDate + ' 00:00',
  111. planEndDate: this.endDate + ' 23:59',
  112. empId: data.empId,
  113. empName: data.empName,
  114. startDate: data.startDate,
  115. endDate: data.endDate
  116. }
  117. uni.navigateTo({
  118. url: `/pages/allocationPerson/allocationPerson?details=${encodeURIComponent(JSON.stringify(details))}`
  119. });
  120. },
  121. // 打开日期选择页面
  122. openDatePickPage(data) {
  123. },
  124. // 获取查核列表
  125. getCheckList(checkId) {
  126. this.$store.dispatch({
  127. type: 'editCheckList/commActions',
  128. key: "getCheckList",
  129. data: { checkId }
  130. }).then(data => {
  131. this.$store.commit({
  132. type: 'editCheckList/comChangeState',
  133. key: 'checkList',
  134. data: data || []
  135. })
  136. });
  137. },
  138. // 获取当前时间
  139. getDateStr() {
  140. this.$store.dispatch({
  141. type: "commActions",
  142. key: "getDateStr" ,
  143. }).then((data) => {
  144. if (data) {
  145. console.log(8, data)
  146. }
  147. });
  148. },
  149. }
  150. }
  151. </script>
  152. <style lang="less">
  153. .check-map-list {
  154. padding: 25rpx;
  155. .footer {
  156. .row {
  157. display: flex;
  158. align-items: center;
  159. justify-content: space-between;
  160. border-top: 1px solid #DADEE6;
  161. height: 62.5rpx;
  162. padding: 0 25rpx;
  163. font-size: 22.5rpx;
  164. .label {
  165. color: #525866;
  166. width: 93.75rpx;
  167. }
  168. .content {
  169. display: flex;
  170. flex-direction: row;
  171. align-items: center;
  172. flex: 1;
  173. height: 100%;
  174. padding: 0 25rpx;
  175. .base-text {
  176. flex: 1;
  177. line-height: 62.5rpx;
  178. color: #B8BECC;
  179. font-weight: normal;
  180. }
  181. .center-text {
  182. padding: 0 25rpx;
  183. color: #292C33;
  184. }
  185. .black-color {
  186. color: #292C33;
  187. }
  188. }
  189. .arrow {
  190. width: 12.5rpx;
  191. height: 21.25rpx;
  192. }
  193. }
  194. }
  195. .null {
  196. text-align: center;
  197. color: #999;
  198. }
  199. }
  200. </style>