sunjh 6 gadi atpakaļ
vecāks
revīzija
6743f565d7

+ 20 - 7
src/components/project/Project.vue

@@ -154,7 +154,7 @@
             :before-remove="beforeRemove"
             :limit="1"
             :on-exceed="handleExceed"
-            :before-upload="beforeFileUpload"
+            :before-upload="beforeApkUpload"
             :http-request="uploadApkFile"
             :file-list="project.file"
           >
@@ -248,8 +248,7 @@
     <div class="create-body" v-if="!isModifyMode">
       <div class="title h2">任务列表</div>
       <div class="task-list">
-        <el-table :showHeader="true" :stripe="true" :data="task" style="width: 100%;min-height: 200px"
-                  max-height="800px">
+        <el-table :showHeader="true" :stripe="true" :data="task" style="width: 100%">
           <el-table-column prop="title" label="任务名称" title="任务名称"></el-table-column>
           <el-table-column prop="datetime" sortable label="任务截止时间"></el-table-column>
           <el-table-column prop="resource" label="任务可见性">
@@ -415,7 +414,7 @@ export default {
   watch: {
     'project.institution' () {
       if (this.project.institution) {
-        this.$refs.addFormProvince.resetProviceCity()
+        //this.$refs.addFormProvince.resetProviceCity()
         this.project.location = {provinceCode: '', cityCode: ''}
       }
     },
@@ -562,14 +561,28 @@ export default {
     handleDelete (index, id) {
       this.task.splice(index, 1)
     },
-    beforeFileUpload (file) {
+    beforeApkUpload (file) {
       const isAPK = file.type === 'application/vnd.android.package-archive'
       const isDMG = file.type === 'application/octet-stream'
 
       if (!isAPK && !isDMG) {
         this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
       }
-      return isAPK && isDMG
+      return isAPK || isDMG
+    },
+    beforeFileUpload (file) {
+      console.log(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'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
     },
     analyseDemand () {
       this.$router.push({name: 'AnalyseDemand'})
@@ -622,7 +635,7 @@ export default {
       )
     },
     beforeRemove (file, fileList) {
-      return this.$confirm(`确定移除 ${file.name}?`)
+      //return this.$confirm(`确定移除 ${file.name}?`)
     },
     uploadRequireDoc (param) {
       const formData = new FormData()

+ 36 - 20
src/components/project/ProjectCreate.vue

@@ -114,10 +114,9 @@
             class="upload-demo"
             action=""
             :on-remove="handleRemove"
-            :before-remove="beforeRemove"
             :limit="1"
             :on-exceed="handleExceed"
-            :before-upload="beforeFileUpload"
+            :before-upload="beforeApkUpload"
             :http-request="uploadApkFile"
             :file-list="project.file"
           >
@@ -151,7 +150,6 @@
 
 <script>
 import Enum from '@/constants/enum/index'
-import PlatformType from '@/constants/enum/platform-type'
 import Http from '@/js/http.js'
 import Apis from '@/js/api.js'
 import provincecity from '@/components/commons/ProvinceCity'
@@ -189,8 +187,10 @@ export default {
         type: [],
         platform: [],
         desc: '',
-        doc: '123',
-        file: '123',
+        doc: [],
+        file: [],
+        requireDocUrl: '',
+        fileUrl: '',
         resource: '0',
         location: {provinceCode: '3200', cityCode: '3201'},
         institution: '',
@@ -307,13 +307,13 @@ export default {
       }
     },
     init () {
-      this.project.platform.map(item => {
-        this.platformType.push(PlatformType[item])
-      })
+      // this.project.platform.map(item => {
+      //   this.platformType.push(PlatformType[item])
+      // })
     },
     submitForm (formName) {
       Http.post(Apis.PROJECT.CREATE_PROJECT, this.project).then((res) => {
-        console.log(res.status)
+        //console.log(res.status)
         if (window.history.length <= 1) {
           this.$router.push({path: '/'})
           return false
@@ -351,14 +351,28 @@ export default {
       this.project.usage = ''
       this.project.budget = ''
     },
+    beforeApkUpload (file) {
+      const isAPK = file.type === 'application/vnd.android.package-archive'
+      const isDMG = file.type === 'application/octet-stream'
+
+      if (!isAPK && !isDMG) {
+        this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
+      }
+      return isAPK || isDMG
+    },
     beforeFileUpload (file) {
-      // const isAPK = file.type === 'application/vnd.android.package-archive'
-      // const isDMG = file.type === 'application/octet-stream'
-      //
-      // if (!isAPK && !isDMG) {
-      //   this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
-      // }
-      // return isAPK && isDMG
+      console.log(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'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
     },
     loadData () {
       Http.get(Apis.PAGE.PROJECT_DETAIL_PAGE).then((res) => {
@@ -366,7 +380,7 @@ export default {
       })
     },
     handleRemove (file, fileList) {
-      console.log(file, fileList)
+      //console.log(file, fileList)
     },
     handleExceed (files, fileList) {
       this.$message.warning(
@@ -376,7 +390,7 @@ export default {
       )
     },
     beforeRemove (file, fileList) {
-      return this.$confirm(`确定移除 ${file.name}?`)
+      //return this.$confirm(`确定移除 ${file.name}?`)
     },
     uploadRequireDoc (param) {
       const formData = new FormData()
@@ -386,10 +400,12 @@ export default {
       }
       formData.append('file', param.file)
       Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', 3), formData, config).then((res) => {
-        console.log('上传成功')
+        //console.log('上传成功')
         this.project.requireDocUrl = res.data
-        console.log(res.data)
+        console.log(this.project.doc)
+        //console.log(res.data)
       })
+
     },
     uploadApkFile (param) {
       const formData = new FormData()

+ 14 - 2
src/components/report/Report.vue

@@ -203,9 +203,21 @@ export default {
       )
     },
     beforeRemove (file, fileList) {
-      return this.$confirm(`确定移除 ${file.name}?`)
+      //return this.$confirm(`确定移除 ${file.name}?`)
     },
-    beforeFileUpload () {
+    beforeFileUpload (file) {
+      console.log(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'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
     },
     back () {
       if (window.history.length <= 1) {

+ 14 - 2
src/components/report/ReportCreate.vue

@@ -192,9 +192,21 @@ export default {
       )
     },
     beforeRemove (file, fileList) {
-      return this.$confirm(`确定移除 ${file.name}?`)
+      //return this.$confirm(`确定移除 ${file.name}?`)
     },
-    beforeFileUpload () {
+    beforeFileUpload (file) {
+      console.log(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'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
     },
     loadData () {
     },

+ 14 - 3
src/components/task/Task.vue

@@ -383,10 +383,21 @@ export default {
       )
     },
     beforeRemove (file, fileList) {
-      return this.$confirm(`确定移除 ${file.name}?`)
+      //return this.$confirm(`确定移除 ${file.name}?`)
     },
-    beforeFileUpload () {
-
+    beforeFileUpload (file) {
+      console.log(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'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
     },
     uploadProjectCreateExcelFile (param) {
       const formData = new FormData()

+ 14 - 3
src/components/task/TaskCreate.vue

@@ -303,10 +303,21 @@ export default {
       )
     },
     beforeRemove (file, fileList) {
-      return this.$confirm(`确定移除 ${file.name}?`)
+      //return this.$confirm(`确定移除 ${file.name}?`)
     },
-    beforeFileUpload () {
-
+    beforeFileUpload (file) {
+      console.log(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'
+      //console.log(file)
+      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
+        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
+      }
+      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
     },
     uploadProjectCreateExcelFile (param) {
       const formData = new FormData()