|
@@ -4,7 +4,6 @@
|
|
|
<el-col :span="24" class="btn">
|
|
|
<el-col :span="20"><h3>账号注册</h3></el-col>
|
|
|
<el-col :span="4"><el-button type="success" icon="el-icon-plus">添加</el-button></el-col>
|
|
|
- <el-col></el-col>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="search">
|
|
|
<el-col :span="3" class="searchSel">
|
|
@@ -25,8 +24,13 @@
|
|
|
:load="load"
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
>
|
|
|
- <el-table-column prop="date" label="日期" width="180"> </el-table-column>
|
|
|
- <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
|
|
|
+ <el-table-column label="姓名" width="180">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <tag type="success" v-if="scope.row.hasChildren">{{ scope.row.zhu }}</tag>
|
|
|
+ <tag type="warning">{{ scope.row.cong }}</tag>
|
|
|
+ <tag>{{ scope.row.name }} </tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="address" label="地址"> </el-table-column>
|
|
|
<el-table-column prop="state" label="状态">
|
|
|
<template v-slot="scope">
|
|
@@ -34,9 +38,10 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
+ <template v-slot="scope">
|
|
|
<el-button size="mini" @click="openDialog(scope.$index)">修改</el-button>
|
|
|
- <el-button size="mini" type="danger" @click="open">注销</el-button>
|
|
|
+ <el-button v-if="scope.row.state == 1" size="mini" type="danger" @click="open1(scope.$index)">注销</el-button>
|
|
|
+ <el-button v-if="scope.row.state == 0" type="success" size="mini" @click="open2(scope.$index)">恢复</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -96,39 +101,38 @@ export default {
|
|
|
tableData: [
|
|
|
{
|
|
|
id: 1,
|
|
|
- date: '2016-05-02',
|
|
|
name: '王小虎',
|
|
|
address: '上海市普陀区金沙江路 1518 弄',
|
|
|
state: '0',
|
|
|
+ zhu: '主',
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
- date: '2016-05-04',
|
|
|
name: '王小虎',
|
|
|
address: '上海市普陀区金沙江路 1517 弄',
|
|
|
state: '1',
|
|
|
+ zhu: '主',
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
- date: '2016-05-01',
|
|
|
name: '王小虎',
|
|
|
address: '上海市普陀区金沙江路 1519 弄',
|
|
|
state: '0',
|
|
|
+ zhu: '主',
|
|
|
hasChildren: true,
|
|
|
},
|
|
|
{
|
|
|
id: 4,
|
|
|
- date: '2016-05-03',
|
|
|
name: '王小虎',
|
|
|
address: '上海市普陀区金沙江路 1516 弄',
|
|
|
state: '0',
|
|
|
+ zhu: '主',
|
|
|
},
|
|
|
],
|
|
|
editForm: {
|
|
|
date: '',
|
|
|
name: '',
|
|
|
address: '',
|
|
|
- state: '',
|
|
|
},
|
|
|
editFormVisible: false,
|
|
|
}),
|
|
@@ -140,31 +144,33 @@ export default {
|
|
|
resolve([
|
|
|
{
|
|
|
id: 31,
|
|
|
- date: '2016-05-01',
|
|
|
name: '王小虎',
|
|
|
address: '上海市普陀区金沙江路 1519 弄',
|
|
|
state: '1',
|
|
|
+ cong: '从',
|
|
|
},
|
|
|
{
|
|
|
id: 32,
|
|
|
- date: '2016-05-01',
|
|
|
name: '王小虎',
|
|
|
address: '上海市普陀区金沙江路 1519 弄',
|
|
|
state: '0',
|
|
|
+ cong: '从',
|
|
|
},
|
|
|
]);
|
|
|
}, 1000);
|
|
|
},
|
|
|
- open() {
|
|
|
- this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
|
|
+ open1(num) {
|
|
|
+ console.log(num);
|
|
|
+ this.$confirm('确认注销此用户吗?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
})
|
|
|
.then(() => {
|
|
|
+ this.$set(this.tableData[num], `state`, '0');
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
- message: '删除成功!',
|
|
|
+ message: '注销成功!',
|
|
|
});
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -174,6 +180,27 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ open2(num) {
|
|
|
+ console.log(num);
|
|
|
+ this.$confirm('确认恢复此用户吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$set(this.tableData[num], `state`, '1');
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '恢复成功!',
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消',
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
openDialog(index) {
|
|
|
this.editFormVisible = true;
|
|
|
let data = JSON.parse(JSON.stringify(this.tableData[index]));
|