Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
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
fulixin
dsk-operate-sys-cscec
Commits
c2ff94bd
Commit
c2ff94bd
authored
Jan 16, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
6d2e2778
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
10 deletions
+72
-10
index.js
dsk-operate-ui/src/api/consultingOrgManagement/index.js
+2
-2
CustomFormDesign.vue
...ent/components/CustomForm/components/CustomFormDesign.vue
+70
-8
No files found.
dsk-operate-ui/src/api/consultingOrgManagement/index.js
View file @
c2ff94bd
...
@@ -73,7 +73,7 @@ export const updateConsultingDetailApi = (data) => request({
...
@@ -73,7 +73,7 @@ export const updateConsultingDetailApi = (data) => request({
* @returns
* @returns
*/
*/
export
const
getCustomFormDetailApi
=
()
=>
request
({
export
const
getCustomFormDetailApi
=
()
=>
request
({
url
:
"/advisory/body/get
AdvisoryBodyCustomForm
"
,
url
:
"/advisory/body/get
CustomFormTemplate
"
,
method
:
"get"
,
method
:
"get"
,
params
:
{}
params
:
{}
});
});
...
@@ -84,7 +84,7 @@ export const getCustomFormDetailApi = () => request({
...
@@ -84,7 +84,7 @@ export const getCustomFormDetailApi = () => request({
* @returns
* @returns
*/
*/
export
const
addCustomFormDataApi
=
(
data
)
=>
request
({
export
const
addCustomFormDataApi
=
(
data
)
=>
request
({
url
:
"/advisory/body/
addAdvisoryBodyCustomForm
"
,
url
:
"/advisory/body/
editCustomFormTemplate
"
,
method
:
"post"
,
method
:
"post"
,
data
data
});
});
...
...
dsk-operate-ui/src/views/consultingOrgManagement/components/CustomForm/components/CustomFormDesign.vue
View file @
c2ff94bd
...
@@ -121,6 +121,8 @@ export default {
...
@@ -121,6 +121,8 @@ export default {
activeModuleId
:
""
,
activeModuleId
:
""
,
// 分栏计数
// 分栏计数
moduleCount
:
0
,
moduleCount
:
0
,
// 获取到的表单模板
formTemplate
:
{
}
}
;
}
;
}
,
}
,
watch
:
{
watch
:
{
...
@@ -168,8 +170,8 @@ export default {
...
@@ -168,8 +170,8 @@ export default {
defaultField
:
{
defaultField
:
{
type
:
"object"
,
type
:
"object"
,
fields
:
{
fields
:
{
edit
:
{
type
:
"enum"
,
enum
:
[
false
],
required
:
true
,
message
:
"请先保存分栏名称,当前不能处于编辑状态"
}
,
subfieldModuleName
:
{
type
:
"string"
,
required
:
true
,
message
:
"分栏名称不能为空"
}
,
subfieldModuleName
:
{
type
:
"string"
,
required
:
true
,
message
:
"分栏名称不能为空"
}
,
edit
:
{
type
:
"enum"
,
enum
:
[
true
],
required
:
true
,
message
:
"请先保存分栏名称,当前不能处于编辑状态"
}
,
children
:
{
children
:
{
type
:
"array"
,
type
:
"array"
,
required
:
true
,
required
:
true
,
...
@@ -191,10 +193,58 @@ export default {
...
@@ -191,10 +193,58 @@ export default {
}
;
}
;
const
validatorIns
=
new
Schema
(
finllyRules
);
const
validatorIns
=
new
Schema
(
finllyRules
);
const
flag
=
await
validatorIns
.
validate
(
_templateTemp
,
{
first
:
true
}
);
const
flag
=
await
validatorIns
.
validate
(
_templateTemp
,
{
first
:
true
}
);
const
_tempData
=
cloneDeep
(
this
.
subfieldModuleForm
.
subfieldModuleList
);
const
map
=
new
Map
();
const
len
=
_tempData
.
length
;
for
(
let
index
=
0
;
index
<
len
;
index
++
)
{
const
current
=
_tempData
[
index
];
const
children
=
current
.
children
;
if
(
children
?.
length
)
{
for
(
let
j
=
0
;
j
<
children
.
length
;
j
++
)
{
const
child
=
children
[
j
];
if
(
map
.
has
(
child
.
uid
))
return
this
.
$message
.
error
(
`第${index + 1
}
个分栏下的,第${j + 1
}
个表单元素字段名称重复`
);
map
.
set
(
child
.
uid
,
child
);
}
}
}
await
this
.
submitCustomForm
({
subfieldModuleList
:
_tempData
}
);
}
catch
(
error
)
{
}
catch
(
error
)
{
if
(
error
?.
errors
?.
length
)
{
if
(
error
?.
errors
?.
length
)
{
console
.
dir
(
error
);
console
.
dir
(
error
);
const
{
errors
,
fields
}
=
error
;
this
.
errorHandle
(
errors
);
}
}
}
,
async
submitCustomForm
(
data
)
{
try
{
console
.
log
(
data
);
const
params
=
{
jsonData
:
serialize
(
data
)
}
;
if
(
this
.
formTemplate
?.
templateId
)
params
[
"templateId"
]
=
this
.
formTemplate
.
templateId
;
const
result
=
await
addCustomFormDataApi
(
params
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
,
errorHandle
(
errors
)
{
try
{
const
len
=
errors
.
length
;
for
(
let
index
=
0
;
index
<
len
;
index
++
)
{
const
current
=
errors
[
index
];
let
keyName
=
current
.
field
.
split
(
"."
);
const
isModule
=
keyName
[
0
]
==
"subfieldModuleList"
?
true
:
false
;
if
(
isModule
)
{
this
.
$message
.
error
(
`第${parseInt(keyName[1]) + 1
}
分栏,${current.message
}
`
);
return
;
}
this
.
$message
.
error
(
`${current.message
}
`
);
}
}
}
catch
(
error
)
{
}
}
}
,
}
,
cancelCreate
()
{
cancelCreate
()
{
...
@@ -208,21 +258,33 @@ export default {
...
@@ -208,21 +258,33 @@ export default {
async
getCustomFormDetail
()
{
async
getCustomFormDetail
()
{
try
{
try
{
const
result
=
await
getCustomFormDetailApi
();
const
result
=
await
getCustomFormDetailApi
();
if
(
result
.
code
==
200
&&
result
.
data
?.
length
)
{
if
(
result
.
code
==
200
&&
result
.
data
)
{
return
result
.
data
;
return
result
.
data
;
}
}
return
[]
;
return
null
;
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
}
,
}
,
parseTemplate
(
templateJson
)
{
try
{
const
data
=
eval
(
`(${templateJson
}
)`
);
if
(
data
)
{
this
.
$set
(
this
.
subfieldModuleForm
,
"subfieldModuleList"
,
data
.
subfieldModuleList
);
}
}
catch
(
error
)
{
elementMessageSingleton
(
"error"
,
`解析模板失败,${error.message
}
`
);
}
}
,
async
initModule
()
{
async
initModule
()
{
try
{
try
{
// const result = await this.getCustomFormDetail();
const
result
=
await
this
.
getCustomFormDetail
();
// if (result.length)
{
if
(
result
)
{
// // 有模板数据 进行回显
// 有模板数据 进行回显
// return;
this
.
formTemplate
=
result
;
//
}
this
.
parseTemplate
(
result
.
jsonData
);
return
;
}
// 模块初始化
// 模块初始化
this
.
addSubfieldModule
();
this
.
addSubfieldModule
();
const
component
=
cloneDeep
(
defaultComOptions
[
0
]);
const
component
=
cloneDeep
(
defaultComOptions
[
0
]);
...
...
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