From 13b76069f6d7e3c1fdf64ffc3f877ae47638571d Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 14 二月 2025 16:38:54 +0800
Subject: [PATCH] 增加是否允许挂起
---
src/components/VisibilityToolbar/index.vue | 53 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/src/components/VisibilityToolbar/index.vue b/src/components/VisibilityToolbar/index.vue
index 7b37a77..d58270f 100644
--- a/src/components/VisibilityToolbar/index.vue
+++ b/src/components/VisibilityToolbar/index.vue
@@ -1,5 +1,5 @@
<template>
- <div class="top-right-btn" :style="style">
+ <div class="top-right-btn">
<el-row>
<el-tooltip v-if="search" class="item" effect="dark" :content="showSearch ? '闅愯棌鎼滅储' : '鏄剧ず鎼滅储'" placement="top">
<el-button size="small" circle icon="el-icon-search" @click="toggleSearch"></el-button>
@@ -12,12 +12,18 @@
</el-tooltip>
</el-row>
- <el-drawer v-model="table" title="淇℃伅鏄鹃殣绛涢��" size="30%" append-to-body>
+ <el-drawer
+ :visible.sync="table"
+ title="淇℃伅鏄鹃殣绛涢��"
+ size="30%"
+ append-to-body
+ :wrapperCLosable="false"
+ :with-header="true">
<div slot="header">
<span>淇℃伅鏄鹃殣绛涢��</span>
</div>
- <div slot="default">
- <el-table :data="pagedColumns" style="width: 100%; height: 80%">
+ <div slot="default" style="margin-left: 20px;margin-top: 20px">
+ <el-table :data="pagedColumns" style="width: 95%; height: 80%;;margin-bottom: 40px;">
<el-table-column prop="index" label="搴忓彿" width="80"></el-table-column>
<el-table-column prop="label" label="鏁版嵁鍚嶇О"></el-table-column>
<el-table-column prop="visible" label="鏄惁鏄剧ず">
@@ -25,7 +31,8 @@
<el-switch
v-model="scope.row.visible"
class="ml-2"
- style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
+ active-color="#13ce66"
+ inactive-color="#ff4949"
@change="switchChange(scope.row)"
></el-switch>
</template>
@@ -36,7 +43,6 @@
</template>
</el-table-column>
</el-table>
-
<el-pagination
v-if="total > pageSize"
:page-size="pageSize"
@@ -46,7 +52,7 @@
@current-change="handlePageChange"
></el-pagination>
</div>
- <div slot="footer">
+ <div style="position: absolute; bottom: 0; left: 0; right: 0; padding: 20px; text-align: right;">
<el-button @click="table = false">鍙� 娑�</el-button>
<el-button type="primary" @click="resetSort">閲� 缃�</el-button>
</div>
@@ -62,6 +68,7 @@
table: false,
currentPage: 1,
columnRef: null,
+ cpList: []
};
},
props: {
@@ -117,7 +124,22 @@
this.currentPage = page;
},
sortChange(row, val) {
- this.$emit('update:sort', { key: row.key, serialNumber: val });
+ // // 鍒涘缓涓�涓柊鐨刢olumns鏁扮粍锛屼互閬垮厤鐩存帴淇敼鍘熷鏁扮粍
+ // this.cpList = this.columns.map(item => ({ ...item })); // 浣跨敤瑙f瀯鏉ュ垱寤哄璞$殑娴呮嫹璐�
+ //
+ // // 鏇存柊鎸囧畾椤圭殑serialNumber
+ // this.cpList.forEach(item => {
+ // if (item.key === row.key) {
+ // item.serialNumber = row.serialNumber;
+ // }
+ // });
+ //
+ // // 鏍规嵁serialNumber瀵筺ewColumns杩涜鎺掑簭
+ // this.cpList = this.cpList.sort((a, b) => a.serialNumber - b.serialNumber);
+ //
+ // // 瑙﹀彂浜嬩欢閫氱煡鐖剁粍浠禼olumns宸叉洿鏂帮紙濡傛灉鐖剁粍浠堕渶瑕佺煡閬撹繖涓彉鍖栵級
+ // this.$emit('update:sort', this.cpList);
+ this.$emit('update:sort', row);
},
resetSort() {
this.$emit('update:resetSort');
@@ -126,10 +148,7 @@
mounted() {
this.columns.forEach((item, index) => {
if (item.visible) {
- // 娉ㄦ剰锛氳繖閲屽亣璁綾olumnRef搴旇鏄竴涓猚heckbox缁勪欢鐨勫紩鐢紝
- // 浣嗗湪Vue 2涓紝鎴戜滑鍙兘闇�瑕佸彟涓�绉嶆柟寮忔潵绠$悊checked鐘舵�侊紝
- // 鍥犱负Vue 2娌℃湁ref鐨勮嚜鍔ㄥ疄渚嬬粦瀹氾紝涓旇繖閲岀殑columnRef閫昏緫浼间箮涓嶅畬鏁存垨閿欒銆�
- // 鍙兘闇�瑕佺Щ闄ゆ垨閲嶅啓杩欓儴鍒嗛�昏緫銆�
+
}
});
},
@@ -157,4 +176,14 @@
.show-btn {
margin-left: 12px;
}
+.drawer-footer {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 20px;
+ background: #fff;
+ border-top: 1px solid #e8e8e8;
+ text-align: right;
+}
</style>
--
Gitblit v1.8.0