3 changed files with 0 additions and 220 deletions
@ -1,88 +0,0 @@ |
|||||
import { FormSchema } from '/@/components/Table'; |
|
||||
import { BasicColumn } from '/@/components/Table'; |
|
||||
import { ClientServiceProxy, PagingClientListInput } from '/@/services/ServiceProxies'; |
|
||||
|
|
||||
export const searchFormSchema: FormSchema[] = [ |
|
||||
{ |
|
||||
field: 'filter', |
|
||||
label: '关键字', |
|
||||
component: 'Input', |
|
||||
colProps: { span: 8 }, |
|
||||
}, |
|
||||
]; |
|
||||
|
|
||||
export const tableColumns: BasicColumn[] = [ |
|
||||
{ |
|
||||
title: 'ClientId', |
|
||||
dataIndex: 'clientId', |
|
||||
}, |
|
||||
{ |
|
||||
title: 'ClientName', |
|
||||
dataIndex: 'clientName', |
|
||||
}, |
|
||||
{ |
|
||||
title: '是否启用', |
|
||||
dataIndex: 'enabled', |
|
||||
slots: { customRender: 'enabled' }, |
|
||||
}, |
|
||||
{ |
|
||||
title: 'AccessTokenLifetime', |
|
||||
dataIndex: 'accessTokenLifetime', |
|
||||
}, |
|
||||
{ |
|
||||
title: 'AbsoluteRefreshTokenLifetime', |
|
||||
dataIndex: 'absoluteRefreshTokenLifetime', |
|
||||
}, |
|
||||
{ |
|
||||
title: 'Description', |
|
||||
dataIndex: 'description', |
|
||||
}, |
|
||||
]; |
|
||||
|
|
||||
export const createFormSchema: FormSchema[] = [ |
|
||||
{ |
|
||||
field: 'clientId', |
|
||||
label: 'ClientId', |
|
||||
component: 'Input', |
|
||||
required: true, |
|
||||
colProps: { span: 18 }, |
|
||||
}, |
|
||||
{ |
|
||||
field: 'clientName', |
|
||||
label: 'ClientName', |
|
||||
component: 'Input', |
|
||||
required: true, |
|
||||
colProps: { span: 18 }, |
|
||||
}, |
|
||||
{ |
|
||||
field: 'description', |
|
||||
label: 'Description', |
|
||||
component: 'Input', |
|
||||
required: true, |
|
||||
colProps: { span: 18 }, |
|
||||
}, |
|
||||
]; |
|
||||
|
|
||||
/** |
|
||||
* 分页列表 |
|
||||
* @param params |
|
||||
* @returns |
|
||||
*/ |
|
||||
export async function getTableListAsync(params: PagingClientListInput) { |
|
||||
const _clientServiceProxy = new ClientServiceProxy(); |
|
||||
return _clientServiceProxy.page(params); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 创建client |
|
||||
* @param params |
|
||||
* @returns |
|
||||
*/ |
|
||||
export async function createClientAsync({ request, changeOkLoading, validate, closeModal }) { |
|
||||
changeOkLoading(true); |
|
||||
await validate(); |
|
||||
const _clientServiceProxy = new ClientServiceProxy(); |
|
||||
await _clientServiceProxy.create(request); |
|
||||
changeOkLoading(false); |
|
||||
closeModal(); |
|
||||
} |
|
||||
@ -1,71 +0,0 @@ |
|||||
<template> |
|
||||
<div> |
|
||||
<BasicTable @register="registerTable" size="small"> |
|
||||
<template #toolbar> |
|
||||
<a-button type="primary" @click="openCreateClientModal"> |
|
||||
{{ t('common.createText') }} |
|
||||
</a-button> |
|
||||
</template> |
|
||||
<template #enabled="{ record }"> |
|
||||
<Tag :color="record.enabled ? 'green' : 'red'"> |
|
||||
{{ record.enabled ? '是' : '否' }} |
|
||||
</Tag> |
|
||||
</template> |
|
||||
</BasicTable> |
|
||||
<CreateClient @register="registerCreateClientModal" @reload="reload" :bodyStyle="{ 'padding-top': '0' }" /> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script lang="ts"> |
|
||||
import { defineComponent } from 'vue'; |
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
|
||||
import { tableColumns, searchFormSchema, getTableListAsync } from './Clients'; |
|
||||
import { useI18n } from '/@/hooks/web/useI18n'; |
|
||||
import { Tag } from 'ant-design-vue'; |
|
||||
import CreateClient from './CreateClient.vue'; |
|
||||
import { useModal } from '/@/components/Modal'; |
|
||||
export default defineComponent({ |
|
||||
name: 'Clients', |
|
||||
components: { |
|
||||
BasicTable, |
|
||||
TableAction, |
|
||||
Tag, |
|
||||
CreateClient, |
|
||||
}, |
|
||||
setup() { |
|
||||
const { t } = useI18n(); |
|
||||
// table配置 |
|
||||
const [registerTable] = useTable({ |
|
||||
columns: tableColumns, |
|
||||
formConfig: { |
|
||||
labelWidth: 70, |
|
||||
schemas: searchFormSchema, |
|
||||
}, |
|
||||
api: getTableListAsync, |
|
||||
showTableSetting: true, |
|
||||
useSearchForm: true, |
|
||||
bordered: true, |
|
||||
canResize: true, |
|
||||
showIndexColumn: true, |
|
||||
actionColumn: { |
|
||||
width: 150, |
|
||||
title: t('common.action'), |
|
||||
dataIndex: 'action', |
|
||||
slots: { |
|
||||
customRender: 'action', |
|
||||
}, |
|
||||
fixed: 'right', |
|
||||
}, |
|
||||
}); |
|
||||
|
|
||||
const [registerCreateClientModal, { openModal: openCreateClientModal }] = useModal(); |
|
||||
return { |
|
||||
registerTable, |
|
||||
registerCreateClientModal, |
|
||||
openCreateClientModal, |
|
||||
}; |
|
||||
}, |
|
||||
}); |
|
||||
</script> |
|
||||
|
|
||||
<style lang="less" scoped></style> |
|
||||
@ -1,61 +0,0 @@ |
|||||
<template> |
|
||||
<BasicModal :title="创建Client" :canFullscreen="false" @ok="submit" @cancel="cancel" @register="registerModal"> |
|
||||
<BasicForm @register="registerUserForm" /> |
|
||||
</BasicModal> |
|
||||
</template> |
|
||||
|
|
||||
<script lang="ts"> |
|
||||
import { defineComponent, useContext, defineEmit } from 'vue'; |
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'; |
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
|
||||
import { createFormSchema, createClientAsync } from './Clients'; |
|
||||
import { useI18n } from '/@/hooks/web/useI18n'; |
|
||||
|
|
||||
export default defineComponent({ |
|
||||
name: 'CreateAbpRole', |
|
||||
components: { |
|
||||
BasicModal, |
|
||||
BasicForm, |
|
||||
}, |
|
||||
setup() { |
|
||||
// 加载父组件方法 |
|
||||
defineEmit(['reload']); |
|
||||
const ctx = useContext(); |
|
||||
|
|
||||
const { t } = useI18n(); |
|
||||
const [registerUserForm, { getFieldsValue, validate, resetFields }] = useForm({ |
|
||||
labelWidth: 120, |
|
||||
schemas: createFormSchema, |
|
||||
showActionButtonGroup: false, |
|
||||
}); |
|
||||
|
|
||||
const [registerModal, { changeOkLoading, closeModal }] = useModalInner(); |
|
||||
|
|
||||
// 保存角色 |
|
||||
const submit = async () => { |
|
||||
try { |
|
||||
const request = getFieldsValue(); |
|
||||
await createClientAsync({ request, changeOkLoading, validate, closeModal }); |
|
||||
resetFields(); |
|
||||
ctx.emit('reload'); |
|
||||
} catch (error) { |
|
||||
changeOkLoading(false); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
const cancel = () => { |
|
||||
resetFields(); |
|
||||
closeModal(); |
|
||||
}; |
|
||||
return { |
|
||||
t, |
|
||||
registerModal, |
|
||||
registerUserForm, |
|
||||
submit, |
|
||||
cancel, |
|
||||
}; |
|
||||
}, |
|
||||
}); |
|
||||
</script> |
|
||||
|
|
||||
<style lang="less" scoped></style> |
|
||||
Loading…
Reference in new issue