Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
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
黄奎
mall.oytour.com
Commits
de76161c
Commit
de76161c
authored
Aug 30, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
into sdzq-ld
parents
f655cc0e
8c4220a9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
174 additions
and
5 deletions
+174
-5
RB_Custom_Form_Extend.cs
Mall.Model/Extend/TradePavilion/RB_Custom_Form_Extend.cs
+8
-0
RB_Tenant_Plug_Extend.cs
Mall.Model/Extend/User/RB_Tenant_Plug_Extend.cs
+4
-0
CustomFormModule.cs
Mall.Module.TradePavilion/CustomFormModule.cs
+121
-2
TenantPlugModule.cs
Mall.Module.User/TenantPlugModule.cs
+1
-1
RB_Tenant_PlugRepository.cs
Mall.Repository/User/RB_Tenant_PlugRepository.cs
+13
-0
CustomFormController.cs
Mall.WebApi/Controllers/MallBase/CustomFormController.cs
+23
-2
MContentController.cs
Mall.WebApi/Controllers/User/MContentController.cs
+4
-0
No files found.
Mall.Model/Extend/TradePavilion/RB_Custom_Form_Extend.cs
View file @
de76161c
...
...
@@ -2,6 +2,7 @@
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Common.Plugin
;
namespace
Mall.Model.Extend.TradePavilion
{
...
...
@@ -10,6 +11,8 @@ namespace Mall.Model.Extend.TradePavilion
/// </summary>
public
class
RB_Custom_Form_Extend
:
RB_Custom_Form
{
public
string
FormTypeStr
{
get
{
return
this
.
FormType
.
GetEnumName
();
}
}
/// <summary>
/// 表单内容
/// </summary>
...
...
@@ -26,6 +29,11 @@ namespace Mall.Model.Extend.TradePavilion
/// </summary>
public
string
CompKey
{
get
;
set
;
}
/// <summary>
/// 是否选中
/// </summary>
public
bool
isCked
{
get
;
set
;
}
/// <summary>
/// 组件对象
/// </summary>
...
...
Mall.Model/Extend/User/RB_Tenant_Plug_Extend.cs
View file @
de76161c
...
...
@@ -10,5 +10,9 @@ namespace Mall.Model.Extend.User
/// </summary>
public
class
RB_Tenant_Plug_Extend
:
RB_Tenant_Plug
{
/// <summary>
/// 插件类型
/// </summary>
public
string
QPlugTypeStr
{
get
;
set
;
}
}
}
Mall.Module.TradePavilion/CustomFormModule.cs
View file @
de76161c
...
...
@@ -6,6 +6,8 @@ using System.Text;
using
VT.FW.AOP.CustomerAttribute
;
using
Mall.Common.Enum
;
using
VT.FW.DB
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common.Plugin
;
namespace
Mall.Module.TradePavilion
{
...
...
@@ -42,6 +44,27 @@ namespace Mall.Module.TradePavilion
return
custom_FormRepository
.
GetCustomFormListRepository
(
query
);
}
/// <summary>
/// 检查表单是否存在
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
CheckExistsCustomFormModule
(
RB_Custom_Form_Extend
model
)
{
IList
<
WhereHelper
>
list
=
new
List
<
WhereHelper
>
{
new
WhereHelper
(
nameof
(
RB_Custom_Form_Extend
.
FormType
),
model
.
FormType
),
new
WhereHelper
(
nameof
(
RB_Custom_Form_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
),
new
WhereHelper
(
nameof
(
RB_Custom_Form_Extend
.
TenantId
),
model
.
TenantId
)
};
if
(
model
.
Id
>
0
)
{
list
.
Add
(
new
WhereHelper
(
nameof
(
RB_Custom_Form_Extend
.
Id
),
model
.
Id
,
OperatorEnum
.
NotEqual
));
}
return
custom_FormRepository
.
Exists
(
list
);
}
/// <summary>
/// 新增修改自定义表单
/// </summary>
...
...
@@ -61,7 +84,7 @@ namespace Mall.Module.TradePavilion
{
nameof
(
RB_Custom_Form_Extend
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Custom_Form_Extend
.
UpdateDate
),
model
.
UpdateDate
},
};
custom_FormRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Custom_Form_Extend
.
Id
),
model
.
Id
));
flag
=
custom_FormRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Custom_Form_Extend
.
Id
),
model
.
Id
));
}
else
{
...
...
@@ -80,10 +103,106 @@ namespace Mall.Module.TradePavilion
public
RB_Custom_Form_Extend
GetCustomFormModule
(
object
Id
)
{
var
extModel
=
custom_FormRepository
.
GetEntity
<
RB_Custom_Form_Extend
>(
Id
);
if
(
extModel
!=
null
)
{
extModel
.
FormDataList
=
AnalyzeFormComponent
(
extModel
.
FormData
);
}
return
extModel
;
}
/// <summary>
/// 解析表单组件
/// </summary>
/// <param name="formData"></param>
/// <returns></returns>
public
List
<
FormDataItem
>
AnalyzeFormComponent
(
string
formData
)
{
List
<
FormDataItem
>
dataList
=
new
List
<
FormDataItem
>();
if
(!
string
.
IsNullOrEmpty
(
formData
))
{
JArray
jArray
=
JArray
.
Parse
(
formData
);
if
(
jArray
!=
null
&&
jArray
.
Count
>
0
)
{
foreach
(
var
jItem
in
jArray
)
{
JObject
jObj
=
JObject
.
Parse
(
jItem
.
ToString
());
FormDataItem
dataItem
=
new
FormDataItem
()
{
CompKey
=
jObj
.
GetStringValue
(
"CompKey"
),
CompData
=
new
object
(),
isCked
=
false
,
};
if
(!
string
.
IsNullOrEmpty
(
dataItem
.
CompKey
))
{
switch
(
dataItem
.
CompKey
)
{
//单行文本
case
"SingleLineText"
:
JObject
singleObj
=
JObject
.
Parse
(
jObj
.
GetStringValue
(
"CompData"
));
TextItem
txtItem
=
new
TextItem
()
{
Name
=
singleObj
.
GetStringValue
(
"Name"
),
WordsLength
=
singleObj
.
GetInt
(
"WordsLength"
),
IsRequire
=
singleObj
.
GetBoolValue
(
"IsRequire"
),
};
dataItem
.
CompData
=
txtItem
;
break
;
//多行文本
case
"MultiLineText"
:
JObject
multiObj
=
JObject
.
Parse
(
jObj
.
GetStringValue
(
"CompData"
));
TextItem
multiItem
=
new
TextItem
()
{
Name
=
multiObj
.
GetStringValue
(
"Name"
),
WordsLength
=
multiObj
.
GetInt
(
"WordsLength"
),
IsRequire
=
multiObj
.
GetBoolValue
(
"IsRequire"
),
};
dataItem
.
CompData
=
multiItem
;
break
;
//下拉框
case
"DorpDownList"
:
JObject
dropdownObj
=
JObject
.
Parse
(
jObj
.
GetStringValue
(
"CompData"
));
SelectItem
selectItem
=
new
SelectItem
()
{
Name
=
dropdownObj
.
GetStringValue
(
"Name"
),
IsMultiple
=
dropdownObj
.
GetBoolValue
(
"IsMultiple"
),
IsRequire
=
dropdownObj
.
GetBoolValue
(
"IsRequire"
),
OptionValue
=
""
,
};
dataItem
.
CompData
=
selectItem
;
break
;
//图片上传组件
case
"ImageUploadComp"
:
JObject
imgObj
=
JObject
.
Parse
(
jObj
.
GetStringValue
(
"CompData"
));
UploadItem
imgItem
=
new
UploadItem
()
{
Name
=
imgObj
.
GetStringValue
(
"Name"
),
FileCount
=
imgObj
.
GetInt
(
"FileCount"
),
FileSizeLimit
=
imgObj
.
GetInt
(
"FileSizeLimit"
),
};
dataItem
.
CompData
=
imgItem
;
break
;
//视频上传组件
case
"VideoUploadComp"
:
JObject
videoObj
=
JObject
.
Parse
(
jObj
.
GetStringValue
(
"CompData"
));
UploadItem
videoItem
=
new
UploadItem
()
{
Name
=
videoObj
.
GetStringValue
(
"Name"
),
FileCount
=
videoObj
.
GetInt
(
"FileCount"
),
FileSizeLimit
=
videoObj
.
GetInt
(
"FileSizeLimit"
),
};
dataItem
.
CompData
=
videoItem
;
break
;
}
dataList
.
Add
(
dataItem
);
}
}
}
}
return
dataList
;
}
/// <summary>
/// 根据编号删除自定义表单
/// </summary>
...
...
Mall.Module.User/TenantPlugModule.cs
View file @
de76161c
...
...
@@ -39,7 +39,7 @@ namespace Mall.Module.User
bool
flag
=
false
;
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
tenant_PlugRepository
.
Delete
One
(
new
WhereHelper
(
nameof
(
RB_Tenant_Menu_Extend
.
TenantId
),
list
[
0
].
TenantId
)
);
tenant_PlugRepository
.
Delete
TenantPlugRepository
(
list
[
0
].
TenantId
,
list
[
0
].
QPlugTypeStr
);
foreach
(
var
item
in
list
)
{
flag
=
tenant_PlugRepository
.
Insert
(
item
)
>
0
;
...
...
Mall.Repository/User/RB_Tenant_PlugRepository.cs
View file @
de76161c
...
...
@@ -49,5 +49,18 @@ WHERE 1=1
}
return
Get
<
RB_Tenant_Plug_Extend
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// 根据类型和商户号删除插件
/// </summary>
/// <param name="TenantId"></param>
/// <param name="QPlugTypeStr"></param>
/// <returns></returns>
public
bool
DeleteTenantPlugRepository
(
int
TenantId
,
string
QPlugTypeStr
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
" DELETE FROM RB_Tenant_Plug WHERE TenantId={0} AND PlugId IN (SELECT PlugId FROM rb_plugin WHERE PlugType IN({1})) "
,
TenantId
,
QPlugTypeStr
);
return
base
.
Execute
(
builder
.
ToString
())
>
0
;
}
}
}
Mall.WebApi/Controllers/MallBase/CustomFormController.cs
View file @
de76161c
...
...
@@ -43,7 +43,15 @@ namespace Mall.WebApi.Controllers.MallBase
query
.
TenantId
=
RequestParm
.
TenantId
;
var
list
=
customFormModule
.
GetCustomFormPageModule
(
pageModel
.
pageIndex
,
pageModel
.
pageSize
,
out
long
rowsCount
,
query
);
pageModel
.
count
=
Convert
.
ToInt32
(
rowsCount
);
pageModel
.
pageData
=
list
;
pageModel
.
pageData
=
list
.
Select
(
qitem
=>
new
{
qitem
.
Id
,
qitem
.
FormType
,
qitem
.
FormTypeStr
,
qitem
.
FormName
,
qitem
.
FormDataList
,
CreateDate
=
Common
.
ConvertHelper
.
FormatTime
(
qitem
.
CreateDate
),
});
return
ApiResult
.
Success
(
data
:
pageModel
);
}
...
...
@@ -81,6 +89,15 @@ namespace Mall.WebApi.Controllers.MallBase
FormType
=
(
Common
.
Enum
.
TradePavilion
.
CustomFormTypeEnum
)
parms
.
GetInt
(
"FormType"
)
};
var
formData
=
parms
.
GetStringValue
(
"FormData"
);
List
<
FormDataItem
>
dataList
=
customFormModule
.
AnalyzeFormComponent
(
formData
);
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
model
.
FormData
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
dataList
);
}
else
{
model
.
FormData
=
""
;
}
model
.
MallBaseId
=
RequestParm
.
MallBaseId
;
model
.
TenantId
=
RequestParm
.
TenantId
;
model
.
CreateBy
=
base
.
UserInfo
.
TenantId
;
...
...
@@ -88,8 +105,12 @@ namespace Mall.WebApi.Controllers.MallBase
model
.
CreateDate
=
DateTime
.
Now
;
model
.
UpdateDate
=
DateTime
.
Now
;
model
.
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
;
if
(
customFormModule
.
CheckExistsCustomFormModule
(
model
))
{
return
ApiResult
.
Failed
(
message
:
"已存在此类型的表单!"
);
};
var
flag
=
customFormModule
.
SetCustomFormModule
(
model
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
(
data
:
model
)
:
ApiResult
.
Failed
();
}
/// <summary>
...
...
Mall.WebApi/Controllers/User/MContentController.cs
View file @
de76161c
...
...
@@ -718,6 +718,10 @@ namespace Mall.WebApi.Controllers.User
{
PlugTypeName
=
"其他组件"
;
}
else
if
(
item
.
Key
==
4
)
{
PlugTypeName
=
"表单组件"
;
}
result
.
Add
(
new
{
Id
=
""
,
...
...
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