Prechádzať zdrojové kódy

调整项目下任务的可见性显示

sunjh 6 rokov pred
rodič
commit
4f39f6487c

+ 3 - 3
src/components/Mine.vue

@@ -13,7 +13,7 @@
           <div class="user-banner">
             <p class="head">
               <a href="javascript:;" class="login-link">
-                <img :src="user.userVO.photo" class="user-img">
+                <img src="http://www.mooctest.net/assets/img/mooctest.png" class="user-img">
                 <span class="vertify hide"></span>
               </a>
             </p>
@@ -61,7 +61,7 @@
           <task-item v-if="finishedTaskList != null || finishedTaskList.length > 0"
                      v-for="(item,index) in finishedTaskList" :key="index" :task="item"/>
         </el-tab-pane>
-        <el-tab-pane v-if="rolesPermissions.isEnterpriseUser || rolesPermissions.isIndividualUser" label="我的项目">
+        <el-tab-pane label="我的项目">
 
           <span v-if="myProjects == null || myProjects.length == 0"> 暂无项目 </span>
           <project-item v-if="myProjects != null || myProjects.length > 0"
@@ -157,7 +157,7 @@ export default {
       this.user = storageGet('user')
     },
     setRolesPermissions () {
-      this.rolesPermissions = getRolesPermissions(this.user.userVO.roleList)
+      this.rolesPermissions = storageGet('rolesPermissions')
     }
 
   },

+ 2 - 1
src/components/commons/Header.vue

@@ -101,8 +101,9 @@ export default {
           'isSystemAdministrator': false
         })
         getCurrentUser().then((res) => {
+          console.log(res)
           storageSave('user', res)
-          storageSave('rolesPermissions', getRolesPermissions(res.userVO.roleList))
+          storageSave('rolesPermissions', getRolesPermissions(res.roleList))
           this.isLogin = true
         }).catch(error => {
           console.log(error)

+ 70 - 64
src/components/project/Project.vue

@@ -200,7 +200,8 @@
           <el-table-column prop="datetime" sortable label="任务截止时间"></el-table-column>
           <el-table-column prop="resource" label="任务可见性">
             <template slot-scope="scope">
-              <div v-if="scope.row.resource=='1'">{{updateLocation(scope.row.location)}}</div>
+              <div v-if="scope.row.resource=='1'">{{scope.row.location.provinceCode}}/{{scope.row.location.cityCode}}
+              </div>
               <div v-if="scope.row.resource=='0'">{{scope.row.institution}}</div>
               <div v-if="scope.row.resource=='2'">{{resourceType[scope.row.resource]}}</div>
             </template>
@@ -242,7 +243,6 @@ import Http from '@/js/http.js'
 import Apis from '@/js/api.js'
 import ResourceType from '@/constants/enum/resource-type'
 import provincecity from '@/components/commons/ProvinceCity'
-import provinceCityJSON from '@/constants/provinceCity.json'
 import {notify} from '@/constants/index'
 import {
   getAllInstitutions,
@@ -328,35 +328,35 @@ export default {
         ]
       },
       rules: {
-        name: [
-          {required: true, message: '请输入项目名称', trigger: 'blur'}
-          // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
-        ],
-        type: [
-          {
-            type: 'array',
-            required: true,
-            message: '请至少选择一种服务类型',
-            trigger: 'change'
-          }
-        ],
-        platform: [
-          {
-            type: 'array',
-            required: true,
-            message: '请至少选择一个平台',
-            trigger: 'change'
-          }
-        ],
-        desc: [{required: true, message: '请填写活动形式', trigger: 'blur'}],
-        contact: [{validator: validatePass, trigger: 'blur'}],
-        resource: [
-          {
-            required: true,
-            message: '请选择项目可见性',
-            trigger: 'change'
-          }
-        ]
+        // name: [
+        //   {required: true, message: '请输入项目名称', trigger: 'blur'}
+        //   // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
+        // ],
+        // type: [
+        //   {
+        //     type: 'array',
+        //     required: true,
+        //     message: '请至少选择一种服务类型',
+        //     trigger: 'change'
+        //   }
+        // ],
+        // platform: [
+        //   {
+        //     type: 'array',
+        //     required: true,
+        //     message: '请至少选择一个平台',
+        //     trigger: 'change'
+        //   }
+        // ],
+        // desc: [{required: true, message: '请填写活动形式', trigger: 'blur'}],
+        // contact: [{validator: validatePass, trigger: 'blur'}],
+        // resource: [
+        //   {
+        //     required: true,
+        //     message: '请选择项目可见性',
+        //     trigger: 'change'
+        //   }
+        // ]
       }
     }
   },
