Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hsWebHttpClient
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
何虹
hsWebHttpClient
Commits
55d273e9
Commit
55d273e9
authored
Dec 06, 2021
by
何虹
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CONFIG_TOOL_API
parent
da044ec3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
163 additions
and
60 deletions
+163
-60
hsWebHttpClient.js
dist/hsWebHttpClient.js
+10
-0
hsWebHttpClient.min.js
dist/hsWebHttpClient.min.js
+1
-1
commonModule.js
src/packages/common/commonModule.js
+2
-0
commonProxy.js
src/packages/common/commonProxy.js
+6
-5
webChartConfig.js
src/packages/modules/webChartConfig.js
+144
-54
No files found.
dist/hsWebHttpClient.js
View file @
55d273e9
...
@@ -22146,6 +22146,16 @@ class RestFul {
...
@@ -22146,6 +22146,16 @@ class RestFul {
}
}
return
this
.
requestClient
.
delete
(
url_
,
bodyData
,
parms
)
return
this
.
requestClient
.
delete
(
url_
,
bodyData
,
parms
)
}
}
// 兼容新版java的ref查询
get
(
data
){
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
parms
,
group
}
=
data
let
url_
=
`
${
this
.
MODULE_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
url_
=
`
${
url_
}${
group
}
/`
}
return
this
.
requestClient
.
get
(
url_
,
parms
)
}
}
}
/* harmony default export */
__webpack_exports__
[
"default"
]
=
(
RestFul
);
/* harmony default export */
__webpack_exports__
[
"default"
]
=
(
RestFul
);
...
...
dist/hsWebHttpClient.min.js
View file @
55d273e9
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/packages/common/commonModule.js
View file @
55d273e9
...
@@ -15,3 +15,5 @@ export const UN_CLOSE_BILLS = `${COMMON_UTIL_PROXY}/un_close_bills/`
...
@@ -15,3 +15,5 @@ export const UN_CLOSE_BILLS = `${COMMON_UTIL_PROXY}/un_close_bills/`
export
const
SEND_BILLS
=
`
${
COMMON_UTIL_PROXY
}
/send_bills/`
export
const
SEND_BILLS
=
`
${
COMMON_UTIL_PROXY
}
/send_bills/`
export
const
UN_SEND_BILLS
=
`
${
COMMON_UTIL_PROXY
}
/un_send_bills/`
export
const
UN_SEND_BILLS
=
`
${
COMMON_UTIL_PROXY
}
/un_send_bills/`
export
const
REJECT_BILLS
=
`
${
COMMON_UTIL_PROXY
}
/reject_bills/`
export
const
REJECT_BILLS
=
`
${
COMMON_UTIL_PROXY
}
/reject_bills/`
export
const
CONFIG_TOOL_API
=
`
${
COMMON_UTIL_PROXY
}
/`
src/packages/common/commonProxy.js
View file @
55d273e9
export
const
OAUTH_PROXY
=
'OAUTH_PROXY'
// `http://${api}/HSRight/api/`
export
const
OAUTH_PROXY
=
'OAUTH_PROXY'
// `http://${api}/HSRight/api/`
export
const
TOOL_PROXY
=
'TOOL_PROXY'
// `http://${api}/Tool/api/`
export
const
TOOL_PROXY
=
'TOOL_PROXY'
// `http://${api}/Tool/api/`
export
const
HSRIGHT_TOOL_PROXY
=
'HSRIGHT_TOOL_PROXY'
// `http://${api}/HSRightTool/api/`
export
const
HSRIGHT_TOOL_PROXY
=
'HSRIGHT_TOOL_PROXY'
// `http://${api}/HSRightTool/api/`
export
const
COMMON_UTIL_PROXY
=
'COMMON_UTIL_PROXY'
// `http://${api}/CommonUtil/api/`
export
const
COMMON_UTIL_PROXY
=
'COMMON_UTIL_PROXY'
// `http://${api}/CommonUtil/api/`
export
const
COMMON_PROXY
=
'COMMON_PROXY'
// `http://${api}/`
export
const
COMMON_PROXY
=
'COMMON_PROXY'
// `http://${api}/`
export
const
GQL_PROXY
=
'GQL_PROXY'
// `http://${api}/GQL/api/`
export
const
GQL_PROXY
=
'GQL_PROXY'
// `http://${api}/GQL/api/`
export
const
FILE_RESOURCE_PROXY
=
'FILE_RESOURCE_PROXY'
// `http://${api}/fileresource/api/`
export
const
FILE_RESOURCE_PROXY
=
'FILE_RESOURCE_PROXY'
// `http://${api}/fileresource/api/`
export
const
SERVICE_PROXY
=
'SERVICE_PROXY'
// `SERVICE_PROXY`
export
const
SERVICE_PROXY
=
'SERVICE_PROXY'
// `SERVICE_PROXY`
export
const
SERVICE_PROXY
=
'CONFIG_TOOL_PROXY'
// `新模式toolconfig`
src/packages/modules/webChartConfig.js
View file @
55d273e9
import
{
import
{
WEB_QUERY
,
WEB_QUERY_QUERY
,
WEB_QUERY_QUERY_VALUE
,
WEB_QUERY_PAGE
}
from
'../common/commonModule'
WEB_QUERY
,
WEB_QUERY_QUERY
,
WEB_QUERY_QUERY_VALUE
,
WEB_QUERY_PAGE
,
CONFIG_TOOL_API
}
from
'../common/commonModule'
import
hsUtil
from
'hs-util-js'
import
hsUtil
from
'hs-util-js'
const
urlParam
=
hsUtil
.
SystemModule
.
getUrlParams
()
const
urlParam
=
hsUtil
.
SystemModule
.
getUrlParams
()
const
config_db_name
=
hsUtil
.
SystemModule
.
getURLParameters
().
config_db_name
class
Control
{
class
Control
{
constructor
(
requestClient
)
{
constructor
(
requestClient
)
{
console
.
log
(
'WebChartConfigModule'
)
this
.
requestClient
=
requestClient
this
.
requestClient
=
requestClient
this
.
moduleName
=
'WebChartConfigModule'
this
.
moduleName
=
'WebChartConfigModule'
}
}
...
@@ -31,57 +38,88 @@ class Control {
...
@@ -31,57 +38,88 @@ class Control {
}
}
// 保存控件配置
// 保存控件配置
/**
/**
* sAppCode:页面appCode
* sAppCode:页面appCode
* sPage:页面名称
* sPage:页面名称
* sControl:控件名称
* sControl:控件名称
* sControlType: 类型
* sControlType: 类型
* sQuerySql: sql语句
* sQuerySql: sql语句
* bMockData: 是否是模拟数据
* bMockData: 是否是模拟数据
* iUserId:用户id
* iUserId:用户id
* db_name: 数据库名
* db_name: 数据库名
* db_code:数据库code
* db_code:数据库code
* sConfig:控件配置
* sConfig:控件配置
* sData: 数据
* sData: 数据
* @param {*} data
* @param {*} data
*/
*/
webChartConfigSave
(
param
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
webChartConfigSave
(
param
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
this
.
packParamHandle
(
param
)
this
.
packParamHandle
(
param
)
const
{
appCode
,
pageName
,
controlName
,
controlType
,
querySql
,
mockData
,
userId
,
dbName
,
dbCode
,
config
,
data
,
configType
}
=
param
const
{
appCode
,
pageName
,
controlName
,
controlType
,
querySql
,
mockData
,
userId
,
dbName
,
dbCode
,
config
,
data
,
configType
}
=
param
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_Save @sAppCode='
${
appCode
}
',@sPage='
${
pageName
}
',@sControl='
${
controlName
}
',@sControlType='
${
controlType
||
''
}
',@sConfig=:sConfig,@sData=:sData,@sQuerySql='
${
querySql
||
''
}
',@bMockData='
${
mockData
||
''
}
',@iUserId='
${
userId
}
',@iConfigType='
${
configType
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_Save @sAppCode='
${
appCode
}
',@sPage='
${
pageName
}
',@sControl='
${
controlName
}
',@sControlType='
${
controlType
||
db_name
:
dbName
||
this
.
requestClient
.
getDbName
(),
''
}
',@sConfig=:sConfig,@sData=:sData,@sQuerySql='
${
querySql
||
''
}
',@bMockData='
${
mockData
||
''
}
',@iUserId='
${
userId
}
',@iConfigType='
${
configType
}
'`
,
db_name
:
this
.
getRealDbName
(),
db_code
:
dbCode
,
db_code
:
dbCode
,
param
:
{
param
:
{
sConfig
:
JSON
.
stringify
(
config
),
sConfig
:
JSON
.
stringify
(
config
),
sData
:
JSON
.
stringify
(
data
)
sData
:
JSON
.
stringify
(
data
)
}
}
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY
,
postData
)
}
}
// 查询配置
// 查询配置
/**
/**
* sAppCode:页面appCode
* sAppCode:页面appCode
* sPage:页面名称
* sPage:页面名称
* sControl:控件名称
* sControl:控件名称
* sControlType: 类型
* sControlType: 类型
* sQuerySql: sql语句
* sQuerySql: sql语句
* bMockData: 是否是模拟数据
* bMockData: 是否是模拟数据
* iUserId:用户id
* iUserId:用户id
* db_name: 数据库名
* db_name: 数据库名
* db_code:数据库code
* db_code:数据库code
* sConfig:控件配置
* sConfig:控件配置
* sData: 数据
* sData: 数据
* @param {*} data
* @param {*} data
*/
*/
webChartConfigQuery
(
data
)
{
webChartConfigQuery
(
data
)
{
this
.
packParamHandle
(
data
)
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
controlName
,
userId
,
dbName
,
dbCode
,
configType
}
=
data
const
{
appCode
,
pageName
,
controlName
,
userId
,
dbName
,
dbCode
,
configType
}
=
data
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_Query @sAppCode='
${
appCode
}
',@sPage='
${
pageName
}
',@sControl='
${
controlName
}
',@iUserId='
${
userId
}
',@iConfigType='
${
configType
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_Query @sAppCode='
${
appCode
}
',@sPage='
${
pageName
}
',@sControl='
${
controlName
}
',@iUserId='
${
userId
}
',@iConfigType='
${
configType
}
'`
,
db_name
:
dbName
||
this
.
requestClient
.
get
DbName
(),
db_name
:
this
.
getReal
DbName
(),
db_code
:
dbCode
db_code
:
dbCode
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY_QUERY
,
postData
)
}
}
// 获取将要另存到本地的配置
// 获取将要另存到本地的配置
webChartConfigSaveAs
(
data
=
{})
{
webChartConfigSaveAs
(
data
=
{})
{
...
@@ -89,10 +127,13 @@ class Control {
...
@@ -89,10 +127,13 @@ class Control {
const
{
appCode
,
pageName
,
dbName
,
dbCode
}
=
data
const
{
appCode
,
pageName
,
dbName
,
dbCode
}
=
data
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_SaveAs @sAppCode='
${
appCode
}
',@sPage='
${
pageName
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_SaveAs @sAppCode='
${
appCode
}
',@sPage='
${
pageName
}
'`
,
db_name
:
dbName
||
this
.
requestClient
.
get
DbName
(),
db_name
:
this
.
getReal
DbName
(),
db_code
:
dbCode
db_code
:
dbCode
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY_VALUE
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY_QUERY_VALUE
,
postData
)
}
}
// 另存配置
// 另存配置
async
saveAsDataToLocal
(
data
=
{})
{
async
saveAsDataToLocal
(
data
=
{})
{
...
@@ -100,12 +141,18 @@ class Control {
...
@@ -100,12 +141,18 @@ class Control {
const
{
appCode
,
pageName
}
=
data
const
{
appCode
,
pageName
}
=
data
const
res
=
await
this
.
webChartConfigSaveAs
(
data
)
const
res
=
await
this
.
webChartConfigSaveAs
(
data
)
if
(
!
res
)
return
if
(
!
res
)
return
this
.
download
(
`spappWebChartConfig_Upgrade_
${
appCode
}
_
${
pageName
}
.sql`
,
res
.
data
)
this
.
download
(
`spappWebChartConfig_Upgrade_
${
appCode
}
_
${
pageName
}
.sql`
,
res
.
data
)
}
}
download
(
name
,
data
)
{
download
(
name
,
data
)
{
var
urlObject
=
window
.
URL
||
window
.
webkitURL
||
window
var
urlObject
=
window
.
URL
||
window
.
webkitURL
||
window
var
downloadData
=
new
Blob
([
data
])
var
downloadData
=
new
Blob
([
data
])
var
save_link
=
document
.
createElementNS
(
'http://www.w3.org/1999/xhtml'
,
'a'
)
var
save_link
=
document
.
createElementNS
(
'http://www.w3.org/1999/xhtml'
,
'a'
)
save_link
.
href
=
urlObject
.
createObjectURL
(
downloadData
)
save_link
.
href
=
urlObject
.
createObjectURL
(
downloadData
)
save_link
.
download
=
name
save_link
.
download
=
name
this
.
fake_click
(
save_link
)
this
.
fake_click
(
save_link
)
...
@@ -113,48 +160,81 @@ class Control {
...
@@ -113,48 +160,81 @@ class Control {
fake_click
(
obj
)
{
fake_click
(
obj
)
{
var
ev
=
document
.
createEvent
(
'MouseEvents'
)
var
ev
=
document
.
createEvent
(
'MouseEvents'
)
ev
.
initMouseEvent
(
ev
.
initMouseEvent
(
'click'
,
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
'click'
,
,
false
,
false
,
false
,
false
,
0
,
null
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
,
false
,
false
,
false
,
false
,
0
,
null
)
)
obj
.
dispatchEvent
(
ev
)
obj
.
dispatchEvent
(
ev
)
}
}
// 直接执行sql语句
// 直接执行sql语句
execSql
(
data
)
{
execSql
(
data
)
{
this
.
packParamHandle
(
data
=
{}
)
this
.
packParamHandle
(
(
data
=
{})
)
const
{
execSql
,
dbName
,
dbCode
}
=
data
const
{
execSql
,
dbName
,
dbCode
}
=
data
const
postData
=
{
const
postData
=
{
exec_sql
:
execSql
,
exec_sql
:
execSql
,
db_name
:
dbName
||
this
.
requestClient
.
get
DbName
(),
db_name
:
this
.
getReal
DbName
(),
db_code
:
dbCode
db_code
:
dbCode
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY_QUERY
,
postData
)
}
}
webChartConfigQueryLog
(
data
=
{})
{
webChartConfigQueryLog
(
data
=
{})
{
this
.
packParamHandle
(
data
)
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
controlName
,
dbName
,
dbCode
}
=
data
const
{
appCode
,
pageName
,
controlName
,
dbName
,
dbCode
}
=
data
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_QueryLog @sAppCode='
${
appCode
}
',@sPageName='
${
pageName
}
',@sControlName='
${
controlName
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_QueryLog @sAppCode='
${
appCode
}
',@sPageName='
${
pageName
}
',@sControlName='
${
controlName
}
'`
,
db_name
:
dbName
||
this
.
requestClient
.
get
DbName
(),
db_name
:
this
.
getReal
DbName
(),
db_code
:
dbCode
db_code
:
dbCode
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY_QUERY
,
postData
)
}
}
webChartConfigRevert
(
data
=
{})
{
webChartConfigRevert
(
data
=
{})
{
this
.
packParamHandle
(
data
)
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
db
Name
,
db
Code
,
controlName
,
version
}
=
data
const
{
appCode
,
pageName
,
dbCode
,
controlName
,
version
}
=
data
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_Revert @sAppCode='
${
appCode
}
',@sPageName='
${
pageName
}
',@sControlName='
${
controlName
}
',@iVersion='
${
version
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_Revert @sAppCode='
${
appCode
}
',@sPageName='
${
pageName
}
',@sControlName='
${
controlName
}
',@iVersion='
${
version
}
'`
,
db_name
:
dbName
||
this
.
requestClient
.
get
DbName
(),
db_name
:
this
.
getReal
DbName
(),
db_code
:
dbCode
db_code
:
dbCode
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY
,
postData
)
}
}
// 控件配置查询
// 控件配置查询
webControlQuery
(
data
=
{})
{
webControlQuery
(
data
=
{})
{
this
.
packParamHandle
(
data
)
this
.
packParamHandle
(
data
)
const
{
dbName
,
pageName
,
param
,
appCode
,
controlName
,
returnType
,
dbCode
,
userId
,
configType
}
=
data
const
{
dbName
,
pageName
,
param
,
appCode
,
controlName
,
returnType
,
dbCode
,
userId
,
configType
}
=
data
// 获取问号参数中的config_db_name
const
postData
=
{
const
postData
=
{
db_name
:
dbName
||
this
.
requestClient
.
get
DbName
(),
db_name
:
this
.
getReal
DbName
(),
app_code
:
appCode
,
app_code
:
appCode
,
page
:
pageName
,
page
:
pageName
,
param
:
JSON
.
stringify
(
param
||
{}),
param
:
JSON
.
stringify
(
param
||
{}),
...
@@ -164,7 +244,17 @@ class Control {
...
@@ -164,7 +244,17 @@ class Control {
user_id
:
userId
,
user_id
:
userId
,
config_type
:
configType
config_type
:
configType
}
}
return
this
.
requestClient
.
post
(
WEB_QUERY_PAGE
,
postData
)
return
this
.
requestClient
.
post
(
this
.
getConfigDbNameApiProxy
()
||
WEB_QUERY_PAGE
,
postData
)
}
getRealDbName
()
{
const
db_name
=
config_db_name
||
this
.
requestClient
.
getDbName
()
return
db_name
}
getConfigDbNameApiProxy
()
{
return
config_db_name
?
CONFIG_TOOL_API
:
''
}
}
}
}
export
default
Control
export
default
Control
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