From 397a51bd967a02d4173dd19cb65950697b082651 Mon Sep 17 00:00:00 2001
From: insistence <3055204202@qq.com>
Date: Tue, 26 Aug 2025 15:07:51 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=98=BE=E9=9A=90=E5=88=97=E7=BB=84?=
=?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=81=E5=85=A8=E9=80=89/=E5=85=A8?=
=?UTF-8?q?=E4=B8=8D=E9=80=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/RightToolbar/index.vue | 63 +++++++++++++------
1 file changed, 43 insertions(+), 20 deletions(-)
diff --git a/ruoyi-fastapi-frontend/src/components/RightToolbar/index.vue b/ruoyi-fastapi-frontend/src/components/RightToolbar/index.vue
index 5a53dd4..57377ff 100644
--- a/ruoyi-fastapi-frontend/src/components/RightToolbar/index.vue
+++ b/ruoyi-fastapi-frontend/src/components/RightToolbar/index.vue
@@ -13,9 +13,14 @@
+
+
+ 列展示
+
+
-
+
@@ -39,49 +44,56 @@ const props = defineProps({
/* 是否显示检索条件 */
showSearch: {
type: Boolean,
- default: true,
+ default: true
},
/* 显隐列信息 */
columns: {
- type: Array,
+ type: Array
},
/* 是否显示检索图标 */
search: {
type: Boolean,
- default: true,
+ default: true
},
/* 显隐列类型(transfer穿梭框、checkbox复选框) */
showColumnsType: {
type: String,
- default: "checkbox",
+ default: "checkbox"
},
/* 右外边距 */
gutter: {
type: Number,
- default: 10,
+ default: 10
},
})
-const emits = defineEmits(['update:showSearch', 'queryTable']);
+const emits = defineEmits(['update:showSearch', 'queryTable'])
// 显隐数据
-const value = ref([]);
+const value = ref([])
// 弹出层标题
-const title = ref("显示/隐藏");
+const title = ref("显示/隐藏")
// 是否显示弹出层
-const open = ref(false);
+const open = ref(false)
const style = computed(() => {
- const ret = {};
+ const ret = {}
if (props.gutter) {
- ret.marginRight = `${props.gutter / 2}px`;
+ ret.marginRight = `${props.gutter / 2}px`
}
- return ret;
+ return ret
});
+// 是否全选/半选 状态
+const isChecked = computed({
+ get: () => props.columns.every(col => col.visible),
+ set: () => {}
+})
+const isIndeterminate = computed(() => props.columns.some((col) => col.visible) && !isChecked.value)
+
// 搜索
function toggleSearch() {
- emits("update:showSearch", !props.showSearch);
+ emits("update:showSearch", !props.showSearch)
}
// 刷新
@@ -92,30 +104,35 @@ function refresh() {
// 右侧列表元素变化
function dataChange(data) {
for (let item in props.columns) {
- const key = props.columns[item].key;
- props.columns[item].visible = !data.includes(key);
+ const key = props.columns[item].key
+ props.columns[item].visible = !data.includes(key)
}
}
// 打开显隐列dialog
function showColumn() {
- open.value = true;
+ open.value = true
}
if (props.showColumnsType == 'transfer') {
// 显隐列初始默认隐藏列
for (let item in props.columns) {
if (props.columns[item].visible === false) {
- value.value.push(parseInt(item));
+ value.value.push(parseInt(item))
}
}
}
-// 勾选
+// 单勾选
function checkboxChange(event, label) {
- props.columns.filter(item => item.label == label)[0].visible = event;
+ props.columns.filter(item => item.label == label)[0].visible = event
}
+// 切换全选/反选
+function toggleCheckAll() {
+ const newValue = !isChecked.value
+ props.columns.forEach((col) => (col.visible = newValue))
+}