submit.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. :loading="isLoading"
  26. @click="handleAudit(1)"
  27. >通过
  28. </el-button>
  29. <el-button
  30. icon="el-icon-circle-close"
  31. type="danger"
  32. size="mini"
  33. :loading="isLoading"
  34. @click="handleAudit(0)"
  35. >驳回
  36. </el-button>
  37. </div>
  38. </el-col>
  39. </template>
  40. <script>
  41. import {
  42. approveTaskWithVariables,
  43. outinApproveNotPass
  44. } from '@/api/bpm/task';
  45. export default {
  46. data() {
  47. return {
  48. form: {},
  49. isLoading: false
  50. };
  51. },
  52. props: {
  53. businessId: {
  54. default: ''
  55. },
  56. taskId: {
  57. default: ''
  58. },
  59. id: {
  60. default: ''
  61. },
  62. taskDefinitionKey: {
  63. default: ''
  64. }
  65. },
  66. methods: {
  67. handleAudit(status) {
  68. if (!this.form.reason && status == 1) {
  69. this.$message.warning(`请填写审批意见!`);
  70. return;
  71. }
  72. this._approveTaskWithVariables(status);
  73. },
  74. async _approveTaskWithVariables(status) {
  75. console.log(status);
  76. if (status == 1) {
  77. const params = {
  78. id: this.taskId,
  79. reason: this.form.reason,
  80. variables: { pass: true }
  81. };
  82. // await this.$parent.$parent.$parent.$refs.bziRef.handleSave();
  83. try {
  84. this.isLoading = true;
  85. const data = await approveTaskWithVariables(params);
  86. if (data.data.code != '-1') {
  87. this.$emit('handleAudit', {
  88. status,
  89. title: '通过'
  90. });
  91. this.isLoading = false;
  92. }
  93. } catch (error) {
  94. this.isLoading = false;
  95. }
  96. } else {
  97. const params = {
  98. id: this.taskId,
  99. reason: this.form.reason,
  100. outInId: this.businessId
  101. };
  102. try {
  103. this.isLoading = true;
  104. const data = await outinApproveNotPass(params);
  105. if (data.data.code != '-1') {
  106. this.$emit('handleAudit', {
  107. status,
  108. title: '驳回'
  109. });
  110. }
  111. this.isLoading = false;
  112. } catch (error) {
  113. this.isLoading = false;
  114. }
  115. }
  116. }
  117. }
  118. };
  119. </script>