mission-details.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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.recordTime }}</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. <view :class="['btn-group', taskBtn.length === 1 ?'btn-one' : '']"
  42. v-if="missionDetails.buttonDisplayFlag == 1
  43. && missionDetails.pfmTaskCirculationList
  44. && i == missionDetails.pfmTaskCirculationList.length - 1"
  45. >
  46. <template v-for="(btn, i1) in taskBtn">
  47. <tm-button
  48. :key="i1"
  49. :type="taskBtn.length === 1 ? 'default' : ( i1 === 0 ? 'default' : 'pramary')"
  50. :btnText="btn.name"
  51. @btnClick="clickBtn(item, btn)"
  52. />
  53. </template>
  54. </view>
  55. </template>
  56. </view>
  57. </view>
  58. </scroll-view>
  59. </view>
  60. </template>
  61. <script>
  62. // 改善任务
  63. import { mapState } from "vuex";
  64. import listItem from '../mission/components/list-item.vue';
  65. import taskTypeList from './setting.js';
  66. import pdcaSetting from './pdcaSetting.js'
  67. export default {
  68. computed: {
  69. ...mapState({
  70. missionDetails: state => state.mission.missionDetails
  71. }),
  72. // 进度长度
  73. taskStepLength() {
  74. return (this.missionDetails.pfmTaskCirculationList || []).length - 1;
  75. },
  76. // 获取底部按钮
  77. taskBtn() {
  78. const { buttonDisplayFlag, pfmTaskCirculationList, taskType, checkResult } = this.missionDetails;
  79. if(buttonDisplayFlag == 1 && pfmTaskCirculationList && pfmTaskCirculationList.length > 0) {
  80. let task = null;
  81. if(taskType == 1) { // 状态为1比较特殊,需要再比较checkResult
  82. task = taskTypeList.find(item => (item.taskType == taskType && item.checkResult == checkResult));
  83. }else {
  84. task = taskTypeList.find(item => item.taskType == taskType);
  85. }
  86. return task ? task.btnList : []
  87. }else {
  88. return [];
  89. }
  90. }
  91. },
  92. data() {
  93. return {
  94. // 任务id
  95. taskId: '',
  96. // 跳转详情信息
  97. linkTaskDetails: null
  98. }
  99. },
  100. onLoad({ taskId }){
  101. this.taskId = taskId;
  102. },
  103. created() {
  104. this.getMissionDetails();
  105. },
  106. methods: {
  107. // 获取改善任务列表
  108. getMissionDetails(data) {
  109. this.$store.dispatch({
  110. type: 'mission/commActions',
  111. payload: {
  112. key: "getMissionDetails",
  113. data: {taskId: this.taskId}
  114. }
  115. });
  116. },
  117. // 点击右侧按钮
  118. clickBtn(currentInfo, btnInfo) {
  119. if(btnInfo.componentName){ // 有组件名,则跳转页面
  120. if(btnInfo.componentName === 'pdca'){
  121. const { taskType, needApproveFlag } = this.missionDetails;
  122. if(taskType === 13 || taskType === 15){ // 制定改善方案中(需要回显暂存过的数据)
  123. if(needApproveFlag){// 需要审核(pdca)
  124. btnInfo= { ...btnInfo, ...pdcaSetting['editPdcaBtnInfo'], isEdit: true };
  125. }else {
  126. btnInfo= { ...btnInfo, ...pdcaSetting['editPBtnInfo'], isEdit: true };
  127. }
  128. }else {
  129. if(needApproveFlag){ // 需要审核(pdca)
  130. btnInfo= { ...btnInfo, ...pdcaSetting['pdcaBtnInfo'] };
  131. }else {
  132. btnInfo= { ...btnInfo, ...pdcaSetting['pBtnInfo'] };
  133. }
  134. }
  135. }
  136. uni.navigateTo({
  137. url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...btnInfo}))}`
  138. });
  139. }else { // 直接调接口
  140. let requestParams = {};
  141. btnInfo.params.map(item => {
  142. if(item.valueKey){
  143. requestParams[item.paramsKey] = (
  144. item.isOutvalueKey
  145. ? this.missionDetails
  146. : currentInfo
  147. )[item.valueKey];
  148. }
  149. })
  150. this.comTaskCirculation(requestParams);
  151. }
  152. },
  153. // 查看详情
  154. goToDetails(currentInfo, detailInfo) {
  155. uni.navigateTo({
  156. url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...detailInfo}))}`
  157. });
  158. },
  159. /***
  160. * 解析显示对应的内容
  161. * @param {Object} obj 当前遍历的任务
  162. * @param {Boolean} isLink 是否需要跳转页面(查看详情)
  163. * @param {String} rowKey 任务流程中的key
  164. */
  165. getContext(obj, isLink, rowKey){
  166. let currentTypeTask = null;
  167. if(obj.taskType == 1) {
  168. const { checkResult } = this.missionDetails;
  169. currentTypeTask = taskTypeList.find(item => (item.taskType == obj.taskType && item.checkResult == checkResult)) || {};
  170. }else {
  171. currentTypeTask = taskTypeList.find(item => item.taskType == obj.taskType) || {};
  172. }
  173. if(isLink) {
  174. return currentTypeTask[rowKey];
  175. }else {
  176. const { hasJoin, name, key} = currentTypeTask[rowKey] || {};
  177. if(hasJoin) { // 需要删除*并替换
  178. return name ? name.replace(/x/g, (obj[key] || '')) : ''
  179. }else {
  180. return name || '';
  181. }
  182. }
  183. },
  184. // 公共改善任务接口
  185. comTaskCirculation(data) {
  186. this.$store.dispatch({
  187. type: 'mission/commActions',
  188. payload: {
  189. key: "comTaskCirculation",
  190. data
  191. }
  192. }).then(data1 => {
  193. if(!data1){
  194. this.getMissionDetails();
  195. }
  196. });
  197. }
  198. },
  199. components: {
  200. listItem
  201. }
  202. }
  203. </script>
  204. <style lang="less">
  205. .mission-details-page {
  206. height: 100%;
  207. padding-top: 15rpx;
  208. .scroll-y {
  209. height: 100%;
  210. .mission-plan {
  211. .label {
  212. margin-top: 25rpx;
  213. margin-bottom: 15rpx;
  214. height: 20rpx;
  215. line-height: 20rpx;
  216. padding-left: 25rpx;
  217. text {
  218. font-size: 20rpx;
  219. color: #666F80;
  220. }
  221. }
  222. .plan-box {
  223. padding: 25rpx;
  224. background-color: #fff;
  225. .row {
  226. display: flex;
  227. .col {
  228. .title {
  229. display: flex;
  230. align-items: center;
  231. margin-bottom: 15rpx;
  232. height: 25rpx;
  233. >text {
  234. font-size: 22.5rpx;
  235. color: #292C33;
  236. }
  237. }
  238. .sub-box {
  239. display: flex;
  240. flex-direction: column;
  241. .sub-title {
  242. display: flex;
  243. align-items: center;
  244. margin-bottom: 15rpx;
  245. height: 20rpx;
  246. &:last-child {
  247. margin-bottom: 34.37rpx;
  248. }
  249. >text {
  250. font-size: 20rpx;
  251. color: #666E80;
  252. }
  253. }
  254. }
  255. &:first-child {
  256. display: flex;
  257. flex-direction: column;
  258. align-items: center;
  259. margin-right: 15rpx;
  260. width: 25rpx;
  261. .plan-icon {
  262. margin-bottom: 17.5rpx;
  263. width: 25rpx;
  264. height: 25rpx;
  265. }
  266. .line {
  267. width: 5rpx;
  268. height: 75rpx;
  269. background-color: #E6EAF2;
  270. }
  271. }
  272. &:last-child {
  273. position: relative;
  274. flex: 1;
  275. .link-view {
  276. position: absolute;
  277. top: 0;
  278. right: 0;
  279. >text {
  280. font-size: 17.5rpx;
  281. color: #3377FF;
  282. }
  283. .blue-arr {
  284. margin-left: 10rpx;
  285. width: 8.12rpx;
  286. height: 15.62rpx;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. .btn-group {
  293. display: flex;
  294. justify-content: space-between;
  295. padding: 0 25rpx;
  296. }
  297. .btn-one {
  298. justify-content: center;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. </style>