This commit is contained in:
mkm 2024-08-01 15:43:32 +08:00
parent a37a24ecf5
commit acccd00866
3 changed files with 26 additions and 13 deletions

View File

@ -93,6 +93,11 @@
<el-input-number v-model="row.new_stock" :min="1" /> <el-input-number v-model="row.new_stock" :min="1" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="批次" min-width="150">
<template #default="{ row }">
<el-input-number v-model="row.batch" />
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right"> <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button
@ -141,6 +146,8 @@ import { onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { apiStoreCategoryLists } from '@/api/store_category' import { apiStoreCategoryLists } from '@/api/store_category'
import { apiStoreProductUnitLists } from '@/api/store_product_unit' import { apiStoreProductUnitLists } from '@/api/store_product_unit'
const route = useRoute()
defineProps({ defineProps({
dictData: { dictData: {
type: Object as PropType<Record<string, any[]>>, type: Object as PropType<Record<string, any[]>>,
@ -151,12 +158,15 @@ const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>() const formRef = shallowRef<FormInstance>()
const { removeTab } = useMultipleTabs() const { removeTab } = useMultipleTabs()
const mode = ref('add') const mode = ref('add')
const warehouse_id = ref('')
// //
const formData = reactive({ const formData = reactive({
store_id: '' store_id: ''
}) })
if (route.query.warehouse_id) {
warehouse_id.value = parseInt(route.query.warehouse_id)
}
const showStore = ref(false) // const showStore = ref(false) //
// //
const storeList = ref([]) const storeList = ref([])
@ -204,26 +214,28 @@ const stock_type = ref(1)
const router = useRouter() const router = useRouter()
// //
const handleSubmit = async () => { const handleSubmit = async () => {
if (warehouse_id.value == '') {
ElMessage.error('请选择仓库')
return
}
const product_arr = productList.value.map((item: any) => { const product_arr = productList.value.map((item: any) => {
return { return {
id: item.id, id: item.product_id,
stock: item.new_stock || 0 stock: item.new_stock || 0,
batch: item.batch || 0
} }
}) })
const store_arr = storeList.value.map((item: any) => item.id) const store_arr = storeList.value.map((item: any) => item.id)
console.log(product_arr)
console.log(store_arr)
console.log(stock_type.value)
return false
apiStoreProductImport({ apiStoreProductImport({
product_arr, product_arr,
store_arr, store_arr,
stock_type: stock_type.value stock_type: stock_type.value,
warehouse_id: warehouse_id.value
}).then((res) => { }).then((res) => {
removeTab() removeTab()
router.push({ // router.push({
path: '/store/store_product' // path: '/warehouse/warehouse_product'
}) // })
}) })
} }
</script> </script>

View File

@ -32,7 +32,8 @@
<el-card class="!border-none" v-loading="pager.loading" shadow="never"> <el-card class="!border-none" v-loading="pager.loading" shadow="never">
<router-link <router-link
:to="{ :to="{
path: 'import' path: 'import',
query: { warehouse_id: queryParams.warehouse_id }
}" }"
class="ml-4" class="ml-4"
> >

View File

@ -63,7 +63,7 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="" prop="id" show-overflow-tooltip /> <el-table-column label="" prop="id" show-overflow-tooltip />
<el-table-column label="操作人员" prop="admin_name" show-overflow-tooltip /> <el-table-column label="操作人员" prop="admin_name" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip /> <el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="商品" prop="store_name" show-overflow-tooltip /> <el-table-column label="商品" prop="store_name" show-overflow-tooltip />
<el-table-column <el-table-column
label="出入库" label="出入库"