Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hs-sky-ui
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
何虹
hs-sky-ui
Commits
2abf3989
Commit
2abf3989
authored
Apr 30, 2020
by
何虹
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
f097fd4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
51 deletions
+52
-51
request.js
src/packages/funTools/request.js
+52
-51
No files found.
src/packages/funTools/request.js
View file @
2abf3989
...
@@ -5,7 +5,7 @@ import commonUtility from './commonUtility'
...
@@ -5,7 +5,7 @@ import commonUtility from './commonUtility'
import
_
from
'lodash'
import
_
from
'lodash'
import
hswebapp2frame
from
'hswebapp2frame'
import
hswebapp2frame
from
'hswebapp2frame'
let
fullLoading
let
fullLoading
function
showLoading
()
{
function
showLoading
()
{
fullLoading
=
Loading
.
service
({
fullLoading
=
Loading
.
service
({
lock
:
true
,
lock
:
true
,
text
:
'加载中...'
,
text
:
'加载中...'
,
...
@@ -16,17 +16,17 @@ function showLoading() {
...
@@ -16,17 +16,17 @@ function showLoading() {
fullLoading
.
close
()
fullLoading
.
close
()
},
10000
)
},
10000
)
}
}
function
closeLoading
()
{
function
closeLoading
()
{
fullLoading
&&
fullLoading
.
close
()
fullLoading
&&
fullLoading
.
close
()
}
}
let
loading_request_count
=
0
let
loading_request_count
=
0
function
show_full_screen_loading
()
{
function
show_full_screen_loading
()
{
if
(
loading_request_count
===
0
)
{
if
(
loading_request_count
===
0
)
{
showLoading
()
showLoading
()
}
}
loading_request_count
++
loading_request_count
++
}
}
function
hide_full_screen_loading
()
{
function
hide_full_screen_loading
()
{
if
(
loading_request_count
<=
0
)
return
if
(
loading_request_count
<=
0
)
return
loading_request_count
--
loading_request_count
--
if
(
loading_request_count
===
0
)
{
if
(
loading_request_count
===
0
)
{
...
@@ -35,7 +35,7 @@ function hide_full_screen_loading() {
...
@@ -35,7 +35,7 @@ function hide_full_screen_loading() {
}
}
// 增加一个response拦截器
// 增加一个response拦截器
axios
.
interceptors
.
response
.
use
(
axios
.
interceptors
.
response
.
use
(
function
(
response
)
{
function
(
response
)
{
hide_full_screen_loading
()
hide_full_screen_loading
()
if
(
response
.
data
)
{
if
(
response
.
data
)
{
const
{
error_detail
,
error_title
}
=
response
.
data
const
{
error_detail
,
error_title
}
=
response
.
data
...
@@ -58,7 +58,7 @@ axios.interceptors.response.use(
...
@@ -58,7 +58,7 @@ axios.interceptors.response.use(
return
response
return
response
}
}
},
},
function
(
error
)
{
function
(
error
)
{
hide_full_screen_loading
()
hide_full_screen_loading
()
if
(
self
===
top
)
{
if
(
self
===
top
)
{
dyncInnerErrorDel
(
error
)
dyncInnerErrorDel
(
error
)
...
@@ -68,7 +68,7 @@ axios.interceptors.response.use(
...
@@ -68,7 +68,7 @@ axios.interceptors.response.use(
return
Promise
.
reject
(
error
)
return
Promise
.
reject
(
error
)
}
}
)
)
function
dyncInnerErrorDel
(
error
)
{
function
dyncInnerErrorDel
(
error
)
{
if
(
error
.
message
===
'Network Error'
)
{
if
(
error
.
message
===
'Network Error'
)
{
Notification
.
error
({
Notification
.
error
({
title
:
'错误信息!'
,
title
:
'错误信息!'
,
...
@@ -104,7 +104,7 @@ function dyncInnerErrorDel(error) {
...
@@ -104,7 +104,7 @@ function dyncInnerErrorDel(error) {
})
})
}
}
}
}
function
response_error_del
(
error
)
{
function
response_error_del
(
error
)
{
const
{
response
,
code
}
=
error
const
{
response
,
code
}
=
error
const
{
status
,
statusText
,
data
}
=
response
||
{}
const
{
status
,
statusText
,
data
}
=
response
||
{}
let
error_title
=
'错误信息'
let
error_title
=
'错误信息'
...
@@ -134,8 +134,8 @@ function response_error_del(error) {
...
@@ -134,8 +134,8 @@ function response_error_del(error) {
// 这条判断是解决 下载文件返回流的情况 要把流转成json
// 这条判断是解决 下载文件返回流的情况 要把流转成json
const
reader
=
new
FileReader
()
const
reader
=
new
FileReader
()
reader
.
readAsText
(
data
)
reader
.
readAsText
(
data
)
const
dealFileReader
=
async
function
()
{
const
dealFileReader
=
async
function
()
{
const
result
=
await
new
Promise
(
function
(
resolve
,
reject
)
{
const
result
=
await
new
Promise
(
function
(
resolve
,
reject
)
{
reader
.
onload
=
e
=>
{
reader
.
onload
=
e
=>
{
resolve
(
JSON
.
parse
(
e
.
target
.
result
))
resolve
(
JSON
.
parse
(
e
.
target
.
result
))
}
}
...
@@ -198,7 +198,7 @@ const bill_close_bills = `${commonUtilAPI}close_bills/`
...
@@ -198,7 +198,7 @@ const bill_close_bills = `${commonUtilAPI}close_bills/`
const
bill_un_close_bills
=
`
${
commonUtilAPI
}
un_close_bills/`
const
bill_un_close_bills
=
`
${
commonUtilAPI
}
un_close_bills/`
const
bill_send_bills
=
`
${
commonUtilAPI
}
send_bills/`
const
bill_send_bills
=
`
${
commonUtilAPI
}
send_bills/`
const
bill_un_send_bills
=
`
${
commonUtilAPI
}
un_send_bills/`
const
bill_un_send_bills
=
`
${
commonUtilAPI
}
un_send_bills/`
function
getPageParms
()
{
function
getPageParms
()
{
const
{
db_name
,
is_mock
,
db_code
}
=
commonUtility
.
parseUrlQueryString
()
const
{
db_name
,
is_mock
,
db_code
}
=
commonUtility
.
parseUrlQueryString
()
const
{
appCode
,
pagename
}
=
commonUtility
.
parseUrlQueryBIDyncAppcodePageName
()
const
{
appCode
,
pagename
}
=
commonUtility
.
parseUrlQueryBIDyncAppcodePageName
()
const
isMock
=
emptyList
.
includes
(
is_mock
)
?
1
:
is_mock
const
isMock
=
emptyList
.
includes
(
is_mock
)
?
1
:
is_mock
...
@@ -213,9 +213,9 @@ function getPageParms() {
...
@@ -213,9 +213,9 @@ function getPageParms() {
return
obj
return
obj
}
}
const
API
=
{
const
API
=
{
runAsync
(
url
,
routerParms
=
{},
on_off
=
false
)
{
runAsync
(
url
,
routerParms
=
{},
on_off
=
false
)
{
let
str
=
''
let
str
=
''
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
!
on_off
)
{
if
(
!
on_off
)
{
const
{
page
,
isMock
,
dbName
,
db_code
}
=
getPageParms
()
const
{
page
,
isMock
,
dbName
,
db_code
}
=
getPageParms
()
const
sPag
=
routerParms
.
page
||
page
const
sPag
=
routerParms
.
page
||
page
...
@@ -265,7 +265,7 @@ const API = {
...
@@ -265,7 +265,7 @@ const API = {
})
})
return
p
return
p
},
},
getData
(
data
)
{
// routerParms: page路由 position位置 other参数
getData
(
data
)
{
// routerParms: page路由 position位置 other参数
const
{
appCode
,
page
,
isMock
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
isMock
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
isMock
:
is_mock
,
dbName
,
elInfo
:
elInfo_
,
other
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
isMock
:
is_mock
,
dbName
,
elInfo
:
elInfo_
,
other
}
=
data
const
db_name
=
dbName
||
db_Name
||
''
const
db_name
=
dbName
||
db_Name
||
''
...
@@ -274,7 +274,7 @@ const API = {
...
@@ -274,7 +274,7 @@ const API = {
const
sAppCode
=
sAppCode_
||
appCode
const
sAppCode
=
sAppCode_
||
appCode
const
sControl
=
sControl_
||
elInfo
.
position
const
sControl
=
sControl_
||
elInfo
.
position
const
isMock_
=
typeof
is_mock
!==
'undefined'
?
is_mock
:
(
isMock
||
1
)
const
isMock_
=
typeof
is_mock
!==
'undefined'
?
is_mock
:
(
isMock
||
1
)
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappCommonQuery_Data @sAppCode='
${
sAppCode
}
',@sPage='
${
sPage
}
',@sControl='
${
sControl
}
',@sParam='
${
other
?
JSON
.
stringify
(
other
)
:
'0x'
}
',@bMockData=
${
isMock_
}
`
,
exec_sql
:
`EXEC dbo.spappCommonQuery_Data @sAppCode='
${
sAppCode
}
',@sPage='
${
sPage
}
',@sControl='
${
sControl
}
',@sParam='
${
other
?
JSON
.
stringify
(
other
)
:
'0x'
}
',@bMockData=
${
isMock_
}
`
,
db_name
:
db_name
,
db_name
:
db_name
,
...
@@ -298,7 +298,7 @@ const API = {
...
@@ -298,7 +298,7 @@ const API = {
})
})
return
p
return
p
},
},
getConfig
(
data
)
{
getConfig
(
data
)
{
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
dbName
,
elInfo
:
elInfo_
,
other
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
dbName
,
elInfo
:
elInfo_
,
other
}
=
data
const
elInfo
=
elInfo_
||
{}
const
elInfo
=
elInfo_
||
{}
...
@@ -307,7 +307,7 @@ const API = {
...
@@ -307,7 +307,7 @@ const API = {
const
sAppCode
=
sAppCode_
||
appCode
const
sAppCode
=
sAppCode_
||
appCode
const
sControl
=
sControl_
||
elInfo
.
position
const
sControl
=
sControl_
||
elInfo
.
position
const
otherParm
=
other
?
JSON
.
stringify
(
other
)
:
'0x'
const
otherParm
=
other
?
JSON
.
stringify
(
other
)
:
'0x'
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappCommonQuery_Config @sAppCode='
${
sAppCode
}
',@sPage='
${
sPage
}
',@sControl='
${
sControl
}
',@sParam='
${
otherParm
}
'`
,
exec_sql
:
`EXEC dbo.spappCommonQuery_Config @sAppCode='
${
sAppCode
}
',@sPage='
${
sPage
}
',@sControl='
${
sControl
}
',@sParam='
${
otherParm
}
'`
,
db_name
:
db_name
,
db_name
:
db_name
,
...
@@ -321,11 +321,11 @@ const API = {
...
@@ -321,11 +321,11 @@ const API = {
})
})
return
p
return
p
},
},
runSave
(
data
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
runSave
(
data
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
sConfig
,
sData
,
sQuerySql
,
is_mock
,
dbName
,
elInfo
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
sConfig
,
sData
,
sQuerySql
,
is_mock
,
dbName
,
elInfo
}
=
data
const
control_type
=
(
elInfo
&&
elInfo
.
el
)
||
''
const
control_type
=
(
elInfo
&&
elInfo
.
el
)
||
''
const
{
appCode
,
page
,
isMock
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
isMock
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
const
db_name
=
dbName
||
(
elInfo
&&
elInfo
.
db_name
)
||
db_Name
||
''
const
db_name
=
dbName
||
(
elInfo
&&
elInfo
.
db_name
)
||
db_Name
||
''
const
sPage
=
sPage_
||
(
elInfo
&&
elInfo
.
page
)
||
page
||
''
const
sPage
=
sPage_
||
(
elInfo
&&
elInfo
.
page
)
||
page
||
''
const
sAppCode
=
sAppCode_
||
(
elInfo
&&
elInfo
.
sAppCode
)
||
appCode
const
sAppCode
=
sAppCode_
||
(
elInfo
&&
elInfo
.
sAppCode
)
||
appCode
...
@@ -366,12 +366,12 @@ const API = {
...
@@ -366,12 +366,12 @@ const API = {
})
})
return
p
return
p
},
},
getSql
(
data
)
{
getSql
(
data
)
{
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
dbName
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
sControl
:
sControl_
,
dbName
}
=
data
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
globalParams
=
commonUtility
.
parseGlobalParams
()
const
globalParams
=
commonUtility
.
parseGlobalParams
()
const
user_id
=
globalParams
.
user_id
||
1
const
user_id
=
globalParams
.
user_id
||
1
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
const
db_name
=
dbName
||
db_Name
||
''
const
db_name
=
dbName
||
db_Name
||
''
const
sAppCode
=
sAppCode_
||
appCode
const
sAppCode
=
sAppCode_
||
appCode
const
sPage
=
sPage_
||
page
||
''
const
sPage
=
sPage_
||
page
||
''
...
@@ -387,7 +387,7 @@ const API = {
...
@@ -387,7 +387,7 @@ const API = {
})
})
return
p
return
p
},
},
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'
)
...
@@ -395,7 +395,7 @@ const API = {
...
@@ -395,7 +395,7 @@ const API = {
save_link
.
download
=
name
save_link
.
download
=
name
this
.
fake_click
(
save_link
)
this
.
fake_click
(
save_link
)
},
},
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'
,
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
...
@@ -403,7 +403,7 @@ const API = {
...
@@ -403,7 +403,7 @@ const API = {
)
)
obj
.
dispatchEvent
(
ev
)
obj
.
dispatchEvent
(
ev
)
},
},
downSql
(
data
)
{
downSql
(
data
)
{
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
}
=
data
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
db_name
=
dbName
||
db_Name
||
''
const
db_name
=
dbName
||
db_Name
||
''
...
@@ -420,7 +420,7 @@ const API = {
...
@@ -420,7 +420,7 @@ const API = {
this
.
download
(
`spappWebChartConfig_Upgrade_
${
sAppCode
}
_
${
sPage
}
.sql`
,
r_d
)
this
.
download
(
`spappWebChartConfig_Upgrade_
${
sAppCode
}
_
${
sPage
}
.sql`
,
r_d
)
})
})
},
},
execSql
(
data
)
{
execSql
(
data
)
{
var
postData
=
{}
var
postData
=
{}
const
{
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
if
(
typeof
data
===
'object'
)
{
if
(
typeof
data
===
'object'
)
{
...
@@ -438,20 +438,20 @@ const API = {
...
@@ -438,20 +438,20 @@ const API = {
db_code
db_code
}
}
}
}
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
axios
.
post
(
module_url
,
postData
).
then
(
res
=>
{
axios
.
post
(
module_url
,
postData
).
then
(
res
=>
{
resolve
(
res
.
data
)
resolve
(
res
.
data
)
})
})
})
})
return
p
return
p
},
},
getPageLog
(
data
)
{
getPageLog
(
data
)
{
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
,
sControl
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
,
sControl
}
=
data
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
db_name
=
dbName
||
db_Name
||
''
const
db_name
=
dbName
||
db_Name
||
''
const
sAppCode
=
sAppCode_
||
appCode
const
sAppCode
=
sAppCode_
||
appCode
const
sPage
=
sPage_
||
page
||
''
const
sPage
=
sPage_
||
page
||
''
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_QueryLog @sAppCode='
${
sAppCode
}
',@sPageName='
${
sPage
}
',@sControlName='
${
sControl
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_QueryLog @sAppCode='
${
sAppCode
}
',@sPageName='
${
sPage
}
',@sControlName='
${
sControl
}
'`
,
db_name
:
db_name
,
db_name
:
db_name
,
...
@@ -471,7 +471,7 @@ const API = {
...
@@ -471,7 +471,7 @@ const API = {
})
})
return
p
return
p
},
},
revertPageLog
(
data
)
{
revertPageLog
(
data
)
{
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
,
sControl
,
version
:
version_
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
,
sControl
,
version
:
version_
}
=
data
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
db_name
=
dbName
||
db_Name
||
''
const
db_name
=
dbName
||
db_Name
||
''
...
@@ -479,7 +479,7 @@ const API = {
...
@@ -479,7 +479,7 @@ const API = {
const
sAppCode
=
sAppCode_
||
appCode
const
sAppCode
=
sAppCode_
||
appCode
const
sPage
=
sPage_
||
page
||
''
const
sPage
=
sPage_
||
page
||
''
const
version
=
version_
||
''
const
version
=
version_
||
''
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
const
postData
=
{
const
postData
=
{
exec_sql
:
`EXEC dbo.spappWebChartConfig_Revert @sAppCode='
${
sAppCode
}
',@sPageName='
${
sPage
}
',@sControlName='
${
sControl
}
',@iVersion='
${
version
}
'`
,
exec_sql
:
`EXEC dbo.spappWebChartConfig_Revert @sAppCode='
${
sAppCode
}
',@sPageName='
${
sPage
}
',@sControlName='
${
sControl
}
',@iVersion='
${
version
}
'`
,
db_name
:
db_name
,
db_name
:
db_name
,
...
@@ -491,13 +491,14 @@ const API = {
...
@@ -491,13 +491,14 @@ const API = {
})
})
return
p
return
p
},
},
getPageInfo
(
data
)
{
getPageInfo
(
data
)
{
const
queryString
=
commonUtility
.
parseUrlQueryString
()
const
queryString
=
commonUtility
.
parseUrlQueryString
()
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
,
control_name
,
param
,
return_type
}
=
data
const
{
sAppCode
:
sAppCode_
,
sPage
:
sPage_
,
dbName
,
control_name
,
param
,
return_type
,
dbCode
}
=
data
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
{
appCode
,
page
,
dbName
:
db_Name
,
db_code
}
=
getPageParms
()
const
db_name
=
dbName
||
db_Name
||
''
const
db_name
=
dbName
||
db_Name
||
''
const
sAppCode
=
sAppCode_
||
appCode
const
sAppCode
=
sAppCode_
||
appCode
const
sPage
=
sPage_
||
page
||
''
const
sPage
=
sPage_
||
page
||
''
const
sdb_code
=
dbCode
||
db_code
const
globalParams
=
commonUtility
.
parseGlobalParams
()
const
globalParams
=
commonUtility
.
parseGlobalParams
()
const
user_id
=
globalParams
.
user_id
||
1
const
user_id
=
globalParams
.
user_id
||
1
const
type
=
typeof
param
const
type
=
typeof
param
...
@@ -519,12 +520,12 @@ const API = {
...
@@ -519,12 +520,12 @@ const API = {
// param: param || '{}',
// param: param || '{}',
control_name
,
control_name
,
return_type
:
return_type
||
3
,
return_type
:
return_type
||
3
,
db_code
db_code
:
sdb_code
}
}
if
(
user_id
)
{
if
(
user_id
)
{
datas
.
user_id
=
user_id
datas
.
user_id
=
user_id
}
}
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
p
=
new
Promise
(
function
(
resolve
,
reject
)
{
axios
.
post
(
`
${
module_query_page
}
`
,
datas
).
then
(
res
=>
{
axios
.
post
(
`
${
module_query_page
}
`
,
datas
).
then
(
res
=>
{
if
(
!
res
)
{
if
(
!
res
)
{
resolve
([])
resolve
([])
...
@@ -539,7 +540,7 @@ const API = {
...
@@ -539,7 +540,7 @@ const API = {
})
})
return
p
return
p
},
},
getGqlData
(
data
,
url
=
module_Gql_query
)
{
getGqlData
(
data
,
url
=
module_Gql_query
)
{
const
{
dbName
:
db_Name
}
=
getPageParms
()
const
{
dbName
:
db_Name
}
=
getPageParms
()
let
url_
=
url
let
url_
=
url
if
(
!
url_
.
includes
(
'?'
))
{
if
(
!
url_
.
includes
(
'?'
))
{
...
@@ -554,7 +555,7 @@ const API = {
...
@@ -554,7 +555,7 @@ const API = {
}
}
return
axios
.
post
(
url_
,
data
)
return
axios
.
post
(
url_
,
data
)
},
},
saveGqlData
(
data
,
url
=
module_Gql_query_save
)
{
saveGqlData
(
data
,
url
=
module_Gql_query_save
)
{
const
{
dbName
:
db_Name
}
=
getPageParms
()
const
{
dbName
:
db_Name
}
=
getPageParms
()
let
url_
=
url
let
url_
=
url
if
(
!
url
.
includes
(
'?'
))
{
if
(
!
url
.
includes
(
'?'
))
{
...
@@ -570,7 +571,7 @@ const API = {
...
@@ -570,7 +571,7 @@ const API = {
}
}
return
axios
.
post
(
url_
,
data_
)
return
axios
.
post
(
url_
,
data_
)
},
},
parseUrlParams
(
queryParms
=
{})
{
parseUrlParams
(
queryParms
=
{})
{
const
urlQueryParams
=
commonUtility
.
parseUrlQueryString
()
const
urlQueryParams
=
commonUtility
.
parseUrlQueryString
()
let
queryParms_str
=
''
let
queryParms_str
=
''
if
(
queryParms
&&
typeof
queryParms
===
'object'
)
{
if
(
queryParms
&&
typeof
queryParms
===
'object'
)
{
...
@@ -585,7 +586,7 @@ const API = {
...
@@ -585,7 +586,7 @@ const API = {
return
queryParms_str
return
queryParms_str
},
},
// 通过主键id 来查询值
// 通过主键id 来查询值
queryByParimaryKey
(
parms
)
{
queryByParimaryKey
(
parms
)
{
const
{
tableName
,
id
,
appCode
:
appCode_
,
queryParms
,
group
,
dyncQueryParms
}
=
parms
const
{
tableName
,
id
,
appCode
:
appCode_
,
queryParms
,
group
,
dyncQueryParms
}
=
parms
const
menuParams
=
getPageParms
()
const
menuParams
=
getPageParms
()
const
appCode__
=
appCode_
||
menuParams
.
appCode
const
appCode__
=
appCode_
||
menuParams
.
appCode
...
@@ -599,7 +600,7 @@ const API = {
...
@@ -599,7 +600,7 @@ const API = {
return
axios
.
get
(
url_
)
return
axios
.
get
(
url_
)
},
},
// 保存
// 保存
save
(
data
)
{
save
(
data
)
{
const
{
tableName
,
appCode
:
appCode_
,
bodyData
,
group
,
parms
}
=
data
const
{
tableName
,
appCode
:
appCode_
,
bodyData
,
group
,
parms
}
=
data
const
{
appCode
}
=
getPageParms
()
const
{
appCode
}
=
getPageParms
()
const
queryParms_str
=
this
.
parseUrlParams
(
parms
)
const
queryParms_str
=
this
.
parseUrlParams
(
parms
)
...
@@ -611,7 +612,7 @@ const API = {
...
@@ -611,7 +612,7 @@ const API = {
url
=
url
+
'?'
+
queryParms_str
url
=
url
+
'?'
+
queryParms_str
return
axios
.
post
(
url
,
bodyData
)
return
axios
.
post
(
url
,
bodyData
)
},
},
put
(
data
)
{
put
(
data
)
{
const
{
tableName
,
appCode
:
appCode_
,
bodyData
,
group
,
parms
}
=
data
const
{
tableName
,
appCode
:
appCode_
,
bodyData
,
group
,
parms
}
=
data
const
{
appCode
}
=
getPageParms
()
const
{
appCode
}
=
getPageParms
()
const
queryParms_str
=
this
.
parseUrlParams
(
parms
)
const
queryParms_str
=
this
.
parseUrlParams
(
parms
)
...
@@ -624,7 +625,7 @@ const API = {
...
@@ -624,7 +625,7 @@ const API = {
return
axios
.
put
(
url
,
bodyData
)
return
axios
.
put
(
url
,
bodyData
)
},
},
// 查询列表
// 查询列表
queryList
(
parms
)
{
queryList
(
parms
)
{
const
{
tableName
,
appCode
:
appCode_
,
queryParms
,
group
,
bodyData
}
=
parms
const
{
tableName
,
appCode
:
appCode_
,
queryParms
,
group
,
bodyData
}
=
parms
const
{
appCode
}
=
getPageParms
()
const
{
appCode
}
=
getPageParms
()
const
appCode__
=
appCode_
||
appCode
const
appCode__
=
appCode_
||
appCode
...
@@ -641,7 +642,7 @@ const API = {
...
@@ -641,7 +642,7 @@ const API = {
}
}
},
},
// 批量删除
// 批量删除
deleteList
(
parms
)
{
deleteList
(
parms
)
{
const
{
tableName
,
appCode
:
appCode_
,
bodyData
}
=
parms
const
{
tableName
,
appCode
:
appCode_
,
bodyData
}
=
parms
const
{
appCode
}
=
getPageParms
()
const
{
appCode
}
=
getPageParms
()
const
queryParms_str
=
this
.
parseUrlParams
()
const
queryParms_str
=
this
.
parseUrlParams
()
...
@@ -651,7 +652,7 @@ const API = {
...
@@ -651,7 +652,7 @@ const API = {
data
:
bodyData
data
:
bodyData
})
})
},
},
importExcel
(
formData
,
data
)
{
importExcel
(
formData
,
data
)
{
const
{
table_name
,
queryParms
}
=
data
const
{
table_name
,
queryParms
}
=
data
const
{
appCode
,
dbName
}
=
getPageParms
()
const
{
appCode
,
dbName
}
=
getPageParms
()
let
strParms
=
''
let
strParms
=
''
...
@@ -666,11 +667,11 @@ const API = {
...
@@ -666,11 +667,11 @@ const API = {
const
url
=
`
${
module_toolAPI
}${
appCode
}
/
${
table_name
}
/import_excel/?db_name=
${
dbName
}${
strParms
}
`
const
url
=
`
${
module_toolAPI
}${
appCode
}
/
${
table_name
}
/import_excel/?db_name=
${
dbName
}${
strParms
}
`
return
axios
.
post
(
url
,
formData
)
return
axios
.
post
(
url
,
formData
)
},
},
getNewId
(
number
)
{
getNewId
(
number
)
{
const
number_
=
number
||
100
const
number_
=
number
||
100
return
axios
.
get
(
module_tool
+
`common/new_id/
${
number_
}
/`
)
return
axios
.
get
(
module_tool
+
`common/new_id/
${
number_
}
/`
)
},
},
importDataIframe
(
data
,
parms
)
{
importDataIframe
(
data
,
parms
)
{
const
{
dbName
,
appCode
}
=
getPageParms
()
const
{
dbName
,
appCode
}
=
getPageParms
()
const
{
table_name
,
import_name
,
queryParms
}
=
parms
const
{
table_name
,
import_name
,
queryParms
}
=
parms
let
strParms
=
''
let
strParms
=
''
...
@@ -686,7 +687,7 @@ const API = {
...
@@ -686,7 +687,7 @@ const API = {
return
axios
.
post
(
url_
,
data
)
return
axios
.
post
(
url_
,
data
)
},
},
// 单据流控制
// 单据流控制
billHandleCommon
(
obj
)
{
billHandleCommon
(
obj
)
{
const
{
data
,
type
}
=
obj
const
{
data
,
type
}
=
obj
let
url
=
''
let
url
=
''
switch
(
type
)
{
switch
(
type
)
{
...
@@ -711,7 +712,7 @@ const API = {
...
@@ -711,7 +712,7 @@ const API = {
}
}
return
axios
.
post
(
url
,
data
)
return
axios
.
post
(
url
,
data
)
},
},
queryBillpbWebDyncCode
(
parms
)
{
queryBillpbWebDyncCode
(
parms
)
{
const
{
appCode
:
appCode_
,
queryParms
,
tableName
}
=
parms
const
{
appCode
:
appCode_
,
queryParms
,
tableName
}
=
parms
const
{
appCode
,
page
}
=
getPageParms
()
const
{
appCode
,
page
}
=
getPageParms
()
const
appCode__
=
appCode_
||
appCode
const
appCode__
=
appCode_
||
appCode
...
@@ -721,20 +722,20 @@ const API = {
...
@@ -721,20 +722,20 @@ const API = {
return
axios
.
get
(
url_
)
return
axios
.
get
(
url_
)
},
},
// action打印
// action打印
printTask
(
data
)
{
printTask
(
data
)
{
const
url
=
`
${
module_tool
}
common/print_task/`
const
url
=
`
${
module_tool
}
common/print_task/`
return
axios
.
post
(
url
,
data
)
return
axios
.
post
(
url
,
data
)
},
},
// 默认单据类型打印
// 默认单据类型打印
TypePrintTask
(
data
)
{
TypePrintTask
(
data
)
{
const
url
=
`
${
module_tool
}
common/print_task_by_bill_type/`
const
url
=
`
${
module_tool
}
common/print_task_by_bill_type/`
return
axios
.
post
(
url
,
data
)
return
axios
.
post
(
url
,
data
)
},
},
get
(
url
)
{
get
(
url
)
{
return
axios
.
get
(
url
)
return
axios
.
get
(
url
)
},
},
// 上传附件
// 上传附件
uploadFile
(
formData
)
{
uploadFile
(
formData
)
{
const
{
appCode
}
=
getPageParms
()
const
{
appCode
}
=
getPageParms
()
return
axios
.
post
(
`fileresourceAPI/file/
${
appCode
}
/`
,
formData
)
return
axios
.
post
(
`fileresourceAPI/file/
${
appCode
}
/`
,
formData
)
}
}
...
...
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