submit.vue 4.7 KB

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