Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
1727a6a9
提交
1727a6a9
authored
4月 13, 2021
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
11794 后勤编外人员库,000013 批量导入报错 数据库 监听器 报错在前端不显示导入什么报错了
上级
15f2e239
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
101 行增加
和
72 行删除
+101
-72
ImportUtil.js
one_stop_public/App/ImportUtil.js
+0
-0
DataObj.js
one_stop_public/models/DataObj.js
+47
-43
request.js
one_stop_public/utils/request.js
+54
-29
没有找到文件。
one_stop_public/App/ImportUtil.js
浏览文件 @
1727a6a9
差异被折叠。
点击展开。
one_stop_public/models/DataObj.js
浏览文件 @
1727a6a9
import
{
apiRequest
}
from
'../utils/request'
;
import
{
apiRequest
}
from
'../utils/request'
;
const
api
=
'/DataObjApi'
;
import
{
Base16Encode
}
from
"../Base16/index"
...
...
@@ -18,10 +19,10 @@ export default {
},
effects
:
{
*
importAnalyse
({
payload
,
callback
},
{
call
,
put
})
{
*
importAnalyse
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/importAnalyse'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -31,10 +32,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
importDataQuery
({
payload
,
callback
},
{
call
,
put
})
{
*
importDataQuery
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/importDataQuery'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -44,10 +45,13 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
importExecute
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/importExecute'
,
payload
);
*
importExecute
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/importExecute'
,
{
...
payload
,
customErrMsg
:
'导入的文件中可能存在字段不一致、字段类型不匹配、唯一性字段冲突,请检查或联系系统管理员'
,
// 自定义errMsg
});
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -57,18 +61,18 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
getAll
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getAll'
,
payload
);
*
getAll
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getAll'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
if
(
callback
)
callback
(
response
);
},
*
getStatistics
({
payload
,
callback
},
{
call
,
put
})
{
*
getStatistics
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getStatistics'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -78,10 +82,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
getExportInfo
({
payload
,
callback
},
{
call
,
put
})
{
*
getExportInfo
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getExportInfo'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -91,10 +95,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
changeCatalogue
({
payload
,
callback
},
{
call
,
put
})
{
*
changeCatalogue
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/changeCatalogue'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -104,10 +108,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
findByCode
({
payload
,
callback
},
{
call
,
put
})
{
*
findByCode
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/findByCode'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -117,10 +121,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
findByName
({
payload
,
callback
},
{
call
,
put
})
{
*
findByName
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/findByName'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
...
...
@@ -129,10 +133,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
find
({
payload
,
callback
},
{
call
,
put
})
{
*
find
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/find'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -142,14 +146,14 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
add
({
payload
,
callback
},
{
call
,
put
})
{
*
add
({
payload
,
callback
},
{
call
,
put
})
{
if
(
payload
.
sqlScript
)
{
payload
.
sqlScript
=
Base16Encode
(
payload
.
sqlScript
)
if
(
payload
.
sqlScript
)
{
payload
.
sqlScript
=
Base16Encode
(
payload
.
sqlScript
)
}
const
response
=
yield
call
(
apiRequest
,
api
+
'/add'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
...
...
@@ -159,33 +163,33 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
fetch
({
payload
,
callback
},
{
call
,
put
})
{
*
fetch
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getPage'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
type
:
'page'
,
payload
:
{
...
response
,
isMain
:
payload
.
isMain
},
payload
:
{
...
response
,
isMain
:
payload
.
isMain
},
});
},
*
getTableList
({
payload
,
callback
},
{
call
,
put
})
{
*
getTableList
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/getTableList'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
yield
put
({
type
:
'nom'
,
payload
:
response
,
});
if
(
callback
)
callback
(
response
);
},
*
createTableByName
({
payload
,
callback
},
{
call
,
put
})
{
*
createTableByName
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/createTableByName'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
...
...
@@ -194,10 +198,10 @@ export default {
});
if
(
callback
)
callback
(
response
);
},
*
remove
({
payload
,
callback
},
{
call
,
put
})
{
*
remove
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/remove'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
...
...
@@ -208,10 +212,10 @@ export default {
callback
();
}
},
*
open
({
payload
,
callback
},
{
call
,
put
})
{
*
open
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/open'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
...
...
@@ -222,10 +226,10 @@ export default {
callback
();
}
},
*
createTabel
({
payload
,
callback
},
{
call
,
put
})
{
*
createTabel
({
payload
,
callback
},
{
call
,
put
})
{
const
response
=
yield
call
(
apiRequest
,
api
+
'/createTable'
,
payload
);
if
(
!
response
)
{
yield
put
({
type
:
'nom'
});
yield
put
({
type
:
'nom'
});
return
;
}
yield
put
({
...
...
@@ -245,7 +249,7 @@ export default {
list
:
action
.
payload
,
};
},
page
(
state
,
{
payload
})
{
page
(
state
,
{
payload
})
{
if
(
payload
.
isMain
)
{
return
{
...
state
,
...
...
@@ -273,7 +277,7 @@ export default {
}
},
nom
(
state
,
action
)
{
return
{
...
state
};
return
{
...
state
};
},
},
};
one_stop_public/utils/request.js
浏览文件 @
1727a6a9
...
...
@@ -5,10 +5,16 @@
import
{
extend
}
from
'umi-request'
;
import
{
notification
}
from
'antd'
;
import
{
getToken
}
from
'./token'
;
import
{
queryApiActionPath
,
queryOauthActionPath
,
queryPermActionPath
,
queryDynamicActionPath
}
from
'./queryConfig'
;
import
{
queryApiActionPath
,
queryOauthActionPath
,
queryPermActionPath
,
queryDynamicActionPath
,
}
from
'./queryConfig'
;
import
{
openToast
}
from
'../location/Notification'
;
import
{
showToast
}
from
'../location/Toast'
;
import
{
offline
}
from
'../location/Toast'
;
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
201
:
'新建或修改数据成功。'
,
...
...
@@ -33,7 +39,17 @@ const codeMessage = {
*
* return URL参数字符串
*/
const
objectToQuery
=
function
(
param
,
key
,
encode
)
{
const
qqCw
=
({
title
=
'请求错误'
,
msg
=
''
,
customErrMsg
=
''
})
=>
{
// 请求错误 增加自定义错误提示信息
notification
.
error
({
message
:
title
,
description
:
customErrMsg
||
msg
,
});
return
undefined
;
};
const
objectToQuery
=
function
(
param
,
key
,
encode
)
{
if
(
param
==
null
)
return
''
;
var
paramStr
=
''
;
var
t
=
typeof
param
;
...
...
@@ -56,9 +72,8 @@ const errorHandler = error => {
if
(
response
&&
response
.
status
)
{
const
errorText
=
codeMessage
[
response
.
status
]
||
response
.
statusText
;
notification
.
error
({
message
:
`请求错误`
,
description
:
errorText
,
qqCw
({
msg
:
errorText
,
});
if
(
response
.
status
===
401
)
{
// @HACK
...
...
@@ -84,6 +99,9 @@ const errorHandler = error => {
/**
* 配置request请求时的默认参数
*/
const
umiRequest
=
extend
({
errorHandler
,
// 默认错误处理
credentials
:
'omit'
,
// 默认请求是否带上cookie
...
...
@@ -134,8 +152,8 @@ export const request = (url, data, options = {}) => {
window
.
location
.
href
=
x
.
mobileAdress
?
mobileAdress
+
'?timeVersion='
+
time
:
ul
.
indexOf
(
'?'
)
>
-
1
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
}
else
{
sessionStorage
.
removeItem
(
'cacheMobile'
);
openToast
(
'error'
,
'版本更新'
,
'检查到最新版本,即将自动更新,更新完成后请重新操作'
);
...
...
@@ -143,8 +161,8 @@ export const request = (url, data, options = {}) => {
window
.
location
.
href
=
x
.
webAdress
?
x
.
webAdress
+
'?timeVersion='
+
time
:
ul
.
indexOf
(
'?'
)
>
-
1
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
}
setTimeout
(()
=>
location
.
reload
(),
3000
);
}
...
...
@@ -161,16 +179,16 @@ export const request = (url, data, options = {}) => {
if
(
!
response
)
return
;
if
(
response
.
errCode
||
response
.
errMsg
)
{
notification
.
error
({
m
essage
:
`请求错误`
,
description
:
response
.
e
rrMsg
,
qqCw
({
m
sg
:
response
.
errMsg
,
customErrMsg
:
pp
.
customE
rrMsg
,
});
return
;
}
if
(
response
.
errcode
)
{
notification
.
error
({
m
essage
:
`请求错误`
,
description
:
response
.
errm
sg
,
qqCw
({
m
sg
:
response
.
errmsg
,
customErrMsg
:
pp
.
customErrM
sg
,
});
return
;
}
...
...
@@ -178,7 +196,11 @@ export const request = (url, data, options = {}) => {
return
response
;
});
}
else
{
const
pp
=
{
...
data
,
token
:
getToken
(),
version_
:
version
};
const
pp
=
{
...
data
,
token
:
getToken
(),
version_
:
version
,
};
for
(
let
i
in
pp
)
{
if
(
pp
[
i
]
==
null
)
{
...
...
@@ -209,8 +231,8 @@ export const request = (url, data, options = {}) => {
window
.
location
.
href
=
x
.
mobileAdress
?
mobileAdress
+
'?timeVersion='
+
time
:
ul
.
indexOf
(
'?'
)
>
-
1
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
}
else
{
sessionStorage
.
removeItem
(
'cacheMobile'
);
openToast
(
'error'
,
'版本更新'
,
'检查到最新版本,即将自动更新,更新完成后请重新操作'
);
...
...
@@ -218,8 +240,8 @@ export const request = (url, data, options = {}) => {
window
.
location
.
href
=
x
.
webAdress
?
x
.
webAdress
+
'?timeVersion='
+
time
:
ul
.
indexOf
(
'?'
)
>
-
1
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
?
ul
+
'&timeVersion='
+
time
:
ul
+
'?timeVersion='
+
time
;
}
setTimeout
(()
=>
location
.
reload
(),
3000
);
}
...
...
@@ -235,17 +257,17 @@ export const request = (url, data, options = {}) => {
if
(
!
response
)
return
;
if
(
response
.
errCode
||
response
.
errMsg
)
{
notification
.
error
({
m
essage
:
`请求错误`
,
description
:
response
.
e
rrMsg
,
})
;
qqCw
({
m
sg
:
response
.
errMsg
,
customErrMsg
:
pp
.
customE
rrMsg
,
})
return
;
}
if
(
response
.
errcode
)
{
notification
.
error
({
m
essage
:
`请求错误`
,
description
:
response
.
errm
sg
,
})
;
qqCw
({
m
sg
:
response
.
errmsg
,
customErrMsg
:
pp
.
customErrM
sg
,
})
return
;
}
canReportError
=
true
;
...
...
@@ -272,7 +294,10 @@ const createServerRequest = (config = {}) => {
return
setRequestConfig
(
config
);
};
export
const
dynamicRequest
=
createServerRequest
({
method
:
'POST'
,
prefix
:
queryDynamicActionPath
()
});
export
const
dynamicRequest
=
createServerRequest
({
method
:
'POST'
,
prefix
:
queryDynamicActionPath
(),
});
export
const
uaaRequest
=
createServerRequest
({
method
:
'POST'
,
prefix
:
queryOauthActionPath
()
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论