submit.vue 5.3 KB

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