重新生成bank和region
This commit is contained in:
@ -9,6 +9,9 @@ enum Api {
|
|||||||
LngBBank = '/mdm/bank',
|
LngBBank = '/mdm/bank',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DataLog = '/mdm/bank/datalog',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,4 +87,22 @@ export async function deleteLngBBank(ids: string[], mode: ErrorMessageMode = 'mo
|
|||||||
errorMessageMode: mode,
|
errorMessageMode: mode,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取数据日志LngBBank
|
||||||
|
*/
|
||||||
|
export async function getDataLogLngBBank(id: string, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.Datalog,
|
||||||
|
data: id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -11,6 +11,12 @@ export interface LngBBankPageParams extends BasicPageParams {
|
|||||||
regionCode: string;
|
regionCode: string;
|
||||||
|
|
||||||
valid: string;
|
valid: string;
|
||||||
|
|
||||||
|
fullName: string;
|
||||||
|
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
swift: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,10 +27,16 @@ export interface LngBBankPageModel {
|
|||||||
|
|
||||||
bankCode: string;
|
bankCode: string;
|
||||||
|
|
||||||
|
fullName: string;
|
||||||
|
|
||||||
shortName: string;
|
shortName: string;
|
||||||
|
|
||||||
regionCode: string;
|
regionCode: string;
|
||||||
|
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
swift: string;
|
||||||
|
|
||||||
valid: string;
|
valid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,9 @@ enum Api {
|
|||||||
LngBRegion = '/mdm/countryRegion',
|
LngBRegion = '/mdm/countryRegion',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DataLog = '/mdm/countryRegion/datalog',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,4 +87,22 @@ export async function deleteLngBRegion(ids: string[], mode: ErrorMessageMode = '
|
|||||||
errorMessageMode: mode,
|
errorMessageMode: mode,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取数据日志LngBRegion
|
||||||
|
*/
|
||||||
|
export async function getDataLogLngBRegion(id: string, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.Datalog,
|
||||||
|
data: id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -4,17 +4,15 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
|||||||
* @description: LngBRegion分页参数 模型
|
* @description: LngBRegion分页参数 模型
|
||||||
*/
|
*/
|
||||||
export interface LngBRegionPageParams extends BasicPageParams {
|
export interface LngBRegionPageParams extends BasicPageParams {
|
||||||
id: string;
|
|
||||||
|
|
||||||
code: string;
|
code: string;
|
||||||
|
|
||||||
createUserId: string;
|
fullName: string;
|
||||||
|
|
||||||
regionTypeCode: string;
|
regionTypeCode: string;
|
||||||
|
|
||||||
pid: string;
|
pid: string;
|
||||||
|
|
||||||
fullName: string;
|
fullPath: string;
|
||||||
|
|
||||||
valid: string;
|
valid: string;
|
||||||
|
|
||||||
@ -27,19 +25,19 @@ export interface LngBRegionPageParams extends BasicPageParams {
|
|||||||
export interface LngBRegionPageModel {
|
export interface LngBRegionPageModel {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
regionTypeCode: string;
|
|
||||||
|
|
||||||
valid: string;
|
|
||||||
|
|
||||||
code: string;
|
code: string;
|
||||||
|
|
||||||
fullName: string;
|
fullName: string;
|
||||||
|
|
||||||
|
regionTypeCode: string;
|
||||||
|
|
||||||
pid: string;
|
pid: string;
|
||||||
|
|
||||||
note: string;
|
fullPath: string;
|
||||||
|
|
||||||
createUserId: string;
|
valid: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
0;
|
0;
|
||||||
|
|||||||
@ -1,108 +1,110 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||||
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, reactive } from 'vue';
|
import { ref, computed, reactive } from 'vue';
|
||||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { formProps } from './config';
|
import { formProps } from './config';
|
||||||
import ModalForm from './Form.vue';
|
import ModalForm from './Form.vue';
|
||||||
import { FromPageType } from '/@/enums/workflowEnum';
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
|
|
||||||
const emit = defineEmits(['success', 'register']);
|
const emit = defineEmits(['success', 'register']);
|
||||||
|
|
||||||
const { notification } = useMessage();
|
const { notification } = useMessage();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
formModel: {},
|
formModel: {},
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
isView: false,
|
isView: false,
|
||||||
isCopy: false,
|
isCopy: false,
|
||||||
rowId: ''
|
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 { t } = useI18n();
|
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
||||||
state.isUpdate = !!data?.isUpdate;
|
|
||||||
state.isView = !!data?.isView;
|
|
||||||
state.isCopy = !!data?.isCopy;
|
|
||||||
|
|
||||||
setModalProps({
|
async function saveModal() {
|
||||||
destroyOnClose: true,
|
let saveSuccess = false;
|
||||||
maskClosable: false,
|
try {
|
||||||
showCancelBtn: !state.isView,
|
const values = await formRef.value?.validate();
|
||||||
showOkBtn: !state.isView,
|
//添加隐藏组件
|
||||||
canFullscreen: true,
|
if (formProps.hiddenComponent?.length) {
|
||||||
width: 900
|
formProps.hiddenComponent.forEach((component) => {
|
||||||
|
values[component.bindField] = component.value;
|
||||||
});
|
});
|
||||||
if (state.isUpdate || state.isView || state.isCopy) {
|
}
|
||||||
state.rowId = data.id;
|
if (values !== false) {
|
||||||
if (state.isView) {
|
try {
|
||||||
await formRef.value.setDisabledForm();
|
if (!state.isUpdate || state.isCopy) {
|
||||||
}
|
saveSuccess = await formRef.value.add(values);
|
||||||
await formRef.value.setFormDataFromId(state.rowId);
|
} 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 {
|
} else {
|
||||||
formRef.value.resetFields();
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('修改成功!'),
|
||||||
|
}); //提示消息
|
||||||
}
|
}
|
||||||
});
|
closeModal();
|
||||||
|
|
||||||
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();
|
formRef.value.resetFields();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
}
|
}
|
||||||
</script>
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -1,198 +1,224 @@
|
|||||||
<template>
|
<template>
|
||||||
<SimpleForm ref="systemFormRef" :formProps="data.formDataProps" :formModel="{}" :isWorkFlow="props.fromPage != FromPageType.MENU" />
|
<SimpleForm
|
||||||
|
ref="systemFormRef"
|
||||||
|
:formProps="data.formDataProps"
|
||||||
|
:formModel="{}"
|
||||||
|
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref, onBeforeMount, onMounted } from 'vue';
|
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
||||||
import { formProps, formEventConfigs, formConfig } from './config';
|
import { formProps, formEventConfigs ,formConfig} from './config';
|
||||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||||
import { addLngBBank, getLngBBank, updateLngBBank, deleteLngBBank } from '/@/api/mdm/Bank';
|
import { addLngBBank, getLngBBank, updateLngBBank, deleteLngBBank } from '/@/api/mdm/Bank';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { FormDataProps } from '/@/components/Designer/src/types';
|
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||||
import { usePermission } from '/@/hooks/web/usePermission';
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||||
import { FromPageType } from '/@/enums/workflowEnum';
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent';
|
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
|
||||||
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||||
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
const { filterFormSchemaAuth } = usePermission();
|
||||||
|
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
|
||||||
const { filterFormSchemaAuth } = usePermission();
|
const RowKey = 'id';
|
||||||
const { mergeFormSchemas, mergeFormEventConfigs } = useFormConfig();
|
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||||
const { currentRoute } = useRouter();
|
const props = defineProps({
|
||||||
|
fromPage: {
|
||||||
|
type: Number,
|
||||||
|
default: FromPageType.MENU,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const systemFormRef = ref();
|
||||||
|
const data: { formDataProps: FormDataProps } = reactive({
|
||||||
|
formDataProps: {schemas:[]} as FormDataProps,
|
||||||
|
});
|
||||||
|
const state = reactive({
|
||||||
|
formModel: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
let customFormEventConfigs=[];
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
||||||
|
await mergeCustomFormRenderConfig();
|
||||||
|
|
||||||
|
if (props.fromPage == FromPageType.MENU) {
|
||||||
|
setMenuPermission();
|
||||||
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, 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(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
}
|
||||||
|
emits('form-mounted', formProps);
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
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: { schemas: [] } as FormDataProps
|
|
||||||
});
|
|
||||||
const state = reactive({
|
|
||||||
formModel: {}
|
|
||||||
});
|
|
||||||
|
|
||||||
let customFormEventConfigs = [];
|
async function mergeCustomFormRenderConfig() {
|
||||||
|
let cloneProps=cloneDeep(formProps);
|
||||||
|
let fEventConfigs=cloneDeep(formEventConfigs);
|
||||||
|
if (formConfig.useCustomConfig) {
|
||||||
|
if(props.fromPage !== FromPageType.FLOW){
|
||||||
|
let formPath=currentRoute.value.query.formPath;
|
||||||
|
//1.合并字段配置
|
||||||
|
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
|
||||||
|
//2.合并表单事件配置
|
||||||
|
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.formDataProps=cloneProps;
|
||||||
|
customFormEventConfigs=fEventConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||||
|
function setMenuPermission() {
|
||||||
|
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
// 校验form 通过返回表单数据
|
||||||
try {
|
async function validate() {
|
||||||
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
let values = [];
|
||||||
await mergeCustomFormRenderConfig();
|
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, skipUpdate) {
|
||||||
|
try {
|
||||||
|
const record = await getLngBBank(rowId);
|
||||||
|
if (skipUpdate) {
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
setFieldsValue(record);
|
||||||
|
state.formModel = record;
|
||||||
|
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||||
|
return record;
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
if (props.fromPage == FromPageType.MENU) {
|
|
||||||
setMenuPermission();
|
|
||||||
await createFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
|
||||||
await loadFormEvent(customFormEventConfigs, 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(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
|
||||||
await loadFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
|
||||||
}
|
|
||||||
emits('form-mounted', formProps);
|
|
||||||
} catch (error) {}
|
|
||||||
});
|
|
||||||
|
|
||||||
async function mergeCustomFormRenderConfig() {
|
|
||||||
let cloneProps = cloneDeep(formProps);
|
|
||||||
let fEventConfigs = cloneDeep(formEventConfigs);
|
|
||||||
if (formConfig.useCustomConfig) {
|
|
||||||
if (props.fromPage !== FromPageType.FLOW) {
|
|
||||||
let formPath = currentRoute.value.query.formPath;
|
|
||||||
//1.合并字段配置
|
|
||||||
cloneProps.schemas = await mergeFormSchemas({ formSchema: cloneProps.schemas!, formPath: formPath });
|
|
||||||
//2.合并表单事件配置
|
|
||||||
fEventConfigs = await mergeFormEventConfigs({ formEventConfigs: fEventConfigs, formPath: formPath });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data.formDataProps = cloneProps;
|
|
||||||
customFormEventConfigs = fEventConfigs;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
// 辅助设置表单数据
|
||||||
function setMenuPermission() {
|
function setFieldsValue(record) {
|
||||||
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
|
systemFormRef.value.setFieldsValue(record);
|
||||||
}
|
}
|
||||||
|
// 重置表单数据
|
||||||
// 校验form 通过返回表单数据
|
async function resetFields() {
|
||||||
async function validate() {
|
await systemFormRef.value.resetFields();
|
||||||
let values = [];
|
}
|
||||||
try {
|
// 设置表单数据全部为Disabled 【查看】
|
||||||
values = await systemFormRef.value?.validate();
|
async function setDisabledForm(isDisabled) {
|
||||||
//添加隐藏组件
|
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
|
||||||
if (data.formDataProps.hiddenComponent?.length) {
|
}
|
||||||
data.formDataProps.hiddenComponent.forEach((component) => {
|
// 获取行键值
|
||||||
values[component.bindField] = component.value;
|
function getRowKey() {
|
||||||
});
|
return RowKey;
|
||||||
}
|
}
|
||||||
} finally {
|
// 更新api表单数据
|
||||||
}
|
async function update({ values, rowId }) {
|
||||||
return values;
|
try {
|
||||||
}
|
values[RowKey] = rowId;
|
||||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
state.formModel = values;
|
||||||
async function setFormDataFromId(rowId, skipUpdate) {
|
let saveVal = await updateLngBBank(values);
|
||||||
try {
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
const record = await getLngBBank(rowId);
|
systemFormRef.value,
|
||||||
if (skipUpdate) {
|
formProps.schemas); //表单事件:提交表单
|
||||||
return record;
|
return saveVal;
|
||||||
}
|
} catch (error) {}
|
||||||
setFieldsValue(record);
|
}
|
||||||
state.formModel = record;
|
// 新增api表单数据
|
||||||
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
async function add(values) {
|
||||||
return record;
|
try {
|
||||||
} catch (error) {}
|
state.formModel = values;
|
||||||
}
|
let saveVal = await addLngBBank(values);
|
||||||
// 辅助设置表单数据
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
function setFieldsValue(record) {
|
systemFormRef.value,
|
||||||
systemFormRef.value.setFieldsValue(record);
|
formProps.schemas); //表单事件:提交表单
|
||||||
}
|
return saveVal;
|
||||||
// 重置表单数据
|
} catch (error) {}
|
||||||
async function resetFields() {
|
}
|
||||||
await systemFormRef.value.resetFields();
|
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||||
}
|
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||||
// 设置表单数据全部为Disabled 【查看】
|
try {
|
||||||
async function setDisabledForm(isDisabled) {
|
const cloneProps=cloneDeep(formProps);
|
||||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas), isDisabled);
|
customFormEventConfigs=cloneDeep(formEventConfigs);
|
||||||
}
|
if (formConfig.useCustomConfig) {
|
||||||
// 获取行键值
|
const parts = obj.formConfigKey.split('_');
|
||||||
function getRowKey() {
|
const formId=parts[1];
|
||||||
return RowKey;
|
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
|
||||||
}
|
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
|
||||||
// 更新api表单数据
|
}
|
||||||
async function update({ values, rowId }) {
|
|
||||||
try {
|
let flowData = changeWorkFlowForm(cloneProps, obj);
|
||||||
values[RowKey] = rowId;
|
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||||
state.formModel = values;
|
data.formDataProps = buildOptionJson;
|
||||||
let saveVal = await updateLngBBank(values);
|
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||||
await submitFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:提交表单
|
if (isViewProcess) {
|
||||||
return saveVal;
|
setDisabledForm(); //查看
|
||||||
} catch (error) {}
|
}
|
||||||
}
|
state.formModel = formModels;
|
||||||
// 新增api表单数据
|
if(formModels[RowKey]) {
|
||||||
async function add(values) {
|
setFormDataFromId(formModels[RowKey], false)
|
||||||
try {
|
} else {
|
||||||
state.formModel = values;
|
setFieldsValue(formModels)
|
||||||
let saveVal = await addLngBBank(values);
|
}
|
||||||
await submitFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:提交表单
|
} catch (error) {}
|
||||||
return saveVal;
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
} catch (error) {}
|
systemFormRef.value,
|
||||||
}
|
formProps.schemas); //表单事件:初始化表单
|
||||||
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
systemFormRef.value,
|
||||||
try {
|
formProps.schemas); //表单事件:加载表单
|
||||||
const cloneProps = cloneDeep(formProps);
|
}
|
||||||
customFormEventConfigs = cloneDeep(formEventConfigs);
|
function getFormModel() {
|
||||||
if (formConfig.useCustomConfig) {
|
return systemFormRef.value.formModel
|
||||||
const parts = obj.formConfigKey.split('_');
|
}
|
||||||
const formId = parts[1];
|
async function handleDelete(id) {
|
||||||
cloneProps.schemas = await mergeFormSchemas({ formSchema: cloneProps.schemas!, formId: formId });
|
return await deleteLngBBank([id]);
|
||||||
customFormEventConfigs = await mergeFormEventConfigs({ formEventConfigs: customFormEventConfigs, formId: formId });
|
}
|
||||||
}
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
let flowData = changeWorkFlowForm(cloneProps, obj);
|
resetFields,
|
||||||
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
validate,
|
||||||
data.formDataProps = buildOptionJson;
|
add,
|
||||||
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
update,
|
||||||
if (isViewProcess) {
|
setFormDataFromId,
|
||||||
setDisabledForm(); //查看
|
setDisabledForm,
|
||||||
}
|
setMenuPermission,
|
||||||
state.formModel = formModels;
|
setWorkFlowForm,
|
||||||
if (formModels[RowKey]) {
|
getRowKey,
|
||||||
setFormDataFromId(formModels[RowKey], false);
|
getFormModel,
|
||||||
} else {
|
handleDelete
|
||||||
setFieldsValue(formModels);
|
});
|
||||||
}
|
</script>
|
||||||
} catch (error) {}
|
|
||||||
await createFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
|
||||||
await loadFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
|
||||||
}
|
|
||||||
function getFormModel() {
|
|
||||||
return systemFormRef.value.formModel;
|
|
||||||
}
|
|
||||||
async function handleDelete(id) {
|
|
||||||
return await deleteLngBBank([id]);
|
|
||||||
}
|
|
||||||
defineExpose({
|
|
||||||
setFieldsValue,
|
|
||||||
resetFields,
|
|
||||||
validate,
|
|
||||||
add,
|
|
||||||
update,
|
|
||||||
setFormDataFromId,
|
|
||||||
setDisabledForm,
|
|
||||||
setMenuPermission,
|
|
||||||
setWorkFlowForm,
|
|
||||||
getRowKey,
|
|
||||||
getFormModel,
|
|
||||||
handleDelete
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@ -34,6 +34,21 @@ export const searchFormSchema: FormSchema[] = [
|
|||||||
getPopupContainer: () => document.body,
|
getPopupContainer: () => document.body,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'fullName',
|
||||||
|
label: '银行名称',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'code',
|
||||||
|
label: '所属国家和地区',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'swift',
|
||||||
|
label: 'SWIFT',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
@ -46,6 +61,15 @@ export const columns: BasicColumn[] = [
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'fullName',
|
||||||
|
title: '银行名称',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
dataIndex: 'shortName',
|
dataIndex: 'shortName',
|
||||||
title: '银行名称/简称',
|
title: '银行名称/简称',
|
||||||
@ -64,6 +88,24 @@ export const columns: BasicColumn[] = [
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'code',
|
||||||
|
title: '所属国家和地区',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'swift',
|
||||||
|
title: 'SWIFT',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
dataIndex: 'valid',
|
dataIndex: 'valid',
|
||||||
title: '有效标志',
|
title: '有效标志',
|
||||||
@ -143,7 +185,7 @@ export const formProps: FormProps = {
|
|||||||
size: 'default',
|
size: 'default',
|
||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
key: '5fdaec7802364d16a979fc9d3218bbfa',
|
key: '151d6e797f7e411297992bd2460ddd29',
|
||||||
field: 'shortName',
|
field: 'shortName',
|
||||||
label: '银行名称/简称',
|
label: '银行名称/简称',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
@ -177,7 +219,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '38bd834c265446658be6f9784672e1ae',
|
key: 'df917f42491f4a8888a9d661a89ac3ce',
|
||||||
field: 'bankCode',
|
field: 'bankCode',
|
||||||
label: '编码',
|
label: '编码',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
@ -211,7 +253,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '6461a5e152124abca28bd2114dd577e6',
|
key: '0e4069a334ea44219d6f1d364d830ffe',
|
||||||
field: 'regionCode',
|
field: 'regionCode',
|
||||||
label: '联行号',
|
label: '联行号',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
@ -245,7 +287,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '714953d458d9402bb507893c92913d44',
|
key: 'e00cdcea0ed14c99b7f7901526f5a5fe',
|
||||||
field: 'valid',
|
field: 'valid',
|
||||||
label: '有效标志',
|
label: '有效标志',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -264,6 +306,7 @@ export const formProps: FormProps = {
|
|||||||
showSearch: false,
|
showSearch: false,
|
||||||
clearable: false,
|
clearable: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
mode: 'multiple',
|
||||||
staticOptions: [
|
staticOptions: [
|
||||||
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
||||||
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
||||||
@ -288,6 +331,108 @@ export const formProps: FormProps = {
|
|||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'fe4822ade6334198965e983ab26c4100',
|
||||||
|
field: 'fullName',
|
||||||
|
label: '银行名称',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入银行名称',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '503adbb6dd024e0f934a41ec1ccbff07',
|
||||||
|
field: 'code',
|
||||||
|
label: '所属国家和地区',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入所属国家和地区',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '08b8ef5bc2a148e2b14093e97be20305',
|
||||||
|
field: 'swift',
|
||||||
|
label: 'SWIFT',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入SWIFT',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
showActionButtonGroup: false,
|
showActionButtonGroup: false,
|
||||||
buttonLocation: 'center',
|
buttonLocation: 'center',
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: '5fdaec7802364d16a979fc9d3218bbfa',
|
key: '151d6e797f7e411297992bd2460ddd29',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -26,7 +26,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: '38bd834c265446658be6f9784672e1ae',
|
key: 'df917f42491f4a8888a9d661a89ac3ce',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: '6461a5e152124abca28bd2114dd577e6',
|
key: '0e4069a334ea44219d6f1d364d830ffe',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -56,7 +56,52 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: '714953d458d9402bb507893c92913d44',
|
key: 'e00cdcea0ed14c99b7f7901526f5a5fe',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '银行名称',
|
||||||
|
fieldId: 'fullName',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'fe4822ade6334198965e983ab26c4100',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '所属国家和地区',
|
||||||
|
fieldId: 'code',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '503adbb6dd024e0f934a41ec1ccbff07',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: 'SWIFT',
|
||||||
|
fieldId: 'swift',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '08b8ef5bc2a148e2b14093e97be20305',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -1,296 +1,299 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||||
<template #toolbar>
|
|
||||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
<template #toolbar>
|
||||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||||
<template #icon><Icon :icon="button.icon" /></template>
|
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||||
{{ button.name }}
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
</a-button>
|
{{ button.name }}
|
||||||
<a-button v-else :type="button.type">
|
</a-button>
|
||||||
<template #icon><Icon :icon="button.icon" /></template>
|
<a-button v-else :type="button.type">
|
||||||
{{ button.name }}
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
</a-button>
|
{{ button.name }}
|
||||||
</template>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
</template>
|
||||||
<template v-if="column.dataIndex === 'action'">
|
<template #bodyCell="{ column, record }">
|
||||||
<TableAction :actions="getActions(record)" />
|
<template v-if="column.dataIndex === 'action'">
|
||||||
</template>
|
<TableAction :actions="getActions(record)" />
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</template>
|
||||||
<BankModal @register="registerModal" @success="handleSuccess" />
|
</BasicTable>
|
||||||
</PageWrapper>
|
<BankModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
</PageWrapper>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, onMounted, onUnmounted, createVNode } from 'vue';
|
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||||
|
|
||||||
import { Modal } from 'ant-design-vue';
|
} from 'vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
||||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
import { Modal } from 'ant-design-vue';
|
||||||
import { getLngBBankPage, deleteLngBBank } from '/@/api/mdm/Bank';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { PageWrapper } from '/@/components/Page';
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { getLngBBankPage, deleteLngBBank} from '/@/api/mdm/Bank';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { PageWrapper } from '/@/components/Page';
|
||||||
import { usePermission } from '/@/hooks/web/usePermission';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
import { setIndexFlowStatus } from '/@/utils/flow/index';
|
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||||
import { getLngBBank } from '/@/api/mdm/Bank';
|
import { useRouter } from 'vue-router';
|
||||||
import { useModal } from '/@/components/Modal';
|
import { setIndexFlowStatus } from '/@/utils/flow/index'
|
||||||
import BankModal from './components/BankModal.vue';
|
import { getLngBBank } from '/@/api/mdm/Bank';
|
||||||
import { formConfig, searchFormSchema, columns } from './components/config';
|
import { useModal } from '/@/components/Modal';
|
||||||
import Icon from '/@/components/Icon/index';
|
import BankModal from './components/BankModal.vue';
|
||||||
import useEventBus from '/@/hooks/event/useEventBus';
|
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import Icon from '/@/components/Icon/index';
|
||||||
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
|
||||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
const { notification } = useMessage();
|
||||||
|
const { t } = useI18n();
|
||||||
|
defineEmits(['register']);
|
||||||
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
|
||||||
|
|
||||||
const { notification } = useMessage();
|
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||||
const { t } = useI18n();
|
const customConfigColums =ref(filterColumns);
|
||||||
defineEmits(['register']);
|
const customSearchFormSchema =ref(searchFormSchema);
|
||||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
|
||||||
const { mergeColumns, mergeSearchFormSchema, mergeButtons } = useFormConfig();
|
const tableRef = ref();
|
||||||
|
//所有按钮
|
||||||
|
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"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":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
|
||||||
|
//展示在列表内的按钮
|
||||||
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||||
|
const buttonConfigs = computed(()=>{
|
||||||
|
return filterButtonAuth(buttons.value);
|
||||||
|
})
|
||||||
|
|
||||||
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
const tableButtonConfig = computed(() => {
|
||||||
const customConfigColums = ref(filterColumns);
|
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||||
const customSearchFormSchema = ref(searchFormSchema);
|
});
|
||||||
|
|
||||||
const tableRef = ref();
|
const actionButtonConfig = computed(() => {
|
||||||
//所有按钮
|
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||||
const buttons = ref([
|
});
|
||||||
{ isUse: true, name: '新增', code: 'add', icon: 'ant-design:plus-outlined', isDefault: true, type: 'primary' },
|
|
||||||
{ 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: 'enable', icon: 'ant-design:check-circle-twotone', isDefault: false },
|
|
||||||
{ isUse: true, name: '停用', code: 'stop', icon: 'ant-design:stop-outlined', isDefault: false },
|
|
||||||
{ isUse: true, name: '删除', code: 'delete', icon: 'ant-design:delete-outlined', isDefault: true }
|
|
||||||
]);
|
|
||||||
//展示在列表内的按钮
|
|
||||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork', 'flowRecord']);
|
|
||||||
const buttonConfigs = computed(() => {
|
|
||||||
return filterButtonAuth(buttons.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
const tableButtonConfig = computed(() => {
|
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
|
||||||
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
|
||||||
});
|
|
||||||
|
|
||||||
const actionButtonConfig = computed(() => {
|
const { currentRoute } = useRouter();
|
||||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
const router = useRouter();
|
||||||
});
|
const formIdComputedRef = ref();
|
||||||
|
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||||
const btnEvent = { add: handleAdd, edit: handleEdit, refresh: handleRefresh, view: handleView, delete: handleDelete };
|
const schemaIdComputedRef = ref();
|
||||||
|
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||||
const { currentRoute } = useRouter();
|
const [registerModal, { openModal }] = useModal();
|
||||||
const router = useRouter();
|
const formName='银行';
|
||||||
const formIdComputedRef = ref();
|
const [registerTable, { reload, }] = useTable({
|
||||||
formIdComputedRef.value = currentRoute.value.meta.formId;
|
title: '' || (formName + '列表'),
|
||||||
const schemaIdComputedRef = ref();
|
api: getLngBBankPage,
|
||||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId;
|
rowKey: 'id',
|
||||||
const [registerModal, { openModal }] = useModal();
|
columns: customConfigColums,
|
||||||
const formName = '银行';
|
formConfig: {
|
||||||
const [registerTable, { reload }] = useTable({
|
rowProps: {
|
||||||
title: '' || formName + '列表',
|
gutter: 16,
|
||||||
api: getLngBBankPage,
|
},
|
||||||
rowKey: 'id',
|
schemas: customSearchFormSchema,
|
||||||
columns: customConfigColums,
|
fieldMapToTime: [],
|
||||||
formConfig: {
|
showResetButton: false,
|
||||||
rowProps: {
|
},
|
||||||
gutter: 16
|
beforeFetch: (params) => {
|
||||||
},
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||||
schemas: customSearchFormSchema,
|
},
|
||||||
fieldMapToTime: [],
|
afterFetch: (res) => {
|
||||||
showResetButton: false
|
tableRef.value.setToolBarWidth();
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
},
|
||||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
useSearchForm: true,
|
||||||
},
|
showTableSetting: true,
|
||||||
afterFetch: (res) => {
|
|
||||||
tableRef.value.setToolBarWidth();
|
striped: false,
|
||||||
},
|
actionColumn: {
|
||||||
useSearchForm: true,
|
width: 160,
|
||||||
showTableSetting: true,
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
striped: false,
|
slots: { customRender: 'action' },
|
||||||
actionColumn: {
|
},
|
||||||
width: 160,
|
tableSetting: {
|
||||||
title: '操作',
|
size: false,
|
||||||
dataIndex: 'action',
|
setting: false,
|
||||||
slots: { customRender: 'action' }
|
},
|
||||||
},
|
|
||||||
tableSetting: {
|
});
|
||||||
size: false,
|
|
||||||
setting: false
|
function dbClickRow(record) {
|
||||||
}
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
});
|
return;
|
||||||
|
|
||||||
function dbClickRow(record) {
|
|
||||||
if (!actionButtonConfig?.value.some((element) => element.code == 'view')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
|
||||||
if (taskIds && taskIds.length) {
|
|
||||||
router.push({
|
|
||||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
|
||||||
query: {
|
|
||||||
taskId: taskIds[0],
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (schemaId && !taskIds && processId) {
|
|
||||||
router.push({
|
|
||||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
|
||||||
query: {
|
|
||||||
readonly: 1,
|
|
||||||
taskId: '',
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
router.push({
|
|
||||||
path: '/form/Bank/' + record.id + '/viewForm',
|
|
||||||
query: {
|
|
||||||
formPath: 'mdm/Bank',
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
function buttonClick(code) {
|
if (taskIds && taskIds.length) {
|
||||||
btnEvent[code]();
|
router.push({
|
||||||
}
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
function handleAdd() {
|
taskId: taskIds[0],
|
||||||
if (schemaIdComputedRef.value) {
|
formName: formName,
|
||||||
router.push({
|
formId:currentRoute.value.meta.formId
|
||||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
router.push({
|
|
||||||
path: '/form/Bank/0/createForm',
|
|
||||||
query: {
|
|
||||||
formPath: 'mdm/Bank',
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else if (schemaId && !taskIds && processId) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/Bank/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'mdm/Bank',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleEdit(record: Recordable) {
|
function buttonClick(code) {
|
||||||
router.push({
|
|
||||||
path: '/form/Bank/' + record.id + '/updateForm',
|
btnEvent[code]();
|
||||||
query: {
|
}
|
||||||
formPath: 'mdm/Bank',
|
|
||||||
formName: formName,
|
function handleAdd() {
|
||||||
formId: currentRoute.value.meta.formId
|
if (schemaIdComputedRef.value) {
|
||||||
}
|
router.push({
|
||||||
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/Bank/0/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'mdm/Bank',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/form/Bank/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'mdm/Bank',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteLngBBank(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
function handleDelete(record: Recordable) {
|
onCancel() {},
|
||||||
deleteList([record.id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteList(ids) {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示信息',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
content: '是否确认删除?',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk() {
|
|
||||||
deleteLngBBank(ids).then((_) => {
|
|
||||||
handleSuccess();
|
|
||||||
notification.success({
|
|
||||||
message: 'Tip',
|
|
||||||
description: t('删除成功!')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onCancel() {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function handleRefresh() {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
function handleSuccess() {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleView(record: Recordable) {
|
|
||||||
dbClickRow(record);
|
|
||||||
}
|
|
||||||
onMounted(() => {
|
|
||||||
if (schemaIdComputedRef.value) {
|
|
||||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
|
||||||
bus.on(CREATE_FLOW, handleRefresh);
|
|
||||||
} else {
|
|
||||||
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
|
||||||
mergeCustomListRenderConfig();
|
|
||||||
});
|
});
|
||||||
onUnmounted(() => {
|
}
|
||||||
if (schemaIdComputedRef.value) {
|
function handleRefresh() {
|
||||||
bus.off(FLOW_PROCESSED, handleRefresh);
|
reload();
|
||||||
bus.off(CREATE_FLOW, handleRefresh);
|
}
|
||||||
|
function handleSuccess() {
|
||||||
|
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleView(record: Recordable) {
|
||||||
|
|
||||||
|
dbClickRow(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||||
|
bus.on(CREATE_FLOW, handleRefresh);
|
||||||
|
} else {
|
||||||
|
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
||||||
|
mergeCustomListRenderConfig();
|
||||||
|
});
|
||||||
|
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 {
|
} else {
|
||||||
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
return {};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
function getActions(record: Recordable): ActionItem[] {
|
return actionsList;
|
||||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
}
|
||||||
if (!record.workflowData?.processId) {
|
async function mergeCustomListRenderConfig(){
|
||||||
return {
|
if (formConfig.useCustomConfig) {
|
||||||
icon: button?.icon,
|
let formId=currentRoute.value.meta.formId;
|
||||||
tooltip: button?.name,
|
//1.合并展示字段配置
|
||||||
color: button.code === 'delete' ? 'error' : undefined,
|
let cols= await mergeColumns(customConfigColums.value,formId);
|
||||||
onClick: btnEvent[button.code].bind(null, record)
|
customConfigColums.value=cols;
|
||||||
};
|
//2.合并搜索字段配置
|
||||||
} else {
|
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
|
||||||
if (button.code === 'view') {
|
customSearchFormSchema.value=sFormSchema;
|
||||||
return {
|
//3.合并按钮配置
|
||||||
icon: button?.icon,
|
let btns= await mergeButtons(buttons.value,formId);
|
||||||
tooltip: button?.name,
|
buttons.value=btns;
|
||||||
onClick: btnEvent[button.code].bind(null, record)
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return actionsList;
|
|
||||||
}
|
|
||||||
async function mergeCustomListRenderConfig() {
|
|
||||||
if (formConfig.useCustomConfig) {
|
|
||||||
let formId = currentRoute.value.meta.formId;
|
|
||||||
//1.合并展示字段配置
|
|
||||||
let cols = await mergeColumns(customConfigColums.value, formId);
|
|
||||||
customConfigColums.value = cols;
|
|
||||||
//2.合并搜索字段配置
|
|
||||||
let sFormSchema = await mergeSearchFormSchema(customSearchFormSchema.value, formId);
|
|
||||||
customSearchFormSchema.value = sFormSchema;
|
|
||||||
//3.合并按钮配置
|
|
||||||
let btns = await mergeButtons(buttons.value, formId);
|
|
||||||
buttons.value = btns;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
:deep(.ant-table-selection-col) {
|
:deep(.ant-table-selection-col) {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
.show {
|
.show{
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.hide {
|
.hide{
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,108 +1,110 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||||
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, reactive } from 'vue';
|
import { ref, computed, reactive } from 'vue';
|
||||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { formProps } from './config';
|
import { formProps } from './config';
|
||||||
import ModalForm from './Form.vue';
|
import ModalForm from './Form.vue';
|
||||||
import { FromPageType } from '/@/enums/workflowEnum';
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
|
|
||||||
const emit = defineEmits(['success', 'register']);
|
const emit = defineEmits(['success', 'register']);
|
||||||
|
|
||||||
const { notification } = useMessage();
|
const { notification } = useMessage();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
formModel: {},
|
formModel: {},
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
isView: false,
|
isView: false,
|
||||||
isCopy: false,
|
isCopy: false,
|
||||||
rowId: ''
|
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 { t } = useI18n();
|
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
||||||
state.isUpdate = !!data?.isUpdate;
|
|
||||||
state.isView = !!data?.isView;
|
|
||||||
state.isCopy = !!data?.isCopy;
|
|
||||||
|
|
||||||
setModalProps({
|
async function saveModal() {
|
||||||
destroyOnClose: true,
|
let saveSuccess = false;
|
||||||
maskClosable: false,
|
try {
|
||||||
showCancelBtn: !state.isView,
|
const values = await formRef.value?.validate();
|
||||||
showOkBtn: !state.isView,
|
//添加隐藏组件
|
||||||
canFullscreen: true,
|
if (formProps.hiddenComponent?.length) {
|
||||||
width: 900
|
formProps.hiddenComponent.forEach((component) => {
|
||||||
|
values[component.bindField] = component.value;
|
||||||
});
|
});
|
||||||
if (state.isUpdate || state.isView || state.isCopy) {
|
}
|
||||||
state.rowId = data.id;
|
if (values !== false) {
|
||||||
if (state.isView) {
|
try {
|
||||||
await formRef.value.setDisabledForm();
|
if (!state.isUpdate || state.isCopy) {
|
||||||
}
|
saveSuccess = await formRef.value.add(values);
|
||||||
await formRef.value.setFormDataFromId(state.rowId);
|
} 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 {
|
} else {
|
||||||
formRef.value.resetFields();
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('修改成功!'),
|
||||||
|
}); //提示消息
|
||||||
}
|
}
|
||||||
});
|
closeModal();
|
||||||
|
|
||||||
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();
|
formRef.value.resetFields();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
}
|
}
|
||||||
</script>
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -1,198 +1,224 @@
|
|||||||
<template>
|
<template>
|
||||||
<SimpleForm ref="systemFormRef" :formProps="data.formDataProps" :formModel="{}" :isWorkFlow="props.fromPage != FromPageType.MENU" />
|
<SimpleForm
|
||||||
|
ref="systemFormRef"
|
||||||
|
:formProps="data.formDataProps"
|
||||||
|
:formModel="{}"
|
||||||
|
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref, onBeforeMount, onMounted } from 'vue';
|
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
||||||
import { formProps, formEventConfigs, formConfig } from './config';
|
import { formProps, formEventConfigs ,formConfig} from './config';
|
||||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||||
import { addLngBRegion, getLngBRegion, updateLngBRegion, deleteLngBRegion } from '/@/api/mdm/CountryRegion';
|
import { addLngBRegion, getLngBRegion, updateLngBRegion, deleteLngBRegion } from '/@/api/mdm/CountryRegion';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { FormDataProps } from '/@/components/Designer/src/types';
|
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||||
import { usePermission } from '/@/hooks/web/usePermission';
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||||
import { FromPageType } from '/@/enums/workflowEnum';
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent';
|
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
|
||||||
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||||
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
const { filterFormSchemaAuth } = usePermission();
|
||||||
|
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
|
||||||
const { filterFormSchemaAuth } = usePermission();
|
const RowKey = 'id';
|
||||||
const { mergeFormSchemas, mergeFormEventConfigs } = useFormConfig();
|
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||||
const { currentRoute } = useRouter();
|
const props = defineProps({
|
||||||
|
fromPage: {
|
||||||
|
type: Number,
|
||||||
|
default: FromPageType.MENU,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const systemFormRef = ref();
|
||||||
|
const data: { formDataProps: FormDataProps } = reactive({
|
||||||
|
formDataProps: {schemas:[]} as FormDataProps,
|
||||||
|
});
|
||||||
|
const state = reactive({
|
||||||
|
formModel: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
let customFormEventConfigs=[];
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
||||||
|
await mergeCustomFormRenderConfig();
|
||||||
|
|
||||||
|
if (props.fromPage == FromPageType.MENU) {
|
||||||
|
setMenuPermission();
|
||||||
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, 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(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
}
|
||||||
|
emits('form-mounted', formProps);
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
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: { schemas: [] } as FormDataProps
|
|
||||||
});
|
|
||||||
const state = reactive({
|
|
||||||
formModel: {}
|
|
||||||
});
|
|
||||||
|
|
||||||
let customFormEventConfigs = [];
|
async function mergeCustomFormRenderConfig() {
|
||||||
|
let cloneProps=cloneDeep(formProps);
|
||||||
|
let fEventConfigs=cloneDeep(formEventConfigs);
|
||||||
|
if (formConfig.useCustomConfig) {
|
||||||
|
if(props.fromPage !== FromPageType.FLOW){
|
||||||
|
let formPath=currentRoute.value.query.formPath;
|
||||||
|
//1.合并字段配置
|
||||||
|
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
|
||||||
|
//2.合并表单事件配置
|
||||||
|
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.formDataProps=cloneProps;
|
||||||
|
customFormEventConfigs=fEventConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||||
|
function setMenuPermission() {
|
||||||
|
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
// 校验form 通过返回表单数据
|
||||||
try {
|
async function validate() {
|
||||||
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
let values = [];
|
||||||
await mergeCustomFormRenderConfig();
|
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, skipUpdate) {
|
||||||
|
try {
|
||||||
|
const record = await getLngBRegion(rowId);
|
||||||
|
if (skipUpdate) {
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
setFieldsValue(record);
|
||||||
|
state.formModel = record;
|
||||||
|
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||||
|
return record;
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
if (props.fromPage == FromPageType.MENU) {
|
|
||||||
setMenuPermission();
|
|
||||||
await createFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
|
||||||
await loadFormEvent(customFormEventConfigs, 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(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
|
||||||
await loadFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
|
||||||
}
|
|
||||||
emits('form-mounted', formProps);
|
|
||||||
} catch (error) {}
|
|
||||||
});
|
|
||||||
|
|
||||||
async function mergeCustomFormRenderConfig() {
|
|
||||||
let cloneProps = cloneDeep(formProps);
|
|
||||||
let fEventConfigs = cloneDeep(formEventConfigs);
|
|
||||||
if (formConfig.useCustomConfig) {
|
|
||||||
if (props.fromPage !== FromPageType.FLOW) {
|
|
||||||
let formPath = currentRoute.value.query.formPath;
|
|
||||||
//1.合并字段配置
|
|
||||||
cloneProps.schemas = await mergeFormSchemas({ formSchema: cloneProps.schemas!, formPath: formPath });
|
|
||||||
//2.合并表单事件配置
|
|
||||||
fEventConfigs = await mergeFormEventConfigs({ formEventConfigs: fEventConfigs, formPath: formPath });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data.formDataProps = cloneProps;
|
|
||||||
customFormEventConfigs = fEventConfigs;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
// 辅助设置表单数据
|
||||||
function setMenuPermission() {
|
function setFieldsValue(record) {
|
||||||
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
|
systemFormRef.value.setFieldsValue(record);
|
||||||
}
|
}
|
||||||
|
// 重置表单数据
|
||||||
// 校验form 通过返回表单数据
|
async function resetFields() {
|
||||||
async function validate() {
|
await systemFormRef.value.resetFields();
|
||||||
let values = [];
|
}
|
||||||
try {
|
// 设置表单数据全部为Disabled 【查看】
|
||||||
values = await systemFormRef.value?.validate();
|
async function setDisabledForm(isDisabled) {
|
||||||
//添加隐藏组件
|
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
|
||||||
if (data.formDataProps.hiddenComponent?.length) {
|
}
|
||||||
data.formDataProps.hiddenComponent.forEach((component) => {
|
// 获取行键值
|
||||||
values[component.bindField] = component.value;
|
function getRowKey() {
|
||||||
});
|
return RowKey;
|
||||||
}
|
}
|
||||||
} finally {
|
// 更新api表单数据
|
||||||
}
|
async function update({ values, rowId }) {
|
||||||
return values;
|
try {
|
||||||
}
|
values[RowKey] = rowId;
|
||||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
state.formModel = values;
|
||||||
async function setFormDataFromId(rowId, skipUpdate) {
|
let saveVal = await updateLngBRegion(values);
|
||||||
try {
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
const record = await getLngBRegion(rowId);
|
systemFormRef.value,
|
||||||
if (skipUpdate) {
|
formProps.schemas); //表单事件:提交表单
|
||||||
return record;
|
return saveVal;
|
||||||
}
|
} catch (error) {}
|
||||||
setFieldsValue(record);
|
}
|
||||||
state.formModel = record;
|
// 新增api表单数据
|
||||||
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
async function add(values) {
|
||||||
return record;
|
try {
|
||||||
} catch (error) {}
|
state.formModel = values;
|
||||||
}
|
let saveVal = await addLngBRegion(values);
|
||||||
// 辅助设置表单数据
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
function setFieldsValue(record) {
|
systemFormRef.value,
|
||||||
systemFormRef.value.setFieldsValue(record);
|
formProps.schemas); //表单事件:提交表单
|
||||||
}
|
return saveVal;
|
||||||
// 重置表单数据
|
} catch (error) {}
|
||||||
async function resetFields() {
|
}
|
||||||
await systemFormRef.value.resetFields();
|
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||||
}
|
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||||
// 设置表单数据全部为Disabled 【查看】
|
try {
|
||||||
async function setDisabledForm(isDisabled) {
|
const cloneProps=cloneDeep(formProps);
|
||||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas), isDisabled);
|
customFormEventConfigs=cloneDeep(formEventConfigs);
|
||||||
}
|
if (formConfig.useCustomConfig) {
|
||||||
// 获取行键值
|
const parts = obj.formConfigKey.split('_');
|
||||||
function getRowKey() {
|
const formId=parts[1];
|
||||||
return RowKey;
|
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
|
||||||
}
|
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
|
||||||
// 更新api表单数据
|
}
|
||||||
async function update({ values, rowId }) {
|
|
||||||
try {
|
let flowData = changeWorkFlowForm(cloneProps, obj);
|
||||||
values[RowKey] = rowId;
|
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||||
state.formModel = values;
|
data.formDataProps = buildOptionJson;
|
||||||
let saveVal = await updateLngBRegion(values);
|
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||||
await submitFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:提交表单
|
if (isViewProcess) {
|
||||||
return saveVal;
|
setDisabledForm(); //查看
|
||||||
} catch (error) {}
|
}
|
||||||
}
|
state.formModel = formModels;
|
||||||
// 新增api表单数据
|
if(formModels[RowKey]) {
|
||||||
async function add(values) {
|
setFormDataFromId(formModels[RowKey], false)
|
||||||
try {
|
} else {
|
||||||
state.formModel = values;
|
setFieldsValue(formModels)
|
||||||
let saveVal = await addLngBRegion(values);
|
}
|
||||||
await submitFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:提交表单
|
} catch (error) {}
|
||||||
return saveVal;
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
} catch (error) {}
|
systemFormRef.value,
|
||||||
}
|
formProps.schemas); //表单事件:初始化表单
|
||||||
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
systemFormRef.value,
|
||||||
try {
|
formProps.schemas); //表单事件:加载表单
|
||||||
const cloneProps = cloneDeep(formProps);
|
}
|
||||||
customFormEventConfigs = cloneDeep(formEventConfigs);
|
function getFormModel() {
|
||||||
if (formConfig.useCustomConfig) {
|
return systemFormRef.value.formModel
|
||||||
const parts = obj.formConfigKey.split('_');
|
}
|
||||||
const formId = parts[1];
|
async function handleDelete(id) {
|
||||||
cloneProps.schemas = await mergeFormSchemas({ formSchema: cloneProps.schemas!, formId: formId });
|
return await deleteLngBRegion([id]);
|
||||||
customFormEventConfigs = await mergeFormEventConfigs({ formEventConfigs: customFormEventConfigs, formId: formId });
|
}
|
||||||
}
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
let flowData = changeWorkFlowForm(cloneProps, obj);
|
resetFields,
|
||||||
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
validate,
|
||||||
data.formDataProps = buildOptionJson;
|
add,
|
||||||
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
update,
|
||||||
if (isViewProcess) {
|
setFormDataFromId,
|
||||||
setDisabledForm(); //查看
|
setDisabledForm,
|
||||||
}
|
setMenuPermission,
|
||||||
state.formModel = formModels;
|
setWorkFlowForm,
|
||||||
if (formModels[RowKey]) {
|
getRowKey,
|
||||||
setFormDataFromId(formModels[RowKey], false);
|
getFormModel,
|
||||||
} else {
|
handleDelete
|
||||||
setFieldsValue(formModels);
|
});
|
||||||
}
|
</script>
|
||||||
} catch (error) {}
|
|
||||||
await createFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
|
||||||
await loadFormEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
|
||||||
}
|
|
||||||
function getFormModel() {
|
|
||||||
return systemFormRef.value.formModel;
|
|
||||||
}
|
|
||||||
async function handleDelete(id) {
|
|
||||||
return await deleteLngBRegion([id]);
|
|
||||||
}
|
|
||||||
defineExpose({
|
|
||||||
setFieldsValue,
|
|
||||||
resetFields,
|
|
||||||
validate,
|
|
||||||
add,
|
|
||||||
update,
|
|
||||||
setFormDataFromId,
|
|
||||||
setDisabledForm,
|
|
||||||
setMenuPermission,
|
|
||||||
setWorkFlowForm,
|
|
||||||
getRowKey,
|
|
||||||
getFormModel,
|
|
||||||
handleDelete
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@ -6,18 +6,13 @@ export const formConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const searchFormSchema: FormSchema[] = [
|
export const searchFormSchema: FormSchema[] = [
|
||||||
{
|
|
||||||
field: 'id',
|
|
||||||
label: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'code',
|
field: 'code',
|
||||||
label: '编码',
|
label: '编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createUserId',
|
field: 'fullName',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
@ -40,7 +35,7 @@ export const searchFormSchema: FormSchema[] = [
|
|||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'fullName',
|
field: 'fullPath',
|
||||||
label: '全路径名称',
|
label: '全路径名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
@ -66,8 +61,17 @@ export const searchFormSchema: FormSchema[] = [
|
|||||||
|
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
dataIndex: 'id',
|
dataIndex: 'code',
|
||||||
title: 'id',
|
title: '编码',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'fullName',
|
||||||
|
title: '名称',
|
||||||
componentType: 'input',
|
componentType: 'input',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
||||||
@ -83,33 +87,6 @@ export const columns: BasicColumn[] = [
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
dataIndex: 'valid',
|
|
||||||
title: '有效标志',
|
|
||||||
componentType: 'select',
|
|
||||||
align: 'left',
|
|
||||||
|
|
||||||
sorter: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
dataIndex: 'code',
|
|
||||||
title: '编码',
|
|
||||||
componentType: 'input',
|
|
||||||
align: 'left',
|
|
||||||
|
|
||||||
sorter: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
dataIndex: 'fullName',
|
|
||||||
title: '全路径名称',
|
|
||||||
componentType: 'input',
|
|
||||||
align: 'left',
|
|
||||||
|
|
||||||
sorter: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
dataIndex: 'pid',
|
dataIndex: 'pid',
|
||||||
title: '上级ID',
|
title: '上级ID',
|
||||||
@ -120,18 +97,27 @@ export const columns: BasicColumn[] = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
dataIndex: 'note',
|
dataIndex: 'fullPath',
|
||||||
title: '备注',
|
title: '全路径名称',
|
||||||
componentType: 'textarea',
|
componentType: 'input',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
dataIndex: 'createUserId',
|
dataIndex: 'valid',
|
||||||
title: '名称',
|
title: '有效标志',
|
||||||
componentType: 'input',
|
componentType: 'select',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'note',
|
||||||
|
title: '备注',
|
||||||
|
componentType: 'textarea',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
||||||
sorter: true,
|
sorter: true,
|
||||||
@ -207,41 +193,7 @@ export const formProps: FormProps = {
|
|||||||
size: 'default',
|
size: 'default',
|
||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
key: '3665616565b14649b7cc18269b7a2d06',
|
key: '8debb3c9f24b44e6a5256baf825dabd3',
|
||||||
field: 'id',
|
|
||||||
label: 'id',
|
|
||||||
type: 'input',
|
|
||||||
component: 'Input',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
defaultValue: '',
|
|
||||||
componentProps: {
|
|
||||||
width: '100%',
|
|
||||||
span: '',
|
|
||||||
defaultValue: '',
|
|
||||||
labelWidthMode: 'fix',
|
|
||||||
labelFixWidth: 120,
|
|
||||||
responsive: false,
|
|
||||||
respNewRow: false,
|
|
||||||
placeholder: '请输入id',
|
|
||||||
maxlength: null,
|
|
||||||
prefix: '',
|
|
||||||
suffix: '',
|
|
||||||
addonBefore: '',
|
|
||||||
addonAfter: '',
|
|
||||||
disabled: false,
|
|
||||||
allowClear: false,
|
|
||||||
showLabel: true,
|
|
||||||
required: false,
|
|
||||||
rules: [],
|
|
||||||
events: {},
|
|
||||||
isSave: false,
|
|
||||||
isShow: true,
|
|
||||||
scan: false,
|
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: '04cf4a78d06244f282a8082070bdd160',
|
|
||||||
field: 'code',
|
field: 'code',
|
||||||
label: '编码',
|
label: '编码',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
@ -275,8 +227,8 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '569e80f61cfa49338d3a629acf403b2f',
|
key: 'c9f612f71d7b4d8ba63b29f849e21512',
|
||||||
field: 'createUserId',
|
field: 'fullName',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
@ -309,7 +261,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'ac57735d6de3479ab78a092cce60af35',
|
key: 'db1d945640974619b1da11ee3eedc43c',
|
||||||
field: 'regionTypeCode',
|
field: 'regionTypeCode',
|
||||||
label: '类型',
|
label: '类型',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -322,12 +274,13 @@ export const formProps: FormProps = {
|
|||||||
labelFixWidth: 120,
|
labelFixWidth: 120,
|
||||||
responsive: false,
|
responsive: false,
|
||||||
respNewRow: false,
|
respNewRow: false,
|
||||||
placeholder: '请选择下拉选择类型',
|
placeholder: '请选择下拉选择',
|
||||||
sepTextField: '',
|
sepTextField: '',
|
||||||
showLabel: true,
|
showLabel: true,
|
||||||
showSearch: false,
|
showSearch: false,
|
||||||
clearable: false,
|
clearable: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
mode: 'multiple',
|
||||||
staticOptions: [
|
staticOptions: [
|
||||||
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
||||||
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
||||||
@ -353,7 +306,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '8b4d0e4a36164d219b2fe9045e056581',
|
key: 'ed8d105c346a4306bf6502ecca668328',
|
||||||
field: 'pid',
|
field: 'pid',
|
||||||
label: '上级ID',
|
label: '上级ID',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
@ -387,8 +340,8 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'd71fb1fcf5924520b059b1f0b79837f3',
|
key: 'ed4ef5737e834886b33c49a800c180c8',
|
||||||
field: 'fullName',
|
field: 'fullPath',
|
||||||
label: '全路径名称',
|
label: '全路径名称',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
@ -421,7 +374,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '5ee69ee1a3c846aa9ae77035208eac66',
|
key: 'c4eb806479bb49fab6aaab58c2ef8511',
|
||||||
field: 'valid',
|
field: 'valid',
|
||||||
label: '有效标志',
|
label: '有效标志',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -440,6 +393,7 @@ export const formProps: FormProps = {
|
|||||||
showSearch: false,
|
showSearch: false,
|
||||||
clearable: false,
|
clearable: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
mode: 'multiple',
|
||||||
staticOptions: [
|
staticOptions: [
|
||||||
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
||||||
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
||||||
@ -465,7 +419,7 @@ export const formProps: FormProps = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'fa22773393104485870ba4f6c54e5457',
|
key: '1d4a47bb18044306918247cf66682d5a',
|
||||||
field: 'note',
|
field: 'note',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
@ -481,7 +435,7 @@ export const formProps: FormProps = {
|
|||||||
responsive: false,
|
responsive: false,
|
||||||
respNewRow: true,
|
respNewRow: true,
|
||||||
placeholder: '请输入备注',
|
placeholder: '请输入备注',
|
||||||
maxlength: 200,
|
maxlength: '',
|
||||||
rows: 4,
|
rows: 4,
|
||||||
autoSize: false,
|
autoSize: false,
|
||||||
showCount: false,
|
showCount: false,
|
||||||
|
|||||||
@ -1,19 +1,4 @@
|
|||||||
export const permissionList = [
|
export const permissionList = [
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
view: true,
|
|
||||||
edit: true,
|
|
||||||
disabled: false,
|
|
||||||
isSaveTable: false,
|
|
||||||
tableName: '',
|
|
||||||
fieldName: 'id',
|
|
||||||
fieldId: 'id',
|
|
||||||
isSubTable: false,
|
|
||||||
showChildren: true,
|
|
||||||
type: 'input',
|
|
||||||
key: '3665616565b14649b7cc18269b7a2d06',
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
view: true,
|
view: true,
|
||||||
@ -26,7 +11,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: '04cf4a78d06244f282a8082070bdd160',
|
key: '8debb3c9f24b44e6a5256baf825dabd3',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -37,11 +22,11 @@ export const permissionList = [
|
|||||||
isSaveTable: false,
|
isSaveTable: false,
|
||||||
tableName: '',
|
tableName: '',
|
||||||
fieldName: '名称',
|
fieldName: '名称',
|
||||||
fieldId: 'createUserId',
|
fieldId: 'fullName',
|
||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: '569e80f61cfa49338d3a629acf403b2f',
|
key: 'c9f612f71d7b4d8ba63b29f849e21512',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -56,7 +41,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'ac57735d6de3479ab78a092cce60af35',
|
key: 'db1d945640974619b1da11ee3eedc43c',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -71,7 +56,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: '8b4d0e4a36164d219b2fe9045e056581',
|
key: 'ed8d105c346a4306bf6502ecca668328',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -82,11 +67,11 @@ export const permissionList = [
|
|||||||
isSaveTable: false,
|
isSaveTable: false,
|
||||||
tableName: '',
|
tableName: '',
|
||||||
fieldName: '全路径名称',
|
fieldName: '全路径名称',
|
||||||
fieldId: 'fullName',
|
fieldId: 'fullPath',
|
||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
key: 'd71fb1fcf5924520b059b1f0b79837f3',
|
key: 'ed4ef5737e834886b33c49a800c180c8',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -101,7 +86,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: '5ee69ee1a3c846aa9ae77035208eac66',
|
key: 'c4eb806479bb49fab6aaab58c2ef8511',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -116,7 +101,7 @@ export const permissionList = [
|
|||||||
isSubTable: false,
|
isSubTable: false,
|
||||||
showChildren: true,
|
showChildren: true,
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
key: 'fa22773393104485870ba4f6c54e5457',
|
key: '1d4a47bb18044306918247cf66682d5a',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -1,318 +1,329 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||||
<div class="w-1/5 xl:w-1/5 mr-2">
|
<div class="w-1/5 xl:w-1/5 mr-2">
|
||||||
<BasicTree title="" toolbar search :clickRowToExpand="true" :treeData="treeData" :fieldNames="{ key: 'key', title: 'title' }" @select="handleSelect">
|
<BasicTree
|
||||||
<template #title="item"> {{ item.title }} </template>
|
title="国家地区"
|
||||||
</BasicTree>
|
toolbar
|
||||||
</div>
|
search
|
||||||
<div class="w-4/5 xl:w-4/5">
|
:clickRowToExpand="true"
|
||||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
:treeData="treeData"
|
||||||
<template #toolbar>
|
:fieldNames="{ key: 'key', title: 'title' }"
|
||||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
@select="handleSelect"
|
||||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
>
|
||||||
<template #icon><Icon :icon="button.icon" /></template>
|
<template #title="item">
|
||||||
{{ button.name }}
|
{{ item.title }}
|
||||||
</a-button>
|
</template>
|
||||||
<a-button v-else :type="button.type">
|
</BasicTree>
|
||||||
<template #icon><Icon :icon="button.icon" /></template>
|
</div>
|
||||||
{{ button.name }}
|
<div class="w-4/5 xl:w-4/5">
|
||||||
</a-button>
|
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||||
</template>
|
|
||||||
</template>
|
<template #toolbar>
|
||||||
<template #bodyCell="{ column, record }">
|
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||||
<template v-if="column.dataIndex === 'action'">
|
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||||
<TableAction :actions="getActions(record)" />
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
</template>
|
{{ button.name }}
|
||||||
</template>
|
</a-button>
|
||||||
</BasicTable>
|
<a-button v-else :type="button.type">
|
||||||
</div>
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
<CountryRegionModal @register="registerModal" @success="handleSuccess" />
|
{{ button.name }}
|
||||||
</PageWrapper>
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.dataIndex === 'action'">
|
||||||
|
<TableAction :actions="getActions(record)" />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
</div>
|
||||||
|
<CountryRegionModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
</PageWrapper>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, onMounted, onUnmounted, createVNode } from 'vue';
|
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||||
|
|
||||||
import { Modal } from 'ant-design-vue';
|
} from 'vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
||||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
import { Modal } from 'ant-design-vue';
|
||||||
import { getLngBRegionPage, deleteLngBRegion } from '/@/api/mdm/CountryRegion';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { PageWrapper } from '/@/components/Page';
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { getLngBRegionPage, deleteLngBRegion} from '/@/api/mdm/CountryRegion';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { PageWrapper } from '/@/components/Page';
|
||||||
import { usePermission } from '/@/hooks/web/usePermission';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
import { setIndexFlowStatus } from '/@/utils/flow/index';
|
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||||
import { getLngBRegion } from '/@/api/mdm/CountryRegion';
|
import { useRouter } from 'vue-router';
|
||||||
import { useModal } from '/@/components/Modal';
|
import { setIndexFlowStatus } from '/@/utils/flow/index'
|
||||||
import CountryRegionModal from './components/CountryRegionModal.vue';
|
import { getLngBRegion } from '/@/api/mdm/CountryRegion';
|
||||||
import { formConfig, searchFormSchema, columns } from './components/config';
|
import { useModal } from '/@/components/Modal';
|
||||||
import Icon from '/@/components/Icon/index';
|
import CountryRegionModal from './components/CountryRegionModal.vue';
|
||||||
|
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||||
|
import Icon from '/@/components/Icon/index';
|
||||||
|
|
||||||
|
import { BasicTree, TreeItem } from '/@/components/Tree';
|
||||||
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
|
||||||
import { BasicTree, TreeItem } from '/@/components/Tree';
|
const { notification } = useMessage();
|
||||||
import useEventBus from '/@/hooks/event/useEventBus';
|
const { t } = useI18n();
|
||||||
import { cloneDeep } from 'lodash-es';
|
defineEmits(['register']);
|
||||||
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
|
||||||
|
|
||||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||||
|
const customConfigColums =ref(filterColumns);
|
||||||
|
const customSearchFormSchema =ref(searchFormSchema);
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
//所有按钮
|
||||||
|
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"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":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
|
||||||
|
//展示在列表内的按钮
|
||||||
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||||
|
const buttonConfigs = computed(()=>{
|
||||||
|
return filterButtonAuth(buttons.value);
|
||||||
|
})
|
||||||
|
|
||||||
const { notification } = useMessage();
|
const tableButtonConfig = computed(() => {
|
||||||
const { t } = useI18n();
|
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||||
defineEmits(['register']);
|
});
|
||||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
|
||||||
const { mergeColumns, mergeSearchFormSchema, mergeButtons } = useFormConfig();
|
|
||||||
|
|
||||||
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
const actionButtonConfig = computed(() => {
|
||||||
const customConfigColums = ref(filterColumns);
|
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||||
const customSearchFormSchema = ref(searchFormSchema);
|
});
|
||||||
|
|
||||||
const tableRef = ref();
|
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
|
||||||
//所有按钮
|
|
||||||
const buttons = ref([
|
|
||||||
{ isUse: true, name: '新增', code: 'add', icon: 'ant-design:plus-outlined', isDefault: true, type: 'primary' },
|
|
||||||
{ 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: 'enable', icon: 'ant-design:check-circle-outlined', isDefault: false },
|
|
||||||
{ isUse: true, name: '停用', code: 'stop', icon: 'ant-design:stop-outlined', isDefault: false },
|
|
||||||
{ isUse: true, name: '批量启用', code: 'batchenable', icon: 'ant-design:check-circle-outlined', isDefault: false },
|
|
||||||
{ isUse: true, name: '批量停用', code: 'batchstop', icon: 'ant-design:stop-outlined', isDefault: false },
|
|
||||||
{ isUse: true, name: '删除', code: 'delete', icon: 'ant-design:delete-outlined', isDefault: true }
|
|
||||||
]);
|
|
||||||
//展示在列表内的按钮
|
|
||||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork', 'flowRecord']);
|
|
||||||
const buttonConfigs = computed(() => {
|
|
||||||
return filterButtonAuth(buttons.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
const tableButtonConfig = computed(() => {
|
const { currentRoute } = useRouter();
|
||||||
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
const router = useRouter();
|
||||||
});
|
const formIdComputedRef = ref();
|
||||||
|
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||||
const actionButtonConfig = computed(() => {
|
const schemaIdComputedRef = ref();
|
||||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||||
});
|
const selectId = ref('');
|
||||||
|
const treeData = ref<TreeItem[]>([]);
|
||||||
const btnEvent = { add: handleAdd, edit: handleEdit, refresh: handleRefresh, view: handleView, delete: handleDelete };
|
const [registerModal, { openModal }] = useModal();
|
||||||
|
const formName='国家地区';
|
||||||
const { currentRoute } = useRouter();
|
const [registerTable, { reload, }] = useTable({
|
||||||
const router = useRouter();
|
title: '' || (formName + '列表'),
|
||||||
const formIdComputedRef = ref();
|
api: getLngBRegionPage,
|
||||||
formIdComputedRef.value = currentRoute.value.meta.formId;
|
rowKey: 'id',
|
||||||
const schemaIdComputedRef = ref();
|
columns: customConfigColums,
|
||||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId;
|
formConfig: {
|
||||||
const selectId = ref('');
|
rowProps: {
|
||||||
const treeData = ref<TreeItem[]>([]);
|
gutter: 16,
|
||||||
const [registerModal, { openModal }] = useModal();
|
},
|
||||||
const formName = '国家地区';
|
schemas: customSearchFormSchema,
|
||||||
const [registerTable, { reload }] = useTable({
|
fieldMapToTime: [],
|
||||||
title: '' || formName + '列表',
|
showResetButton: false,
|
||||||
api: getLngBRegionPage,
|
},
|
||||||
rowKey: 'id',
|
beforeFetch: (params) => {
|
||||||
columns: customConfigColums,
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||||
formConfig: {
|
},
|
||||||
rowProps: {
|
afterFetch: (res) => {
|
||||||
gutter: 16
|
tableRef.value.setToolBarWidth();
|
||||||
},
|
|
||||||
schemas: customSearchFormSchema,
|
},
|
||||||
fieldMapToTime: [],
|
useSearchForm: true,
|
||||||
showResetButton: false
|
showTableSetting: true,
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
striped: false,
|
||||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
actionColumn: {
|
||||||
},
|
width: 160,
|
||||||
afterFetch: (res) => {
|
title: '操作',
|
||||||
tableRef.value.setToolBarWidth();
|
dataIndex: 'action',
|
||||||
},
|
slots: { customRender: 'action' },
|
||||||
useSearchForm: true,
|
},
|
||||||
showTableSetting: true,
|
tableSetting: {
|
||||||
|
size: false,
|
||||||
striped: false,
|
setting: false,
|
||||||
actionColumn: {
|
},
|
||||||
width: 160,
|
|
||||||
title: '操作',
|
});
|
||||||
dataIndex: 'action',
|
|
||||||
slots: { customRender: 'action' }
|
function dbClickRow(record) {
|
||||||
},
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
tableSetting: {
|
return;
|
||||||
size: false,
|
|
||||||
setting: false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function dbClickRow(record) {
|
|
||||||
if (!actionButtonConfig?.value.some((element) => element.code == 'view')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
|
||||||
if (taskIds && taskIds.length) {
|
|
||||||
router.push({
|
|
||||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
|
||||||
query: {
|
|
||||||
taskId: taskIds[0],
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (schemaId && !taskIds && processId) {
|
|
||||||
router.push({
|
|
||||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
|
||||||
query: {
|
|
||||||
readonly: 1,
|
|
||||||
taskId: '',
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
router.push({
|
|
||||||
path: '/form/CountryRegion/' + record.id + '/viewForm',
|
|
||||||
query: {
|
|
||||||
formPath: 'mdm/CountryRegion',
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
function buttonClick(code) {
|
if (taskIds && taskIds.length) {
|
||||||
btnEvent[code]();
|
router.push({
|
||||||
}
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
function handleAdd() {
|
taskId: taskIds[0],
|
||||||
if (schemaIdComputedRef.value) {
|
formName: formName,
|
||||||
router.push({
|
formId:currentRoute.value.meta.formId
|
||||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
router.push({
|
|
||||||
path: '/form/CountryRegion/0/createForm',
|
|
||||||
query: {
|
|
||||||
formPath: 'mdm/CountryRegion',
|
|
||||||
formName: formName,
|
|
||||||
formId: currentRoute.value.meta.formId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else if (schemaId && !taskIds && processId) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/CountryRegion/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'mdm/CountryRegion',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleEdit(record: Recordable) {
|
function buttonClick(code) {
|
||||||
router.push({
|
|
||||||
path: '/form/CountryRegion/' + record.id + '/updateForm',
|
btnEvent[code]();
|
||||||
query: {
|
}
|
||||||
formPath: 'mdm/CountryRegion',
|
|
||||||
formName: formName,
|
function handleAdd() {
|
||||||
formId: currentRoute.value.meta.formId
|
if (schemaIdComputedRef.value) {
|
||||||
}
|
router.push({
|
||||||
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/CountryRegion/0/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'mdm/CountryRegion',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/form/CountryRegion/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'mdm/CountryRegion',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteLngBRegion(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
function handleDelete(record: Recordable) {
|
onCancel() {},
|
||||||
deleteList([record.id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteList(ids) {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示信息',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
content: '是否确认删除?',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk() {
|
|
||||||
deleteLngBRegion(ids).then((_) => {
|
|
||||||
handleSuccess();
|
|
||||||
notification.success({
|
|
||||||
message: 'Tip',
|
|
||||||
description: t('删除成功!')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onCancel() {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function handleRefresh() {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
function handleSuccess() {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleView(record: Recordable) {
|
|
||||||
dbClickRow(record);
|
|
||||||
}
|
|
||||||
function handleSelect(selectIds) {
|
|
||||||
selectId.value = selectIds[0];
|
|
||||||
reload({ searchInfo: { id: selectIds[0] } });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetch() {
|
|
||||||
treeData.value = [];
|
|
||||||
}
|
|
||||||
onMounted(() => {
|
|
||||||
fetch();
|
|
||||||
if (schemaIdComputedRef.value) {
|
|
||||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
|
||||||
bus.on(CREATE_FLOW, handleRefresh);
|
|
||||||
} else {
|
|
||||||
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
|
||||||
mergeCustomListRenderConfig();
|
|
||||||
});
|
});
|
||||||
onUnmounted(() => {
|
}
|
||||||
if (schemaIdComputedRef.value) {
|
function handleRefresh() {
|
||||||
bus.off(FLOW_PROCESSED, handleRefresh);
|
reload();
|
||||||
bus.off(CREATE_FLOW, handleRefresh);
|
}
|
||||||
|
function handleSuccess() {
|
||||||
|
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleView(record: Recordable) {
|
||||||
|
|
||||||
|
dbClickRow(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
function handleSelect(selectIds) {
|
||||||
|
selectId.value = selectIds[0];
|
||||||
|
reload({ searchInfo: { code: selectIds[0] } });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetch() {
|
||||||
|
|
||||||
|
treeData.value = [];
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
fetch();
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||||
|
bus.on(CREATE_FLOW, handleRefresh);
|
||||||
|
} else {
|
||||||
|
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
||||||
|
mergeCustomListRenderConfig();
|
||||||
|
});
|
||||||
|
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 {
|
} else {
|
||||||
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
return {};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
function getActions(record: Recordable): ActionItem[] {
|
return actionsList;
|
||||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
}
|
||||||
if (!record.workflowData?.processId) {
|
async function mergeCustomListRenderConfig(){
|
||||||
return {
|
if (formConfig.useCustomConfig) {
|
||||||
icon: button?.icon,
|
let formId=currentRoute.value.meta.formId;
|
||||||
tooltip: button?.name,
|
//1.合并展示字段配置
|
||||||
color: button.code === 'delete' ? 'error' : undefined,
|
let cols= await mergeColumns(customConfigColums.value,formId);
|
||||||
onClick: btnEvent[button.code].bind(null, record)
|
customConfigColums.value=cols;
|
||||||
};
|
//2.合并搜索字段配置
|
||||||
} else {
|
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
|
||||||
if (button.code === 'view') {
|
customSearchFormSchema.value=sFormSchema;
|
||||||
return {
|
//3.合并按钮配置
|
||||||
icon: button?.icon,
|
let btns= await mergeButtons(buttons.value,formId);
|
||||||
tooltip: button?.name,
|
buttons.value=btns;
|
||||||
onClick: btnEvent[button.code].bind(null, record)
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return actionsList;
|
|
||||||
}
|
|
||||||
async function mergeCustomListRenderConfig() {
|
|
||||||
if (formConfig.useCustomConfig) {
|
|
||||||
let formId = currentRoute.value.meta.formId;
|
|
||||||
//1.合并展示字段配置
|
|
||||||
let cols = await mergeColumns(customConfigColums.value, formId);
|
|
||||||
customConfigColums.value = cols;
|
|
||||||
//2.合并搜索字段配置
|
|
||||||
let sFormSchema = await mergeSearchFormSchema(customSearchFormSchema.value, formId);
|
|
||||||
customSearchFormSchema.value = sFormSchema;
|
|
||||||
//3.合并按钮配置
|
|
||||||
let btns = await mergeButtons(buttons.value, formId);
|
|
||||||
buttons.value = btns;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
:deep(.ant-table-selection-col) {
|
:deep(.ant-table-selection-col) {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
.show {
|
.show{
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.hide {
|
.hide{
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user