submit.vue 3.4 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. style="margin-bottom: 20px"
  7. >
  8. <el-input
  9. type="textarea"
  10. v-model="form.reason"
  11. placeholder="请输入审批建议"
  12. />
  13. </el-form-item>
  14. </el-form>
  15. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  16. <el-button
  17. icon="el-icon-edit-outline"
  18. type="success"
  19. size="mini"
  20. v-click-once
  21. @click="handleAudit(1)"
  22. >通过
  23. </el-button>
  24. <el-button
  25. icon="el-icon-circle-close"
  26. type="danger"
  27. size="mini"
  28. v-click-once
  29. @click="handleAudit(0)"
  30. >驳回
  31. </el-button>
  32. <el-dropdown
  33. @command="(command) => handleCommand(command)"
  34. style="margin-left: 30px"
  35. >
  36. <span class="el-dropdown-link"
  37. >更多<i class="el-icon-arrow-down el-icon--right"></i
  38. ></span>
  39. <el-dropdown-menu slot="dropdown">
  40. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  41. </el-dropdown-menu>
  42. </el-dropdown>
  43. </div>
  44. </el-col>
  45. </template>
  46. <script>
  47. import { cancel } from '@/api/bpm/components/supplierManage/contact';
  48. import { approveTaskWithVariables, rejectTask,cancelTask } from '@/api/bpm/task';
  49. // 流程实例的详情页,可用于审批
  50. export default {
  51. name: '',
  52. components: {
  53. // Parser
  54. },
  55. props: {
  56. businessId: {
  57. default: ''
  58. },
  59. taskId: {
  60. default: ''
  61. },
  62. id: {
  63. default: ''
  64. },
  65. taskDefinitionKey: {
  66. default: ''
  67. }
  68. },
  69. data() {
  70. return {
  71. form: {
  72. technicianId: '',
  73. reason: '同意'
  74. },
  75. };
  76. },
  77. methods: {
  78. /** 处理转办审批人 */
  79. handleUpdateAssignee() {
  80. this.$emit('handleUpdateAssignee');
  81. },
  82. /** 退回 */
  83. handleBackList() {
  84. this.$emit('handleBackList');
  85. },
  86. async handleAudit(status) {
  87. await this._approveTaskWithVariables(status);
  88. },
  89. async _approveTaskWithVariables(status) {
  90. let variables = {
  91. pass: !!status
  92. };
  93. let API = !!status ? approveTaskWithVariables : rejectTask;
  94. API({
  95. id: this.taskId,
  96. reason: this.form.reason,
  97. variables
  98. }).then((res) => {
  99. if (res.data.code != '-1') {
  100. this.$emit('handleAudit', {
  101. status,
  102. title: status === 0 ? '驳回' : ''
  103. });
  104. }
  105. });
  106. },
  107. //更多
  108. handleCommand(command) {
  109. if (command === 'cancel') {
  110. this.$confirm('是否确认作废?', {
  111. type: 'warning',
  112. cancelButtonText: '取消',
  113. confirmButtonText: '确定'
  114. })
  115. .then(() => {
  116. cancelTask({
  117. id: this.id,
  118. taskId: this.taskId,
  119. reason: this.form.reason,
  120. businessId: this.businessId
  121. })
  122. .then(() => {
  123. this.$emit('handleClose');
  124. })
  125. .catch(() => {
  126. this.$message.error('流程作废失败');
  127. });
  128. })
  129. .catch(() => {});
  130. }
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss"></style>