submit.vue 3.8 KB

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