Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
绝世唐门三哥
Vue Manage System
提交
5ac78cfd
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,发现更多精彩内容 >>
未验证
提交
5ac78cfd
编写于
6月 13, 2019
作者:
林
林鑫
提交者:
GitHub
6月 13, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #178 from lin-xin/dev
修复表格顺序改变后误删其他数据
上级
dc340587
ce21d137
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
74 addition
and
43 deletion
+74
-43
public/vuetable.json
public/vuetable.json
+46
-36
src/components/page/BaseTable.vue
src/components/page/BaseTable.vue
+28
-7
未找到文件。
public/vuetable.json
浏览文件 @
5ac78cfd
{
{
"list"
:
[{
"list"
:
[{
"date"
:
"1997-11-11"
,
"id"
:
1
,
"name"
:
"林丽"
,
"date"
:
"2013-05-04"
,
"address"
:
"吉林省 辽源市 龙山区"
"name"
:
"邱秀兰"
,
},
{
"address"
:
"浙江省 金华市 兰溪市"
"date"
:
"1987-09-24"
,
},
{
"name"
:
"文敏"
,
"id"
:
2
,
"address"
:
"江西省 萍乡市 芦溪县"
"date"
:
"1991-05-02"
,
},
{
"name"
:
"蒋军"
,
"date"
:
"1996-08-08"
,
"address"
:
"广东省 东莞市 长安镇"
"name"
:
"杨秀兰"
,
},
{
"address"
:
"黑龙江省 黑河市 五大连池市"
"id"
:
3
,
},
{
"date"
:
"2009-12-01"
,
"date"
:
"1978-06-18"
,
"name"
:
"廖艳"
,
"name"
:
"魏强"
,
"address"
:
"陕西省 渭南市 富平县"
"address"
:
"广东省 韶关市 始兴县"
},
{
},
{
"id"
:
4
,
"date"
:
"1977-07-09"
,
"date"
:
"1999-07-15"
,
"name"
:
"石秀兰"
,
"name"
:
"秦强"
,
"address"
:
"江苏省 宿迁市 宿豫区"
"address"
:
"内蒙古自治区 巴彦淖尔市 磴口县"
},
{
},
{
"date"
:
"1994-09-20"
,
"id"
:
5
,
"name"
:
"朱洋"
,
"date"
:
"1997-02-09"
,
"address"
:
"海外 海外 -"
"name"
:
"唐洋"
,
},
{
"address"
:
"湖南省 长沙市 "
"date"
:
"1980-01-22"
,
},
{
"name"
:
"傅敏"
,
"id"
:
6
,
"date"
:
"2018-05-23"
,
"name"
:
"易勇"
,
"address"
:
"重庆 重庆市 双桥区"
},
{
"id"
:
7
,
"date"
:
"2014-04-09"
,
"name"
:
"袁丽"
,
"address"
:
"陕西省 铜川市 耀州区"
},
{
"id"
:
8
,
"date"
:
"2013-08-05"
,
"name"
:
"常刚"
,
"address"
:
"海外 海外 -"
"address"
:
"海外 海外 -"
},
{
},
{
"date"
:
"1985-10-10"
,
"id"
:
9
,
"name"
:
"毛明"
,
"date"
:
"1995-12-13"
,
"address"
:
"内蒙古自治区 包头市 九原区"
"name"
:
"龚勇"
,
"address"
:
"黑龙江省 牡丹江市 西安区"
},
{
},
{
"date"
:
"1975-09-08"
,
"id"
:
10
,
"name"
:
"何静"
,
"date"
:
"2017-06-06"
,
"address"
:
"西藏自治区 阿里地区 普兰县"
"name"
:
"魏强"
,
},
{
"address"
:
"安徽省 六安市 裕安区"
"date"
:
"1970-06-07"
,
"name"
:
"郭秀英"
,
"address"
:
"四川省 巴中市 恩阳区"
}]
}]
}
}
\ No newline at end of file
src/components/page/BaseTable.vue
浏览文件 @
5ac78cfd
...
@@ -87,7 +87,8 @@
...
@@ -87,7 +87,8 @@
date
:
''
,
date
:
''
,
address
:
''
address
:
''
},
},
idx
:
-
1
idx
:
-
1
,
id
:
-
1
}
}
},
},
created
()
{
created
()
{
...
@@ -143,16 +144,18 @@
...
@@ -143,16 +144,18 @@
},
},
handleEdit
(
index
,
row
)
{
handleEdit
(
index
,
row
)
{
this
.
idx
=
index
;
this
.
idx
=
index
;
const
item
=
this
.
tableData
[
index
]
;
this
.
id
=
row
.
id
;
this
.
form
=
{
this
.
form
=
{
name
:
item
.
name
,
id
:
row
.
id
,
date
:
item
.
date
,
name
:
row
.
name
,
address
:
item
.
address
date
:
row
.
date
,
address
:
row
.
address
}
}
this
.
editVisible
=
true
;
this
.
editVisible
=
true
;
},
},
handleDelete
(
index
,
row
)
{
handleDelete
(
index
,
row
)
{
this
.
idx
=
index
;
this
.
idx
=
index
;
this
.
id
=
row
.
id
;
this
.
delVisible
=
true
;
this
.
delVisible
=
true
;
},
},
delAll
()
{
delAll
()
{
...
@@ -170,15 +173,33 @@
...
@@ -170,15 +173,33 @@
},
},
// 保存编辑
// 保存编辑
saveEdit
()
{
saveEdit
()
{
this
.
$set
(
this
.
tableData
,
this
.
idx
,
this
.
form
);
this
.
editVisible
=
false
;
this
.
editVisible
=
false
;
this
.
$message
.
success
(
`修改第
${
this
.
idx
+
1
}
行成功`
);
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
;
}
}
}
},
},
// 确定删除
// 确定删除
deleteRow
(){
deleteRow
(){
this
.
tableData
.
splice
(
this
.
idx
,
1
);
this
.
$message
.
success
(
'
删除成功
'
);
this
.
$message
.
success
(
'
删除成功
'
);
this
.
delVisible
=
false
;
this
.
delVisible
=
false
;
if
(
this
.
tableData
[
this
.
idx
].
id
===
this
.
id
){
this
.
tableData
.
splice
(
this
.
idx
,
1
);
}
else
{
for
(
let
i
=
0
;
i
<
this
.
tableData
.
length
;
i
++
){
if
(
this
.
tableData
[
i
].
id
===
this
.
id
){
this
.
tableData
.
splice
(
i
,
1
);
return
;
}
}
}
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录