aiyadc 5 years ago
commit 9df456f9b1

@ -104,7 +104,6 @@
}, },
cancel() { cancel() {
this.$refs['userForm'].resetFields()
this.$emit('cancel') this.$emit('cancel')
} }
}, },

@ -6,7 +6,7 @@
</el-col> </el-col>
<el-col :span="16" style="text-align: left"> <el-col :span="16" style="text-align: left">
<el-button type="success" style="width: 120px;text-align: left" icon="el-icon-circle-plus-outline" <el-button type="success" style="width: 120px;text-align: left" icon="el-icon-circle-plus-outline"
@click="addUser">新增用户 @click="editUser(null)">新增用户
</el-button> </el-button>
<el-button type="danger" plain icon="el-icon-delete" style="width: 120px;text-align: left" <el-button type="danger" plain icon="el-icon-delete" style="width: 120px;text-align: left"
@click="deleteUserMul" v-if="items.length">多选删除 @click="deleteUserMul" v-if="items.length">多选删除
@ -36,9 +36,14 @@
<el-table-column prop="email" label="邮箱"></el-table-column> <el-table-column prop="email" label="邮箱"></el-table-column>
<el-table-column fixed="right" label="操作" width="300"> <el-table-column fixed="right" label="操作" width="300">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="editUser(scope.row)" type="primary" size="mini" plain icon="el-icon-edit" v-if="scope.row.position!==3"></el-button> <el-button @click="editUser(scope.row)" type="primary" size="mini" plain icon="el-icon-edit"
<el-button @click="deleteUser(scope.row)" type="danger" size="mini" plain icon="el-icon-delete" v-if="scope.row.position!==3"></el-button> v-if="scope.row.position!==3">编辑
<el-button @click="handleClick(scope.row)" size="mini" plain v-if="scope.row.position === 1"></el-button> </el-button>
<el-button @click="deleteUser(scope.row)" type="danger" size="mini" plain icon="el-icon-delete"
v-if="scope.row.position!==3">删除
</el-button>
<el-button @click="handleClick(scope.row)" size="mini" plain v-if="scope.row.position === 1">
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -81,18 +86,6 @@
handleSelectionChange(val) { handleSelectionChange(val) {
this.items = val; this.items = val;
}, },
addUser() {
this.edit = false
this.userForm = {
nickname: "",
tel: "",
email: "",
username: "",
office: "",
position: ''
}
this.dialogFormVisible = true
},
// //
async deleteUser(item) { async deleteUser(item) {
await showDialog("确认要删除吗?", this) await showDialog("确认要删除吗?", this)
@ -111,15 +104,24 @@
}, },
// //
async editUser(item) { async editUser(item) {
this.edit = true //
this.userForm = item this.edit = !!item
this.userForm = item ? item : {
nickname: "",
tel: "",
email: "",
username: "",
office: "",
position: ''
}
//
this.dialogFormVisible = true this.dialogFormVisible = true
}, },
cancel() { cancel() {
this.load()
this.dialogFormVisible = false this.dialogFormVisible = false
}, },
confirm() { confirm() {
this.load()
this.cancel() this.cancel()
} }
}, },

Loading…
Cancel
Save