| | |
| | | </a-row> |
| | | </a-form> |
| | | </a-spin> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">选择刀具</a-button> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">选择库存刀具</a-button> |
| | | <a-table |
| | | ref="table" |
| | | bordered |
| | |
| | | }, |
| | | { |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | align: 'center', |
| | | dataIndex: 'action', |
| | | scopedSlots: { customRender: 'action' } |
| | | } |
| | | ], |
| | |
| | | // this.$refs.toolingModalForm.disableSubmit = false |
| | | |
| | | this.$refs.inventoryModalForm.showModal(ids) |
| | | this.$refs.inventoryModalForm.title = '选择刀具' |
| | | this.$refs.inventoryModalForm.title = '选择库存刀具' |
| | | this.$refs.inventoryModalForm.disableSubmit = false |
| | | |
| | | }, |
| | |
| | | let formData = Object.assign(this.model, values) |
| | | formData.detailData = this.dataSource |
| | | |
| | | // 添加更新库存状态的逻辑 |
| | | const inventoryIds = this.dataSource.map(item => item.inventoryId) |
| | | const updateInventoryStatus = inventoryIds.length > 0 ? |
| | | //需要写一个更新库存状态的接口在后端(还没写25/9/9) |
| | | postAction('/cms/inventory/updateStatus', { |
| | | ids: inventoryIds, |
| | | status: '待出库' //设为待出库 |
| | | }) : Promise.resolve() |
| | | updateInventoryStatus.then(() => { |
| | | return postAction(that.url.add, formData) |
| | | }).then((res) => { |
| | | // 确保 detailData 包含 inventoryId |
| | | formData.detailData = this.dataSource.map(item => ({ |
| | | ...item, |
| | | // 确保 inventoryId 被正确传递 |
| | | inventoryId: item.inventoryId |
| | | })) |
| | | |
| | | postAction(that.url.add, formData) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success('领用成功') |
| | | that.$emit('ok', new Date()) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).catch((error) => { |
| | | that.$message.error('操作失败: ' + error.message) |
| | | }).finally(() => { |
| | | }) |
| | | .finally(() => { |
| | | that.confirmLoading = false |
| | | that.close() |
| | | }) |