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
b61a23bf
Commit
b61a23bf
authored
May 30, 2025
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改物流菜单中的类型
parent
24140a09
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
374 additions
and
283 deletions
+374
-283
src/components/CustomizeForm.tsx
+26
-17
src/components/Form.vue/AmountInput.vue
+4
-4
src/components/Form.vue/DatePicker.vue
+4
-4
src/components/Form.vue/DateRangePicker.vue
+0
-11
src/components/Form.vue/Select.vue
+11
-13
src/components/Form.vue/Switch .vue
+3
-3
src/components/SearchForm.tsx
+1
-9
src/components/VxeTable.tsx
+10
-9
src/types/api/logistics.ts
+3
-1
src/views/logistics/components/LogDialog.tsx
+2
-2
src/views/logistics/declarationRule.vue
+26
-18
src/views/logistics/logisticsCalculate.vue
+10
-6
src/views/logistics/logisticsMethod.vue
+104
-98
src/views/logistics/logisticsPartition.vue
+58
-18
src/views/logistics/logisticsQuotation.vue
+38
-27
src/views/logistics/shippingAddress.vue
+32
-24
src/views/logistics/types/logisticsQuotation.ts
+18
-19
src/views/logistics/types/shippingAddress.ts
+24
-0
No files found.
src/components/CustomizeForm.tsx
View file @
b61a23bf
...
...
@@ -11,6 +11,8 @@ import './Form.vue/form.scss'
import
type
{
FormItemRule
}
from
'element-plus'
type
SimpleFormData
=
Record
<
string
,
unknown
>
// 定义表单项配置接口
export
interface
IFormConfig
{
fixed
?:
string
...
...
@@ -19,14 +21,14 @@ export interface IFormConfig {
label
?:
string
type
?:
string
btn
?:
JSX
.
Element
|
(()
=>
JSX
.
Element
)
attrs
?:
Record
<
string
,
unknown
>
attrs
?:
SimpleFormData
isIncludeProp
?:
boolean
rules
?:
FormItemRule
|
FormItemRule
[]
render
?:
(
item
?:
IFormConfig
,
formData
?:
Record
<
string
,
any
>
,
formData
?:
SimpleFormData
,
index
?:
number
,
)
=>
JSX
.
Element
)
=>
VNode
|
VNode
[]
|
JSX
.
Element
}
// 定义组件类型
...
...
@@ -59,7 +61,7 @@ export default defineComponent({
default
:
'50%'
,
},
modelValue
:
{
type
:
Object
as
PropType
<
Record
<
string
,
unknown
>>
,
type
:
Object
,
default
:
()
=>
({}),
},
size
:
{
...
...
@@ -79,7 +81,7 @@ export default defineComponent({
setup
(
props
,
{
emit
,
attrs
})
{
const
formRef
=
ref
<
FormInstance
>
()
const
formData
=
ref
<
Record
<
string
,
unknown
>>
(
props
.
modelValue
)
const
tableConfig
=
ref
<
any
[]
>
([])
const
tableConfig
=
shallowRef
<
IFormConfig
[]
>
([])
watch
(
()
=>
props
.
config
,
...
...
@@ -199,7 +201,7 @@ export default defineComponent({
>
{
item
.
title
}
</
div
>
{
item
.
render
&&
item
.
render
(
item
,
this
.
formData
,
this
)
}
{
item
.
render
&&
item
.
render
(
item
,
this
.
formData
)
}
</
div
>
)
:
(
<
ElFormItem
...
...
@@ -213,18 +215,25 @@ export default defineComponent({
>
{
item
.
render
?
item
.
render
(
item
)
:
h
(
componentConfig
[
item
.
type
]
||
ElInput
,
{
modelValue
:
this
.
formData
[
item
.
prop
],
'onUpdate:modelValue'
:
(
value
:
unknown
)
=>
{
this
.
formData
[
item
.
prop
]
=
value
:
h
(
componentConfig
[
item
.
type
as
keyof
typeof
componentConfig
]
||
ElInput
,
{
modelValue
:
this
.
formData
[
item
.
prop
as
string
],
'onUpdate:modelValue'
:
(
value
:
unknown
)
=>
{
this
.
formData
[
item
.
prop
as
string
]
=
value
},
disabled
:
typeof
item
.
attrs
?.
disabled
===
'function'
?
item
.
attrs
.
disabled
()
:
item
.
attrs
?.
disabled
,
...
this
.
getComponentAttrs
(
item
),
},
disabled
:
typeof
item
.
attrs
?.
disabled
===
'function'
?
item
.
attrs
.
disabled
()
:
item
.
attrs
?.
disabled
,
...
this
.
getComponentAttrs
(
item
),
})
}
{
item
.
btn
&&
item
.
btn
()
}
)
}
{
item
.
btn
&&
(
typeof
item
.
btn
===
'function'
?
item
.
btn
()
:
item
.
btn
)
}
</
ElFormItem
>
),
)
}
...
...
src/components/Form.vue/AmountInput.vue
View file @
b61a23bf
...
...
@@ -35,7 +35,7 @@ const props = withDefaults(
hasSuffix
:
true
,
isDisabled
:
false
,
hasAppend
:
false
,
appendRender
:
null
,
appendRender
:
undefined
,
},
)
const
emits
=
defineEmits
<
{
...
...
@@ -45,7 +45,7 @@ const emits = defineEmits<{
const
val
=
ref
<
string
|
number
|
null
>
(
props
.
modelValue
)
const
iptFn
=
(
e
)
=>
{
const
iptFn
=
(
e
:
string
)
=>
{
const
bool
=
isNumFloat
(
e
)
// 只允许输入数字和最多一个小数点
if
(
e
===
''
)
{
val
.
value
=
null
...
...
@@ -63,11 +63,11 @@ const iptFn = (e) => {
const
decimalCount
=
(
e
.
match
(
/
\.
/g
)
||
[]).
length
// 计算小数点的个数
if
(
decimalCount
>
1
)
{
// 如果小数点个数大于1,则将多余的小数点替换为空字符串
val
.
value
=
e
.
replace
(
/
\.
/g
,
(
match
,
offset
)
=>
{
val
.
value
=
e
.
replace
(
/
\.
/g
,
(
match
:
string
,
offset
:
number
)
=>
{
return
offset
===
e
.
lastIndexOf
(
'.'
)
?
'.'
:
''
})
}
else
{
val
.
value
=
e
.
replace
(
/
[^\d
\
.]
/g
,
''
)
val
.
value
=
e
.
replace
(
/
[^\d
.
]
/g
,
''
)
}
}
}
...
...
src/components/Form.vue/DatePicker.vue
View file @
b61a23bf
...
...
@@ -17,21 +17,21 @@ const props = withDefaults(
placeholder
?:
string
type
?:
string
isNeedTime
?:
boolean
rowData
?:
any
rowData
?:
unknown
isrowDate
?:
boolean
newDisableDate
?:
(...
arg
)
=>
boolean
newDisableDate
?:
(...
arg
:
unknown
[]
)
=>
boolean
}
>
(),
{
placeholder
:
'请选择日期'
,
type
:
'date'
,
isNeedTime
:
false
,
isrowDate
:
false
,
rowData
:
null
,
rowData
:
undefined
,
newDisableDate
:
undefined
,
},
)
// 用于存储动态的禁用日期逻辑
function
disabledDate
(
time
)
{
function
disabledDate
(
time
:
Date
)
{
if
(
props
.
isrowDate
&&
props
.
newDisableDate
)
{
return
props
.
newDisableDate
(
time
,
props
.
rowData
)
}
...
...
src/components/Form.vue/DateRangePicker.vue
View file @
b61a23bf
...
...
@@ -21,17 +21,6 @@ const props = defineProps({
},
})
const
attrs
=
useAttrs
()
function
disabledDate
(
time
)
{
// 获取当前日期
const
today
=
new
Date
()
// 将时间戳转换为年月日格式的字符串
const
year
=
today
.
getFullYear
()
const
month
=
today
.
getMonth
()
const
day
=
today
.
getDate
()
const
currentDate
=
new
Date
(
year
,
month
,
day
)
// 禁止选择同一天
return
time
.
getTime
()
===
currentDate
.
getTime
()
}
const
dateRangePickerRef
=
ref
(
null
)
...
...
src/components/Form.vue/Select.vue
View file @
b61a23bf
...
...
@@ -22,9 +22,9 @@
<!--
</el-row>
-->
</
template
>
<
script
lang=
"ts"
setup
>
import
{
cloneDeep
,
debounce
}
from
'lodash-es'
import
{
cloneDeep
}
from
'lodash-es'
interface
IOption
{
[
key
:
string
]:
any
[
key
:
string
]:
unknown
}
const
props
=
withDefaults
(
defineProps
<
{
...
...
@@ -49,15 +49,18 @@ const props = withDefaults(
initChange
:
false
,
modelValue
:
''
,
isRefresh
:
false
,
load
:
null
,
isValueKey
:
false
,
},
)
const
emits
=
defineEmits
<
{
(
e
:
'change'
,
option
:
IOption
,
value
:
string
|
number
)
(
e
:
'update:modelValue'
,
data
:
string
|
number
|
undefined
)
(
e
:
'updatedOption'
)
(
e
:
'change'
,
option
:
IOption
,
value
:
string
|
number
):
void
(
e
:
'update:modelValue'
,
data
:
string
|
number
|
string
[]
|
number
[]
|
undefined
,
):
void
(
e
:
'updatedOption'
):
void
}
>
()
const
loading
=
ref
<
boolean
>
(
false
)
...
...
@@ -91,7 +94,7 @@ const getOptions = computed(() => {
return
data
})
const
changeFn
=
(
id
)
=>
{
const
changeFn
=
(
id
:
string
|
number
)
=>
{
const
value
=
props
.
labelIsValue
?
fields
.
label
:
fields
.
value
const
findItem
=
props
.
options
.
find
((
item
)
=>
item
[
value
]
===
id
)
...
...
@@ -108,7 +111,7 @@ if (props.initChange) {
watch
([()
=>
props
.
modelValue
,
getOptions
],
([
val
,
getOptionsVal
])
=>
{
if
(
val
!==
0
)
{
model
.
value
=
val
getOptionsVal
.
length
&&
changeFn
(
val
)
getOptionsVal
.
length
&&
changeFn
(
val
as
string
|
number
)
}
})
}
else
{
...
...
@@ -122,11 +125,6 @@ if (props.initChange) {
)
}
const
handleClickFn
=
debounce
(()
=>
{
model
.
value
=
null
emits
(
'updatedOption'
)
},
500
)
const
FocusFn
=
()
=>
{
try
{
props
.
load
&&
...
...
src/components/Form.vue/Switch .vue
View file @
b61a23bf
...
...
@@ -15,12 +15,12 @@ const props = withDefaults(
defineProps
<
{
activeColor
?:
string
inactiveColor
?:
string
modelValue
?:
any
modelValue
?:
unknown
}
>
(),
{
activeColor
:
'#13ce66'
,
inactiveColor
:
' #ff4949'
,
modelValue
:
null
,
modelValue
:
undefined
,
},
)
watch
(
...
...
@@ -36,7 +36,7 @@ watch(model, (val) => {
})
const
emits
=
defineEmits
<
{
(
e
:
'update:modelValue'
,
data
:
string
|
number
|
undefined
)
(
e
:
'update:modelValue'
,
data
:
string
|
number
|
undefined
)
:
void
}
>
()
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
src/components/SearchForm.tsx
View file @
b61a23bf
import
{
defineComponent
,
PropType
,
ref
,
computed
,
reactive
,
watch
,
h
,
}
from
'vue'
import
{
defineComponent
,
PropType
,
ref
,
computed
,
watch
,
h
}
from
'vue'
import
type
{
Component
}
from
'vue'
import
AmountInput
from
'./Form.vue/AmountInput.vue'
// 金额输入框
...
...
src/components/VxeTable.tsx
View file @
b61a23bf
import
{
VNode
}
from
'vue'
import
{
VxeTableInstance
}
from
'vxe-table'
interface
ColumnAttrs
{
field
?:
string
title
?:
string
...
...
@@ -7,15 +7,15 @@ interface ColumnAttrs {
[
key
:
string
]:
unknown
}
interface
TableColumn
{
export
interface
TableColumn
{
prop
:
string
label
:
string
attrs
?:
ColumnAttrs
render
?:
{
edit
?:
(
params
:
{
row
:
TableRowData
})
=>
VNode
|
JSX
.
Element
default
?:
(
params
:
{
row
:
TableRowData
})
=>
VNode
|
JSX
.
Element
edit
?:
(
params
:
{
row
:
TableRowData
})
=>
VNode
|
VNode
[]
|
JSX
.
Element
default
?:
(
params
:
{
row
:
TableRowData
})
=>
VNode
|
VNode
[]
|
JSX
.
Element
[
key
:
string
]:
|
((
params
:
{
row
:
TableRowData
})
=>
VNode
|
JSX
.
Element
)
|
((
params
:
{
row
:
TableRowData
})
=>
VNode
|
VNode
[]
|
JSX
.
Element
)
|
undefined
}
}
...
...
@@ -24,7 +24,9 @@ interface TableRowData {
[
key
:
string
]:
unknown
}
type
SlotFunction
=
(
scope
:
{
row
:
TableRowData
})
=>
VNode
|
JSX
.
Element
type
SlotFunction
=
(
scope
:
{
row
:
TableRowData
})
=>
VNode
|
VNode
[]
|
JSX
.
Element
export
default
defineComponent
({
name
:
'CustomizeTable'
,
...
...
@@ -52,7 +54,7 @@ export default defineComponent({
},
emits
:
[
'update:modelValue'
,
'checkbox-change'
,
'getCheckboxRecords'
],
setup
(
props
,
{
emit
,
attrs
})
{
const
tableRef
=
ref
(
null
)
const
tableRef
=
ref
<
VxeTableInstance
|
null
>
(
null
)
const
tableData
=
ref
<
Record
<
string
,
unknown
>
[]
>
([])
const
tableColumns
=
ref
<
TableColumn
[]
>
([])
const
editConfig
=
computed
(()
=>
{
...
...
@@ -107,7 +109,6 @@ export default defineComponent({
const
selectRowEvent
=
(
row
:
TableRowData
)
=>
{
const
$table
=
tableRef
.
value
if
(
$table
)
{
console
.
log
(
110
,
row
)
$table
.
setCurrentRow
(
row
)
}
}
...
...
@@ -129,7 +130,7 @@ export default defineComponent({
render
()
{
return
(
<
vxe
-
table
ref=
{
(
el
)
=>
(
this
.
tableRef
=
el
)
}
ref=
{
(
el
:
VxeTableInstance
)
=>
(
this
.
tableRef
=
el
)
}
data=
{
this
.
tableData
}
height=
"100%"
edit
-
config=
{
this
.
editConfig
}
...
...
src/types/api/logistics.ts
View file @
b61a23bf
...
...
@@ -10,6 +10,8 @@ export interface LogisticsMethod {
status
:
number
|
string
platformList
:
platformObj
[]
ruleRef
:
ruleRefObj
ruleId
?:
string
|
number
ruleList
?:
ruleRefObj
[]
}
export
interface
LogisticsMethodList
{
...
...
@@ -36,7 +38,7 @@ export interface LogisticsResponse {
message
:
string
}
interface
platformObj
{
export
interface
platformObj
{
platform
:
string
logisticsName
:
string
|
number
showPlatform
:
(
string
|
number
)[]
...
...
src/views/logistics/components/LogDialog.tsx
View file @
b61a23bf
...
...
@@ -20,7 +20,7 @@ export default defineComponent({
},
emits
:
[
'update:modelValue'
,
'close'
],
setup
(
props
,
{
emit
,
attrs
,
slots
})
{
const
formRef
=
ref
(
null
)
const
formRef
=
ref
<
InstanceType
<
typeof
ElDialog
>
|
null
>
(
null
)
const
isShow
=
ref
(
false
)
watch
(
()
=>
props
.
modelValue
,
...
...
@@ -33,7 +33,7 @@ export default defineComponent({
return
()
=>
{
return
(
<
ElDialog
ref=
{
(
el
)
=>
(
formRef
.
value
=
el
)
}
ref=
{
formRef
}
v
-
model=
{
isShow
.
value
}
title=
{
props
.
title
}
width=
{
props
.
dialogWidth
}
...
...
src/views/logistics/declarationRule.vue
View file @
b61a23bf
...
...
@@ -32,7 +32,7 @@
</div>
<LogDialog
:title=
"editForm
.id
? '编辑申报规则' : '新增申报规则'"
:title=
"editForm
['id']
? '编辑申报规则' : '新增申报规则'"
dialogWidth=
"1000px"
v-model=
"dialogVisible"
@
close=
"cancelFn"
...
...
@@ -77,7 +77,7 @@ import {
deleteLogisticsCustomsRule
,
getLogisticsLog
,
}
from
'@/api/logistics'
import
type
{
LogisticsMethod
}
from
'@/types/api/logistics'
import
SearchForm
from
'@/components/SearchForm.tsx'
import
LogDialog
from
'./components/LogDialog.tsx'
import
CustomizeForm
from
'@/components/CustomizeForm.tsx'
...
...
@@ -87,11 +87,9 @@ import usePageList from '@/utils/hooks/usePageList'
import
{
useValue
}
from
'./hooks/useValue'
import
{
showConfirm
}
from
'@/utils/ui'
import
{
debounce
}
from
'lodash-es'
import
{
DeclarationRuleList
,
AddDeclarationRuleObj
,
}
from
'./types/declarationRule'
import
{
AddDeclarationRuleObj
}
from
'./types/declarationRule'
import
{
Edit
,
Delete
,
List
}
from
'@element-plus/icons-vue'
import
{
ISeachFormConfig
}
from
'@/types/searchType'
const
[
searchForm
]
=
useValue
({})
const
[
editForm
,
resetEditForm
]
=
useValue
<
AddDeclarationRuleObj
>
({
type
:
1
})
...
...
@@ -116,9 +114,9 @@ const {
})
const
dialogVisible
=
ref
(
false
)
const
logDialogVisible
=
ref
(
false
)
const
editFormRef
=
ref
(
null
)
const
editFormRef
=
ref
<
InstanceType
<
typeof
CustomizeForm
>
|
null
>
(
null
)
const
selection
=
ref
([])
const
searchConfig
=
ref
([
const
searchConfig
=
ref
<
ISeachFormConfig
[]
>
([
{
prop
:
'name'
,
type
:
'input'
,
...
...
@@ -129,7 +127,9 @@ const searchConfig = ref([
},
},
])
interface
IOption
{
[
key
:
string
]:
unknown
}
const
mapData
=
ref
(
new
Map
<
number
,
string
[]
>
())
mapData
.
value
.
set
(
1
,
[
'fixedValue'
,
'fixedWeight'
])
mapData
.
value
.
set
(
2
,
[
'orderPercent'
,
'valueUp'
,
'weightPercent'
,
'weightUp'
])
...
...
@@ -175,7 +175,7 @@ const formConfig = ref<IFormConfig[]>([
{
label
:
'固定'
,
value
:
1
},
{
label
:
'比例'
,
value
:
2
},
],
onChange
:
(
item
,
value
)
=>
{
onChange
:
(
item
:
IOption
,
value
:
number
)
=>
{
if
(
value
===
2
)
{
editForm
.
value
.
fixedValue
=
''
editForm
.
value
.
fixedWeight
=
''
...
...
@@ -411,7 +411,9 @@ async function editRule(item: AddDeclarationRuleObj) {
editForm
.
value
=
{
...
item
}
dialogVisible
.
value
=
true
nextTick
(()
=>
{
editFormRef
.
value
?.
refashConfig
(
mapData
.
value
.
get
(
item
.
type
)
as
string
[])
editFormRef
.
value
?.
refashConfig
(
mapData
.
value
.
get
(
item
.
type
as
number
)
as
string
[],
)
})
console
.
log
(
493
,
editForm
.
value
)
}
catch
(
e
)
{
...
...
@@ -430,7 +432,7 @@ async function checkData() {
console
.
log
(
err
)
})
}),
new
Promise
<
LogisticsMethod
>
((
resolve
)
=>
{
new
Promise
<
AddDeclarationRuleObj
>
((
resolve
)
=>
{
const
params
=
{
...
editForm
.
value
}
resolve
(
params
)
...
...
@@ -498,7 +500,9 @@ async function deleteFn() {
return
}
try
{
const
ids
=
{
ids
:
selection
.
value
.
map
((
item
)
=>
item
.
id
).
join
(
','
)
}
const
ids
=
{
ids
:
selection
.
value
.
map
((
item
:
IOption
)
=>
item
.
id
).
join
(
','
),
}
await
deleteLogisticsCustomsRule
(
ids
)
ElMessage
({
message
:
'删除成功'
,
...
...
@@ -510,7 +514,7 @@ async function deleteFn() {
// showError(e)
}
}
async
function
deleteRule
(
item
)
{
async
function
deleteRule
(
item
:
AddDeclarationRuleObj
)
{
try
{
await
showConfirm
(
'是否删除物流方式'
,
{
confirmButtonText
:
'确认'
,
...
...
@@ -533,14 +537,18 @@ async function deleteRule(item) {
// showError(e)
}
}
const
logList
=
ref
([])
async
function
showLog
(
row
)
{
interface
LogList
{
id
?:
number
createTime
?:
string
description
?:
string
}
const
logList
=
ref
<
LogList
[]
>
([])
async
function
showLog
(
row
:
AddDeclarationRuleObj
)
{
logDialogVisible
.
value
=
true
try
{
const
{
data
}
=
await
getLogisticsLog
({
logType
:
'logistics_customs_rule'
,
relaId
:
row
.
id
,
relaId
:
row
.
id
as
number
,
})
logList
.
value
=
data
}
catch
(
error
)
{
...
...
src/views/logistics/logisticsCalculate.vue
View file @
b61a23bf
...
...
@@ -39,19 +39,21 @@
defineOptions
({
name
:
'LogisticsCalculate'
,
})
import
{
getLogisticsTrialCalculation
}
from
'@/api/logistics'
import
SearchForm
from
'@/components/SearchForm.tsx'
import
CustomizeTable
from
'@/components/VxeTable.tsx'
import
type
{
VxeTablePropTypes
}
from
'vxe-table'
import
{
useValue
}
from
'./hooks/useValue'
import
{
ISeachFormConfig
}
from
'@/types/searchType'
import
{
TableColumn
}
from
'@/components/VxeTable'
const
[
searchForm
]
=
useValue
({
code
:
''
,
weight
:
''
})
const
tableRef
=
ref
(
null
)
const
tableRef
=
ref
<
InstanceType
<
typeof
CustomizeTable
>
|
null
>
(
null
)
const
selection
=
ref
([])
const
mergeCells
=
ref
<
VxeTablePropTypes
.
MergeCells
>
([])
const
tableData
=
ref
([])
const
searchConfig
=
ref
([
const
searchConfig
=
ref
<
ISeachFormConfig
[]
>
([
{
prop
:
'code'
,
type
:
'input'
,
...
...
@@ -73,7 +75,7 @@ const searchConfig = ref([
},
])
const
tableConfig
=
ref
([
const
tableConfig
=
ref
<
TableColumn
[]
>
([
{
prop
:
'logisticsWayName'
,
label
:
'物流名称'
,
...
...
@@ -125,7 +127,9 @@ async function search() {
return
}
await
getList
(
searchForm
.
value
)
const
itemIndex
=
tableData
.
value
.
findIndex
((
item
)
=>
item
.
status
)
const
itemIndex
=
tableData
.
value
.
findIndex
(
(
item
:
{
status
:
boolean
})
=>
item
.
status
,
)
console
.
log
(
123
,
itemIndex
)
if
(
itemIndex
!==
-
1
)
{
nextTick
(()
=>
{
...
...
@@ -135,7 +139,7 @@ async function search() {
}
const
loading
=
ref
(
false
)
async
function
getList
(
data
?)
{
async
function
getList
(
data
?
:
{
code
:
string
;
weight
:
string
}
)
{
loading
.
value
=
true
try
{
const
res
=
await
getLogisticsTrialCalculation
({
...
...
src/views/logistics/logisticsMethod.vue
View file @
b61a23bf
This diff is collapsed.
Click to expand it.
src/views/logistics/logisticsPartition.vue
View file @
b61a23bf
...
...
@@ -54,7 +54,6 @@ defineOptions({
})
import
{
getLogisticsZoneList
,
addLogisticsZone
,
updateLogisticsZone
,
deleteLogisticsZone
,
importLogisticsZone
,
...
...
@@ -63,13 +62,14 @@ import {
}
from
'@/api/logistics'
import
SearchForm
from
'@/components/SearchForm.tsx'
import
{
ISeachFormConfig
}
from
'@/types/searchType'
import
CustomizeTable
from
'@/components/VxeTable.tsx'
import
type
{
VxeTablePropTypes
}
from
'vxe-table'
import
{
useValue
}
from
'./hooks/useValue'
import
{
showConfirm
}
from
'@/utils/ui'
import
{
ElInput
}
from
'element-plus'
import
{
debounce
}
from
'lodash-es
'
import
{
TableColumn
}
from
'@/components/VxeTable
'
const
[
searchForm
]
=
useValue
<
{
logisticsIdList
?:
string
[]
|
string
...
...
@@ -79,7 +79,7 @@ const [searchForm] = useValue<{
const
selection
=
ref
([])
const
mergeCells
=
ref
<
VxeTablePropTypes
.
MergeCells
>
([])
const
tableData
=
ref
([])
const
searchConfig
=
ref
([
const
searchConfig
=
ref
<
ISeachFormConfig
[]
>
([
{
prop
:
'logisticsIdList'
,
type
:
'select'
,
...
...
@@ -105,7 +105,7 @@ const searchConfig = ref([
},
])
const
tableConfig
=
ref
([])
const
tableConfig
=
ref
<
TableColumn
[]
>
([])
onMounted
(()
=>
{
getAllList
()
...
...
@@ -122,7 +122,22 @@ async function search() {
/**
* @description: 转换表格数据
*/
function
getTableData
(
arr
)
{
// 定义物流区域项的类型
interface
LogisticsZoneItem
{
logistics
:
string
codePrefix
:
string
highlight
:
boolean
logisticsId
:
string
}
// 定义父项的类型,允许动态添加属性
interface
ParentItem
{
logisticsZoneList
:
LogisticsZoneItem
[]
[
key
:
string
]:
unknown
// 添加索引签名,允许任意字符串键
}
function
getTableData
(
arr
:
ParentItem
[])
{
if
(
!
Array
.
isArray
(
arr
)
||
arr
.
length
===
0
)
return
[]
return
arr
.
map
((
parentItem
)
=>
{
const
quotationList
=
parentItem
.
logisticsZoneList
??
[]
...
...
@@ -173,7 +188,9 @@ async function deleteFn() {
const
params
=
{
logisticsList
:
zomList
[
0
],
zoneNameList
:
selection
.
value
.
map
((
item
)
=>
item
.
zoneName
),
zoneNameList
:
selection
.
value
.
map
(
(
item
:
{
zoneName
:
string
})
=>
item
.
zoneName
,
),
}
await
deleteLogisticsZone
(
params
)
ElMessage
({
...
...
@@ -193,7 +210,10 @@ const editParams = ref({})
/**
* @description: 获取列表
*/
async
function
getList
(
data
?)
{
async
function
getList
(
data
?:
{
logisticsIdList
?:
string
[]
|
string
codePrefix
?:
string
})
{
loading
.
value
=
true
try
{
const
res
=
await
getLogisticsZoneList
({
...
...
@@ -209,6 +229,14 @@ async function getList(data?) {
{
prop
:
'zoneName'
,
label
:
'分区'
,
render
:
{
edit
:
({
row
}:
{
row
:
{
zoneName
:
string
}
})
=>
{
return
<
span
>
{
row
.
zoneName
}
<
/span
>
},
default
:
({
row
}:
{
row
:
{
zoneName
:
string
}
})
=>
{
return
<
span
>
{
row
.
zoneName
}
<
/span
>
},
},
},
]
const
newConfig
=
[]
...
...
@@ -220,7 +248,13 @@ async function getList(data?) {
label
:
key
,
render
:
{
edit
:
({
row
})
=>
{
edit
:
({
row
,
}:
{
row
:
{
[
key
:
string
]:
{
codePrefix
:
string
;
logisticsId
:
string
}
}
})
=>
{
return
(
<
div
>
<
ElInput
...
...
@@ -240,7 +274,13 @@ async function getList(data?) {
<
/div
>
)
},
default
:
({
row
})
=>
{
default
:
({
row
,
}:
{
row
:
{
[
key
:
string
]:
{
codePrefix
:
string
;
highlight
:
string
}
}
})
=>
{
return
(
<
span
class
=
{
row
[
key
]?.
highlight
?
'tableCell'
:
'primaryCell'
}
...
...
@@ -254,7 +294,7 @@ async function getList(data?) {
}
}
}
tableConfig
.
value
=
[...
oldConfig
,
...
newConfig
]
tableConfig
.
value
=
[...
oldConfig
,
...
newConfig
]
as
TableColumn
[]
console
.
log
(
545
,
tableConfig
.
value
)
}
catch
(
error
)
{
console
.
log
(
error
)
...
...
@@ -278,15 +318,15 @@ function setCellStyle() {
const
[
cell
,
primaryCell
]
=
[
'.tableCell'
,
'.primaryCell'
].
map
((
selector
)
=>
document
.
querySelectorAll
(
selector
),
)
const
getAncestor
=
(
element
,
level
=
2
)
=>
{
const
getAncestor
=
(
element
:
Element
,
level
=
2
)
=>
{
let
current
=
element
while
(
level
--
>
0
&&
current
)
{
current
=
current
.
parentElement
current
=
current
.
parentElement
as
Element
}
return
current
||
null
}
const
safeSetBackground
=
(
element
,
color
)
=>
{
const
safeSetBackground
=
(
element
:
HTMLElement
,
color
:
string
)
=>
{
if
(
element
?.
style
&&
typeof
color
===
'string'
)
{
element
.
style
.
backgroundColor
=
color
}
...
...
@@ -294,13 +334,13 @@ function setCellStyle() {
if
(
cell
.
length
)
{
cell
.
forEach
((
item
)
=>
{
const
grandParent
=
getAncestor
(
item
)
safeSetBackground
(
grandParent
,
'#e6f7ff'
)
safeSetBackground
(
grandParent
as
HTMLElement
,
'#e6f7ff'
)
})
}
if
(
primaryCell
.
length
)
{
primaryCell
.
forEach
((
item
)
=>
{
const
grandParent
=
getAncestor
(
item
)
safeSetBackground
(
grandParent
,
'transparent'
)
safeSetBackground
(
grandParent
as
HTMLElement
,
'transparent'
)
})
}
}
...
...
@@ -320,7 +360,7 @@ async function getAllList() {
/**
* @description: 上传文件
*/
function
onBeforeUploadImage
(
file
)
{
function
onBeforeUploadImage
(
file
:
File
)
{
const
isIMAGE
=
file
.
type
==
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
...
...
@@ -338,7 +378,7 @@ function onBeforeUploadImage(file) {
async
function
downloadExcel
()
{
try
{
const
res
=
await
exportExcelLogisticsZone
()
const
blob
=
new
Blob
([
res
])
const
blob
=
new
Blob
([
res
as
unknown
as
BlobPart
])
const
filename
=
'物流分区模版.xlsx'
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
window
.
URL
.
createObjectURL
(
blob
)
...
...
@@ -352,7 +392,7 @@ async function downloadExcel() {
/**
* @description: 导入
*/
async
function
exportExcel
(
file
)
{
async
function
exportExcel
(
file
:
{
file
:
File
}
)
{
try
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
...
...
src/views/logistics/logisticsQuotation.vue
View file @
b61a23bf
...
...
@@ -46,8 +46,8 @@
:config=
"tableConfig"
:merge-cells=
"mergeCells"
:seq-config=
"{
seqMethod: (row) => {
if (searchForm.logisticsList?.length) {
seqMethod: (row
:any
) => {
if (searchForm.logistics
Id
List?.length) {
return row.row.seq
}
...
...
@@ -121,7 +121,9 @@ import {
downloadLogisticsQuotationTemplate
,
getLogisticsLog
,
}
from
'@/api/logistics'
import
type
{
LogisticsMethod
}
from
'@/types/api/logistics'
import
{
ISeachFormConfig
}
from
'@/types/searchType'
import
{
TableColumn
}
from
'@/components/VxeTable'
import
SearchForm
from
'@/components/SearchForm.tsx'
import
LogDialog
from
'./components/LogDialog.tsx'
import
CustomizeForm
from
'@/components/CustomizeForm.tsx'
...
...
@@ -132,9 +134,11 @@ import { useValue } from './hooks/useValue'
import
{
showConfirm
}
from
'@/utils/ui'
import
{
Edit
,
List
}
from
'@element-plus/icons-vue'
import
{
debounce
}
from
'lodash-es'
import
{
LogisticsQuotation
}
from
'./types/logisticsQuotation'
const
[
searchForm
]
=
useValue
({
logisticsIdList
:
[]
})
const
[
editForm
,
resetEditForm
]
=
useValue
({
unit
:
'oz'
})
const
[
editForm
,
resetEditForm
]
=
useValue
<
LogisticsQuotation
>
({
unit
:
'oz'
,
})
const
{
loading
,
currentPage
,
...
...
@@ -156,11 +160,11 @@ const {
}),
})
const
dialogVisible
=
ref
(
false
)
const
editFormRef
=
ref
(
null
)
const
editFormRef
=
ref
<
InstanceType
<
typeof
CustomizeForm
>
|
null
>
(
null
)
const
selection
=
ref
([])
const
mergeCells
=
ref
<
VxeTablePropTypes
.
MergeCells
>
([])
const
tableData
=
ref
([])
const
searchConfig
=
ref
([
const
tableData
=
ref
<
LogisticsQuotation
[]
>
([])
const
searchConfig
=
ref
<
ISeachFormConfig
[]
>
([
{
prop
:
'logisticsIdList'
,
type
:
'select'
,
...
...
@@ -190,7 +194,7 @@ const formConfig = computed(() => [
label
:
'name'
,
options
:
[],
disabled
:
editForm
.
value
?.[
'id'
]
?
true
:
false
,
onChange
:
(
val
,
id
)
=>
{
onChange
:
(
val
:
{
name
:
string
;
id
:
number
}
)
=>
{
editForm
.
value
[
'logisticsId'
]
=
val
.
id
},
},
...
...
@@ -307,7 +311,7 @@ const formConfig = computed(() => [
},
])
const
tableConfig
=
ref
([
const
tableConfig
=
ref
<
TableColumn
[]
>
([
{
prop
:
'rateType'
,
label
:
'Rate(oz/LB)'
,
...
...
@@ -374,7 +378,7 @@ const tableConfig = ref([
align
:
'center'
,
},
render
:
{
default
:
({
row
}
:
{
row
:
LogisticsMethod
}
)
=>
(
default
:
({
row
})
=>
(
<
div
>
<
el
-
icon
size
=
"24"
...
...
@@ -390,7 +394,7 @@ const tableConfig = ref([
title
=
"日志"
color
=
"#008aff"
style
=
"cursor: pointer; vertical-align: middle"
onclick
=
{()
=>
showLog
(
row
)}
onclick
=
{()
=>
showLog
(
row
as
unknown
as
LogisticsQuotation
)}
>
<
List
/>
<
/el-icon
>
...
...
@@ -401,15 +405,15 @@ const tableConfig = ref([
])
watch
(
()
=>
data
.
value
,
()
=>
data
.
value
as
LogisticsQuotation
[]
,
(
val
)
=>
{
try
{
tableData
.
value
=
getTableData
(
val
)
tableData
.
value
=
getTableData
(
val
as
LogisticsQuotation
[]
)
if
(
searchForm
.
value
.
logisticsIdList
?.
length
)
{
let
startRow
=
0
mergeCells
.
value
=
[]
data
.
value
.
forEach
((
item
)
=>
{
val
.
forEach
((
item
)
=>
{
if
(
item
.
logisticsQuotationList
?.
length
)
{
const
rowspan
=
item
.
logisticsQuotationList
.
length
for
(
let
col
=
0
;
col
<
5
;
col
++
)
{
...
...
@@ -437,8 +441,8 @@ onMounted(() => {
getAllList
()
})
function
getTableData
(
arr
)
{
const
newArr
=
[]
function
getTableData
(
arr
:
LogisticsQuotation
[]
)
{
const
newArr
:
LogisticsQuotation
[]
=
[]
if
(
arr
.
length
)
{
arr
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
logisticsQuotationList
?.
length
)
{
...
...
@@ -459,7 +463,7 @@ function cancelFn() {
resetEditForm
()
}
async
function
editWay
(
item
:
Logistics
Method
)
{
async
function
editWay
(
item
:
Logistics
Quotation
)
{
try
{
editForm
.
value
=
{
...
item
}
console
.
log
(
432
,
editForm
.
value
)
...
...
@@ -481,7 +485,7 @@ async function checkData() {
console
.
log
(
err
)
})
}),
new
Promise
<
Logistics
Method
>
((
resolve
)
=>
{
new
Promise
<
Logistics
Quotation
>
((
resolve
)
=>
{
const
params
=
{
...
editForm
.
value
}
resolve
(
params
)
...
...
@@ -539,7 +543,9 @@ async function deleteFn() {
return
}
try
{
const
ids
=
{
ids
:
selection
.
value
.
map
((
item
)
=>
item
.
id
).
join
(
','
)
}
const
ids
=
{
ids
:
selection
.
value
.
map
((
item
:
{
id
:
number
})
=>
item
.
id
).
join
(
','
),
}
await
deleteLogisticsQuotation
(
ids
)
ElMessage
({
message
:
'删除成功'
,
...
...
@@ -573,7 +579,7 @@ async function getAllList() {
}
}
function
onBeforeUploadImage
(
file
)
{
function
onBeforeUploadImage
(
file
:
File
)
{
const
isIMAGE
=
file
.
type
==
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
...
...
@@ -588,7 +594,7 @@ async function downloadExcel() {
try
{
const
res
=
await
downloadLogisticsQuotationTemplate
()
console
.
log
(
483
,
data
)
const
blob
=
new
Blob
([
res
])
const
blob
=
new
Blob
([
res
as
unknown
as
BlobPart
])
const
filename
=
'物流报价模版.xlsx'
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
window
.
URL
.
createObjectURL
(
blob
)
...
...
@@ -598,7 +604,7 @@ async function downloadExcel() {
console
.
log
(
error
)
}
}
async
function
exportExcel
(
file
)
{
async
function
exportExcel
(
file
:
{
file
:
File
}
)
{
try
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
...
...
@@ -613,7 +619,7 @@ async function exportExcel(file) {
ElMessage
.
error
(
'导入失败!'
)
}
}
async
function
updateExcel
(
file
)
{
async
function
updateExcel
(
file
:
{
file
:
File
}
)
{
try
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
...
...
@@ -628,15 +634,20 @@ async function updateExcel(file) {
ElMessage
.
error
(
'导入失败!'
)
}
}
interface
LogList
{
id
?:
number
createTime
?:
string
description
?:
string
}
const
logList
=
ref
<
LogList
[]
>
([])
const
logList
=
ref
([])
const
logDialogVisible
=
ref
(
false
)
async
function
showLog
(
row
)
{
async
function
showLog
(
row
:
LogisticsQuotation
)
{
logDialogVisible
.
value
=
true
try
{
const
{
data
}
=
await
getLogisticsLog
({
logType
:
'logistics_quotation'
,
relaId
:
row
.
id
,
relaId
:
row
.
id
as
number
,
})
logList
.
value
=
data
}
catch
(
error
)
{
...
...
src/views/logistics/shippingAddress.vue
View file @
b61a23bf
...
...
@@ -5,10 +5,14 @@
{{
'新增'
}}
</el-button>
<el-button
:disabled=
"
tableData
.filter((el) => el.checked).length === 0"
:disabled=
"
(tableData as ShippingAddress[])
.filter((el) => el.checked).length === 0"
type=
"danger"
@
click=
"
deleteSection(tableData.filter((el) => el.checked).map((el) => el.id))
deleteSection(
(tableData as ShippingAddress[])
.filter((el) => el.checked)
.map((el) => el.id as number)
)
"
>
{{
'删除'
}}
...
...
@@ -17,7 +21,11 @@
<div
class=
"user-content flex-1 flex-column overflow-hidden"
>
<div
class=
"user-list flex-1 overflow-hidden"
v-loading=
"loading"
>
<el-row
:gutter=
"20"
>
<el-col
v-for=
"(item, index) in tableData"
:key=
"index"
:span=
"12"
>
<el-col
v-for=
"(item, index) in tableData as ShippingAddress[]"
:key=
"index"
:span=
"12"
>
<div
class=
"address-item"
>
<div
class=
"check"
>
<el-checkbox
v-model=
"item.checked"
></el-checkbox>
...
...
@@ -26,14 +34,8 @@
<div
class=
"name"
>
<b>
{{
item
.
shipperName
}}
</b>
<p
:title=
"
[item.phoneNumber, item.email, item.postalCode].join(' ')
"
>
{{
[
item
.
phoneNumber
,
item
.
email
,
item
.
postalCode
].
join
(
' '
)
}}
<p
:title=
"[item.phoneNumber, item.postalCode].join(' ')"
>
{{
[
item
.
phoneNumber
,
item
.
postalCode
].
join
(
' '
)
}}
</p>
<el-tag
type=
"success"
v-if=
"item.swDefault"
>
...
...
@@ -178,24 +180,24 @@ import {
getAddressByIdList
,
addAddress
,
updateAddress
,
getAddressById
,
getLogisticsLog
,
deleteAddressByIds
,
}
from
'@/api/logistics'
import
type
{
LogisticsMethod
}
from
'@/types/api/logistics'
import
{
IFormConfig
}
from
'@/components/CustomizeForm.tsx'
import
{
LogisticsQuotation
}
from
'./types/logisticsQuotation.ts'
import
LogDialog
from
'./components/LogDialog.tsx'
import
CustomizeForm
from
'@/components/CustomizeForm.tsx'
import
{
Edit
,
Delete
,
List
}
from
'@element-plus/icons-vue'
import
{
debounce
}
from
'lodash-es'
import
{
ShippingAddress
}
from
'./types/shippingAddress.ts'
import
usePageList
from
'@/utils/hooks/usePageList'
import
{
useValue
}
from
'./hooks/useValue'
import
{
showConfirm
}
from
'@/utils/ui'
const
[
searchForm
]
=
useValue
({})
const
[
editForm
,
resetEditForm
]
=
useValue
<
LogisticsQuotation
>
({
const
[
editForm
,
resetEditForm
]
=
useValue
<
ShippingAddress
>
({
swDefault
:
false
,
})
const
{
...
...
@@ -219,8 +221,7 @@ const {
})
const
dialogVisible
=
ref
(
false
)
const
logDialogVisible
=
ref
(
false
)
const
editFormRef
=
ref
(
null
)
const
selection
=
ref
([])
const
editFormRef
=
ref
<
InstanceType
<
typeof
CustomizeForm
>
|
null
>
(
null
)
const
formConfig
=
ref
<
IFormConfig
[]
>
([
{
...
...
@@ -367,7 +368,7 @@ function cancelFn() {
editFormRef
.
value
?.
resetFields
()
resetEditForm
()
}
async
function
deleteAddress
(
item
)
{
async
function
deleteAddress
(
item
:
ShippingAddress
)
{
try
{
await
showConfirm
(
'是否删除发货地址'
,
{
confirmButtonText
:
'确认'
,
...
...
@@ -391,7 +392,7 @@ async function deleteAddress(item) {
// showError(e)
}
}
async
function
editAddress
(
item
)
{
async
function
editAddress
(
item
:
ShippingAddress
)
{
try
{
editForm
.
value
=
{
...
item
}
console
.
log
(
395
,
editForm
.
value
)
...
...
@@ -412,7 +413,7 @@ async function checkData() {
console
.
log
(
err
)
})
}),
new
Promise
<
LogisticsMethod
>
((
resolve
)
=>
{
new
Promise
<
ShippingAddress
>
((
resolve
)
=>
{
const
params
=
{
...
editForm
.
value
}
resolve
(
params
)
}),
...
...
@@ -452,7 +453,7 @@ const save = debounce(async () => {
function
addDialog
()
{
dialogVisible
.
value
=
true
}
async
function
deleteSection
(
arr
)
{
async
function
deleteSection
(
arr
:
number
[]
)
{
try
{
await
showConfirm
(
'是否删除发货地址'
,
{
confirmButtonText
:
'确认'
,
...
...
@@ -475,13 +476,20 @@ async function deleteSection(arr) {
// showError(e)
}
}
const
logList
=
ref
([])
async
function
showLog
(
row
)
{
interface
LogList
{
id
?:
number
createTime
?:
string
description
?:
string
}
const
logList
=
ref
<
LogList
[]
>
([])
async
function
showLog
(
row
:
ShippingAddress
)
{
logDialogVisible
.
value
=
true
try
{
const
{
data
}
=
await
getLogisticsLog
({
logType
:
'logistics_address'
,
relaId
:
row
.
id
,
relaId
:
row
.
id
as
number
,
})
logList
.
value
=
data
}
catch
(
error
)
{
...
...
src/views/logistics/types/logisticsQuotation.ts
View file @
b61a23bf
export
interface
LogisticsQuotation
{
addressLine1
?:
string
addressLine2
?:
string
addressLine3
?:
string
city
?:
string
cityCode
?:
string
countryCode
?:
string
countryName
?:
string
createTime
?:
string
cspAccount
?:
string
district
?:
string
districtCode
?:
string
factoryId
?:
number
id
?:
number
phoneNumber
?:
string
postalCode
?:
string
rfcTaxId
?:
string
shipperName
?:
string
stateProvince
?:
string
stateProvinceAbbr
?:
string
swDefault
?:
boolean
updateTime
?:
string
logistics
?:
string
logisticsId
?:
number
rate
?:
number
rateG
?:
number
rateKg
?:
number
rateType
?:
string
seq
?:
number
unit
?:
string
zone1
?:
string
zone2
?:
string
zone3
?:
string
zone4
?:
string
zone5
?:
string
zone6
?:
string
zone7
?:
string
zone8
?:
string
zone9
?:
string
logisticsQuotationList
?:
LogisticsQuotation
[]
}
src/views/logistics/types/shippingAddress.ts
0 → 100644
View file @
b61a23bf
export
interface
ShippingAddress
{
addressLine1
?:
string
addressLine2
?:
string
addressLine3
?:
string
city
?:
string
cityCode
?:
string
countryCode
?:
string
countryName
?:
string
createTime
?:
string
cspAccount
?:
string
district
?:
string
districtCode
?:
string
factoryId
?:
number
id
?:
number
phoneNumber
?:
string
postalCode
?:
string
rfcTaxId
?:
string
shipperName
?:
string
stateProvince
?:
string
stateProvinceAbbr
?:
string
swDefault
?:
boolean
updateTime
?:
string
checked
?:
boolean
}
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