limengbo hace 5 años
padre
commit
cb5ae535e0
Se han modificado 2 ficheros con 12 adiciones y 7 borrados
  1. 1 0
      src/api/schoolTimetable.js
  2. 11 7
      src/views/uploadTab/index.vue

+ 1 - 0
src/api/schoolTimetable.js

@@ -33,6 +33,7 @@ export function setScheduleWare(data) {
 }
 // 导入表格
 export function upLoad(data) {
+  debugger
   return request({
     url: '/cms/schedule/import',
     method: 'post',

+ 11 - 7
src/views/uploadTab/index.vue

@@ -21,7 +21,6 @@
       <el-upload
         class="image-uploader"
         :multiple="false"
-        :before-upload="beforeUpload"
         :drag="true"
         action=""
         :limit="1"
@@ -39,7 +38,7 @@
   </div>
 </template>
 <script>
-import  { upLoad } from '@/api/schoolTimetable'
+import { upLoad } from '@/api/schoolTimetable'
 export default {
   data() {
     return {
@@ -111,18 +110,23 @@ export default {
       const form = new FormData()
       // 文件对象
       form.append('file', fileObj)
+      for (var value of form.values()) {
+        console.log(value)
+        this.ruleForm.file = value
+      }
       // form.append('comId', this.comId)
-      console.log('-----', form)
-      this.ruleForm.file = form
+      // console.log((JSON.stringify(fileObj))
+      // console.log(JSON.stringify(form.get('file')))
+      // this.ruleForm.file = value
     },
     submitForm(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           console.log(this.ruleForm)
           // alert('submit!')
-        //   upLoad().then(res => {
-        //     console.log(res)
-        //   })
+          upLoad(this.ruleForm).then(res => {
+            console.log(res)
+          })
         } else {
           console.log('error submit!!')
           return false