6 changed files with 147 additions and 157 deletions
@ -0,0 +1,64 @@
@@ -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 @@
@@ -1,164 +1,79 @@
|
||||
/** |
||||
* @program: kicc-ui |
||||
* @description: 授权客户端模块动态渲染配置 |
||||
* @author: entfrm开发团队-王翔 |
||||
* @create: 2022/4/21 |
||||
*/ |
||||
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
import { h } from 'vue'; |
||||
import { Tag } from 'ant-design-vue'; |
||||
|
||||
/** 表格列配置 */ |
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '客户端Id', |
||||
dataIndex: 'clientId', |
||||
width: 100 |
||||
}, |
||||
{ |
||||
title: '客户端密钥', |
||||
dataIndex: 'clientSecret', |
||||
width: 100 |
||||
title: '流程定义ID', |
||||
dataIndex: 'formDefinitionId', |
||||
width: 120 |
||||
}, |
||||
{ |
||||
title: '授权类型', |
||||
dataIndex: 'authorizedGrantTypes', |
||||
width: 130 |
||||
title: '流程表单结构体', |
||||
dataIndex: 'json', |
||||
width: 220, |
||||
ellipsis: true |
||||
}, |
||||
{ |
||||
title: '授权范围', |
||||
dataIndex: 'scope', |
||||
width: 90 |
||||
title: '版本号', |
||||
dataIndex: 'version', |
||||
width: 80 |
||||
}, |
||||
{ |
||||
title: '令牌过期秒数', |
||||
dataIndex: 'accessTokenValidity', |
||||
width: 130 |
||||
}, |
||||
{ |
||||
title: '令牌过期秒数', |
||||
dataIndex: 'refreshTokenValidity', |
||||
width: 130 |
||||
title: '状态', |
||||
dataIndex: 'status', |
||||
width: 90, |
||||
customRender: ({ record }) => { |
||||
return record.formDefinitionJson?.status == '1' ? |
||||
h(Tag, { color: 'success' }, () => '已发布'): |
||||
h(Tag, { color: 'red' }, () => '未发布'); |
||||
} |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 100 |
||||
title: '是否主版本', |
||||
dataIndex: 'isPrimary', |
||||
width: 90, |
||||
customRender: ({ record }) => { |
||||
return record.formDefinitionJson?.status == '1' ? |
||||
h(Tag, { color: 'success' }, () => '主版本'): |
||||
h(Tag, { color: 'red' }, () => '非主版本'); |
||||
} |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'clientId', |
||||
label: '客户端编码', |
||||
field: 'version', |
||||
label: '版本号', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入客户端编码', |
||||
placeholder: '请输入版本号', |
||||
}, |
||||
colProps: { span: 8 }, |
||||
}, |
||||
{ |
||||
field: 'dateRange', |
||||
label: '创建时间', |
||||
component: 'RangePicker', |
||||
field: 'status', |
||||
label: '状态', |
||||
component: 'Select', |
||||
componentProps: { |
||||
style: { width:'100%' }, |
||||
valueFormat: 'YYYY-MM-DD', |
||||
placeholder: ['开始日期','结束日期'] |
||||
options: [ |
||||
{ label: '未发布', value: '0' }, |
||||
{ label: '已发布', value: '1' } |
||||
] |
||||
}, |
||||
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, |
||||
field: 'isPrimary', |
||||
label: '是否主版本', |
||||
component: 'Select', |
||||
componentProps: { |
||||
rows: 3 |
||||
options: [ |
||||
{ label: '非主版本', value: '0' }, |
||||
{ label: '主版本', value: '1' } |
||||
] |
||||
}, |
||||
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 |
||||
} |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
Loading…
Reference in new issue