submit.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. v-if="!['starter'].includes(taskDefinitionKey)"
  34. >驳回
  35. </el-button>
  36. <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  37. <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--right"></i></span>
  38. <el-dropdown-menu slot="dropdown">
  39. <el-dropdown-item command="cancel">作废</el-dropdown-item>
  40. </el-dropdown-menu>
  41. </el-dropdown>
  42. <!-- <el-button
  43. icon="el-icon-circle-close"
  44. type="danger"
  45. size="mini"
  46. @click="handleBackList"
  47. >退回
  48. </el-button> -->
  49. <!-- <el-button
  50. icon="el-icon-circle-close"
  51. type="danger"
  52. size="mini"
  53. @click="handleAudit(0)"
  54. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  55. >不通过
  56. </el-button>
  57. <el-button
  58. icon="el-icon-edit-outline"
  59. type="primary"
  60. size="mini"
  61. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  62. @click="handleUpdateAssignee"
  63. >转办
  64. </el-button> -->
  65. </div>
  66. </el-col>
  67. </template>
  68. <script>
  69. import { UpdateInformation, saleOrderProcessCancel } from '@/api/bpm/components/saleManage/saleorder';
  70. import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
  71. // 流程实例的详情页,可用于审批
  72. export default {
  73. name: '',
  74. components: {
  75. // Parser
  76. },
  77. props: {
  78. businessId: {
  79. default: ''
  80. },
  81. taskId: {
  82. default: ''
  83. },
  84. id: {
  85. default: ''
  86. },
  87. id: {
  88. default: ''
  89. },
  90. taskDefinitionKey: {
  91. default: ''
  92. }
  93. },
  94. data() {
  95. return {
  96. form: {
  97. technicianId: '',
  98. reason: ''
  99. }
  100. };
  101. },
  102. created() {},
  103. methods: {
  104. /** 处理转办审批人 */
  105. handleUpdateAssignee() {
  106. this.$emit('handleUpdateAssignee');
  107. },
  108. /** 退回 */
  109. handleBackList() {
  110. this.$emit('handleBackList');
  111. },
  112. async handleAudit(status) {
  113. //发起人补充
  114. if (this.taskDefinitionKey === 'starter') {
  115. let arr = await this.getTableValue();
  116. if (!arr) {
  117. return;
  118. }
  119. let data = await UpdateInformation(arr);
  120. if (data.code != '0') {
  121. return;
  122. }
  123. }
  124. this._approveTaskWithVariables(status);
  125. },
  126. async _approveTaskWithVariables(status) {
  127. let variables = {
  128. pass: !!status
  129. };
  130. let API = !!status ? approveTaskWithVariables : rejectTask;
  131. API({
  132. id: this.taskId,
  133. reason: this.form.reason,
  134. variables
  135. }).then((res) => {
  136. if (res.data.code != '-1') {
  137. this.$emit('handleAudit', {
  138. status,
  139. title: status === 0 ? '驳回' : ''
  140. });
  141. }
  142. });
  143. },
  144. getTableValue() {
  145. return new Promise((resolve, reject) => {
  146. this.$emit('getTableValue', async (data) => {
  147. resolve(await data);
  148. });
  149. });
  150. },
  151. //更多
  152. handleCommand(command) {
  153. if (command === 'cancel') {
  154. this.$confirm("是否确认作废?", {
  155. type: 'warning',
  156. cancelButtonText: '取消',
  157. confirmButtonText: '确定'
  158. }).then(() => {
  159. saleOrderProcessCancel({
  160. id: this.taskId,
  161. reason: this.form.reason,
  162. businessId: this.businessId,
  163. }).then(() => {
  164. this.$emit('handleClose');
  165. }).catch(() => {
  166. this.$message.error("流程作废失败");
  167. });
  168. }).catch(() => {});
  169. }
  170. },
  171. }
  172. };
  173. </script>
  174. <style lang="scss"></style>