This commit is contained in:
‘huanghaiixia’
2025-10-23 14:03:24 +08:00
6 changed files with 1370 additions and 1374 deletions

2
.gitignore vendored
View File

@ -38,3 +38,5 @@ jinayi
/pnpm-lock.yaml /pnpm-lock.yaml
/src/views/jianyi /src/views/jianyi
/src/api/jianyi /src/api/jianyi
*.bak

View File

@ -7,6 +7,14 @@ export interface LngBPriceTermPageParams extends BasicPageParams {
fullName: string; fullName: string;
valid: string; valid: string;
code: string;
freightSign: string;
insuranceSign: string;
note: string;
} }
/** /**

View File

@ -2,358 +2,335 @@ import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
export const formConfig = { export const formConfig = {
useCustomConfig: false, useCustomConfig: false
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
field: 'fullName', field: 'fullName',
label: '名称', label: '名称',
component: 'Input', component: 'Input'
},
{
field: 'valid',
label: '有效标志',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
}, },
}, {
{ field: 'valid',
field: 'code', label: '有效标志',
label: '编码', component: 'XjrSelect',
component: 'Input', componentProps: {
}, datasourceType: 'dic',
{ params: { itemId: '1978057078528327681' },
field: 'localSign', labelField: 'name',
label: '是否本币', valueField: 'value',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1978056598125330433' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body, getPopupContainer: () => document.body
}, }
}, }
{
field: 'note',
label: '备注',
component: 'Input',
},
]; ];
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
dataIndex: 'code', dataIndex: 'code',
title: '编码', title: '编码',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'fullName', dataIndex: 'fullName',
title: '名称', title: '名称',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'localSign', dataIndex: 'localSign',
title: '是否本币', title: '是否本币',
componentType: 'select', componentType: 'select',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'valid', dataIndex: 'valid',
title: '有效标志', title: '有效标志',
componentType: 'select', componentType: 'select',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'note', dataIndex: 'note',
title: '备注', title: '备注',
componentType: 'textarea', componentType: 'textarea',
align: 'left', align: 'left',
sorter: true, sorter: true
}, }
]; ];
//表单事件 //表单事件
export const formEventConfigs = { export const formEventConfigs = {
0: [ 0: [
{ {
type: 'circle', type: 'circle',
color: '#2774ff', color: '#2774ff',
text: '开始节点', text: '开始节点',
icon: '#icon-kaishi', icon: '#icon-kaishi',
bgcColor: '#D8E5FF', bgcColor: '#D8E5FF',
isUserDefined: false, isUserDefined: false
}, },
{ {
color: '#F6AB01', color: '#F6AB01',
icon: '#icon-chushihua', icon: '#icon-chushihua',
text: '初始化表单', text: '初始化表单',
bgcColor: '#f9f5ea', bgcColor: '#f9f5ea',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
1: [ 1: [
{ {
color: '#B36EDB', color: '#B36EDB',
icon: '#icon-shujufenxi', icon: '#icon-shujufenxi',
text: '获取表单数据', text: '获取表单数据',
detail: '(新增无此操作)', detail: '(新增无此操作)',
bgcColor: '#F8F2FC', bgcColor: '#F8F2FC',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
2: [ 2: [
{ {
color: '#F8625C', color: '#F8625C',
icon: '#icon-jiazai', icon: '#icon-jiazai',
text: '加载表单', text: '加载表单',
bgcColor: '#FFF1F1', bgcColor: '#FFF1F1',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
3: [ 3: [
{ {
color: '#6C6AE0', color: '#6C6AE0',
icon: '#icon-jsontijiao', icon: '#icon-jsontijiao',
text: '提交表单', text: '提交表单',
bgcColor: '#F5F4FF', bgcColor: '#F5F4FF',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
4: [ 4: [
{ {
type: 'circle', type: 'circle',
color: '#F8625C', color: '#F8625C',
text: '结束节点', text: '结束节点',
icon: '#icon-jieshuzhiliao', icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6', bgcColor: '#FFD6D6',
isLast: true, isLast: true,
isUserDefined: false, isUserDefined: false
}, }
], ]
}; };
export const formProps: FormProps = { export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 }, labelCol: { span: 3, offset: 0 },
labelAlign: 'right', labelAlign: 'right',
layout: 'horizontal', layout: 'horizontal',
size: 'default', size: 'default',
schemas: [ schemas: [
{ {
key: '216e1018f11a4d4aa5ad0879dd4d8209', key: '216e1018f11a4d4aa5ad0879dd4d8209',
field: 'code', field: 'code',
label: '编码', label: '编码',
type: 'input', type: 'input',
component: 'Input', component: 'Input',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
width: '100%', width: '100%',
span: '', span: '',
defaultValue: '', defaultValue: '',
labelWidthMode: 'fix', labelWidthMode: 'fix',
labelFixWidth: 120, labelFixWidth: 120,
responsive: false, responsive: false,
respNewRow: false, respNewRow: false,
placeholder: '请输入编码', placeholder: '请输入编码',
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: false,
allowClear: true, allowClear: true,
showLabel: true, showLabel: true,
required: true, required: true,
rules: [], rules: [],
events: {}, events: {},
isSave: false, isSave: false,
isShow: true, isShow: true,
scan: false, scan: false,
style: { width: '100%' }, style: { width: '100%' }
}, }
},
{
key: '6074c6c1ac8b4f528fa421f8464e6e73',
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: '请输入名称',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: true,
showLabel: true,
required: true,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '477dc52fa33b402f94146203c9ffcdc7',
field: 'localSign',
label: '是否本币',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择是否本币',
sepTextField: '',
showLabel: true,
showSearch: false,
clearable: false,
disabled: false,
mode: '',
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
datasourceType: 'dic',
params: { itemId: '1978056598125330433' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
}, },
dicOptions: [], {
required: true, key: '6074c6c1ac8b4f528fa421f8464e6e73',
rules: [], field: 'fullName',
events: {}, label: '名称',
isShow: true, type: 'input',
itemId: '1978056598125330433', component: 'Input',
style: { width: '100%' }, colProps: { span: 24 },
}, defaultValue: '',
}, componentProps: {
{ width: '100%',
key: '7940a5fbdf024f44b18d063c2023ee46', span: '',
field: 'valid', defaultValue: '',
label: '有效标志', labelWidthMode: 'fix',
type: 'select', labelFixWidth: 120,
component: 'XjrSelect', responsive: false,
colProps: { span: 24 }, respNewRow: false,
componentProps: { placeholder: '请输入名称',
width: '100%', prefix: '',
span: '', suffix: '',
labelWidthMode: 'fix', addonBefore: '',
labelFixWidth: 120, addonAfter: '',
responsive: false, disabled: false,
respNewRow: false, allowClear: true,
placeholder: '请选择有效标志', showLabel: true,
sepTextField: '', required: true,
showLabel: true, rules: [],
showSearch: false, events: {},
clearable: false, isSave: false,
disabled: true, isShow: true,
mode: '', scan: false,
staticOptions: [ style: { width: '100%' }
{ key: 1, label: 'Option 1', value: 'Option 1' }, }
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
}, },
dicOptions: [], {
required: false, key: '477dc52fa33b402f94146203c9ffcdc7',
rules: [], field: 'localSign',
events: {}, label: '是否本币',
isShow: true, type: 'select',
itemId: '1978057078528327681', component: 'XjrSelect',
style: { width: '100%' }, colProps: { span: 24 },
}, componentProps: {
}, width: '100%',
{ span: '',
key: '45d20cfa03a747b2a1e1ebb0cb8198c5', labelWidthMode: 'fix',
field: 'note', labelFixWidth: 120,
label: '备注', responsive: false,
type: 'textarea', respNewRow: false,
component: 'InputTextArea', placeholder: '请选择是否本币',
colProps: { span: 24 }, sepTextField: '',
defaultValue: '', showLabel: true,
componentProps: { showSearch: false,
width: '100%', clearable: false,
span: '', disabled: false,
defaultValue: '', mode: '',
labelWidthMode: 'fix', staticOptions: [
labelFixWidth: 120, { key: 1, label: 'Option 1', value: 'Option 1' },
responsive: false, { key: 2, label: 'Option 2', value: 'Option 2' },
respNewRow: true, { key: 3, label: 'Option 3', value: 'Option 3' }
placeholder: '请输入备注', ],
maxlength: 400, datasourceType: 'dic',
rows: 4, params: { itemId: '1978056598125330433' },
autoSize: false, labelField: 'name',
showCount: true, valueField: 'value',
disabled: false, apiConfig: {
showLabel: true, path: 'CodeGeneration/selection',
allowClear: false, method: 'GET',
required: false, apiId: '93d735dcb7364a0f8102188ec4d77ac7'
isShow: true, },
rules: [], dicOptions: [],
events: {}, required: true,
style: { width: '100%' }, rules: [],
}, events: {},
}, isShow: true,
], itemId: '1978056598125330433',
showActionButtonGroup: false, style: { width: '100%' }
buttonLocation: 'center', }
actionColOptions: { span: 24 }, },
showResetButton: false, {
showSubmitButton: false, key: '7940a5fbdf024f44b18d063c2023ee46',
hiddenComponent: [], field: 'valid',
label: '有效标志',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择有效标志',
sepTextField: '',
showLabel: true,
showSearch: false,
clearable: false,
disabled: true,
defaultSelect: 'Y',
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' }
],
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7'
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
itemId: '1978057078528327681',
style: { width: '100%' }
}
},
{
key: '45d20cfa03a747b2a1e1ebb0cb8198c5',
field: 'note',
label: '备注',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入备注',
maxlength: 400,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
}
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: []
}; };

View File

@ -1,356 +1,365 @@
<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-db-click="dbClickRow" @selection-change="selectionChange">
<template #toolbar>
<template #toolbar> <template v-for="button in tableButtonConfig" :key="button.code">
<template v-for="button in tableButtonConfig" :key="button.code"> <a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)"> <template #icon><Icon :icon="button.icon" /></template>
<template #icon><Icon :icon="button.icon" /></template> {{ button.name }}
{{ button.name }} </a-button>
</a-button> <a-button v-else :type="button.type">
<a-button v-else :type="button.type"> <template #icon><Icon :icon="button.icon" /></template>
<template #icon><Icon :icon="button.icon" /></template> {{ button.name }}
{{ button.name }} </a-button>
</a-button> </template>
</template> </template>
</template> <template #bodyCell="{ column, record }">
<template #bodyCell="{ column, record }"> <template v-if="column.dataIndex === 'action'">
<template v-if="column.dataIndex === 'action'"> <TableAction :actions="getActions(record)" />
<TableAction :actions="getActions(record)" /> </template>
</template> </template>
</template> </BasicTable>
</BasicTable> <CurrencyModal @register="registerModal" @success="handleSuccess" />
<CurrencyModal @register="registerModal" @success="handleSuccess" /> </PageWrapper>
</PageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted, createVNode, import { ref, computed, onMounted, onUnmounted, createVNode } from 'vue';
} from 'vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngBCurrencyPage, deleteLngBCurrency, disableLngBCurrency, enableLngBCurrency } from '/@/api/mdm/Currency';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index';
import { getLngBCurrency } from '/@/api/mdm/Currency';
import { useModal } from '/@/components/Modal';
import CurrencyModal from './components/CurrencyModal.vue';
import { formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { Modal } from 'ant-design-vue'; const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngBCurrencyPage, deleteLngBCurrency} from '/@/api/mdm/Currency';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngBCurrency } from '/@/api/mdm/Currency';
import { useModal } from '/@/components/Modal';
import CurrencyModal from './components/CurrencyModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
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 { 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 filterColumns = cloneDeep(filterColumnAuth(columns)); const tableRef = ref();
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref(); //所有按钮
//所有按钮 const buttons = ref([
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"启用","code":"enable","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"作废","code":"disable","icon":"ant-design:stop-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,"isUse":true}]); { name: '新增', code: 'add', icon: 'ant-design:plus-outlined', isDefault: true, isUse: true },
//展示在列表内的按钮 { name: '编辑', code: 'edit', icon: 'ant-design:form-outlined', isDefault: true, isUse: true },
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']); { name: '启用', code: 'enable', icon: 'ant-design:form-outlined', isDefault: true, isUse: true },
const buttonConfigs = computed(()=>{ { name: '作废', code: 'disable', icon: 'ant-design:stop-outlined', isDefault: true, isUse: true },
return filterButtonAuth(buttons.value); { 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 },
const tableButtonConfig = computed(() => { { name: '删除', code: 'delete', icon: 'ant-design:delete-outlined', isDefault: true, isUse: true }
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code)); ]);
}); //展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit', 'datalog', 'copyData', 'delete', 'startwork', 'flowRecord']);
const actionButtonConfig = computed(() => { const buttonConfigs = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return filterButtonAuth(buttons.value);
});
const btnEvent = {add : handleAdd,edit : handleEdit,enable : handleEnable,disable : handleDisable,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName='币种管理';
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngBCurrencyPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
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/Currency/' + record.id + '/viewForm',
query: {
formPath: 'mdm/Currency',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/Currency/0/createForm',
query: {
formPath: 'mdm/Currency',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/Currency/' + record.id + '/updateForm',
query: {
formPath: 'mdm/Currency',
formName: formName,
formId:currentRoute.value.meta.formId
}
}); });
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function handleEnable() { const tableButtonConfig = computed(() => {
if (!selectedKeys.value.length) { return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
notification.warning({
message: 'Tip',
description: t('请选择需要启用的数据'),
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认启用?',
okText: '确认',
cancelText: '取消',
onOk() {
enableLngBCurrency(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('启用成功!'),
});
});
},
onCancel() {},
});
}
function handleDisable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要禁用的数据'),
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认禁用?',
okText: '确认',
cancelText: '取消',
onOk() {
disableLngBCurrency(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('禁用成功!'),
});
});
},
onCancel() {},
});
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngBCurrency(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
}); });
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload(); const actionButtonConfig = computed(() => {
} return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
function handleView(record: Recordable) { const btnEvent = { add: handleAdd, edit: handleEdit, enable: handleEnable, disable: handleDisable, refresh: handleRefresh, view: handleView, datalog: handleDatalog, delete: handleDelete };
dbClickRow(record); const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId;
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId;
const [registerModal, { openModal }] = useModal();
const formName = '币种管理';
const [registerTable, { reload }] = useTable({
title: '' || formName + '列表',
api: getLngBCurrencyPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
rowSelection: {
type: 'checkbox'
},
striped: false,
actionColumn: {
width: 200,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' }
},
tableSetting: {
size: false,
setting: false
}
});
} // 选中的行ID
onMounted(() => { const selectedKeys = ref([]);
if (schemaIdComputedRef.value) { function dbClickRow(record) {
bus.on(FLOW_PROCESSED, handleRefresh); if (!actionButtonConfig?.value.some((element) => element.code == 'view')) {
bus.on(CREATE_FLOW, handleRefresh); return;
} else { }
bus.on(FORM_LIST_MODIFIED, handleRefresh); const { processId, taskIds, schemaId } = record.workflowData || {};
} if (taskIds && taskIds.length) {
router.push({
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置 path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
mergeCustomListRenderConfig(); query: {
}); taskId: taskIds[0],
onUnmounted(() => { formName: formName,
if (schemaIdComputedRef.value) { formId: currentRoute.value.meta.formId
bus.off(FLOW_PROCESSED, handleRefresh); }
bus.off(CREATE_FLOW, handleRefresh); });
} else { } else if (schemaId && !taskIds && processId) {
bus.off(FORM_LIST_MODIFIED, handleRefresh); router.push({
} path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
}); query: {
function getActions(record: Recordable):ActionItem[] { readonly: 1,
taskId: '',
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => { formName: formName,
if (!record.workflowData?.processId) { formId: currentRoute.value.meta.formId
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 {
return {}; router.push({
path: '/form/Currency/' + record.id + '/viewForm',
query: {
formPath: 'mdm/Currency',
formName: formName,
formId: currentRoute.value.meta.formId
}
});
}
}
function selectionChange(selected) {
selectedKeys.value = selected.keys;
}
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/Currency/0/createForm',
query: {
formPath: 'mdm/Currency',
formName: formName,
formId: currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/Currency/' + record.id + '/updateForm',
query: {
formPath: 'mdm/Currency',
formName: formName,
formId: currentRoute.value.meta.formId
}
});
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function handleEnable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要启用的数据')
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认启用?',
okText: '确认',
cancelText: '取消',
onOk() {
enableLngBCurrency(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('启用成功!')
});
});
},
onCancel() {}
});
}
function handleDisable() {
console.log(selectedKeys.value);
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要禁用的数据')
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认禁用?',
okText: '确认',
cancelText: '取消',
onOk() {
disableLngBCurrency(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('禁用成功!')
});
});
},
onCancel() {}
});
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngBCurrency(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!')
});
});
},
onCancel() {}
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
function handleDatalog() {}
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 {
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;
} }
}
});
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>

View File

@ -2,393 +2,388 @@ import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
export const formConfig = { export const formConfig = {
useCustomConfig: false, useCustomConfig: false
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
field: 'fullName', field: 'fullName',
label: '名称', label: '名称',
component: 'Input', component: 'Input'
},
{
field: 'valid',
label: '有效标志',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
}, },
}, {
field: 'valid',
label: '有效标志',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body
}
}
]; ];
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
dataIndex: 'code', dataIndex: 'code',
title: '编码', title: '编码',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'fullName', dataIndex: 'fullName',
title: '名称', title: '名称',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'freightSign', dataIndex: 'freightSign',
title: '是否承担运费', title: '是否承担运费',
componentType: 'select', componentType: 'select',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'insuranceSign', dataIndex: 'insuranceSign',
title: '是否承担保险', title: '是否承担保险',
componentType: 'select', componentType: 'select',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'valid', dataIndex: 'valid',
title: '有效标志', title: '有效标志',
componentType: 'select', componentType: 'select',
align: 'left', align: 'left',
sorter: true, sorter: true
}, },
{ {
dataIndex: 'note', dataIndex: 'note',
title: '备注', title: '备注',
componentType: 'textarea', componentType: 'textarea',
align: 'left', align: 'left',
sorter: true, sorter: true
}, }
]; ];
//表单事件 //表单事件
export const formEventConfigs = { export const formEventConfigs = {
0: [ 0: [
{ {
type: 'circle', type: 'circle',
color: '#2774ff', color: '#2774ff',
text: '开始节点', text: '开始节点',
icon: '#icon-kaishi', icon: '#icon-kaishi',
bgcColor: '#D8E5FF', bgcColor: '#D8E5FF',
isUserDefined: false, isUserDefined: false
}, },
{ {
color: '#F6AB01', color: '#F6AB01',
icon: '#icon-chushihua', icon: '#icon-chushihua',
text: '初始化表单', text: '初始化表单',
bgcColor: '#f9f5ea', bgcColor: '#f9f5ea',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
1: [ 1: [
{ {
color: '#B36EDB', color: '#B36EDB',
icon: '#icon-shujufenxi', icon: '#icon-shujufenxi',
text: '获取表单数据', text: '获取表单数据',
detail: '(新增无此操作)', detail: '(新增无此操作)',
bgcColor: '#F8F2FC', bgcColor: '#F8F2FC',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
2: [ 2: [
{ {
color: '#F8625C', color: '#F8625C',
icon: '#icon-jiazai', icon: '#icon-jiazai',
text: '加载表单', text: '加载表单',
bgcColor: '#FFF1F1', bgcColor: '#FFF1F1',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
3: [ 3: [
{ {
color: '#6C6AE0', color: '#6C6AE0',
icon: '#icon-jsontijiao', icon: '#icon-jsontijiao',
text: '提交表单', text: '提交表单',
bgcColor: '#F5F4FF', bgcColor: '#F5F4FF',
isUserDefined: false, isUserDefined: false,
nodeInfo: { processEvent: [] }, nodeInfo: { processEvent: [] }
}, }
], ],
4: [ 4: [
{ {
type: 'circle', type: 'circle',
color: '#F8625C', color: '#F8625C',
text: '结束节点', text: '结束节点',
icon: '#icon-jieshuzhiliao', icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6', bgcColor: '#FFD6D6',
isLast: true, isLast: true,
isUserDefined: false, isUserDefined: false
}, }
], ]
}; };
export const formProps: FormProps = { export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 }, labelCol: { span: 3, offset: 0 },
labelAlign: 'right', labelAlign: 'right',
layout: 'horizontal', layout: 'horizontal',
size: 'default', size: 'default',
schemas: [ schemas: [
{ {
key: 'e5b395b24d214214a16951d8df4e2004', key: 'e5b395b24d214214a16951d8df4e2004',
field: 'code', field: 'code',
label: '编码', label: '编码',
type: 'input', type: 'input',
component: 'Input', component: 'Input',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
width: '100%', width: '100%',
span: '', span: '',
defaultValue: '', defaultValue: '',
labelWidthMode: 'fix', labelWidthMode: 'fix',
labelFixWidth: 120, labelFixWidth: 120,
responsive: false, responsive: false,
respNewRow: false, respNewRow: false,
placeholder: '请输入编码', placeholder: '请输入编码',
maxlength: null, prefix: '',
prefix: '', suffix: '',
suffix: '', addonBefore: '',
addonBefore: '', addonAfter: '',
addonAfter: '', disabled: false,
disabled: false, allowClear: false,
allowClear: false, showLabel: true,
showLabel: true, required: true,
required: true, rules: [],
rules: [], events: {},
events: {}, isSave: false,
isSave: false, isShow: true,
isShow: true, scan: false,
scan: false, style: { width: '100%' }
style: { width: '100%' }, }
},
},
{
key: '86536f9d2e8c473b8821c9216c765c9c',
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: true,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '38c7f7488fe24254a1a939fa9b445657',
field: 'freightSign',
label: '是否承担运费',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择是否承担运费',
sepTextField: '',
showLabel: true,
showSearch: false,
clearable: false,
disabled: false,
mode: '',
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: null,
datasourceType: 'dic',
params: { itemId: '1978056598125330433' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
}, },
dicOptions: [], {
required: true, key: '86536f9d2e8c473b8821c9216c765c9c',
rules: [], field: 'fullName',
events: {}, label: '名称',
isShow: true, type: 'input',
itemId: '1978056598125330433', component: 'Input',
style: { width: '100%' }, colProps: { span: 24 },
}, defaultValue: '',
}, componentProps: {
{ width: '100%',
key: '10bfa57236b74a5f9a680e9bc5861d55', span: '',
field: 'insuranceSign', defaultValue: '',
label: '是否承担保险', labelWidthMode: 'fix',
type: 'select', labelFixWidth: 120,
component: 'XjrSelect', responsive: false,
colProps: { span: 24 }, respNewRow: false,
componentProps: { placeholder: '请输入名称',
width: '100%', prefix: '',
span: '', suffix: '',
labelWidthMode: 'fix', addonBefore: '',
labelFixWidth: 120, addonAfter: '',
responsive: false, disabled: false,
respNewRow: false, allowClear: false,
placeholder: '请选择是否承担保险', showLabel: true,
sepTextField: '', required: true,
showLabel: true, rules: [],
showSearch: false, events: {},
clearable: false, isSave: false,
disabled: false, isShow: true,
mode: '', scan: false,
staticOptions: [ style: { width: '100%' }
{ key: 1, label: 'Option 1', value: 'Option 1' }, }
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: null,
datasourceType: 'dic',
params: { itemId: '1978056598125330433' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
}, },
dicOptions: [], {
required: true, key: '38c7f7488fe24254a1a939fa9b445657',
rules: [], field: 'freightSign',
events: {}, label: '是否承担运费',
isShow: true, type: 'select',
itemId: '1978056598125330433', component: 'XjrSelect',
style: { width: '100%' }, colProps: { span: 24 },
}, componentProps: {
}, width: '100%',
{ span: '',
key: 'd1feff0a3b454fa4a29c53355ab6c9cd', labelWidthMode: 'fix',
field: 'valid', labelFixWidth: 120,
label: '有效标志', responsive: false,
type: 'select', respNewRow: false,
component: 'XjrSelect', placeholder: '请选择是否承担运费',
colProps: { span: 24 }, sepTextField: '',
componentProps: { showLabel: true,
width: '100%', showSearch: false,
span: '', clearable: false,
labelWidthMode: 'fix', disabled: false,
labelFixWidth: 120, mode: '',
responsive: false, staticOptions: [
respNewRow: false, { key: 1, label: 'Option 1', value: 'Option 1' },
placeholder: '请选择有效标志', { key: 2, label: 'Option 2', value: 'Option 2' },
sepTextField: '', { key: 3, label: 'Option 3', value: 'Option 3' }
showLabel: true, ],
showSearch: false, datasourceType: 'dic',
clearable: false, params: { itemId: '1978056598125330433' },
disabled: true, labelField: 'name',
mode: 'multiple', valueField: 'value',
staticOptions: [ apiConfig: {
{ key: 1, label: 'Option 1', value: 'Option 1' }, path: 'CodeGeneration/selection',
{ key: 2, label: 'Option 2', value: 'Option 2' }, method: 'GET',
{ key: 3, label: 'Option 3', value: 'Option 3' }, apiId: '93d735dcb7364a0f8102188ec4d77ac7'
], },
defaultSelect: null, dicOptions: [],
datasourceType: 'dic', required: true,
params: { itemId: '1978057078528327681' }, rules: [],
labelField: 'name', events: {},
valueField: 'value', isShow: true,
apiConfig: { itemId: '1978056598125330433',
path: 'CodeGeneration/selection', style: { width: '100%' }
method: 'GET', }
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
}, },
dicOptions: [], {
required: false, key: '10bfa57236b74a5f9a680e9bc5861d55',
rules: [], field: 'insuranceSign',
events: {}, label: '是否承担保险',
isShow: true, type: 'select',
itemId: '1978057078528327681', component: 'XjrSelect',
style: { width: '100%' }, colProps: { span: 24 },
}, componentProps: {
}, width: '100%',
{ span: '',
key: '297be674c3e84930a81ec6d92600e896', labelWidthMode: 'fix',
field: 'note', labelFixWidth: 120,
label: '备注', responsive: false,
type: 'textarea', respNewRow: false,
component: 'InputTextArea', placeholder: '请选择是否承担保险',
colProps: { span: 24 }, sepTextField: '',
defaultValue: '', showLabel: true,
componentProps: { showSearch: false,
width: '100%', clearable: false,
span: '', disabled: false,
defaultValue: '', mode: '',
labelWidthMode: 'fix', staticOptions: [
labelFixWidth: 120, { key: 1, label: 'Option 1', value: 'Option 1' },
responsive: false, { key: 2, label: 'Option 2', value: 'Option 2' },
respNewRow: true, { key: 3, label: 'Option 3', value: 'Option 3' }
placeholder: '请输入备注', ],
maxlength: 400, datasourceType: 'dic',
rows: 4, params: { itemId: '1978056598125330433' },
autoSize: false, labelField: 'name',
showCount: true, valueField: 'value',
disabled: false, apiConfig: {
showLabel: true, path: 'CodeGeneration/selection',
allowClear: false, method: 'GET',
required: false, apiId: '93d735dcb7364a0f8102188ec4d77ac7'
isShow: true, },
rules: [], dicOptions: [],
events: {}, required: true,
style: { width: '100%' }, rules: [],
}, events: {},
}, isShow: true,
], itemId: '1978056598125330433',
showActionButtonGroup: false, style: { width: '100%' }
buttonLocation: 'center', }
actionColOptions: { span: 24 }, },
showResetButton: false, {
showSubmitButton: false, key: 'd1feff0a3b454fa4a29c53355ab6c9cd',
hiddenComponent: [], field: 'valid',
label: '有效标志',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择有效标志',
sepTextField: '',
showLabel: true,
showSearch: false,
clearable: false,
disabled: true,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' }
],
datasourceType: 'dic',
params: { itemId: '1978057078528327681' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7'
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
itemId: '1978057078528327681',
defaultSelect: 'Y',
style: { width: '100%' }
}
},
{
key: '297be674c3e84930a81ec6d92600e896',
field: 'note',
label: '备注',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: true,
placeholder: '请输入备注',
maxlength: 400,
rows: 4,
autoSize: false,
showCount: true,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
rules: [],
events: {},
style: { width: '100%' }
}
}
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: []
}; };

View File

@ -1,356 +1,361 @@
<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-db-click="dbClickRow" @selection-change="selectionChange">
<template #toolbar>
<template #toolbar> <template v-for="button in tableButtonConfig" :key="button.code">
<template v-for="button in tableButtonConfig" :key="button.code"> <a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)"> <template #icon><Icon :icon="button.icon" /></template>
<template #icon><Icon :icon="button.icon" /></template> {{ button.name }}
{{ button.name }} </a-button>
</a-button> <a-button v-else :type="button.type">
<a-button v-else :type="button.type"> <template #icon><Icon :icon="button.icon" /></template>
<template #icon><Icon :icon="button.icon" /></template> {{ button.name }}
{{ button.name }} </a-button>
</a-button> </template>
</template> </template>
</template> <template #bodyCell="{ column, record }">
<template #bodyCell="{ column, record }"> <template v-if="column.dataIndex === 'action'">
<template v-if="column.dataIndex === 'action'"> <TableAction :actions="getActions(record)" />
<TableAction :actions="getActions(record)" /> </template>
</template> </template>
</template> </BasicTable>
</BasicTable> <PriceTermsModal @register="registerModal" @success="handleSuccess" />
<PriceTermsModal @register="registerModal" @success="handleSuccess" /> </PageWrapper>
</PageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted, createVNode, import { ref, computed, onMounted, onUnmounted, createVNode } from 'vue';
} from 'vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngBPriceTermPage, deleteLngBPriceTerm, disableLngBPriceTerm, enableLngBPriceTerm } from '/@/api/mdm/PriceTerms';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index';
import { getLngBPriceTerm } from '/@/api/mdm/PriceTerms';
import { useModal } from '/@/components/Modal';
import PriceTermsModal from './components/PriceTermsModal.vue';
import { formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { Modal } from 'ant-design-vue'; const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngBPriceTermPage, deleteLngBPriceTerm} from '/@/api/mdm/PriceTerms';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngBPriceTerm } from '/@/api/mdm/PriceTerms';
import { useModal } from '/@/components/Modal';
import PriceTermsModal from './components/PriceTermsModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
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 { 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 filterColumns = cloneDeep(filterColumnAuth(columns)); const tableRef = ref();
const customConfigColums =ref(filterColumns); //所有按钮
const customSearchFormSchema =ref(searchFormSchema); const buttons = ref([
{ name: '新增', code: 'add', icon: 'ant-design:plus-outlined', isDefault: true, isUse: true },
const tableRef = ref(); { name: '编辑', code: 'edit', icon: 'ant-design:form-outlined', isDefault: true, isUse: true },
//所有按钮 { name: '启用', code: 'enable', icon: 'ant-design:form-outlined', isDefault: true, isUse: true },
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":"enable","icon":"ant-design:form-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"作废","code":"disable","icon":"ant-design:stop-outlined","isDefault":true,"type":"dashed"},{"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}]); { name: '作废', code: 'disable', icon: 'ant-design:stop-outlined', isDefault: true, isUse: true },
//展示在列表内的按钮 { name: '刷新', code: 'refresh', icon: 'ant-design:reload-outlined', isDefault: true, isUse: true },
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']); { name: '查看', code: 'view', icon: 'ant-design:eye-outlined', isDefault: true, isUse: true },
const buttonConfigs = computed(()=>{ { name: '数据日志', code: 'datalog', icon: 'ant-design:profile-outlined', isDefault: true, isUse: true },
return filterButtonAuth(buttons.value); { name: '删除', code: 'delete', icon: 'ant-design:delete-outlined', isDefault: true, isUse: true }
}) ]);
//展示在列表内的按钮
const tableButtonConfig = computed(() => { const actionButtons = ref<string[]>(['view', 'edit', 'datalog', 'copyData', 'delete', 'startwork', 'flowRecord']);
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code)); const buttonConfigs = computed(() => {
}); return filterButtonAuth(buttons.value);
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,enable : handleEnable,disable : handleDisable,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName='价格条款管理';
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngBPriceTermPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
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/PriceTerms/' + record.id + '/viewForm',
query: {
formPath: 'mdm/PriceTerms',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/PriceTerms/0/createForm',
query: {
formPath: 'mdm/PriceTerms',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/PriceTerms/' + record.id + '/updateForm',
query: {
formPath: 'mdm/PriceTerms',
formName: formName,
formId:currentRoute.value.meta.formId
}
}); });
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function handleEnable() { const tableButtonConfig = computed(() => {
if (!selectedKeys.value.length) { return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
notification.warning({
message: 'Tip',
description: t('请选择需要启用的数据'),
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认启用?',
okText: '确认',
cancelText: '取消',
onOk() {
enableLngBPriceTerm(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('启用成功!'),
});
});
},
onCancel() {},
});
}
function handleDisable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要禁用的数据'),
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认禁用?',
okText: '确认',
cancelText: '取消',
onOk() {
disableLngBPriceTerm(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('禁用成功!'),
});
});
},
onCancel() {},
});
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngBPriceTerm(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
}); });
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload(); const actionButtonConfig = computed(() => {
} return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
function handleView(record: Recordable) { const btnEvent = { add: handleAdd, edit: handleEdit, enable: handleEnable, disable: handleDisable, refresh: handleRefresh, view: handleView, datalog: handleDatalog, delete: handleDelete };
dbClickRow(record); const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId;
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId;
const [registerModal, { openModal }] = useModal();
const formName = '价格条款管理';
const [registerTable, { reload }] = useTable({
title: '' || formName + '列表',
api: getLngBPriceTermPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
rowSelection: {
type: 'checkbox'
},
striped: false,
actionColumn: {
width: 200,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' }
},
tableSetting: {
size: false,
setting: false
}
});
} function dbClickRow(record) {
onMounted(() => { if (!actionButtonConfig?.value.some((element) => element.code == 'view')) {
return;
if (schemaIdComputedRef.value) { }
bus.on(FLOW_PROCESSED, handleRefresh); const { processId, taskIds, schemaId } = record.workflowData || {};
bus.on(CREATE_FLOW, handleRefresh); if (taskIds && taskIds.length) {
} else { router.push({
bus.on(FORM_LIST_MODIFIED, handleRefresh); path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
} query: {
taskId: taskIds[0],
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置 formName: formName,
mergeCustomListRenderConfig(); formId: currentRoute.value.meta.formId
}); }
onUnmounted(() => { });
if (schemaIdComputedRef.value) { } else if (schemaId && !taskIds && processId) {
bus.off(FLOW_PROCESSED, handleRefresh); router.push({
bus.off(CREATE_FLOW, handleRefresh); path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
} else { query: {
bus.off(FORM_LIST_MODIFIED, handleRefresh); readonly: 1,
} taskId: '',
}); formName: formName,
function getActions(record: Recordable):ActionItem[] { formId: currentRoute.value.meta.formId
}
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 {
return {}; router.push({
path: '/form/PriceTerms/' + record.id + '/viewForm',
query: {
formPath: 'mdm/PriceTerms',
formName: formName,
formId: currentRoute.value.meta.formId
}
});
}
}
// 选中的行ID
const selectedKeys = ref([]);
function selectionChange(selected) {
selectedKeys.value = selected.keys;
}
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/PriceTerms/0/createForm',
query: {
formPath: 'mdm/PriceTerms',
formName: formName,
formId: currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/PriceTerms/' + record.id + '/updateForm',
query: {
formPath: 'mdm/PriceTerms',
formName: formName,
formId: currentRoute.value.meta.formId
}
});
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function handleEnable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要启用的数据')
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认启用?',
okText: '确认',
cancelText: '取消',
onOk() {
enableLngBPriceTerm(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('启用成功!')
});
});
},
onCancel() {}
});
}
function handleDisable() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要禁用的数据')
});
return;
}
let ids = selectedKeys.value;
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认禁用?',
okText: '确认',
cancelText: '取消',
onOk() {
disableLngBPriceTerm(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('禁用成功!')
});
});
},
onCancel() {}
});
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngBPriceTerm(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!')
});
});
},
onCancel() {}
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
function handleDatalog() {}
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 {
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;
} }
}
});
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>