Переглянути джерело

添加用户Id,修改在vuex中报错的用户名字段为userName

zhangyu 5 роки тому
батько
коміт
896666b59b

+ 4 - 1
src/api/model/file.js

@@ -120,6 +120,7 @@ let api = {
                                 FloorModelId: res.EntityList[0].Id, //模型所属楼层(FloorModel外键)
                                 ModelName: params.Form.file.name,        //模型文件名
                                 UserName: params.userName,
+                                UserId: params.userId,
                                 Note: params.Form.desc
                                 // ReplaceReason: 0
                             }]
@@ -151,6 +152,7 @@ let api = {
                             FloorModelId: res.Content[0].Id, //模型所属楼层(FloorModel外键)
                             ModelName: params.Form.file.name,        //模型文件名
                             UserName: params.userName,
+                            UserId: params.userId,
                             Note: params.Form.desc
                             // ReplaceReason: 0
                         }]
@@ -241,12 +243,13 @@ let api = {
         })
     },
     // 更新模型文件
-    upDateModelFile(data, ProjectId,UserName, callback1, callback2) {
+    upDateModelFile(data, ProjectId, UserName, UserId, callback1, callback2) {
         let modelFile = {
             Content: [{
                 FloorModelId:data.replaceModelItem.Id, //模型id
                 ModelName: data.Form.file.name,        //模型名字
                 UserName: UserName,
+                UserId: UserId,
                 Note: data.replaceModelItem.Note,
                 ReplaceReason: data.Form.ReplaceReason
             }]

+ 2 - 1
src/components/model/file/addFloorDialog.vue

@@ -162,7 +162,8 @@ export default {
             FolderId: this.FolderId,
             FloorName: FloorName,
             Form: this.form,
-            userName:this.userInfo.username
+            userName: this.userInfo.userName,
+            userId: this.userInfo.userId
           };
           request.createFloor(data).then(res => {
             if (res.Result == "success") {

+ 1 - 1
src/components/model/file/floorTable.vue

@@ -115,7 +115,7 @@ export default {
     },
     // 停止上传
     closeUpdate(item) {
-      if (this.userInfo.username == item.UserName) {
+      if (this.userInfo.userName == item.UserName) {
         this.$emit("closeUpdateFile", item);
       } else {
         this.$message({

+ 5 - 5
src/framework/layout/PageHeader.vue

@@ -18,7 +18,7 @@
         <div id='page-header-user-menu' class='user-menu'>
             <el-dropdown trigger='hover' class='user-menu-dropdown' @command='userMenuCommand'>
                 <span class='el-dropdown-link'>
-                    {{userInfo.username}}
+                    {{userInfo.userName}}
                     <i class='el-icon-fa-user el-icon--right'></i>
                 </span>
                 <el-dropdown-menu slot='dropdown'>
@@ -67,11 +67,11 @@ export default {
     },
     created() {
         let cacheInfo = JSON.parse(localStorage.getItem('_sagacloud_admin_store_cacheInfo'))?JSON.parse(localStorage.getItem('_sagacloud_admin_store_cacheInfo')):{}
-        if(cacheInfo[this.userInfo.username] && 
-            cacheInfo[this.userInfo.username].projectId && 
-            this.projects.some((item) => {return item.id == cacheInfo[this.userInfo.username].projectId})
+        if(cacheInfo[this.userInfo.userName] && 
+            cacheInfo[this.userInfo.userName].projectId && 
+            this.projects.some((item) => {return item.id == cacheInfo[this.userInfo.userName].projectId})
         ){
-            this.selectedProjectId = cacheInfo[this.userInfo.username].projectId
+            this.selectedProjectId = cacheInfo[this.userInfo.userName].projectId
         } else {
             this.selectedProjectId = this.projectId
         }

+ 4 - 4
src/framework/layout/layout-store.js

@@ -66,11 +66,11 @@ export default {
             let cacheInfo = JSON.parse(localStorage.getItem('_sagacloud_admin_store_cacheInfo'))?JSON.parse(localStorage.getItem('_sagacloud_admin_store_cacheInfo')):{}
             state.projectId = val
             localStorage.setItem('projectId', val)
-            if(cacheInfo[state.userInfo.username]){
-                cacheInfo[state.userInfo.username].projectId = val
+            if(cacheInfo[state.userInfo.userName]){
+                cacheInfo[state.userInfo.userName].projectId = val
                 localStorage.setItem('_sagacloud_admin_store_cacheInfo', JSON.stringify(cacheInfo))
             } else {
-                cacheInfo[state.userInfo.username] = {projectId: val}
+                cacheInfo[state.userInfo.userName] = {projectId: val}
                 localStorage.setItem('_sagacloud_admin_store_cacheInfo', JSON.stringify(cacheInfo))
             }
             storage.set(KEY_PROJECT_SELECTED, val)
@@ -88,7 +88,7 @@ export default {
                 frameworkApi.loadUserInfo().then(resp => {
                     console.log(resp)
                     if (resp.Result == 'success') {
-                        state.userInfo = { username: resp.Username, userId: resp.UserId }
+                        state.userInfo = { userName: resp.Username, userId: resp.UserId }
                         state.userId = resp.UserId
                         storage.set('user_name', resp.Username)
                         storage.set('user_id', resp.UserId)

+ 2 - 1
src/views/model/file/index.vue

@@ -411,7 +411,8 @@ export default {
           request.upDateModelFile(
             data,
             that.projectId,
-            that.userInfo.username,
+            that.userInfo.userName,
+            that.userInfo.userId,
             res => {
               let loaded = res.loaded, //加载量
                 total = res.total; //文件大小