mission-action.vue 3.4 KB

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