mission-action.vue 3.4 KB

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