Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
component
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
purplevin
component
Commits
229f4b7a
Commit
229f4b7a
authored
Sep 01, 2022
by
shuaiqiang
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:api问题
parent
a9fa7fc7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
46 deletions
+116
-46
api/convertApi.js
api/convertApi.js
+17
-8
config/index.js
config/index.js
+1
-2
packages/convertTool/src/components/Pct2CnForm.vue
packages/convertTool/src/components/Pct2CnForm.vue
+36
-30
packages/fileSplit/src/components/SplitWordForm.vue
packages/fileSplit/src/components/SplitWordForm.vue
+0
-1
packages/upload_excel/src/index.vue
packages/upload_excel/src/index.vue
+3
-5
utils/uploadAPiService.js
utils/uploadAPiService.js
+59
-0
No files found.
api/convertApi.js
View file @
229f4b7a
import
service
from
'
@utils/GraphApiService
'
// export function CnConversionPCT(baseURL, data) {
// return service({
// baseURL: baseURL,
// url: 'Word/CN2PCT',
// method: 'post',
// data
// })
// }
export
function
fetchCnToCpc
(
baseURL
,
data
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
Word/CN2CPC
'
,
method
:
'
POST
'
,
data
})
}
export
function
fetchCntToPct
(
baseURL
,
data
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
Word/CN2PCT
'
,
method
:
'
post
'
,
data
})
}
export
function
fetchPctToCn
(
baseURL
,
data
)
{
return
service
({
...
...
config/index.js
View file @
229f4b7a
...
...
@@ -28,6 +28,5 @@ module.exports = {
},
dev_file_sz
:
{
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/dev2/wade_ext/
'
},
VUE_APP_USER_ID_MODE
:
'
variable
'
}
}
\ No newline at end of file
packages/convertTool/src/components/Pct2CnForm.vue
View file @
229f4b7a
...
...
@@ -48,7 +48,6 @@
</
template
>
<
script
>
import
GraphApiService
from
'
@utils/GraphApiService
'
import
{
fetchPctToCn
}
from
'
@api/convertApi
'
export
default
{
name
:
'
Cn2CpcForm
'
,
data
:
function
()
{
...
...
@@ -74,35 +73,42 @@ export default {
this
.
fileList
.
forEach
(
e
=>
{
formData
.
append
(
'
file
'
,
e
.
raw
)
})
const
response
=
await
fetchPctToCn
(
this
.
baseUrl
,
formData
)
if
(
response
.
status
===
200
)
{
this
.
fileList
=
[]
this
.
$refs
.
upload
.
clearFiles
()
const
excelFileName
=
response
.
data
GraphApiService
.
get
(
'
RequestPayment/DownloadFile
'
,
{
params
:
{
fileName
:
excelFileName
},
responseType
:
'
blob
'
})
.
then
(
res
=>
{
const
blob
=
new
Blob
([
res
])
const
downloadElement
=
document
.
createElement
(
'
a
'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
downloadElement
.
href
=
href
downloadElement
.
download
=
excelFileName
.
split
(
'
/
'
)[
1
]
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
document
.
body
.
removeChild
(
downloadElement
)
window
.
URL
.
revokeObjectURL
(
href
)
})
}
else
{
this
.
$refs
.
upload
.
abort
()
this
.
$message
.
error
(
'
下载档案失败!
'
)
}
console
.
log
(
response
.
data
)
GraphApiService
.
post
(
'
Word/PCT2CN
'
,
formData
)
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
this
.
fileList
=
[]
this
.
$refs
.
upload
.
clearFiles
()
const
excelFileName
=
res
.
data
GraphApiService
.
get
(
'
RequestPayment/DownloadFile
'
,
{
params
:
{
fileName
:
excelFileName
},
responseType
:
'
blob
'
})
.
then
(
response
=>
{
const
blob
=
new
Blob
([
response
])
const
downloadElement
=
document
.
createElement
(
'
a
'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
downloadElement
.
href
=
href
downloadElement
.
download
=
excelFileName
.
split
(
'
/
'
)[
1
]
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
document
.
body
.
removeChild
(
downloadElement
)
window
.
URL
.
revokeObjectURL
(
href
)
})
}
else
{
this
.
$refs
.
upload
.
abort
()
this
.
$message
.
error
(
'
下载档案失败!
'
)
}
console
.
log
(
res
.
data
)
})
.
catch
(
error
=>
{
console
.
log
(
'
error
'
,
error
)
this
.
$refs
.
upload
.
abort
()
this
.
$message
.
error
(
'
下载档案失败!
'
)
})
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange
(
file
,
fileList
)
{
...
...
packages/fileSplit/src/components/SplitWordForm.vue
View file @
229f4b7a
...
...
@@ -182,7 +182,6 @@ export default {
this
.
$refs
.
upload
.
clearFiles
()
const
zipFileName
=
response
.
data
this
.
downloadFile
(
zipFileName
)
console
.
log
(
this
.
downloadFile
)
}
else
{
this
.
$refs
.
upload
.
abort
()
this
.
$message
.
error
(
'
下载档案失败!
'
)
...
...
packages/upload_excel/src/index.vue
View file @
229f4b7a
...
...
@@ -25,7 +25,7 @@
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
UploadExcelComponent
from
'
./components/UploadExcel.vue
'
import
graphRequest
from
'
@utils/GraphAp
iService
'
import
uploadApiService
from
'
@utils/uploadAP
iService
'
export
default
{
name
:
'
uploadExcel
'
,
components
:
{
UploadExcelComponent
},
...
...
@@ -59,12 +59,10 @@ export default {
return
false
},
handleSuccess
({
results
,
header
})
{
console
.
log
(
this
.
wadeUserID
)
this
.
tableData
=
results
this
.
tableHeader
=
header
this
.
tableHeader
.
push
(
'
isUpload
'
)
// this.tableData = this.tableData.map(obj => ({ ...obj, isUpload: false }))
console
.
log
(
this
.
tableData
)
this
.
levelKeys
.
map
(
level
=>
{
this
.
tableData
.
forEach
((
obj
,
index
,
array
)
=>
{
array
[
index
][
level
.
name
]
=
this
.
getLevel
(
level
.
value
)
...
...
@@ -80,7 +78,7 @@ export default {
return
item
[
level
.
value
]
===
'
ν
'
})
.
map
(
item
=>
{
graphRequest
uploadApiService
.
get
(
'
/Wade/GetEhrEmployeeByName
'
,
{
params
:
{
name
:
item
[
'
姓名
'
]
}
})
...
...
@@ -101,7 +99,7 @@ export default {
match_type
:
'
1
'
,
update_user_id
:
this
.
wadeUserID
}
graphRequest
uploadApiService
.
post
(
'
/Wade/CreateCaseLevelList
'
,
params
)
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
...
...
utils/uploadAPiService.js
0 → 100644
View file @
229f4b7a
import
axios
from
'
axios
'
import
{
Message
}
from
'
element-ui
'
// create an axios instance
const
uploadApiService
=
axios
.
create
({
baseURL
:
"
https://dev.essenptl.com/graphAPITest/api/v1.0/
"
,
// withCredentials: true, // send cookies when cross-domain requests
timeout
:
300000
,
// request timeout
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
})
// 請求攔截
uploadApiService
.
interceptors
.
request
.
use
(
confing
=>
{
return
confing
},
error
=>
{
console
.
log
(
error
)
// for debug
return
Promise
.
reject
(
error
)
}
)
// 響應攔截
uploadApiService
.
interceptors
.
response
.
use
(
response
=>
{
const
res
=
response
.
data
if
(
res
.
type
&&
(
res
.
type
===
'
application/vnd.openxmlformats-officedocument.wordprocessingml.document
'
||
res
.
type
===
'
application/zip
'
)
)
{
return
res
}
if
(
res
.
status
!==
200
)
{
// if the custom code is not 200, it is judged as an error.
Message
({
message
:
res
.
message
||
'
Error
'
,
type
:
'
error
'
,
duration
:
5
*
1000
})
return
Promise
.
reject
(
new
Error
(
res
.
message
||
'
Error
'
))
}
else
{
return
res
}
},
error
=>
{
console
.
log
(
'
err
'
+
error
)
// for debug
Message
({
message
:
error
.
message
,
type
:
'
error
'
,
duration
:
5
*
1000
})
return
Promise
.
reject
(
error
)
}
)
export
default
uploadApiService
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