提交 a8a46e49 authored 作者: lidongxu's avatar lidongxu

refactor(user.js): 重构-用户管理页面

同上
上级 c63df3f7
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
@pagination="getPageList" /> @pagination="getPageList" />
<!-- 折叠分类侧边栏 --> <!-- 折叠分类侧边栏 -->
<div class="arrow" <div class="arrow"
@click="hideSideBar = true"> @click="handleClick">
<svg-icon icon-class="left-arrow" /> <svg-icon icon-class="left-arrow" />
</div> </div>
</div> </div>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<!-- 展开分类侧边栏 --> <!-- 展开分类侧边栏 -->
<div class="arrow" <div class="arrow"
v-show="hideSideBar" v-show="hideSideBar"
@click="hideSideBar = !hideSideBar"> @click="handleClick">
<svg-icon icon-class="right-arrow" /> <svg-icon icon-class="right-arrow" />
</div> </div>
</el-col> </el-col>
...@@ -150,7 +150,7 @@ watch(searchValue, (val) => { ...@@ -150,7 +150,7 @@ watch(searchValue, (val) => {
} else { } else {
// 有分页,走外面接口搜索 // 有分页,走外面接口搜索
queryParams.searchKey = val queryParams.searchKey = val
emits('search', queryParams) // emits('search', queryParams)
} }
}) })
...@@ -167,11 +167,12 @@ watch(() => props.modelValue, (val) => { ...@@ -167,11 +167,12 @@ watch(() => props.modelValue, (val) => {
// 点击空白位置-取消选中效果 // 点击空白位置-取消选中效果
const cancelSel = () => { const cancelSel = () => {
// 刚才有过点击的某行 // 刚才有过点击的某行
console.log(666, lastRow.value)
if (lastRow.value) { if (lastRow.value) {
treeRef.value.setCurrentKey(null) treeRef.value.setCurrentKey(null)
lastRow.value = null lastRow.value = null
emits('update:modelValue', '') emits('update:modelValue', '')
emits('search') emits('search', null)
} }
} }
...@@ -181,11 +182,13 @@ const handleNodeClick = (row) => { ...@@ -181,11 +182,13 @@ const handleNodeClick = (row) => {
if (lastRowId.value === row[props.nodeKey]) { if (lastRowId.value === row[props.nodeKey]) {
treeRef.value.setCurrentKey(null) treeRef.value.setCurrentKey(null)
lastRowId.value = null lastRowId.value = null
lastRow.value = null
} else { } else {
lastRowId.value = row[props.nodeKey] lastRowId.value = row[props.nodeKey]
lastRow.value = row
} }
emits('update:modelValue', lastRowId.value ? row[props.nodeKey] : '') emits('update:modelValue', lastRowId.value ? row[props.nodeKey] : '')
emits('search') emits('search', row)
} }
// tree 筛选节点 // tree 筛选节点
...@@ -198,6 +201,10 @@ const filterNode = (value, data) => { ...@@ -198,6 +201,10 @@ const filterNode = (value, data) => {
const getPageList = () => { const getPageList = () => {
emits('pageChange', queryParams) emits('pageChange', queryParams)
} }
const handleClick = () => {
hideSideBar.value =!hideSideBar.value
}
</script> </script>
<style scoped <style scoped
......
<template>
<div class="wrap">
<el-tooltip v-if="show"
v-bind="$attrs">
<slot></slot>
</el-tooltip>
<div @mouseenter="show = true"
@mouseleave="show = false"
v-else>
<slot></slot>
</div>
</div>
</template>
<script>
export default {
name: 'MouseToolTip',
data() {
return {
show: false
}
}
}
</script>
<style scoped lang="scss">
.wrap{
display: inline-block;
}
</style>
\ No newline at end of file
...@@ -48,6 +48,8 @@ import NoData from '@/components/NoData' ...@@ -48,6 +48,8 @@ import NoData from '@/components/NoData'
import CategoryTree from '@/components/CategoryTree' import CategoryTree from '@/components/CategoryTree'
// 返回头部 // 返回头部
import BackToUp from '@/components/BackToUp' import BackToUp from '@/components/BackToUp'
// 自定义 toolTip
import CustomToolTip from '@/components/ToolTip'
const app = createApp(App) const app = createApp(App)
...@@ -76,6 +78,7 @@ app.component('GroupLegend', GroupLegend) ...@@ -76,6 +78,7 @@ app.component('GroupLegend', GroupLegend)
app.component('NoData', NoData) app.component('NoData', NoData)
app.component('CategoryTree', CategoryTree) app.component('CategoryTree', CategoryTree)
app.component('BackToUp', BackToUp) app.component('BackToUp', BackToUp)
app.component('CustomToolTip', CustomToolTip)
// 全局插件 // 全局插件
app.use(plugins) app.use(plugins)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论