mission-action.vue 3.4 KB

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