6 changed files with 147 additions and 157 deletions
@ -0,0 +1,64 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal |
||||||
|
v-bind="$attrs" |
||||||
|
width="720px" |
||||||
|
minHeight="100px" |
||||||
|
@register="registerModal" |
||||||
|
@ok="handleSubmit" |
||||||
|
> |
||||||
|
todo |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
<script lang="ts" setup> |
||||||
|
import { ref, unref } from 'vue'; |
||||||
|
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||||
|
|
||||||
|
/** 通用变量统一声明区域 */ |
||||||
|
const tag = ref<Nullable<string>>(''); |
||||||
|
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||||
|
const emit = defineEmits(['success', 'register']); |
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: BoxPayload = { _tag: '' }) => { |
||||||
|
// 处理清除脏数据 |
||||||
|
|
||||||
|
// 处理设置数据 |
||||||
|
tag.value = data._tag; |
||||||
|
const id = data.record?.id; |
||||||
|
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||||
|
// 采用tag标签区分操作 |
||||||
|
switch (unref(tag)) { |
||||||
|
case 'add': |
||||||
|
props.title = '新增流程表单'; |
||||||
|
break; |
||||||
|
case 'edit': |
||||||
|
props.title = '编辑流程表单'; |
||||||
|
// await setFieldsValue(await getFormDefinition(id)); |
||||||
|
break; |
||||||
|
} |
||||||
|
// 尾部:设置处理后的最终配置数据 |
||||||
|
setModalProps(props); |
||||||
|
}); |
||||||
|
|
||||||
|
/** 处理弹出框提交 */ |
||||||
|
async function handleSubmit() { |
||||||
|
try { |
||||||
|
// 提取验证数据 |
||||||
|
|
||||||
|
// 处理提交之前逻辑 |
||||||
|
setModalProps({ confirmLoading: true }); |
||||||
|
// 采用tag标签区分操作 |
||||||
|
switch (unref(tag)) { |
||||||
|
case 'add': |
||||||
|
|
||||||
|
break; |
||||||
|
case 'edit': |
||||||
|
|
||||||
|
break; |
||||||
|
} |
||||||
|
// 处理提交完成之后逻辑 |
||||||
|
closeModal(); |
||||||
|
emit('success'); |
||||||
|
} finally { |
||||||
|
setModalProps({ confirmLoading: false }); |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
@ -1,164 +1,79 @@ |
|||||||
/** |
|
||||||
* @program: kicc-ui |
|
||||||
* @description: 授权客户端模块动态渲染配置 |
|
||||||
* @author: entfrm开发团队-王翔 |
|
||||||
* @create: 2022/4/21 |
|
||||||
*/ |
|
||||||
|
|
||||||
import { BasicColumn } from '/@/components/Table'; |
import { BasicColumn } from '/@/components/Table'; |
||||||
import { FormSchema } from '/@/components/Table'; |
import { FormSchema } from '/@/components/Table'; |
||||||
|
import { h } from 'vue'; |
||||||
|
import { Tag } from 'ant-design-vue'; |
||||||
|
|
||||||
/** 表格列配置 */ |
|
||||||
export const columns: BasicColumn[] = [ |
export const columns: BasicColumn[] = [ |
||||||
{ |
{ |
||||||
title: '客户端Id', |
title: '流程定义ID', |
||||||
dataIndex: 'clientId', |
dataIndex: 'formDefinitionId', |
||||||
width: 100 |
width: 120 |
||||||
}, |
|
||||||
{ |
|
||||||
title: '客户端密钥', |
|
||||||
dataIndex: 'clientSecret', |
|
||||||
width: 100 |
|
||||||
}, |
}, |
||||||
{ |
{ |
||||||
title: '授权类型', |
title: '流程表单结构体', |
||||||
dataIndex: 'authorizedGrantTypes', |
dataIndex: 'json', |
||||||
width: 130 |
width: 220, |
||||||
|
ellipsis: true |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
title: '授权范围', |
title: '版本号', |
||||||
dataIndex: 'scope', |
dataIndex: 'version', |
||||||
width: 90 |
width: 80 |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
title: '令牌过期秒数', |
title: '状态', |
||||||
dataIndex: 'accessTokenValidity', |
dataIndex: 'status', |
||||||
width: 130 |
width: 90, |
||||||
}, |
customRender: ({ record }) => { |
||||||
{ |
return record.formDefinitionJson?.status == '1' ? |
||||||
title: '令牌过期秒数', |
h(Tag, { color: 'success' }, () => '已发布'): |
||||||
dataIndex: 'refreshTokenValidity', |
h(Tag, { color: 'red' }, () => '未发布'); |
||||||
width: 130 |
} |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
title: '创建时间', |
title: '是否主版本', |
||||||
dataIndex: 'createTime', |
dataIndex: 'isPrimary', |
||||||
width: 100 |
width: 90, |
||||||
|
customRender: ({ record }) => { |
||||||
|
return record.formDefinitionJson?.status == '1' ? |
||||||
|
h(Tag, { color: 'success' }, () => '主版本'): |
||||||
|
h(Tag, { color: 'red' }, () => '非主版本'); |
||||||
|
} |
||||||
} |
} |
||||||
]; |
]; |
||||||
|
|
||||||
/** 搜索表单配置 */ |
|
||||||
export const searchFormSchema: FormSchema[] = [ |
export const searchFormSchema: FormSchema[] = [ |
||||||
{ |
{ |
||||||
field: 'clientId', |
field: 'version', |
||||||
label: '客户端编码', |
label: '版本号', |
||||||
component: 'Input', |
component: 'Input', |
||||||
componentProps: { |
componentProps: { |
||||||
placeholder: '请输入客户端编码', |
placeholder: '请输入版本号', |
||||||
}, |
}, |
||||||
colProps: { span: 8 }, |
colProps: { span: 8 }, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
field: 'dateRange', |
field: 'status', |
||||||
label: '创建时间', |
label: '状态', |
||||||
component: 'RangePicker', |
component: 'Select', |
||||||
componentProps: { |
componentProps: { |
||||||
style: { width:'100%' }, |
options: [ |
||||||
valueFormat: 'YYYY-MM-DD', |
{ label: '未发布', value: '0' }, |
||||||
placeholder: ['开始日期','结束日期'] |
{ label: '已发布', value: '1' } |
||||||
|
] |
||||||
}, |
}, |
||||||
colProps: { span: 8 } |
colProps: { span: 8 } |
||||||
} |
|
||||||
]; |
|
||||||
|
|
||||||
/** 表单配置 */ |
|
||||||
export const formSchema: FormSchema[] = [ |
|
||||||
{ |
|
||||||
field: 'id', |
|
||||||
label: 'ID', |
|
||||||
component: 'Input', |
|
||||||
show: false |
|
||||||
}, |
}, |
||||||
{ |
{ |
||||||
field: 'clientId', |
field: 'isPrimary', |
||||||
label: '客户端Id', |
label: '是否主版本', |
||||||
component: 'Input', |
component: 'Select', |
||||||
required: true, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'clientSecret', |
|
||||||
label: '客户端密钥', |
|
||||||
component: 'Input', |
|
||||||
required: true, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'authorizedGrantTypes', |
|
||||||
label: '授权类型', |
|
||||||
component: 'InputTextArea', |
|
||||||
required:true, |
|
||||||
componentProps: { |
componentProps: { |
||||||
rows: 3 |
options: [ |
||||||
|
{ label: '非主版本', value: '0' }, |
||||||
|
{ label: '主版本', value: '1' } |
||||||
|
] |
||||||
}, |
}, |
||||||
colProps: { |
colProps: { span: 8 } |
||||||
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 |
|
||||||
} |
|
||||||
} |
} |
||||||
]; |
]; |
||||||
|
Loading…
Reference in new issue