submit.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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="storeManagerApprove"
  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. </div>
  38. </el-col>
  39. </template>
  40. <script>
  41. import { approveTaskWithVariablesOther } from '@/api/bpm/task';
  42. import outin from '@/api/warehouseManagement/outin';
  43. import storageApi from '@/api/warehouseManagement';
  44. export default {
  45. name: '',
  46. props: {
  47. businessId: {
  48. default: ''
  49. },
  50. taskId: {
  51. default: ''
  52. },
  53. id: {
  54. default: ''
  55. },
  56. taskDefinitionKey: {
  57. default: ''
  58. }
  59. },
  60. data() {
  61. return {
  62. isSaveLoading: false,
  63. form: {
  64. reason: '同意'
  65. },
  66. activeComp: ''
  67. };
  68. },
  69. mounted() {
  70. console.log('taskDefinitionKey-------------', this.taskDefinitionKey);
  71. },
  72. methods: {
  73. async storeManagerApprove() {
  74. let res = await this.getTableValue();
  75. let storageData = res.returnStorageData;
  76. if (!storageData) {
  77. return;
  78. }
  79. console.log('我需要的~~~~~~~~~~~~~~~~', res);
  80. // 入库来源isSkip 0-正常 1-外部(外部跳过内部审核流程)
  81. storageData.isSkip = 1;
  82. storageData.workOrderCode = res.form.workOrderCode;
  83. console.log('storageData~~~~~~~~~~~~~~~~', storageData);
  84. // return;
  85. // 验证outInDetailList中是否存在数量为空的情况
  86. // if (storageData.outInDetailList && storageData.outInDetailList.some(item => item.number ==undefined || item.number == '' || item.number == null)) {
  87. // this.$message.error('计量数量不为空');
  88. // return;
  89. // }
  90. try {
  91. this.isSaveLoading = true;
  92. let res = await storageApi.storage(storageData);
  93. approveTaskWithVariablesOther({
  94. id: this.taskId,
  95. reason: this.form.reason,
  96. outInId: res.data[0],
  97. businessId: this.businessId,
  98. variables: {
  99. pass: true
  100. }
  101. }).then((res) => {
  102. if (res.code != '-1') {
  103. this.$emit('handleAudit', {
  104. status: 1,
  105. title: '入库'
  106. });
  107. }
  108. this.isSaveLoading = false;
  109. });
  110. } catch (error) {
  111. this.isSaveLoading = false;
  112. this.$message.error('保存失败');
  113. }
  114. },
  115. async handleAudit(status) {
  116. let variables = {
  117. pass: !!status
  118. };
  119. storageApi
  120. .notPass({
  121. id: this.taskId,
  122. reason: this.form.reason,
  123. businessId: this.businessId,
  124. variables
  125. })
  126. .then((res) => {
  127. if (res.code != '-1') {
  128. this.$emit('handleAudit', {
  129. status,
  130. title: status === 0 ? '驳回' : ''
  131. });
  132. }
  133. });
  134. },
  135. /** 处理转办审批人 */
  136. handleUpdateAssignee() {
  137. this.$emit('handleUpdateAssignee');
  138. },
  139. /** 退回 */
  140. handleBackList() {
  141. this.$emit('handleBackList');
  142. },
  143. activeCompChange(activeComp) {
  144. this.activeComp = activeComp;
  145. },
  146. getTableValue() {
  147. return new Promise((resolve, reject) => {
  148. this.$emit('getTableValue', async (data) => {
  149. resolve(await data);
  150. });
  151. });
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="scss"></style>