submit.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. v-click-once
  26. @click="handleAudit(1)"
  27. >通过
  28. </el-button>
  29. <el-button
  30. icon="el-icon-circle-close"
  31. type="danger"
  32. size="mini"
  33. v-click-once
  34. @click="handleAudit(0)"
  35. v-if="!['starter'].includes(taskDefinitionKey)"
  36. >驳回
  37. </el-button>
  38. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  39. <span class="el-dropdown-link">
  40. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  41. </span>
  42. <el-dropdown-menu slot="dropdown">
  43. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  44. </el-dropdown-menu>
  45. </el-dropdown>
  46. </div>
  47. </el-col>
  48. </template>
  49. <script>
  50. import {approveTaskWithVariables, cancelTask} from '@/api/bpm/task';
  51. import {cancel} from "@/api/bpm/components/project-manage/task";
  52. // 流程实例的详情页,可用于审批
  53. export default {
  54. name: '',
  55. components: {
  56. // Parser
  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) {
  91. await this._approveTaskWithVariables(status);
  92. },
  93. async _approveTaskWithVariables(status) {
  94. let variables = {
  95. pass: !!status
  96. };
  97. let API = !!status ? approveTaskWithVariables : rejectTask
  98. API({
  99. id: this.taskId,
  100. reason: this.form.reason,
  101. variables
  102. }).then((res) => {
  103. if (res.data.code != '-1') {
  104. this.$emit('handleAudit', {
  105. status,
  106. title: status === 0 ? '驳回' : ''
  107. });
  108. }
  109. });
  110. },
  111. getTableValue() {
  112. return new Promise((resolve, reject) => {
  113. this.$emit('getTableValue', async (data) => {
  114. resolve(await data);
  115. });
  116. });
  117. },
  118. //更多
  119. handleCommand(command) {
  120. if (command === 'cancel') {
  121. this.$confirm("是否确认作废?", {
  122. type: 'warning',
  123. cancelButtonText: '取消',
  124. confirmButtonText: '确定'
  125. }).then(() => {
  126. cancelTask({
  127. taskId: this.taskId,
  128. id: this.id,
  129. reason: this.form.reason,
  130. businessId: this.businessId,
  131. }).then(() => {
  132. this.$emit('handleClose');
  133. }).catch(() => {
  134. this.$message.error("流程作废失败");
  135. });
  136. }).catch(() => {
  137. });
  138. }
  139. },
  140. }
  141. };
  142. </script>
  143. <style lang="scss"></style>