Skip to content

Commit 0c3bda0

Browse files
authored
Merge pull request #44 from wenjianzhang/dev
Fix "Personal Center" Department and role are empty
2 parents 8bf0901 + 7d886ae commit 0c3bda0

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

src/api/tools/gen.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@ export function delTable(tableId) {
5757
})
5858
}
5959

60+
// 生成代码到项目
61+
export function toProjectTable(tableId) {
62+
return request({
63+
url: '/api/v1/gen/toproject/' + tableId,
64+
method: 'get'
65+
})
66+
}
67+

src/views/profile/index.vue

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
</li>
2626
<li class="list-group-item">
2727
<svg-icon icon-class="tree" />所属部门
28-
<div v-if="user.dept" class="pull-right">{{ user.dept.deptName }} / {{ postGroup }}</div>
28+
<div class="pull-right">{{ deptName }}</div>
2929
</li>
3030
<li class="list-group-item">
3131
<svg-icon icon-class="peoples" />所属角色
32-
<div class="pull-right">{{ roleGroup }}</div>
32+
<div class="pull-right">{{ roleName }}</div>
3333
</li>
3434
<li class="list-group-item">
3535
<svg-icon icon-class="date" />创建日期
@@ -72,7 +72,14 @@ export default {
7272
user: {},
7373
roleGroup: {},
7474
postGroup: {},
75-
activeTab: 'userinfo'
75+
deptGroup: {},
76+
activeTab: 'userinfo',
77+
roleIds: undefined,
78+
postIds: undefined,
79+
roleName: undefined,
80+
postName: undefined,
81+
dept: {},
82+
deptName: undefined
7683
}
7784
},
7885
created() {
@@ -82,8 +89,20 @@ export default {
8289
getUser() {
8390
getUserProfile().then(response => {
8491
this.user = response.data
85-
this.roleGroup = response.roleGroup
86-
this.postGroup = response.postGroup
92+
this.roleIds = response.roleIds
93+
this.roleGroup = response.roles
94+
95+
if (this.roleIds[0]) {
96+
for (const key in this.roleGroup) {
97+
if (this.roleIds[0] === this.roleGroup[key].roleId) {
98+
this.roleName = this.roleGroup[key].roleName
99+
}
100+
}
101+
} else {
102+
this.roleName = '暂无'
103+
}
104+
this.dept = response.dept
105+
this.deptName = this.dept.deptName
87106
})
88107
}
89108
}

src/views/tools/gen/index.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@
108108
icon="el-icon-view"
109109
@click="handlePreview(scope.row)"
110110
>预览</el-button>
111+
<el-button
112+
113+
type="text"
114+
size="small"
115+
icon="el-icon-view"
116+
@click="handleToProject(scope.row)"
117+
>生成到项目</el-button>
111118
<el-button
112119

113120
type="text"
@@ -150,7 +157,7 @@
150157
</template>
151158

152159
<script>
153-
import { listTable, previewTable, delTable } from '@/api/tools/gen'
160+
import { listTable, previewTable, delTable, toProjectTable } from '@/api/tools/gen'
154161
import importTable from './importTable'
155162
import { downLoadFile } from '@/utils/zipdownload'
156163
export default {
@@ -244,6 +251,11 @@ export default {
244251
this.preview.open = true
245252
})
246253
},
254+
handleToProject(row) {
255+
toProjectTable(row.tableId).then(response => {
256+
this.msgSuccess(response.msg)
257+
})
258+
},
247259
// 多选框选中数据
248260
handleSelectionChange(selection) {
249261
this.ids = selection.map(item => item.tableId)

0 commit comments

Comments
 (0)