submit.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. v-click-once
  26. @click="handleAudit(1)"
  27. >通过
  28. </el-button>
  29. <el-button
  30. icon="el-icon-circle-close"
  31. type="danger"
  32. size="mini"
  33. v-click-once
  34. @click="handleAudit(0)"
  35. v-if="taskDefinitionKey != 'starter'"
  36. >驳回
  37. </el-button>
  38. </div>
  39. </el-col>
  40. </template>
  41. <script>
  42. import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
  43. import dictMixins from '@/mixins/dictMixins';
  44. // 流程实例的详情页,可用于审批
  45. export default {
  46. mixins: [dictMixins],
  47. name: '',
  48. components: {
  49. // Parser
  50. },
  51. props: {
  52. businessId: {
  53. default: ''
  54. },
  55. taskId: {
  56. default: ''
  57. },
  58. id: {
  59. default: ''
  60. },
  61. taskDefinitionKey: {
  62. default: ''
  63. }
  64. },
  65. data() {
  66. return {
  67. form: {
  68. reason: '同意'
  69. }
  70. };
  71. },
  72. created() {},
  73. methods: {
  74. async handleAudit(status) {
  75. await this._approveTaskWithVariables(status);
  76. },
  77. async _approveTaskWithVariables(status) {
  78. let variables = {
  79. pass: !!status
  80. };
  81. let API = !!status ? approveTaskWithVariables : rejectTask;
  82. API({
  83. id: this.taskId,
  84. reason: this.form.reason,
  85. variables
  86. }).then((res) => {
  87. if (res.data.code != '-1') {
  88. this.$emit('handleAudit', {
  89. status,
  90. title: status === 0 ? '驳回' : ''
  91. });
  92. }
  93. });
  94. }
  95. }
  96. };
  97. </script>
  98. <style lang="scss"></style>