|
@@ -104,8 +104,8 @@
|
|
|
:before-remove="beforeRemove"
|
|
|
:limit="1"
|
|
|
:on-exceed="handleExceed"
|
|
|
- :before-upload="beforeFileUpload"
|
|
|
- :http-request="uploadThreePageDoc"
|
|
|
+ :before-upload="beforeThreePageUpload"
|
|
|
+ :http-request="uploadThreePageFile"
|
|
|
:file-list="task.threePageList"
|
|
|
>
|
|
|
<i class="el-icon-upload"></i>
|
|
@@ -451,20 +451,33 @@ export default {
|
|
|
notify('error', '上传失败:' + error.data)
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ beforeThreePageUpload(file) {
|
|
|
+ const isPDF = file.type === 'application/pdf'
|
|
|
+ const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
|
|
+ const isEXCEL = file.type === 'application/vnd.ms-excel'
|
|
|
+ const isXLS = file.type === 'application/x-xls'
|
|
|
+ const isTXT = file.type === 'text/plain'
|
|
|
+ const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
+ if (!(isEXCEL || isXLS || isXLSX)) {
|
|
|
+ this.$message.error('上传文件只能是 XLS、XLSX 格式!')
|
|
|
+ }
|
|
|
+ return isEXCEL || isXLS || isXLSX
|
|
|
+ },
|
|
|
//todo:上传测试大纲
|
|
|
- uploadThreePageDoc(param) {
|
|
|
+ uploadThreePageFile(param) {
|
|
|
const formData = new FormData()
|
|
|
let config = {
|
|
|
//添加请求头
|
|
|
headers: {'Content-Type': 'multipart/form-data'},
|
|
|
}
|
|
|
formData.append('file', param.file)
|
|
|
- Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
|
|
|
+ Http.upload(Apis.FILE.THREEPAGE_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
|
|
|
notify('success', '上传成功')
|
|
|
this.task.endPoint.threePageUrl = res.data;
|
|
|
this.$refs.task.validateField('endPoint.threePageUrl');
|
|
|
}).catch((error) => {
|
|
|
- notify('error', '上传失败:' + error.data)
|
|
|
+ notify('error', '上传失败:' + error)
|
|
|
})
|
|
|
},
|
|
|
setServiceType() {
|