v3.7.2 版本代码合并

This commit is contained in:
JEECG
2024-12-09 15:10:46 +08:00
parent 64b29f47e0
commit b0c4194602
118 changed files with 12729 additions and 1596 deletions

View File

@ -94,4 +94,15 @@ export function definedComponent() {
// addComponent(JVxeTypes.userSelect, JVxeUserSelectCell)
}
/**
* 清空注册的组件
*/
export function clearComponent() {
componentMap.clear();
// update-begin--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
import.meta.env.DEV && (window[JVxeComponents] = componentMap);
// update-end--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
}
export { componentMap };

View File

@ -5,15 +5,17 @@
<template #buttons>
<div :class="`${prefixCls}-button div`" :size="btnSize">
<slot v-if="showPrefix" name="toolbarPrefix" :size="btnSize" />
<a-button v-if="showAdd" type="primary" preIcon="ant-design:plus-outlined" :disabled="disabled" :loading="deleting" @click="trigger('add')">
<span>新增</span>
<a-button v-if="addBtnCfg.enabled && showAdd" type="primary" :preIcon="addBtnCfg.buttonIcon" :disabled="disabled" :loading="deleting" @click="trigger('add')">
<span>{{ addBtnCfg.buttonName }}</span>
</a-button>
<a-button v-if="showSave" preIcon="ant-design:save-outlined" :disabled="disabled" @click="trigger('save')">
<span>保存</span>
</a-button>
<template v-if="deleting || selectedRowIds.length > 0">
<Popconfirm v-if="showRemove" :title="`确定要删除这 ${selectedRowIds.length} 项吗?`" :disabled="deleting" @confirm="onRemove">
<a-button preIcon="ant-design:minus-outlined" :disabled="disabled" :loading="deleting">删除</a-button>
<Popconfirm v-if="removeBtnCfg.enabled && showRemove" :title="`确定要删除这 ${selectedRowIds.length} 项吗?`" :disabled="deleting" @confirm="onRemove">
<a-button :preIcon="removeBtnCfg.buttonIcon" :disabled="disabled" :loading="deleting">
<span>{{ removeBtnCfg.buttonName }}</span>
</a-button>
</Popconfirm>
<template v-if="showClearSelection">
<a-button preIcon="ant-design:delete-outlined" @click="trigger('clearSelection')">清空选择</a-button>
@ -46,6 +48,16 @@
disabledRows: propTypes.object,
hasBtnAuth: propTypes.func,
selectedRowIds: propTypes.array.def(() => []),
addBtnCfg: propTypes.object.def(() => ({
enabled: true,
buttonIcon: 'ant-design:plus-outlined',
buttonName: '新增',
})),
removeBtnCfg: propTypes.object.def(() => ({
enabled: true,
buttonIcon: 'ant-design:minus-outlined',
buttonName: '删除',
})),
});
const emit = defineEmits(['save', 'add', 'remove', 'clearSelection', 'register']);
const xToolbarRef = ref({} as VxeToolbarInstance);

View File

@ -10,8 +10,10 @@
<a-menu>
<a-menu-item key="0" :disabled="disabledMoveUp" @click="handleRowMoveUp">向上移</a-menu-item>
<a-menu-item key="1" :disabled="disabledMoveDown" @click="handleRowMoveDown">向下移</a-menu-item>
<a-menu-divider />
<a-menu-item key="3" @click="handleRowInsertDown">插入一行</a-menu-item>
<template v-if="allowInsertRow">
<a-menu-divider />
<a-menu-item key="3" @click="handleRowInsertDown">插入一行</a-menu-item>
</template>
</a-menu>
</template>
</a-dropdown>
@ -48,6 +50,9 @@
const disabledMoveUp = computed(() => rowIndex.value === 0);
const disabledMoveDown = computed(() => rowIndex.value === fullDataLength.value - 1);
// 是否允许插入行
const allowInsertRow = computed(() => originColumn.value.insertRow);
/** 向上移 */
function handleRowMoveUp() {
if (!disabledMoveUp.value) {
@ -79,7 +84,8 @@
handleRowMoveUp,
handleRowMoveDown,
handleRowInsertDown,
isAllowDrag
isAllowDrag,
allowInsertRow,
};
},
// 【组件增强】注释详见JVxeComponent.Enhanced

View File

