增加系统配置界面

序号列右对齐
流程元素名称空报错修复
This commit is contained in:
yaoyn
2024-08-01 11:07:29 +08:00
parent 63babbd93d
commit a5fc193967
9 changed files with 1246 additions and 3 deletions

View File

@ -0,0 +1,110 @@
import { XjrSystemConfigPageModel, XjrSystemConfigPageParams, XjrSystemConfigPageResult } from './model/SystemConfigModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/system/systemConfig/page',
List = '/system/systemConfig/list',
Info = '/system/systemConfig/info',
XjrSystemConfig = '/system/systemConfig',
Export = '/system/systemConfig/export',
}
/**
* @description: 查询XjrSystemConfig分页列表
*/
export async function getXjrSystemConfigPage(params: XjrSystemConfigPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<XjrSystemConfigPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取XjrSystemConfig信息
*/
export async function getXjrSystemConfig(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<XjrSystemConfigPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增XjrSystemConfig
*/
export async function addXjrSystemConfig(xjrSystemConfig: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.XjrSystemConfig,
params: xjrSystemConfig,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新XjrSystemConfig
*/
export async function updateXjrSystemConfig(xjrSystemConfig: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.XjrSystemConfig,
params: xjrSystemConfig,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除XjrSystemConfig批量删除
*/
export async function deleteXjrSystemConfig(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.XjrSystemConfig,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 导出XjrSystemConfig
*/
export async function exportXjrSystemConfig(
params?: object,
mode: ErrorMessageMode = 'modal'
) {
return defHttp.download(
{
url: Api.Export,
method: 'GET',
params,
responseType: 'blob',
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,63 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: XjrSystemConfig分页参数 模型
*/
export interface XjrSystemConfigPageParams extends BasicPageParams {
code: string;
name: string;
value: string;
remark: string;
}
/**
* @description: XjrSystemConfig分页返回值模型
*/
export interface XjrSystemConfigPageModel {
id: string;
code: string;
name: string;
value: string;
remark: string;
}
/**
* @description: XjrSystemConfig表类型
*/
export interface XjrSystemConfigModel {
id: number;
code: string;
name: string;
value: string;
remark: string;
createDate: string;
createUserId: number;
modifyDate: string;
modifyUserId: number;
deleteMark: number;
enabledMark: number;
tenantId: number;
}
/**
* @description: XjrSystemConfig分页返回值结构
*/
export type XjrSystemConfigPageResult = BasicFetchResult<XjrSystemConfigPageModel>;

View File

@ -67,7 +67,7 @@ function handleIndexColumn(
flag: INDEX_COLUMN_FLAG,
width: 50,
title: t('序号'),
align: 'center',
align: 'right',
customRender: ({ index }) => {
const getPagination = unref(getPaginationRef);
if (isBoolean(getPagination)) {

View File

@ -0,0 +1,174 @@
<template>
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
/>
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted } from 'vue';
import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addXjrSystemConfig, getXjrSystemConfig, updateXjrSystemConfig } from '/@/api/system/systemConfig';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
const { filterFormSchemaAuth } = usePermission();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: cloneDeep(formProps),
});
const state = reactive({
formModel: {},
});
onMounted(async () => {
try {
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(formProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId) {
try {
const record = await getXjrSystemConfig(rowId);
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm() {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateXjrSystemConfig(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addXjrSystemConfig(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
let flowData = changeWorkFlowForm(cloneDeep(formProps), obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
});
</script>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true });
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

View File

@ -0,0 +1,289 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const searchFormSchema: FormSchema[] = [
{
field: 'code',
label: '编码',
component: 'Input',
},
{
field: 'name',
label: '名称',
component: 'Input',
},
{
field: 'value',
label: '配置值',
component: 'Input',
},
{
field: 'remark',
label: '备注',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'code',
title: '编码',
componentType: 'input',
align: 'left',
width: 150,
sorter: true,
},
{
dataIndex: 'name',
title: '名称',
componentType: 'input',
align: 'left',
width: 200,
sorter: true,
},
{
dataIndex: 'value',
title: '配置值',
componentType: 'textarea',
align: 'left',
sorter: true,
},
{
dataIndex: 'remark',
title: '备注',
componentType: 'textarea',
align: 'left',
width: 150,
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: '8318dab17ae34a13bd6a3838bb5b57f1',
field: '',
label: '标题',
type: 'title',
component: 'Title',
colProps: { span: 24 },
defaultValue: '系统配置',
componentProps: {
defaultValue: '系统配置',
color: '',
align: 'left',
fontSize: 18,
isShow: true,
style: {},
},
},
{
key: '34e417669da74420b74f0e9ee8caead6',
field: 'code',
label: '编码',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入编码',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: true,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '0f36e23276974c8486fbcbe2cd7a5126',
field: 'name',
label: '名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: false,
placeholder: '请输入名称',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: true,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '5a636807b3814241a9b7f9e9025acf07',
field: 'value',
label: '配置值',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: true,
placeholder: '请输入配置值',
rows: 4,
autoSize: false,
showCount: false,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' },
},
},
{
key: 'd9a8a68174954ca6ba14bd86c7fbf669',
field: 'remark',
label: '备注',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: true,
respNewRow: true,
placeholder: '请输入备注',
rows: 4,
autoSize: false,
showCount: false,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,77 @@
export const permissionList = [
{
required: false,
view: true,
edit: false,
disabled: true,
isSaveTable: false,
tableName: '',
fieldName: '标题',
fieldId: '',
isSubTable: false,
showChildren: true,
type: 'title',
key: '8318dab17ae34a13bd6a3838bb5b57f1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '编码',
fieldId: 'code',
isSubTable: false,
showChildren: true,
type: 'input',
key: '34e417669da74420b74f0e9ee8caead6',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '名称',
fieldId: 'name',
isSubTable: false,
showChildren: true,
type: 'input',
key: '0f36e23276974c8486fbcbe2cd7a5126',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '配置值',
fieldId: 'value',
isSubTable: false,
showChildren: true,
type: 'textarea',
key: '5a636807b3814241a9b7f9e9025acf07',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '备注',
fieldId: 'remark',
isSubTable: false,
showChildren: true,
type: 'textarea',
key: 'd9a8a68174954ca6ba14bd86c7fbf669',
children: [],
},
];

View File

@ -0,0 +1,419 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<SystemConfigModal @register="registerModal" @success="handleSuccess" />
<ImportModal @register="registerImportModal" importUrl="/system/systemConfig/import" @success="handleImportSuccess"/>
</PageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted, createVNode,
} from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getXjrSystemConfigPage, deleteXjrSystemConfig, exportXjrSystemConfig} from '/@/api/system/systemConfig';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useRouter } from 'vue-router';
import { getXjrSystemConfig } from '/@/api/system/systemConfig';
import { useModal } from '/@/components/Modal';
import SystemConfigModal from './components/SystemConfigModal.vue';
import { ImportModal } from '/@/components/Import';
import { downloadByData } from '/@/utils/file/download';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const filterColumns = filterColumnAuth(columns);
const tableRef = ref();
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
const list = [{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"批量删除","code":"batchdelete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true},{"name":"复制数据","code":"copyData","icon":"ant-design:copy-outlined","isDefault":true,"isUse":true},{"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true,"isUse":true},{"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]
return filterButtonAuth(list);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,batchdelete : handleBatchdelete,copyData : handleCopyData,import : handleImport,export : handleExport,delete : handleDelete,}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const selectedKeys = ref<string[]>([]);
const selectedRowsData = ref<any[]>([]);
const [registerModal, { openModal }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const formName='系统配置';
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getXjrSystemConfigPage,
rowKey: 'id',
columns: filterColumns,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: searchFormSchema,
fieldMapToTime: [],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
customRow,
});
function dbClickRow(record) {
const { processId, taskIds, schemaId } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName
}
});
} else {
router.push({
path: '/form/systemConfig/' + record.id + '/viewForm',
query: {
formPath: 'system/systemConfig',
formName: formName
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/systemConfig/0/createForm',
query: {
formPath: 'system/systemConfig',
formName: formName
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/systemConfig/' + record.id + '/updateForm',
query: {
formPath: 'system/systemConfig',
formName: formName
}
});
}
async function handleCopyData(record: Recordable) {
/*//弹框添加数据
openModal(true, {
id: record.id,
isCopy: true,
});*/
const result = await getXjrSystemConfig(record['id']);
const form={};
const key="form_copy_"+record['id'];
form[key]=result;
localStorage.setItem('formJsonStr', JSON.stringify(form));
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
if(schemaId){
router.push({
path: '/flow/' + schemaId + '/0/createFlow',
query: {
fromKey: key
}
});
}else{
router.push({
path: '/form/systemConfig/0/createForm',
query: {
formPath: 'system/systemConfig',
formName: formName,
fromKey: key
}
});
}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function handleBatchdelete() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要删除的数据'),
});
return;
}
//与工作流相关的数据不能进行批量删除
const cantDelete = selectedRowsData.value.filter((x) => {
return (
(x.workflowData?.enabled && x.workflowData?.status) ||
(!x.workflowData?.enabled && !!x.workflowData?.processId)
);
});
if (cantDelete.length) {
notification.warning({
message: 'Tip',
description: t('含有不能删除的数据'),
});
return;
}
deleteList(selectedKeys.value);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteXjrSystemConfig(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function onSelectChange(selectedRowKeys: [], selectedRows) {
selectedKeys.value = selectedRowKeys;
selectedRowsData.value = selectedRows;
}
function customRow(record: Recordable) {
return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
},
};
}
function handleRefresh() {
reload();
}
function handleSuccess() {
selectedKeys.value = [];
selectedRowsData.value = [];
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
async function handleExport() {
const res = await exportXjrSystemConfig({ isTemplate: false });
downloadByData(
res.data,
'SystemConfig.xlsx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
}
function handleImport() {
openImportModal(true, {
title: '快速导入',
downLoadUrl:'/system/systemConfig/export',
});
}
function handleImportSuccess(){
reload()
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>

View File

@ -244,6 +244,7 @@
});
bpmnModeler.on('shape.removed', (e) => {
if (e.element && e.element.id && e.element.id.includes('_label')) {
return;
let id = e.element.id.replace('_label', '');
bpmnCanvas.removedId = id;
removeProperties(id);
@ -268,9 +269,9 @@
getProperties(infoId)?.type == BpmnNodeKey.SEQUENCEFLOW) &&
!getProperties(infoId)?.name
) {
modeling.updateProperties(bpmnElement, { name: '_' });
modeling.updateProperties(bpmnElement, { name: '' });
} else {
modeling.updateProperties(bpmnElement, { name: getProperties(infoId)?.name });
modeling.updateProperties(bpmnElement, { name: getProperties(infoId)?.name });
}
}
// 更新xml中流程线参数