submit.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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', '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 { UpdateInformation, cancel } from '@/api/bpm/components/purchasingManage/inquiryManage';
  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 (
  119. (this.taskDefinitionKey === 'starter' ||
  120. this.taskDefinitionKey === 'deptLeaderApprove') &&
  121. status === 1
  122. ) {
  123. let arr = await this.getTableValue();
  124. if (!arr) {
  125. return;
  126. }
  127. // if (this.taskDefinitionKey === 'deptLeaderApprove' && !arr.winnerId) {
  128. // this.$message.error('请选择中标单位');
  129. // return;
  130. // }
  131. let data = await UpdateInformation(arr);
  132. // console.log(data)
  133. // return
  134. if (data.code != '0') {
  135. return;
  136. }
  137. }
  138. this._approveTaskWithVariables(status);
  139. },
  140. async _approveTaskWithVariables(status) {
  141. let variables = {
  142. pass: !!status
  143. };
  144. let API = !!status ? approveTaskWithVariables : rejectTask;
  145. API({
  146. id: this.taskId,
  147. reason: this.form.reason,
  148. variables
  149. }).then((res) => {
  150. if (res.data.code != '-1') {
  151. this.$emit('handleAudit', {
  152. status,
  153. title: status === 0 ? '驳回' : ''
  154. });
  155. }
  156. });
  157. },
  158. getTableValue() {
  159. return new Promise((resolve, reject) => {
  160. this.$emit('getTableValue', async (data) => {
  161. resolve(await data);
  162. });
  163. });
  164. },
  165. //更多
  166. handleCommand(command) {
  167. if (command === 'cancel') {
  168. this.$confirm("是否确认作废?", {
  169. type: 'warning',
  170. cancelButtonText: '取消',
  171. confirmButtonText: '确定'
  172. }).then(() => {
  173. cancel({
  174. id: this.taskId,
  175. reason: this.form.reason,
  176. businessId: this.businessId,
  177. }).then(() => {
  178. this.$emit('handleClose');
  179. }).catch(() => {
  180. this.$message.error("流程作废失败");
  181. });
  182. }).catch(() => {});
  183. }
  184. },
  185. }
  186. };
  187. </script>
  188. <style lang="scss"></style>