submit.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <!--流程标识: bom_release_device 器械bom -->
  3. <el-col :span="16" :offset="6">
  4. <el-form label-width="100px" ref="formRef" :model="form">
  5. <el-form-item label="审批建议" prop="reason" style="margin-bottom: 20px" :rules="{
  6. required: true,
  7. message: '请选择',
  8. trigger: 'change'
  9. }">
  10. <el-input type="textarea" v-model="form.reason" placeholder="请输入审批建议" />
  11. </el-form-item>
  12. </el-form>
  13. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  14. <el-button icon="el-icon-edit-outline" type="success" size="mini" @click="handleAudit(1)">通过
  15. </el-button>
  16. <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleAudit(0)">驳回
  17. </el-button>
  18. </div>
  19. </el-col>
  20. </template>
  21. <script>
  22. import { approveTaskWithVariables } from '@/api/bpm/task';
  23. import { notPass } from '@/api/bpm/components/bomApprover';
  24. // 流程实例的详情页,可用于审批
  25. export default {
  26. name: '',
  27. components: {
  28. },
  29. props: {
  30. businessId: {
  31. default: ''
  32. },
  33. taskId: {
  34. default: ''
  35. },
  36. id: {
  37. default: ''
  38. },
  39. taskDefinitionKey: {
  40. default: ''
  41. }
  42. },
  43. data() {
  44. return {
  45. form: {
  46. reason: ''
  47. },
  48. };
  49. },
  50. created() {
  51. },
  52. methods: {
  53. async handleAudit(status) {
  54. this._approveTaskWithVariables(status);
  55. },
  56. async _approveTaskWithVariables(status) {
  57. if (status == 1) {
  58. approveTaskWithVariables({
  59. businessId: this.businessId,
  60. id: this.taskId,
  61. reason: this.form.reason,
  62. variables: { pass: true }
  63. }).then((res) => {
  64. if (res.data.code != '-1') {
  65. this.$emit('handleAudit', {
  66. status,
  67. title: ''
  68. });
  69. }
  70. });
  71. } else if (status == 0) {
  72. notPass({
  73. businessId: this.businessId,
  74. id: this.taskId,
  75. reason: this.form.reason,
  76. }).then((res) => {
  77. if (res.data.code != '-1') {
  78. this.$emit('handleAudit', {
  79. status,
  80. title: '驳回'
  81. });
  82. }
  83. });
  84. }
  85. },
  86. getTableValue() {
  87. return new Promise((resolve, reject) => {
  88. this.$emit('getTableValue', async (data) => {
  89. resolve(await data);
  90. });
  91. });
  92. },
  93. }
  94. };
  95. </script>
  96. <style lang="scss"></style>