mission-action.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="mission-action-page">
  3. <!-- 指派改善任务 -->
  4. <component
  5. :is="currentComponet"
  6. :disabled="disabled"
  7. :values="values"
  8. :btnInfo="btnInfo"
  9. :missionDetails="missionDetails"
  10. :pdcaSetting="pdcaSetting"
  11. @comRequest="comTaskCirculation"
  12. />
  13. </view>
  14. </template>
  15. <script>
  16. import { mapState } from "vuex";
  17. import assignMission from './components/assign-mission.vue';
  18. import disagree from './components/disagree.vue'
  19. import personnel from './components/personnel.vue'
  20. import writeBack from './components/write-back.vue'
  21. import pdca from './components/pdca.vue'
  22. export default {
  23. computed: {
  24. ...mapState({
  25. missionDetails: state => state.mission.missionDetails
  26. })
  27. },
  28. data() {
  29. return {
  30. // 当前显示的组件
  31. currentComponet: 'assign-mission',
  32. // 查看详情回显的数据
  33. values: {},
  34. // 按钮信息
  35. btnInfo: {},
  36. compoentList: [
  37. {type: 1, name: '指派改善任务', component: 'assign-mission'},
  38. {type: 2, name: '原因', component: 'disagree'},
  39. {type: 3, name: '人员架构', component: 'personnel'},
  40. {type: 4, name: '改善回复', component: 'write-back'},
  41. {type: 5, name: 'PDCA', component: 'pdca'},
  42. ],
  43. // pdca类型
  44. pdcaSetting: 'p'
  45. }
  46. },
  47. onLoad({ details }){
  48. this.getComponentInfo(details ? JSON.parse(details) : {});
  49. },
  50. methods: {
  51. // 获取组件信息
  52. getComponentInfo(details) {
  53. console.log('组件数据', details)
  54. const {
  55. nextPermission,
  56. nextPermissionName,
  57. componentName,
  58. disabled,
  59. hasAnyData,
  60. isOutvalueKey,
  61. key,
  62. labelKey,
  63. dataKey,
  64. pdcaSetting
  65. } = details;
  66. this.currentComponet = componentName;
  67. this.disabled = disabled;
  68. if(disabled) { // 查看xx详情
  69. let values = {};
  70. if(hasAnyData){ // 回显数据由多个key组成
  71. dataKey.map(item => {
  72. values[item.labelKey] = (item.isOutvalueKey ? this.missionDetails : details)[item.key];
  73. });
  74. }else {
  75. values[labelKey] = (isOutvalueKey ? this.missionDetails : details)[key]
  76. }
  77. this.values = values;
  78. this.pdcaSetting = pdcaSetting;
  79. this.btnInfo = details;
  80. }else { // 编辑流程
  81. this.btnInfo = details;
  82. }
  83. },
  84. // 公共改善任务接口
  85. comTaskCirculation(data) {
  86. this.$store.dispatch({
  87. type: 'mission/commActions',
  88. payload: {
  89. key: "comTaskCirculation",
  90. data
  91. }
  92. }).then(data1 => {
  93. if(!data1){
  94. let taskId = uni.getStorageSync('taskId');
  95. uni.redirectTo({
  96. url: `/pages/mission-details/mission-details?taskId=${taskId}`
  97. });
  98. }
  99. });
  100. }
  101. },
  102. components: {
  103. assignMission,
  104. disagree,
  105. personnel,
  106. writeBack,
  107. pdca
  108. }
  109. }
  110. </script>
  111. <style lang="less">
  112. .mission-action-page {
  113. height: 100%;
  114. }
  115. </style>