19号更新
This commit is contained in:
parent
e1cbf289ed
commit
864ca910eb
28
src/api/storage/entry.ts
Normal file
28
src/api/storage/entry.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
const v = "1.0"
|
||||||
|
|
||||||
|
export function getEntryList(data:any): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'storage.entry.getEntryList',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEntryDetail(data:any): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'storage.entry.getEntryDetail',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -14,6 +14,7 @@ export function getReceivingList(data: any): Promise<any> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getReceivingDetail(data: any): Promise<any> {
|
export function getReceivingDetail(data: any): Promise<any> {
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
@ -27,6 +28,20 @@ export function getReceivingDetail(data: any): Promise<any> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 未使用,保留
|
||||||
|
export function getReceivingProduct(data: any): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'storage.receiving.getReceivingProduct',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function batchCancelReceiving(data: any): Promise<any> {
|
export function batchCancelReceiving(data: any): Promise<any> {
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
:current-row-key="currentRowKey"
|
:current-row-key="currentRowKey"
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
|
@row-contextmenu="handleRowContextMenu"
|
||||||
@sort-change="handleSortChange"
|
@sort-change="handleSortChange"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:size="tableSize"
|
:size="tableSize"
|
||||||
@ -274,6 +275,7 @@ const emit = defineEmits([
|
|||||||
'current-change',
|
'current-change',
|
||||||
'selection-change',
|
'selection-change',
|
||||||
'row-click',
|
'row-click',
|
||||||
|
'row-contextmenu',
|
||||||
'sort-change',
|
'sort-change',
|
||||||
'page-size-change',
|
'page-size-change',
|
||||||
'page-change',
|
'page-change',
|
||||||
@ -493,6 +495,10 @@ function handleRowClick(row: any, column: any, event: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleRowContextMenu(row: any, column: any, event: any) {
|
||||||
|
emit('row-contextmenu', row, column, event)
|
||||||
|
}
|
||||||
|
|
||||||
function handleSortChange({ column, prop, order }: any) {
|
function handleSortChange({ column, prop, order }: any) {
|
||||||
emit('sort-change', { column, prop, order })
|
emit('sort-change', { column, prop, order })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,12 +36,23 @@ router.beforeEach(async (to, from) => {
|
|||||||
const permissionStore = usePermissionStore()
|
const permissionStore = usePermissionStore()
|
||||||
// generate accessible routes based on menus
|
// generate accessible routes based on menus
|
||||||
const accessRoutes = await permissionStore.generateRoutes(user.menus || [])
|
const accessRoutes = await permissionStore.generateRoutes(user.menus || [])
|
||||||
// console.log("生成的路由表",accessRoutes);
|
|
||||||
|
console.log('从后端获取并转换后的动态路由:', accessRoutes)
|
||||||
|
console.log('合并后的前端完整路由表 (添加前):', router.getRoutes())
|
||||||
|
|
||||||
// dynamically add accessible routes
|
// dynamically add accessible routes
|
||||||
accessRoutes.forEach(route => {
|
accessRoutes.forEach(route => {
|
||||||
router.addRoute(route)
|
router.addRoute(route)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 打印已添加的动态路由信息与添加后的完整路由表,便于调试
|
||||||
|
try {
|
||||||
|
console.log('已添加的动态路由 paths:', accessRoutes.map(r => r.path))
|
||||||
|
} catch (e) {
|
||||||
|
console.log('已添加的动态路由 (无法列出 paths):', accessRoutes)
|
||||||
|
}
|
||||||
|
console.log('合并后的前端完整路由表 (添加后):', router.getRoutes())
|
||||||
|
|
||||||
// hack method to ensure that addRoutes is complete
|
// hack method to ensure that addRoutes is complete
|
||||||
// set the replace: true, so the navigation will not leave a history record
|
// set the replace: true, so the navigation will not leave a history record
|
||||||
return { ...to, replace: true }
|
return { ...to, replace: true }
|
||||||
|
|||||||
@ -191,14 +191,23 @@ export const transformMenusToRoutes = (menus: any[]) => {
|
|||||||
if (menu.component) {
|
if (menu.component) {
|
||||||
if (menu.component === 'Layout') {
|
if (menu.component === 'Layout') {
|
||||||
route.component = Layout
|
route.component = Layout
|
||||||
} else if (menu.component.startsWith('@/views/')) {
|
} else if (typeof menu.component === 'string') {
|
||||||
const componentPath = menu.component.replace('@/views/', '')
|
// 正常情况:字符串类型
|
||||||
route.component = resolveComponent(componentPath)
|
if (menu.component.startsWith('@/views/')) {
|
||||||
} else if (menu.component.startsWith('@/')) {
|
const componentPath = menu.component.replace('@/views/', '')
|
||||||
const componentPath = menu.component.replace('@/', '')
|
route.component = resolveComponent(componentPath)
|
||||||
route.component = () => import(`@/${componentPath}.vue`)
|
} else if (menu.component.startsWith('@/')) {
|
||||||
|
const componentPath = menu.component.replace('@/', '')
|
||||||
|
route.component = () => import(`@/${componentPath}.vue`)
|
||||||
|
} else {
|
||||||
|
route.component = resolveComponent(menu.component)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
route.component = () => import(`@/views/${menu.component}.vue`)
|
// 如果后端传回的 component 是一个带有 __file 等不该出现的打包后的对象
|
||||||
|
// 通过父子路径拼接去 map 里面找,或者直接截取 path
|
||||||
|
const fallbackPath = parentName ? `${parentName.toLowerCase()}/${menu.path}` : menu.path;
|
||||||
|
console.warn(`Invalid component format for path [${menu.path}]. Falling back to use componentMap key: ${fallbackPath}`);
|
||||||
|
route.component = resolveComponent(fallbackPath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!menu.children || menu.children.length === 0) {
|
if (!menu.children || menu.children.length === 0) {
|
||||||
|
|||||||
@ -11,6 +11,10 @@ export const componentMap: Record<string, any> = {
|
|||||||
'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'),
|
'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'),
|
||||||
'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'),
|
'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'),
|
||||||
'storage/receiving': () => import('@/views/storage/receiving/index.vue'),
|
'storage/receiving': () => import('@/views/storage/receiving/index.vue'),
|
||||||
|
'storage/entry': () => import('@/views/storage/entry/index.vue'),
|
||||||
|
'storage/entry/index': () => import('@/views/storage/entry/index.vue'),
|
||||||
|
'storage/stock': () => import('@/views/storage/stock/index.vue'),
|
||||||
|
//'storage/stock/index': () => import('@/views/storage/stock/index.vue'),
|
||||||
'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'),
|
'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'),
|
||||||
// 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'),
|
// 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'),
|
||||||
'system/print/station': () => import('@/views/system/setting/printStation/index.vue'),
|
'system/print/station': () => import('@/views/system/setting/printStation/index.vue'),
|
||||||
|
|||||||
@ -79,12 +79,22 @@ service.interceptors.request.use(
|
|||||||
// response interceptor
|
// response interceptor
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
response => {
|
response => {
|
||||||
|
// 强制转换为小写键以进行不区分大小写的查找
|
||||||
const headers = response.headers
|
const headers = response.headers
|
||||||
const res = response.data
|
const res = response.data
|
||||||
const authHeader = headers['authorization'] || headers['Authorization'];
|
|
||||||
if (authHeader && authHeader.startsWith('Bearer ')) {
|
// axios 的 headers 对象通常已经处理过大小写,但为了保险起见,检查多种可能的键名
|
||||||
const newToken = authHeader.substring(7)
|
const newToken = headers['new-token'] || headers['new-authorization'] || headers['authorization'] || headers['Authorization'];
|
||||||
setToken(newToken)
|
|
||||||
|
if (newToken) {
|
||||||
|
// 提取 Bearer 之后的 token 字符串
|
||||||
|
const tokenValue = newToken.startsWith('Bearer ') ? newToken.substring(7) : newToken
|
||||||
|
if (tokenValue && tokenValue !== getToken()) {
|
||||||
|
console.log('检测到新 Token,正在更新存储...');
|
||||||
|
setToken(tokenValue)
|
||||||
|
// 同步更新当前实例的默认请求头,确保后续请求立即生效
|
||||||
|
service.defaults.headers.common['Authorization'] = `Bearer ${tokenValue}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查业务状态码
|
// 检查业务状态码
|
||||||
|
|||||||
161
src/views/storage/entry/component/entrydetail.vue
Normal file
161
src/views/storage/entry/component/entrydetail.vue
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
<template>
|
||||||
|
<div class="entry-details">
|
||||||
|
<div class="header-actions">
|
||||||
|
<div class="left-actions">
|
||||||
|
<el-button size="small" @click="loadEntryDetail">刷新</el-button>
|
||||||
|
<el-button disabled>入库</el-button>
|
||||||
|
<el-button size="small" type="primary" disabled>批量入库</el-button>
|
||||||
|
<el-button size="small" disabled>EXCEL导出</el-button>
|
||||||
|
<el-button size="small" disabled>导出</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="right-actions">
|
||||||
|
<!-- 搜索或额外操作 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-content">
|
||||||
|
<UpperTable
|
||||||
|
:data="tableData"
|
||||||
|
:columns="detailColumns"
|
||||||
|
:show-selection="true"
|
||||||
|
:pagination="pagination"
|
||||||
|
:loading="loading"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
@page-size-change="handlePageSizeChange"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
>
|
||||||
|
<template #column-images="{ row }">
|
||||||
|
<div class="image-slot">
|
||||||
|
<el-image
|
||||||
|
v-if="row.images"
|
||||||
|
style="width: 40px; height: 40px"
|
||||||
|
:src="row.images"
|
||||||
|
:preview-src-list="[row.images]"
|
||||||
|
fit="cover"
|
||||||
|
/>
|
||||||
|
<span v-else>--</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</UpperTable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, watch, onMounted } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
|
||||||
|
import {entrydetail} from '../entry-config'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
id?: string | number,
|
||||||
|
row?: any
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const tableData = ref<any[]>([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const multipleSelection = ref<any[]>([])
|
||||||
|
|
||||||
|
// 分页相关
|
||||||
|
const pagination = reactive({
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
// 列定义
|
||||||
|
const detailColumns = ref(entrydetail)
|
||||||
|
|
||||||
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
// 监听 ID 变化加载数据
|
||||||
|
watch(() => props.id, (newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
loadEntryDetail()
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
async function loadEntryDetail() {
|
||||||
|
if (!props.id) return
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
console.log('加载入库单详情, ID:', props.id)
|
||||||
|
// 模拟数据源
|
||||||
|
const allMockDetails: Record<number | string, any[]> = {
|
||||||
|
90: [
|
||||||
|
{ id: 91, order_id: 90, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 0, count: 5000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 5000, confirm_quantity: 5000 }
|
||||||
|
],
|
||||||
|
93: [
|
||||||
|
{ id: 94, order_id: 93, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 1000689, count: 1000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 1000, confirm_quantity: 1000 }
|
||||||
|
],
|
||||||
|
95: [
|
||||||
|
{ id: 95, order_id: 95, out_biz_code: '', order_line_no: 2786714391389667366, owner_code: 'wdt02060120001', item_code: '三层钢蒸锅+屉26cm', item_id: 1000690, count: 1000, inventory_type: 'ZP', stock_id: 101874, received_quantity: 1000, confirm_quantity: 1000 }
|
||||||
|
],
|
||||||
|
96: [
|
||||||
|
{ id: 96, order_id: 96, out_biz_code: '', order_line_no: 2786720123363262666, owner_code: 'wdt02060120001', item_code: 'rrxm202502', item_id: 1000691, count: 1000, inventory_type: 'ZP', stock_id: 101875, received_quantity: 1000, confirm_quantity: 1000 }
|
||||||
|
],
|
||||||
|
97: [
|
||||||
|
{ id: 97, order_id: 97, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '20251023-18', item_id: 1000686, count: 1000, inventory_type: 'ZP', stock_id: 101842, received_quantity: 0, confirm_quantity: 0 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const mockDetails = allMockDetails[props.id] || []
|
||||||
|
tableData.value = mockDetails
|
||||||
|
pagination.total = mockDetails.length
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('获取明细失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSelectionChange = (val: any[]) => {
|
||||||
|
multipleSelection.value = val
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageSizeChange = (val: number) => {
|
||||||
|
pagination.pageSize = val
|
||||||
|
loadEntryDetail()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageChange = (val: number) => {
|
||||||
|
pagination.currentPage = val
|
||||||
|
loadEntryDetail()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.id) {
|
||||||
|
loadEntryDetail()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.entry-details {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-content {
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-slot {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
167
src/views/storage/entry/component/entryoperate.vue
Normal file
167
src/views/storage/entry/component/entryoperate.vue
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
<template>
|
||||||
|
<div class="entry-operate">
|
||||||
|
<div class="left-col">
|
||||||
|
<div class="col-left">
|
||||||
|
<el-form :model="form" label-width="120px" size="small">
|
||||||
|
<!-- 动态渲染可用字段,此处可根据 entry-config 调整 -->
|
||||||
|
<el-form-item
|
||||||
|
v-for="field in entryColums"
|
||||||
|
:key="field.prop"
|
||||||
|
:label="field.label"
|
||||||
|
:prop="field.prop"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="(form as any)[field.prop]"
|
||||||
|
:placeholder="'请输入' + field.label"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div class="col-right">
|
||||||
|
<!-- 预留扩展区域 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<aside class="right-col">
|
||||||
|
<div class="right-panel">
|
||||||
|
<div class="panel-actions">
|
||||||
|
<el-button size="small" @click="handleReset">重置</el-button>
|
||||||
|
<el-button type="primary" size="small" @click="handleSave" :loading="saveLoading">保存</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-info" v-if="row">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">创建时间:</span>
|
||||||
|
<span class="info-value">{{ row.order_create_time }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">当前状态:</span>
|
||||||
|
<el-tag size="small">{{ row.status }}</el-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch, onMounted } from 'vue'
|
||||||
|
import { entryColums } from '../entry-config'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
id: string | number,
|
||||||
|
row?: any
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const form = ref<any>({})
|
||||||
|
const saveLoading = ref(false)
|
||||||
|
|
||||||
|
// 监听行数据变化同步表单
|
||||||
|
watch(() => props.row, (newRow) => {
|
||||||
|
if (newRow) {
|
||||||
|
form.value = { ...newRow }
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
if (props.row) {
|
||||||
|
form.value = { ...props.row }
|
||||||
|
} else {
|
||||||
|
form.value = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSave = async () => {
|
||||||
|
try {
|
||||||
|
saveLoading.value = true
|
||||||
|
// 模拟接口调用
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500))
|
||||||
|
ElMessage.success('保存成功')
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('保存失败')
|
||||||
|
} finally {
|
||||||
|
saveLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.row) {
|
||||||
|
form.value = { ...props.row }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.entry-operate {
|
||||||
|
padding: 12px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 320px;
|
||||||
|
gap: 0 16px;
|
||||||
|
align-items: start;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-col {
|
||||||
|
grid-column: 1 / 2;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-right: 12px;
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-left {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-right {
|
||||||
|
flex: 1;
|
||||||
|
border-left: 1px solid #f0f0f0;
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-col {
|
||||||
|
grid-column: 2 / 3;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-panel {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 16px;
|
||||||
|
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
|
||||||
|
.panel-actions {
|
||||||
|
text-align: right;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-info {
|
||||||
|
border-top: 1px dashed #ebeef5;
|
||||||
|
padding-top: 15px;
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.info-label {
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
.info-value {
|
||||||
|
color: #303133;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
9
src/views/storage/entry/component/log.vue
Normal file
9
src/views/storage/entry/component/log.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div class="">
|
||||||
|
<h1>操作日志</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style lang="css" scoped></style>
|
||||||
111
src/views/storage/entry/entry-config.ts
Normal file
111
src/views/storage/entry/entry-config.ts
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
export const availableFields = [
|
||||||
|
{ label:'', value: '', type: 'input' },
|
||||||
|
{ label: '货主', value: 'store_id', type: 'select', options: [] },
|
||||||
|
{ label: '状态', value: 'status', type: 'select', options: [
|
||||||
|
{ label: '待入库', value: 'pending' },
|
||||||
|
{ label: '入库中', value: 'partial' },
|
||||||
|
{ label: '已完成', value: 'confirmed' },
|
||||||
|
{ label: '随机入库中',value: ''},
|
||||||
|
{ label: '随机入库完成',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '已取消', value: 'cancelled' },
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
]},
|
||||||
|
{ label: '入库单类型', value: 'type', type: 'select', options: [
|
||||||
|
{ label: '采购入库单', value: 'purchase' },
|
||||||
|
{ label: '退货入库单', value: '' },
|
||||||
|
{ label: '其他入库单', value: 'other' },
|
||||||
|
{ label: '盘点入库单', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
{ label: '', value: '' },
|
||||||
|
]},
|
||||||
|
{ label: '是否同步', value: 'is_synced', type: 'select', options: [
|
||||||
|
{ label: '是', value: true },
|
||||||
|
{ label: '否', value: false },
|
||||||
|
]},
|
||||||
|
{ label: '费用是否记录',value: 'expense_record', type: 'select', options: [
|
||||||
|
{ label: '是', value: true },
|
||||||
|
{ label: '否', value: false },
|
||||||
|
]},
|
||||||
|
{ label: '批次',value: 'batch',type: 'text' },
|
||||||
|
{ label: '编号',value: 'number',type: 'text' },
|
||||||
|
{ label: '备注',value: 'remark',type: 'text' },
|
||||||
|
{ label: 'ERP备注',value: 'erp_remark',type: 'text' },
|
||||||
|
{ label: '操作员ID',value: 'operator_id',type: 'text' },
|
||||||
|
{ label: '申请起始日期',value: 'start_date',type: 'daterange' },
|
||||||
|
{ label: '申请结束日期',value: 'end_date',type: 'daterange' },
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
{ label: '',value: ''},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const entryColums = [
|
||||||
|
{ prop: 'id',label:'ID',width:'50' },
|
||||||
|
{ prop: 'entry_order_code',label:'入库单号',width:'160',},
|
||||||
|
{ prop: 'store_name',label:'货主',width:'140', },
|
||||||
|
{ prop: 'order_type',label:'类型',width:'160' },
|
||||||
|
|
||||||
|
{ prop: 'purchase_order_code',label:'单据编号 ',width:'160' },
|
||||||
|
{ prop: 'total_order_lines',label:'商品数',width:'160' },
|
||||||
|
{ prop: 'order_status',label:'订单状态',width:'160' },
|
||||||
|
{ prop: 'sync_status',label:'同步状态',width:'160' },
|
||||||
|
{ prop: 'supplier_code',label:'供应商编码',width:'160' },
|
||||||
|
{ prop: 'supplier_name',label:'供应商名称',width:'160' },
|
||||||
|
{ prop: '',label:'',width:'160' },
|
||||||
|
{ prop: 'express_code',label:'运单号',width:'160' },
|
||||||
|
{ prop: 'logistics_code',label:'物流公司编码',width:'160' },
|
||||||
|
{ prop: 'logistics_name',label:'物流公司名称',width:'160' },
|
||||||
|
{ prop: '',label:'',width:'160',fixed: 'left' },
|
||||||
|
{ prop: '',label:'',width:'160',fixed: 'left' },
|
||||||
|
{ prop: 'order_create_time',label:'单据创建时间',width:'160' },
|
||||||
|
{ prop: 'expect_start_time',label:'预计开始时间',width:'160' },
|
||||||
|
{ prop: 'expect_end_time',label:'预计结束时间',width:'160' },
|
||||||
|
{ prop: '',label:'',width:'160',fixed: 'left' },
|
||||||
|
{ prop: 'source_type',label:'数据来源',width:'160' },
|
||||||
|
{ prop: '',label:'',width:'160',fixed: 'left' },
|
||||||
|
{ prop: '',label:'',width:'160',fixed: 'left' },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const entrydetail = [
|
||||||
|
{ prop: 'id', label: 'ID', width: '160' },
|
||||||
|
{ prop: 'out_biz_code', label: '外部业务编码', width: '160' },
|
||||||
|
{ prop: 'order_line_no', label: '订单行号', width: '160' },
|
||||||
|
{ prop: 'owner_code', label: '货主编码', width: '160' },
|
||||||
|
{ prop: 'item_code', label: '商品编码', width: '160' },
|
||||||
|
{ prop: 'item_id', label: '商品 ID', width: '160' },
|
||||||
|
{ prop: 'count', label: '应收数量', width: '160' },
|
||||||
|
{ prop: 'inventory_type', label: '库存类型', width: '160' },
|
||||||
|
{ prop: 'stock_id', label: '库存记录 ID', width: '160' },
|
||||||
|
{ prop: 'received_quantity', label: '实收数量', width: '160' },
|
||||||
|
{ prop: 'confirm_quantity', label: '确认数量', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
{ prop: '', label: '', width: '160' },
|
||||||
|
]
|
||||||
460
src/views/storage/entry/index.vue
Normal file
460
src/views/storage/entry/index.vue
Normal file
@ -0,0 +1,460 @@
|
|||||||
|
<template>
|
||||||
|
<div class="storage-entry-container">
|
||||||
|
<scan-box
|
||||||
|
ref="scanBox"
|
||||||
|
width="320px"
|
||||||
|
:tree-props="{ children: 'children', label: 'label' }"
|
||||||
|
:auto-submit="false"
|
||||||
|
:preset-tree="presetTree"
|
||||||
|
:available-fields="availableFieldsRef"
|
||||||
|
@condition-change="handleConditionChange"
|
||||||
|
@reset="handleConditionReset"
|
||||||
|
@condition-clear="handleConditionClear"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="toolbar">
|
||||||
|
<div class="toolbar-left">
|
||||||
|
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||||
|
<el-button size="small" @click="handleCreateEntry">新建入库单</el-button>
|
||||||
|
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
|
||||||
|
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
|
||||||
|
<el-button size="small" @click="handleImport">导入</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="toolbar-right">
|
||||||
|
<el-input size="small" placeholder="搜索入库单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="upper-wrapper">
|
||||||
|
<upper-table
|
||||||
|
ref="upperTable"
|
||||||
|
title="入库单列表"
|
||||||
|
:data="list"
|
||||||
|
:columns="columns"
|
||||||
|
:table-size="tableSize"
|
||||||
|
:pagination="pagination"
|
||||||
|
:show-index="true"
|
||||||
|
:show-actions="true"
|
||||||
|
:show-selection="true"
|
||||||
|
:loading="loading"
|
||||||
|
:queryTime="queryTime"
|
||||||
|
@current-change="handleRowClick"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
@page-size-change="handlePageSizeChange"
|
||||||
|
@refresh="loadData"
|
||||||
|
@selection-change="onSelectionChange"
|
||||||
|
>
|
||||||
|
<template #column-status="{ row }">
|
||||||
|
<el-tag v-if="row.status" size="small">
|
||||||
|
{{ row.status }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-tip">暂无入库单</div>
|
||||||
|
</template>
|
||||||
|
</upper-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lower-level" v-if="selectedEntryId" :class="tableSize">
|
||||||
|
<div class="detail-header">
|
||||||
|
<el-tabs v-model="activeTab" class="detail-tab">
|
||||||
|
<el-tabs></el-tabs>
|
||||||
|
<el-tab-pane label="表单操作" name="operate" />
|
||||||
|
<el-tab-pane label="入库明细" name="details" />
|
||||||
|
<el-tab-pane label="操作日志" name="logs" />
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="detail-container">
|
||||||
|
<KeepAlive>
|
||||||
|
<component
|
||||||
|
:is="activeComponent"
|
||||||
|
:id="selectedEntryId"
|
||||||
|
:row="selectedRow"
|
||||||
|
@refresh="loadData"
|
||||||
|
/>
|
||||||
|
</KeepAlive>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="no-selection" v-else>
|
||||||
|
<div class="empty-tip">
|
||||||
|
<p>请从上方列表中选择一项查看详情</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted, computed } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
import * as indexApi from '@/api/index'
|
||||||
|
import * as entryApi from '@/api/storage/entry'
|
||||||
|
|
||||||
|
import {
|
||||||
|
availableFields,
|
||||||
|
entryColums,
|
||||||
|
} from './entry-config'
|
||||||
|
|
||||||
|
import entrydetail from './component/entrydetail.vue'
|
||||||
|
import log from './component/log.vue'
|
||||||
|
import entryoperate from './component/entryoperate.vue'
|
||||||
|
|
||||||
|
const scanBox = ref<any>(null)
|
||||||
|
const upperTable = ref<any>(null)
|
||||||
|
|
||||||
|
const presetTree = ref<any[]>([])
|
||||||
|
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
|
||||||
|
|
||||||
|
const activeTab = ref('details')
|
||||||
|
|
||||||
|
const list = ref<any[]>([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const exportLoading = ref(false)
|
||||||
|
const queryTime = ref(0)
|
||||||
|
|
||||||
|
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||||
|
const tableSize = ref('small')
|
||||||
|
const columns = ref(entryColums)
|
||||||
|
|
||||||
|
|
||||||
|
const selectionRows = ref<any[]>([])
|
||||||
|
const hasSelection = ref(false)
|
||||||
|
const selectedEntryId = ref<number | string | null>(null)
|
||||||
|
|
||||||
|
const quickSearch = ref('')
|
||||||
|
|
||||||
|
const componentMap: Record<string, any> = {
|
||||||
|
details: entrydetail,
|
||||||
|
logs: log,
|
||||||
|
operate: entryoperate
|
||||||
|
}
|
||||||
|
|
||||||
|
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.details)
|
||||||
|
|
||||||
|
const selectedRow = computed(() => {
|
||||||
|
return list.value.find((i: any) => i.id === selectedEntryId.value) || null
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData()
|
||||||
|
loadFilterData()
|
||||||
|
})
|
||||||
|
|
||||||
|
async function loadData() {
|
||||||
|
if (loading.value) return
|
||||||
|
loading.value = true
|
||||||
|
const start = Date.now()
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
page: pagination.currentPage,
|
||||||
|
page_size: pagination.pageSize,
|
||||||
|
quick_search: quickSearch.value,
|
||||||
|
...(scanBox.value?.getConditions() || {})
|
||||||
|
}
|
||||||
|
|
||||||
|
let useMock = false
|
||||||
|
try {
|
||||||
|
const res = await entryApi.getEntryList(params)
|
||||||
|
if (res && res.code === 200 && res.data && res.data.length > 0) {
|
||||||
|
list.value = res.data
|
||||||
|
pagination.total = res.total || res.data.length
|
||||||
|
} else {
|
||||||
|
useMock = true
|
||||||
|
console.log('API未返回数据,准备使用模拟数据')
|
||||||
|
}
|
||||||
|
} catch (apiError) {
|
||||||
|
console.warn('API调用失败,改用模拟数据', apiError)
|
||||||
|
useMock = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useMock) {
|
||||||
|
const mockData = [
|
||||||
|
{
|
||||||
|
id: 90,
|
||||||
|
entry_order_code: '2885-2011062548597596161',
|
||||||
|
order_type: 'CGRK',
|
||||||
|
purchase_order_code: '',
|
||||||
|
total_order_lines: 1,
|
||||||
|
order_create_time: '2026-01-13 13:07:36',
|
||||||
|
expect_start_time: '2026-01-13 13:07:36',
|
||||||
|
expect_end_time: '2026-01-13 13:07:36',
|
||||||
|
logistics_code: '',
|
||||||
|
logistics_name: '',
|
||||||
|
express_code: '',
|
||||||
|
supplier_code: '',
|
||||||
|
supplier_name: '',
|
||||||
|
source_type: 'QM',
|
||||||
|
order_status: 'COMPLETED',
|
||||||
|
sync_status: 'SUCCESS',
|
||||||
|
warehouse_id: 100000,
|
||||||
|
store_id: 1000016,
|
||||||
|
store_name: '花颜物语',
|
||||||
|
warehouse_name: '天豹2',
|
||||||
|
status: '已完成'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 93,
|
||||||
|
entry_order_code: '2885-2011043642256453634',
|
||||||
|
order_type: 'CGRK',
|
||||||
|
purchase_order_code: '',
|
||||||
|
total_order_lines: 1,
|
||||||
|
order_create_time: '2026-01-13 13:17:13',
|
||||||
|
expect_start_time: '2026-01-13 13:17:13',
|
||||||
|
expect_end_time: '2026-01-13 13:17:13',
|
||||||
|
logistics_code: '',
|
||||||
|
logistics_name: '',
|
||||||
|
express_code: '',
|
||||||
|
supplier_code: '',
|
||||||
|
supplier_name: '',
|
||||||
|
source_type: 'QM',
|
||||||
|
order_status: 'COMPLETED',
|
||||||
|
sync_status: 'SUCCESS',
|
||||||
|
warehouse_id: 100000,
|
||||||
|
store_id: 1000016,
|
||||||
|
store_name: '花颜物语',
|
||||||
|
warehouse_name: '天豹2',
|
||||||
|
status: '已完成'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 95,
|
||||||
|
entry_order_code: 'CGW2601201120',
|
||||||
|
order_type: 'CGRK',
|
||||||
|
purchase_order_code: '',
|
||||||
|
total_order_lines: 1,
|
||||||
|
order_create_time: '2026-01-20 12:48:05',
|
||||||
|
expect_start_time: '2026-01-20 12:52:34',
|
||||||
|
expect_end_time: '2026-01-20 12:52:34',
|
||||||
|
logistics_code: '',
|
||||||
|
logistics_name: '',
|
||||||
|
express_code: '',
|
||||||
|
supplier_code: '0004',
|
||||||
|
supplier_name: 'NBBT30',
|
||||||
|
source_type: 'QM',
|
||||||
|
order_status: 'COMPLETED',
|
||||||
|
sync_status: 'SUCCESS',
|
||||||
|
warehouse_id: 100000,
|
||||||
|
store_id: 1000016,
|
||||||
|
store_name: '花颜物语',
|
||||||
|
warehouse_name: '天豹2',
|
||||||
|
status: '已完成'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 97,
|
||||||
|
entry_order_code: '2885-2021923981203890178',
|
||||||
|
order_type: 'CGRK',
|
||||||
|
purchase_order_code: '',
|
||||||
|
total_order_lines: 1,
|
||||||
|
order_create_time: '2026-02-12 12:27:01',
|
||||||
|
expect_start_time: '2026-02-12 12:27:01',
|
||||||
|
expect_end_time: '2026-02-12 12:27:01',
|
||||||
|
logistics_code: '',
|
||||||
|
logistics_name: '',
|
||||||
|
express_code: '',
|
||||||
|
supplier_code: '',
|
||||||
|
supplier_name: '',
|
||||||
|
source_type: 'QM',
|
||||||
|
order_status: 'CREATED',
|
||||||
|
sync_status: 'PENDING',
|
||||||
|
warehouse_id: 100000,
|
||||||
|
store_id: 1000016,
|
||||||
|
store_name: '花颜物语',
|
||||||
|
warehouse_name: '天豹2',
|
||||||
|
status: '待入库'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
list.value = mockData
|
||||||
|
pagination.total = mockData.length
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('加载逻辑发生严重错误', e)
|
||||||
|
ElMessage.error('加载入库单失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
queryTime.value = Date.now() - start
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadFilterData() {
|
||||||
|
try {
|
||||||
|
const [storesRes, presetRes]: any = await Promise.all([
|
||||||
|
indexApi.loadStores({ type: 'entry' }),
|
||||||
|
indexApi.fastWhereTree('entry')
|
||||||
|
])
|
||||||
|
if (storesRes && storesRes.code === 200) {
|
||||||
|
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
|
||||||
|
if (f) f.options = storesRes.stores || []
|
||||||
|
}
|
||||||
|
if (presetRes && presetRes.code === 200) {
|
||||||
|
presetTree.value = presetRes.presetTree || []
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('加载筛选配置失败', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConditionChange(condition: any) {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleConditionClear = () => {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConditionReset() {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
if (scanBox.value?.reset) {
|
||||||
|
scanBox.value.reset()
|
||||||
|
}
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSelectionChange(rows: any[]) {
|
||||||
|
selectionRows.value = rows || []
|
||||||
|
hasSelection.value = selectionRows.value.length > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleRowClick(row: any) {
|
||||||
|
selectedEntryId.value = row?.id || null
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.currentPage = page
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(size: number) {
|
||||||
|
pagination.pageSize = size
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onQuickSearch() {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCreateEntry() {
|
||||||
|
ElMessage.info('新建入库单')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function confirmBatchCancel() {
|
||||||
|
if (!selectionRows.value.length) {
|
||||||
|
ElMessage.warning('请先选择要作废的入库单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(`确定要批量作废 ${selectionRows.value.length} 个入库单吗?`, '确认', { type: 'warning' })
|
||||||
|
// 调用作废 API
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
loadData()
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleExport() {
|
||||||
|
exportLoading.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
exportLoading.value = false
|
||||||
|
ElMessage.success('导出成功')
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleImport() {
|
||||||
|
ElMessage.info('导入功能')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.storage-entry-container {
|
||||||
|
display: flex;
|
||||||
|
height: calc(100vh - 130px);
|
||||||
|
width: 100%;
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.toolbar {
|
||||||
|
padding: 10px;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-right {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper-wrapper :deep(.upper-table-container) {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper-wrapper :deep(.table-container) {
|
||||||
|
height: auto !important;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper-wrapper :deep(.el-table__body-wrapper) {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lower-level {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-top: 1px solid #ebeef5;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.detail-header {
|
||||||
|
padding: 0 10px;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
.detail-tab { margin-bottom: -1px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-container {
|
||||||
|
flex: 1;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-selection {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #909399;
|
||||||
|
background-color: #fff;
|
||||||
|
.empty-tip { text-align: center; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -2,8 +2,9 @@
|
|||||||
<div class="product-details">
|
<div class="product-details">
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
<div class="left-actions">
|
<div class="left-actions">
|
||||||
<el-button type="primary">批量操作</el-button>
|
<el-button @click="loadProductData">刷新</el-button>
|
||||||
<el-button>导出</el-button>
|
<el-button type="primary" disabled>批量操作</el-button>
|
||||||
|
<el-button disabled>导出</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-actions">
|
<div class="right-actions">
|
||||||
<!-- 可以在这里添加搜索框或其他操作 -->
|
<!-- 可以在这里添加搜索框或其他操作 -->
|
||||||
@ -74,8 +75,8 @@
|
|||||||
</KeepAlive>
|
</KeepAlive>
|
||||||
</div>
|
</div>
|
||||||
<div class="window-body-bottom">
|
<div class="window-body-bottom">
|
||||||
<el-button @click="resetForm">重置</el-button>
|
<el-button @click="resetForm" disabled>重置</el-button>
|
||||||
<el-button type="primary" @click="saveProductDetail">保存</el-button>
|
<el-button type="primary" @click="saveProductDetail" disabled>保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -83,8 +84,8 @@
|
|||||||
<!-- <aside class="right-col">
|
<!-- <aside class="right-col">
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<div class="panel-actions">
|
<div class="panel-actions">
|
||||||
<el-button>重置</el-button>
|
<el-button disabled>重置</el-button>
|
||||||
<el-button type="primary" @click="handleSave" :loading="saveLoading">
|
<el-button type="primary" @click="handleSave" :loading="saveLoading" disabled>
|
||||||
保存
|
保存
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -94,7 +95,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted, computed, reactive } from 'vue'
|
import { ref, onMounted, onUnmounted, computed, reactive, watch } from 'vue'
|
||||||
import { productdetail,productquick,productsnapshop,windowtopbar } from '../receiving-config'
|
import { productdetail,productquick,productsnapshop,windowtopbar } from '../receiving-config'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { FullScreen, Close, CopyDocument } from '@element-plus/icons-vue'
|
import { FullScreen, Close, CopyDocument } from '@element-plus/icons-vue'
|
||||||
@ -104,7 +105,128 @@ import basic from '../window/basic.vue'
|
|||||||
import log from '../window/log.vue'
|
import log from '../window/log.vue'
|
||||||
import product from '../window/product.vue'
|
import product from '../window/product.vue'
|
||||||
|
|
||||||
const props = defineProps<{ id?: string | number }>()
|
const props = defineProps<{
|
||||||
|
id?: string | number,
|
||||||
|
productData?: any[],
|
||||||
|
loading?: boolean,
|
||||||
|
productTotal?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// 模拟数据
|
||||||
|
// const mockProductData = [
|
||||||
|
// {
|
||||||
|
// id: 1,
|
||||||
|
// receiving_number: 'RCV202601180001',
|
||||||
|
// item_name: '商品A - 测试商品',
|
||||||
|
// barcodes: '6901234567890',
|
||||||
|
// product_snapshot: '{"id": null, "name": "商品A - 测试商品", "barcode": "6901234567890", "spec": "500g/袋"}',
|
||||||
|
// system_product_id: null,
|
||||||
|
// actual_quantity: 20,
|
||||||
|
// box_quantity: 2,
|
||||||
|
// boxes_per_pallet: 10,
|
||||||
|
// pallet_quantity: 0,
|
||||||
|
// receiving_time: '2026-01-18 22:43:42',
|
||||||
|
// receiving_status_display: '已完成',
|
||||||
|
// storage_status: '未入库',
|
||||||
|
// stored_quantity: 0,
|
||||||
|
// batch_number: 'BATCH20231215A',
|
||||||
|
// production_date: '2023-12-01',
|
||||||
|
// expiry_date: '2024-12-01',
|
||||||
|
// remark: '商品A测试明细 - 未匹配',
|
||||||
|
// box_length: 40,
|
||||||
|
// box_width: 30,
|
||||||
|
// box_height: 25,
|
||||||
|
// weight: 10.5,
|
||||||
|
// space_id: 'A-01-01',
|
||||||
|
// creator_id: 'EMP001',
|
||||||
|
// updated_at_display: '2026-01-18 22:43:42',
|
||||||
|
// created_at_display: '2026-01-18 22:43:42'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 2,
|
||||||
|
// receiving_number: 'RCV202601180001',
|
||||||
|
// item_name: '商品B - 进口商品',
|
||||||
|
// barcodes: '8801234567890',
|
||||||
|
// product_snapshot: '{"id": null, "name": "商品B - 进口商品", "barcode": "8801234567890", "origin": "日本", "spec": "1kg/盒"}',
|
||||||
|
// system_product_id: null,
|
||||||
|
// actual_quantity: 15,
|
||||||
|
// box_quantity: 1,
|
||||||
|
// boxes_per_pallet: 15,
|
||||||
|
// pallet_quantity: 1,
|
||||||
|
// receiving_time: '2026-01-18 22:43:42',
|
||||||
|
// receiving_status_display: '已完成',
|
||||||
|
// storage_status: '未入库',
|
||||||
|
// stored_quantity: 0,
|
||||||
|
// batch_number: 'BATCH20231215B',
|
||||||
|
// production_date: '2023-11-15',
|
||||||
|
// expiry_date: '2024-11-15',
|
||||||
|
// remark: '商品B测试明细 - 未匹配',
|
||||||
|
// box_length: 50,
|
||||||
|
// box_width: 40,
|
||||||
|
// box_height: 30,
|
||||||
|
// weight: 15.0,
|
||||||
|
// space_id: 'B-02-05',
|
||||||
|
// creator_id: 'EMP001',
|
||||||
|
// updated_at_display: '2026-01-18 22:43:42',
|
||||||
|
// created_at_display: '2026-01-18 22:43:42'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 3,
|
||||||
|
// receiving_number: 'RCV202601180001',
|
||||||
|
// item_name: '商品C - 电子商品',
|
||||||
|
// barcodes: '4901234567890',
|
||||||
|
// product_snapshot: '{"id": null, "name": "商品C - 电子商品", "barcode": "4901234567890", "brand": "索尼", "model": "X-100"}',
|
||||||
|
// system_product_id: 152656,
|
||||||
|
// actual_quantity: 15,
|
||||||
|
// box_quantity: 2,
|
||||||
|
// boxes_per_pallet: 8,
|
||||||
|
// pallet_quantity: 1,
|
||||||
|
// receiving_time: '2026-01-18 21:43:42',
|
||||||
|
// receiving_status_display: '已完成',
|
||||||
|
// storage_status: '部分入库',
|
||||||
|
// stored_quantity: 5,
|
||||||
|
// batch_number: 'BATCH20231215C',
|
||||||
|
// production_date: '2023-10-01',
|
||||||
|
// expiry_date: '2025-10-01',
|
||||||
|
// remark: '商品C测试明细 - 未匹配',
|
||||||
|
// box_length: 30,
|
||||||
|
// box_width: 20,
|
||||||
|
// box_height: 15,
|
||||||
|
// weight: 5.2,
|
||||||
|
// space_id: 'C-01-12',
|
||||||
|
// creator_id: 'EMP001',
|
||||||
|
// updated_at_display: '2026-01-18 22:43:42',
|
||||||
|
// created_at_display: '2026-01-18 22:43:42'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 48,
|
||||||
|
// receiving_number: 'RCV2026020100002',
|
||||||
|
// item_name: 'MOODAMOR绮梦茉莉香型香水',
|
||||||
|
// barcodes: '6942233906190',
|
||||||
|
// product_snapshot: '{"store_id":1000166,"store_name":"花颜物语","updated_at":"2026-02-02T08:37:06.691Z"}',
|
||||||
|
// system_product_id: null,
|
||||||
|
// actual_quantity: 1000,
|
||||||
|
// box_quantity: 10,
|
||||||
|
// boxes_per_pallet: 100,
|
||||||
|
// pallet_quantity: 20,
|
||||||
|
// receiving_time: '2026-02-02 07:10:26',
|
||||||
|
// receiving_status_display: '收货中',
|
||||||
|
// storage_status: '未入库',
|
||||||
|
// stored_quantity: 0,
|
||||||
|
// batch_number: '20260202',
|
||||||
|
// production_date: '2025-12-01',
|
||||||
|
// expiry_date: '2028-12-01',
|
||||||
|
// remark: '1561534',
|
||||||
|
// box_length: 45,
|
||||||
|
// box_width: 35,
|
||||||
|
// box_height: 30,
|
||||||
|
// weight: 12.8,
|
||||||
|
// space_id: 'D-05-01',
|
||||||
|
// creator_id: 'EMP030',
|
||||||
|
// updated_at_display: '2026-02-02 13:24:43',
|
||||||
|
// created_at_display: '2026-02-02 07:10:26'
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
|
||||||
const tableData = ref<any[]>([])
|
const tableData = ref<any[]>([])
|
||||||
const multipleSelection = ref<any[]>([])
|
const multipleSelection = ref<any[]>([])
|
||||||
@ -119,16 +241,53 @@ const pagination = reactive({
|
|||||||
|
|
||||||
const queryTime = ref(0)
|
const queryTime = ref(0)
|
||||||
|
|
||||||
|
// 监听外部数据变化
|
||||||
|
watch(() => props.productData, (newVal) => {
|
||||||
|
if (newVal && newVal.length > 0) {
|
||||||
|
tableData.value = [...newVal]
|
||||||
|
pagination.total = props.productTotal || newVal.length
|
||||||
|
} else if (!props.loading) {
|
||||||
|
// 只有在非加载状态下且没有数据时才使用模拟数据
|
||||||
|
// tableData.value = [...mockProductData]
|
||||||
|
// pagination.total = mockProductData.length
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
const emit = defineEmits(['page-change', 'page-size-change', 'refresh-product'])
|
||||||
|
|
||||||
const handlePageSizeChange = (val: number) => {
|
const handlePageSizeChange = (val: number) => {
|
||||||
pagination.pageSize = val
|
pagination.pageSize = val
|
||||||
// 这里可以重新请求接口获取数据
|
emit('page-size-change', val)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePageChange = (val: number) => {
|
const handlePageChange = (val: number) => {
|
||||||
pagination.currentPage = val
|
pagination.currentPage = val
|
||||||
// 这里可以重新请求接口获取数据
|
emit('page-change', val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loadProductData = () => {
|
||||||
|
// 请求父组件刷新商品数据
|
||||||
|
emit('refresh-product')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 监听 props.loading
|
||||||
|
watch(() => props.loading, (val) => {
|
||||||
|
if (!val && (!props.productData || props.productData.length === 0)) {
|
||||||
|
// tableData.value = [...mockProductData]
|
||||||
|
// pagination.total = mockProductData.length
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听 props.productTotal
|
||||||
|
watch(() => props.productTotal, (val) => {
|
||||||
|
if (val !== undefined) {
|
||||||
|
pagination.total = val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const handleRowClick = (row: any) => {
|
const handleRowClick = (row: any) => {
|
||||||
currentRow.value = row
|
currentRow.value = row
|
||||||
}
|
}
|
||||||
@ -243,122 +402,6 @@ const saveProductDetail = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模拟数据
|
|
||||||
const mockProductData = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
receiving_number: 'RCV202601180001',
|
|
||||||
item_name: '商品A - 测试商品',
|
|
||||||
barcodes: '6901234567890',
|
|
||||||
product_snapshot: '{"id": null, "name": "商品A - 测试商品", "barcode": "6901234567890", "spec": "500g/袋"}',
|
|
||||||
system_product_id: null,
|
|
||||||
actual_quantity: 20,
|
|
||||||
box_quantity: 2,
|
|
||||||
boxes_per_pallet: 10,
|
|
||||||
pallet_quantity: 0,
|
|
||||||
receiving_time: '2026-01-18 22:43:42',
|
|
||||||
receiving_status_display: '已完成',
|
|
||||||
storage_status: '未入库',
|
|
||||||
stored_quantity: 0,
|
|
||||||
batch_number: 'BATCH20231215A',
|
|
||||||
production_date: '2023-12-01',
|
|
||||||
expiry_date: '2024-12-01',
|
|
||||||
remark: '商品A测试明细 - 未匹配',
|
|
||||||
box_length: 40,
|
|
||||||
box_width: 30,
|
|
||||||
box_height: 25,
|
|
||||||
weight: 10.5,
|
|
||||||
space_id: 'A-01-01',
|
|
||||||
creator_id: 'EMP001',
|
|
||||||
updated_at_display: '2026-01-18 22:43:42',
|
|
||||||
created_at_display: '2026-01-18 22:43:42'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
receiving_number: 'RCV202601180001',
|
|
||||||
item_name: '商品B - 进口商品',
|
|
||||||
barcodes: '8801234567890',
|
|
||||||
product_snapshot: '{"id": null, "name": "商品B - 进口商品", "barcode": "8801234567890", "origin": "日本", "spec": "1kg/盒"}',
|
|
||||||
system_product_id: null,
|
|
||||||
actual_quantity: 15,
|
|
||||||
box_quantity: 1,
|
|
||||||
boxes_per_pallet: 15,
|
|
||||||
pallet_quantity: 1,
|
|
||||||
receiving_time: '2026-01-18 22:43:42',
|
|
||||||
receiving_status_display: '已完成',
|
|
||||||
storage_status: '未入库',
|
|
||||||
stored_quantity: 0,
|
|
||||||
batch_number: 'BATCH20231215B',
|
|
||||||
production_date: '2023-11-15',
|
|
||||||
expiry_date: '2024-11-15',
|
|
||||||
remark: '商品B测试明细 - 未匹配',
|
|
||||||
box_length: 50,
|
|
||||||
box_width: 40,
|
|
||||||
box_height: 30,
|
|
||||||
weight: 15.0,
|
|
||||||
space_id: 'B-02-05',
|
|
||||||
creator_id: 'EMP001',
|
|
||||||
updated_at_display: '2026-01-18 22:43:42',
|
|
||||||
created_at_display: '2026-01-18 22:43:42'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
receiving_number: 'RCV202601180001',
|
|
||||||
item_name: '商品C - 电子商品',
|
|
||||||
barcodes: '4901234567890',
|
|
||||||
product_snapshot: '{"id": null, "name": "商品C - 电子商品", "barcode": "4901234567890", "brand": "索尼", "model": "X-100"}',
|
|
||||||
system_product_id: 152656,
|
|
||||||
actual_quantity: 15,
|
|
||||||
box_quantity: 2,
|
|
||||||
boxes_per_pallet: 8,
|
|
||||||
pallet_quantity: 1,
|
|
||||||
receiving_time: '2026-01-18 21:43:42',
|
|
||||||
receiving_status_display: '已完成',
|
|
||||||
storage_status: '部分入库',
|
|
||||||
stored_quantity: 5,
|
|
||||||
batch_number: 'BATCH20231215C',
|
|
||||||
production_date: '2023-10-01',
|
|
||||||
expiry_date: '2025-10-01',
|
|
||||||
remark: '商品C测试明细 - 未匹配',
|
|
||||||
box_length: 30,
|
|
||||||
box_width: 20,
|
|
||||||
box_height: 15,
|
|
||||||
weight: 5.2,
|
|
||||||
space_id: 'C-01-12',
|
|
||||||
creator_id: 'EMP001',
|
|
||||||
updated_at_display: '2026-01-18 22:43:42',
|
|
||||||
created_at_display: '2026-01-18 22:43:42'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 48,
|
|
||||||
receiving_number: 'RCV2026020100002',
|
|
||||||
item_name: 'MOODAMOR绮梦茉莉香型香水',
|
|
||||||
barcodes: '6942233906190',
|
|
||||||
product_snapshot: '{"store_id":1000166,"store_name":"花颜物语","updated_at":"2026-02-02T08:37:06.691Z"}',
|
|
||||||
system_product_id: null,
|
|
||||||
actual_quantity: 1000,
|
|
||||||
box_quantity: 10,
|
|
||||||
boxes_per_pallet: 100,
|
|
||||||
pallet_quantity: 20,
|
|
||||||
receiving_time: '2026-02-02 07:10:26',
|
|
||||||
receiving_status_display: '收货中',
|
|
||||||
storage_status: '未入库',
|
|
||||||
stored_quantity: 0,
|
|
||||||
batch_number: '20260202',
|
|
||||||
production_date: '2025-12-01',
|
|
||||||
expiry_date: '2028-12-01',
|
|
||||||
remark: '1561534',
|
|
||||||
box_length: 45,
|
|
||||||
box_width: 35,
|
|
||||||
box_height: 30,
|
|
||||||
weight: 12.8,
|
|
||||||
space_id: 'D-05-01',
|
|
||||||
creator_id: 'EMP030',
|
|
||||||
updated_at_display: '2026-02-02 13:24:43',
|
|
||||||
created_at_display: '2026-02-02 07:10:26'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
try {
|
try {
|
||||||
saveLoading.value = true
|
saveLoading.value = true
|
||||||
@ -373,8 +416,13 @@ const handleSave = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tableData.value = [...mockProductData]
|
if (props.productData && props.productData.length > 0) {
|
||||||
pagination.total = mockProductData.length
|
tableData.value = [...props.productData]
|
||||||
|
pagination.total = props.productData.length
|
||||||
|
} else if (!props.loading) {
|
||||||
|
// tableData.value = [...mockProductData]
|
||||||
|
// pagination.total = mockProductData.length
|
||||||
|
}
|
||||||
window.addEventListener('click', closeMenu)
|
window.addEventListener('click', closeMenu)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -498,8 +546,8 @@ onUnmounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 35px;
|
height: 40px;
|
||||||
background-color: antiquewhite;
|
background-color: rgb(235, 235, 235);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,7 +105,17 @@
|
|||||||
|
|
||||||
<div class="detail-container">
|
<div class="detail-container">
|
||||||
<KeepAlive>
|
<KeepAlive>
|
||||||
<component :is="activeComponent" :id="selectedReceivingId" :row="selectedRow" @refresh="loadData" />
|
<component
|
||||||
|
:is="activeComponent"
|
||||||
|
:id="selectedReceivingId"
|
||||||
|
:row="selectedRow"
|
||||||
|
:product-data="productData"
|
||||||
|
:product-total="productTotal"
|
||||||
|
:loading="productLoading"
|
||||||
|
@refresh-product="loadProductData"
|
||||||
|
@page-change="handleProductPageChange"
|
||||||
|
@page-size-change="handleProductSizeChange"
|
||||||
|
/>
|
||||||
</KeepAlive>
|
</KeepAlive>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -255,8 +265,69 @@ function onSelectionChange(rows: any[]) {
|
|||||||
hasSelection.value = selectionRows.value.length > 0
|
hasSelection.value = selectionRows.value.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRowClick(row: any) {
|
const productData = ref<any[]>([])
|
||||||
|
const productLoading = ref(false)
|
||||||
|
const productTotal = ref(0)
|
||||||
|
const productPagination = reactive({ currentPage: 1, pageSize: 20 })
|
||||||
|
|
||||||
|
async function handleRowClick(row: any) {
|
||||||
selectedReceivingId.value = row?.id || null
|
selectedReceivingId.value = row?.id || null
|
||||||
|
if (!selectedReceivingId.value) {
|
||||||
|
productData.value = []
|
||||||
|
productTotal.value = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 重置分页
|
||||||
|
productPagination.currentPage = 1
|
||||||
|
loadProductData()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadProductData() {
|
||||||
|
productLoading.value = true
|
||||||
|
const start = Date.now()
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
id: selectedReceivingId.value,
|
||||||
|
pagination: {
|
||||||
|
page: productPagination.currentPage,
|
||||||
|
pageSize: productPagination.pageSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const res: any = await receivingApi.getReceivingDetail(params)
|
||||||
|
if (res && res.code === 200 && res.data) {
|
||||||
|
// 这里的路径需要匹配实际返回的数据结构 res.data.receiving.details
|
||||||
|
const receivingData = res.data.receiving || {}
|
||||||
|
if (Array.isArray(receivingData.details)) {
|
||||||
|
productData.value = receivingData.details
|
||||||
|
productTotal.value = receivingData.pagination?.total || receivingData.details.length || 0
|
||||||
|
} else {
|
||||||
|
// 兼容处理
|
||||||
|
productData.value = []
|
||||||
|
productTotal.value = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
productData.value = []
|
||||||
|
productTotal.value = 0
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('获取收货单详情失败', e)
|
||||||
|
productData.value = []
|
||||||
|
productTotal.value = 0
|
||||||
|
} finally {
|
||||||
|
productLoading.value = false
|
||||||
|
// queryTime.value = Date.now() - start // 这里queryTime是给主表的,子表可能需要单独传
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleProductPageChange(page: number) {
|
||||||
|
productPagination.currentPage = page
|
||||||
|
loadProductData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleProductSizeChange(size: number) {
|
||||||
|
productPagination.pageSize = size
|
||||||
|
productPagination.currentPage = 1
|
||||||
|
loadProductData()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePageChange(page: number) {
|
function handlePageChange(page: number) {
|
||||||
|
|||||||
@ -175,6 +175,12 @@ export const availableFields = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const addReceving = [
|
||||||
|
{ prop: 'receiving_number', label: '收货单号', type: 'input' },
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 详情面板表单配置
|
// 详情面板表单配置
|
||||||
export const detailpanel = [
|
export const detailpanel = [
|
||||||
{ prop: 'receiving_number', label: '收货单号', type: 'input', disabled: true },
|
{ prop: 'receiving_number', label: '收货单号', type: 'input', disabled: true },
|
||||||
@ -203,17 +209,17 @@ export const productsnapshop = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export const productdetail = [
|
export const productdetail = [
|
||||||
{ prop: 'receiving_number', label: '收货单号', width: '160', fixed: 'left' },
|
{ prop: 'id', label: 'ID', width: '100' },
|
||||||
{ prop: 'item_name', label: '商品名称', width: '160', fixed: 'left' },
|
{ prop: 'product_name', label: '商品名称', width: '160', fixed: 'left' },
|
||||||
{ prop:'barcodes',label: '商品条码',width:'160' },
|
{ prop: 'barcode', label: '商品条码', width: '160' },
|
||||||
{ prop: 'product_snapshot', label: '商品信息快照', width: '160' },
|
{ prop: 'product_snapshot', label: '商品信息快照', width: '160' },
|
||||||
{ prop: 'system_product_id', label: '关联系统商品ID', width: '160' },
|
{ prop: 'system_product_id', label: '关联系统商品ID', width: '160' },
|
||||||
{ prop:'actual_quantity',label: '实际收货数量',width:'160' },
|
{ prop: 'actual_quantity', label: '实际收货数量', width: '160' },
|
||||||
{ prop: 'box_quantity', label: '箱数', width: '160' },
|
{ prop: 'box_quantity', label: '箱数', width: '160' },
|
||||||
{ prop:'boxes_per_pallet',label: '箱规',width:'160' },
|
{ prop: 'boxes_per_pallet', label: '箱规', width: '160' },
|
||||||
{ prop: 'pallet_quantity', label: '托盘数', width: '160' },
|
{ prop: 'pallet_quantity', label: '托盘数', width: '160' },
|
||||||
{ prop: 'receiving_time', label: '收货时间', width: '160' },
|
{ prop: 'receiving_time', label: '收货时间', width: '160' },
|
||||||
{ prop: 'receiving_status_display', label: '收货状态', width: '160' },
|
{ prop: 'receiving_status', label: '收货状态', width: '160' },
|
||||||
{ prop: 'storage_status', label: '入库状态', width: '160' },
|
{ prop: 'storage_status', label: '入库状态', width: '160' },
|
||||||
{ prop: 'stored_quantity', label: '已入库数量', width: '160' },
|
{ prop: 'stored_quantity', label: '已入库数量', width: '160' },
|
||||||
{ prop: 'batch_number', label: '批次号', width: '160' },
|
{ prop: 'batch_number', label: '批次号', width: '160' },
|
||||||
@ -226,14 +232,15 @@ export const productdetail = [
|
|||||||
{ prop: 'weight', label: '重量', width: '160' },
|
{ prop: 'weight', label: '重量', width: '160' },
|
||||||
{ prop: 'space_id', label: '存放位置', width: '160' },
|
{ prop: 'space_id', label: '存放位置', width: '160' },
|
||||||
{ prop: 'creator_id', label: '创建人ID', width: '160' },
|
{ prop: 'creator_id', label: '创建人ID', width: '160' },
|
||||||
{ prop: 'updated_at_display', label: '更新时间', width: '160' },
|
{ prop: 'updated_at', label: '更新时间', width: '160' },
|
||||||
{ prop: 'created_at_display', label: '创建时间', width: '160' },
|
{ prop: 'created_at', label: '创建时间', width: '160' },
|
||||||
]
|
]
|
||||||
|
|
||||||
export const productquick = [
|
export const productquick = [
|
||||||
{ prop: 'receiving_number', label: '收货单号', width: '160', fixed: 'left' },
|
{ prop: 'id', label: 'ID', width: '100' },
|
||||||
{ prop: 'item_name', label: '商品名称', width: '160', fixed: 'left' },
|
{ prop: 'product_name', label: '商品名称', width: '160', fixed: 'left' },
|
||||||
{ prop:'actual_quantity',label: '实际收货数量',width:'160' },
|
{ prop: 'barcode', label: '条码', width: '160' },
|
||||||
|
{ prop: 'actual_quantity', label: '实际收货数量', width: '160' },
|
||||||
{ prop: 'box_quantity', label: '箱数', width: '160' },
|
{ prop: 'box_quantity', label: '箱数', width: '160' },
|
||||||
{ prop: 'storage_status', label: '入库状态', width: '160' },
|
{ prop: 'storage_status', label: '入库状态', width: '160' },
|
||||||
{ prop: 'remark', label: '备注', width: '160' },
|
{ prop: 'remark', label: '备注', width: '160' },
|
||||||
|
|||||||
9
src/views/storage/stock/index.vue
Normal file
9
src/views/storage/stock/index.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div class="">
|
||||||
|
<h1>库存管理</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style lang="css" scoped></style>
|
||||||
Loading…
x
Reference in New Issue
Block a user