@@ -372,42 +372,44 @@ export default {
     institutionArray (val) {
       this.institutionArray = val
     },
-    'project.institution' () {
-      if (this.project.institution) {
-        //this.$refs.addFormProvince.resetProviceCity()
-        this.project.location = {provinceCode: '', cityCode: ''}
-      }
-    },
-    'project.location' () {
-      if (this.project.location.provinceCode || this.project.location.cityCode) {
-        this.project.institution = ''
-      }
-    },
-    'project.resource' () {
-      if (this.project.resource == '2') {
-        this.$refs.addFormProvince.resetProviceCity()
-        this.project.institution = ''
-        this.project.location = {provinceCode: '', cityCode: ''}
-      }
-    },
+    // 'project.institution' () {
+    //   if (this.project.institution) {
+    //     //this.$refs.addFormProvince.resetProviceCity()
+    //     this.project.location = {provinceCode: '', cityCode: ''}
+    //   }
+    // },
+    // 'project.location' () {
+    //   if (this.project.location.provinceCode || this.project.location.cityCode) {
+    //     this.project.institution = ''
+    //   }
+    // },
+    // 'project.resource' () {
+    //   if (this.project.resource == '2') {
+    //     //this.$refs.addFormProvince.resetProviceCity()
+    //     this.project.institution = ''
+    //     this.project.location = {provinceCode: '', cityCode: ''}
+    //   }
+    // },
     deep: true
   },
   methods: {
     updateLocation (location) {
-      var provinceName = ''
-      var cityName = ''
-      for (var item of provinceCityJSON.provinces) {
-        if (item.code === location.provinceCode) {
-          provinceName = item.name
-          for (var city of item.cities) {
-            if (city.code === location.cityCode) {
-              cityName = city.name
-              break
-            }
-          }
-        }
-      }
-      return provinceName + ' / ' + cityName
+      //console.log(location)
+      const loactionName = getProvinceNameByProvinceCode(location.provinceCode, location.cityCode)
+      // var provinceName = ''
+      // var cityName = ''
+      // for (var item of provinceCityJSON.provinces) {
+      //   if (item.code === location.provinceCode) {
+      //     provinceName = item.name
+      //     for (var city of item.cities) {
+      //       if (city.code === location.cityCode) {
+      //         cityName = city.name
+      //         break
+      //       }
+      //     }
+      //   }
+      // }
+      return loactionName.provinceCode + ' / ' + loactionName.cityCode
     },
     init () {
       this.projectId = this.$route.params.projectId
@@ -440,7 +442,7 @@ export default {
         datetime: this.project.datetime,
         usage: this.project.usage,
       }
-      //console.log(newProject)
+      console.log(newProject)
       Http.put(Apis.PROJECT.UPDATE_PROJECT.replace('{projectId}', this.projectId), newProject).then((res) => {
         this.projectId = res.projectDetails.id
         this.project.name = res.projectDetails.name
@@ -691,6 +693,10 @@ export default {
   .el-row {
     margin-bottom: 10px;
   }
+
+  .el-input {
+    width: 400px;
+  }
 </style>
 
 

+ 10 - 0
src/components/report/Report.vue

@@ -163,10 +163,17 @@ export default {
       if (this.taskId == null) {
         Http.put(Apis.REPORT.UPDATE_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId), newReport).then((res) => {
           console.log(res)
+          notify('success','修改成功')
+          this.isModifyMode = false
+        }).catch((error)=>{
+          notify('error',error.data)
         })
       } else {
         Http.put(Apis.REPORT.UPDATE_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId), newReport).then((res) => {
           console.log(res)
+          this.isModifyMode = false
+        }).catch((error)=>{
+          notify('error',error.data)
         })
       }
       // this.$refs[formName].validate(valid => {
@@ -287,6 +294,9 @@ export default {
     },
     setUserInfo () {
       this.user = storageGet('user')
+    },
+    updateReportSuccess(){
+
     }
   },
   watch:{

+ 47 - 33
src/components/task/Task.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="create-container">
+  <div class="create-container" v-loading="loading">
     <div class="title h1" v-if="!isModifyMode">任务</div>
     <div class="create-body">
       <div class="title h2" v-if="!isModifyMode">基本信息</div>
@@ -154,6 +154,7 @@ export default {
   data () {
     return {
       user: {},
+      loading:false,
       isModifyMode: false,
       institutionArray: [],
       tabPosition: 'top',
@@ -227,24 +228,24 @@ export default {
     institutionArray (val) {
       this.institutionArray = val
     },
-    'task.institution' () {
-      if (this.task.institution) {
-        //this.$refs.addFormProvince.resetProviceCity()
-        this.task.location = {provinceCode: '', cityCode: ''}
-      }
-    },
-    'task.location' () {
-      if (this.task.location.provinceCode || this.task.location.cityCode) {
-        this.task.institution = ''
-      }
-    },
-    'task.resource' () {
-      if (this.task.resource == '广场') {
-        this.$refs.addFormProvince.resetProviceCity()
-        this.task.institution = ''
-        this.task.location = {provinceCode: '', cityCode: ''}
-      }
-    },
+    // 'task.institution' () {
+    //   if (this.task.institution) {
+    //     //this.$refs.addFormProvince.resetProviceCity()
+    //     this.task.location = {provinceCode: '', cityCode: ''}
+    //   }
+    // },
+    // 'task.location' () {
+    //   if (this.task.location.provinceCode || this.task.location.cityCode) {
+    //     this.task.institution = ''
+    //   }
+    // },
+    // 'task.resource' () {
+    //   if (this.task.resource == '广场') {
+    //     this.$refs.addFormProvince.resetProviceCity()
+    //     this.task.institution = ''
+    //     this.task.location = {provinceCode: '', cityCode: ''}
+    //   }
+    // },
     deep: true
   },
   mounted () {
@@ -263,22 +264,25 @@ export default {
       this.setInstitutions()
     },
     updateLocation (location) {
-      var provinceName = ''
-      var cityName = ''
-      for (var item of provinceCityJSON.provinces) {
-        if (item.code === location.provinceCode) {
-          provinceName = item.name
-          for (var city of item.cities) {
-            if (city.code === location.cityCode) {
-              cityName = city.name
-              break
-            }
-          }
-        }
-      }
-      return provinceName + ' / ' + cityName
+      console.log(location)
+      const loactionName = getProvinceNameByProvinceCode(location.provinceCode,location.cityCode)
+      // var provinceName = ''
+      // var cityName = ''
+      // for (var item of provinceCityJSON.provinces) {
+      //   if (item.code === location.provinceCode) {
+      //     provinceName = item.name
+      //     for (var city of item.cities) {
+      //       if (city.code === location.cityCode) {
+      //         cityName = city.name
+      //         break
+      //       }
+      //     }
+      //   }
+      // }
+      return loactionName.provinceCode + ' / ' + loactionName.cityCode
     },
     submitForm (formName) {
+      this.showLoading()
       const newTask = {
         name: this.task.title,
         desc: this.task.description,
@@ -310,6 +314,7 @@ export default {
         this.task.requireDocUrl = res.crowdTaskVO.requirementFile
 
         this.reportList = res.crowdReportVOList
+        this.hideLoading()
       })
       // this.$refs[formName].validate(valid => {
       //   if (valid) {
@@ -383,8 +388,10 @@ export default {
       })
     },
     loadData (projectId, taskId) {
+      this.showLoading()
       //replace('{taskId}', this.taskId)
       Http.get(Apis.TASK.GET_TASK.replace('{projectId}', projectId).replace('{taskId}', taskId)).then((res) => {
+        console.log(res.crowdTaskVO)
         this.taskId = res.crowdTaskVO.id
         this.projectId = res.crowdTaskVO.projectId
         this.task.title = res.crowdTaskVO.title
@@ -400,6 +407,7 @@ export default {
         this.task.requireDocUrl = res.crowdTaskVO.requirementFile
 
         this.reportList = res.crowdReportVOList
+        this.hideLoading()
       })
     },
     handleRemove (file, fileList) {
@@ -471,6 +479,12 @@ export default {
     },
     setUserInfo () {
       this.user = storageGet('user')
+    },
+    showLoading(){
+      this.loading = true
+    },
+    hideLoading(){
+      this.loading = false
     }
   },
   // created () {

+ 28 - 20
src/js/index.js

@@ -19,30 +19,30 @@ export const getUserIdentity = () => {
 
 //获取用户信息
 export const getCurrentUser = () => {
-  const data = {
-    userVO: {
-      id: 3,
-      photo: 'http://www.mooctest.net/assets/img/mooctest.png',
-      name: '郭超',
-      roleList: ['区域管理员', '个人用户', '企业用户', '测评机构', '系统管理员'],
-      mobile: '110',
-      email: '12345@qq.com',
-    },
-    agency: '',
-  }
-  return new Promise((resolve) => {
-    resolve(data)
-  })
-  // return Http.get(Apis.USER.GET_CURRENT_USER)
+  // const data = {
+  //   userVO: {
+  //     id: 3,
+  //     photo: 'http://www.mooctest.net/assets/img/mooctest.png',
+  //     name: '郭超',
+  //     roleList: ['区域管理员', '个人用户', '企业用户', '测评机构', '系统管理员'],
+  //     mobile: '110',
+  //     email: '12345@qq.com',
+  //   },
+  //   agency: '',
+  // }
+  // return new Promise((resolve) => {
+  //   resolve(data)
+  // })
+  return Http.get(Apis.USER.GET_CURRENT_USER)
 }
 //
 export const getRolesPermissions = (roleList) => {
   const roles = {
-    regionManager: '区域管理员',
-    individualUser: '个人用户',
-    enterpriseUser: '个人用户',
-    agency: '测评机构',
-    systemAdministrator: '系统管理员'
+    regionManager: 'RegionalManager',
+    individualUser: 'generalUser',
+    enterpriseUser: 'enterpriseUser',
+    agency: 'evaluationAgency',
+    systemAdministrator: 'SystemAdministrator'
   }
   const permissions = {
     isRegionManager: false,
@@ -53,9 +53,13 @@ export const getRolesPermissions = (roleList) => {
   }
   if (roleList.includes(roles.regionManager)) {
     permissions.isRegionManager = true
+    permissions.isEnterpriseUser = true
+    permissions.isIndividualUser = true
   }
   if (roleList.includes(roles.agency)) {
     permissions.isAgency = true
+    permissions.isEnterpriseUser = true
+    permissions.isIndividualUser = true
   }
   if (roleList.includes(roles.enterpriseUser)) {
     permissions.isEnterpriseUser = true
@@ -65,6 +69,10 @@ export const getRolesPermissions = (roleList) => {
   }
   if (roleList.includes(roles.systemAdministrator)) {
     permissions.isSystemAdministrator = true
+    permissions.isRegionManager = true
+    permissions.isAgency = true
+    permissions.isEnterpriseUser = true
+    permissions.isIndividualUser = true
   }
   return permissions
 }