Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web
continuous-integration/drone/push Build is passing Details

uat_us
DESKTOP-6C3NK6N\WXS 2024-09-24 14:02:17 +08:00
commit dc60a1ca4a
3 changed files with 151 additions and 2 deletions

View File

@ -209,3 +209,11 @@ export function getIVUSTemplate(param) {
data: param
})
}
export function uploadIVUSTemplate(param) {
return request({
url: `/IVUSCalculate/uploadIVUSTemplate`,
method: 'post',
data: param
})
}

View File

@ -49,7 +49,7 @@
<div class="add-icon" @click.prevent="downloadTpl">
<i class="el-icon-download" />
</div>
<div class="add-icon" style="margin: 0 5px;">
<div class="add-icon" style="margin: 0 5px;" @click.prevent="uploadTpl">
<i class="el-icon-upload2" />
</div>
<div class="add-icon" @click.prevent="handleAddOrEdit('add',item)">
@ -198,6 +198,19 @@
</el-form-item>
</el-form>
</el-dialog>
<!-- 导入 -->
<el-dialog
v-if="upload.visible"
:visible.sync="upload.visible"
:close-on-click-modal="false"
:title="upload.title"
width="500px"
>
<UploadExcel
:visit-task-id="visitTaskId"
@close="uploadDlgClose"
/>
</el-dialog>
</div>
</div>
</template>
@ -209,11 +222,13 @@ import store from '@/store'
import { mapGetters } from 'vuex'
import Questions from './../Questions'
import QuestionTableFormItem from './QuestionTableFormItem'
import UploadExcel from './UploadExcel'
export default {
name: 'MeasurementList',
components: {
Questions,
QuestionTableFormItem
QuestionTableFormItem,
UploadExcel
},
props: {
isShow: {
@ -254,6 +269,7 @@ export default {
formChanged: false,
digitPlaces: 2,
addOrEdit: { visible: false, title: '' },
upload: { visible: false, title: '导入' },
qsList: [],
answersList: [],
qsForm: {},
@ -669,6 +685,9 @@ export default {
console.log(e)
}
},
uploadTpl() {
this.upload.visible = true
},
async downloadTpl() {
try {
const params = {
@ -679,6 +698,11 @@ export default {
console.log(e)
}
},
async uploadDlgClose() {
await this.getReadingQuestionAndAnswer(this.visitTaskId)
DicomEvent.$emit('getReportInfo', true)
this.upload.visible = false
},
renderHeader(h, { column, $index }) {
const span = document.createElement('span')
span.innerText = column.label

View File

@ -0,0 +1,117 @@
<template>
<el-form
ref="uploadExcel"
class="upload-excel-file"
>
<!-- 文件 -->
<el-form-item :label="$t('trials:consistencyCheck:label:file')">
<div class="upload-container">
<el-upload
class="upload-demo"
action
accept=".xlsx,.xls,.csv"
:before-upload="beforeUpload"
:http-request="handleUploadFile"
:on-preview="handlePreview"
:show-file-list="true"
:limit="1"
:on-exceed="handleExceed"
>
<el-button size="small" type="primary">
{{ $t('trials:consistencyCheck:dialogButton:upload') }}
</el-button>
<span
slot="tip"
style="margin-left:10px;"
class="el-upload__tip"
>
({{ $t('trials:consistencyCheck:message:excelFileOnly') }})
</span>
</el-upload>
</div>
</el-form-item>
</el-form>
</template>
<script>
import { uploadIVUSTemplate } from '@/api/reading'
export default {
props: {
visitTaskId: {
type: String,
required: true
}
},
data() {
return {
}
},
methods: {
beforeUpload(file) {
//
if (this.checkFileSuffix(file.name)) {
return true
} else {
// Must be xls or xlsx format
this.$alert(this.$t('trials:consistencyCheck:message:xlsx'))
return false
}
},
async handleUploadFile(param) {
const loading = this.$loading({ fullscreen: true })
try {
var data = new FormData()
data.append('file', param.file)
data.append('visitTaskId', this.visitTaskId)
await uploadIVUSTemplate(data)
this.$emit('close')
this.$message.success('导入成功!')
loading.close()
} catch (e) {
loading.close()
console.log(e)
}
},
handlePreview(file) {
if (file.fullPath) {
window.open(file.fullPath, '_blank')
}
},
handleExceed(files, fileList) {
// Upload is currently limited to 1 file
this.$message.warning(this.$t('trials:consistencyCheck:message:onlyOneFile'))
},
checkFileSuffix(fileName) {
var typeArr = ['xls', 'xlsx', 'csv']
var extendName = fileName.substring(fileName.lastIndexOf('.') + 1).toLocaleLowerCase()
if (typeArr.indexOf(extendName) !== -1) {
return true
} else {
return false
}
}
}
}
</script>
<style lang="scss">
.upload-excel-file{
.upload-container .el-upload--text {
border: none;
width: 80px;
height: 40px;
}
.upload-container .el-input--small {
margin-bottom: 5px;
}
.upload-container .el-icon-circle-check {
color: #428bca;
font-size: 13px;
}
.account_item_clear{
.el-tag__close{
display: none !important;
}
}
}
</style>