终端授权类型改为复选框

2.X
RuoYi 5 years ago committed by 疯狂的狮子li
parent d5b4e1f06c
commit a8d130fb84

@ -54,7 +54,7 @@
<el-table-column label="编号" align="center" prop="clientId" /> <el-table-column label="编号" align="center" prop="clientId" />
<el-table-column label="安全码" align="center" prop="originSecret" :show-overflow-tooltip="true" /> <el-table-column label="安全码" align="center" prop="originSecret" :show-overflow-tooltip="true" />
<el-table-column label="授权范围" align="center" prop="scope" /> <el-table-column label="授权范围" align="center" prop="scope" />
<el-table-column label="授权类型" align="center" prop="authorizedGrantTypes" :show-overflow-tooltip="true" /> <el-table-column label="授权类型" align="center" prop="authorizedGrantTypes" :formatter="authorizedGrantTypesFormat" :show-overflow-tooltip="true"/>
<el-table-column label="令牌时效" align="center" prop="accessTokenValidity" /> <el-table-column label="令牌时效" align="center" prop="accessTokenValidity" />
<el-table-column label="刷新时效" align="center" prop="refreshTokenValidity" /> <el-table-column label="刷新时效" align="center" prop="refreshTokenValidity" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -98,7 +98,14 @@
<el-input v-model="form.scope" placeholder="请输入授权范围" /> <el-input v-model="form.scope" placeholder="请输入授权范围" />
</el-form-item> </el-form-item>
<el-form-item label="授权类型" prop="authorizedGrantTypes"> <el-form-item label="授权类型" prop="authorizedGrantTypes">
<el-input v-model="form.authorizedGrantTypes" placeholder="请输入授权类型" /> <el-checkbox-group v-model="form.authorizedGrantTypes">
<el-checkbox
v-for="dict in authorizedGrantTypesOptions"
:key="dict.dictValue"
:label="dict.dictValue">
{{dict.dictLabel}}
</el-checkbox>
</el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item label="令牌时效" prop="accessTokenValidity"> <el-form-item label="令牌时效" prop="accessTokenValidity">
<el-input-number v-model="form.accessTokenValidity" controls-position="right" :min="0" /> <el-input-number v-model="form.accessTokenValidity" controls-position="right" :min="0" />
@ -140,6 +147,8 @@ export default {
title: "", title: "",
// //
open: false, open: false,
//
authorizedGrantTypesOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -169,6 +178,9 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_grant_type").then(response => {
this.authorizedGrantTypesOptions = response.data;
});
}, },
methods: { methods: {
/** 查询终端列表 */ /** 查询终端列表 */
@ -180,6 +192,10 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
//
authorizedGrantTypesFormat(row, column) {
return this.selectDictLabels(this.authorizedGrantTypesOptions, row.authorizedGrantTypes);
},
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -191,7 +207,7 @@ export default {
clientId: undefined, clientId: undefined,
clientSecret: undefined, clientSecret: undefined,
scope: "server", scope: "server",
authorizedGrantTypes: "password,refresh_token", authorizedGrantTypes: [],
accessTokenValidity: 3600, accessTokenValidity: 3600,
refreshTokenValidity: 7200 refreshTokenValidity: 7200
}; };
@ -227,6 +243,7 @@ export default {
const clientId = row.clientId || this.ids; const clientId = row.clientId || this.ids;
getClient(clientId).then(response => { getClient(clientId).then(response => {
this.form = response.data; this.form = response.data;
this.form.authorizedGrantTypes = this.form.authorizedGrantTypes.split(",");
this.open = true; this.open = true;
this.title = "修改终端"; this.title = "修改终端";
}); });
@ -235,6 +252,7 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.authorizedGrantTypes = this.form.authorizedGrantTypes.join(",");
if (!this.isAdd && this.form.clientId != undefined) { if (!this.isAdd && this.form.clientId != undefined) {
updateClient(this.form).then(response => { updateClient(this.form).then(response => {
if (response.code === 200) { if (response.code === 200) {

@ -461,6 +461,7 @@ insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0',
insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知状态列表'); insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知状态列表');
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '操作类型列表'); insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '操作类型列表');
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '登录状态列表'); insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '登录状态列表');
insert into sys_dict_type values(11, '授权类型', 'sys_grant_type', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '授权类型列表');
-- ---------------------------- -- ----------------------------
@ -514,6 +515,11 @@ insert into sys_dict_data values(25, 8, '生成代码', '8', 'sys_oper_ty
insert into sys_dict_data values(26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '清空操作'); insert into sys_dict_data values(26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '清空操作');
insert into sys_dict_data values(27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); insert into sys_dict_data values(27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
insert into sys_dict_data values(28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); insert into sys_dict_data values(28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
insert into sys_dict_data values(29, 1, '授权码模式', 'authorization_code', 'sys_grant_type', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '授权码模式');
insert into sys_dict_data values(30, 2, '密码模式', 'password', 'sys_grant_type', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '密码模式');
insert into sys_dict_data values(31, 3, '客户端模式', 'client_credentials', 'sys_grant_type', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '客户端模式');
insert into sys_dict_data values(32, 4, '简化模式', 'implicit', 'sys_grant_type', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '简化模式');
insert into sys_dict_data values(33, 5, '刷新模式', 'refresh_token', 'sys_grant_type', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '刷新模式');
-- ---------------------------- -- ----------------------------
Loading…
Cancel
Save