@ -30,7 +30,8 @@ export function useColumns(props: JVxeTableProps, data: JVxeDataProps, methods:
// handle 方法参数
const args: HandleArgs = { props, slots, data, methods, columns };
let seqColumn, selectionColumn, expandColumn, dragSortColumn;
props.columns.forEach((column: JVxeColumn) => {
const handleColumn = (column: JVxeColumn, container: JVxeColumn[]) => {
// 排除未授权的列 1 = 显示/隐藏; 2 = 禁用
let auth = methods.getColAuth(column.key);
if (auth?.type == '1' && !auth.isAuth) {
@ -47,6 +48,15 @@ export function useColumns(props: JVxeTableProps, data: JVxeDataProps, methods:
if (col.type === JVxeTypes.hidden) {
return handleInnerColumn(args, col, handleHiddenColumn);
}
// 处理子级列
// 判断是否是分组列,如果当前是父级,则无需处理 render
if (Array.isArray(col.children) && col.children.length > 0) {
const children: JVxeColumn[] = [];
col.children.forEach((child: JVxeColumn) => handleColumn(child, children));
col.children = children;
container.push(col);
return;
}
// 组件未注册,自动设置为 normal
if (!isRegistered(col.type)) {
col.type = JVxeTypes.normal;
@ -72,21 +82,25 @@ export function useColumns(props: JVxeTableProps, data: JVxeDataProps, methods:
};
if (col.type === JVxeTypes.rowNumber) {
seqColumn = col;
columns.push(col);
container.push(col);
} else if (col.type === JVxeTypes.rowRadio || col.type === JVxeTypes.rowCheckbox) {
selectionColumn = col;
columns.push(col);
container.push(col);
} else if (col.type === JVxeTypes.rowExpand) {
expandColumn = col;
columns.push(col);
container.push(col);
} else if (col.type === JVxeTypes.rowDragSort) {
dragSortColumn = col;
columns.push(col);
container.push(col);
} else {
col.params = column;
args.columns = container;
handlerCol(args);
}
});
}
props.columns.forEach((column: JVxeColumn) => handleColumn(column, columns));
handleInnerColumn(args, seqColumn, handleSeqColumn);
handleInnerColumn(args, selectionColumn, handleSelectionColumn);
handleInnerColumn(args, expandColumn, handleExpandColumn);
@ -250,6 +264,7 @@ function handleDragSortColumn({ props, data, col, columns, renderOptions }: Hand
align: 'center',
// update-begin--author:liaozhiyang---date:20240417---for:【QQYUN-8785】online表单列位置的id未做限制拖动其他列到id列上面同步数据库时报错
params: {
insertRow: props.insertRow,
notAllowDrag: props.notAllowDrag,
...col?.params,
},

View File

@ -16,6 +16,8 @@ export function useToolbar(props: JVxeTableProps, data: JVxeDataProps, methods:
hasBtnAuth: methods.hasBtnAuth,
selectedRowIds: data.selectedRowIds.value,
custom: props.custom,
addBtnCfg: props.addBtnCfg,
removeBtnCfg: props.removeBtnCfg,
// 新增事件
onAdd: () => {
// update-begin--author:liaozhiyang---date:20240521---for【TV360X-212】online新增字段就出校验提示

View File

@ -1,13 +1,12 @@
/* JVxeTable 行编辑 权限 */
import { usePermissionStoreWithOut } from '/@/store/modules/permission';
const permissionStore = usePermissionStoreWithOut();
/**
* JVxe 专用,获取权限
* @param prefix
*/
export function getJVxeAuths(prefix) {
const permissionStore = usePermissionStoreWithOut();
prefix = getPrefix(prefix);
let { authList, allAuthList } = permissionStore;
let authsMap = new Map<string, typeof allAuthList[0]>();

View File

@ -42,6 +42,8 @@ export const vxeProps = () => ({
rowExpand: propTypes.bool.def(false),
// 展开行配置
expandConfig: propTypes.object.def(() => ({})),
// 是否可插入行
insertRow: propTypes.bool.def(true),
// 页面是否在加载中
loading: propTypes.bool.def(false),
// 表格高度
@ -113,6 +115,11 @@ export const vxeProps = () => ({
// 不允许拖拽的行 [{'key':field,'value':value}]
notAllowDrag: propTypes.array.def(() => []),
// update-end--author:liaozhiyang---date:20240417---for:【QQYUN-8785】online表单列位置的id未做限制拖动其他列到id列上面同步数据库时报错
// 新增按钮配置
addBtnCfg: propTypes.object,
// 删除按钮配置
removeBtnCfg: propTypes.object,
});
export const vxeEmits = ['save', 'added', 'removed', 'inserted', 'dragged', 'selectRowChange', 'pageChange', 'valueChange', 'blur'];