mission-action.vue 3.0 KB

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