mission-details.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="mission-details-page">
  3. <scroll-view class="scroll-y" scroll-y="true">
  4. <list-item :isDetails="true" :task="missionDetails" />
  5. <view class="mission-plan">
  6. <view class="label">
  7. <text>改善进度</text>
  8. </view>
  9. <view class="plan-box">
  10. <template v-for="(item, i) in missionDetails.pfmTaskCirculationList || []">
  11. <view class="row" :key="i">
  12. <view class="col">
  13. <image
  14. class="plan-icon"
  15. :src="`/static/${i === taskStepLength ? 'check-radio' : 'check-no'}.png`">
  16. </image>
  17. <view class="line" v-show="i != taskStepLength"></view>
  18. </view>
  19. <view class="col">
  20. <view class="title">
  21. <text>{{ getContext(item, false, 'row1') }}</text>
  22. </view>
  23. <view class="sub-box">
  24. <view class="sub-title">
  25. <text>{{ getContext(item, false, 'row2') }}</text>
  26. </view>
  27. <view class="sub-title">
  28. <text>{{ item.createTime }}</text>
  29. </view>
  30. </view>
  31. <template v-if="getContext(item, true, 'selectDetails')">
  32. <view class="link-view"
  33. @click="goToDetails(item, getContext(item, true, 'selectDetails'))"
  34. >
  35. <text>{{ getContext(item, true, 'selectDetails').name }}</text>
  36. <image class="blue-arr" src="/static/blue-arrow.png"></image>
  37. </view>
  38. </template>
  39. </view>
  40. </view>
  41. </template>
  42. <view class="btn-group" v-if="missionDetails.buttonDisplayFlag == 1">
  43. <template v-for="(item, i) in taskBtn">
  44. <tm-button
  45. :key="i"
  46. :type="taskBtn.length === 1 ? 'default' : ( i === 0 ? 'default' : 'pramary')"
  47. :btnText="item.name"
  48. @btnClick="clickBtn(item)"
  49. />
  50. </template>
  51. </view>
  52. </view>
  53. </view>
  54. </scroll-view>
  55. </view>
  56. </template>
  57. <script>
  58. // 改善任务
  59. import { mapState } from "vuex";
  60. import listItem from '../mission/components/list-item.vue';
  61. import taskTypeList from './setting.js';
  62. export default {
  63. computed: {
  64. ...mapState({
  65. missionDetails: state => state.mission.missionDetails
  66. }),
  67. // 进度长度
  68. taskStepLength() {
  69. return (this.missionDetails.pfmTaskCirculationList || []).length - 1;
  70. },
  71. // 获取底部按钮
  72. taskBtn() {
  73. const { buttonDisplayFlag, pfmTaskCirculationList, taskType, checkResult } = this.missionDetails;
  74. if(buttonDisplayFlag == 1 && pfmTaskCirculationList && pfmTaskCirculationList.length > 0) {
  75. let task = null;
  76. if(taskType == 1) { // 状态为1比较特殊,需要再比较checkResult
  77. task = taskTypeList.find(item => (item.taskType == taskType && item.checkResult == checkResult));
  78. }else {
  79. task = taskTypeList.find(item => item.taskType == taskType);
  80. }
  81. return task ? task.btnList : []
  82. }else {
  83. return [];
  84. }
  85. }
  86. },
  87. data() {
  88. return {
  89. // 任务id
  90. taskId: '',
  91. // 跳转详情信息
  92. linkTaskDetails: null
  93. }
  94. },
  95. onLoad({ taskId }){
  96. this.taskId = taskId;
  97. },
  98. created() {
  99. this.getMissionDetails();
  100. },
  101. methods: {
  102. // 获取改善任务列表
  103. getMissionDetails(data) {
  104. this.$store.dispatch({
  105. type: 'mission/commActions',
  106. payload: {
  107. key: "getMissionDetails",
  108. data: {taskId: this.taskId}
  109. }
  110. });
  111. },
  112. // 点击右侧按钮
  113. clickBtn(btnInfo) {
  114. uni.navigateTo({
  115. url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify(btnInfo))}`
  116. })
  117. },
  118. // 查看详情
  119. goToDetails(currentInfo, detailInfo) {
  120. uni.navigateTo({
  121. url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...detailInfo}))}`
  122. });
  123. },
  124. /***
  125. * 解析显示对应的内容
  126. * @param {Object} obj 当前遍历的任务
  127. * @param {Boolean} isLink 是否需要跳转页面(查看详情)
  128. * @param {String} rowKey 任务流程中的key
  129. */
  130. getContext(obj, isLink, rowKey){
  131. let currentTypeTask = null;
  132. if(obj.taskType == 1) {
  133. currentTypeTask = taskTypeList.find(item => (item.taskType == obj.taskType && item.checkResult == this.missionDetails.checkResult)) || {};
  134. }else {
  135. currentTypeTask = taskTypeList.find(item => item.taskType == obj.taskType) || {};
  136. }
  137. if(isLink) {
  138. return currentTypeTask[rowKey];
  139. }else {
  140. const { hasJoin, name, key} = currentTypeTask[rowKey] || {};
  141. if(hasJoin) { // 需要删除*并替换
  142. return name ? name.replace(/x/g, (obj[key] || '')) : ''
  143. }else {
  144. return name || '';
  145. }
  146. }
  147. }
  148. },
  149. components: {
  150. listItem
  151. }
  152. }
  153. </script>
  154. <style lang="less">
  155. .mission-details-page {
  156. height: 100%;
  157. padding-top: 15rpx;
  158. .scroll-y {
  159. height: 100%;
  160. .mission-plan {
  161. .label {
  162. margin-top: 25rpx;
  163. margin-bottom: 15rpx;
  164. height: 20rpx;
  165. line-height: 20rpx;
  166. padding-left: 25rpx;
  167. text {
  168. font-size: 20rpx;
  169. color: #666F80;
  170. }
  171. }
  172. .plan-box {
  173. padding: 25rpx;
  174. background-color: #fff;
  175. .row {
  176. display: flex;
  177. .col {
  178. .title {
  179. display: flex;
  180. align-items: center;
  181. margin-bottom: 15rpx;
  182. height: 25rpx;
  183. >text {
  184. font-size: 22.5rpx;
  185. color: #292C33;
  186. }
  187. }
  188. .sub-box {
  189. display: flex;
  190. flex-direction: column;
  191. .sub-title {
  192. display: flex;
  193. align-items: center;
  194. margin-bottom: 15rpx;
  195. height: 20rpx;
  196. &:last-child {
  197. margin-bottom: 34.37rpx;
  198. }
  199. >text {
  200. font-size: 20rpx;
  201. color: #666E80;
  202. }
  203. }
  204. }
  205. &:first-child {
  206. display: flex;
  207. flex-direction: column;
  208. align-items: center;
  209. margin-right: 15rpx;
  210. width: 25rpx;
  211. .plan-icon {
  212. margin-bottom: 17.5rpx;
  213. width: 25rpx;
  214. height: 25rpx;
  215. }
  216. .line {
  217. width: 5rpx;
  218. height: 75rpx;
  219. background-color: #E6EAF2;
  220. }
  221. }
  222. &:last-child {
  223. position: relative;
  224. flex: 1;
  225. .link-view {
  226. position: absolute;
  227. top: 0;
  228. right: 0;
  229. >text {
  230. font-size: 17.5rpx;
  231. color: #3377FF;
  232. }
  233. .blue-arr {
  234. margin-left: 10rpx;
  235. width: 8.12rpx;
  236. height: 15.62rpx;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. .btn-group {
  243. display: flex;
  244. justify-content: space-between;
  245. padding: 0 25rpx;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. </style>