submit.vue 4.2 KB

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