submit.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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: 'blur'
  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
  34. @command="(command) => handleCommand(command)"
  35. style="margin-left: 30px"
  36. >
  37. <span class="el-dropdown-link"
  38. >更多<i class="el-icon-arrow-down el-icon--right"></i
  39. ></span>
  40. <el-dropdown-menu slot="dropdown">
  41. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  42. </el-dropdown-menu>
  43. </el-dropdown>
  44. </div>
  45. </el-col>
  46. </template>
  47. <script>
  48. import { cancel } from '@/api/bpm/components/supplierManage/contact';
  49. import { approveTaskWithVariables, rejectTask,cancelTask } from '@/api/bpm/task';
  50. import { listAllUserBind } from '@/api/system/organization';
  51. // 流程实例的详情页,可用于审批
  52. export default {
  53. name: '',
  54. components: {
  55. // Parser
  56. },
  57. props: {
  58. businessId: {
  59. default: ''
  60. },
  61. taskId: {
  62. default: ''
  63. },
  64. id: {
  65. default: ''
  66. },
  67. taskDefinitionKey: {
  68. default: ''
  69. }
  70. },
  71. data() {
  72. return {
  73. form: {
  74. technicianId: '',
  75. reason: '同意'
  76. },
  77. userOptions: []
  78. };
  79. },
  80. created() {
  81. this.userOptions = [];
  82. listAllUserBind().then((data) => {
  83. this.userOptions.push(...data);
  84. });
  85. },
  86. methods: {
  87. /** 处理转办审批人 */
  88. handleUpdateAssignee() {
  89. this.$emit('handleUpdateAssignee');
  90. },
  91. /** 退回 */
  92. handleBackList() {
  93. this.$emit('handleBackList');
  94. },
  95. async handleAudit(status) {
  96. //发起人补充
  97. // if (this.taskDefinitionKey === 'starter') {
  98. // await this.getTableValue();
  99. // }
  100. await this._approveTaskWithVariables(status);
  101. },
  102. async _approveTaskWithVariables(status) {
  103. let variables = {
  104. pass: !!status
  105. };
  106. let API = !!status ? approveTaskWithVariables : rejectTask;
  107. API({
  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. })
  135. .then(() => {
  136. cancelTask({
  137. id: this.id,
  138. taskId: this.taskId,
  139. reason: this.form.reason,
  140. businessId: this.businessId
  141. })
  142. .then(() => {
  143. this.$emit('handleClose');
  144. })
  145. .catch(() => {
  146. this.$message.error('流程作废失败');
  147. });
  148. })
  149. .catch(() => {});
  150. }
  151. }
  152. }
  153. };
  154. </script>
  155. <style lang="scss"></style>