Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
4545b5dc
Commit
4545b5dc
authored
Jun 11, 2025
by
wuqian
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wq' into dev
parents
02083ceb
22a5a2d2
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
581 additions
and
208 deletions
+581
-208
src/api/order.ts
+4
-3
src/api/warehouse.ts
+16
-2
src/components/NavMenu.vue
+2
-1
src/router/index.ts
+8
-8
src/router/menu.ts
+5
-5
src/types/api/index.ts
+0
-13
src/types/api/order.ts
+14
-1
src/types/api/warehouse.ts
+8
-0
src/utils/hooks/commonUtil.ts
+0
-1
src/views/warehouse/issueDoc.vue
+339
-104
src/views/warehouse/receiptDoc.vue
+181
-64
src/views/warehouse/warning.vue
+4
-6
No files found.
src/api/order.ts
View file @
4545b5dc
import
{
BasePaginationData
,
BaseRespData
,
RejectParams
}
from
'@/types/api'
import
{
BasePaginationData
,
BaseRespData
}
from
'@/types/api'
import
axios
from
'./axios'
import
axios
from
'./axios'
import
{
PaymentForm
}
from
'@/types/api/index.ts'
import
{
import
{
LogListData
,
LogListData
,
OrderData
,
OrderData
,
...
@@ -11,6 +10,8 @@ import {
...
@@ -11,6 +10,8 @@ import {
ShipmentOrderRes
,
ShipmentOrderRes
,
Tab
,
Tab
,
InspectionData
,
InspectionData
,
PaymentForm
,
RejectParams
}
from
'@/types/api/order'
}
from
'@/types/api/order'
import
{
import
{
apiSubmitPodOrderForm
,
apiSubmitPodOrderForm
,
...
@@ -151,7 +152,7 @@ export function apiSetCraftData({
...
@@ -151,7 +152,7 @@ export function apiSetCraftData({
}:
{
}:
{
id
:
number
|
undefined
id
:
number
|
undefined
craftTotalPrice
:
number
|
undefined
craftTotalPrice
:
number
|
undefined
recNumber
:
string
|
undefined
recNumber
:
string
|
undefined
craftPriceList
:
IUpdatePrice
[]
craftPriceList
:
IUpdatePrice
[]
})
{
})
{
return
axios
.
post
<
never
,
BaseRespData
<
never
>>
(
return
axios
.
post
<
never
,
BaseRespData
<
never
>>
(
...
...
src/api/warehouse.ts
View file @
4545b5dc
...
@@ -314,9 +314,9 @@ export function InRecordBatchCheckPrintApi(ids: string) {
...
@@ -314,9 +314,9 @@ export function InRecordBatchCheckPrintApi(ids: string) {
},
},
)
)
}
}
export
function
warehouseInRecord
Inventory
(
data
:
ExportInWarehouseInfo
)
{
export
function
warehouseInRecord
Export
(
data
:
ExportInWarehouseInfo
)
{
return
axios
.
post
<
never
,
BasePaginationData
<
never
>>
(
return
axios
.
post
<
never
,
BasePaginationData
<
never
>>
(
'factory/warehouseInRecord/
inventory
'
,
'factory/warehouseInRecord/
export
'
,
data
,
data
,
)
)
}
}
...
@@ -438,6 +438,20 @@ export function getInRecordLogApi(inRecordId?: number) {
...
@@ -438,6 +438,20 @@ export function getInRecordLogApi(inRecordId?: number) {
)
)
}
}
// 出库单
// 出库单
export
function
warehouseOutRecordExport
(
data
:
ExportInWarehouseInfo
)
{
return
axios
.
post
<
never
,
BasePaginationData
<
never
>>
(
'factory/warehouseOutRecord/export'
,
data
,
)
}
export
function
OutRecordBatchCheckPrintApi
(
ids
:
string
)
{
return
axios
.
get
<
never
,
BaseRespData
<
never
[]
>>
(
'factory/warehouseOutRecord/batchCheckPrint'
,
{
params
:
{
ids
},
},
)
}
export
function
getOutRecordStatusTree
()
{
export
function
getOutRecordStatusTree
()
{
return
axios
.
get
<
never
,
BaseRespData
<
InterWarehouseTree
[]
>>
(
return
axios
.
get
<
never
,
BaseRespData
<
InterWarehouseTree
[]
>>
(
'factory/warehouseOutRecord/status_tree'
,
'factory/warehouseOutRecord/status_tree'
,
...
...
src/components/NavMenu.vue
View file @
4545b5dc
...
@@ -87,8 +87,9 @@
...
@@ -87,8 +87,9 @@
>
>
<div
class=
"nav-tabs-node_label"
>
<div
class=
"nav-tabs-node_label"
>
<span>
{{ item.title }}
</span>
<span>
{{ item.title }}
</span>
<!-- 首页不可删除 -->
<el-icon
<el-icon
v-if=
"tabs.length > 1"
v-if=
"
item.path != '/dashboard' &&
tabs.length > 1"
class=
"el-icon-close"
class=
"el-icon-close"
@
click
.
stop=
"removeTab(item.name)"
@
click
.
stop=
"removeTab(item.name)"
>
>
...
...
src/router/index.ts
View file @
4545b5dc
...
@@ -27,8 +27,8 @@ import WarehouseManage from '@/views/warehouse/manage.vue'
...
@@ -27,8 +27,8 @@ import WarehouseManage from '@/views/warehouse/manage.vue'
import
WarehouseWarning
from
'@/views/warehouse/warning.vue'
import
WarehouseWarning
from
'@/views/warehouse/warning.vue'
import
WarehousePosition
from
'@/views/warehouse/position.vue'
import
WarehousePosition
from
'@/views/warehouse/position.vue'
import
receiptDoc
from
'@/views/warehouse/receiptDoc.vue'
import
receiptDoc
from
'@/views/warehouse/receiptDoc.vue'
import
issueDoc
from
'@/views/warehouse/issueDoc.vue'
import
ExternalAuthorisationPage
from
'@/views/system/externalAuthorisationPage.vue'
import
ExternalAuthorisationPage
from
'@/views/system/externalAuthorisationPage.vue'
// import issueDoc from '@/views/warehouse/issueDoc.vue'
const
router
=
createRouter
({
const
router
=
createRouter
({
history
:
createWebHistory
(),
history
:
createWebHistory
(),
routes
:
[
routes
:
[
...
@@ -197,13 +197,13 @@ const router = createRouter({
...
@@ -197,13 +197,13 @@ const router = createRouter({
},
},
component
:
receiptDoc
,
component
:
receiptDoc
,
},
},
//
{
{
//
path: '/warehouse/issue-doc',
path
:
'/warehouse/issue-doc'
,
//
meta: {
meta
:
{
//
title: '出库单',
title
:
'出库单'
,
//
},
},
//
component: issueDoc,
component
:
issueDoc
,
//
},
},
{
{
path
:
'/warehouse/warning'
,
path
:
'/warehouse/warning'
,
meta
:
{
meta
:
{
...
...
src/router/menu.ts
View file @
4545b5dc
...
@@ -78,11 +78,11 @@ const menu: MenuItem[] = [
...
@@ -78,11 +78,11 @@ const menu: MenuItem[] = [
id
:
123
,
id
:
123
,
label
:
'入库单'
,
label
:
'入库单'
,
},
},
//
{
{
//
index: '/warehouse/issue-doc',
index
:
'/warehouse/issue-doc'
,
//
id: 124,
id
:
124
,
//
label: '出库单',
label
:
'出库单'
,
//
},
},
{
{
index
:
'/warehouse/manage'
,
index
:
'/warehouse/manage'
,
...
...
src/types/api/index.ts
View file @
4545b5dc
...
@@ -35,17 +35,4 @@ export interface baseRes {
...
@@ -35,17 +35,4 @@ export interface baseRes {
code
:
number
code
:
number
msg
:
string
msg
:
string
}
}
export
interface
PaymentForm
{
waterList
:
string
id
?:
number
|
string
actualAmount
?:
number
|
string
payableAmount
?:
number
|
string
recNumber
?:
number
|
string
}
export
interface
RejectParams
{
id
:
number
description
?:
string
ids
?:
string
pass
?:
number
}
src/types/api/order.ts
View file @
4545b5dc
...
@@ -81,7 +81,7 @@ export interface ProductList {
...
@@ -81,7 +81,7 @@ export interface ProductList {
subOrderNumber
?:
string
subOrderNumber
?:
string
shopNumber
?:
string
shopNumber
?:
string
material
?:
string
material
?:
string
materialPrice
?:
number
|
null
materialPrice
?:
number
|
null
count
?:
number
count
?:
number
baseSku
?:
string
baseSku
?:
string
erpSubOrderNumber
?:
string
erpSubOrderNumber
?:
string
...
@@ -277,3 +277,16 @@ export interface ICompareObjects {
...
@@ -277,3 +277,16 @@ export interface ICompareObjects {
lanshouPost
?:
string
lanshouPost
?:
string
lanshouRegion
?:
string
lanshouRegion
?:
string
}
}
export
interface
PaymentForm
{
waterList
:
string
id
?:
number
|
string
actualAmount
?:
number
|
string
payableAmount
?:
number
|
string
recNumber
?:
number
|
string
}
export
interface
RejectParams
{
id
:
number
description
?:
string
ids
?:
string
pass
?:
number
}
src/types/api/warehouse.ts
View file @
4545b5dc
...
@@ -5,6 +5,8 @@ export interface warehouseSearchForm {
...
@@ -5,6 +5,8 @@ export interface warehouseSearchForm {
billStatus
?:
string
billStatus
?:
string
createTimeEnd
?:
string
createTimeEnd
?:
string
createTimeStart
?:
string
createTimeStart
?:
string
startTime
?:
string
endTime
?:
string
inNo
?:
string
inNo
?:
string
outNo
?:
string
outNo
?:
string
warehouseSku
?:
string
warehouseSku
?:
string
...
@@ -14,6 +16,7 @@ export interface warehouseSearchForm {
...
@@ -14,6 +16,7 @@ export interface warehouseSearchForm {
export
interface
InterProductList
{
export
interface
InterProductList
{
createTime
?:
string
createTime
?:
string
id
?:
number
id
?:
number
inventoryId
?:
number
|
null
inId
?:
number
inId
?:
number
productNo
?:
string
|
null
//custom的货号
productNo
?:
string
|
null
//custom的货号
buyStored
?:
number
|
null
//入库数量
buyStored
?:
number
|
null
//入库数量
...
@@ -42,6 +45,7 @@ export interface InterWarehouseBase {
...
@@ -42,6 +45,7 @@ export interface InterWarehouseBase {
total
?:
number
total
?:
number
totalPrice
?:
number
totalPrice
?:
number
billStatus
?:
string
billStatus
?:
string
billStatusTxt
?:
string
remark
?:
string
|
null
remark
?:
string
|
null
dataVersion
?:
number
dataVersion
?:
number
createTime
?:
string
|
null
createTime
?:
string
|
null
...
@@ -86,6 +90,9 @@ export interface InterProductList {
...
@@ -86,6 +90,9 @@ export interface InterProductList {
warehouseSku
?:
string
warehouseSku
?:
string
locationId
?:
number
|
null
locationId
?:
number
|
null
locationCode
?:
string
|
null
locationCode
?:
string
|
null
inventory
?:
{
usableInventory
?:
number
}
}
}
export
interface
InterskuList
{
export
interface
InterskuList
{
id
?:
number
id
?:
number
...
@@ -101,6 +108,7 @@ export interface InterskuList {
...
@@ -101,6 +108,7 @@ export interface InterskuList {
price
?:
number
|
null
//出库单的
price
?:
number
|
null
//出库单的
usableInventory
?:
number
|
null
usableInventory
?:
number
|
null
warehouseSku
?:
string
warehouseSku
?:
string
remark
?:
string
|
null
}
}
export
interface
ILocation
{
export
interface
ILocation
{
id
?:
number
id
?:
number
...
...
src/utils/hooks/commonUtil.ts
View file @
4545b5dc
...
@@ -108,7 +108,6 @@ export function checkUpdateParams(
...
@@ -108,7 +108,6 @@ export function checkUpdateParams(
removeList
=
arr1
.
map
((
item
)
=>
item
[
'id'
]
as
IdType
)
removeList
=
arr1
.
map
((
item
)
=>
item
[
'id'
]
as
IdType
)
}
}
if
(
isBackKeyName
)
{
if
(
isBackKeyName
)
{
console
.
log
(
isBackKeyName
)
// 将列表直接添加到 params 顶层
// 将列表直接添加到 params 顶层
if
(
addList
.
length
>
0
)
params
[
'addList'
]
=
addList
||
undefined
if
(
addList
.
length
>
0
)
params
[
'addList'
]
=
addList
||
undefined
if
(
updateList
.
length
>
0
)
if
(
updateList
.
length
>
0
)
...
...
src/views/warehouse/issueDoc.vue
View file @
4545b5dc
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<
template
#
top
>
<
template
#
top
>
<
div
class
=
"header-filter-form"
>
<
div
class
=
"header-filter-form"
>
<
ElForm
:
model
=
"searchForm"
inline
>
<
ElForm
:
model
=
"searchForm"
inline
>
<
ElFormItem
label
=
"
采购
仓库"
>
<
ElFormItem
label
=
"仓库"
>
<
ElSelect
<
ElSelect
v
-
model
=
"searchForm.warehouseId"
v
-
model
=
"searchForm.warehouseId"
clearable
clearable
...
@@ -117,10 +117,10 @@
...
@@ -117,10 +117,10 @@
>
>
删除
删除
<
/el-button
>
<
/el-button
>
<
!--
<
el
-
button
type
=
"success"
@
click
=
"handleExport"
>
导出
<
/el-button
>
<
el
-
button
type
=
"success"
@
click
=
"handleExport"
>
导出
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"printProductTag"
>
<
el
-
button
type
=
"primary"
@
click
=
"printProductTag"
>
打印商品
SKU
标签
打印商品
SKU
标签
<
/el-button>
--
>
<
/el-button
>
<
el
-
button
<
el
-
button
v
-
if
=
"nodeCode === 'PENDING_AUDIT'"
v
-
if
=
"nodeCode === 'PENDING_AUDIT'"
type
=
"warning"
type
=
"warning"
...
@@ -190,7 +190,7 @@
...
@@ -190,7 +190,7 @@
<
ElTableColumn
<
ElTableColumn
label
=
"单据状态"
label
=
"单据状态"
width
=
"130"
width
=
"130"
prop
=
"billStatus"
prop
=
"billStatus
Txt
"
header
-
align
=
"center"
header
-
align
=
"center"
align
=
"center"
align
=
"center"
><
/ElTableColumn
>
><
/ElTableColumn
>
...
@@ -211,14 +211,6 @@
...
@@ -211,14 +211,6 @@
align
=
"center"
align
=
"center"
><
/ElTableColumn
>
><
/ElTableColumn
>
<
ElTableColumn
<
ElTableColumn
label
=
"物流单号"
show
-
overflow
-
tooltip
prop
=
"shipmentNumber"
width
=
"200"
header
-
align
=
"center"
align
=
"center"
><
/ElTableColumn
>
<
ElTableColumn
label
=
"总金额(¥)"
label
=
"总金额(¥)"
show
-
overflow
-
tooltip
show
-
overflow
-
tooltip
width
=
"120"
width
=
"120"
...
@@ -259,6 +251,7 @@
...
@@ -259,6 +251,7 @@
align
=
"center"
align
=
"center"
><
/ElTableColumn
>
><
/ElTableColumn
>
<
ElTableColumn
<
ElTableColumn
v
-
if
=
"nodeCode === 'PENDING_SUBMIT'"
width
=
"100"
width
=
"100"
align
=
"center"
align
=
"center"
header
-
align
=
"center"
header
-
align
=
"center"
...
@@ -572,13 +565,13 @@
...
@@ -572,13 +565,13 @@
<
div
class
=
"product-dialog-footer"
>
<
div
class
=
"product-dialog-footer"
>
<
div
>
<
div
>
<
el
-
input
<
el
-
input
v
-
model
=
"selectSku"
v
-
model
.
trim
=
"selectSku"
placeholder
=
"商品SKU"
placeholder
=
"商品SKU"
style
=
"width: 200px; margin: 0 10px"
style
=
"width: 200px; margin: 0 10px"
clearable
clearable
size
=
"small"
size
=
"small"
><
/el-input
>
><
/el-input
>
<
el
-
popover
placement
=
"top-start"
width
=
"
9
00"
trigger
=
"click"
>
<
el
-
popover
placement
=
"top-start"
width
=
"
10
00"
trigger
=
"click"
>
<
div
v
-
if
=
"skuData.length > 0"
style
=
"height: 50vh"
>
<
div
v
-
if
=
"skuData.length > 0"
style
=
"height: 50vh"
>
<
ElTable
size
=
"small"
:
data
=
"skuData"
height
=
"100%"
border
>
<
ElTable
size
=
"small"
:
data
=
"skuData"
height
=
"100%"
border
>
<
ElTableColumn
<
ElTableColumn
...
@@ -658,14 +651,14 @@
...
@@ -658,14 +651,14 @@
<
/el-button
>
<
/el-button
>
<
/template
>
<
/template
>
<
/el-popover
>
<
/el-popover
>
<
!--
<
el
-
button
<
el
-
button
style
=
"margin-left: 6px"
style
=
"margin-left: 6px"
type
=
"success"
type
=
"success"
size
=
"small"
size
=
"small"
@
click
=
"addPurchase"
@
click
=
"addPurchase"
>
>
批量新增
批量新增
<
/el-button>
--
>
<
/el-button
>
<
el
-
button
<
el
-
button
type
=
"danger"
type
=
"danger"
style
=
"margin-left: 10px"
style
=
"margin-left: 10px"
...
@@ -706,7 +699,7 @@
...
@@ -706,7 +699,7 @@
>
>
<
el
-
form
:
model
=
"exportForm"
label
-
width
=
"80px"
>
<
el
-
form
:
model
=
"exportForm"
label
-
width
=
"80px"
>
<
el
-
form
-
item
label
=
""
prop
=
"resource"
>
<
el
-
form
-
item
label
=
""
prop
=
"resource"
>
<
el
-
radio
-
group
v
-
model
=
"exportForm.resource"
>
<
el
-
radio
-
group
v
-
model
=
"exportForm.resource"
@
change
=
"isAllExport"
>
<
el
-
radio
:
label
=
"0"
>
导出本页
<
/el-radio
>
<
el
-
radio
:
label
=
"0"
>
导出本页
<
/el-radio
>
<
el
-
radio
:
label
=
"1"
>
导出选中
<
/el-radio
>
<
el
-
radio
:
label
=
"1"
>
导出选中
<
/el-radio
>
<
el
-
radio
:
label
=
"2"
>
全部
<
/el-radio
>
<
el
-
radio
:
label
=
"2"
>
全部
<
/el-radio
>
...
@@ -724,7 +717,7 @@
...
@@ -724,7 +717,7 @@
<
/template
>
<
/template
>
<
/ElDialog
>
<
/ElDialog
>
<
el
-
dialog
v
-
model
=
"showPrintDialog"
title
=
"打印参数设置"
>
<
el
-
dialog
v
-
model
=
"showPrintDialog"
title
=
"打印参数设置"
>
<
el
-
table
height
=
"400px"
:
data
=
"
selections
"
border
>
<
el
-
table
height
=
"400px"
:
data
=
"
printData
"
border
>
<
el
-
table
-
column
<
el
-
table
-
column
width
=
"60"
width
=
"60"
align
=
"center"
align
=
"center"
...
@@ -743,18 +736,18 @@
...
@@ -743,18 +736,18 @@
><
/el-table-column
>
><
/el-table-column
>
<
el
-
table
-
column
<
el
-
table
-
column
align
=
"center"
align
=
"center"
prop
=
"location
Cod
e"
prop
=
"location
Nam
e"
label
=
"库位编码"
label
=
"库位编码"
><
/el-table-column
>
><
/el-table-column
>
<
el
-
table
-
column
<
el
-
table
-
column
align
=
"center"
align
=
"center"
prop
=
"
product
No"
prop
=
"
supplierItem
No"
label
=
"货号
"
label
=
"货号"
><
/el-table-column
>
><
/el-table-column
>
<
el
-
table
-
column
align
=
"center"
prop
=
"number"
label
=
"打印数量"
>
<
el
-
table
-
column
align
=
"center"
prop
=
"number"
label
=
"打印数量"
>
<
template
#
default
=
"{ row
}
"
>
<
template
#
default
=
"{ row
}
"
>
<
el
-
input
<
el
-
input
v
-
model
=
"row.number"
v
-
model
.
number
=
"row.number"
oninput
=
"value=value.replace(/[^
\
-?
\
d.]/g,'')"
oninput
=
"value=value.replace(/[^
\
-?
\
d.]/g,'')"
placeholder
=
"打印数量"
placeholder
=
"打印数量"
clearable
clearable
...
@@ -767,6 +760,33 @@
...
@@ -767,6 +760,33 @@
<
el
-
button
type
=
"primary"
@
click
=
"handlePrintProductTag"
>
打印
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"handlePrintProductTag"
>
打印
<
/el-button
>
<
/template
>
<
/template
>
<
/el-dialog
>
<
/el-dialog
>
<
ElDialog
v
-
model
=
"addPurchaseVisible"
title
=
"批量添加"
width
=
"500px"
:
close
-
on
-
click
-
modal
=
"false"
>
<
div
>
<
el
-
input
v
-
model
.
trim
=
"purchaseTextarea"
type
=
"textarea"
placeholder
=
"请输入库存 SKU"
:
rows
=
"5"
minlength
=
"1"
maxlength
=
"1000"
show
-
word
-
limit
/>
<
div
style
=
"margin-top: 12px; color: #777"
>
{{
'多个字段使用_##_,_##_隔开'
}}
<
/div
>
<
/div
>
<
template
#
footer
>
<
span
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"addPurchaseVisible = false"
>
取消
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"submitPurchase"
>
确认
<
/el-button
>
<
/span
>
<
/template
>
<
/ElDialog
>
<
/template
>
<
/template
>
<
script
setup
lang
=
"ts"
>
<
script
setup
lang
=
"ts"
>
...
@@ -793,9 +813,11 @@ import {
...
@@ -793,9 +813,11 @@ import {
rejectOutRecordApi
,
rejectOutRecordApi
,
LogListData
,
LogListData
,
warehouseInfo
,
warehouseInfo
,
warehouseOutRecordExport
,
factoryWarehouseInventoryPrint
,
OutRecordBatchCheckPrintApi
,
}
from
'@/api/warehouse'
}
from
'@/api/warehouse'
// factoryWarehouseInventoryPrint,
import
{
filePath
}
from
'@/api/axios'
// import
{
filePath
}
from
'@/api/axios.ts'
import
BigNumber
from
'bignumber.js'
import
BigNumber
from
'bignumber.js'
import
{
ref
,
onMounted
,
watch
,
nextTick
}
from
'vue'
import
{
ref
,
onMounted
,
watch
,
nextTick
}
from
'vue'
import
'element-plus/dist/index.css'
import
'element-plus/dist/index.css'
...
@@ -943,6 +965,11 @@ const logList = ref<LogListData[]>([])
...
@@ -943,6 +965,11 @@ const logList = ref<LogListData[]>([])
const
rules
=
{
const
rules
=
{
warehouseId
:
[{
required
:
true
,
message
:
'请选择仓库'
,
trigger
:
'change'
}
],
warehouseId
:
[{
required
:
true
,
message
:
'请选择仓库'
,
trigger
:
'change'
}
],
}
}
const
isAllExport
=
()
=>
{
if
(
exportForm
.
value
.
resource
==
'2'
)
{
ElMessage
.
warning
(
'最多支持5000条!'
)
}
}
const
nodeCode
=
ref
<
string
>
(
const
nodeCode
=
ref
<
string
>
(
sessionStorage
.
getItem
(
'InRecord_NodeCode'
)
||
'all'
,
sessionStorage
.
getItem
(
'InRecord_NodeCode'
)
||
'all'
,
)
)
...
@@ -962,12 +989,12 @@ const {
...
@@ -962,12 +989,12 @@ const {
{
{
...
searchForm
.
value
,
...
searchForm
.
value
,
billStatus
:
nodeCode
.
value
==
'all'
?
'all'
:
nodeCode
.
value
,
billStatus
:
nodeCode
.
value
==
'all'
?
'all'
:
nodeCode
.
value
,
createTimeStart
:
tradingTime
.
value
&&
tradingTime
.
value
[
0
],
startTime
:
tradingTime
.
value
&&
tradingTime
.
value
[
0
],
createTimeEnd
:
tradingTime
.
value
&&
tradingTime
.
value
[
1
],
endTime
:
tradingTime
.
value
&&
tradingTime
.
value
[
1
],
}
,
}
,
page
,
page
,
pageSize
,
pageSize
,
).
then
((
res
)
=>
res
.
data
)
as
never
,
).
then
((
res
)
=>
res
.
data
),
}
)
}
)
const
setCostPrice
=
(
item
:
InterProductList
)
=>
{
const
setCostPrice
=
(
item
:
InterProductList
)
=>
{
...
@@ -995,72 +1022,192 @@ const getTreeNum = async () => {
...
@@ -995,72 +1022,192 @@ const getTreeNum = async () => {
}
}
}
}
const
showPrintDialog
=
ref
(
false
)
const
showPrintDialog
=
ref
(
false
)
// const printProductTag = async () =>
{
const
printData
=
ref
([])
// if (!selections.value.length)
{
const
printProductTag
=
async
()
=>
{
// return ElMessage.warning('请选择要操作的数据')
if
(
!
selections
.
value
.
length
)
{
//
}
return
ElMessage
.
warning
(
'请选择要操作的数据'
)
// showPrintDialog.value = true
}
// selections.value.forEach((el:InterWarehousePage) =>
{
const
str
=
selections
.
value
.
map
((
el
:
InterWarehousePage
)
=>
el
.
id
).
join
(
','
)
// el.number = ''
try
{
//
}
)
const
res
=
await
OutRecordBatchCheckPrintApi
(
str
)
//
}
if
(
res
.
code
===
200
)
{
printData
.
value
=
res
.
data
showPrintDialog
.
value
=
true
}
else
{
ElMessage
.
error
(
res
.
message
)
}
}
catch
(
e
)
{
console
.
error
(
e
)
}
}
async
function
handlePrintProductTag
()
{
async
function
handlePrintProductTag
()
{
// const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0')
const
flag
=
printData
.
value
.
every
(
// if (!flag)
{
(
el
:
InterWarehousePage
)
=>
el
.
number
&&
el
.
number
!=
'0'
,
// return ElMessage.warning('打印数量需大于0')
)
//
}
if
(
!
flag
)
{
// const list = selections.value.map((item:InterWarehousePage) =>
{
return
ElMessage
.
warning
(
'打印数量需大于0'
)
// return
{
}
// skuName: item.skuName,
const
list
=
printData
.
value
.
map
(
// warehouseSku: item.warehouseSku,
({
// supplierItemNo: item.productNumber,
skuName
=
''
,
// number: item.number,
warehouseSku
=
''
,
// locationName: item.locationCode,
supplierItemNo
=
''
,
//
}
number
=
''
,
//
}
)
locationName
=
''
,
// const res = await factoryWarehouseInventoryPrint(
{
}
)
=>
({
// list,
skuName
,
// code: 'PT002',
warehouseSku
,
//
}
)
supplierItemNo
,
// showPrintDialog.value = false
number
,
// window.open(filePath + res.message, '_blank')
locationName
,
}
),
)
const
res
=
await
factoryWarehouseInventoryPrint
({
list
,
code
:
'PT002'
,
}
)
showPrintDialog
.
value
=
false
window
.
open
(
filePath
+
res
.
message
,
'_blank'
)
}
const
batchAddCommodity
=
async
(
sku
:
string
):
Promise
<
InterskuList
[]
>
=>
{
if
(
!
editForm
.
value
.
warehouseId
)
{
ElMessage
.
error
(
'请选择仓库'
)
return
[]
}
try
{
const
res
=
await
getBySkuAndWarehouseIdApi
(
editForm
.
value
.
warehouseId
,
sku
)
const
arr
:
InterskuList
[]
=
res
.
data
||
[]
const
ids
:
Record
<
string
,
boolean
>
=
{
}
// 过滤掉商品列表已经加了的
for
(
const
item
of
otherPurchaseData
.
value
)
{
if
(
item
.
warehouseSku
!==
undefined
)
{
ids
[
item
.
warehouseSku
]
=
true
}
}
// 使用 filter 方法过滤掉已经存在的 SKU
const
filteredArr
=
arr
.
filter
((
currentItem
:
InterskuList
)
=>
{
return
(
currentItem
.
warehouseSku
===
undefined
||
!
ids
[
currentItem
.
warehouseSku
]
)
}
)
return
filteredArr
}
catch
(
e
)
{
console
.
error
(
e
)
return
[]
}
}
interface
InterImportData
{
warehouseSku
:
string
;
remark
?:
string
|
null
;
buyStored
?:
string
|
number
|
null
|
object
;
// 扩大 buyStored 类型,以兼容原始数据
[
propName
:
string
]:
string
|
number
|
boolean
|
undefined
|
unknown
}
}
// 前端导入Excel
// 前端导入Excel
const
excelFieldMap
:
Record
<
string
,
keyof
Inter
ProductList
>
=
{
const
excelFieldMap
:
Record
<
string
,
keyof
Inter
ImportData
>
=
{
SKU
图片
:
'skuImage'
,
//
SKU图片: 'skuImage',
商品
SKU
:
'warehouseSku'
,
商品
SKU
:
'warehouseSku'
,
SKU
名称
:
'skuName'
,
//
SKU名称: 'skuName',
出库数量
:
'outCount'
,
//
出库数量: 'outCount',
可用库存数量
:
'usableInventory'
,
//
可用库存数量: 'usableInventory',
'成本价(¥)'
:
'costPrice'
,
//
'成本价(¥)': 'costPrice',
'总成本(¥)'
:
'totalPrice'
,
//
'总成本(¥)': 'totalPrice',
库位
:
'locationCode'
,
//
库位: 'locationCode',
备注
:
'remark'
,
备注
:
'remark'
,
}
}
const
handleLocalImport
=
async
({
const
handleLocalImport
=
({
path
,
path
,
data
,
data
,
}
:
{
}
:
{
path
:
string
path
:
string
data
:
InterProductList
[]
data
:
Record
<
string
,
any
>
[]
}
)
=>
{
}
)
=>
{
const
result
:
InterProductList
[]
=
data
.
map
((
item
)
=>
{
// 1. 将原始导入数据映射到 InterImportData[]
const
obj
=
{
}
as
InterProductList
const
importedData
:
InterImportData
[]
=
data
.
map
(
item
=>
{
Object
.
keys
(
excelFieldMap
).
forEach
((
excelKey
)
=>
{
const
obj
:
InterImportData
=
{
warehouseSku
:
''
}
;
const
field
=
excelFieldMap
[
excelKey
]
as
keyof
InterProductList
Object
.
keys
(
excelFieldMap
).
forEach
(
excelKey
=>
{
const
value
=
item
[
excelKey
]
const
field
=
excelFieldMap
[
excelKey
];
// // 类型转换和默认值
const
value
=
item
[
excelKey
];
// if (['outCount', 'costPrice', 'totalPrice'].includes(field))
{
// value = value == null || value === '' ? 0 : Number(value)
if
(
field
===
'warehouseSku'
)
{
//
}
else
{
obj
[
field
]
=
typeof
value
===
'string'
?
value
:
String
(
value
??
''
);
// value = value == null ? '' : value
}
else
if
(
field
===
'remark'
)
{
//
}
obj
[
field
]
=
typeof
value
===
'string'
?
value
:
(
value
===
null
||
value
===
undefined
?
null
:
String
(
value
));
obj
[
field
]
=
value
as
InterProductList
[
typeof
field
]
}
else
if
(
field
===
'buyStored'
)
{
}
)
// 处理 buyStored: 确保它是一个数字、数字字符串,否则设置为 null
return
obj
if
(
typeof
value
===
'number'
)
{
}
)
obj
[
field
]
=
String
(
value
);
// 将数字转换为字符串
otherPurchaseData
.
value
=
result
}
else
if
(
typeof
value
===
'string'
&&
!
isNaN
(
Number
(
value
)))
{
obj
[
field
]
=
value
;
// 保持有效的数字字符串
}
else
{
// 如果不是数字或有效的数字字符串,则设置为 null
obj
[
field
]
=
null
;
}
}
else
{
obj
[
field
]
=
value
;
}
}
);
return
obj
;
}
).
filter
(
item
=>
item
.
warehouseSku
);
if
(
importedData
.
length
===
0
)
{
ElMessage
.
warning
(
'导入数据中没有有效的商品SKU'
);
importDialogVisible
.
value
=
false
;
return
;
}
// 2. 提取导入的 SKU 列表
const
importedSkus
=
importedData
.
map
(
item
=>
item
.
warehouseSku
).
join
(
','
);
// 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU
const
filteredSkusList
=
await
batchAddCommodity
(
importedSkus
);
if
(
filteredSkusList
.
length
===
0
)
{
ElMessage
.
warning
(
'导入的商品SKU已存在或无效'
);
importedFileUrl
.
value
=
path
;
importDialogVisible
.
value
=
false
;
return
;
}
// 4. 将备注信息合并到获取到的商品列表中
const
mergedProductList
=
filteredSkusList
.
map
(
skuItem
=>
{
const
importedItem
=
importedData
.
find
(
item
=>
item
.
warehouseSku
===
skuItem
.
warehouseSku
);
let
outCountValueForBigNumber
:
string
|
number
=
'0'
;
// 初始化为安全默认值
if
(
importedItem
?.
buyStored
!==
null
&&
importedItem
?.
buyStored
!==
undefined
)
{
if
(
typeof
importedItem
.
buyStored
===
'string'
&&
!
isNaN
(
Number
(
importedItem
.
buyStored
)))
{
outCountValueForBigNumber
=
importedItem
.
buyStored
;
}
else
if
(
typeof
importedItem
.
buyStored
===
'number'
)
{
outCountValueForBigNumber
=
importedItem
.
buyStored
;
}
else
{
// 如果是对象或其他意外类型,则默认为 '0'
outCountValueForBigNumber
=
'0'
;
}
}
const
calculatedOutCount
=
new
BigNumber
(
outCountValueForBigNumber
).
toNumber
();
return
{
skuImage
:
skuItem
.
image
,
warehouseSku
:
skuItem
.
warehouseSku
,
skuName
:
skuItem
.
skuName
,
productNo
:
skuItem
.
productNumber
,
locationCode
:
skuItem
.
locationCode
??
''
,
locationId
:
skuItem
.
locationId
??
null
,
costPrice
:
skuItem
.
price
,
outCount
:
calculatedOutCount
,
totalPrice
:
new
BigNumber
(
calculatedOutCount
).
multipliedBy
(
skuItem
.
price
??
0
).
toNumber
(),
usableInventory
:
skuItem
.
usableInventory
,
inventoryId
:
skuItem
.
id
,
remark
:
importedItem
?.
remark
??
skuItem
.
remark
??
null
,
}
as
InterProductList
;
}
);
// 5. 更新 otherPurchaseData
otherPurchaseData
.
value
=
[...
otherPurchaseData
.
value
,
...
mergedProductList
];
importedFileUrl
.
value
=
path
importedFileUrl
.
value
=
path
importDialogVisible
.
value
=
false
importDialogVisible
.
value
=
false
}
}
...
@@ -1069,10 +1216,46 @@ const exportForm = ref({
...
@@ -1069,10 +1216,46 @@ const exportForm = ref({
delivery
:
false
,
delivery
:
false
,
resource
:
''
,
resource
:
''
,
}
)
}
)
// const handleExport = () =>
{
const
handleExport
=
()
=>
{
// exportVisible.value = true
exportVisible
.
value
=
true
//
}
}
const
submitExportForm
=
()
=>
{
}
const
submitExportForm
=
async
()
=>
{
if
(
exportForm
.
value
.
resource
===
''
)
{
return
ElMessage
.
error
(
'请选择导出类型'
)
}
let
purchaseIds
:
number
[]
=
[]
let
exportTotal
:
number
|
undefined
=
undefined
const
params
:
AnyObject
=
{
}
const
resourceType
=
Number
(
exportForm
.
value
.
resource
)
if
(
resourceType
===
0
)
{
purchaseIds
=
(
tableData
.
value
as
InterWarehousePage
[]).
map
(
(
el
:
InterWarehousePage
)
=>
Number
(
el
.
id
),
)
}
else
if
(
resourceType
===
1
)
{
purchaseIds
=
selections
.
value
.
map
((
el
:
InterWarehousePage
)
=>
Number
(
el
.
id
),
)
}
else
if
(
resourceType
===
2
)
{
purchaseIds
=
[]
exportTotal
=
total
.
value
params
.
billStatus
=
nodeCode
.
value
==
'all'
?
'all'
:
nodeCode
.
value
}
params
.
idList
=
purchaseIds
if
(
exportTotal
!==
undefined
)
{
params
.
total
=
exportTotal
}
try
{
const
res
=
await
warehouseOutRecordExport
({
showDetail
:
exportForm
.
value
.
delivery
,
...
params
,
...
searchForm
.
value
,
}
)
window
.
open
(
filePath
+
res
.
message
,
'_blank'
)
exportVisible
.
value
=
false
}
catch
(
e
)
{
exportVisible
.
value
=
false
}
}
const
getWarehouseList
=
async
()
=>
{
const
getWarehouseList
=
async
()
=>
{
try
{
try
{
const
res
=
await
warehouseInfoGetAll
()
const
res
=
await
warehouseInfoGetAll
()
...
@@ -1099,7 +1282,25 @@ const selectbySku = async () => {
...
@@ -1099,7 +1282,25 @@ const selectbySku = async () => {
editForm
.
value
.
warehouseId
,
editForm
.
value
.
warehouseId
,
selectSku
.
value
,
selectSku
.
value
,
)
)
skuData
.
value
=
res
.
data
||
[]
const
arr
:
InterskuList
[]
=
res
.
data
||
[]
const
ids
:
Record
<
string
,
boolean
>
=
{
}
// 过滤掉商品列表已经加了的
for
(
const
item
of
otherPurchaseData
.
value
)
{
if
(
item
.
warehouseSku
!==
undefined
)
{
ids
[
item
.
warehouseSku
]
=
true
}
}
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
const
currentItem
:
InterskuList
=
arr
[
i
]
if
(
currentItem
.
warehouseSku
!==
undefined
&&
ids
[
currentItem
.
warehouseSku
]
)
{
arr
.
splice
(
i
,
1
)
i
--
}
}
skuData
.
value
=
arr
||
[]
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
)
console
.
error
(
e
)
}
}
...
@@ -1109,12 +1310,13 @@ const skudblclick = (val: InterskuList) => {
...
@@ -1109,12 +1310,13 @@ const skudblclick = (val: InterskuList) => {
const
{
const
{
locationCode
=
''
,
locationCode
=
''
,
price
=
null
,
price
=
null
,
productN
umber
=
''
,
productN
o
=
''
,
warehouseSku
=
''
,
warehouseSku
=
''
,
skuName
=
''
,
skuName
=
''
,
image
=
''
,
image
=
''
,
locationId
=
null
,
locationId
=
null
,
usableInventory
=
null
,
usableInventory
=
null
,
id
=
null
,
}
=
val
||
{
}
}
=
val
||
{
}
otherPurchaseData
.
value
=
[
otherPurchaseData
.
value
=
[
...
otherPurchaseData
.
value
,
...
otherPurchaseData
.
value
,
...
@@ -1122,13 +1324,14 @@ const skudblclick = (val: InterskuList) => {
...
@@ -1122,13 +1324,14 @@ const skudblclick = (val: InterskuList) => {
skuImage
:
image
,
skuImage
:
image
,
warehouseSku
,
warehouseSku
,
skuName
,
skuName
,
productNo
:
productNumber
,
productNo
,
locationCode
:
locationCode
??
''
,
// 确保空值处理
locationCode
:
locationCode
??
''
,
// 确保空值处理
locationId
:
locationId
??
null
,
// 确保空值处理
locationId
:
locationId
??
null
,
// 确保空值处理
costPrice
:
price
,
costPrice
:
price
,
outCount
:
null
,
//出库数量
outCount
:
null
,
//出库数量
totalPrice
:
null
,
totalPrice
:
null
,
usableInventory
,
//可用库存数量
usableInventory
,
//可用库存数量
inventoryId
:
id
,
}
,
}
,
]
]
// 使用filter代替forEach+splice,时间复杂度从O(n^2)降到O(n)
// 使用filter代替forEach+splice,时间复杂度从O(n^2)降到O(n)
...
@@ -1197,13 +1400,27 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
...
@@ -1197,13 +1400,27 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
formId
.
value
=
undefined
formId
.
value
=
undefined
}
}
fetchLocationList
(
''
)
fetchLocationList
(
''
)
selectSku
.
value
=
''
newDialogVisible
.
value
=
true
newDialogVisible
.
value
=
true
}
}
const
getProduct
=
async
(
id
:
number
|
undefined
)
=>
{
const
getProduct
=
async
(
id
:
number
|
undefined
)
=>
{
try
{
try
{
const
res
=
await
getWarehouseOutRecordDetailApi
(
id
)
const
res
=
await
getWarehouseOutRecordDetailApi
(
id
)
const
productList
=
res
.
data
?.
productList
const
newProductList
=
(
Array
.
isArray
(
productList
)
?
productList
:
[]).
map
(
(
item
:
InterProductList
)
=>
{
const
{
inventory
,
...
rest
}
=
item
return
{
...
rest
,
usableInventory
:
inventory
?.
usableInventory
??
null
,
}
}
,
)
if
(
res
.
data
)
{
res
.
data
.
productList
=
newProductList
}
editForm
.
value
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
editForm
.
value
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
otherPurchaseData
.
value
=
res
.
data
?.
p
roductList
||
[]
otherPurchaseData
.
value
=
newP
roductList
||
[]
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
)
console
.
error
(
e
)
}
}
...
@@ -1414,7 +1631,7 @@ const upSection = async () => {
...
@@ -1414,7 +1631,7 @@ const upSection = async () => {
editForm
.
value
as
unknown
as
AnyObject
,
editForm
.
value
as
unknown
as
AnyObject
,
'id'
,
'id'
,
{
{
productList
:
'
warehouseSku
'
,
productList
:
'
id
'
,
}
,
}
,
)
)
try
{
try
{
...
@@ -1427,9 +1644,36 @@ const upSection = async () => {
...
@@ -1427,9 +1644,36 @@ const upSection = async () => {
console
.
error
(
e
)
console
.
error
(
e
)
}
}
}
}
// const addPurchase = async () =>
{
const
addPurchaseVisible
=
ref
(
false
)
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
const
purchaseTextarea
=
ref
(
null
)
//
}
const
addPurchase
=
async
()
=>
{
addPurchaseVisible
.
value
=
true
}
const
submitPurchase
=
async
()
=>
{
if
(
!
purchaseTextarea
.
value
)
{
ElMessage
.
warning
(
'请输入库存 SKU'
)
return
}
const
filteredSkusList
=
await
batchAddCommodity
(
purchaseTextarea
.
value
)
const
mergedProductList
=
filteredSkusList
.
map
((
skuItem
)
=>
{
return
{
skuImage
:
skuItem
.
image
,
warehouseSku
:
skuItem
.
warehouseSku
,
skuName
:
skuItem
.
skuName
,
productNo
:
skuItem
.
productNumber
,
locationCode
:
skuItem
.
locationCode
??
''
,
locationId
:
skuItem
.
locationId
??
null
,
costPrice
:
skuItem
.
price
,
outCount
:
null
,
totalPrice
:
null
,
usableInventory
:
skuItem
.
usableInventory
,
inventoryId
:
skuItem
.
id
,
remark
:
null
,
}
as
InterProductList
}
)
otherPurchaseData
.
value
=
[...
otherPurchaseData
.
value
,
...
mergedProductList
]
addPurchaseVisible
.
value
=
false
}
const
deleteOtherWarehousing
=
()
=>
{
const
deleteOtherWarehousing
=
()
=>
{
const
arr
=
otherWarehouseSelection
.
value
const
arr
=
otherWarehouseSelection
.
value
if
(
arr
.
length
===
0
)
return
if
(
arr
.
length
===
0
)
return
...
@@ -1441,8 +1685,8 @@ const deleteOtherWarehousing = () => {
...
@@ -1441,8 +1685,8 @@ const deleteOtherWarehousing = () => {
const
importDialogVisible
=
ref
(
false
)
const
importDialogVisible
=
ref
(
false
)
const
importedFileUrl
=
ref
(
''
)
const
importedFileUrl
=
ref
(
''
)
const
importData
=
async
()
=>
{
const
importData
=
async
()
=>
{
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
importDialogVisible
.
value
=
true
importDialogVisible
.
value
=
true
importedFileUrl
.
value
=
''
}
}
const
handleBatchDelete
=
async
()
=>
{
const
handleBatchDelete
=
async
()
=>
{
if
(
!
selections
.
value
.
length
)
{
if
(
!
selections
.
value
.
length
)
{
...
@@ -1464,11 +1708,6 @@ const nodeClick = (data: InterWarehouseTree) => {
...
@@ -1464,11 +1708,6 @@ const nodeClick = (data: InterWarehouseTree) => {
sessionStorage
.
setItem
(
'InRecord_NodeCode'
,
data
.
code
??
''
)
sessionStorage
.
setItem
(
'InRecord_NodeCode'
,
data
.
code
??
''
)
search
()
search
()
}
}
// const detailPager = ref(
{
// page: 1,
// rows: 100,
// total: 0,
//
}
)
const
searchDetail
=
async
()
=>
{
const
searchDetail
=
async
()
=>
{
try
{
try
{
const
res
=
await
getItemListByIdApi
(
currentRow
.
value
?.
id
)
const
res
=
await
getItemListByIdApi
(
currentRow
.
value
?.
id
)
...
@@ -1489,10 +1728,6 @@ const locationList = ref<ILocation[]>([])
...
@@ -1489,10 +1728,6 @@ const locationList = ref<ILocation[]>([])
const
locationLoading
=
ref
(
false
)
const
locationLoading
=
ref
(
false
)
const
fetchLocationList
=
async
(
query
:
string
)
=>
{
const
fetchLocationList
=
async
(
query
:
string
)
=>
{
// if (!query)
{
// locationList.value = []
// return
//
}
if
(
!
editForm
.
value
.
warehouseId
)
return
if
(
!
editForm
.
value
.
warehouseId
)
return
locationLoading
.
value
=
true
locationLoading
.
value
=
true
try
{
try
{
...
...
src/views/warehouse/receiptDoc.vue
View file @
4545b5dc
...
@@ -190,7 +190,7 @@
...
@@ -190,7 +190,7 @@
<
ElTableColumn
<
ElTableColumn
label
=
"单据状态"
label
=
"单据状态"
width
=
"130"
width
=
"130"
prop
=
"billStatus"
prop
=
"billStatus
Txt
"
header
-
align
=
"center"
header
-
align
=
"center"
align
=
"center"
align
=
"center"
><
/ElTableColumn
>
><
/ElTableColumn
>
...
@@ -446,12 +446,6 @@
...
@@ -446,12 +446,6 @@
/>
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<!--
<
template
#
footer
>
<
span
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"importDialogVisible = false"
>
取消
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"packedData"
>
确认
<
/el-button
>
<
/span
>
<
/template> --
>
<
/ElDialog
>
<
/ElDialog
>
<
ElDialog
<
ElDialog
v
-
model
=
"newDialogVisible"
v
-
model
=
"newDialogVisible"
...
@@ -607,7 +601,7 @@
...
@@ -607,7 +601,7 @@
<
div
class
=
"product-dialog-footer"
>
<
div
class
=
"product-dialog-footer"
>
<
div
>
<
div
>
<
el
-
input
<
el
-
input
v
-
model
=
"selectSku"
v
-
model
.
trim
=
"selectSku"
placeholder
=
"商品SKU"
placeholder
=
"商品SKU"
style
=
"width: 200px; margin: 0 10px"
style
=
"width: 200px; margin: 0 10px"
clearable
clearable
...
@@ -693,14 +687,14 @@
...
@@ -693,14 +687,14 @@
<
/el-button
>
<
/el-button
>
<
/template
>
<
/template
>
<
/el-popover
>
<
/el-popover
>
<
!--
<
el
-
button
<
el
-
button
style
=
"margin-left: 6px"
style
=
"margin-left: 6px"
type
=
"success"
type
=
"success"
size
=
"small"
size
=
"small"
@
click
=
"addPurchase"
@
click
=
"addPurchase"
>
>
批量新增
批量新增
<
/el-button>
--
>
<
/el-button
>
<
el
-
button
<
el
-
button
type
=
"danger"
type
=
"danger"
style
=
"margin-left: 10px"
style
=
"margin-left: 10px"
...
@@ -741,7 +735,7 @@
...
@@ -741,7 +735,7 @@
>
>
<
el
-
form
:
model
=
"exportForm"
label
-
width
=
"80px"
>
<
el
-
form
:
model
=
"exportForm"
label
-
width
=
"80px"
>
<
el
-
form
-
item
label
=
""
prop
=
"resource"
>
<
el
-
form
-
item
label
=
""
prop
=
"resource"
>
<
el
-
radio
-
group
v
-
model
=
"exportForm.resource"
>
<
el
-
radio
-
group
v
-
model
=
"exportForm.resource"
@
change
=
"isAllExport"
>
<
el
-
radio
:
label
=
"0"
>
导出本页
<
/el-radio
>
<
el
-
radio
:
label
=
"0"
>
导出本页
<
/el-radio
>
<
el
-
radio
:
label
=
"1"
>
导出选中
<
/el-radio
>
<
el
-
radio
:
label
=
"1"
>
导出选中
<
/el-radio
>
<
el
-
radio
:
label
=
"2"
>
全部
<
/el-radio
>
<
el
-
radio
:
label
=
"2"
>
全部
<
/el-radio
>
...
@@ -789,7 +783,7 @@
...
@@ -789,7 +783,7 @@
<
el
-
table
-
column
align
=
"center"
prop
=
"number"
label
=
"打印数量"
>
<
el
-
table
-
column
align
=
"center"
prop
=
"number"
label
=
"打印数量"
>
<
template
#
default
=
"{ row
}
"
>
<
template
#
default
=
"{ row
}
"
>
<
el
-
input
<
el
-
input
v
-
model
=
"row.number"
v
-
model
.
number
=
"row.number"
oninput
=
"value=value.replace(/[^
\
-?
\
d.]/g,'')"
oninput
=
"value=value.replace(/[^
\
-?
\
d.]/g,'')"
placeholder
=
"打印数量"
placeholder
=
"打印数量"
clearable
clearable
...
@@ -802,6 +796,33 @@
...
@@ -802,6 +796,33 @@
<
el
-
button
type
=
"primary"
@
click
=
"handlePrintProductTag"
>
打印
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"handlePrintProductTag"
>
打印
<
/el-button
>
<
/template
>
<
/template
>
<
/el-dialog
>
<
/el-dialog
>
<
ElDialog
v
-
model
=
"addPurchaseVisible"
title
=
"批量添加"
width
=
"500px"
:
close
-
on
-
click
-
modal
=
"false"
>
<
div
>
<
el
-
input
v
-
model
.
trim
=
"purchaseTextarea"
type
=
"textarea"
placeholder
=
"请输入库存 SKU"
:
rows
=
"5"
minlength
=
"1"
maxlength
=
"1000"
show
-
word
-
limit
/>
<
div
style
=
"margin-top: 12px; color: #777"
>
{{
'多个字段使用_##_,_##_隔开'
}}
<
/div
>
<
/div
>
<
template
#
footer
>
<
span
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"addPurchaseVisible = false"
>
取消
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"submitPurchase"
>
确认
<
/el-button
>
<
/span
>
<
/template
>
<
/ElDialog
>
<
/template
>
<
/template
>
<
script
setup
lang
=
"ts"
>
<
script
setup
lang
=
"ts"
>
...
@@ -829,7 +850,7 @@ import {
...
@@ -829,7 +850,7 @@ import {
warehouseInfo
,
warehouseInfo
,
InRecordBatchCheckPrintApi
,
InRecordBatchCheckPrintApi
,
factoryWarehouseInventoryPrint
,
factoryWarehouseInventoryPrint
,
warehouseInRecord
Inventory
,
warehouseInRecord
Export
,
}
from
'@/api/warehouse'
}
from
'@/api/warehouse'
import
{
filePath
}
from
'@/api/axios.ts'
import
{
filePath
}
from
'@/api/axios.ts'
import
BigNumber
from
'bignumber.js'
import
BigNumber
from
'bignumber.js'
...
@@ -979,6 +1000,11 @@ const logList = ref<LogListData[]>([])
...
@@ -979,6 +1000,11 @@ const logList = ref<LogListData[]>([])
const
rules
=
{
const
rules
=
{
warehouseId
:
[{
required
:
true
,
message
:
'请选择仓库'
,
trigger
:
'change'
}
],
warehouseId
:
[{
required
:
true
,
message
:
'请选择仓库'
,
trigger
:
'change'
}
],
}
}
const
isAllExport
=
()
=>
{
if
(
exportForm
.
value
.
resource
==
'2'
)
{
ElMessage
.
warning
(
'最多支持5000条!'
)
}
}
const
nodeCode
=
ref
<
string
>
(
const
nodeCode
=
ref
<
string
>
(
sessionStorage
.
getItem
(
'InRecord_NodeCode'
)
||
'all'
,
sessionStorage
.
getItem
(
'InRecord_NodeCode'
)
||
'all'
,
)
)
...
@@ -1078,41 +1104,130 @@ async function handlePrintProductTag() {
...
@@ -1078,41 +1104,130 @@ async function handlePrintProductTag() {
showPrintDialog
.
value
=
false
showPrintDialog
.
value
=
false
window
.
open
(
filePath
+
res
.
message
,
'_blank'
)
window
.
open
(
filePath
+
res
.
message
,
'_blank'
)
}
}
const
batchAddCommodity
=
async
(
sku
:
string
):
Promise
<
InterskuList
[]
>
=>
{
if
(
!
editForm
.
value
.
warehouseId
)
{
ElMessage
.
error
(
'请选择仓库'
)
return
[]
}
try
{
const
res
=
await
getBySkuApi
(
editForm
.
value
.
warehouseId
,
sku
)
const
arr
:
InterskuList
[]
=
res
.
data
||
[]
const
ids
:
Record
<
string
,
boolean
>
=
{
}
// 过滤掉商品列表已经加了的
for
(
const
item
of
otherPurchaseData
.
value
)
{
if
(
item
.
warehouseSku
!==
undefined
)
{
ids
[
item
.
warehouseSku
]
=
true
}
}
// 使用 filter 方法过滤掉已经存在的 SKU
const
filteredArr
=
arr
.
filter
((
currentItem
:
InterskuList
)
=>
{
return
currentItem
.
sku
===
undefined
||
!
ids
[
currentItem
.
sku
]
}
)
return
filteredArr
}
catch
(
e
)
{
console
.
error
(
e
)
return
[]
}
}
interface
InterImportData
{
warehouseSku
:
string
remark
?:
string
|
null
[
key
:
string
]:
unknown
}
// 前端导入Excel
// 前端导入Excel
const
excelFieldMap
:
Record
<
string
,
keyof
InterProductList
>
=
{
const
excelFieldMap
:
Record
<
string
,
keyof
InterProductList
>
=
{
SKU
图片
:
'skuImage'
,
//
SKU图片: 'skuImage',
商品
SKU
:
'warehouseSku'
,
商品
SKU
:
'warehouseSku'
,
SKU
名称
:
'skuName'
,
//
SKU名称: 'skuName',
入库数量
:
'buyStored'
,
入库数量
:
'buyStored'
,
'成本价(¥)'
:
'costPrice'
,
//
'成本价(¥)': 'costPrice',
'总成本(¥)'
:
'totalPrice'
,
//
'总成本(¥)': 'totalPrice',
库位
:
'locationCode'
,
//
库位: 'locationCode',
备注
:
'remark'
,
备注
:
'remark'
,
}
}
const
handleLocalImport
=
({
const
handleLocalImport
=
async
({
path
,
path
,
data
,
data
,
}
:
{
}
:
{
path
:
string
path
:
string
data
:
Inter
ProductList
[]
data
:
Inter
ImportData
[]
}
)
=>
{
}
)
=>
{
const
result
:
InterProductList
[]
=
data
.
map
((
item
)
=>
{
// 1. 将原始导入数据映射到 InterImportData[]
const
obj
=
{
}
as
InterProductList
const
importedData
:
InterImportData
[]
=
data
Object
.
keys
(
excelFieldMap
).
forEach
((
excelKey
)
=>
{
.
map
((
item
)
=>
{
const
field
=
excelFieldMap
[
excelKey
]
as
keyof
InterProductList
const
obj
:
InterImportData
=
{
warehouseSku
:
''
}
const
value
=
item
[
excelKey
]
Object
.
keys
(
excelFieldMap
).
forEach
((
excelKey
)
=>
{
// // 类型转换和默认值
const
field
=
excelFieldMap
[
excelKey
]
// if (['buyStored', 'costPrice', 'totalPrice'].includes(field))
{
const
value
=
item
[
excelKey
]
// value = value == null || value === '' ? 0 : Number(value)
//
}
else
{
if
(
field
===
'warehouseSku'
)
{
// value = value == null ? '' : value
obj
[
field
]
=
typeof
value
===
'string'
?
value
:
String
(
value
??
''
)
//
}
}
else
if
(
field
===
'remark'
)
{
obj
[
field
]
=
value
as
InterProductList
[
typeof
field
]
obj
[
field
]
=
typeof
value
===
'string'
?
value
:
value
===
null
||
value
===
undefined
?
null
:
String
(
value
)
}
else
if
(
field
===
'buyStored'
)
{
// 确保 value 是一个有效的数字或数字字符串,否则设置为 null
if
(
typeof
value
===
'number'
||
(
typeof
value
===
'string'
&&
!
isNaN
(
Number
(
value
)))
)
{
obj
[
field
]
=
String
(
value
)
// 转换为字符串
}
else
{
obj
[
field
]
=
null
// 无效值设置为 null
}
}
else
{
obj
[
field
]
=
value
}
}
)
return
obj
}
)
}
)
return
obj
.
filter
((
item
)
=>
item
.
warehouseSku
)
if
(
importedData
.
length
===
0
)
{
ElMessage
.
warning
(
'导入数据中没有有效的商品SKU'
)
importDialogVisible
.
value
=
false
return
}
// 2. 提取导入的 SKU 列表
const
importedSkus
=
importedData
.
map
((
item
)
=>
item
.
warehouseSku
).
join
(
','
)
// 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU
const
filteredSkusList
=
await
batchAddCommodity
(
importedSkus
)
// 使用 await 等待结果
if
(
filteredSkusList
.
length
===
0
)
{
ElMessage
.
warning
(
'导入的商品SKU已存在或无效'
)
importedFileUrl
.
value
=
path
importDialogVisible
.
value
=
false
return
}
// 4. 将备注信息合并到获取到的商品列表中
const
mergedProductList
=
filteredSkusList
.
map
((
skuItem
)
=>
{
// 在导入数据中找到匹配的备注信息
const
importedItem
=
importedData
.
find
(
(
item
)
=>
item
.
warehouseSku
===
skuItem
.
sku
,
)
return
{
skuImage
:
skuItem
.
image
,
warehouseSku
:
skuItem
.
sku
,
skuName
:
skuItem
.
skuName
,
productNo
:
skuItem
.
productNo
,
locationCode
:
skuItem
.
locationCode
??
''
,
locationId
:
skuItem
.
locationId
??
null
,
costPrice
:
skuItem
.
factoryPrice
,
buyStored
:
importedItem
?.
buyStored
??
null
,
totalPrice
:
new
BigNumber
(
(
importedItem
?.
buyStored
??
0
)
as
number
|
string
,
)
.
multipliedBy
(
skuItem
.
price
??
0
)
.
toNumber
(),
usableInventory
:
skuItem
.
usableInventory
,
remark
:
importedItem
?.
remark
??
null
,
}
as
InterProductList
// 明确类型
}
)
}
)
otherPurchaseData
.
value
=
result
// 5. 更新 otherPurchaseData
otherPurchaseData
.
value
=
[...
otherPurchaseData
.
value
,
...
mergedProductList
]
importedFileUrl
.
value
=
path
importedFileUrl
.
value
=
path
importDialogVisible
.
value
=
false
importDialogVisible
.
value
=
false
}
}
...
@@ -1150,7 +1265,7 @@ const submitExportForm = async () => {
...
@@ -1150,7 +1265,7 @@ const submitExportForm = async () => {
params
.
total
=
exportTotal
params
.
total
=
exportTotal
}
}
try
{
try
{
const
res
=
await
warehouseInRecord
Inventory
({
const
res
=
await
warehouseInRecord
Export
({
showDetail
:
exportForm
.
value
.
delivery
,
showDetail
:
exportForm
.
value
.
delivery
,
...
params
,
...
params
,
...
searchForm
.
value
,
...
searchForm
.
value
,
...
@@ -1280,6 +1395,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
...
@@ -1280,6 +1395,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
formId
.
value
=
undefined
formId
.
value
=
undefined
}
}
fetchLocationList
(
''
)
fetchLocationList
(
''
)
selectSku
.
value
=
''
newDialogVisible
.
value
=
true
newDialogVisible
.
value
=
true
}
}
const
getProduct
=
async
(
id
:
number
|
undefined
)
=>
{
const
getProduct
=
async
(
id
:
number
|
undefined
)
=>
{
...
@@ -1415,31 +1531,6 @@ const addOtherCurrency = async () => {
...
@@ -1415,31 +1531,6 @@ const addOtherCurrency = async () => {
return
return
}
}
}
}
// 看新增后要不要打印标签
// try
{
// if (!editId.value)
{
// await addUserApi(
{
// ...editForm.value,
// supperMark: Number(editForm.value.supperMark),
// status: Number(editForm.value.status),
//
}
)
//
}
else
{
// await updateUserApi(
{
// ...editForm.value,
// supperMark: Number(editForm.value.supperMark),
// status: Number(editForm.value.status),
//
}
)
//
}
// ElMessage(
{
// message: '保存成功',
// type: 'success',
// offset: window.innerHeight / 2,
//
}
)
// newDialogVisible.value = false
// search()
//
}
catch
(
e
)
{
// return
//
}
if
(
!
formId
.
value
)
{
if
(
!
formId
.
value
)
{
addSection
()
addSection
()
}
else
{
}
else
{
...
@@ -1507,9 +1598,35 @@ const upSection = async () => {
...
@@ -1507,9 +1598,35 @@ const upSection = async () => {
console
.
error
(
e
)
console
.
error
(
e
)
}
}
}
}
// const addPurchase = async () =>
{
const
addPurchaseVisible
=
ref
(
false
)
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
const
purchaseTextarea
=
ref
(
null
)
//
}
const
addPurchase
=
async
()
=>
{
addPurchaseVisible
.
value
=
true
}
const
submitPurchase
=
async
()
=>
{
if
(
!
purchaseTextarea
.
value
)
{
ElMessage
.
warning
(
'请输入库存 SKU'
)
return
}
const
filteredSkusList
=
await
batchAddCommodity
(
purchaseTextarea
.
value
)
const
mergedProductList
=
filteredSkusList
.
map
((
skuItem
)
=>
{
return
{
skuImage
:
skuItem
.
image
,
warehouseSku
:
skuItem
.
sku
,
skuName
:
skuItem
.
skuName
,
productNo
:
skuItem
.
productNo
,
locationCode
:
skuItem
.
locationCode
??
''
,
locationId
:
skuItem
.
locationId
??
null
,
costPrice
:
skuItem
.
factoryPrice
,
buyStored
:
null
,
totalPrice
:
null
,
usableInventory
:
skuItem
.
usableInventory
,
remark
:
null
,
}
as
InterProductList
}
)
otherPurchaseData
.
value
=
[...
otherPurchaseData
.
value
,
...
mergedProductList
]
addPurchaseVisible
.
value
=
false
}
const
deleteOtherWarehousing
=
()
=>
{
const
deleteOtherWarehousing
=
()
=>
{
const
arr
=
otherWarehouseSelection
.
value
const
arr
=
otherWarehouseSelection
.
value
if
(
arr
.
length
===
0
)
return
if
(
arr
.
length
===
0
)
return
...
@@ -1521,8 +1638,8 @@ const deleteOtherWarehousing = () => {
...
@@ -1521,8 +1638,8 @@ const deleteOtherWarehousing = () => {
const
importDialogVisible
=
ref
(
false
)
const
importDialogVisible
=
ref
(
false
)
const
importedFileUrl
=
ref
(
''
)
const
importedFileUrl
=
ref
(
''
)
const
importData
=
async
()
=>
{
const
importData
=
async
()
=>
{
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
importDialogVisible
.
value
=
true
importDialogVisible
.
value
=
true
importedFileUrl
.
value
=
''
}
}
const
handleBatchDelete
=
async
()
=>
{
const
handleBatchDelete
=
async
()
=>
{
if
(
!
selections
.
value
.
length
)
{
if
(
!
selections
.
value
.
length
)
{
...
...
src/views/warehouse/warning.vue
View file @
4545b5dc
...
@@ -112,18 +112,16 @@ const submitExportForm = async () => {
...
@@ -112,18 +112,16 @@ const submitExportForm = async () => {
return
ElMessage
.
error
(
'请选择导出类型'
)
return
ElMessage
.
error
(
'请选择导出类型'
)
}
}
exportLoading
.
value
=
true
exportLoading
.
value
=
true
let
purchaseIds
=
''
let
purchaseIds
:
number
[]
=
[]
let
exportTotal
:
number
|
undefined
=
undefined
let
exportTotal
:
number
|
undefined
=
undefined
const
params
:
AnyObject
=
{}
const
params
:
AnyObject
=
{}
const
resourceType
=
Number
(
exportForm
.
value
.
resource
)
const
resourceType
=
Number
(
exportForm
.
value
.
resource
)
if
(
resourceType
===
0
)
{
if
(
resourceType
===
0
)
{
purchaseIds
=
leftData
.
value
.
map
((
el
:
WarehouseWarning
)
=>
el
.
id
).
join
(
','
)
purchaseIds
=
leftData
.
value
.
map
((
el
:
WarehouseWarning
)
=>
Number
(
el
.
id
)
)
}
else
if
(
resourceType
===
1
)
{
}
else
if
(
resourceType
===
1
)
{
purchaseIds
=
selections
.
value
purchaseIds
=
selections
.
value
.
map
((
el
:
WarehouseWarning
)
=>
Number
(
el
.
id
))
.
map
((
el
:
WarehouseWarning
)
=>
el
.
id
)
.
join
(
','
)
}
else
if
(
resourceType
===
2
)
{
}
else
if
(
resourceType
===
2
)
{
purchaseIds
=
''
purchaseIds
=
[]
exportTotal
=
pagination
.
value
.
total
exportTotal
=
pagination
.
value
.
total
}
}
params
.
idList
=
purchaseIds
params
.
idList
=
purchaseIds
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment