正在显示
4 个修改的文件
包含
65 行增加
和
15 行删除
| 1 | -<!-- @author Shiyn/ huangmx 20200807优化--> | ||
| 2 | <template> | 1 | <template> |
| 3 | <div class="top-right-btn"> | 2 | <div class="top-right-btn"> |
| 4 | <el-row> | 3 | <el-row> |
| @@ -8,31 +7,74 @@ | @@ -8,31 +7,74 @@ | ||
| 8 | <el-tooltip class="item" effect="dark" content="刷新" placement="top"> | 7 | <el-tooltip class="item" effect="dark" content="刷新" placement="top"> |
| 9 | <el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" /> | 8 | <el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" /> |
| 10 | </el-tooltip> | 9 | </el-tooltip> |
| 10 | + <el-tooltip class="item" effect="dark" content="显隐列" placement="top" v-if="columns"> | ||
| 11 | + <el-button size="mini" circle icon="el-icon-menu" @click="showColumn()" /> | ||
| 12 | + </el-tooltip> | ||
| 11 | </el-row> | 13 | </el-row> |
| 14 | + <el-dialog :title="title" :visible.sync="open" append-to-body> | ||
| 15 | + <el-transfer | ||
| 16 | + :titles="['显示', '隐藏']" | ||
| 17 | + v-model="value" | ||
| 18 | + :data="columns" | ||
| 19 | + @change="dataChange" | ||
| 20 | + ></el-transfer> | ||
| 21 | + </el-dialog> | ||
| 12 | </div> | 22 | </div> |
| 13 | </template> | 23 | </template> |
| 14 | <script> | 24 | <script> |
| 15 | export default { | 25 | export default { |
| 16 | name: "RightToolbar", | 26 | name: "RightToolbar", |
| 17 | data() { | 27 | data() { |
| 18 | - return {}; | 28 | + return { |
| 29 | + // 显隐数据 | ||
| 30 | + value: [], | ||
| 31 | + // 弹出层标题 | ||
| 32 | + title: "显示/隐藏", | ||
| 33 | + // 是否显示弹出层 | ||
| 34 | + open: false, | ||
| 35 | + }; | ||
| 19 | }, | 36 | }, |
| 20 | props: { | 37 | props: { |
| 21 | showSearch: { | 38 | showSearch: { |
| 22 | type: Boolean, | 39 | type: Boolean, |
| 23 | default: true, | 40 | default: true, |
| 24 | }, | 41 | }, |
| 42 | + columns: { | ||
| 43 | + type: Array, | ||
| 44 | + }, | ||
| 25 | }, | 45 | }, |
| 26 | 46 | ||
| 27 | methods: { | 47 | methods: { |
| 28 | - //搜索 | 48 | + // 搜索 |
| 29 | toggleSearch() { | 49 | toggleSearch() { |
| 30 | this.$emit("update:showSearch", !this.showSearch); | 50 | this.$emit("update:showSearch", !this.showSearch); |
| 31 | }, | 51 | }, |
| 32 | - //刷新 | 52 | + // 刷新 |
| 33 | refresh() { | 53 | refresh() { |
| 34 | this.$emit("queryTable"); | 54 | this.$emit("queryTable"); |
| 35 | }, | 55 | }, |
| 56 | + // 右侧列表元素变化 | ||
| 57 | + dataChange(data) { | ||
| 58 | + for (var item in this.columns) { | ||
| 59 | + const key = this.columns[item].key; | ||
| 60 | + this.columns[item].visible = !data.includes(key); | ||
| 61 | + } | ||
| 62 | + }, | ||
| 63 | + // 打开显隐列dialog | ||
| 64 | + showColumn() { | ||
| 65 | + this.open = true; | ||
| 66 | + }, | ||
| 36 | }, | 67 | }, |
| 37 | }; | 68 | }; |
| 38 | </script> | 69 | </script> |
| 70 | +<style lang="scss" scoped> | ||
| 71 | +::v-deep .el-transfer__button { | ||
| 72 | + border-radius: 50%; | ||
| 73 | + padding: 12px; | ||
| 74 | + display: block; | ||
| 75 | + margin-left: 0px; | ||
| 76 | +} | ||
| 77 | +::v-deep .el-transfer__button:first-child { | ||
| 78 | + margin-bottom: 10px; | ||
| 79 | +} | ||
| 80 | +</style> |
ruoyi-ui/src/layout/components/global.js
已删除
100644 → 0
| @@ -135,17 +135,17 @@ | @@ -135,17 +135,17 @@ | ||
| 135 | v-hasPermi="['system:user:export']" | 135 | v-hasPermi="['system:user:export']" |
| 136 | >导出</el-button> | 136 | >导出</el-button> |
| 137 | </el-col> | 137 | </el-col> |
| 138 | - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | 138 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> |
| 139 | </el-row> | 139 | </el-row> |
| 140 | 140 | ||
| 141 | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> | 141 | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
| 142 | <el-table-column type="selection" width="50" align="center" /> | 142 | <el-table-column type="selection" width="50" align="center" /> |
| 143 | - <el-table-column label="用户编号" align="center" prop="userId" /> | ||
| 144 | - <el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" /> | ||
| 145 | - <el-table-column label="用户昵称" align="center" prop="nickName" :show-overflow-tooltip="true" /> | ||
| 146 | - <el-table-column label="部门" align="center" prop="dept.deptName" :show-overflow-tooltip="true" /> | ||
| 147 | - <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" /> | ||
| 148 | - <el-table-column label="状态" align="center"> | 143 | + <el-table-column label="用户编号" align="center" prop="userId" v-if="columns[0].visible" /> |
| 144 | + <el-table-column label="用户名称" align="center" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> | ||
| 145 | + <el-table-column label="用户昵称" align="center" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> | ||
| 146 | + <el-table-column label="部门" align="center" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> | ||
| 147 | + <el-table-column label="手机号码" align="center" prop="phonenumber" v-if="columns[4].visible" width="120" /> | ||
| 148 | + <el-table-column label="状态" align="center" v-if="columns[5].visible"> | ||
| 149 | <template slot-scope="scope"> | 149 | <template slot-scope="scope"> |
| 150 | <el-switch | 150 | <el-switch |
| 151 | v-model="scope.row.status" | 151 | v-model="scope.row.status" |
| @@ -155,7 +155,7 @@ | @@ -155,7 +155,7 @@ | ||
| 155 | ></el-switch> | 155 | ></el-switch> |
| 156 | </template> | 156 | </template> |
| 157 | </el-table-column> | 157 | </el-table-column> |
| 158 | - <el-table-column label="创建时间" align="center" prop="createTime" width="160"> | 158 | + <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160"> |
| 159 | <template slot-scope="scope"> | 159 | <template slot-scope="scope"> |
| 160 | <span>{{ parseTime(scope.row.createTime) }}</span> | 160 | <span>{{ parseTime(scope.row.createTime) }}</span> |
| 161 | </template> | 161 | </template> |
| @@ -418,6 +418,16 @@ export default { | @@ -418,6 +418,16 @@ export default { | ||
| 418 | status: undefined, | 418 | status: undefined, |
| 419 | deptId: undefined | 419 | deptId: undefined |
| 420 | }, | 420 | }, |
| 421 | + // 列信息 | ||
| 422 | + columns: [ | ||
| 423 | + { key: 0, label: `用户编号`, visible: true }, | ||
| 424 | + { key: 1, label: `用户名称`, visible: true }, | ||
| 425 | + { key: 2, label: `用户昵称`, visible: true }, | ||
| 426 | + { key: 3, label: `部门`, visible: true }, | ||
| 427 | + { key: 4, label: `手机号码`, visible: true }, | ||
| 428 | + { key: 5, label: `状态`, visible: true }, | ||
| 429 | + { key: 6, label: `创建时间`, visible: true } | ||
| 430 | + ], | ||
| 421 | // 表单校验 | 431 | // 表单校验 |
| 422 | rules: { | 432 | rules: { |
| 423 | userName: [ | 433 | userName: [ |
-
请 注册 或 登录 后发表评论