|
@@ -90,6 +90,7 @@
|
|
|
<template slot-scope="{row}">
|
|
|
<el-button size="mini" type="warning" @click="handleEdit(row)">编辑</el-button>
|
|
|
<el-button size="mini" type="danger" @click="handleDelete(row)">删除</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="openChangePw(row)">修改密码</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -108,6 +109,22 @@
|
|
|
:title="modalTitle"
|
|
|
@close="onDetailModalClose"
|
|
|
></user-detail>
|
|
|
+ <el-dialog
|
|
|
+ title="修改密码"
|
|
|
+ :visible.sync="dialogFormVisible"
|
|
|
+ :modal-append-to-body="false"
|
|
|
+ style="width:50%"
|
|
|
+ >
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="新密码" prop="password">
|
|
|
+ <el-input v-model="newPassword" placeholder="请输入新密码" style="width:70%" show-password></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="changePw">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -136,9 +153,12 @@ export default {
|
|
|
direction: "",
|
|
|
pageSizeList: [10, 20, 30],
|
|
|
multipleSelection: [],
|
|
|
- modalTitle: "",
|
|
|
+ modalTitle: "",
|
|
|
businessKey: "",
|
|
|
- showModal: false
|
|
|
+ showModal: false,
|
|
|
+ dialogFormVisible: false,
|
|
|
+ changeId:"",
|
|
|
+ newPassword: ""
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -166,32 +186,34 @@ export default {
|
|
|
|
|
|
self.loading = true;
|
|
|
|
|
|
- userApi.pageList(formData).then(function(response) {
|
|
|
- self.loading = false;
|
|
|
+ userApi
|
|
|
+ .pageList(formData)
|
|
|
+ .then(function(response) {
|
|
|
+ self.loading = false;
|
|
|
|
|
|
- var jsonData = response.data;
|
|
|
+ var jsonData = response.data;
|
|
|
|
|
|
- if(jsonData.result){
|
|
|
- var pageInfo = jsonData.data;
|
|
|
+ if (jsonData.result) {
|
|
|
+ var pageInfo = jsonData.data;
|
|
|
|
|
|
- self.tableData = pageInfo.data;
|
|
|
- self.totalPages = pageInfo.totalPages;
|
|
|
- self.totalElements = pageInfo.recordsTotal;
|
|
|
- }
|
|
|
- else {
|
|
|
- self.$message({
|
|
|
+ self.tableData = pageInfo.data;
|
|
|
+ self.totalPages = pageInfo.totalPages;
|
|
|
+ self.totalElements = pageInfo.recordsTotal;
|
|
|
+ } else {
|
|
|
+ self.$message({
|
|
|
message: jsonData.message + "",
|
|
|
type: "warning"
|
|
|
});
|
|
|
- }
|
|
|
- }).catch((error)=>{
|
|
|
- self.loading = false;
|
|
|
- });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ self.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
pageSizeChange(pageSize) {
|
|
|
this.pageSize = pageSize;
|
|
|
|
|
|
- this.$nextTick(()=>{
|
|
|
+ this.$nextTick(() => {
|
|
|
this.changePage(this.pageIndex);
|
|
|
});
|
|
|
},
|
|
@@ -209,14 +231,14 @@ export default {
|
|
|
},
|
|
|
handleAdd() {
|
|
|
var self = this;
|
|
|
-
|
|
|
+
|
|
|
self.modalTitle = "新增用户";
|
|
|
self.businessKey = "";
|
|
|
self.showModal = true;
|
|
|
},
|
|
|
handleEdit(record) {
|
|
|
var self = this;
|
|
|
-
|
|
|
+
|
|
|
self.modalTitle = "编辑用户";
|
|
|
self.businessKey = record.id;
|
|
|
self.showModal = true;
|
|
@@ -274,9 +296,38 @@ export default {
|
|
|
onDetailModalClose(refreshed) {
|
|
|
this.showModal = false;
|
|
|
|
|
|
- if(refreshed) {
|
|
|
+ if (refreshed) {
|
|
|
this.changePage(this.pageIndex);
|
|
|
}
|
|
|
+ },
|
|
|
+ openChangePw(record) {
|
|
|
+ var self = this;
|
|
|
+ self.changeId = record.id;
|
|
|
+ self.dialogFormVisible = true;
|
|
|
+ },
|
|
|
+ changePw() {
|
|
|
+ var self = this;
|
|
|
+ var formData = new FormData();
|
|
|
+
|
|
|
+ formData.append("userId", self.changeId);
|
|
|
+ formData.append("newPwd", self.newPassword);
|
|
|
+
|
|
|
+ userApi.changeUserPassword(formData).then(function(response) {
|
|
|
+ var jsonData = response.data;
|
|
|
+
|
|
|
+ if (jsonData.result) {
|
|
|
+ self.changePage(self.pageIndex);
|
|
|
+
|
|
|
+ self.dialogFormVisible = false;
|
|
|
+ self.changeId = "";
|
|
|
+ self.newPassword = "";
|
|
|
+
|
|
|
+ self.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "修改成功!"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
mounted: function() {
|