submit.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  37. <span class="el-dropdown-link">
  38. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  39. </span>
  40. <el-dropdown-menu slot="dropdown">
  41. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  42. </el-dropdown-menu>
  43. </el-dropdown>
  44. </div>
  45. </el-col>
  46. </template>
  47. <script>
  48. import {approveTaskWithVariables, cancelTask, rejectTask} from '@/api/bpm/task';
  49. import {cancel} from "@/api/bpm/components/project-manage/task";
  50. // 流程实例的详情页,可用于审批
  51. export default {
  52. name: '',
  53. components: {
  54. // Parser
  55. },
  56. props: {
  57. businessId: {
  58. default: ''
  59. },
  60. taskId: {
  61. default: ''
  62. },
  63. id: {
  64. default: ''
  65. },
  66. taskDefinitionKey: {
  67. default: ''
  68. }
  69. },
  70. data() {
  71. return {
  72. form: {
  73. reason: ''
  74. }
  75. };
  76. },
  77. created() {
  78. },
  79. methods: {
  80. /** 处理转办审批人 */
  81. handleUpdateAssignee() {
  82. this.$emit('handleUpdateAssignee');
  83. },
  84. /** 退回 */
  85. handleBackList() {
  86. this.$emit('handleBackList');
  87. },
  88. async handleAudit(status) {
  89. await this._approveTaskWithVariables(status);
  90. },
  91. async _approveTaskWithVariables(status) {
  92. let variables = {
  93. pass: !!status
  94. };
  95. let API = !!status ? approveTaskWithVariables : rejectTask
  96. API({
  97. id: this.taskId,
  98. reason: this.form.reason,
  99. variables
  100. }).then((res) => {
  101. if (res.data.code != '-1') {
  102. this.$emit('handleAudit', {
  103. status,
  104. title: status === 0 ? '驳回' : ''
  105. });
  106. }
  107. });
  108. },
  109. getTableValue() {
  110. return new Promise((resolve, reject) => {
  111. this.$emit('getTableValue', async (data) => {
  112. resolve(await data);
  113. });
  114. });
  115. },
  116. //更多
  117. handleCommand(command) {
  118. if (command === 'cancel') {
  119. this.$confirm("是否确认作废?", {
  120. type: 'warning',
  121. cancelButtonText: '取消',
  122. confirmButtonText: '确定'
  123. }).then(() => {
  124. cancelTask({
  125. taskId: this.taskId,
  126. id: this.id,
  127. reason: this.form.reason,
  128. businessId: this.businessId,
  129. }).then(() => {
  130. this.$emit('handleClose');
  131. }).catch(() => {
  132. this.$message.error("流程作废失败");
  133. });
  134. }).catch(() => {
  135. });
  136. }
  137. },
  138. }
  139. };
  140. </script>
  141. <style lang="scss"></style>