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
79298d8e
Commit
79298d8e
authored
Aug 17, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4fba17d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
20 deletions
+37
-20
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
+9
-9
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
+28
-11
No files found.
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
View file @
79298d8e
...
@@ -5,8 +5,8 @@ const settings = require("../../../../config/settings");
...
@@ -5,8 +5,8 @@ const settings = require("../../../../config/settings");
class
ForminfoService
extends
ServiceBase
{
class
ForminfoService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
ForminfoService
));
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
ForminfoService
));
this
.
formitem
Sve
=
system
.
getObject
(
"service.configmag.formitemSve
"
);
this
.
formitem
Dao
=
system
.
getObject
(
"db.configmag.formitemDao
"
);
this
.
template
Sve
=
system
.
getObject
(
"service.template.templateinfoSve
"
);
this
.
template
Dao
=
system
.
getObject
(
"db.template.templateinfoDao
"
);
}
}
/**
/**
...
@@ -46,7 +46,7 @@ class ForminfoService extends ServiceBase {
...
@@ -46,7 +46,7 @@ class ForminfoService extends ServiceBase {
is_required
:
1
,
is_required
:
1
,
sequence
:
2
sequence
:
2
}
}
let
itRt
=
await
this
.
formitem
Sve
.
create
(
phoneItem
);
let
itRt
=
await
this
.
formitem
Dao
.
create
(
phoneItem
);
if
(
!
itRt
){
if
(
!
itRt
){
return
system
.
getResultFail
(
-
1
,
'创建联系人表单项失败'
);
return
system
.
getResultFail
(
-
1
,
'创建联系人表单项失败'
);
}
}
...
@@ -62,7 +62,7 @@ class ForminfoService extends ServiceBase {
...
@@ -62,7 +62,7 @@ class ForminfoService extends ServiceBase {
is_required
:
1
,
is_required
:
1
,
sequence
:
1
sequence
:
1
}
}
let
itRt2
=
await
this
.
formitem
Sve
.
create
(
nameItem
);
let
itRt2
=
await
this
.
formitem
Dao
.
create
(
nameItem
);
this
.
updateForm
(
result
)
this
.
updateForm
(
result
)
if
(
!
itRt2
){
if
(
!
itRt2
){
return
system
.
getResultFail
(
-
1
,
'创建联系方式表单失败'
);
return
system
.
getResultFail
(
-
1
,
'创建联系方式表单失败'
);
...
@@ -76,7 +76,7 @@ class ForminfoService extends ServiceBase {
...
@@ -76,7 +76,7 @@ class ForminfoService extends ServiceBase {
* @returns {Promise<void>}
* @returns {Promise<void>}
*/
*/
async
deleteForm
(
pobj
){
async
deleteForm
(
pobj
){
let
template
=
await
this
.
template
Sve
.
findOne
({
form_id
:
pobj
.
id
},[]);
let
template
=
await
this
.
template
Dao
.
findOne
({
form_id
:
pobj
.
id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能删除'
)
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能删除'
)
}
}
...
@@ -95,12 +95,12 @@ class ForminfoService extends ServiceBase {
...
@@ -95,12 +95,12 @@ class ForminfoService extends ServiceBase {
name
:
pobj
.
name
,
name
:
pobj
.
name
,
form_describe
:
pobj
.
form_describe
form_describe
:
pobj
.
form_describe
}
}
let
template
=
await
this
.
template
Sve
.
findOne
({
form_id
:
pobj
.
id
},[]);
let
template
=
await
this
.
template
Dao
.
findOne
({
form_id
:
pobj
.
id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能修改'
)
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能修改'
)
}
}
//获取相关表单项
//获取相关表单项
let
itemData
=
await
this
.
formitem
Sve
.
findAll
({
form_id
:
pobj
.
id
},[]);
let
itemData
=
await
this
.
formitem
Dao
.
findAll
({
form_id
:
pobj
.
id
},[]);
let
form_items
=
''
;
let
form_items
=
''
;
if
(
itemData
.
length
>
0
){
if
(
itemData
.
length
>
0
){
itemData
.
forEach
(
v
=>
{
itemData
.
forEach
(
v
=>
{
...
@@ -122,7 +122,7 @@ class ForminfoService extends ServiceBase {
...
@@ -122,7 +122,7 @@ class ForminfoService extends ServiceBase {
* @returns {Promise<void>}
* @returns {Promise<void>}
*/
*/
async
copy
(
pobj
){
async
copy
(
pobj
){
let
items
=
await
this
.
formitem
Sve
.
findAll
({
form_id
:
pobj
.
id
},[]);
let
items
=
await
this
.
formitem
Dao
.
findAll
({
form_id
:
pobj
.
id
},[]);
delete
pobj
.
id
;
delete
pobj
.
id
;
delete
pobj
.
created_at
;
delete
pobj
.
created_at
;
let
code
=
await
this
.
getBusUid
(
'fm'
);
let
code
=
await
this
.
getBusUid
(
'fm'
);
...
@@ -135,7 +135,7 @@ class ForminfoService extends ServiceBase {
...
@@ -135,7 +135,7 @@ class ForminfoService extends ServiceBase {
let
iCode
=
await
this
.
getBusUid
(
'it'
);
let
iCode
=
await
this
.
getBusUid
(
'it'
);
item
.
code
=
iCode
;
item
.
code
=
iCode
;
item
.
form_id
=
saveRt
.
id
item
.
form_id
=
saveRt
.
id
this
.
formitem
Sve
.
create
(
item
.
dataValues
);
this
.
formitem
Dao
.
create
(
item
.
dataValues
);
})
})
return
system
.
getResult
(
saveRt
);
return
system
.
getResult
(
saveRt
);
}
}
...
...
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
View file @
79298d8e
...
@@ -5,7 +5,7 @@ const settings = require("../../../../config/settings");
...
@@ -5,7 +5,7 @@ const settings = require("../../../../config/settings");
class
FormitemService
extends
ServiceBase
{
class
FormitemService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
FormitemService
));
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
FormitemService
));
this
.
template
Sve
=
system
.
getObject
(
'service.template.templateinfoSve
'
);
this
.
template
Dao
=
system
.
getObject
(
'db.template.templateinfoDao
'
);
}
}
async
getFormItemListByFormId
(
pobj
){
async
getFormItemListByFormId
(
pobj
){
...
@@ -32,14 +32,16 @@ class FormitemService extends ServiceBase {
...
@@ -32,14 +32,16 @@ class FormitemService extends ServiceBase {
if
(
!
pobj
.
sequence
){
if
(
!
pobj
.
sequence
){
return
system
.
getResultFail
(
-
1
,
'排序不能为空'
)
return
system
.
getResultFail
(
-
1
,
'排序不能为空'
)
}
}
let
template
=
await
this
.
template
Sve
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
let
template
=
await
this
.
template
Dao
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能新增表单项'
);
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能新增表单项'
);
}
}
let
config_params
=
await
this
.
packageConfigParams
(
pobj
);
let
configRet
=
await
this
.
packageConfigParams
(
pobj
);
if
(
configRet
.
status
!==
0
){
return
configRet
;
}
let
code
=
await
this
.
getBusUid
(
'it'
);
let
code
=
await
this
.
getBusUid
(
'it'
);
pobj
.
config_params
=
config_params
;
pobj
.
config_params
=
configRet
.
data
;
pobj
.
item_type_name
=
pobj
.
item_type_name
;
pobj
.
code
=
code
;
pobj
.
code
=
code
;
//保存表单项
//保存表单项
let
result
=
await
this
.
create
(
pobj
);
let
result
=
await
this
.
create
(
pobj
);
...
@@ -56,7 +58,7 @@ class FormitemService extends ServiceBase {
...
@@ -56,7 +58,7 @@ class FormitemService extends ServiceBase {
if
([
'contact_mobile'
,
'contact_name'
].
includes
(
itemInfo
.
code
)){
if
([
'contact_mobile'
,
'contact_name'
].
includes
(
itemInfo
.
code
)){
return
system
.
getResultFail
(
-
1
,
'默认表单项,不能删除'
);
return
system
.
getResultFail
(
-
1
,
'默认表单项,不能删除'
);
}
}
let
template
=
await
this
.
template
Sve
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
let
template
=
await
this
.
template
Dao
.
findOne
({
form_id
:
itemInfo
.
form_id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能删除表单项'
);
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能删除表单项'
);
}
}
...
@@ -80,12 +82,15 @@ class FormitemService extends ServiceBase {
...
@@ -80,12 +82,15 @@ class FormitemService extends ServiceBase {
if
([
'contact_mobile'
,
'contact_name'
].
includes
(
pobj
.
code
)){
if
([
'contact_mobile'
,
'contact_name'
].
includes
(
pobj
.
code
)){
return
system
.
getResultFail
(
-
1
,
'默认表单项,不能修改'
);
return
system
.
getResultFail
(
-
1
,
'默认表单项,不能修改'
);
}
}
let
template
=
await
this
.
template
Sve
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
let
template
=
await
this
.
template
Dao
.
findOne
({
form_id
:
pobj
.
form_id
},[]);
if
(
template
&&
template
.
is_enabled
==
1
){
if
(
template
&&
template
.
is_enabled
==
1
){
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能修改表单项'
);
return
system
.
getResultFail
(
-
1
,
'表单已投入使用,不能修改表单项'
);
}
}
let
config_params
=
await
this
.
packageConfigParams
(
pobj
);
let
configRet
=
await
this
.
packageConfigParams
(
pobj
);
pobj
.
config_params
=
config_params
;
if
(
config_params
.
status
!==
0
){
return
configRet
;
}
pobj
.
config_params
=
configRet
.
data
;
let
upResult
=
await
this
.
update
(
pobj
);
let
upResult
=
await
this
.
update
(
pobj
);
return
system
.
getResult
(
upResult
);
return
system
.
getResult
(
upResult
);
}
}
...
@@ -99,28 +104,40 @@ class FormitemService extends ServiceBase {
...
@@ -99,28 +104,40 @@ class FormitemService extends ServiceBase {
let
config_params
=
{};
let
config_params
=
{};
switch
(
pobj
.
item_type
)
{
switch
(
pobj
.
item_type
)
{
case
"phone"
:
case
"phone"
:
if
(
!
pobj
.
mobile_input_length
){
return
system
.
getResultFail
(
-
1
,
'手机号位数选择有误'
);
}
config_params
[
"mobile_input_length"
]
=
pobj
.
mobile_input_length
==
"specific"
?
1
:
2
;
config_params
[
"mobile_input_length"
]
=
pobj
.
mobile_input_length
==
"specific"
?
1
:
2
;
config_params
[
"verify_sms"
]
=
pobj
.
verify_sms
==
true
?
1
:
0
;
config_params
[
"verify_sms"
]
=
pobj
.
verify_sms
==
true
?
1
:
0
;
break
;
break
;
case
"singleBtn"
:
case
"singleBtn"
:
case
"multipleBtn"
:
case
"multipleBtn"
:
case
"downOptions"
:
case
"downOptions"
:
if
(
!
pobj
.
options
){
return
system
.
getResultFail
(
-
1
,
'选项内容不能为空'
)
}
config_params
[
"options"
]
=
pobj
.
options
;
config_params
[
"options"
]
=
pobj
.
options
;
break
;
break
;
case
"singleText"
:
case
"singleText"
:
case
"multipleText"
:
case
"multipleText"
:
if
(
!
pobj
.
input_les
||
!
pobj
.
input_lar
){
return
system
.
getResultFail
(
-
1
,
'请填写字数限制'
);
}
if
(
pobj
.
input_lar
<
pobj
.
input_les
){
return
system
.
getResultFail
(
-
1
,
'字数范围有误'
);
}
let
length
=
[]
let
length
=
[]
length
.
push
(
pobj
.
input_les
);
length
.
push
(
pobj
.
input_les
);
length
.
push
(
pobj
.
input_lar
);
length
.
push
(
pobj
.
input_lar
);
config_params
[
"input_length"
]
=
length
;
config_params
[
"input_length"
]
=
length
;
break
;
break
;
case
"area"
:
case
"area"
:
config_params
[
"is_show_county"
]
=
pobj
.
is_show_county
;
config_params
[
"is_show_county"
]
=
pobj
.
is_show_county
==
true
?
1
:
0
;
break
;
break
;
default
:
default
:
break
;
break
;
}
}
return
config_params
;
return
system
.
getResult
(
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