Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
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
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
zhouqian
vue-gjjs
Commits
873e0b0c
Commit
873e0b0c
authored
Dec 28, 2021
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善setValues支持
parent
b11b2363
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
14 deletions
+36
-14
commonApi.js
src/mixin/commonApi.js
+33
-5
commonFuncs.js
src/mixin/commonFuncs.js
+0
-8
index.js
src/utils/index.js
+3
-1
No files found.
src/mixin/commonApi.js
View file @
873e0b0c
...
...
@@ -4,8 +4,15 @@ import Utils from "../utils"
export
default
{
data
()
{
return
{
codeSet
:{}
//setvalues的接收码表
},
created
(){
if
(
this
.
root
){
//非顶级vue实例,不需要执行
return
;
}
if
(
this
.
codes
){
Vue
.
set
(
this
.
codes
,
"codeSet"
,{})
}
},
mounted
()
{
...
...
@@ -16,13 +23,19 @@ export default {
if
(
!
values
){
return
}
for
(
let
key
in
values
){
Vue
.
set
(
this
.
codeSet
,
key
,
values
[
key
])
//顶级实例,进入设置
if
(
!
this
.
root
){
for
(
let
key
in
values
){
Vue
.
set
(
this
.
codes
.
codeSet
,
key
,
values
[
key
])
}
}
else
{
this
.
root
.
updapteValueSet
(
values
)
}
},
//获取后台setValues、setCodeValues传来的动态码,并自动转为码表值
getValues
(
key
){
let
arr
=
codeSet
[
key
]
let
arr
=
this
.
codes
.
codeSet
[
key
]
if
(
!
arr
)
return
undefined
return
arr
.
map
(
item
=>
{
...
...
@@ -33,6 +46,17 @@ export default {
return
{
label
:
itemArr
[
0
],
value
:
itemArr
[
1
]}
})
},
showBackendErrors
(
fieldErrors
){
// 清除之前的校验状态
this
.
getRoot
().
$refs
.
modelForm
.
clearValidate
();
const
fields
=
this
.
getRoot
().
$refs
.
modelForm
.
fields
;
Utils
.
positioningErrorMsg
(
fieldErrors
,
fields
);
const
tab
=
Utils
.
positioningErrorMsg
(
fieldErrors
,
fields
);
return
tab
;
},
getRoot
(){
return
(
this
.
root
||
this
)
},
async
init
(
params
)
{
let
rtnmsg
=
await
Api
.
post
(
this
.
declareParams
.
trnName
+
"/init"
,
{
params
})
if
(
rtnmsg
.
respCode
==
SUCCESS
){
...
...
@@ -40,6 +64,7 @@ export default {
}
return
rtnmsg
},
save
(
params
)
{
return
Api
.
post
(
this
.
declareParams
.
trnName
+
"/saveData"
,
this
.
wrapper
(
params
))
},
...
...
@@ -47,6 +72,7 @@ export default {
let
rtnmsg
=
await
Api
.
post
(
this
.
declareParams
.
trnName
+
"/executeCheck/"
+
rulePath
,
this
.
wrapper
(
params
))
if
(
rtnmsg
.
respCode
==
SUCCESS
){
this
.
updapteValueSet
(
rtnmsg
.
codeSet
)
this
.
showBackendErrors
(
rtnmsg
.
fieldErrors
)
}
return
rtnmsg
},
...
...
@@ -54,6 +80,7 @@ export default {
let
rtnmsg
=
await
Api
.
post
(
this
.
declareParams
.
trnName
+
"/executeDefault/"
+
rulePath
,
this
.
wrapper
(
params
))
if
(
rtnmsg
.
respCode
==
SUCCESS
){
this
.
updapteValueSet
(
rtnmsg
.
codeSet
)
this
.
showBackendErrors
(
rtnmsg
.
fieldErrors
)
}
return
rtnmsg
},
...
...
@@ -61,6 +88,7 @@ export default {
let
rtnmsg
=
await
Api
.
post
(
this
.
declareParams
.
trnName
+
"/executeRule/"
+
rulePath
,
this
.
wrapper
(
params
,
delayCb
))
if
(
rtnmsg
.
respCode
==
SUCCESS
){
this
.
updapteValueSet
(
rtnmsg
.
codeSet
)
this
.
showBackendErrors
(
rtnmsg
.
fieldErrors
)
}
return
rtnmsg
},
...
...
src/mixin/commonFuncs.js
View file @
873e0b0c
...
...
@@ -51,14 +51,6 @@ export default {
});
}
},
showBackendErrors
(
fieldErrors
){
// 清除之前的校验状态
this
.
$refs
.
modelForm
.
clearValidate
();
const
fields
=
this
.
$refs
.
modelForm
.
fields
;
Utils
.
positioningErrorMsg
(
fieldErrors
,
fields
);
const
tab
=
Utils
.
positioningErrorMsg
(
fieldErrors
,
fields
);
return
tab
;
},
// 表单校验
async
handleCheck
()
{
let
result
=
await
this
.
checkAll
();
...
...
src/utils/index.js
View file @
873e0b0c
...
...
@@ -62,7 +62,9 @@ export default class Utils {
//给叶子元素赋值
if
(
tempobj
)
{
let
leafProp
=
keyArr
[
keyArr
.
length
-
1
];
if
(
tempobj
.
hasOwnProperty
(
leafProp
))
if
(
tempobj
.
hasOwnProperty
(
leafProp
)
||
"pageId"
==
leafProp
//对pageId开放判断。
)
tempobj
[
leafProp
]
=
vo
[
key
];
}
}
...
...
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