完成上传参航人员功能
This commit is contained in:
parent
d8ed778408
commit
68e1e34367
|
|
@ -284,3 +284,13 @@ export function voyageRegPeopleEdit(data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 上传参航人员文件
|
||||
export function voyageRegPeopleUpload(data) {
|
||||
return request({
|
||||
url: '/voyage/member/upload.htm',
|
||||
method: 'post',
|
||||
type: 'multipart/form-data',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,6 +238,18 @@
|
|||
</el-dialog>
|
||||
<!-- 上传参航人员-->
|
||||
<el-dialog title="参航人员信息" :visible.sync="openPeople" :before-close="cancelPeople" width="1000px" append-to-body>
|
||||
<div style="margin-bottom: 15px; text-align: right">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
action="action"
|
||||
:multiple="false"
|
||||
:show-file-list="false"
|
||||
:http-request="uploadPeople"
|
||||
:before-upload="beforeUploadPeople"
|
||||
>
|
||||
<el-button :loading="loadingPeopleBtn" type="primary">{{ textPeople }}</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
<el-card class="box-card" v-show="showForm" >
|
||||
<el-form ref="formPeople" :model="formPeople" :rules="rulesPeople" label-width="100px">
|
||||
<el-row>
|
||||
|
|
@ -335,7 +347,7 @@ import {
|
|||
voyageRegNav,
|
||||
uploadNavigation,
|
||||
voyageRegPeople,
|
||||
voyageRegPeopleDelete, voyageRegPeopleEdit
|
||||
voyageRegPeopleDelete, voyageRegPeopleEdit, voyageRegPeopleUpload
|
||||
} from '@/api/dataTransfer'
|
||||
import { time } from '@/utils/validate'
|
||||
|
||||
|
|
@ -435,6 +447,8 @@ export default {
|
|||
formPeople: {},
|
||||
rulesPeople: {},
|
||||
sexOptions: ['男', '女', '保密'],
|
||||
textPeople: '上传参航人员',
|
||||
loadingPeopleBtn: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -726,6 +740,32 @@ export default {
|
|||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
beforeUploadPeople(file) { // 上传文件之前钩子
|
||||
const type = file.name.split('.')[1]
|
||||
if (type !== 'xlsx') {
|
||||
this.$message({ type: 'error', message: '只支持xlsx文件格式!' })
|
||||
return false
|
||||
}
|
||||
},
|
||||
uploadPeople(param) {
|
||||
this.loadingPeopleBtn = true
|
||||
this.textPeople = '数据处理中'
|
||||
const formData = new FormData()
|
||||
this.formNav.navName = param.file.name
|
||||
formData.append('file', param.file)
|
||||
formData.append('voyage_id', this.id)
|
||||
voyageRegPeopleUpload(formData).then(res => {
|
||||
if (res.errorCode === 0) {
|
||||
this.loadingPeopleBtn = false
|
||||
this.textPeople = '上传参航人员'
|
||||
this.$message.success('导入成功!')
|
||||
this.getPeopleList()
|
||||
}
|
||||
}).cache(() => {
|
||||
this.loadingPeopleBtn = false
|
||||
this.textPeople = '上传参航人员'
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
dynamicTags2(arr) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue