14 changed files with 1479 additions and 0 deletions
@ -0,0 +1,125 @@
@@ -0,0 +1,125 @@
|
||||
<template> |
||||
<BasicModal |
||||
v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"> |
||||
<template #tip> |
||||
<div class="tip"> |
||||
<p> |
||||
注意:按钮编码不能重复,系统按钮以_flow_开头,自定义按钮不能以_flow_开头。 |
||||
系统按钮和自定义按钮的区别是,系统按钮是绑定具体的action进行提交,如果你定义了系统按钮,必须在代码中实现对应的action方法。 |
||||
自定义按钮无需在代码中添加action方法,触发自定义按钮时调用的是【同意】按钮对应的action,并把该按钮对应的code设置为true、其他自定义按钮对应的code设置为false作为流程变量进行提交。 |
||||
</p> |
||||
</div> |
||||
</template> |
||||
</BasicForm> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './button.data'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
import { isEmpty } from '/@/utils/is'; |
||||
import { listButton, getButton, editButton, addButton } from '/@/api/platform/workflow/extension/controller/button'; |
||||
|
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const tag = ref<Nullable<string>>(''); |
||||
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||
const emit = defineEmits(['success', 'register']); |
||||
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema }] = useForm({ |
||||
labelWidth: 100, |
||||
schemas: formSchema, |
||||
showActionButtonGroup: false, |
||||
baseColProps: { span: 24 }, |
||||
colon: false, |
||||
}); |
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: BoxPayload = { _tag: '' }) => { |
||||
// 处理清除脏数据 |
||||
await resetFields(); |
||||
await clearValidate(); |
||||
// 处理设置数据 |
||||
tag.value = data._tag; |
||||
const id = data.record?.id; |
||||
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||
await updateSchema({ |
||||
field: 'code', |
||||
componentProps: { |
||||
disabled: unref(tag) != 'add' |
||||
}, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
whitespace: true, |
||||
message: '请输入按钮编码' |
||||
}, |
||||
{ |
||||
validator: async (rule, value) => { |
||||
if (!isEmpty(value)) { |
||||
const result = await listButton({ code: value }); |
||||
// 支持修改 |
||||
const list = result.data?.filter(item => item.code != value); |
||||
if(list?.length > 0) return Promise.reject('该按钮编码已存在'); |
||||
} |
||||
return Promise.resolve(); |
||||
}, |
||||
validateTrigger: 'blur' |
||||
}] |
||||
}); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增按钮'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑按钮'; |
||||
await setFieldsValue(await getButton(id)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addButton(formData); |
||||
break; |
||||
case 'edit': |
||||
await editButton(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
||||
<style lang="less" scoped> |
||||
.tip { |
||||
padding: 8px 16px; |
||||
background-color: #ecf8ff; |
||||
border-radius: 4px; |
||||
border-left: 5px solid #50bfff; |
||||
margin: 20px 0; |
||||
} |
||||
</style> |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
|
||||
/** 表格列配置 */ |
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '名称', |
||||
dataIndex: 'name', |
||||
}, |
||||
{ |
||||
title: '编码', |
||||
dataIndex: 'code', |
||||
}, |
||||
{ |
||||
title: '排序', |
||||
dataIndex: 'sort', |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入名称', |
||||
}, |
||||
colProps: { span: 8 }, |
||||
}, |
||||
{ |
||||
field: 'code', |
||||
label: '编码', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入编码', |
||||
}, |
||||
colProps: { span: 8 }, |
||||
}, |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '名称', |
||||
component: 'Input', |
||||
required: true, |
||||
}, |
||||
{ |
||||
field: 'code', |
||||
label: '编码', |
||||
component: 'Input', |
||||
required: true, |
||||
}, |
||||
{ |
||||
field: 'tip', |
||||
label: ' ', |
||||
component: 'Input', |
||||
slot: 'tip', |
||||
}, |
||||
{ |
||||
field: 'sort', |
||||
label: '排序', |
||||
component: 'InputNumber', |
||||
componentProps: { |
||||
style: { width:'100%' }, |
||||
min: 0 |
||||
}, |
||||
required: true, |
||||
}, |
||||
]; |
@ -0,0 +1,154 @@
@@ -0,0 +1,154 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable |
||||
@register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button |
||||
type="primary" |
||||
@click="handleAdd()" |
||||
>新增</a-button> |
||||
<a-button |
||||
type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改</a-button> |
||||
<a-button |
||||
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', |
||||
onClick: handleView.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
<ButtonModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listButton, delButton } from '/@/api/platform/workflow/extension/controller/button'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import ButtonModal from './ButtonModal.vue'; |
||||
import { columns, searchFormSchema } from './button.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
ids: string[]; |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '按钮列表', |
||||
api: listButton, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
compact: true, |
||||
labelWidth: 100, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true, |
||||
showAdvancedButton: true, |
||||
autoAdvancedLine: 3, |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.ids = rowSelection; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: toRaw(state.ids) }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
function handleView(record: Recordable) { |
||||
openModal(true, { _tag: 'view', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || toRaw(state.ids); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: '是否确认删除所选项编号为"' + ids + '"的数据项?', |
||||
onOk: async () => { |
||||
await delButton(ids); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
</script> |
@ -0,0 +1,90 @@
@@ -0,0 +1,90 @@
|
||||
<template> |
||||
<BasicModal |
||||
v-bind="$attrs" |
||||
width="720px" |
||||
@ok="handleSubmit" |
||||
@register="registerModal" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './category.data'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
import { listProcessCategory, getProcessCategory, addProcessCategory, editProcessCategory } from '/@/api/platform/workflow/extension/controller/processCategory'; |
||||
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const tag = ref<Nullable<string>>(''); |
||||
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||
const emit = defineEmits(['success', 'register']); |
||||
const [registerForm, { resetFields, setFieldsValue, updateSchema, validate, clearValidate }] = useForm({ |
||||
labelWidth: 100, |
||||
schemas: formSchema, |
||||
showActionButtonGroup: false, |
||||
baseColProps: { span: 24 } |
||||
}); |
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: BoxPayload = { _tag: '' }) => { |
||||
// 处理清除脏数据 |
||||
await resetFields(); |
||||
await clearValidate(); |
||||
// 处理设置数据 |
||||
tag.value = data._tag; |
||||
const topTree = { id: '0', name: '顶级分类', children: [] }; |
||||
topTree.children = listToTree(await listProcessCategory()); |
||||
await updateSchema({ |
||||
field: 'parentId', |
||||
componentProps: { |
||||
treeData: [topTree] |
||||
} |
||||
}); |
||||
const id = data.record?.id; |
||||
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增流程分类'; |
||||
id && await setFieldsValue({ parentId: id }); |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑流程分类'; |
||||
await setFieldsValue(await getProcessCategory(id)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addProcessCategory(formData); |
||||
break; |
||||
case 'edit': |
||||
await editProcessCategory(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
|
||||
/** 表格列配置 */ |
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '分类名称', |
||||
dataIndex: 'name', |
||||
align: 'left' |
||||
}, |
||||
{ |
||||
title: '排序', |
||||
dataIndex: 'sort' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime' |
||||
}, |
||||
{ |
||||
title: '备注信息', |
||||
dataIndex: 'remarks' |
||||
}, |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '分类名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入分类名称' |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'parentId', |
||||
label: '上级流程分类', |
||||
component: 'TreeSelect', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
fieldNames: { |
||||
label: 'name', |
||||
key: 'id', |
||||
value: 'id', |
||||
}, |
||||
} |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '分类名称', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'sort', |
||||
label: '排序', |
||||
component: 'InputNumber', |
||||
componentProps: { |
||||
style: { width:'100%' }, |
||||
min: 0 |
||||
}, |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'remarks', |
||||
label: '备注信息', |
||||
component: 'InputTextArea', |
||||
componentProps: { |
||||
rows: 6 |
||||
}, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable"> |
||||
<template #toolbar> |
||||
<a-button type="primary" @click="handleAdd()">新增</a-button> |
||||
<a-button type="default" @click="expandAll">展开全部</a-button> |
||||
<a-button type="default" @click="collapseAll">折叠全部</a-button> |
||||
</template> |
||||
<template #bodyCell="{ column, record }"> |
||||
<template v-if="column.key === 'action'"> |
||||
<TableAction |
||||
:actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '新增', |
||||
icon: 'ant-design:plus-circle-outlined', |
||||
onClick: handleAdd.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
popConfirm: { |
||||
title: '是否确认删除', |
||||
confirm: handleDel.bind(null, record) |
||||
} |
||||
} |
||||
]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
<CategoryModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import CategoryModal from './CategoryModal.vue'; |
||||
import { columns, searchFormSchema } from './category.data'; |
||||
import { delProcessCategory, listProcessCategory } from '/@/api/platform/workflow/extension/controller/processCategory'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const { createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, expandAll, collapseAll, getDataSource }] = useTable({ |
||||
title: '流程分类列表', |
||||
api: listProcessCategory, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
compact: true, |
||||
labelWidth: 100, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true, |
||||
showAdvancedButton: true, |
||||
autoAdvancedLine: 3, |
||||
}, |
||||
isTreeTable: true, |
||||
pagination: false, |
||||
striped: false, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
showIndexColumn: false, |
||||
canResize: false, |
||||
actionColumn: { |
||||
width: 250, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
fixed: false |
||||
}, |
||||
afterFetch: result => listToTree(result), |
||||
}); |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd(record?: Recordable) { |
||||
openModal(true, { _tag: 'add', record }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record: Recordable) { |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record: Recordable) { |
||||
await delProcessCategory(record.id); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
<template> |
||||
<BasicModal |
||||
v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './condition.data'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
import { getCondition, editCondition, addCondition } from '/@/api/platform/workflow/extension/controller/condition'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const tag = ref<Nullable<string>>(''); |
||||
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||
const emit = defineEmits(['success', 'register']); |
||||
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema }] = useForm({ |
||||
labelWidth: 100, |
||||
schemas: formSchema, |
||||
showActionButtonGroup: false, |
||||
baseColProps: { span: 24 }, |
||||
}); |
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: BoxPayload = { _tag: '' }) => { |
||||
// 处理清除脏数据 |
||||
await resetFields(); |
||||
await clearValidate(); |
||||
// 处理设置数据 |
||||
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 getCondition(id)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addCondition(formData); |
||||
break; |
||||
case 'edit': |
||||
await editCondition(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
|
||||
/** 表格列配置 */ |
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '名称', |
||||
dataIndex: 'name', |
||||
}, |
||||
{ |
||||
title: '表达式', |
||||
dataIndex: 'expression', |
||||
}, |
||||
{ |
||||
title: '备注信息', |
||||
dataIndex: 'remarks' |
||||
}, |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入名称', |
||||
}, |
||||
colProps: { span: 8 }, |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '名称', |
||||
component: 'Input', |
||||
required: true, |
||||
}, |
||||
{ |
||||
field: 'expression', |
||||
label: '表达式', |
||||
component: 'Input', |
||||
required: true, |
||||
}, |
||||
{ |
||||
field: 'remarks', |
||||
label: '备注信息', |
||||
component: 'InputTextArea', |
||||
componentProps: { |
||||
rows: 6 |
||||
}, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,150 @@
@@ -0,0 +1,150 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable |
||||
@register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button |
||||
type="primary" |
||||
@click="handleAdd()" |
||||
>新增</a-button> |
||||
<a-button |
||||
type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改</a-button> |
||||
<a-button |
||||
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', |
||||
onClick: handleView.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
<ConditionModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listCondition, delCondition } from '/@/api/platform/workflow/extension/controller/condition'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import ConditionModal from './ConditionModal.vue'; |
||||
import { columns, searchFormSchema } from './condition.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
ids: string[]; |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '表达式列表', |
||||
api: listCondition, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
compact: true, |
||||
labelWidth: 100, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true, |
||||
showAdvancedButton: true, |
||||
autoAdvancedLine: 3, |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.ids = rowSelection; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: toRaw(state.ids) }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
function handleView(record: Recordable) { |
||||
openModal(true, { _tag: 'view', record }); |
||||
} |
||||
|
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || toRaw(state.ids); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: '是否确认删除所选项编号为"' + ids + '"的数据项?', |
||||
onOk: async () => { |
||||
await delCondition(ids); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
</script> |
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
<template> |
||||
<BasicModal |
||||
v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './listener.data'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
import { getListener, editListener, addListener } from '/@/api/platform/workflow/extension/controller/listener'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const tag = ref<Nullable<string>>(''); |
||||
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||
const emit = defineEmits(['success', 'register']); |
||||
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema }] = useForm({ |
||||
labelWidth: 100, |
||||
schemas: formSchema, |
||||
showActionButtonGroup: false, |
||||
baseColProps: { span: 24 }, |
||||
}); |
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: BoxPayload = { _tag: '' }) => { |
||||
// 处理清除脏数据 |
||||
await resetFields(); |
||||
await clearValidate(); |
||||
// 处理设置数据 |
||||
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 getListener(id)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addListener(formData); |
||||
break; |
||||
case 'edit': |
||||
await editListener(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,150 @@
@@ -0,0 +1,150 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable |
||||
@register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button |
||||
type="primary" |
||||
@click="handleAdd()" |
||||
>新增</a-button> |
||||
<a-button |
||||
type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改</a-button> |
||||
<a-button |
||||
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', |
||||
onClick: handleView.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
<ListenerModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listListener, delListener } from '/@/api/platform/workflow/extension/controller/listener'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import ListenerModal from './ListenerModal.vue'; |
||||
import { columns, searchFormSchema } from './listener.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
ids: string[]; |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '监听器列表', |
||||
api: listListener, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
compact: true, |
||||
labelWidth: 100, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true, |
||||
showAdvancedButton: true, |
||||
autoAdvancedLine: 3, |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.ids = rowSelection; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: toRaw(state.ids) }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
function handleView(record: Recordable) { |
||||
openModal(true, { _tag: 'view', record }); |
||||
} |
||||
|
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || toRaw(state.ids); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: '是否确认删除所选项编号为"' + ids + '"的数据项?', |
||||
onOk: async () => { |
||||
await delListener(ids); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
</script> |
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
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: '监听器名称', |
||||
dataIndex: 'name', |
||||
}, |
||||
{ |
||||
title: '监听器类型', |
||||
dataIndex: 'listenerType', |
||||
customRender: ({ record }) => { |
||||
const type = record.listenerType; |
||||
return h(Tag, { color: 'processing' }, () => ~~type === 1 ? '执行监听器' : '任务监听器'); |
||||
} |
||||
}, |
||||
{ |
||||
title: '事件', |
||||
dataIndex: 'event', |
||||
}, |
||||
{ |
||||
title: '值类型', |
||||
dataIndex: 'valueType', |
||||
customRender: ({ record }) => { |
||||
return {'1':'类', '2':'表达式', '3':'委托表达式'}[record.valueType || '1']; |
||||
} |
||||
}, |
||||
{ |
||||
title: '值', |
||||
dataIndex: 'value' |
||||
}, |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '监听器名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入名称', |
||||
}, |
||||
colProps: { span: 8 }, |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '监听器名称', |
||||
component: 'Input', |
||||
required: true, |
||||
}, |
||||
{ |
||||
field: 'listenerType', |
||||
label: '监听器类型', |
||||
component: 'RadioButtonGroup', |
||||
defaultValue: '1', |
||||
componentProps: ({ formModel, formActionType }) => ({ |
||||
options: [ |
||||
{ label: '执行监听器', value: '1' }, |
||||
{ label: '任务监听器', value: '2' }, |
||||
], |
||||
onChange: async (e: any) => { |
||||
let eventOptions = e == 1 |
||||
? [ |
||||
{label: 'start', value: 'start'}, |
||||
{label: 'take', value: 'take'}, |
||||
{label: 'end', value: 'end'} |
||||
] : [ |
||||
{label: 'start', value: 'start'}, |
||||
{label: 'assignment', value: 'assignment'}, |
||||
{label: 'complete', value: 'complete'}, |
||||
{label: 'delete', value: 'delete'} |
||||
]; |
||||
if (e === undefined) { |
||||
eventOptions = []; |
||||
} |
||||
formModel.event = undefined; // reset city value
|
||||
const { updateSchema } = formActionType; |
||||
await updateSchema({ |
||||
field: 'event', |
||||
componentProps: { |
||||
options: eventOptions, |
||||
}, |
||||
}); |
||||
} |
||||
}), |
||||
}, |
||||
{ |
||||
field: 'event', |
||||
label: '事件', |
||||
component: 'Select', |
||||
required: true, |
||||
componentProps: { |
||||
options: [] |
||||
} |
||||
}, |
||||
|
||||
{ |
||||
field: 'valueType', |
||||
label: '值类型', |
||||
component: 'RadioButtonGroup', |
||||
defaultValue: '1', |
||||
componentProps: ({ formModel, formActionType }) => ({ |
||||
options: [ |
||||
{ label: '类', value: '1' }, |
||||
{ label: '表达式', value: '2' }, |
||||
{ label: '委托表达式', value: '3' }, |
||||
], |
||||
onChange: async (e: any) => { |
||||
let valueLabel = {'1':'类', '2':'表达式', '3':'委托表达式'}[e || '1']; |
||||
const { updateSchema } = formActionType; |
||||
await updateSchema({ |
||||
field: 'value', |
||||
label: valueLabel |
||||
}); |
||||
} |
||||
}), |
||||
}, |
||||
{ |
||||
field: 'value', |
||||
label: '类', |
||||
component: 'Input', |
||||
required: true, |
||||
componentProps: { |
||||
placeholder: '请填写值', |
||||
}, |
||||
} |
||||
]; |
@ -0,0 +1,148 @@
@@ -0,0 +1,148 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #tableTitle> |
||||
<a-button |
||||
danger |
||||
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-solid:bars-progress', |
||||
onClick: handleViewAudit.bind(null, record) |
||||
}, { |
||||
label: '删除', |
||||
icon: 'fa-solid:toggle-on', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts"> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,不采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { defineComponent, reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { columns } from './workflowCopy.data'; |
||||
import { getTaskDefinition } from '/@/api/platform/workflow/controller/task'; |
||||
import { PageEnum } from '/@/enums/workflowEnum'; |
||||
import { useRouter } from 'vue-router'; |
||||
import { listWorkflowCopy, delWorkflowCopy } from '/@/api/platform/workflow/extension/controller/workflowCopy'; |
||||
import {useMessage} from '/@/hooks/web/useMessage'; |
||||
|
||||
interface TableState { |
||||
ids: string[]; |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
export default defineComponent({ |
||||
name: 'WorkflowCopy', |
||||
components: { |
||||
BasicTable, |
||||
TableAction, |
||||
}, |
||||
setup() { |
||||
const state = reactive<TableState>({ |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
}); |
||||
const { push } = useRouter(); |
||||
const { createConfirm } = useMessage(); |
||||
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({ |
||||
api: listWorkflowCopy, |
||||
rowKey: 'id', |
||||
columns, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: false, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 240, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.ids = rowSelection; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
async function handleViewAudit(record: Recordable) { |
||||
const task = await getTaskDefinition({ |
||||
processInsId: record.processInsId, |
||||
processDefId: record.processDefId |
||||
}); |
||||
await push({ |
||||
path: PageEnum.TASK_FORM_VIEW_PAGE, |
||||
query: { |
||||
_meta: 'y', |
||||
title: record.processInsName, |
||||
formTitle: record.processInsName, |
||||
formType: task.formType, |
||||
formKey: task.formKey, |
||||
processDefKey: task.processDefKey, |
||||
taskDefKey: task.taskDefKey, |
||||
processInsId: task.processInsId, |
||||
processDefId: task.processDefId, |
||||
taskId: task.taskId, |
||||
businessId: task.businessId |
||||
} |
||||
}); |
||||
} |
||||
|
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || toRaw(state.ids); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: '是否确认删除所选项编号为"' + ids + '"的数据项?', |
||||
onOk: async () => { |
||||
await delWorkflowCopy(ids); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
return { |
||||
state, |
||||
registerTable, |
||||
handleViewAudit, |
||||
handleDel, |
||||
handleSelectionChange |
||||
}; |
||||
} |
||||
}); |
||||
</script> |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
|
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '实例标题', |
||||
dataIndex: 'processInsName', |
||||
}, |
||||
{ |
||||
title: '抄送日期', |
||||
dataIndex: 'createTime', |
||||
customRender: ({ record }) => { |
||||
return record.createTime || '--'; |
||||
} |
||||
}, |
||||
{ |
||||
title: '抄送发起人', |
||||
dataIndex: 'createByName' |
||||
} |
||||
]; |
||||
|
Loading…
Reference in new issue