submit.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. >驳回
  34. </el-button>
  35. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  36. <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--right"></i></span>
  37. <el-dropdown-menu slot="dropdown">
  38. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  39. </el-dropdown-menu>
  40. </el-dropdown>
  41. </div>
  42. </el-col>
  43. </template>
  44. <script>
  45. import { UpdateInformation, cancel } from '@/api/bpm/components/contractManage/contractBook';
  46. import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
  47. import { listAllUserBind } from '@/api/system/organization';
  48. // 流程实例的详情页,可用于审批
  49. export default {
  50. name: '',
  51. components: {
  52. // Parser
  53. },
  54. props: {
  55. businessId: {
  56. default: ''
  57. },
  58. taskId: {
  59. default: ''
  60. },
  61. id: {
  62. default: ''
  63. },
  64. taskDefinitionKey: {
  65. default: ''
  66. }
  67. },
  68. data() {
  69. return {
  70. form: {
  71. technicianId: '',
  72. reason: ''
  73. },
  74. userOptions: []
  75. };
  76. },
  77. created() {
  78. this.userOptions = [];
  79. listAllUserBind().then((data) => {
  80. this.userOptions.push(...data);
  81. });
  82. },
  83. methods: {
  84. /** 处理转办审批人 */
  85. handleUpdateAssignee() {
  86. this.$emit('handleUpdateAssignee');
  87. },
  88. /** 退回 */
  89. handleBackList() {
  90. this.$emit('handleBackList');
  91. },
  92. async handleAudit(status) {
  93. let variables = {
  94. pass: !!status
  95. };
  96. let API = !!status ? approveTaskWithVariables : rejectTask;
  97. API({
  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. getTableValue() {
  111. return new Promise((resolve, reject) => {
  112. this.$emit('getTableValue', async (data) => {
  113. resolve(await data);
  114. });
  115. });
  116. },
  117. //更多
  118. handleCommand(command) {
  119. if (command === 'cancel') {
  120. this.$confirm("是否确认作废?", {
  121. type: 'warning',
  122. cancelButtonText: '取消',
  123. confirmButtonText: '确定'
  124. }).then(() => {
  125. cancel({
  126. id: this.taskId,
  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. </script>
  140. <style lang="scss"></style>