浏览代码

数据驱动

guo00guo 5 年之前
父节点
当前提交
b74911bc4b
共有 3 个文件被更改,包括 65 次插入28 次删除
  1. 45 13
      src/components/project/ProjectCreate.vue
  2. 4 2
      src/js/api.js
  3. 16 13
      src/js/generalService.js

+ 45 - 13
src/components/project/ProjectCreate.vue

@@ -26,11 +26,18 @@
         <!--<template slot="append">¥</template>-->
         <!--</el-input>-->
         <!--</el-form-item>-->
+        <el-form-item label="领域类型" prop="field">
+          <el-radio-group v-model="project.field">
+            <span v-for="(item,index) in fields" :key="index">
+              <el-radio :label="item.code">{{ item.name }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
+            </span>
+          </el-radio-group>
+        </el-form-item>
 
         <el-form-item label="应用类型" prop="platform">
           <el-radio-group v-model="project.platform">
             <span v-for="(item,index) in platforms" :key="index">
-              <el-radio :label="item">{{ item }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
+              <el-radio :label="item.code">{{ item.name }}&nbsp;&nbsp;&nbsp;&nbsp;</el-radio>
             </span>
           </el-radio-group>
         </el-form-item>
@@ -38,7 +45,7 @@
         <el-form-item label="服务类型" prop="type">
           <el-checkbox-group v-model="project.type">
             <span v-for="(item,index) in serviceType" :key="index">
-              <el-checkbox :label="item" name="type">{{item}}&nbsp;&nbsp;&nbsp;&nbsp;</el-checkbox>
+              <el-checkbox :label="item.code" name="type">{{item.name}}&nbsp;&nbsp;&nbsp;&nbsp;</el-checkbox>
             </span>
           </el-checkbox-group>
         </el-form-item>
@@ -138,6 +145,7 @@ import {notify} from '@/constants/index'
 import {
   checkFileType,
   getAllInstitutions,
+  getAllFields,
   getAllPlatformTypes,
   getAllServiceTypes,
   getProvinceNameByProvinceCode,
@@ -165,8 +173,10 @@ export default {
       loading: false,
       tabPosition: 'top',
       institutionArray: [],
-      platforms: [],
-      serviceType: [],
+      fields:[{code: '', name: ''}],
+      platforms:[{code: '', name: ''}],
+      // platforms: [],
+      serviceType: [{code: '', name: ''}],
       resourceType: ResourceType,
       project: {
         userId: 0,
@@ -174,7 +184,8 @@ export default {
         contactName: '',
         contactPhone: '',
         type: [],
-        platform: [],
+        platform: '',
+        field: '',
         desc: '',
         doc: [],
         file: [],
@@ -253,6 +264,13 @@ export default {
             trigger: 'change'
           }
         ],
+        field: [
+          {
+            required: true,
+            message: '请至少选择一个领域类型',
+            trigger: 'change'
+          }
+        ],
         desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
         //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
         budget: [
@@ -339,6 +357,7 @@ export default {
     },
     init () {
       this.setServiceType()
+      this.setFields()
       this.setPlatforms()
       this.setInstitution()
       this.setUserInfo()
@@ -356,7 +375,8 @@ export default {
             userId: this.user.userVO.id,
             name: this.project.name,
             type: this.project.type,
-            platform: this.project.applicationType,
+            platform: this.project.platform,
+            field: this.project.field,
             desc: this.project.desc,
             resource: this.project.resource,
             location: newLocation,
@@ -399,7 +419,8 @@ export default {
       this.$refs[formName].resetFields()
       this.project.name = ''
       this.project.type = []
-      this.project.platform = []
+      this.project.platform = ''
+      this.project.field = ''
       this.project.desc = ''
       this.project.file = ''
       this.project.doc = ''
@@ -489,14 +510,25 @@ export default {
       })
     },
     setServiceType () {
-      getAllServiceTypes().then((res) => {
-        this.serviceType = res
-      }).catch((error) => {
-        notify('error', '获取项目服务类型列表失败')
-      })
+      // getAllServiceTypes().then((res) => {
+      //   this.serviceType = res
+      // }).catch((error) => {
+      //   notify('error', '获取项目服务类型列表失败')
+      // })
+        getAllServiceTypes().then((res) => {
+            this.serviceType = res
+        })
+    },
+    setFields(){
+        getAllFields().then((res) => {
+            this.fields = res
+        })
     },
     setPlatforms () {
-      this.platforms = getAllPlatformTypes()
+        getAllPlatformTypes().then((res) => {
+            this.platforms = res
+        })
+      // this.platforms = getAllPlatformTypes()
     },
     setInstitution () {
       getAllInstitutions().then((res) => {

+ 4 - 2
src/js/api.js

@@ -74,8 +74,10 @@ export default {
     REPORT_DETAIL_PAGE: '/api/page/reportDetail/{reportId}/',
   },
   GENERAL: {
-    GET_ALL_ABILITIES: '',
     GET_ALL_INSTITUTIONS: '/api/regionalManager',
-    GET_ALL_AGENCIES: '/api/agency/list'
+    GET_ALL_AGENCIES: '/api/agency/list',
+    GET_ALL_ApplicationType: '/api/list/application',
+    GET_ALL_TestType: '/api/list/type',
+    GET_ALL_Filed: '/api/list/filed',
   }
 }

+ 16 - 13
src/js/generalService.js

@@ -31,14 +31,6 @@ export const getAllAgencyResourceTypes = () => {
   //return Http.get(Apis.GENERAL.GET_ALL_ABILITIES)
 }
 
-//获取所有服务类型
-export const getAllServiceTypes = () => {
-  const data = ['接口测试', '兼容性测试', '可靠性测试', '稳定性测试', '功能测试', '性能测试', '安全测试','易用性测试', '应用故障诊断', '应用漏洞扫描', '代码安全审计', '风险评估', '等保测评', '评估评价', '定制测试']
-  return new Promise((resolve) => {
-    resolve(data)
-  })
-  //return Http.get(Apis.GENERAL.GET_ALL_ABILITIES)
-}
 
 //获取所有报告类型
 export const getAllReportTypes = () => {
@@ -49,15 +41,26 @@ export const getAllReportTypes = () => {
   //return Http.get(Apis.GENERAL.GET_ALL_ABILITIES)
 }
 
-//获取所有平台类型
+//获取所有领域类型
+export const getAllFields = () => {
+  return Http.get(Apis.GENERAL.GET_ALL_Filed)
+}
+
+//获取所有应用类型
 export const getAllPlatformTypes = () => {
-  return ['Android APP', 'IOS APP', 'Web应用', 'C/S应用软件', '嵌入式软件', '工业控制软件', '信息技术产品', '其他']
-  // return Http.get(Apis.GENERAL.GET_ALL_ApplicationType)
+  // return ['Android APP', 'IOS APP', 'Web应用', 'C/S应用软件', '嵌入式软件', '工业控制软件', '信息技术产品', '其他']
+  return Http.get(Apis.GENERAL.GET_ALL_ApplicationType)
 }
 
-export const getAllFields = () => {
-  return ['科技服务', '互联网服务', '集成电路', '工业控制', '北斗应用', '其他']
+//获取所有服务类型
+export const getAllServiceTypes = () => {
+  // const data = ['接口测试', '兼容性测试', '可靠性测试', '稳定性测试', '功能测试', '性能测试', '安全测试','易用性测试', '应用故障诊断', '应用漏洞扫描', '代码安全审计', '风险评估', '等保测评', '评估评价', '定制测试']
+  // return new Promise((resolve) => {
+  //   resolve(data)
+  // })
+  return Http.get(Apis.GENERAL.GET_ALL_TestType)
 }
+
 //获取所有定向发布的目标
 export const getAllInstitutions = () => {
   return Http.get(Apis.GENERAL.GET_ALL_INSTITUTIONS)