submit.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <el-col :span="16" :offset="6">
  3. <el-form label-width="100px" ref="formRef" :model="form">
  4. <el-form-item
  5. label="审批建议"
  6. style="margin-bottom: 20px"
  7. :rules="{
  8. required: true,
  9. message: '请选择',
  10. trigger: 'change'
  11. }"
  12. >
  13. <el-input
  14. type="textarea"
  15. v-model="form.reason"
  16. placeholder="请输入审批建议"
  17. />
  18. </el-form-item>
  19. </el-form>
  20. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  21. <el-button
  22. icon="el-icon-edit-outline"
  23. type="success"
  24. size="mini"
  25. @click="handleAudit(1)"
  26. >通过
  27. </el-button>
  28. <el-button
  29. icon="el-icon-circle-close"
  30. type="danger"
  31. size="mini"
  32. @click="handleAudit(0)"
  33. v-if="taskDefinitionKey != 'starter'"
  34. >驳回
  35. </el-button>
  36. <!-- <el-dropdown
  37. @command="(command) => handleCommand(command)"
  38. style="margin-left: 30px"
  39. >
  40. <span class="el-dropdown-link">
  41. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  42. </span>
  43. <el-dropdown-menu slot="dropdown">
  44. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  45. </el-dropdown-menu>
  46. </el-dropdown> -->
  47. </div>
  48. </el-col>
  49. </template>
  50. <script>
  51. import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
  52. import dictMixins from '@/mixins/dictMixins';
  53. import { questionSave } from '@/api/bpm/components/changeManagement/question';
  54. import { requestSave } from '@/api/bpm/components/changeManagement/request';
  55. import { noticeSave } from '@/api/bpm/components/changeManagement/notice';
  56. // import {
  57. // assign,
  58. // cancel
  59. // } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
  60. // 流程实例的详情页,可用于审批
  61. export default {
  62. mixins: [dictMixins],
  63. name: '',
  64. components: {
  65. // Parser
  66. },
  67. props: {
  68. businessId: {
  69. default: ''
  70. },
  71. taskId: {
  72. default: ''
  73. },
  74. id: {
  75. default: ''
  76. },
  77. taskDefinitionKey: {
  78. default: ''
  79. }
  80. },
  81. data() {
  82. return {
  83. form: {
  84. reason: ''
  85. }
  86. };
  87. },
  88. created() {},
  89. methods: {
  90. async handleAudit(status) {
  91. //申请人申请
  92. if (this.taskDefinitionKey === 'starter') {
  93. const data = await this.getTableValue();
  94. let api=data.objType==1?questionSave:data.objType==2?requestSave:noticeSave
  95. // return
  96. if (data) {
  97. await api(data);
  98. }
  99. }
  100. await this._approveTaskWithVariables(status);
  101. },
  102. async _approveTaskWithVariables(status) {
  103. let variables = {
  104. pass: !!status
  105. };
  106. let API = !!status ? approveTaskWithVariables : rejectTask;
  107. API({
  108. id: this.taskId,
  109. reason: this.form.reason,
  110. variables
  111. }).then((res) => {
  112. if (res.data.code != '-1') {
  113. this.$emit('handleAudit', {
  114. status,
  115. title: status === 0 ? '驳回' : ''
  116. });
  117. }
  118. });
  119. },
  120. getTableValue() {
  121. return new Promise((resolve, reject) => {
  122. this.$emit('getTableValue', async (data) => {
  123. resolve(await data);
  124. });
  125. });
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss"></style>