submit.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 @command="(command) => handleCommand(command)" style="margin-left: 30px;">
  38. <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--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. </div>
  44. </el-col>
  45. </template>
  46. <script>
  47. import { UpdateInformation, cancel } from '@/api/bpm/components/contractManage/contractBook';
  48. import {approveTaskWithVariables, rejectTask,cancelTask} from '@/api/bpm/task';
  49. import { listAllUserBind } from '@/api/system/organization';
  50. import { noticeDocumentUpdateAPI } from '@/api/documents/noticeIssuance/index.js';
  51. // 流程实例的详情页,可用于审批
  52. export default {
  53. name: '',
  54. components: {
  55. // Parser
  56. },
  57. props: {
  58. businessId: {
  59. default: ''
  60. },
  61. taskId: {
  62. default: ''
  63. },
  64. id: {
  65. default: ''
  66. },
  67. taskDefinitionKey: {
  68. default: ''
  69. }
  70. },
  71. data() {
  72. return {
  73. form: {
  74. reason: '同意'
  75. },
  76. userOptions: []
  77. };
  78. },
  79. created() {
  80. this.userOptions = [];
  81. listAllUserBind().then((data) => {
  82. this.userOptions.push(...data);
  83. });
  84. },
  85. methods: {
  86. /** 处理转办审批人 */
  87. handleUpdateAssignee() {
  88. this.$emit('handleUpdateAssignee');
  89. },
  90. /** 退回 */
  91. handleBackList() {
  92. this.$emit('handleBackList');
  93. },
  94. async handleAudit(status) {
  95. // 通过前先更新公文信息
  96. if (status == 1) {
  97. try {
  98. const loading = this.$loading({ lock: true, text: '正在更新公文信息...' });
  99. let formData = await this.getTableValue();
  100. console.log('formData~~~', formData);
  101. await noticeDocumentUpdateAPI(formData);
  102. loading.close();
  103. } catch (e) {
  104. this.$message.error('更新公文信息失败,请重试');
  105. return;
  106. }
  107. }
  108. let variables = {
  109. pass: !!status
  110. };
  111. let API = !!status ? approveTaskWithVariables : rejectTask;
  112. console.log('this.taskId~~', this.form);
  113. API({
  114. id: this.taskId,
  115. reason: this.form.reason,
  116. variables
  117. }).then((res) => {
  118. if (res.data.code != '-1') {
  119. this.$emit('handleAudit', {
  120. status,
  121. title: status === 0 ? '驳回' : ''
  122. });
  123. }
  124. });
  125. },
  126. getTableValue() {
  127. return new Promise((resolve, reject) => {
  128. this.$emit('getTableValue', async (data) => {
  129. resolve(await data);
  130. });
  131. });
  132. },
  133. //更多
  134. handleCommand(command) {
  135. if (command === 'cancel') {
  136. this.$confirm("是否确认作废?", {
  137. type: 'warning',
  138. cancelButtonText: '取消',
  139. confirmButtonText: '确定'
  140. }).then(() => {
  141. cancelTask({
  142. id: this.id,
  143. taskId: this.taskId,
  144. reason: this.form.reason,
  145. businessId: this.businessId,
  146. }).then(() => {
  147. this.$emit('handleClose');
  148. }).catch(() => {
  149. this.$message.error("流程作废失败");
  150. });
  151. }).catch(() => {});
  152. }
  153. },
  154. }
  155. };
  156. </script>
  157. <style lang="scss"></style>