src/views/cms/modules/CuttingReceiveModal.vue
@@ -116,7 +116,7 @@
        </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
@@ -253,8 +253,8 @@
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
               dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
@@ -321,7 +321,7 @@
      // this.$refs.toolingModalForm.disableSubmit = false
      this.$refs.inventoryModalForm.showModal(ids)
      this.$refs.inventoryModalForm.title = '选择刀具'
         this.$refs.inventoryModalForm.title = '选择库存刀具'
      this.$refs.inventoryModalForm.disableSubmit = false
    },
@@ -349,26 +349,23 @@
          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()
              })