submit.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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
  6. label="审批建议"
  7. style="margin-bottom: 20px"
  8. :rules="{
  9. required: true,
  10. message: '请选择',
  11. trigger: 'change'
  12. }"
  13. >
  14. <el-input
  15. type="textarea"
  16. v-model="form.reason"
  17. placeholder="请输入审批建议"
  18. />
  19. </el-form-item>
  20. </el-form>
  21. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  22. <el-button
  23. icon="el-icon-edit-outline"
  24. type="success"
  25. size="mini"
  26. @click="handleAudit(1)"
  27. >通过
  28. </el-button>
  29. <el-button
  30. icon="el-icon-circle-close"
  31. type="danger"
  32. size="mini"
  33. @click="handleAudit(0)"
  34. >驳回
  35. </el-button>
  36. </div>
  37. </el-col>
  38. </template>
  39. <script>
  40. import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
  41. import { deviceNotPass, batchUpdate } from '@/api/bpm/components/bomApprover';
  42. // 流程实例的详情页,可用于审批
  43. export default {
  44. name: '',
  45. components: {},
  46. props: {
  47. businessId: {
  48. default: ''
  49. },
  50. taskId: {
  51. default: ''
  52. },
  53. id: {
  54. default: ''
  55. },
  56. taskDefinitionKey: {
  57. default: ''
  58. }
  59. },
  60. data() {
  61. return {
  62. form: {
  63. reason: ''
  64. }
  65. };
  66. },
  67. created() {},
  68. methods: {
  69. async handleAudit(status) {
  70. this._approveTaskWithVariables(status);
  71. },
  72. async _approveTaskWithVariables(status) {
  73. if (status == 1) {
  74. let API = !!status ? approveTaskWithVariables : rejectTask;
  75. API({
  76. businessId: this.businessId,
  77. id: this.taskId,
  78. reason: this.form.reason,
  79. variables: { pass: true }
  80. }).then((res) => {
  81. if (res.data.code != '-1') {
  82. this.updateDate()
  83. this.$emit('handleAudit', {
  84. status,
  85. title: ''
  86. });
  87. }
  88. });
  89. } else if (status == 0) {
  90. deviceNotPass({
  91. businessId: this.businessId,
  92. id: this.taskId,
  93. reason: this.form.reason
  94. }).then((res) => {
  95. if (res.data.code != '-1') {
  96. this.$emit('handleAudit', {
  97. status,
  98. title: '驳回'
  99. });
  100. }
  101. });
  102. }
  103. },
  104. async updateDate() {
  105. let LL = await this.getTableValue();
  106. if (this.taskDefinitionKey == 'Activity_0uypakw') {
  107. let _LL = LL.map((m) => {
  108. return {
  109. id: m.id,
  110. materielDesignation: m.materielDesignation
  111. };
  112. });
  113. if (_LL.length > 0) {
  114. batchUpdate(_LL).then(() => {});
  115. }
  116. } else {
  117. let _LL = LL.map((m) => {
  118. return {
  119. id: m.id,
  120. supplierId: m.supplierId
  121. };
  122. });
  123. if (_LL.length > 0) {
  124. batchUpdate(_LL).then(() => {});
  125. }
  126. }
  127. },
  128. getTableValue() {
  129. return new Promise((resolve, reject) => {
  130. this.$emit('getTableValue', async (data) => {
  131. resolve(await data);
  132. });
  133. });
  134. }
  135. }
  136. };
  137. </script>
  138. <style lang="scss"></style>