submit.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <el-col :span="16" :offset="6">
  3. <el-form label-width="100px" ref="formRef" :model="form">
  4. <el-form-item label="审批建议" style="margin-bottom: 20px">
  5. <el-input
  6. type="textarea"
  7. v-model="form.reason"
  8. placeholder="请输入审批建议"
  9. />
  10. </el-form-item>
  11. </el-form>
  12. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  13. <el-button
  14. icon="el-icon-edit-outline"
  15. type="success"
  16. size="mini"
  17. v-click-once
  18. @click="handleAudit(1)"
  19. v-if="!['storeManagerApprove'].includes(taskDefinitionKey)"
  20. >通过
  21. </el-button>
  22. <el-button
  23. icon="el-icon-circle-close"
  24. type="danger"
  25. size="mini"
  26. v-click-once
  27. @click="rejectTask(0)"
  28. >驳回
  29. </el-button>
  30. <!-- <el-button
  31. icon="el-icon-circle-close"
  32. type="danger"
  33. size="mini"
  34. @click="handleBackList"
  35. >退回
  36. </el-button> -->
  37. <!-- <el-button
  38. icon="el-icon-circle-close"
  39. type="danger"
  40. size="mini"
  41. @click="handleAudit(0)"
  42. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  43. >不通过
  44. </el-button>
  45. <el-button
  46. icon="el-icon-edit-outline"
  47. type="primary"
  48. size="mini"
  49. v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
  50. @click="handleUpdateAssignee"
  51. >转办
  52. </el-button> -->
  53. </div>
  54. </el-col>
  55. </template>
  56. <script>
  57. import {
  58. approveTaskWithVariables,
  59. rejectTask,
  60. cancelTask
  61. } from '@/api/bpm/task';
  62. import { generateReport } from '@/api/bpm/components/qualityReportApproval/qualityReportApproval';
  63. // 流程实例的详情页,可用于审批
  64. export default {
  65. name: '',
  66. components: {},
  67. props: {
  68. businessId: {
  69. default: ''
  70. },
  71. taskId: {
  72. default: ''
  73. },
  74. id: {
  75. default: ''
  76. },
  77. taskDefinitionKey: {
  78. default: ''
  79. },
  80. businessType: {
  81. default: ''
  82. }
  83. },
  84. data() {
  85. return {
  86. form: {
  87. reason: '同意'
  88. },
  89. isSaveLoading: false
  90. };
  91. },
  92. created() {},
  93. methods: {
  94. /** 处理转办审批人 */
  95. handleUpdateAssignee() {
  96. this.$emit('handleUpdateAssignee');
  97. },
  98. /** 退回 */
  99. handleBackList() {
  100. this.$emit('handleBackList');
  101. },
  102. async handleAudit(status) {
  103. if (this.businessType?.includes('检测报告单')) {
  104. const data = await this.getTableValue();
  105. if (data == 'isNodisposeType') {
  106. this.$message.warning('有不合格品未处置,请检查!');
  107. return;
  108. }
  109. await generateReport(data);
  110. console.log(data, 'dasdsa');
  111. }
  112. let API = !!status ? approveTaskWithVariables : rejectTask;
  113. await API({
  114. id: this.taskId,
  115. reason: this.form.reason,
  116. variables: {
  117. // userId: userInfo?.id,
  118. pass: !!status
  119. }
  120. });
  121. this.$emit('handleAudit', {
  122. status,
  123. title: status === 0 ? '驳回' : ''
  124. });
  125. },
  126. async rejectTask(status) {
  127. await rejectTask({
  128. id: this.taskId,
  129. reason: this.form.reason,
  130. variables: {
  131. pass: !!status
  132. }
  133. });
  134. this.$emit('handleAudit', {
  135. status,
  136. title: status === 0 ? '驳回' : ''
  137. });
  138. },
  139. getTableValue() {
  140. return new Promise((resolve, reject) => {
  141. this.$emit('getTableValue', async (data) => {
  142. resolve(await data);
  143. });
  144. });
  145. },
  146. //更多
  147. handleCommand(command) {
  148. if (command === 'cancel') {
  149. this.$confirm('是否确认作废?', {
  150. type: 'warning',
  151. cancelButtonText: '取消',
  152. confirmButtonText: '确定'
  153. })
  154. .then(() => {
  155. cancelTask({
  156. id: this.id,
  157. taskId: this.taskId,
  158. reason: this.form.reason,
  159. businessId: this.businessId
  160. })
  161. .then(() => {
  162. this.$emit('handleClose');
  163. })
  164. .catch(() => {
  165. this.$message.error('流程作废失败');
  166. });
  167. })
  168. .catch(() => {});
  169. }
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss"></style>