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