|
@@ -181,6 +181,7 @@ import Apis from '@/js/api.js'
|
|
|
import ServiceType from '@/constants/enum/service-type.js'
|
|
|
import PlatformType from '@/constants/enum/platform-type.js'
|
|
|
import {notify} from '@/constants/index'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'ProjectAdd',
|
|
|
data () {
|
|
@@ -207,7 +208,7 @@ export default {
|
|
|
price: '',
|
|
|
datetime: ''
|
|
|
},
|
|
|
- excelFile:{},
|
|
|
+ excelFile: {},
|
|
|
rules: {
|
|
|
// name: [
|
|
|
// {required: true, message: '请输入报告名称', trigger: 'blur'}
|
|
@@ -277,15 +278,24 @@ export default {
|
|
|
datetime: this.project.datetime
|
|
|
}
|
|
|
Http.post(Apis.PROJECT.ADD_PROJECT, newProject).then((res) => {
|
|
|
+ notify('success', '项目添加成功')
|
|
|
console.log(res)
|
|
|
+ }).catch(error => {
|
|
|
+ notify('error', error.data.msg)
|
|
|
})
|
|
|
},
|
|
|
submitByFile () {
|
|
|
- const data = {
|
|
|
- file: this.project.file[0]
|
|
|
+ const formData = new FormData()
|
|
|
+ let config = {
|
|
|
+ //添加请求头
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'},
|
|
|
}
|
|
|
- Http.post(Apis.PROJECT.ADD_PROJECT_BY_EXCEL, data).then((res) => {
|
|
|
+ formData.append('file', this.excelFile)
|
|
|
+ Http.upload(Apis.PROJECT.ADD_PROJECT_BY_EXCEL, formData,config).then((res) => {
|
|
|
console.log(res)
|
|
|
+ notify('success', '项目添加成功')
|
|
|
+ }).catch(error => {
|
|
|
+ notify('error', error.data.msg)
|
|
|
})
|
|
|
},
|
|
|
// cancelModify () {
|