fix: 0.1.1 修正问题如下:
1. 修正了部分开发页面以及开源时的展示问题。 2. 修正了成品入库单模块出货功能行选择框缓存没清除的问题。 3. 修正了角色管理级联选中问题。 4. 修正了表格行按钮的宽度不够展示不全的问题。 5. 对 Excel 解析进行了兼容。
This commit is contained in:
@@ -8,6 +8,9 @@ import { get } from "@/common/http/request";
|
||||
interface Emits {
|
||||
(e: "data-loaded", data: any[]): void;
|
||||
(e: "expand-change", row: any, expandedRows: any[]): void;
|
||||
(e: "select", selection: any[], row: any): void;
|
||||
(e: "select-all", selection: any[]): void;
|
||||
(e: "selection-change", selection: any[]): void;
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
@@ -18,6 +21,16 @@ const props = defineProps({
|
||||
parse: Function,
|
||||
expandRowKeys: Array as PropType<(string | number)[]>,
|
||||
rowKey: { type: String, default: "id" },
|
||||
// 树形数据配置
|
||||
treeProps: {
|
||||
type: Object as PropType<{ children: string; hasChildren?: string }>,
|
||||
default: () => ({ children: "children" }),
|
||||
},
|
||||
// 是否显示为树形表格
|
||||
isTreeTable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits<Emits>();
|
||||
const tableMainRef = ref<InstanceType<typeof TableMain> | null>(null);
|
||||
@@ -67,6 +80,18 @@ const handleExpandChange = (row: any, expandedRows: any[]) => {
|
||||
emit("expand-change", row, expandedRows);
|
||||
};
|
||||
|
||||
const handleSelect = (selection: any[], row: any) => {
|
||||
emit("select", selection, row);
|
||||
};
|
||||
|
||||
const handleSelectAll = (selection: any[]) => {
|
||||
emit("select-all", selection);
|
||||
};
|
||||
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
emit("selection-change", selection);
|
||||
};
|
||||
|
||||
const recomputeTableHeight = () => {
|
||||
if (!tableMainHostEl.value) return;
|
||||
const top = tableMainHostEl.value.getBoundingClientRect().top;
|
||||
@@ -85,6 +110,11 @@ defineExpose({
|
||||
sort: (field: string, order: string) => {
|
||||
tableMainRef.value?.tableRef?.sort(field, order);
|
||||
},
|
||||
toggleRowSelection: (row: any, selected?: boolean) => {
|
||||
tableMainRef.value?.toggleRowSelection(row, selected);
|
||||
},
|
||||
getSelectionRows: () => tableMainRef.value?.getSelectionRows() || [],
|
||||
clearSelection: () => tableMainRef.value?.tableRef?.clearSelection(),
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -135,7 +165,12 @@ onMounted(async () => {
|
||||
v-model:page-size="pageSize"
|
||||
:expand-row-keys="expandRowKeys"
|
||||
:row-key="rowKey"
|
||||
:tree-props="treeProps"
|
||||
:is-tree-table="isTreeTable"
|
||||
@expand-change="handleExpandChange"
|
||||
@select="handleSelect"
|
||||
@select-all="handleSelectAll"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #columns><slot name="columns"></slot></template>
|
||||
</TableMain>
|
||||
|
||||
@@ -94,6 +94,8 @@ watch(
|
||||
if (!val) {
|
||||
// 关闭时清空选中
|
||||
selectedRows.value = [];
|
||||
// 清空表格内部的选择状态,避免下次打开时残留
|
||||
tableRef.value?.clearSelection();
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -129,7 +131,7 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog v-model="visible" :title="title" :close-on-click-modal="false" width="80%">
|
||||
<el-dialog v-model="visible" :title="title" :close-on-click-modal="false" :lock-scroll="false" width="80%">
|
||||
<!-- 1. 顶部筛选区域 (Slot) -->
|
||||
<div class="dialog-filter-area">
|
||||
<slot name="filter" :refresh="() => emit('filter-refresh')" :selected-rows="selectedRows">
|
||||
@@ -151,7 +153,7 @@ defineExpose({
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 勾选列 -->
|
||||
<el-table-column type="selection" width="55" :reserve-selection="true" v-if="selectable" />
|
||||
<el-table-column type="selection" width="55" v-if="selectable" />
|
||||
|
||||
<!-- 父组件自定义列 -->
|
||||
<slot name="table-columns"></slot>
|
||||
@@ -253,6 +255,11 @@ defineExpose({
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
:deep(.el-dialog__body) {
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
:deep(.el-dialog__header) {
|
||||
padding: 16px 20px;
|
||||
margin-right: 0;
|
||||
|
||||
@@ -9,6 +9,8 @@ const props = defineProps({
|
||||
param: URLSearchParams,
|
||||
selectUrl: String,
|
||||
showCheckbox: { default: false },
|
||||
// 是否启用级联选择:勾选父节点自动勾选子节点,部分勾选子节点时父节点显示半选状态
|
||||
cascade: { type: Boolean, default: false },
|
||||
});
|
||||
const treeCheck = defineModel<number[]>();
|
||||
const treeSelect = defineModel("current-node");
|
||||
@@ -79,7 +81,7 @@ defineExpose({
|
||||
highlight-current
|
||||
:show-checkbox="showCheckbox"
|
||||
:default-checked-keys="treeCheck"
|
||||
check-strictly
|
||||
:check-strictly="!cascade"
|
||||
@check="checkHandle"
|
||||
@node-click="clickHandle"
|
||||
/>
|
||||
|
||||
@@ -57,7 +57,7 @@ const authShowFunc = (row: any, button: globalThis.ButtonProp) => {
|
||||
<style scoped>
|
||||
.operate-buttons {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
Reference in New Issue
Block a user