submit.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. <ApprovalOpinion ref="approvalOpinion" v-model="form.reason" />
  14. </el-form-item>
  15. </el-form>
  16. <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
  17. <el-button
  18. icon="el-icon-edit-outline"
  19. type="success"
  20. size="mini"
  21. v-if="
  22. taskDefinitionKey != 'wms_out' ||
  23. (taskDefinitionKey == 'wms_out' &&
  24. outInData.verifyStatus == 2)
  25. "
  26. v-click-once
  27. @click="$refs.approvalOpinion.validate(1) && handleAudit(1)"
  28. >通过
  29. </el-button>
  30. <el-button
  31. icon="el-icon-edit-outline"
  32. type="success"
  33. size="mini"
  34. :loading="isSaveLoading"
  35. v-click-once
  36. @click="wms_out"
  37. v-if="
  38. ['wms_out'].includes(taskDefinitionKey)
  39. "
  40. >申请出库
  41. </el-button>
  42. <el-button
  43. icon="el-icon-circle-close"
  44. type="danger"
  45. size="mini"
  46. v-click-once
  47. @click="$refs.approvalOpinion.validate(0) && rejectTask(0)"
  48. >驳回
  49. </el-button>
  50. </div>
  51. </el-col>
  52. </template>
  53. <script>
  54. import {
  55. saleSendProcessCancel
  56. } from '@/api/bpm/components/saleManage/saleorder';
  57. import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
  58. import storageApi from '@/api/warehouseManagement';
  59. // 流程实例的详情页,可用于审批
  60. export default {
  61. name: '',
  62. components: {
  63. // Parser
  64. },
  65. props: {
  66. businessId: {
  67. default: ''
  68. },
  69. taskId: {
  70. default: ''
  71. },
  72. id: {
  73. default: ''
  74. },
  75. taskDefinitionKey: {
  76. default: ''
  77. }
  78. },
  79. data() {
  80. return {
  81. isSaveLoading: false,
  82. form: {
  83. technicianId: '',
  84. reason: '同意'
  85. },
  86. outInData: { verifyStatus: 0 },
  87. activeComp: ''
  88. };
  89. },
  90. async created() {
  91. },
  92. methods: {
  93. async wms_out() {
  94. let res = await this.getTableValue();
  95. let storageData = res.returnStorageData;
  96. console.log(storageData);
  97. // 出库来源isSkip 0-正常 1-外部(外部跳过内部审核流程)
  98. storageData.isSkip = 1;
  99. storageData.isMes = 1;
  100. try {
  101. this.isSaveLoading = true;
  102. await storageApi.outStorage(storageData);
  103. approveTaskWithVariables({
  104. id: this.taskId,
  105. reason: this.form.reason,
  106. variables: {
  107. pass: true
  108. }
  109. }).then((res) => {
  110. if (res.code != '-1') {
  111. this.$emit('handleAudit', {
  112. status: 1,
  113. title: '出库'
  114. });
  115. }
  116. this.isSaveLoading = false;
  117. });
  118. } catch (error) {
  119. this.isSaveLoading = false;
  120. console.error('保存失败:', error);
  121. }
  122. },
  123. activeCompChange(activeComp) {
  124. this.activeComp = activeComp;
  125. },
  126. /** 处理转办审批人 */
  127. handleUpdateAssignee() {
  128. this.$emit('handleUpdateAssignee');
  129. },
  130. /** 退回 */
  131. handleBackList() {
  132. this.$emit('handleBackList');
  133. },
  134. rejectTask(status) {
  135. let variables = {
  136. pass: !!status
  137. };
  138. rejectTask({
  139. id: this.taskId,
  140. reason: this.form.reason,
  141. variables
  142. }).then((res) => {
  143. if (res.data.code != '-1') {
  144. this.$emit('handleAudit', {
  145. status,
  146. title: status === 0 ? '驳回' : ''
  147. });
  148. }
  149. });
  150. },
  151. async handleAudit(status) {
  152. let variables = {
  153. pass: !!status
  154. };
  155. let API = !!status ? approveTaskWithVariables : rejectTask;
  156. API({
  157. id: this.taskId,
  158. reason: this.form.reason,
  159. variables
  160. }).then((res) => {
  161. if (res.data.code != '-1') {
  162. this.$emit('handleAudit', {
  163. status,
  164. title: status === 0 ? '驳回' : ''
  165. });
  166. }
  167. });
  168. },
  169. async _approveTaskWithVariables(status, storemanIds) {
  170. },
  171. getTableValue() {
  172. return new Promise((resolve, reject) => {
  173. this.$emit('getTableValue', async (data) => {
  174. resolve(await data);
  175. });
  176. });
  177. },
  178. //更多
  179. handleCommand(command) {
  180. if (command === 'cancel') {
  181. this.$confirm('是否确认作废?', {
  182. type: 'warning',
  183. cancelButtonText: '取消',
  184. confirmButtonText: '确定'
  185. })
  186. .then(() => {
  187. saleSendProcessCancel({
  188. id: this.taskId,
  189. reason: this.form.reason,
  190. businessId: this.businessId
  191. })
  192. .then(() => {
  193. this.$emit('handleClose');
  194. })
  195. .catch(() => {
  196. this.$message.error('流程作废失败');
  197. });
  198. })
  199. .catch(() => {});
  200. }
  201. }
  202. }
  203. };
  204. </script>
  205. <style lang="scss"></style>