mission-action.vue 3.3 KB

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