mission-details.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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 class="plan-icon"
  14. :src="`/static/${i === taskStepLength ? 'check-radio' : 'check-no'}.png`">
  15. </image>
  16. <view class="line" v-show="i != taskStepLength"></view>
  17. </view>
  18. <view class="col">
  19. <view class="title">
  20. <text>{{ getContext(item, false, 'row1') }}</text>
  21. </view>
  22. <view class="sub-box">
  23. <view class="sub-title">
  24. <text>{{ getContext(item, false, 'row2') }}</text>
  25. </view>
  26. <view class="sub-title">
  27. <text>{{ item.recordTime }}</text>
  28. </view>
  29. </view>
  30. <template v-if="getContext(item, true, 'selectDetails')">
  31. <view class="link-view"
  32. @click="goToDetails(item, getContext(item, true, 'selectDetails'))">
  33. <text>{{ getContext(item, true, 'selectDetails').name }}</text>
  34. <image class="blue-arr" src="/static/blue-arrow.png"></image>
  35. </view>
  36. </template>
  37. </view>
  38. </view>
  39. <view :class="['btn-group', taskBtn.length === 1 ?'btn-one' : '']" v-if="missionDetails.buttonDisplayFlag == 1
  40. && missionDetails.pfmTaskCirculationList
  41. && i == missionDetails.pfmTaskCirculationList.length - 1">
  42. <template v-for="(btn, i1) in taskBtn">
  43. <tm-button :key="i1"
  44. :type="taskBtn.length === 1 ? 'default' : ( i1 === 0 ? 'pramary' : 'default')"
  45. :btnText="btn.name" @btnClick="clickBtn(item, btn)" />
  46. </template>
  47. </view>
  48. </template>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. <view class="bottomBtn" @click="goBack">{{botBtnText}}</view>
  53. </view>
  54. </template>
  55. <script>
  56. // 改善任务
  57. import {
  58. mapState
  59. } from "vuex";
  60. import listItem from '../mission/components/list-item.vue';
  61. import taskTypeList from './setting.js';
  62. import pdcaSetting from './pdcaSetting.js'
  63. export default {
  64. computed: {
  65. ...mapState({
  66. missionDetails: state => state.mission.missionDetails
  67. }),
  68. // 进度长度
  69. taskStepLength() {
  70. return (this.missionDetails.pfmTaskCirculationList || []).length - 1;
  71. },
  72. // 获取底部按钮
  73. taskBtn() {
  74. const {
  75. buttonDisplayFlag,
  76. pfmTaskCirculationList,
  77. taskType,
  78. checkResult
  79. } = this.missionDetails;
  80. if (buttonDisplayFlag == 1 && pfmTaskCirculationList && pfmTaskCirculationList.length > 0) {
  81. let task = null;
  82. if (taskType == 1 || taskType == 3) { // 状态为1, 和3比较特殊,需要再比较checkResult
  83. task = taskTypeList.find(item => (item.taskType == taskType && item.checkResult == checkResult));
  84. } else {
  85. task = taskTypeList.find(item => item.taskType == taskType);
  86. }
  87. return task ? task.btnList : []
  88. } else {
  89. return [];
  90. }
  91. }
  92. },
  93. data() {
  94. return {
  95. // 任务id
  96. taskId: '',
  97. botBtnText: '',
  98. // 跳转详情信息
  99. linkTaskDetails: null
  100. }
  101. },
  102. onLoad(option) {
  103. const {
  104. taskId,
  105. pathName
  106. } = option;
  107. this.taskId = taskId;
  108. this.botBtnText = pathName == 'missionDetails' ? '返回改善任务列表' : '返回改善消息列表'
  109. },
  110. created() {
  111. this.getMissionDetails();
  112. },
  113. methods: {
  114. goBack() {
  115. window.history.back();
  116. },
  117. // 获取改善任务列表
  118. getMissionDetails(data) {
  119. this.$store.dispatch({
  120. type: 'mission/commActions',
  121. payload: {
  122. key: "getMissionDetails",
  123. data: {
  124. taskId: this.taskId
  125. }
  126. }
  127. });
  128. },
  129. // 点击按钮
  130. clickBtn(currentInfo, btnInfo) {
  131. if (btnInfo.componentName) { // 有组件名,则跳转页面
  132. if (btnInfo.componentName === 'pdca') {
  133. const {
  134. taskType,
  135. needApproveFlag
  136. } = this.missionDetails;
  137. // needApproveFlag: true 需要审核(p)只显示p
  138. if (taskType === 8) {
  139. btnInfo = {
  140. ...btnInfo,
  141. ...pdcaSetting['pdcaBtnInfo'],
  142. pDisabled: true // plan内容禁用
  143. };
  144. } else if (taskType === 11) {
  145. btnInfo = {
  146. ...btnInfo,
  147. ...pdcaSetting[needApproveFlag ? 'pdcaBtnInfo' : 'pdcaBtnInfo2'],
  148. pDisabled: needApproveFlag // plan内容是否禁用取决于needApproveFlag
  149. };
  150. } else if (taskType === 13) { // 制定改善方案p中(需要回显暂存过的数据)
  151. btnInfo = {
  152. ...btnInfo,
  153. ...pdcaSetting['editPBtnInfo'],
  154. isEdit: true
  155. };
  156. } else if (taskType === 15) { // 制定改善方案pdca中(需要回显暂存过的数据)
  157. btnInfo = {
  158. ...btnInfo,
  159. ...pdcaSetting['editPdcaBtnInfo'],
  160. isEdit: true,
  161. pDisabled: needApproveFlag
  162. };
  163. } else {
  164. // taskType === 4 || taskType === 6 || taskType === 7 || taskType === 9
  165. btnInfo = {
  166. ...btnInfo,
  167. ...pdcaSetting[needApproveFlag ? 'pBtnInfo' : 'pdcaBtnInfo2']
  168. };
  169. }
  170. }
  171. uni.navigateTo({
  172. url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...btnInfo}))}`
  173. });
  174. } else { // 直接调接口
  175. let requestParams = {};
  176. btnInfo.params.map(item => {
  177. if (item.valueKey) {
  178. requestParams[item.paramsKey] = (
  179. item.isOutvalueKey ?
  180. this.missionDetails :
  181. currentInfo
  182. )[item.valueKey];
  183. } else if (item.value) {
  184. requestParams[item.paramsKey] = item.value;
  185. }
  186. })
  187. this.comTaskCirculation(requestParams);
  188. }
  189. },
  190. // 查看详情
  191. goToDetails(currentInfo, detailInfo) {
  192. if (detailInfo.navigateUrl) { // 跳转其他页面(如查核项详情) 目前hasAnyData都为false
  193. const {
  194. navigateUrl,
  195. key,
  196. isOutvalueKey,
  197. hasAnyData
  198. } = detailInfo;
  199. uni.navigateTo({
  200. url: `${detailInfo.navigateUrl}?id=${(isOutvalueKey ? this.missionDetails : currentInfo)[detailInfo.key]}&checkPointId=${this.missionDetails.checkPointId}`
  201. });
  202. } else {
  203. uni.navigateTo({
  204. url: `/pages/mission-action/mission-action?details=${encodeURIComponent(JSON.stringify({...currentInfo, ...detailInfo}))}`
  205. });
  206. }
  207. },
  208. /***
  209. * 解析显示对应的内容
  210. * @param {Object} obj 当前遍历的任务
  211. * @param {Boolean} isLink 是否需要跳转页面(查看详情)
  212. * @param {String} rowKey 任务流程中的key
  213. */
  214. getContext(obj, isLink, rowKey) {
  215. let currentTypeTask = null;
  216. if (obj.taskType == 1) {
  217. const {
  218. checkResult
  219. } = this.missionDetails;
  220. currentTypeTask = taskTypeList.find(item => (item.taskType == obj.taskType && item.checkResult ==
  221. checkResult)) || {};
  222. } else {
  223. currentTypeTask = taskTypeList.find(item => item.taskType == obj.taskType) || {};
  224. }
  225. if (isLink) {
  226. return currentTypeTask[rowKey];
  227. } else {
  228. const {
  229. hasJoin,
  230. name,
  231. key,
  232. isOutvalueKey
  233. } = currentTypeTask[rowKey] || {};
  234. if (hasJoin) { // 需要删除*并替换
  235. return name ? name.replace(/x/g, (isOutvalueKey ? this.missionDetails : obj)[key] || '') : ''
  236. } else {
  237. return name || '';
  238. }
  239. }
  240. },
  241. // 公共改善任务接口
  242. comTaskCirculation(data) {
  243. this.$store.dispatch({
  244. type: 'mission/commActions',
  245. payload: {
  246. key: "comTaskCirculation",
  247. data
  248. }
  249. }).then(data1 => {
  250. if (data1) {
  251. this.getMissionDetails();
  252. }
  253. });
  254. }
  255. },
  256. components: {
  257. listItem
  258. }
  259. }
  260. </script>
  261. <style lang="less">
  262. .mission-details-page {
  263. height: 100%;
  264. padding-top: 15rpx;
  265. .bottomBtn {
  266. position: fixed;
  267. bottom: 0;
  268. width: 100%;
  269. height: 75rpx;
  270. line-height: 75rpx;
  271. text-align: center;
  272. font-size: 22.5rpx;
  273. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  274. font-weight: 400;
  275. color: #FFFFFF;
  276. background: #3377FF;
  277. }
  278. .scroll-y {
  279. height: 100%;
  280. padding-bottom: 87.5rpx;
  281. .mission-plan {
  282. .label {
  283. margin-top: 25rpx;
  284. margin-bottom: 15rpx;
  285. height: 20rpx;
  286. line-height: 20rpx;
  287. padding-left: 25rpx;
  288. text {
  289. font-size: 20rpx;
  290. color: #666F80;
  291. }
  292. }
  293. .plan-box {
  294. padding: 25rpx;
  295. background-color: #fff;
  296. .row {
  297. display: flex;
  298. .col {
  299. .title {
  300. display: flex;
  301. align-items: center;
  302. margin-bottom: 15rpx;
  303. height: 25rpx;
  304. >text {
  305. font-size: 22.5rpx;
  306. color: #292C33;
  307. }
  308. }
  309. .sub-box {
  310. display: flex;
  311. flex-direction: column;
  312. .sub-title {
  313. display: flex;
  314. align-items: center;
  315. margin-bottom: 15rpx;
  316. height: 20rpx;
  317. &:last-child {
  318. margin-bottom: 34.37rpx;
  319. }
  320. >text {
  321. font-size: 20rpx;
  322. color: #666E80;
  323. }
  324. }
  325. }
  326. &:first-child {
  327. display: flex;
  328. flex-direction: column;
  329. align-items: center;
  330. margin-right: 15rpx;
  331. width: 25rpx;
  332. .plan-icon {
  333. margin-bottom: 17.5rpx;
  334. width: 25rpx;
  335. height: 25rpx;
  336. }
  337. .line {
  338. width: 5rpx;
  339. height: 75rpx;
  340. background-color: #E6EAF2;
  341. }
  342. }
  343. &:last-child {
  344. position: relative;
  345. flex: 1;
  346. .link-view {
  347. position: absolute;
  348. top: 0;
  349. right: 0;
  350. >text {
  351. font-size: 17.5rpx;
  352. color: #3377FF;
  353. }
  354. .blue-arr {
  355. margin-left: 10rpx;
  356. width: 8.12rpx;
  357. height: 15.62rpx;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. .btn-group {
  364. display: flex;
  365. justify-content: space-between;
  366. padding: 0 25rpx;
  367. }
  368. .btn-one {
  369. justify-content: center;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. </style>