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
e53a93a9
Commit
e53a93a9
authored
Aug 11, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3d281a9b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
117 additions
and
109 deletions
+117
-109
gsb-marketplat/app/base/controller/impl/configmag/forminfoCtl.js
+3
-14
gsb-marketplat/app/base/controller/impl/configmag/formitemCtl.js
+4
-6
gsb-marketplat/app/base/controller/impl/configmag/launchchannelCtl.js
+2
-13
gsb-marketplat/app/base/db/impl/configmag/forminfoDao.js
+6
-0
gsb-marketplat/app/base/db/impl/configmag/launchchannelDao.js
+5
-0
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
+59
-15
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
+38
-46
gsb-marketplat/app/base/service/impl/configmag/launchchannelSve.js
+0
-15
No files found.
gsb-marketplat/app/base/controller/impl/configmag/forminfoCtl.js
View file @
e53a93a9
...
...
@@ -5,18 +5,7 @@ var cacheBaseComp = null;
class
FormInfoCtl
extends
CtlBase
{
constructor
()
{
super
(
"formmag"
,
CtlBase
.
getServiceName
(
FormInfoCtl
));
this
.
forminfoSve
=
system
.
getObject
(
'service.configmag.forminfoSve'
);
}
/**
* 重写查询方法
* @param pobj
* @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
*/
async
findAndCountAll
(
pobj
)
{
let
result
=
await
this
.
forminfoSve
.
findByCompanyId
(
pobj
);
return
result
;
super
(
"configmag"
,
CtlBase
.
getServiceName
(
FormInfoCtl
));
}
/**
...
...
@@ -25,7 +14,7 @@ class FormInfoCtl extends CtlBase {
* @returns {Promise<void>}
*/
async
create
(
pobj
){
let
result
=
await
this
.
forminfoSv
e
.
createForm
(
pobj
);
let
result
=
await
this
.
servic
e
.
createForm
(
pobj
);
return
result
;
}
...
...
@@ -35,7 +24,7 @@ class FormInfoCtl extends CtlBase {
* @returns {Promise<void>}
*/
async
update
(
pobj
)
{
let
result
=
await
this
.
forminfoSv
e
.
updateForm
(
pobj
);
let
result
=
await
this
.
servic
e
.
updateForm
(
pobj
);
return
result
;
}
...
...
gsb-marketplat/app/base/controller/impl/configmag/formitemCtl.js
View file @
e53a93a9
...
...
@@ -6,7 +6,6 @@ var cacheBaseComp = null;
class
FormItemCtl
extends
CtlBase
{
constructor
()
{
super
(
"configmag"
,
CtlBase
.
getServiceName
(
FormItemCtl
));
this
.
formitemSve
=
system
.
getObject
(
"service.configmag.formitemSve"
);
}
/**
...
...
@@ -15,18 +14,17 @@ class FormItemCtl extends CtlBase {
* @returns {Promise<void>}
*/
async
create
(
pobj
){
let
result
=
this
.
formitemSv
e
.
createItem
(
pobj
);
let
result
=
this
.
servic
e
.
createItem
(
pobj
);
return
result
;
}
/**
* 重写
删除
* 重写
修改方法
* @param pobj
* @returns {Promise<void>}
*/
async
dele
te
(
pobj
){
let
result
=
this
.
formitemSve
.
dele
teItem
(
pobj
);
async
upda
te
(
pobj
){
let
result
=
this
.
service
.
upda
teItem
(
pobj
);
return
result
;
}
...
...
gsb-marketplat/app/base/controller/impl/configmag/launchchannelCtl.js
View file @
e53a93a9
...
...
@@ -5,8 +5,7 @@ var cacheBaseComp = null;
class
LaunchchannelCtl
extends
CtlBase
{
constructor
()
{
super
(
"launchchannelmag"
,
CtlBase
.
getServiceName
(
LaunchchannelCtl
));
this
.
launchchannelSve
=
system
.
getObject
(
'service.configmag.launchchannelSve'
);
super
(
"configmag"
,
CtlBase
.
getServiceName
(
LaunchchannelCtl
));
}
/**
...
...
@@ -15,20 +14,10 @@ class LaunchchannelCtl extends CtlBase {
* @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
*/
async
create
(
pobj
){
const
result
=
await
this
.
launchchannelSv
e
.
createChannel
(
pobj
);
const
result
=
await
this
.
servic
e
.
createChannel
(
pobj
);
return
result
;
}
/**
* 重写查询
* @param pobj
* @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
*/
async
findAndCountAll
(
pobj
){
pobj
.
search
.
company_id
=
pobj
.
company_id
;
const
result
=
await
this
.
launchchannelSve
.
findByCompanyId
(
pobj
);
return
result
;
}
}
module
.
exports
=
LaunchchannelCtl
;
gsb-marketplat/app/base/db/impl/configmag/forminfoDao.js
View file @
e53a93a9
...
...
@@ -4,5 +4,11 @@ class ForminfoDao extends Dao{
constructor
(){
super
(
Dao
.
getModelName
(
ForminfoDao
));
}
extraWhere
(
qobj
,
qw
,
qc
)
{
console
.
log
(
qobj
)
qw
[
"company_id"
]
=
Number
(
qobj
.
company_id
);
return
qw
}
}
module
.
exports
=
ForminfoDao
;
gsb-marketplat/app/base/db/impl/configmag/launchchannelDao.js
View file @
e53a93a9
...
...
@@ -4,5 +4,10 @@ class LaunchchannelDao extends Dao{
constructor
(){
super
(
Dao
.
getModelName
(
LaunchchannelDao
));
}
extraWhere
(
qobj
,
qw
,
qc
)
{
qw
[
"company_id"
]
=
qobj
.
company_id
;
return
qw
;
}
}
module
.
exports
=
LaunchchannelDao
;
gsb-marketplat/app/base/service/impl/configmag/forminfoSve.js
View file @
e53a93a9
...
...
@@ -5,19 +5,7 @@ const settings = require("../../../../config/settings");
class
ForminfoService
extends
ServiceBase
{
constructor
()
{
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
ForminfoService
));
}
/**
* 根据company_id 查询
* @param pobj
* @returns {Promise<void>}
*/
async
findByCompanyId
(
pobj
)
{
if
(
pobj
.
company_id
)
{
pobj
.
search
.
company_id
=
pobj
.
company_id
;
}
let
result
=
await
this
.
findAndCountAll
(
pobj
);
return
system
.
getResult
(
result
);
this
.
formitemSve
=
system
.
getObject
(
"service.configmag.formitemSve"
);
}
/**
...
...
@@ -26,13 +14,13 @@ class ForminfoService extends ServiceBase {
* @returns {Promise<void>}
*/
async
createForm
(
pobj
){
console
.
log
(
pobj
)
if
(
!
pobj
.
name
){
return
system
.
getResult
(
null
,
'name can not be empty'
);
}
if
(
!
pobj
.
form_describe
){
return
system
.
getResult
(
null
,
'form_describe can not be empty'
);
}
let
code
=
await
this
.
getBusUid
(
"fm"
)
pobj
.
code
=
code
;
pobj
.
user_id
=
pobj
.
userid
;
...
...
@@ -41,7 +29,7 @@ class ForminfoService extends ServiceBase {
return
system
.
getResult
(
result
);
}
/**
*
*
修改方法
* @param pobj
* @returns {Promise<void>}
*/
...
...
@@ -50,10 +38,66 @@ class ForminfoService extends ServiceBase {
name
:
pobj
.
name
,
form_describe
:
pobj
.
form_describe
}
//获取相关表单项
let
itemData
=
await
this
.
formitemSve
.
findAll
({
form_id
:
pobj
.
id
},[]);
let
form_items
=
''
;
if
(
itemData
.
length
>
0
){
itemData
.
forEach
(
v
=>
{
form_items
+=
v
.
item_type_name
+
","
;
})
form_items
=
form_items
.
substring
(
0
,
form_items
.
length
-
1
)
}
upData
.
form_items
=
form_items
;
//组装form表单
let
form
=
await
this
.
packageForm
(
itemData
);
let
result
=
await
this
.
updateByWhere
(
upData
,{
id
:
pobj
.
id
})
return
system
.
getResult
(
result
);
}
//组装form
async
packageForm
(
items
)
{
let
data
=
{
"phone"
:
"input"
,
"singleBtn"
:
"radiogroup"
,
"multipleBtn"
:
"checkgroup"
,
"downOptions"
:
"dic-select"
,
"singleText"
:
"textarea"
,
"multipleText"
:
"textarea"
,
"dateTime"
:
"datetime"
,
"area"
:
"省市"
}
let
form
=
{};
let
ctls
=
[];
if
(
items
.
length
>
0
){
items
.
forEach
(
item
=>
{
console
.
log
(
item
.
config_params
)
let
ctl
=
{
"type"
:
`
${
data
[
item
.
item_type_name
]}
`
,
"label"
:
"名称"
,
options
:
'ddd,,dd,,dd'
,
"prop"
:
"name"
,
rules
:
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]
}
ctl
[
'type'
]
=
data
[
item
.
item_type_name
];
ctl
[
'label'
]
=
item
.
name
;
ctl
[
'prop'
]
=
item
.
item_type
;
ctl
[
'rules'
]
=
ctls
.
push
();
})
form
=
{
name
:
"xxx"
,
main
:
[
{
"title"
:
"表单信息"
,
cols
:
1
,
ctls
:
[
{
"type"
:
"input"
,
"label"
:
"名称"
,
options
:
'ddd,,dd,,dd'
,
"prop"
:
"name"
,
"style"
:
"padding-left:6px"
,
rules
:
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]
},
{
"type"
:
"dic-select"
,
"label"
:
"类型"
,
options
:
""
,
"prop"
:
"item_type"
,
"placeHolder"
:
"选择类型"
,
dicName
:
"control_type"
,
"style"
:
"width:100%"
,
isMulti
:
false
,
rules
:
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]
},
{
"type"
:
"input"
,
"label"
:
"排序"
,
"prop"
:
"sequence"
,
"style"
:
"padding-left:6px"
,
rules
:
[{
"required"
:
true
,
"message"
:
' '
,
"trigger"
:
'blur'
},]
},
]
}
]
}
}
return
form
;
}
async
getFormList
(
pobj
)
{
let
res
=
await
this
.
dao
.
findAndCountAll
(
pobj
);
return
system
.
getResult
(
res
);
...
...
gsb-marketplat/app/base/service/impl/configmag/formitemSve.js
View file @
e53a93a9
...
...
@@ -5,7 +5,6 @@ const settings = require("../../../../config/settings");
class
FormitemService
extends
ServiceBase
{
constructor
()
{
super
(
"configmag"
,
ServiceBase
.
getDaoName
(
FormitemService
));
this
.
forminfoSve
=
system
.
getObject
(
"service.configmag.forminfoSve"
);
}
...
...
@@ -15,46 +14,17 @@ class FormitemService extends ServiceBase {
* @returns {Promise<void>}
*/
async
createItem
(
pobj
)
{
let
config_params
=
await
this
.
packageConfigParams
(
pobj
);
let
code
=
await
this
.
getBusUid
(
'it'
);
pobj
.
config_params
=
config_params
;
pobj
.
item_type_name
=
pobj
.
item_type_name
;
pobj
.
code
=
code
;
//获取表单的表单项
let
form
=
await
this
.
forminfoSve
.
findOne
({
id
:
pobj
.
form_id
},[
'form_items'
]);
if
(
!
form
){
return
system
.
getResult
(
null
,
'获取订单信息失败'
);
}
let
form_items
=
form
.
form_items
?
form
.
form_items
+
"、"
+
pobj
.
item_type_name
:
pobj
.
item_type_name
;
//修改表单项字段
this
.
forminfoSve
.
updateByWhere
({
form_items
:
form_items
},{
id
:
pobj
.
form_id
});
//保存表单项
let
result
=
await
this
.
create
(
pobj
);
return
system
.
getResult
(
result
)
}
/**
* 表单项删除
* @param pobj
* @returns {Promise<void>}
*/
async
deleteItem
(
pobj
){
let
item
=
await
this
.
findOne
({
id
:
pobj
.
id
},[
'form_id'
,
'item_type_name'
]);
if
(
!
item
){
return
system
.
getResult
(
null
,
'获取表单项失败'
);
}
let
form
=
await
this
.
forminfoSve
.
findOne
({
id
:
item
.
form_id
},[
'form_items'
]);
if
(
!
form
){
return
system
.
getResult
(
null
,
'获取表单失败'
);
}
let
form_items
=
''
;
if
(
form
.
form_items
){
form_items
=
form
.
form_items
.
replace
(
'、'
+
item
.
item_type_name
,
''
);
}
this
.
forminfoSve
.
updateByWhere
({
form_items
:
form_items
},{
id
:
item
.
form_id
});
let
result
=
await
this
.
delete
(
pobj
);
return
system
.
getResult
(
result
);
}
/**
* 修改表表单项
* @param pobj
* @returns {Promise<void>}
...
...
@@ -64,21 +34,44 @@ class FormitemService extends ServiceBase {
return
system
.
getResult
(
upResult
);
}
//根据类型获取类型名称
async
getTypeName
(
type
)
{
let
data
=
{
"phone"
:
"手机号"
,
"singleBtn"
:
"单选按钮"
,
"multipleBtn"
:
"多选按钮"
,
"downOptions"
:
"下拉选项"
,
"singleText"
:
"单行文本"
,
"multipleText"
:
"多行文本"
,
"dateTime"
:
"日期"
,
"area"
:
"省市"
/**
* 组装表单项参数
* @param pobj
* @returns {Promise<void>}
*/
async
packageConfigParams
(
pobj
){
let
config_params
=
{};
switch
(
pobj
.
item_type
)
{
case
"phone"
:
config_params
[
"mobile_input_length"
]
=
pobj
.
mobile_input_length
;
config_params
[
"verify_sms"
]
=
pobj
.
verify_sms
;
break
;
case
"singleBtn"
:
case
"multipleBtn"
:
case
"downOptions"
:
config_params
[
"options"
]
=
pobj
.
options
.
split
(
','
);
break
;
case
"singleText"
:
case
"multipleText"
:
let
length
=
[]
length
.
push
(
pobj
.
input_les
);
length
.
push
(
pobj
.
input_lar
);
config_params
[
"input_length"
]
=
length
;
break
;
case
"dateTime"
:
config_params
[
"date_type"
]
=
pobj
.
date_type
;
config_params
[
"date_accuracy"
]
=
pobj
.
date_type
;
config_params
[
"date_shield_type"
]
=
pobj
.
date_type
;
config_params
[
"shield_date"
]
=
pobj
.
dshield_date
.
split
(
','
);
break
;
case
"area"
:
config_params
[
"is_show_county"
]
=
pobj
.
is_show_county
;
break
;
default
:
break
;
}
return
data
[
type
]
;
return
config_params
;
}
}
module
.
exports
=
FormitemService
;
\ No newline at end of file
gsb-marketplat/app/base/service/impl/configmag/launchchannelSve.js
View file @
e53a93a9
...
...
@@ -40,20 +40,6 @@ class LaunchchannelService extends ServiceBase {
let
result
=
await
this
.
create
(
channelData
);
return
system
.
getResult
(
result
);
}
/**
* 根据company_id 查询
* @param pobj
* @returns {Promise<null|[]>}
*/
async
findByCompanyId
(
pobj
)
{
if
(
pobj
.
company_id
)
{
pobj
.
search
.
company_id
=
pobj
.
company_id
;
}
let
reuslt
=
await
this
.
findAndCountAll
(
pobj
);
return
system
.
getResult
(
reuslt
);
}
}
module
.
exports
=
LaunchchannelService
;
\ No newline at end of file
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