mission-action.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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: '',
  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. const {
  54. nextPermission,
  55. nextPermissionName,
  56. componentName,
  57. disabled,
  58. hasAnyData,
  59. isOutvalueKey,
  60. key,
  61. labelKey,
  62. dataKey,
  63. pdcaSetting
  64. } = details;
  65. this.currentComponet = componentName;
  66. this.disabled = disabled;
  67. if(disabled) { // 查看xx详情
  68. let values = {};
  69. if(hasAnyData){ // 回显数据由多个key组成
  70. dataKey.map(item => {
  71. values[item.labelKey] = (item.isOutvalueKey ? this.missionDetails : details)[item.key];
  72. });
  73. }else {
  74. values[labelKey] = (isOutvalueKey ? this.missionDetails : details)[key]
  75. }
  76. this.values = values;
  77. }else { // 编辑流程
  78. this.btnInfo = details;
  79. }
  80. this.pdcaSetting = pdcaSetting;
  81. },
  82. // 公共改善任务接口
  83. comTaskCirculation(data) {
  84. this.$store.dispatch({
  85. type: 'mission/commActions',
  86. payload: {
  87. key: "comTaskCirculation",
  88. data
  89. }
  90. }).then(data1 => {
  91. if(!data1){
  92. let taskId = uni.getStorageSync('taskId');
  93. uni.redirectTo({
  94. url: `/pages/mission-details/mission-details?taskId=${taskId}`
  95. });
  96. }
  97. });
  98. }
  99. },
  100. components: {
  101. assignMission,
  102. disagree,
  103. personnel,
  104. writeBack,
  105. pdca
  106. }
  107. }
  108. </script>
  109. <style lang="less">
  110. .mission-action-page {
  111. height: 100%;
  112. }
  113. </style>