Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
绝世唐门三哥
Vue Manage System
提交
2cb246ec
Vue Manage System
项目概览
绝世唐门三哥
/
Vue Manage System
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Vue Manage System
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2cb246ec
编写于
8月 17, 2019
作者:
L
linxin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化表格代码
上级
3dd0b2fd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
56 deletion
+37
-56
src/components/page/BaseTable.vue
src/components/page/BaseTable.vue
+37
-56
未找到文件。
src/components/page/BaseTable.vue
浏览文件 @
2cb246ec
<
template
>
<div
class=
"table"
>
<div>
<div
class=
"crumbs"
>
<el-breadcrumb
separator=
"/"
>
<el-breadcrumb-item>
...
...
@@ -13,14 +13,14 @@
type=
"primary"
icon=
"el-icon-delete"
class=
"handle-del mr10"
@
click=
"delAll"
@
click=
"delAll
Selection
"
>
批量删除
</el-button>
<el-select
v-model=
"select
_c
ate"
placeholder=
"筛选省份"
class=
"handle-select mr10"
>
<el-select
v-model=
"select
C
ate"
placeholder=
"筛选省份"
class=
"handle-select mr10"
>
<el-option
key=
"1"
label=
"广东省"
value=
"广东省"
></el-option>
<el-option
key=
"2"
label=
"湖南省"
value=
"湖南省"
></el-option>
</el-select>
<el-input
v-model=
"select
_w
ord"
placeholder=
"筛选关键词"
class=
"handle-input mr10"
></el-input>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"
s
earch"
>
搜索
</el-button>
<el-input
v-model=
"select
W
ord"
placeholder=
"筛选关键词"
class=
"handle-input mr10"
></el-input>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"
handleS
earch"
>
搜索
</el-button>
</div>
<el-table
:data=
"data"
...
...
@@ -78,7 +78,7 @@
:current-page=
"page.index"
:page-size=
"page.size"
:total=
"page.total"
@
current-change=
"handle
Current
Change"
@
current-change=
"handle
Page
Change"
></el-pagination>
</div>
</div>
...
...
@@ -108,18 +108,17 @@ export default {
data
()
{
return
{
tableData
:
[],
cur_page
:
1
,
multipleSelection
:
[],
select_cate
:
''
,
select
_word
:
''
,
del_list
:
[]
,
delList
:
[]
,
select
Cate
:
''
,
selectWord
:
''
,
editVisible
:
false
,
form
:
{},
page
:
{
index
:
1
,
size
:
10
,
total
:
50
},
form
:
{},
idx
:
-
1
,
id
:
-
1
};
...
...
@@ -131,16 +130,16 @@ export default {
data
()
{
return
this
.
tableData
.
filter
(
d
=>
{
let
is_del
=
false
;
for
(
let
i
=
0
;
i
<
this
.
del
_l
ist
.
length
;
i
++
)
{
if
(
d
.
name
===
this
.
del
_l
ist
[
i
].
name
)
{
for
(
let
i
=
0
;
i
<
this
.
del
L
ist
.
length
;
i
++
)
{
if
(
d
.
name
===
this
.
del
L
ist
[
i
].
name
)
{
is_del
=
true
;
break
;
}
}
if
(
!
is_del
)
{
if
(
d
.
address
.
indexOf
(
this
.
select
_c
ate
)
>
-
1
&&
(
d
.
name
.
indexOf
(
this
.
select
_word
)
>
-
1
||
d
.
address
.
indexOf
(
this
.
select_w
ord
)
>
-
1
)
d
.
address
.
indexOf
(
this
.
select
C
ate
)
>
-
1
&&
(
d
.
name
.
indexOf
(
this
.
select
Word
)
>
-
1
||
d
.
address
.
indexOf
(
this
.
selectW
ord
)
>
-
1
)
)
{
return
d
;
}
...
...
@@ -149,26 +148,17 @@ export default {
}
},
methods
:
{
// 分页导航
handleCurrentChange
(
val
)
{
this
.
cur_page
=
val
;
this
.
getData
();
},
// 获取 easy-mock 的模拟数据
getData
()
{
fetchData
({
page
:
this
.
cur_page
page
:
this
.
page
.
index
}).
then
(
res
=>
{
this
.
tableData
=
res
.
list
;
});
},
search
()
{},
handleEdit
(
index
,
row
)
{
this
.
idx
=
index
;
this
.
id
=
row
.
id
;
this
.
form
=
row
;
this
.
editVisible
=
true
;
},
// 触发搜索按钮
handleSearch
()
{},
// 删除操作
handleDelete
(
index
,
row
)
{
// 二次确认删除
this
.
$confirm
(
'
确定要删除吗?
'
,
'
提示
'
,
{
...
...
@@ -176,46 +166,41 @@ export default {
})
.
then
(()
=>
{
this
.
$message
.
success
(
'
删除成功
'
);
if
(
this
.
tableData
[
index
].
id
===
row
.
id
)
{
this
.
tableData
.
splice
(
index
,
1
);
}
else
{
for
(
let
i
=
0
;
i
<
this
.
tableData
.
length
;
i
++
)
{
if
(
this
.
tableData
[
i
].
id
===
row
.
id
)
{
this
.
tableData
.
splice
(
i
,
1
);
return
;
}
}
}
this
.
tableData
.
splice
(
index
,
1
);
})
.
catch
(()
=>
{});
},
delAll
()
{
// 多选操作
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
},
delAllSelection
()
{
const
length
=
this
.
multipleSelection
.
length
;
let
str
=
''
;
this
.
del
_list
=
this
.
del_l
ist
.
concat
(
this
.
multipleSelection
);
this
.
del
List
=
this
.
delL
ist
.
concat
(
this
.
multipleSelection
);
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
str
+=
this
.
multipleSelection
[
i
].
name
+
'
'
;
}
this
.
$message
.
error
(
`删除了
${
str
}
`
);
this
.
multipleSelection
=
[];
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
// 编辑操作
handleEdit
(
index
,
row
)
{
this
.
idx
=
index
;
this
.
id
=
row
.
id
;
this
.
form
=
row
;
this
.
editVisible
=
true
;
},
// 保存编辑
saveEdit
()
{
this
.
editVisible
=
false
;
this
.
$message
.
success
(
`修改第
${
this
.
idx
+
1
}
行成功`
);
if
(
this
.
tableData
[
this
.
idx
].
id
===
this
.
id
)
{
this
.
$set
(
this
.
tableData
,
this
.
idx
,
this
.
form
);
}
else
{
for
(
let
i
=
0
;
i
<
this
.
tableData
.
length
;
i
++
)
{
if
(
this
.
tableData
[
i
].
id
===
this
.
id
)
{
this
.
$set
(
this
.
tableData
,
i
,
this
.
form
);
return
;
}
}
}
this
.
$set
(
this
.
tableData
,
this
.
idx
,
this
.
form
);
},
// 分页导航
handlePageChange
(
val
)
{
this
.
page
.
index
=
val
;
this
.
getData
();
}
}
};
...
...
@@ -234,10 +219,6 @@ export default {
width
:
300px
;
display
:
inline-block
;
}
.del-dialog-cnt
{
font-size
:
16px
;
text-align
:
center
;
}
.table
{
width
:
100%
;
font-size
:
14px
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录