submit.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. <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', 'starterFillApprove'].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 { cancel} from '@/api/bpm/components/supplierManage/contact';
  70. import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
  71. import {listAllUserBind} from '@/api/system/organization';
  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. userOptions: []
  99. };
  100. },
  101. created() {
  102. this.userOptions = [];
  103. listAllUserBind().then((data) => {
  104. this.userOptions.push(...data);
  105. });
  106. },
  107. methods: {
  108. /** 处理转办审批人 */
  109. handleUpdateAssignee() {
  110. this.$emit('handleUpdateAssignee');
  111. },
  112. /** 退回 */
  113. handleBackList() {
  114. this.$emit('handleBackList');
  115. },
  116. async handleAudit(status) {
  117. //发起人补充
  118. // if (this.taskDefinitionKey === 'starter') {
  119. // await this.getTableValue();
  120. // }
  121. await this._approveTaskWithVariables(status);
  122. },
  123. async _approveTaskWithVariables(status) {
  124. let variables = {
  125. pass: !!status
  126. };
  127. let API = !!status ? approveTaskWithVariables : rejectTask;
  128. API({
  129. id: this.taskId,
  130. reason: this.form.reason,
  131. variables
  132. }).then((res) => {
  133. if (res.data.code != '-1') {
  134. this.$emit('handleAudit', {
  135. status,
  136. title: status === 0 ? '驳回' : ''
  137. });
  138. }
  139. });
  140. },
  141. getTableValue() {
  142. return new Promise((resolve, reject) => {
  143. this.$emit('getTableValue', async (data) => {
  144. resolve(await data);
  145. });
  146. });
  147. },
  148. //更多
  149. handleCommand(command) {
  150. if (command === 'cancel') {
  151. this.$confirm("是否确认作废?", {
  152. type: 'warning',
  153. cancelButtonText: '取消',
  154. confirmButtonText: '确定'
  155. }).then(() => {
  156. cancel({
  157. id: this.taskId,
  158. reason: this.form.reason,
  159. businessId: this.businessId,
  160. }).then(() => {
  161. this.$emit('handleClose');
  162. }).catch(() => {
  163. this.$message.error("流程作废失败");
  164. });
  165. }).catch(() => {
  166. });
  167. }
  168. },
  169. }
  170. };
  171. </script>
  172. <style lang="scss"></style>