lixiangyu
3 天以前 e461400624e975821edf4684727eeaa7bf8c29c1
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
@@ -127,7 +127,7 @@
      :pagination="ipagination"
      :loading="loading"
    >
      <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index" >
      <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index">
        <div :key="col.dataIndex">
          <a-input
            :value="text"
@@ -158,7 +158,7 @@
      <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
    </template>
    <j-select-inventory-modal ref="inventoryModalForm" @ok="modalFormOk"></j-select-inventory-modal>
<!--    <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal>-->
    <!--    <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal>-->
  </a-modal>
</template>
@@ -178,7 +178,6 @@
export default {
  name: 'CuttingInboundModal',
  components: {
    JSelectToolingModal,
    JSelectInventoryModal,
    JMultiSelectTag,
    JDictSelectTag,
@@ -253,8 +252,8 @@
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
@@ -321,7 +320,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,29 +348,26 @@
          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) => {
                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(() => {
                that.confirmLoading = false
                that.close()
              })
          // 确保 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)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              that.close()
            })
        }
      })
    },