submit.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. prop="reason"
  7. style="margin-bottom: 20px"
  8. :rules="{
  9. required: true,
  10. message: '请选择',
  11. trigger: 'change'
  12. }"
  13. >
  14. <el-input
  15. type="textarea"
  16. v-model="form.reason"
  17. placeholder="请输入审批建议"
  18. />
  19. </el-form-item>
  20. </el-form>
  21. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  22. <el-button
  23. icon="el-icon-edit-outline"
  24. type="success"
  25. size="mini"
  26. @click="handleAudit(1)"
  27. >通过
  28. </el-button>
  29. <el-button
  30. icon="el-icon-circle-close"
  31. type="danger"
  32. size="mini"
  33. @click="handleAudit(0)"
  34. v-if="!['starter'].includes(taskDefinitionKey)"
  35. >驳回
  36. </el-button>
  37. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  38. <span class="el-dropdown-link">
  39. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  40. </span>
  41. <el-dropdown-menu slot="dropdown">
  42. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  43. </el-dropdown-menu>
  44. </el-dropdown>
  45. </div>
  46. </el-col>
  47. </template>
  48. <script>
  49. import { UpdateInformation, cancel } from '@/api/bpm/components/purchasingManage/purchaseNeedManage';
  50. import { approveTaskWithVariables } from '@/api/bpm/task';
  51. import {projectsUpdateAPI} from "@/api/bpm/components/project-manage";
  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. methods: {
  81. /** 处理转办审批人 */
  82. handleUpdateAssignee() {
  83. this.$emit('handleUpdateAssignee');
  84. },
  85. /** 退回 */
  86. handleBackList() {
  87. this.$emit('handleBackList');
  88. },
  89. async handleAudit(status) {
  90. //发起人
  91. if (this.taskDefinitionKey === 'starter') {
  92. let arr = await this.getTableValue();
  93. if (!arr) {
  94. return;
  95. }
  96. let data = await projectsUpdateAPI(arr);
  97. if (data.code != '0') {
  98. return;
  99. }
  100. }
  101. await this._approveTaskWithVariables(status);
  102. },
  103. async _approveTaskWithVariables(status) {
  104. let variables = {
  105. pass: !!status
  106. };
  107. approveTaskWithVariables({
  108. id: this.taskId,
  109. reason: this.form.reason,
  110. variables
  111. }).then((res) => {
  112. if (res.data.code != '-1') {
  113. this.$emit('handleAudit', {
  114. status,
  115. title: status === 0 ? '驳回' : ''
  116. });
  117. }
  118. });
  119. },
  120. getTableValue() {
  121. return new Promise((resolve, reject) => {
  122. this.$emit('getTableValue', async (data) => {
  123. resolve(await data);
  124. });
  125. });
  126. },
  127. //更多
  128. handleCommand(command) {
  129. if (command === 'cancel') {
  130. this.$confirm("是否确认作废?", {
  131. type: 'warning',
  132. cancelButtonText: '取消',
  133. confirmButtonText: '确定'
  134. }).then(() => {
  135. cancel({
  136. id: this.taskId,
  137. reason: this.form.reason,
  138. businessId: this.businessId,
  139. }).then(() => {
  140. this.$emit('handleClose');
  141. }).catch(() => {
  142. this.$message.error("流程作废失败");
  143. });
  144. }).catch(() => {});
  145. }
  146. },
  147. }
  148. };
  149. </script>
  150. <style lang="scss"></style>