Commit ac677587 authored by shuaiqiang's avatar shuaiqiang 🇨🇳

refactor:调整结构

parent 229f4b7a
...@@ -27,11 +27,21 @@ export function fetchPctToCn(baseURL, data) { ...@@ -27,11 +27,21 @@ export function fetchPctToCn(baseURL, data) {
}) })
} }
// export function fetchConvertEquations(baseURL, data) { export function fetchConvertEquations(baseURL, data) {
// return service({ return service({
// baseURL: baseURL, baseURL: baseURL,
// url: 'Word/ConvertEquations', url: 'Word/ConvertEquations',
// method: 'POST', method: 'POST',
// data data
// }) })
// } }
\ No newline at end of file
export function fetchDownloadFile(baseURL, params) {
return service({
baseURL: baseURL,
url: 'RequestPayment/DownloadFile',
method: 'get',
responseType: 'blob',
params
})
}
\ No newline at end of file
import service from '@utils/requestService' import service from '@utils/requestService'
export function createHxRequestPaymentVerticalTotal(data) { export function createHxRequestPaymentVerticalTotal(baseURL, data) {
return service({ return service({
baseURL: baseURL,
url: 'api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal', url: 'api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal',
method: 'POST', method: 'POST',
data data
}) })
} }
export function createHxRequestPaymentVerticalTotal2(data) { export function createHxRequestPaymentVerticalTotal2(baseURL, data) {
return service({ return service({
baseURL: baseURL,
url: 'api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal2', url: 'api/v1.0/RequestPayment/ChangeHXRequestPaymentVerticalTotal2',
method: 'POST', method: 'POST',
data data
}) })
} }
export function downloadFile(params) { export function downloadFile(baseURL,params) {
return service({ return service({
baseURL:baseURL,
url: 'api/v1.0/RequestPayment/DownloadFile', url: 'api/v1.0/RequestPayment/DownloadFile',
method: 'GET', method: 'GET',
params, params,
......
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
...@@ -6,10 +6,8 @@ module.exports = { ...@@ -6,10 +6,8 @@ module.exports = {
VUE_APP_GRAPHAPI_URL: 'https://pvapi.purplevineip.com/graphAPI/api/v1.0/' VUE_APP_GRAPHAPI_URL: 'https://pvapi.purplevineip.com/graphAPI/api/v1.0/'
}, },
prod_test_sz: { prod_test_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/' VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/',
}, VUE_FILE_URL: 'https://dev.essenptl.com/dev2/wade_ext/'
prod_file_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/dev2/wade_ext/'
}, },
dev_tp: { dev_tp: {
VUE_APP_GRAPHAPI_URL: 'http://localhost:64224/api/v1.0/' VUE_APP_GRAPHAPI_URL: 'http://localhost:64224/api/v1.0/'
...@@ -22,11 +20,6 @@ module.exports = { ...@@ -22,11 +20,6 @@ module.exports = {
}, },
dev_test_sz: { dev_test_sz: {
VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/', VUE_APP_GRAPHAPI_URL: 'https://dev.essenptl.com/graphAPITest/api/v1.0/',
}, VUE_FILE_URL: 'https://dev.essenptl.com/dev2/wade_ext/'
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/'
} }
} }
\ No newline at end of file
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<pLink type="primary">Test</pLink> <pLink type="primary">Test</pLink>
<splitTool env="dev_test_sz"></splitTool> <splitTool env="dev_test_sz"></splitTool>
<convertTool env="dev_test_sz"></convertTool> <convertTool env="dev_test_sz"></convertTool>
<fileSplit env="dev_file_sz"></fileSplit> <fileSplit env="dev_test_sz"></fileSplit>
<upload env="dev_file_sz"></upload> <upload env="dev_test_sz"></upload>
<uploadExcel env="dev_test_sz"></uploadExcel> <uploadExcel env="dev_test_sz"></uploadExcel>
</div> </div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
.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} .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 \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</div> </div>
</template> </template>
<script> <script>
import GraphApiService from '@utils/GraphApiService' import { fetchCnToCpc,fetchDownloadFile } from "@api/convertApi"
export default { export default {
name: 'Cn2CpcForm', name: 'Cn2CpcForm',
data: function() { data: function() {
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
}, },
methods: { methods: {
// 上传到服务器 // 上传到服务器
submitUpload() { async submitUpload() {
console.log(this.fileList) console.log(this.fileList)
if (this.fileList.length <= 0) { if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!') this.$message.error('请先选择需要上传的文件!')
...@@ -73,48 +73,32 @@ export default { ...@@ -73,48 +73,32 @@ export default {
this.fileList.forEach(e => { this.fileList.forEach(e => {
formData.append('file', e.raw) formData.append('file', e.raw)
}) })
GraphApiService const res = await fetchCnToCpc(this.baseUrl, formData)
.post('Word/CN2CPC', formData)
.then(res => {
if (res.status === 200) { if (res.status === 200) {
this.fileList = [] this.fileList = []
this.$refs.upload.clearFiles() this.$refs.upload.clearFiles()
const excelFileName = res.data const excelFileName = res.data
GraphApiService const response = await fetchDownloadFile(this.baseUrl,{fileName: excelFileName})
.get('RequestPayment/DownloadFile', { const blob = new Blob([response])
params: { const downloadElement = document.createElement('a')
fileName: excelFileName const href = window.URL.createObjectURL(blob)
}, downloadElement.href = href
responseType: 'blob' downloadElement.download = excelFileName.split('/')[1]
}) document.body.appendChild(downloadElement)
.then(response => { downloadElement.click()
const blob = new Blob([response]) document.body.removeChild(downloadElement)
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) window.URL.revokeObjectURL(href)
}) // })
} else { } else {
this.$refs.upload.abort() this.$refs.upload.abort()
this.$message.error('下载档案失败!') this.$message.error('下载档案失败!')
} }
console.log(res.data) console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
}, },
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用 // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) { handelFileChange(file, fileList) {
// 存在文件标识 // 存在文件标识
let existsFileFlag = false let existsFileFlag = false
for (let i = 0; i < this.fileList.length; i++) { for (let i = 0; i < this.fileList.length; i++) {
if ( if (
file.name === this.fileList[i].name && file.name === this.fileList[i].name &&
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</div> </div>
</template> </template>
<script> <script>
import GraphApiService from '@utils/GraphApiService' import {fetchCntToPct,fetchDownloadFile} from "@api/convertApi"
export default { export default {
name: 'Cn2PctForm', name: 'Cn2PctForm',
data: function() { data: function() {
...@@ -77,42 +77,26 @@ export default { ...@@ -77,42 +77,26 @@ export default {
this.fileList.forEach(e => { this.fileList.forEach(e => {
formData.append('file', e.raw) formData.append('file', e.raw)
}) })
GraphApiService const res = await fetchCntToPct(this.baseUrl,formData)
.post('Word/CN2PCT', formData)
.then(res => {
if (res.status === 200) { if (res.status === 200) {
this.fileList = [] this.fileList = []
this.$refs.upload.clearFiles() this.$refs.upload.clearFiles()
const excelFileName = res.data const excelFileName = res.data
GraphApiService const response = await fetchDownloadFile(this.baseUrl,{fileName: excelFileName})
.get('RequestPayment/DownloadFile', { const blob = new Blob([response])
params: { const downloadElement = document.createElement('a')
fileName: excelFileName const href = window.URL.createObjectURL(blob)
}, downloadElement.href = href
responseType: 'blob' downloadElement.download = excelFileName.split('/')[1]
}) document.body.appendChild(downloadElement)
.then(response => { downloadElement.click()
const blob = new Blob([response]) document.body.removeChild(downloadElement)
const downloadElement = document.createElement('a') window.URL.revokeObjectURL(href)
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 { } else {
this.$refs.upload.abort() this.$refs.upload.abort()
this.$message.error('下载档案失败!') this.$message.error('下载档案失败!')
} }
console.log(res.data) console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
}, },
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用 // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) { handelFileChange(file, fileList) {
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</div> </div>
</template> </template>
<script> <script>
import GraphApiService from '@utils/GraphApiService' import { fetchPctToCn,fetchDownloadFile } from "@api/convertApi"
export default { export default {
name: 'Cn2CpcForm', name: 'Cn2CpcForm',
data: function() { data: function() {
...@@ -73,42 +73,26 @@ export default { ...@@ -73,42 +73,26 @@ export default {
this.fileList.forEach(e => { this.fileList.forEach(e => {
formData.append('file', e.raw) formData.append('file', e.raw)
}) })
GraphApiService const res = await fetchPctToCn(this.baseUrl,formData)
.post('Word/PCT2CN', formData) if (res.status === 200) {
.then(res => { this.fileList = []
if (res.status === 200) { this.$refs.upload.clearFiles()
this.fileList = [] const excelFileName = res.data
this.$refs.upload.clearFiles() const response = await fetchDownloadFile(this.baseUrl,{fileName: excelFileName})
const excelFileName = res.data const blob = new Blob([response])
GraphApiService const downloadElement = document.createElement('a')
.get('RequestPayment/DownloadFile', { const href = window.URL.createObjectURL(blob)
params: { downloadElement.href = href
fileName: excelFileName downloadElement.download = excelFileName.split('/')[1]
}, document.body.appendChild(downloadElement)
responseType: 'blob' downloadElement.click()
}) document.body.removeChild(downloadElement)
.then(response => { window.URL.revokeObjectURL(href)
const blob = new Blob([response]) } else {
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.$refs.upload.abort()
this.$message.error('下载档案失败!') this.$message.error('下载档案失败!')
}) }
console.log(res.data)
}, },
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用 // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) { handelFileChange(file, fileList) {
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
</div> </div>
</template> </template>
<script> <script>
import GraphApiService from '@utils/GraphApiService' import {fetchConvertEquations,fetchDownloadFile} from "@api/convertApi"
export default { export default {
name: 'VisioForm', name: 'VisioForm',
data: function() { data: function() {
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
}, },
methods: { methods: {
// 上传到服务器 // 上传到服务器
submitUpload() { async submitUpload() {
console.log(this.fileList) console.log(this.fileList)
if (this.fileList.length <= 0) { if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!') this.$message.error('请先选择需要上传的文件!')
...@@ -147,42 +147,27 @@ export default { ...@@ -147,42 +147,27 @@ export default {
formData.append('includeType', this.form.includeType) formData.append('includeType', this.form.includeType)
formData.append('isSetLineHeight', this.form.isSetLineHeight) formData.append('isSetLineHeight', this.form.isSetLineHeight)
formData.append('lineHeight', this.form.lineHeight) formData.append('lineHeight', this.form.lineHeight)
GraphApiService const res = await fetchConvertEquations(this.baseUrl,formData)
.post('Word/ConvertEquations', formData)
.then(res => {
if (res.status === 200) { if (res.status === 200) {
this.fileList = [] this.fileList = []
this.$refs.upload.clearFiles() this.$refs.upload.clearFiles()
const excelFileName = res.data const excelFileName = res.data
GraphApiService const response = await fetchDownloadFile(this.baseUrl,{fileName: excelFileName})
.get('RequestPayment/DownloadFile', { const blob = new Blob([response])
params: { const downloadElement = document.createElement('a')
fileName: excelFileName const href = window.URL.createObjectURL(blob)
}, downloadElement.href = href
responseType: 'blob' downloadElement.download = excelFileName.split('/')[1]
}) document.body.appendChild(downloadElement)
.then(response => { downloadElement.click()
const blob = new Blob([response]) document.body.removeChild(downloadElement)
const downloadElement = document.createElement('a') window.URL.revokeObjectURL(href)
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 { } else {
this.$refs.upload.abort() this.$refs.upload.abort()
this.$message.error('下载档案失败!') this.$message.error('下载档案失败!')
} }
console.log(res.data) console.log(res.data)
})
.catch(error => {
console.log('error', error)
this.$refs.upload.abort()
this.$message.error('下载档案失败!')
})
}, },
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用 // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) { handelFileChange(file, fileList) {
......
...@@ -75,10 +75,8 @@ ...@@ -75,10 +75,8 @@
</div> </div>
</template> </template>
<script> <script>
import { SplitRevisionDoc } from '@api/fileApi' import { SplitRevisionDoc} from '@api/fileApi'
import { mixins } from "../mixin/toolMixin"; import { mixins } from "../mixin/toolMixin";
import service from '@utils/requestService'
export default { export default {
name: 'SplitWordForm', name: 'SplitWordForm',
mixins:["mixins"], mixins:["mixins"],
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
computed:{ computed:{
baseUrl(){ baseUrl(){
console.log('config', config, this.env) console.log('config', config, this.env)
return config[this.env].VUE_APP_GRAPHAPI_URL return config[this.env].VUE_FILE_URL
} }
}, },
} }
......
...@@ -129,11 +129,17 @@ import { ...@@ -129,11 +129,17 @@ import {
createHxRequestPaymentVerticalTotal2, createHxRequestPaymentVerticalTotal2,
downloadFile downloadFile
} }
from '@api/warningReportApi' from '@api/uploadApi'
import moment from 'moment' import moment from 'moment'
import config from '@config/index.js'
export default { export default {
name: 'upload', name: 'upload',
props:{
env:{
type: String,
default: 'prod_sz'
}
},
data: function() { data: function() {
return { return {
activeName: 'first', activeName: 'first',
...@@ -147,6 +153,12 @@ export default { ...@@ -147,6 +153,12 @@ export default {
createMonth: '' createMonth: ''
} }
}, },
computed:{
baseUrl(){
console.log('config', config, this.env)
return config[this.env].VUE_FILE_URL
}
},
created() { created() {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
this.createMonth = moment().format('YYYY年MM月') this.createMonth = moment().format('YYYY年MM月')
...@@ -156,7 +168,7 @@ export default { ...@@ -156,7 +168,7 @@ export default {
this.activeName = tab.name this.activeName = tab.name
}, },
// 上传到服务器 // 上传到服务器
submitUpload() { async submitUpload() {
console.log(this.fileList) console.log(this.fileList)
if (this.fileList.length <= 0) { if (this.fileList.length <= 0) {
this.$message.error('请先选择需要上传的文件!') this.$message.error('请先选择需要上传的文件!')
...@@ -175,31 +187,25 @@ export default { ...@@ -175,31 +187,25 @@ export default {
this.detailFileList.forEach(e => { this.detailFileList.forEach(e => {
formData.append('detailFileList', e.raw) formData.append('detailFileList', e.raw)
}) })
createHxRequestPaymentVerticalTotal(formData) const res = await createHxRequestPaymentVerticalTotal(this.baseUrl, formData)
.then(res => { if (res.status === 200) {
if (res.status === 200) { excelFileName = res.data
excelFileName = res.data const response = downloadFile(this.baseUrl,{fileName: excelFileName})
downloadFile({ const blob = new Blob([response])
fileName: excelFileName const downloadElement = document.createElement('a')
}) const href = window.URL.createObjectURL(blob)
.then(response => { downloadElement.href = href
const blob = new Blob([response]) downloadElement.download = excelFileName.split('/')[1]
const downloadElement = document.createElement('a') document.body.appendChild(downloadElement)
const href = window.URL.createObjectURL(blob) downloadElement.click()
downloadElement.href = href document.body.removeChild(downloadElement)
downloadElement.download = excelFileName.split('/')[1] window.URL.revokeObjectURL(href)
document.body.appendChild(downloadElement) } else {
downloadElement.click() this.$message.error('下载档案失败!')
document.body.removeChild(downloadElement) }
window.URL.revokeObjectURL(href) console.log(res.data)
})
} else {
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
}, },
submitUpload2() { async submitUpload2() {
console.log(this.detailFileList2) console.log(this.detailFileList2)
if (this.detailFileList2.length <= 0) { if (this.detailFileList2.length <= 0) {
this.$message.error('请先选择需要上传的文件!') this.$message.error('请先选择需要上传的文件!')
...@@ -210,30 +216,23 @@ export default { ...@@ -210,30 +216,23 @@ export default {
this.detailFileList2.forEach(e => { this.detailFileList2.forEach(e => {
formData.append('detailFileList', e.raw) formData.append('detailFileList', e.raw)
}) })
createHxRequestPaymentVerticalTotal2(formData) const res = await createHxRequestPaymentVerticalTotal2(this.baseUrl,formData)
.then(res => { if (res.status === 200) {
if (res.status === 200) { excelFileName = res.data
excelFileName = res.data const response = downloadFile(this.baseUrl,{fileName: excelFileName})
// debugger const blob = new Blob([response])
downloadFile({ const downloadElement = document.createElement('a')
fileName: excelFileName const href = window.URL.createObjectURL(blob)
}) downloadElement.href = href
.then(response => { downloadElement.download = excelFileName.split('/')[1]
const blob = new Blob([response]) document.body.appendChild(downloadElement)
const downloadElement = document.createElement('a') downloadElement.click()
const href = window.URL.createObjectURL(blob) document.body.removeChild(downloadElement)
downloadElement.href = href window.URL.revokeObjectURL(href)
downloadElement.download = excelFileName.split('/')[1] } else {
document.body.appendChild(downloadElement) this.$message.error('下载档案失败!')
downloadElement.click() }
document.body.removeChild(downloadElement) console.log(res.data)
window.URL.revokeObjectURL(href)
})
} else {
this.$message.error('下载档案失败!')
}
console.log(res.data)
})
}, },
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用 // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
handelFileChange(file, fileList) { handelFileChange(file, fileList) {
......
...@@ -25,10 +25,17 @@ ...@@ -25,10 +25,17 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import UploadExcelComponent from './components/UploadExcel.vue' 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 { export default {
name:'uploadExcel', name:'uploadExcel',
components: { UploadExcelComponent }, components: { UploadExcelComponent },
props:{
env:{
type: String,
default: 'prod_sz'
}
},
data() { data() {
return { return {
tableData: [], tableData: [],
...@@ -42,7 +49,11 @@ export default { ...@@ -42,7 +49,11 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters('user/', ['wadeUserID']) ...mapGetters('user/', ['wadeUserID']),
baseUrl(){
console.log('config', config, this.env)
return config[this.env].VUE_APP_GRAPHAPI_URL
}
}, },
methods: { methods: {
beforeUpload(file) { beforeUpload(file) {
...@@ -77,12 +88,8 @@ export default { ...@@ -77,12 +88,8 @@ export default {
.filter(item => { .filter(item => {
return item[level.value] === 'ν' return item[level.value] === 'ν'
}) })
.map(item => { .map(async item => {
uploadApiService const rest = await fetchEhrEmployeeByName(this.baseUrl,{ name: item['姓名'] })
.get('/Wade/GetEhrEmployeeByName', {
params: { name: item['姓名'] }
})
.then(rest => {
if (rest.status === 200) { if (rest.status === 200) {
if (rest.data === null || rest.data.wade_user_id === null) { if (rest.data === null || rest.data.wade_user_id === null) {
this.$message({ this.$message({
...@@ -99,28 +106,19 @@ export default { ...@@ -99,28 +106,19 @@ export default {
match_type: '1', match_type: '1',
update_user_id: this.wadeUserID update_user_id: this.wadeUserID
} }
uploadApiService const res = await fetchCaseLevelList(this.baseUrl,params)
.post('/Wade/CreateCaseLevelList', params) if (res.status === 200) {
.then(res => { console.log(
if (res.status === 200) { `${item[level.name]} isUpload: ${item['姓名']}`
console.log( )
`${item[level.name]} isUpload: ${item['姓名']}` item.isUpload = 'ν'
) this.itemkey = Math.random() // 在这边给key赋随机值
item.isUpload = 'ν' this.$message({ type: 'success', message: '新增成功!' })
this.itemkey = Math.random() // 在这边给key赋随机值 }
this.$message({ type: 'success', message: '新增成功!' })
}
})
.catch(() => {
this.$message({
type: 'error',
message: '新增失败! 已有该笔资料!'
})
})
} }
}) })
}) })
}) // })
}, },
searchitem(index) { searchitem(index) {
console.log(this.tableHeader[index]) console.log(this.tableHeader[index])
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment