mission-details.vue 6.4 KB

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