Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
contractmanage
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
contractmanage
Commits
1f961a6c
Commit
1f961a6c
authored
Mar 03, 2022
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增修改页面路由离开前判断表单变化
parent
38726982
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
2 deletions
+39
-2
add.vue
src/views/contactsUnit/add.vue
+39
-2
No files found.
src/views/contactsUnit/add.vue
View file @
1f961a6c
<
template
>
<div
class=
"contactsUnitAdd"
>
<div
class=
"addTitle"
>
{{
$route
.
query
.
type
===
'add'
?
'新增往来单位'
<div
class=
"addTitle"
>
{{
$route
.
query
.
type
===
'add'
?
'新增往来单位'
:
$route
.
query
.
type
===
'update'
?
'修改往来单位'
:
$route
.
query
.
type
===
'details'
?
'查看往来单位'
:
''
}}
</div>
<el-form
ref=
"form"
inline
:model=
"form"
:disabled=
"$route.query.type === 'details'"
label-width=
"auto"
label-position=
"right"
>
...
...
@@ -135,6 +135,23 @@ export default {
ZETPSPROPERTY
:
''
,
ZCOMPYREL
:
''
,
ZBPNATURE
:
''
},
saveForm
:
{
ZBPNAME_ZH
:
''
,
ZBPTYPE
:
''
,
ZOIBC
:
''
,
ZBPNAME_EN
:
''
,
ZBPNAME_LOC
:
''
,
ZUSCC
:
''
,
ZBRNO
:
''
,
ZTRNO
:
''
,
ZOSRNO
:
''
,
ZIDNO
:
''
,
ZSSNO
:
''
,
ZZCOUNTRY
:
''
,
ZETPSPROPERTY
:
''
,
ZCOMPYREL
:
''
,
ZBPNATURE
:
''
}
}
},
...
...
@@ -143,9 +160,29 @@ export default {
this
.
getDetail
()
}
},
beforeRouteLeave
(
to
,
from
,
next
)
{
if
(
this
.
agreeBack
)
{
next
()
}
else
{
if
(
JSON
.
stringify
(
this
.
form
)
!==
JSON
.
stringify
(
this
.
saveForm
))
{
this
.
$confirm
(
'您已经对信息进行了修改,离开后不会保存您所做的更改,是否确定离开?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
closeOnHashChange
:
false
}).
then
(()
=>
{
this
.
agreeBack
=
true
this
.
$router
.
replace
(
to
.
path
)
}).
catch
(()
=>
{
})
}
else
{
this
.
agreeBack
=
true
this
.
$router
.
replace
(
to
.
fullPath
)
}
}
},
methods
:
{
getDetail
()
{
this
.
form
=
this
.
$route
.
query
.
data
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
$route
.
query
.
data
))
this
.
saveForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
$route
.
query
.
data
))
}
}
}
...
...
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