submit.vue 4.6 KB

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