Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
eb150c5e
Commit
eb150c5e
authored
Aug 14, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单删除、修改校验,表单项增加,删除,修改校验
parent
24e2f1d4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
2 deletions
+73
-2
gsb-marketplat/app/base/controller/impl/configmag/forminfoCtl.js
+10
-0
gsb-marketplat/app/base/controller/impl/configmag/formitemCtl.js
+9
-0
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
+22
-0
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
+32
-2
No files found.
gsb-marketplat/app/base/controller/impl/configmag/forminfoCtl.js
View file @
eb150c5e
...
...
@@ -37,6 +37,16 @@ class FormInfoCtl extends CtlBase {
return
result
;
}
/**
* 删除
* @param pobj
* @returns {Promise<*>}
*/
async
delete
(
pobj
){
let
result
=
await
this
.
service
.
deleteForm
(
pobj
);
return
result
;
}
}
module
.
exports
=
FormInfoCtl
;
gsb-marketplat/app/base/controller/impl/configmag/formitemCtl.js
View file @
eb150c5e
...
...
@@ -30,6 +30,15 @@ class FormItemCtl extends CtlBase {
return
result
;
}
/**
* 删除
* @param pobj
* @returns {Promise<*>}
*/
async
delete
(
pobj
){
let
result
=
this
.
service
.
deleteItem
(
pobj
);
return
result
;
}
}
module
.
exports
=
FormItemCtl
;
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
View file @
eb150c5e
...
...
@@ -6,6 +6,7 @@ class ForminfoService extends ServiceBase {
constructor
()
{
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
ForminfoService
));
this
.
formitemSve
=
system
.
getObject
(
"service.configmag.formitemSve"
);
this
.
templateSve
=
system
.
getObject
(
"service.template.templateinfoSve"
);
}
/**
...
...
@@ -25,6 +26,7 @@ class ForminfoService extends ServiceBase {
pobj
.
code
=
code
;
pobj
.
user_id
=
pobj
.
userid
;
pobj
.
user_name
=
pobj
.
username
;
pobj
.
form_items
=
'单行文本,手机号'
let
result
=
await
this
.
create
(
pobj
);
if
(
!
result
){
return
system
.
getResultFail
(
-
1
,
'创建表单失败'
);
...
...
@@ -66,6 +68,22 @@ class ForminfoService extends ServiceBase {
}
return
system
.
getResultSuccess
();
}
/**
* 表单删除
* @param pobj
* @returns {Promise<void>}
*/
async
deleteForm
(
pobj
){
let
template
=
await
this
.
templateSve
.
findOne
({
form_id
:
pobj
.
id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能删除'
)
}
let
del
=
await
this
.
delete
(
pobj
);
return
system
.
getResult
(
del
);
}
/**
* 修改方法
* @param pobj
...
...
@@ -76,6 +94,10 @@ class ForminfoService extends ServiceBase {
name
:
pobj
.
name
,
form_describe
:
pobj
.
form_describe
}
let
template
=
await
this
.
templateSve
.
findOne
({
form_id
:
pobj
.
id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能修改'
)
}
//获取相关表单项
let
itemData
=
await
this
.
formitemSve
.
findAll
({
form_id
:
pobj
.
id
},[]);
let
form_items
=
''
;
...
...
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
View file @
eb150c5e
...
...
@@ -5,6 +5,7 @@ const settings = require("../../../../config/settings");
class
FormitemService
extends
ServiceBase
{
constructor
()
{
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
FormitemService
));
this
.
templateSve
=
system
.
getObject
(
'service.template.templateinfoSve'
);
}
async
getFormItemListByFormId
(
pobj
){
...
...
@@ -31,6 +32,10 @@ class FormitemService extends ServiceBase {
if
(
!
pobj
.
sequence
){
return
system
.
getResultFail
(
-
1
,
'排序不能为空'
)
}
let
template
=
await
this
.
templateSve
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能新增表单项'
);
}
let
config_params
=
await
this
.
packageConfigParams
(
pobj
);
let
code
=
await
this
.
getBusUid
(
'it'
);
pobj
.
config_params
=
config_params
;
...
...
@@ -42,6 +47,24 @@ class FormitemService extends ServiceBase {
}
/**
*
* @param pobj
* @returns {Promise<void>}
*/
async
deleteItem
(
pobj
){
let
itemInfo
=
await
this
.
findOne
({
id
:
pobj
.
id
},[]);
if
([
'contact_mobile'
,
'contact_name'
].
includes
(
itemInfo
.
code
)){
return
system
.
getResultFail
(
-
1
,
'默认表单项,不能删除'
);
}
let
template
=
await
this
.
templateSve
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能删除表单项'
);
}
let
delRet
=
await
this
.
delete
(
pobj
);
return
system
.
getResult
(
delRet
);
}
/**
* 修改表表单项
* @param pobj
* @returns {Promise<void>}
...
...
@@ -51,8 +74,15 @@ class FormitemService extends ServiceBase {
if
(
!
pobj
.
name
){
return
system
.
getResultFail
(
-
1
,
'表单名称不能为空'
);
}
if
(
!
pobj
.
form_describe
){
return
system
.
getResultFail
(
-
1
,
'表单描述不能为空'
)
if
(
!
pobj
.
sequence
){
return
system
.
getResultFail
(
-
1
,
'表单排序不能为空'
)
}
if
([
'contact_mobile'
,
'contact_name'
].
includes
(
pobj
.
code
)){
return
system
.
getResultFail
(
-
1
,
'默认表单项,不能修改'
);
}
let
template
=
await
this
.
templateSve
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能修改表单项'
);
}
let
config_params
=
await
this
.
packageConfigParams
(
pobj
);
pobj
.
config_params
=
config_params
;
...
...
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