From 8aa44984efb100836300e55761d3d30fe2a94dfb Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Mon, 9 May 2022 05:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=A3=20=E7=BC=96=E5=86=99=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=A8=A1=E5=9D=97=E5=AE=A2=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OauthClientDetailsController.java | 7 +- .../src/views/system/client/ClientDrawer.vue | 62 ------- .../src/views/system/client/ClientModal.vue | 102 ++++++++++++ .../src/views/system/client/client.data.ts | 105 ++++++++---- kicc-ui/src/views/system/client/index.vue | 153 ++++++++++++------ .../src/views/system/tenant/TenantModal.vue | 2 +- .../src/views/system/tenant/tenant.data.ts | 4 +- 7 files changed, 289 insertions(+), 146 deletions(-) delete mode 100644 kicc-ui/src/views/system/client/ClientDrawer.vue create mode 100644 kicc-ui/src/views/system/client/ClientModal.vue diff --git a/kicc-platform/kicc-platform-biz/kicc-system-biz/src/main/java/com/cloud/kicc/system/controller/OauthClientDetailsController.java b/kicc-platform/kicc-platform-biz/kicc-system-biz/src/main/java/com/cloud/kicc/system/controller/OauthClientDetailsController.java index d7589ee3..6fbb1221 100644 --- a/kicc-platform/kicc-platform-biz/kicc-system-biz/src/main/java/com/cloud/kicc/system/controller/OauthClientDetailsController.java +++ b/kicc-platform/kicc-platform-biz/kicc-system-biz/src/main/java/com/cloud/kicc/system/controller/OauthClientDetailsController.java @@ -1,5 +1,6 @@ package com.cloud.kicc.system.controller; +import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -35,7 +36,7 @@ public class OauthClientDetailsController { private LambdaQueryWrapper getQueryWrapper(OauthClientDetails oauthClientDetails) { return new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(oauthClientDetails.getClientId()), OauthClientDetails::getClientId, oauthClientDetails.getClientId()) + .eq(StrUtil.isNotBlank(oauthClientDetails.getClientId()), OauthClientDetails::getClientId, oauthClientDetails.getClientId()) .between(StrUtil.isNotBlank(oauthClientDetails.getBeginTime()) && StrUtil.isNotBlank(oauthClientDetails.getEndTime()), OauthClientDetails::getCreateTime, oauthClientDetails.getBeginTime(), oauthClientDetails.getEndTime()); } @@ -71,6 +72,10 @@ public class OauthClientDetailsController { @DeleteMapping("/remove/{ids:[\\w,]+}") @PreAuthorize("@pms.hasPermission('client_del')") public R removeById(@PathVariable String[] ids) { + // todo: 防止客户端删除,暂时处理手段 + if(ArrayUtil.containsAny(ids, "kicc", "kicc_lock", "test")){ + return R.error("不允许删除核心客户端"); + } oauthClientDetailsService.removeClientDetailsByIds(Arrays.asList(ids)); return R.ok(); } diff --git a/kicc-ui/src/views/system/client/ClientDrawer.vue b/kicc-ui/src/views/system/client/ClientDrawer.vue deleted file mode 100644 index 55f29a8a..00000000 --- a/kicc-ui/src/views/system/client/ClientDrawer.vue +++ /dev/null @@ -1,62 +0,0 @@ - - diff --git a/kicc-ui/src/views/system/client/ClientModal.vue b/kicc-ui/src/views/system/client/ClientModal.vue new file mode 100644 index 00000000..57a9b0de --- /dev/null +++ b/kicc-ui/src/views/system/client/ClientModal.vue @@ -0,0 +1,102 @@ + + diff --git a/kicc-ui/src/views/system/client/client.data.ts b/kicc-ui/src/views/system/client/client.data.ts index 6313f7bf..3667fb86 100644 --- a/kicc-ui/src/views/system/client/client.data.ts +++ b/kicc-ui/src/views/system/client/client.data.ts @@ -1,115 +1,164 @@ +/** + * @program: kicc-ui + * @description: 多租户模块动态渲染配置 + * @author: entfrm开发团队-王翔 + * @create: 2022/4/21 + */ + import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; +/** 表格列配置 */ export const columns: BasicColumn[] = [ { title: '客户端Id', dataIndex: 'clientId', - width: 100, + width: 100 }, { title: '客户端密钥', dataIndex: 'clientSecret', - width: 100, + width: 100 }, { title: '授权类型', dataIndex: 'authorizedGrantTypes', - width: 130, + width: 130 }, { title: '授权范围', dataIndex: 'scope', - width: 90, + width: 90 }, { title: '令牌过期秒数', dataIndex: 'accessTokenValidity', - width: 130, + width: 130 }, { title: '令牌过期秒数', dataIndex: 'refreshTokenValidity', - width: 130, + width: 130 }, { title: '创建时间', dataIndex: 'createTime', - width: 100, - }, + width: 100 + } ]; +/** 搜索表单配置 */ export const searchFormSchema: FormSchema[] = [ { - field: 'keyword', - label: '关键字', + field: 'clientId', + label: '客户端编码', component: 'Input', componentProps: { - placeholder: '请输入客户端Id/编码', + placeholder: '请输入客户端编码', }, colProps: { span: 8 }, }, { - field: 'startDate', - label: '起始时间', - component: 'DatePicker', - colProps: { span: 8 }, - }, - { - field: 'endDate', - label: '截止时间', - component: 'DatePicker', - colProps: { span: 8 }, - }, + field: 'dateRange', + label: '创建时间', + component: 'RangePicker', + componentProps: { + style: { width:'100%' }, + valueFormat: 'YYYY-MM-DD', + placeholder: ['开始日期','结束日期'] + }, + colProps: { span: 8 } + } ]; +/** 表单配置 */ export const formSchema: FormSchema[] = [ { field: 'id', label: 'ID', component: 'Input', - show: false, + show: false }, { field: 'clientId', label: '客户端Id', component: 'Input', + required: true, + colProps: { + span: 12 + } }, { field: 'clientSecret', label: '客户端密钥', component: 'Input', + required: true, + colProps: { + span: 12 + } }, { field: 'authorizedGrantTypes', label: '授权类型', component: 'InputTextArea', - colProps: { lg: 24, md: 24 }, + required:true, + componentProps: { + rows: 3 + }, + colProps: { + span: 24 + } }, { field: 'scope', label: '授权范围', component: 'Input', + required:true, + colProps: { + span: 12 + } }, { field: 'accessTokenValidity', label: '过期秒数', - component: 'Input', + component: 'InputNumber', + componentProps: { + style: { width:'100%' }, + min: 0 + }, + colProps: { + span: 12 + } }, { field: 'refreshTokenValidity', label: '刷新秒数', - component: 'Input', + component: 'InputNumber', + componentProps: { + style: { width:'100%' }, + min: 0 + }, + colProps: { + span: 12 + } }, { field: 'webServerRedirectUri', label: '回调地址', component: 'Input', + colProps: { + span: 12 + } }, { field: 'additionalInformation', label: '附加说明', component: 'InputTextArea', - colProps: { lg: 24, md: 24 }, - }, + componentProps: { + rows: 6 + }, + colProps: { + span: 24 + } + } ]; diff --git a/kicc-ui/src/views/system/client/index.vue b/kicc-ui/src/views/system/client/index.vue index 17586a8f..520de351 100644 --- a/kicc-ui/src/views/system/client/index.vue +++ b/kicc-ui/src/views/system/client/index.vue @@ -1,89 +1,140 @@ + diff --git a/kicc-ui/src/views/system/tenant/TenantModal.vue b/kicc-ui/src/views/system/tenant/TenantModal.vue index 9f92d229..fd71d0ef 100644 --- a/kicc-ui/src/views/system/tenant/TenantModal.vue +++ b/kicc-ui/src/views/system/tenant/TenantModal.vue @@ -19,7 +19,7 @@ import { formSchema } from './tenant.data'; import {addTenant, editTenant, getTenant, listTenant} from '/@/api/platform/system/controller/tenant'; import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; - import {isEmpty} from "/@/utils/is"; + import {isEmpty} from '/@/utils/is'; /** 通用变量统一声明区域 */ const tag = ref>(''); diff --git a/kicc-ui/src/views/system/tenant/tenant.data.ts b/kicc-ui/src/views/system/tenant/tenant.data.ts index b2160962..e008f0c2 100644 --- a/kicc-ui/src/views/system/tenant/tenant.data.ts +++ b/kicc-ui/src/views/system/tenant/tenant.data.ts @@ -9,8 +9,6 @@ import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { h } from 'vue'; import { Tag } from 'ant-design-vue'; -import { listTenant } from '/@/api/platform/system/controller/tenant'; -import { isEmpty } from '/@/utils/is'; /** 表格列配置 */ export const columns: BasicColumn[] = [ @@ -88,7 +86,7 @@ export const searchFormSchema: FormSchema[] = [ } ]; -/** 用户表单配置 */ +/** 表单配置 */ export const formSchema: FormSchema[] = [ { field: 'id',