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
ac677587
Commit
ac677587
authored
Sep 02, 2022
by
shuaiqiang
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:调整结构
parent
229f4b7a
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
13819 additions
and
6104 deletions
+13819
-6104
api/convertApi.js
api/convertApi.js
+18
-8
api/uploadApi.js
api/uploadApi.js
+6
-3
api/uploadExcelApi.js
api/uploadExcelApi.js
+18
-0
config/index.js
config/index.js
+3
-10
example/App.vue
example/App.vue
+2
-2
lib/index.common.js
lib/index.common.js
+6803
-2894
lib/index.css
lib/index.css
+1
-1
lib/index.umd.js
lib/index.umd.js
+6827
-2918
lib/index.umd.min.js
lib/index.umd.min.js
+6
-6
packages/convertTool/src/components/Cn2CpcForm.vue
packages/convertTool/src/components/Cn2CpcForm.vue
+13
-29
packages/convertTool/src/components/Cn2PctForm.vue
packages/convertTool/src/components/Cn2PctForm.vue
+12
-28
packages/convertTool/src/components/Pct2CnForm.vue
packages/convertTool/src/components/Pct2CnForm.vue
+19
-35
packages/convertTool/src/components/VisioForm.vue
packages/convertTool/src/components/VisioForm.vue
+14
-29
packages/fileSplit/src/components/SplitWordForm.vue
packages/fileSplit/src/components/SplitWordForm.vue
+1
-3
packages/fileSplit/src/index.vue
packages/fileSplit/src/index.vue
+1
-1
packages/upload/src/index.vue
packages/upload/src/index.vue
+50
-51
packages/upload_excel/src/index.vue
packages/upload_excel/src/index.vue
+25
-27
utils/uploadAPiService.js
utils/uploadAPiService.js
+0
-59
No files found.
api/convertApi.js
View file @
ac677587
...
...
@@ -27,11 +27,21 @@ export function fetchPctToCn(baseURL, data) {
})
}
// export function fetchConvertEquations(baseURL, data) {
// return service({
// baseURL: baseURL,
// url: 'Word/ConvertEquations',
// method: 'POST',
// data
// })
// }
\ No newline at end of file
export
function
fetchConvertEquations
(
baseURL
,
data
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
Word/ConvertEquations
'
,
method
:
'
POST
'
,
data
})
}
export
function
fetchDownloadFile
(
baseURL
,
params
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
RequestPayment/DownloadFile
'
,
method
:
'
get
'
,
responseType
:
'
blob
'
,
params
})
}
\ No newline at end of file
api/
warningReport
Api.js
→
api/
upload
Api.js
View file @
ac677587
import
service
from
'
@utils/requestService
'
export
function
createHxRequestPaymentVerticalTotal
(
data
)
{
export
function
createHxRequestPaymentVerticalTotal
(
baseURL
,
data
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal
'
,
method
:
'
POST
'
,
data
})
}
export
function
createHxRequestPaymentVerticalTotal2
(
data
)
{
export
function
createHxRequestPaymentVerticalTotal2
(
baseURL
,
data
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal2
'
,
method
:
'
POST
'
,
data
})
}
export
function
downloadFile
(
params
)
{
export
function
downloadFile
(
baseURL
,
params
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
api/v1.0/RequestPayment/DownloadFile
'
,
method
:
'
GET
'
,
params
,
...
...
api/uploadExcelApi.js
0 → 100644
View file @
ac677587
import
service
from
'
@utils/GraphApiService
'
export
function
fetchEhrEmployeeByName
(
baseURL
,
params
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
Wade/GetEhrEmployeeByName
'
,
method
:
'
get
'
,
params
})
}
export
function
fetchCaseLevelList
(
baseURL
,
data
)
{
return
service
({
baseURL
:
baseURL
,
url
:
'
Wade/CreateCaseLevelList
'
,
method
:
'
post
'
,
data
})
}
\ No newline at end of file
config/index.js
View file @
ac677587
...
...
@@ -6,10 +6,8 @@ module.exports = {
VUE_APP_GRAPHAPI_URL
:
'
https://pvapi.purplevineip.com/graphAPI/api/v1.0/
'
},
prod_test_sz
:
{
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/graphAPITest/api/v1.0/
'
},
prod_file_sz
:
{
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/dev2/wade_ext/
'
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/graphAPITest/api/v1.0/
'
,
VUE_FILE_URL
:
'
https://dev.essenptl.com/dev2/wade_ext/
'
},
dev_tp
:
{
VUE_APP_GRAPHAPI_URL
:
'
http://localhost:64224/api/v1.0/
'
...
...
@@ -22,11 +20,6 @@ module.exports = {
},
dev_test_sz
:
{
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/graphAPITest/api/v1.0/
'
,
},
dev_file_tp
:
{
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/dev2/wade_ext/
'
},
dev_file_sz
:
{
VUE_APP_GRAPHAPI_URL
:
'
https://dev.essenptl.com/dev2/wade_ext/
'
VUE_FILE_URL
:
'
https://dev.essenptl.com/dev2/wade_ext/
'
}
}
\ No newline at end of file
example/App.vue
View file @
ac677587
...
...
@@ -4,8 +4,8 @@
<pLink
type=
"primary"
>
Test
</pLink>
<splitTool
env=
"dev_test_sz"
></splitTool>
<convertTool
env=
"dev_test_sz"
></convertTool>
<fileSplit
env=
"dev_
file
_sz"
></fileSplit>
<upload
env=
"dev_
file
_sz"
></upload>
<fileSplit
env=
"dev_
test
_sz"
></fileSplit>
<upload
env=
"dev_
test
_sz"
></upload>
<uploadExcel
env=
"dev_test_sz"
></uploadExcel>
</div>
...
...
lib/index.common.js
View file @
ac677587
This diff is collapsed.
Click to expand it.
lib/index.css
View file @
ac677587
.p-link-default
[
data-v-30dd6ef1
]
{
color
:
#606266
}
.p-link-primary
[
data-v-30dd6ef1
]
{
color
:
#409eff
}
.el-form
.el-form-item
[
data-v-8461da98
]
{
margin
:
10px
0
}
.el-form
.el-form-item
.el-radio-group
[
data-v-8461da98
]
{
margin-left
:
20px
}
.el-form
.el-form-item
input
[
data-v-8461da98
]
{
width
:
126px
;
margin-left
:
10px
;
outline
:
none
;
border
:
0
;
background
:
#c6c6c6
}
.choose-box
[
data-v-8461da98
]
{
margin-left
:
200px
;
border
:
1px
solid
#000
;
width
:
220px
}
.choose-box
div
>
span
[
data-v-8461da98
]
{
display
:
inline-block
;
width
:
56px
;
text-align
:
center
;
margin
:
10px
5px
;
border
:
1px
solid
#000
}
input
[
data-v-8461da98
]
::-webkit-input-placeholder
{
font-size
:
12px
;
opacity
:
.8
}
[
data-v-8461da98
]
.el-form-item__content
{
line-height
:
1.5
!important
}
.excel-upload-input
[
data-v-77bf1e84
]
{
display
:
none
;
z-index
:
-9999
}
.drop
[
data-v-77bf1e84
]
{
border
:
2px
dashed
#bbb
;
width
:
600px
;
height
:
160px
;
line-height
:
160px
;
margin
:
0
auto
;
font-size
:
24px
;
border-radius
:
5px
;
text-align
:
center
;
color
:
#bbb
;
position
:
relative
}
\ No newline at end of file
.p-link-default
[
data-v-30dd6ef1
]
{
color
:
#606266
}
.p-link-primary
[
data-v-30dd6ef1
]
{
color
:
#409eff
}
.el-form
.el-form-item
[
data-v-64794a36
]
{
margin
:
10px
0
}
.el-form
.el-form-item
.el-radio-group
[
data-v-64794a36
]
{
margin-left
:
20px
}
.el-form
.el-form-item
input
[
data-v-64794a36
]
{
width
:
126px
;
margin-left
:
10px
;
outline
:
none
;
border
:
0
;
background
:
#c6c6c6
}
.choose-box
[
data-v-64794a36
]
{
margin-left
:
200px
;
border
:
1px
solid
#000
;
width
:
220px
}
.choose-box
div
>
span
[
data-v-64794a36
]
{
display
:
inline-block
;
width
:
56px
;
text-align
:
center
;
margin
:
10px
5px
;
border
:
1px
solid
#000
}
input
[
data-v-64794a36
]
::-webkit-input-placeholder
{
font-size
:
12px
;
opacity
:
.8
}
[
data-v-64794a36
]
.el-form-item__content
{
line-height
:
1.5
!important
}
.excel-upload-input
[
data-v-77bf1e84
]
{
display
:
none
;
z-index
:
-9999
}
.drop
[
data-v-77bf1e84
]
{
border
:
2px
dashed
#bbb
;
width
:
600px
;
height
:
160px
;
line-height
:
160px
;
margin
:
0
auto
;
font-size
:
24px
;
border-radius
:
5px
;
text-align
:
center
;
color
:
#bbb
;
position
:
relative
}
\ No newline at end of file
lib/index.umd.js
View file @
ac677587
This diff is collapsed.
Click to expand it.
lib/index.umd.min.js
View file @
ac677587
This diff is collapsed.
Click to expand it.
packages/convertTool/src/components/Cn2CpcForm.vue
View file @
ac677587
...
...
@@ -47,7 +47,7 @@
</div>
</
template
>
<
script
>
import
GraphApiService
from
'
@utils/GraphApiService
'
import
{
fetchCnToCpc
,
fetchDownloadFile
}
from
"
@api/convertApi
"
export
default
{
name
:
'
Cn2CpcForm
'
,
data
:
function
()
{
...
...
@@ -63,7 +63,7 @@ export default {
},
methods
:
{
// 上传到服务器
submitUpload
()
{
async
submitUpload
()
{
console
.
log
(
this
.
fileList
)
if
(
this
.
fileList
.
length
<=
0
)
{
this
.
$message
.
error
(
'
请先选择需要上传的文件!
'
)
...
...
@@ -73,48 +73,32 @@ export default {
this
.
fileList
.
forEach
(
e
=>
{
formData
.
append
(
'
file
'
,
e
.
raw
)
})
GraphApiService
.
post
(
'
Word/CN2CPC
'
,
formData
)
.
then
(
res
=>
{
const
res
=
await
fetchCnToCpc
(
this
.
baseUrl
,
formData
)
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
)
const
response
=
await
fetchDownloadFile
(
this
.
baseUrl
,{
fileName
:
excelFileName
})
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
)
{
// 存在文件标识
let
existsFileFlag
=
false
for
(
let
i
=
0
;
i
<
this
.
fileList
.
length
;
i
++
)
{
if
(
file
.
name
===
this
.
fileList
[
i
].
name
&&
...
...
packages/convertTool/src/components/Cn2PctForm.vue
View file @
ac677587
...
...
@@ -51,7 +51,7 @@
</div>
</
template
>
<
script
>
import
GraphApiService
from
'
@utils/GraphApiService
'
import
{
fetchCntToPct
,
fetchDownloadFile
}
from
"
@api/convertApi
"
export
default
{
name
:
'
Cn2PctForm
'
,
data
:
function
()
{
...
...
@@ -77,42 +77,26 @@ export default {
this
.
fileList
.
forEach
(
e
=>
{
formData
.
append
(
'
file
'
,
e
.
raw
)
})
GraphApiService
.
post
(
'
Word/CN2PCT
'
,
formData
)
.
then
(
res
=>
{
const
res
=
await
fetchCntToPct
(
this
.
baseUrl
,
formData
)
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
)
})
const
response
=
await
fetchDownloadFile
(
this
.
baseUrl
,{
fileName
:
excelFileName
})
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/convertTool/src/components/Pct2CnForm.vue
View file @
ac677587
...
...
@@ -47,7 +47,7 @@
</div>
</
template
>
<
script
>
import
GraphApiService
from
'
@utils/GraphApiService
'
import
{
fetchPctToCn
,
fetchDownloadFile
}
from
"
@api/convertApi
"
export
default
{
name
:
'
Cn2CpcForm
'
,
data
:
function
()
{
...
...
@@ -73,42 +73,26 @@ export default {
this
.
fileList
.
forEach
(
e
=>
{
formData
.
append
(
'
file
'
,
e
.
raw
)
})
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
)
const
res
=
await
fetchPctToCn
(
this
.
baseUrl
,
formData
)
if
(
res
.
status
===
200
)
{
this
.
fileList
=
[]
this
.
$refs
.
upload
.
clearFiles
()
const
excelFileName
=
res
.
data
const
response
=
await
fetchDownloadFile
(
this
.
baseUrl
,{
fileName
:
excelFileName
})
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
)
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange
(
file
,
fileList
)
{
...
...
packages/convertTool/src/components/VisioForm.vue
View file @
ac677587
...
...
@@ -101,7 +101,7 @@
</div>
</
template
>
<
script
>
import
GraphApiService
from
'
@utils/GraphApiService
'
import
{
fetchConvertEquations
,
fetchDownloadFile
}
from
"
@api/convertApi
"
export
default
{
name
:
'
VisioForm
'
,
data
:
function
()
{
...
...
@@ -126,7 +126,7 @@ export default {
},
methods
:
{
// 上传到服务器
submitUpload
()
{
async
submitUpload
()
{
console
.
log
(
this
.
fileList
)
if
(
this
.
fileList
.
length
<=
0
)
{
this
.
$message
.
error
(
'
请先选择需要上传的文件!
'
)
...
...
@@ -147,42 +147,27 @@ export default {
formData
.
append
(
'
includeType
'
,
this
.
form
.
includeType
)
formData
.
append
(
'
isSetLineHeight
'
,
this
.
form
.
isSetLineHeight
)
formData
.
append
(
'
lineHeight
'
,
this
.
form
.
lineHeight
)
GraphApiService
.
post
(
'
Word/ConvertEquations
'
,
formData
)
.
then
(
res
=>
{
const
res
=
await
fetchConvertEquations
(
this
.
baseUrl
,
formData
)
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
)
})
const
response
=
await
fetchDownloadFile
(
this
.
baseUrl
,{
fileName
:
excelFileName
})
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 @
ac677587
...
...
@@ -75,10 +75,8 @@
</div>
</template>
<
script
>
import
{
SplitRevisionDoc
}
from
'
@api/fileApi
'
import
{
SplitRevisionDoc
}
from
'
@api/fileApi
'
import
{
mixins
}
from
"
../mixin/toolMixin
"
;
import
service
from
'
@utils/requestService
'
export
default
{
name
:
'
SplitWordForm
'
,
mixins
:[
"
mixins
"
],
...
...
packages/fileSplit/src/index.vue
View file @
ac677587
...
...
@@ -23,7 +23,7 @@ export default {
computed
:{
baseUrl
(){
console
.
log
(
'
config
'
,
config
,
this
.
env
)
return
config
[
this
.
env
].
VUE_
APP_GRAPHAPI
_URL
return
config
[
this
.
env
].
VUE_
FILE
_URL
}
},
}
...
...
packages/upload/src/index.vue
View file @
ac677587
...
...
@@ -129,11 +129,17 @@ import {
createHxRequestPaymentVerticalTotal2
,
downloadFile
}
from
'
@api/
warningReport
Api
'
from
'
@api/
upload
Api
'
import
moment
from
'
moment
'
import
config
from
'
@config/index.js
'
export
default
{
name
:
'
upload
'
,
props
:{
env
:{
type
:
String
,
default
:
'
prod_sz
'
}
},
data
:
function
()
{
return
{
activeName
:
'
first
'
,
...
...
@@ -147,6 +153,12 @@ export default {
createMonth
:
''
}
},
computed
:{
baseUrl
(){
console
.
log
(
'
config
'
,
config
,
this
.
env
)
return
config
[
this
.
env
].
VUE_FILE_URL
}
},
created
()
{
// eslint-disable-next-line no-undef
this
.
createMonth
=
moment
().
format
(
'
YYYY年MM月
'
)
...
...
@@ -156,7 +168,7 @@ export default {
this
.
activeName
=
tab
.
name
},
// 上传到服务器
submitUpload
()
{
async
submitUpload
()
{
console
.
log
(
this
.
fileList
)
if
(
this
.
fileList
.
length
<=
0
)
{
this
.
$message
.
error
(
'
请先选择需要上传的文件!
'
)
...
...
@@ -175,31 +187,25 @@ export default {
this
.
detailFileList
.
forEach
(
e
=>
{
formData
.
append
(
'
detailFileList
'
,
e
.
raw
)
})
createHxRequestPaymentVerticalTotal
(
formData
)
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
excelFileName
=
res
.
data
downloadFile
({
fileName
:
excelFileName
})
.
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
.
$message
.
error
(
'
下载档案失败!
'
)
}
console
.
log
(
res
.
data
)
})
const
res
=
await
createHxRequestPaymentVerticalTotal
(
this
.
baseUrl
,
formData
)
if
(
res
.
status
===
200
)
{
excelFileName
=
res
.
data
const
response
=
downloadFile
(
this
.
baseUrl
,{
fileName
:
excelFileName
})
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
.
$message
.
error
(
'
下载档案失败!
'
)
}
console
.
log
(
res
.
data
)
},
submitUpload2
()
{
async
submitUpload2
()
{
console
.
log
(
this
.
detailFileList2
)
if
(
this
.
detailFileList2
.
length
<=
0
)
{
this
.
$message
.
error
(
'
请先选择需要上传的文件!
'
)
...
...
@@ -210,30 +216,23 @@ export default {
this
.
detailFileList2
.
forEach
(
e
=>
{
formData
.
append
(
'
detailFileList
'
,
e
.
raw
)
})
createHxRequestPaymentVerticalTotal2
(
formData
)
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
excelFileName
=
res
.
data
// debugger
downloadFile
({
fileName
:
excelFileName
})
.
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
.
$message
.
error
(
'
下载档案失败!
'
)
}
console
.
log
(
res
.
data
)
})
const
res
=
await
createHxRequestPaymentVerticalTotal2
(
this
.
baseUrl
,
formData
)
if
(
res
.
status
===
200
)
{
excelFileName
=
res
.
data
const
response
=
downloadFile
(
this
.
baseUrl
,{
fileName
:
excelFileName
})
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
.
$message
.
error
(
'
下载档案失败!
'
)
}
console
.
log
(
res
.
data
)
},
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange
(
file
,
fileList
)
{
...
...
packages/upload_excel/src/index.vue
View file @
ac677587
...
...
@@ -25,10 +25,17 @@
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
UploadExcelComponent
from
'
./components/UploadExcel.vue
'
import
uploadApiService
from
'
@utils/uploadAPiService
'
import
{
fetchEhrEmployeeByName
,
fetchCaseLevelList
}
from
"
@api/uploadExcelApi
"
import
config
from
'
@config/index.js
'
export
default
{
name
:
'
uploadExcel
'
,
components
:
{
UploadExcelComponent
},
props
:{
env
:{
type
:
String
,
default
:
'
prod_sz
'
}
},
data
()
{
return
{
tableData
:
[],
...
...
@@ -42,7 +49,11 @@ export default {
}
},
computed
:
{
...
mapGetters
(
'
user/
'
,
[
'
wadeUserID
'
])
...
mapGetters
(
'
user/
'
,
[
'
wadeUserID
'
]),
baseUrl
(){
console
.
log
(
'
config
'
,
config
,
this
.
env
)
return
config
[
this
.
env
].
VUE_APP_GRAPHAPI_URL
}
},
methods
:
{
beforeUpload
(
file
)
{
...
...
@@ -77,12 +88,8 @@ export default {
.
filter
(
item
=>
{
return
item
[
level
.
value
]
===
'
ν
'
})
.
map
(
item
=>
{
uploadApiService
.
get
(
'
/Wade/GetEhrEmployeeByName
'
,
{
params
:
{
name
:
item
[
'
姓名
'
]
}
})
.
then
(
rest
=>
{
.
map
(
async
item
=>
{
const
rest
=
await
fetchEhrEmployeeByName
(
this
.
baseUrl
,{
name
:
item
[
'
姓名
'
]
})
if
(
rest
.
status
===
200
)
{
if
(
rest
.
data
===
null
||
rest
.
data
.
wade_user_id
===
null
)
{
this
.
$message
({
...
...
@@ -99,28 +106,19 @@ export default {
match_type
:
'
1
'
,
update_user_id
:
this
.
wadeUserID
}
uploadApiService
.
post
(
'
/Wade/CreateCaseLevelList
'
,
params
)
.
then
(
res
=>
{
if
(
res
.
status
===
200
)
{
console
.
log
(
`
${
item
[
level
.
name
]}
isUpload:
${
item
[
'
姓名
'
]}
`
)
item
.
isUpload
=
'
ν
'
this
.
itemkey
=
Math
.
random
()
// 在这边给key赋随机值
this
.
$message
({
type
:
'
success
'
,
message
:
'
新增成功!
'
})
}
})
.
catch
(()
=>
{
this
.
$message
({
type
:
'
error
'
,
message
:
'
新增失败! 已有该笔资料!
'
})
})
const
res
=
await
fetchCaseLevelList
(
this
.
baseUrl
,
params
)
if
(
res
.
status
===
200
)
{
console
.
log
(
`
${
item
[
level
.
name
]}
isUpload:
${
item
[
'
姓名
'
]}
`
)
item
.
isUpload
=
'
ν
'
this
.
itemkey
=
Math
.
random
()
// 在这边给key赋随机值
this
.
$message
({
type
:
'
success
'
,
message
:
'
新增成功!
'
})
}
}
})
})
})
//
})
},
searchitem
(
index
)
{
console
.
log
(
this
.
tableHeader
[
index
])
...
...
utils/uploadAPiService.js
deleted
100644 → 0
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