submit.vue 5.3 KB

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