submit.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. prop="reason"
  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. v-if="!['starter'].includes(taskDefinitionKey)"
  35. >驳回
  36. </el-button>
  37. <el-dropdown
  38. @command="(command) => handleCommand(command)"
  39. style="margin-left: 30px"
  40. >
  41. <span class="el-dropdown-link"
  42. >更多<i class="el-icon-arrow-down el-icon--right"></i
  43. ></span>
  44. <el-dropdown-menu slot="dropdown">
  45. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  46. </el-dropdown-menu>
  47. </el-dropdown>
  48. </div>
  49. </el-col>
  50. </template>
  51. <script>
  52. import { approveTaskWithVariables } from '@/api/bpm/task';
  53. // 流程实例的详情页,可用于审批
  54. export default {
  55. name: '',
  56. components: {
  57. },
  58. props: {
  59. businessId: {
  60. default: ''
  61. },
  62. taskId: {
  63. default: ''
  64. },
  65. id: {
  66. default: ''
  67. },
  68. taskDefinitionKey: {
  69. default: ''
  70. }
  71. },
  72. data() {
  73. return {
  74. form: {
  75. reason: ''
  76. },
  77. };
  78. },
  79. created() {
  80. },
  81. methods: {
  82. /** 处理转办审批人 */
  83. handleUpdateAssignee() {
  84. this.$emit('handleUpdateAssignee');
  85. },
  86. /** 退回 */
  87. handleBackList() {
  88. this.$emit('handleBackList');
  89. },
  90. async handleAudit(status, type) {
  91. this._approveTaskWithVariables(status);
  92. },
  93. async _approveTaskWithVariables(status) {
  94. let variables = {
  95. pass: !!status
  96. };
  97. approveTaskWithVariables({
  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>