6 changed files with 180 additions and 307 deletions
@ -0,0 +1,20 @@ |
|||||||
|
import type { GenCodeParamResult, GenCodeParamParams, GenCodeParam } from '/@/api/platform/system/entity/genCodeParam'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
list = '/system_proxy/system/devtools/genCodeParam/list', |
||||||
|
add = '/system_proxy/system/devtools/genCodeParam/save', |
||||||
|
get = '/system_proxy/system/devtools/genCodeParam', |
||||||
|
edit = '/system_proxy/system/devtools/genCodeParam/update', |
||||||
|
del = '/system_proxy/system/devtools/genCodeParam/remove' |
||||||
|
} |
||||||
|
|
||||||
|
export const listGenCodeParam = (params?: Partial<GenCodeParamParams>) => defHttp.get<GenCodeParamResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||||
|
|
||||||
|
export const addGenCodeParam = (params: Partial<GenCodeParam>) => defHttp.post({ url: Api.add, data: params }); |
||||||
|
|
||||||
|
export const editGenCodeParam = (params: Partial<GenCodeParam>) => defHttp.put({ url: Api.edit, data: params }); |
||||||
|
|
||||||
|
export const getGenCodeParam = (id: string) => defHttp.get<GenCodeParam>({ url: `${Api.get}/${id}` }); |
||||||
|
|
||||||
|
export const delGenCodeParam = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,16 @@ |
|||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { Page } from '/@/api/common/data/entity'; |
||||||
|
import type { BaseEntity } from '/@/api/common/base/entity'; |
||||||
|
|
||||||
|
export type GenCodeParamParams = Page & GenCodeParam; |
||||||
|
|
||||||
|
export interface GenCodeParam extends BaseEntity { |
||||||
|
id: string; |
||||||
|
projectpath: string; |
||||||
|
frontpath: string; |
||||||
|
packagename: string; |
||||||
|
author: string; |
||||||
|
[key: string]: any; |
||||||
|
} |
||||||
|
|
||||||
|
export type GenCodeParamResult = R<GenCodeParam[]>; |
@ -1,154 +0,0 @@ |
|||||||
import { BasicColumn } from '/@/components/Table'; |
|
||||||
import { FormSchema } from '/@/components/Table'; |
|
||||||
|
|
||||||
export const columns: BasicColumn[] = [ |
|
||||||
{ |
|
||||||
title: '客户端Id', |
|
||||||
dataIndex: 'clientId', |
|
||||||
width: 100 |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '客户端密钥', |
|
||||||
dataIndex: 'clientSecret', |
|
||||||
width: 100 |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '授权类型', |
|
||||||
dataIndex: 'authorizedGrantTypes', |
|
||||||
width: 130 |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '授权范围', |
|
||||||
dataIndex: 'scope', |
|
||||||
width: 90 |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '令牌过期秒数', |
|
||||||
dataIndex: 'accessTokenValidity', |
|
||||||
width: 130 |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '令牌过期秒数', |
|
||||||
dataIndex: 'refreshTokenValidity', |
|
||||||
width: 130 |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '创建时间', |
|
||||||
dataIndex: 'createTime', |
|
||||||
width: 100 |
|
||||||
} |
|
||||||
]; |
|
||||||
|
|
||||||
export const searchFormSchema: FormSchema[] = [ |
|
||||||
{ |
|
||||||
field: 'clientId', |
|
||||||
label: '客户端编码', |
|
||||||
component: 'Input', |
|
||||||
componentProps: { |
|
||||||
placeholder: '请输入客户端编码', |
|
||||||
}, |
|
||||||
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 |
|
||||||
}, |
|
||||||
{ |
|
||||||
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', |
|
||||||
required:true, |
|
||||||
componentProps: { |
|
||||||
rows: 3 |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 24 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'scope', |
|
||||||
label: '授权范围', |
|
||||||
component: 'Input', |
|
||||||
required:true, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'accessTokenValidity', |
|
||||||
label: '过期秒数', |
|
||||||
component: 'InputNumber', |
|
||||||
componentProps: { |
|
||||||
style: { width:'100%' }, |
|
||||||
min: 0 |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'refreshTokenValidity', |
|
||||||
label: '刷新秒数', |
|
||||||
component: 'InputNumber', |
|
||||||
componentProps: { |
|
||||||
style: { width:'100%' }, |
|
||||||
min: 0 |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'webServerRedirectUri', |
|
||||||
label: '回调地址', |
|
||||||
component: 'Input', |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'additionalInformation', |
|
||||||
label: '附加说明', |
|
||||||
component: 'InputTextArea', |
|
||||||
componentProps: { |
|
||||||
rows: 6 |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 24 |
|
||||||
} |
|
||||||
} |
|
||||||
]; |
|
@ -0,0 +1,34 @@ |
|||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
|
||||||
|
export const formSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'id', |
||||||
|
label: 'ID', |
||||||
|
component: 'Input', |
||||||
|
show: false |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'projectpath', |
||||||
|
label: '后端生成路径', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'frontpath', |
||||||
|
label: '前端生成路径', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'packagename', |
||||||
|
label: '默认包名', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'author', |
||||||
|
label: '默认作者', |
||||||
|
component: 'Input', |
||||||
|
required: true |
||||||
|
} |
||||||
|
]; |
@ -1,143 +1,117 @@ |
|||||||
<template> |
<template> |
||||||
<div> |
<div :class="prefixCls"> |
||||||
<BasicTable |
<ACard v-for="item in state.codeParamList" :key="item.id" title="代码生成器默认参数配置"> |
||||||
@register="registerTable" |
<template #extra><a @click="handleEdit(item)">编辑</a></template> |
||||||
@selection-change="handleSelectionChange" |
<AList :class="`${prefixCls}__content`"> |
||||||
> |
<a-list-item v-for="(col, index) in state.column" :key="index"> |
||||||
<template #toolbar> |
<a-list-item-meta> |
||||||
<a-button |
<template #description> |
||||||
v-auth="['client_add']" |
<div class="colName"> |
||||||
type="primary" |
{{ col.label }} |
||||||
@click="handleAdd()" |
</div> |
||||||
>新增客户端</a-button> |
<div class="colDescription"> |
||||||
<a-button |
{{ item[col.value] }} |
||||||
v-auth="['client_edit']" |
</div> |
||||||
type="primary" |
</template> |
||||||
:disabled="state.single" |
</a-list-item-meta> |
||||||
@click="handleEdit()" |
</a-list-item> |
||||||
>修改客户端</a-button> |
</AList> |
||||||
<a-button |
</ACard> |
||||||
v-auth="['client_del']" |
|
||||||
type="primary" |
|
||||||
:disabled="state.multiple" |
|
||||||
@click="handleDel()" |
|
||||||
>删除客户端</a-button> |
|
||||||
</template> |
|
||||||
<template #bodyCell="{ column, record }"> |
|
||||||
<template v-if="column.key === 'action'"> |
|
||||||
<TableAction |
|
||||||
:actions="[ |
|
||||||
{ |
|
||||||
label: '编辑', |
|
||||||
icon: 'fa6-regular:pen-to-square', |
|
||||||
auth: ['client_edit'], |
|
||||||
onClick: handleEdit.bind(null, record) |
|
||||||
}, |
|
||||||
{ |
|
||||||
label: '删除', |
|
||||||
icon: 'ant-design:delete-outlined', |
|
||||||
color: 'error', |
|
||||||
auth: ['client_del'], |
|
||||||
onClick: handleDel.bind(null, record) |
|
||||||
}]" |
|
||||||
/> |
|
||||||
</template> |
|
||||||
</template> |
|
||||||
</BasicTable> |
|
||||||
<!--弹出窗体区域--> |
<!--弹出窗体区域--> |
||||||
<ClientModal @register="registerModal" @success="handleRefreshTable"/> |
<GenCodeParamModal @register="registerModal" @success="handleRefreshTable"/> |
||||||
</div> |
</div> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||||
import { reactive, toRaw } from 'vue'; |
import { onBeforeMount, reactive } from 'vue'; |
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
import { listGenCodeParam } from '/@/api/platform/system/controller/genCodeParam'; |
||||||
import { listClient, delClient } from '/@/api/platform/system/controller/client'; |
|
||||||
import { useModal } from '/@/components/Modal'; |
import { useModal } from '/@/components/Modal'; |
||||||
import ClientModal from './ClientModal.vue'; |
import GenCodeParamModal from './GenCodeParamModal.vue'; |
||||||
import { columns, searchFormSchema } from './client.data'; |
|
||||||
import { useMessage } from '/@/hooks/web/useMessage'; |
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
|
import { Card, List } from 'ant-design-vue'; |
||||||
|
import type { GenCodeParam } from '/@/api/platform/system/entity/genCodeParam'; |
||||||
|
import {useDesign} from '/@/hooks/web/useDesign'; |
||||||
|
|
||||||
interface TableState { |
interface TableState { |
||||||
single: boolean; |
loading: boolean; |
||||||
multiple: boolean; |
codeParamList: GenCodeParam[]; |
||||||
|
column: Recordable[]; |
||||||
} |
} |
||||||
|
|
||||||
/** 通用变量统一声明区域 */ |
|
||||||
const state = reactive<TableState>({ |
const state = reactive<TableState>({ |
||||||
// 非单个禁用 |
loading: false, |
||||||
single: true, |
codeParamList: [], |
||||||
// 非多个禁用 |
column: [ |
||||||
multiple: true |
{ |
||||||
|
label: '后端生成路径', |
||||||
|
value: 'projectpath' |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '前端生成路径', |
||||||
|
value: 'frontpath' |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '默认包名', |
||||||
|
value: 'packagename' |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '默认作者', |
||||||
|
value: 'author' |
||||||
|
} |
||||||
|
] |
||||||
}); |
}); |
||||||
|
const ACard = Card; |
||||||
|
const AList = List; |
||||||
|
const { prefixCls } = useDesign('gen-custom-param'); |
||||||
const { createConfirm, createMessage } = useMessage(); |
const { createConfirm, createMessage } = useMessage(); |
||||||
const [registerModal, { openModal }] = useModal(); |
const [registerModal, { openModal }] = useModal(); |
||||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
|
||||||
title: '客户端列表', |
|
||||||
api: listClient, |
|
||||||
rowKey: 'clientId', |
|
||||||
columns, |
|
||||||
formConfig: { |
|
||||||
compact: true, |
|
||||||
labelWidth: 100, |
|
||||||
schemas: searchFormSchema, |
|
||||||
autoSubmitOnEnter: true, |
|
||||||
showAdvancedButton: true, |
|
||||||
autoAdvancedLine: 3, |
|
||||||
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
|
||||||
}, |
|
||||||
rowSelection: { type: 'checkbox' }, |
|
||||||
useSearchForm: true, |
|
||||||
showTableSetting: true, |
|
||||||
bordered: true, |
|
||||||
clickToRowSelect: false, |
|
||||||
showIndexColumn: false, |
|
||||||
actionColumn: { |
|
||||||
width: 220, |
|
||||||
title: '操作', |
|
||||||
dataIndex: 'action', |
|
||||||
//slots: { customRender: 'action' }, |
|
||||||
fixed: false |
|
||||||
}, |
|
||||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
|
||||||
}); |
|
||||||
|
|
||||||
/** 处理多选框选中数据 */ |
onBeforeMount(() => { |
||||||
function handleSelectionChange(selection?: Recordable) { |
getList(); |
||||||
const rowSelection = toRaw(selection?.keys) || []; |
}); |
||||||
state.single = rowSelection.length != 1; |
|
||||||
state.multiple = !rowSelection.length; |
|
||||||
} |
|
||||||
|
|
||||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
async function getList() { |
||||||
function handleAdd() { |
try { |
||||||
openModal(true,{ _tag: 'add' }); |
state.loading = true; |
||||||
|
const results = await listGenCodeParam(); |
||||||
|
state.codeParamList = results.data; |
||||||
|
} finally { |
||||||
|
state.loading = false; |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
/** 编辑按钮操作,行内编辑 */ |
function handleEdit(record: Recordable) { |
||||||
function handleEdit(record?: Recordable) { |
|
||||||
record = record || { clientId: getSelectRowKeys() }; |
|
||||||
openModal(true, { _tag: 'edit', record }); |
openModal(true, { _tag: 'edit', record }); |
||||||
} |
} |
||||||
|
|
||||||
/** 删除按钮操作,行内删除 */ |
|
||||||
async function handleDel(record?: Recordable) { |
|
||||||
const clientIds = record?.clientId || getSelectRowKeys(); |
|
||||||
createConfirm({ |
|
||||||
iconType: 'warning', |
|
||||||
title: '警告', |
|
||||||
content: `是否确认删除客户端编号为${clientIds}客户端吗?`, |
|
||||||
onOk: async () => { |
|
||||||
await delClient(clientIds); |
|
||||||
createMessage.success('删除成功!'); |
|
||||||
handleRefreshTable(); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
/** 处理表格刷新 */ |
|
||||||
function handleRefreshTable() { |
function handleRefreshTable() { |
||||||
clearSelectedRowKeys(); |
getList(); |
||||||
reload(); |
|
||||||
} |
} |
||||||
|
|
||||||
</script> |
</script> |
||||||
|
<style scoped lang="less"> |
||||||
|
@prefix-cls: ~'@{namespace}-gen-custom-param'; |
||||||
|
|
||||||
|
.@{prefix-cls} { |
||||||
|
:deep(.ant-card) { |
||||||
|
margin: 10px; |
||||||
|
border: 1px solid #EBEEF5; |
||||||
|
border-radius: 4px; |
||||||
|
} |
||||||
|
|
||||||
|
:deep(.ant-list-item-meta-description) { |
||||||
|
color: @text-color; |
||||||
|
} |
||||||
|
|
||||||
|
&__content { |
||||||
|
font-size: 20px; |
||||||
|
font-weight: bold; |
||||||
|
.colName { |
||||||
|
display: inline-block; |
||||||
|
width: 10%; |
||||||
|
} |
||||||
|
.colDescription { |
||||||
|
display: inline-block; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
|
Loading…
Reference in new issue