sunjh 6 years ago
parent
commit
f2b60b3f70
1 changed files with 139 additions and 40 deletions
  1. 139 40
      src/components/cheat/ProjectAdd.vue

+ 139 - 40
src/components/cheat/ProjectAdd.vue

@@ -165,7 +165,7 @@
               <!--</div>-->
             </el-form-item>
             <el-form-item v-if="isModifyMode">
-              <div class="btn btn-primary btn-info" @click="submitByFile()">确认提交</div>
+              <div class="btn btn-primary btn-info" @click="ensureSubmitExcel()">确认提交</div>
             </el-form-item>
           </el-form>
           <el-dialog
@@ -176,40 +176,40 @@
             center>
         <span>
           <el-table
-            :data="tableData"
+            :data="projectList"
             style="width: auto">
       <el-table-column
-        prop="date"
+        prop="projectDetails.name"
         label="项目名称">
       </el-table-column>
-      <el-table-column
-        prop="name"
-        label="项目测试平台">
-      </el-table-column>
-      <el-table-column
-        prop="address"
-        label="项目联系人">
-      </el-table-column>
             <el-table-column
-              prop="address"
+              prop="projectDetails.platform"
+              label="项目测试平台">
+            </el-table-column>
+            <el-table-column
+              prop="projectDetails.contactName"
+              label="项目联系人">
+            </el-table-column>
+            <el-table-column
+              prop="projectDetails.contactPhone"
               label="联系方式">
-      </el-table-column>
+            </el-table-column>
             <el-table-column
-              prop="address"
+              prop="projectDetails.type"
               label="项目测试类型">
-      </el-table-column>
+            </el-table-column>
             <el-table-column
-              prop="address"
+              prop="projectDetails.desc"
               label="项目需求描述">
-      </el-table-column>
+            </el-table-column>
             <el-table-column
-              prop="address"
+              prop="projectDetails.desc"
               label="测试报告内容">
-      </el-table-column>
+            </el-table-column>
             <el-table-column
-              prop="address"
+              prop="projectDetails.desc"
               label="测试报告结论">
-      </el-table-column>
+            </el-table-column>
     </el-table>
         </span>
             <span slot="footer" class="dialog-footer">
@@ -259,7 +259,104 @@ export default {
         price: '',
         datetime: ''
       },
-      projectList: [],
+      projectList: [
+        {
+          'projectDetails': {
+            'id': 'PROJECT-2019081319025',
+            'name': '网易云测试',
+            'contactName': '孙加辉',
+            'contactPhone': '13628972489',
+            'type': [
+              1
+            ],
+            'platform': [
+              1,
+              0
+            ],
+            'desc': '无',
+            'doc': '',
+            'file': '',
+            'resource': 1,
+            'location': {
+              'provinceCode': '江苏',
+              'cityCode': '南京'
+            },
+            'institution': 1,
+            'datetime': '2019-08-13T11:14:08.192+0000',
+            'price': 30000.0,
+            'budget': 30000.0,
+            'usage': null
+          },
+          'taskList': [
+            {
+              'id': 'TASK-LDSM-2019081319013',
+              'projectId': 'PROJECT-2019081319025',
+              'title': '网易云测试-安全漏洞扫描',
+              'description': null,
+              'quotePrice': 30000.0,
+              'fixedPrice': 30000.0,
+              'resource': 0,
+              'location': {
+                'provinceCode': '江苏',
+                'cityCode': '南京'
+              },
+              'institution': 1,
+              'serviceType': 1,
+              'status': 5,
+              'datetime': '2019-08-13T11:14:08.192+0000'
+            }
+          ],
+          'reportList': null
+        },
+        {
+          'projectDetails': {
+            'id': 'PROJECT-2019081319026',
+            'name': '网易测试',
+            'contactName': '孙加辉',
+            'contactPhone': '0797-8877663',
+            'type': [
+              4,
+              3
+            ],
+            'platform': [
+              2
+            ],
+            'desc': '无',
+            'doc': '',
+            'file': '',
+            'resource': 1,
+            'location': {
+              'provinceCode': '江苏',
+              'cityCode': '南京'
+            },
+            'institution': 1,
+            'datetime': '2019-08-13T11:14:08.194+0000',
+            'price': 30000.0,
+            'budget': 30000.0,
+            'usage': null
+          },
+          'taskList': [
+            {
+              'id': 'TASK-GNCS-2019081319006',
+              'projectId': 'PROJECT-2019081319026',
+              'title': '网易测试-功能测试',
+              'description': null,
+              'quotePrice': 30000.0,
+              'fixedPrice': 30000.0,
+              'resource': 0,
+              'location': {
+                'provinceCode': '江苏',
+                'cityCode': '南京'
+              },
+              'institution': 1,
+              'serviceType': 4,
+              'status': 5,
+              'datetime': '2019-08-13T11:14:08.194+0000'
+            }
+          ],
+          'reportList': null
+        }
+      ],
       excelFile: {},
       rules: {
         // name: [
@@ -354,22 +451,6 @@ export default {
         notify('error', error.data.msg)
       })
     },
-    submitByFile () {
-      const formData = new FormData()
-      let config = {
-        //添加请求头
-        headers: {'Content-Type': 'multipart/form-data'},
-      }
-      formData.append('file', this.excelFile)
-      this.showDialog()
-      // Http.upload(Apis.PROJECT.ADD_PROJECT_BY_EXCEL, formData, config).then((res) => {
-      //   console.log(res)
-      //   this.projectList = res.data
-      //   notify('success', '项目添加成功')
-      // }).catch(error => {
-      //   notify('error', error)
-      // })
-    },
     // cancelModify () {
     //   this.isModifyMode = false
     // },
@@ -390,7 +471,20 @@ export default {
 
     },
     uploadProjectCreateExcelFile (param) {
-      this.excelFile = param.file
+      const formData = new FormData()
+      let config = {
+        //添加请求头
+        headers: {'Content-Type': 'multipart/form-data'},
+      }
+      formData.append('file', param.file)
+      Http.upload(Apis.PROJECT.ADD_PROJECT_BY_EXCEL, formData, config).then((res) => {
+        console.log(res)
+        this.projectList = res.data
+        this.showDialog()
+        //notify('success', '项目添加成功')
+      }).catch(error => {
+        notify('error', error)
+      })
     },
     uploadRequireDoc (param) {
       const formData = new FormData()
@@ -434,7 +528,12 @@ export default {
         })
     },
     ensureSubmitExcel () {
-
+      notify('success', '添加成功')
+      // Http.post('',this.projectList).then((res)=>{
+      //
+      // }).catch((error)=>{
+      //
+      // })
     },
     showDialog () {
       this.dialogVisible = true