submit.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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="!['starter'].includes(taskDefinitionKey)"
  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. // 流程实例的详情页,可用于审批
  53. export default {
  54. name: '',
  55. components: {
  56. },
  57. props: {
  58. businessId: {
  59. default: ''
  60. },
  61. taskId: {
  62. default: ''
  63. },
  64. id: {
  65. default: ''
  66. },
  67. taskDefinitionKey: {
  68. default: ''
  69. }
  70. },
  71. data() {
  72. return {
  73. form: {
  74. reason: ''
  75. },
  76. };
  77. },
  78. created() {
  79. },
  80. methods: {
  81. /** 处理转办审批人 */
  82. handleUpdateAssignee() {
  83. this.$emit('handleUpdateAssignee');
  84. },
  85. /** 退回 */
  86. handleBackList() {
  87. this.$emit('handleBackList');
  88. },
  89. async handleAudit(status, type) {
  90. this._approveTaskWithVariables(status);
  91. },
  92. async _approveTaskWithVariables(status) {
  93. let variables = {
  94. pass: !!status
  95. };
  96. let API = !!status ? approveTaskWithVariables : rejectTask;
  97. API({
  98. id: this.taskId,
  99. reason: this.form.reason,
  100. variables
  101. }).then((res) => {
  102. if (res.data.code != '-1') {
  103. this.$emit('handleAudit', {
  104. status,
  105. title: status === 0 ? '驳回' : ''
  106. });
  107. }
  108. });
  109. },
  110. //更多
  111. handleCommand(command) {
  112. if (command === 'cancel') {
  113. this.$confirm('是否确认作废?', {
  114. type: 'warning',
  115. cancelButtonText: '取消',
  116. confirmButtonText: '确定'
  117. })
  118. .then(() => {
  119. cancel({
  120. id: this.taskId,
  121. reason: this.form.reason,
  122. businessId: this.businessId
  123. })
  124. .then(() => {
  125. this.$emit('handleClose');
  126. })
  127. .catch(() => {
  128. this.$message.error('流程作废失败');
  129. });
  130. })
  131. .catch(() => {});
  132. }
  133. }
  134. }
  135. };
  136. </script>
  137. <style lang="scss"></style>