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 diff is collapsed.
.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 diff is collapsed.
This diff is collapsed.
...@@ -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,21 +73,12 @@ export default { ...@@ -73,21 +73,12 @@ 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', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
...@@ -97,24 +88,17 @@ export default { ...@@ -97,24 +88,17 @@ export default {
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) 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,21 +77,12 @@ export default { ...@@ -77,21 +77,12 @@ 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', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
...@@ -101,18 +92,11 @@ export default { ...@@ -101,18 +92,11 @@ export default {
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) 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) {
......
...@@ -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,21 +73,12 @@ export default { ...@@ -73,21 +73,12 @@ 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)
.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', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
...@@ -97,18 +88,11 @@ export default { ...@@ -97,18 +88,11 @@ export default {
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) 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) {
......
...@@ -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,21 +147,12 @@ export default { ...@@ -147,21 +147,12 @@ 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', {
params: {
fileName: excelFileName
},
responseType: 'blob'
})
.then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
...@@ -171,18 +162,12 @@ export default { ...@@ -171,18 +162,12 @@ export default {
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) 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) {
......
...@@ -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,14 +187,10 @@ export default { ...@@ -175,14 +187,10 @@ 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
downloadFile({ const response = downloadFile(this.baseUrl,{fileName: excelFileName})
fileName: excelFileName
})
.then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
...@@ -192,14 +200,12 @@ export default { ...@@ -192,14 +200,12 @@ export default {
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href) window.URL.revokeObjectURL(href)
})
} else { } else {
this.$message.error('下载档案失败!') this.$message.error('下载档案失败!')
} }
console.log(res.data) 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,15 +216,10 @@ export default { ...@@ -210,15 +216,10 @@ 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
// debugger const response = downloadFile(this.baseUrl,{fileName: excelFileName})
downloadFile({
fileName: excelFileName
})
.then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
...@@ -228,12 +229,10 @@ export default { ...@@ -228,12 +229,10 @@ export default {
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href) window.URL.revokeObjectURL(href)
})
} else { } else {
this.$message.error('下载档案失败!') this.$message.error('下载档案失败!')
} }
console.log(res.data) 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,9 +106,7 @@ export default { ...@@ -99,9 +106,7 @@ 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)
.then(res => {
if (res.status === 200) { if (res.status === 200) {
console.log( console.log(
`${item[level.name]} isUpload: ${item['姓名']}` `${item[level.name]} isUpload: ${item['姓名']}`
...@@ -110,17 +115,10 @@ export default { ...@@ -110,17 +115,10 @@ export default {
this.itemkey = Math.random() // 在这边给key赋随机值 this.itemkey = Math.random() // 在这边给key赋随机值
this.$message({ type: 'success', message: '新增成功!' }) 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