mission-action.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. disabled: false,
  33. // 查看详情回显的数据
  34. values: {},
  35. // 按钮信息
  36. btnInfo: {},
  37. compoentList: [
  38. {type: 1, name: '指派改善任务', component: 'assign-mission'},
  39. {type: 2, name: '原因', component: 'disagree'},
  40. {type: 3, name: '人员架构', component: 'personnel'},
  41. {type: 4, name: '改善回复', component: 'write-back'},
  42. {type: 5, name: 'PDCA', component: 'pdca'}
  43. ],
  44. // pdca类型
  45. pdcaSetting: 'p'
  46. }
  47. },
  48. onLoad({ details }){
  49. this.getComponentInfo(details ? JSON.parse(details) : {});
  50. },
  51. methods: {
  52. // 获取组件信息
  53. getComponentInfo(details) {
  54. const {
  55. nextPermission,
  56. nextPermissionName,
  57. componentName,
  58. disabled,
  59. hasAnyData,
  60. isOutvalueKey,
  61. key,
  62. labelKey,
  63. dataKey,
  64. pdcaSetting,
  65. isEdit,
  66. params
  67. } = details;
  68. this.currentComponet = componentName;
  69. this.disabled = disabled;
  70. if(disabled) { // 查看xx详情
  71. let values = {};
  72. if(hasAnyData){ // 回显数据由多个key组成
  73. dataKey.map(item => {
  74. values[item.labelKey] = (item.isOutvalueKey ? this.missionDetails : details)[item.key];
  75. });
  76. }else {
  77. values[labelKey] = (isOutvalueKey ? this.missionDetails : details)[key]
  78. }
  79. this.values = values;
  80. }else { // 编辑流程
  81. this.btnInfo = details;
  82. // if(isEdit) { // 之前暂存过,需要先回显数据
  83. let values = {};
  84. params && params.map(item => {
  85. if(item.labelKey){
  86. values[item.labelKey] = details[item.valueKey];
  87. }
  88. });
  89. this.values = values;
  90. // }
  91. }
  92. this.pdcaSetting = pdcaSetting;
  93. },
  94. // 公共改善任务接口
  95. comTaskCirculation(data) {
  96. this.$store.dispatch({
  97. type: 'mission/commActions',
  98. payload: {
  99. key: "comTaskCirculation",
  100. data
  101. }
  102. }).then(data1 => {
  103. if(data1){
  104. let taskId = uni.getStorageSync('taskId');
  105. uni.redirectTo({
  106. url: `/pages/mission-details/mission-details?taskId=${taskId}`
  107. });
  108. }
  109. });
  110. }
  111. },
  112. components: {
  113. assignMission,
  114. disagree,
  115. personnel,
  116. writeBack,
  117. pdca
  118. }
  119. }
  120. </script>
  121. <style lang="less">
  122. .mission-action-page {
  123. height: 100%;
  124. }
  125. </style>