Commit 9d7c3ec9 by 潘建波

提交修改个人密码

1 parent ff0930a2
No preview for this file type
......@@ -4,7 +4,7 @@ console.log(process.env.NODE_ENV);
switch (process.env.NODE_ENV) {
case "development":
// baseUrl = "http://192.168.9.234:20080"; // 测试环境url
baseUrl = "http://192.168.9.62:20080"; // 测试环境url
baseUrl = "http://192.168.9.149:20080"; // 测试环境url
// baseUrl = "http://192.168.9.82:8080"; // 测试环境url
// baseUrl = "http://192.168.9.61:8086";
// baseUrl = 'http://vion-panda.51vip.biz:52510';
......
......@@ -14,7 +14,7 @@ export default {
return api.post(`${baseUrl}/api/v1/auth/users/${id}`, params)
},
resetPwd(params,id) {
return api.post(`${baseUrl}/api/v1/devconf_fx/users/${id}/reset`, params)
return api.post(`${baseUrl}/api/v1/auth/users/${id}/password`, params)
},
delUser(params,id){
return api.delete(`${baseUrl}/api/v1/auth/users/${id}`, params)
......
......@@ -39,7 +39,14 @@ export const constantRouterMap = [
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: resolve => require(["../views/Show.vue"], resolve)
}
},{
path: "/resetpass",
name: "resetpassword",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: resolve => require(["../views/Resetpassword.vue"], resolve)
},
];
export const asyncRouterMap = [
{
......
......@@ -14,7 +14,7 @@
></span>
<div class="headRight">
<span>{{ curdate }}</span>
<img src="../../assets/img/home/user.png" alt="" />
<img @click="resetpass" src="../../assets/img/home/user.png" alt="" />
<span class="exit" @click="logout()"
>退出<i class="el-icon-arrow-down"></i
></span>
......@@ -129,6 +129,9 @@ export default {
this.$store.commit(types.ATOKEN, "");
localStorage.removeItem("atoken");
this.$router.push("/login").catch(err => {err});
},
resetpass(){
this.$router.push("/resetpass").catch(err => {err});
}
},
created() {
......
<template>
<div class="passform-box">
<div class="re-header">重置密码</div>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="passform"
>
<div class="passformitem">
<el-form-item label="旧密码" prop="oldpassword">
<el-input v-model="ruleForm.oldpassword" type="password"></el-input>
</el-form-item>
</div>
<div class="passformitem">
<el-form-item label="新密码" prop="newpassword">
<el-input v-model="ruleForm.newpassword" type="password"></el-input>
</el-form-item>
</div>
<div class="passformitem">
<el-form-item label="密码确认" prop="checknewpassword">
<el-input
v-model="ruleForm.checknewpassword"
type="password"
></el-input>
</el-form-item>
</div>
<el-form-item>
<el-button @click="back('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')"
>提交</el-button
>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
var validatePass = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入密码"));
} else {
if (this.ruleForm.checkPass !== "") {
this.$refs.ruleForm.validateField("checkPass");
}
callback();
}
};
var validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.ruleForm.newpassword) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
ruleForm: {
oldpassword: "",
newpassword: "",
checknewpassword: ""
},
rules: {
oldpassword: [
{ required: true, message: "请输入旧密码", trigger: "blur" }
],
newpassword: [
{ validator: validatePass, trigger: "blur" },
{ required: true, message: "", trigger: "blur" }
],
checknewpassword: [
{ validator: validatePass2, trigger: "blur" },
{ required: true, message: "", trigger: "blur" }
]
}
};
},
methods: {
submitForm(formName) {
let data = {
old_pwd: this.ruleForm.oldpassword,
new_pwd: this.ruleForm.newpassword
};
this.$refs[formName].validate(valid => {
if (valid) {
let user_unid = sessionStorage.getItem("user_unid");
this.$api.ops.resetPwd(data, user_unid).then(res => {
this.$router.push("/login");
});
} else {
console.log("error submit!!");
return false;
}
});
},
back() {
this.$router.back(-1);
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
};
</script>
<style>
.passform {
margin: 20px;
width: 400px;
}
.passformitem {
margin-bottom: 20px;
}
.passform-box{
width: 400px;
}
.re-header{
margin-left: 60px;
margin-top: 20px;
}
</style>
......@@ -161,6 +161,9 @@
<script>
import { SVG } from "@svgdotjs/svg.js";
var draw = null;
var childgroup = null;
var levalgroup = null;
var levalinecolor = "#333";
export default {
data() {
return {
......@@ -222,9 +225,7 @@ export default {
};
this.curDevData = dev;
this.$api.device.getSubdev(this.parentData, obj).then(res => {
for (var i = 0; i < 10; i++) {
this.slaveData.push(res.list_data);
}
this.slaveData = res.list_data;
this.createdLeval(ev, this.slaveData);
});
},
......@@ -266,13 +267,14 @@ export default {
var _this = this;
var nested = draw
.nested()
.size(120, 40)
.size(130, 40)
.move(50, 50)
.data("sdv", data);
var rect = nested
.rect(120, 40)
.attr({ fill: "#f06" })
.radius(5);
.rect(130, 40)
.attr({ fill: "#123e6c", opacity: 0.6 })
.stroke({ color: "#333", opacity: 0.5, width: 1 })
.radius(3);
var text = nested.text(function(add) {
add
.tspan(`${data.device_name}`)
......@@ -286,32 +288,38 @@ export default {
});
},
createdChild(data) {
if (childgroup) {
childgroup.clear();
}
childgroup = draw.group();
var _this = this;
data.map((ele, index) => {
let point = {
x: 200,
y: 70 * (index + 1) + 50
y: 65 * (index + 1) + 70
};
var polyline = draw
var polyline = childgroup
.polyline([
[110, 90],
[110, point.y - 45],
[110, point.y + 20],
[200, point.y + 20]
])
.stroke({ width: 1, color: "red" });
.stroke({ width: 1, color: "#ddd" });
polyline.fill("none").stroke({
width: 2,
color: "red"
width: 1,
color: "#333"
});
ele.color = this.setsubcolor(index);
var nested = draw
.nested()
.size(120, 40)
.size(130, 40)
.move(point.x, point.y)
.data("childsdv", ele);
var rect = nested
.rect(120, 40)
.attr({ fill: "#f06" })
.radius(5);
.rect(130, 40)
.stroke({ color: "#333", opacity: 0.5, width: 1 })
.attr({ fill: `rgb(${_this.setsubcolor(index)})`, opacity: 0.6 })
.radius(3);
var text = nested.text(function(add) {
add
.tspan(`${ele.device_name}`)
......@@ -319,15 +327,23 @@ export default {
.fill({ color: "#fff" }),
add.tspan(`${ele.in_ip}`).newLine();
});
childgroup.add(nested);
nested.click(function() {
let data = this.data("childsdv");
this.curDevData = data;
_this.getleval(this, data);
levalinecolor = data.color;
});
});
},
createdLeval(ev, data) {
let num = Math.ceil(data.length/6);
for(let i = 0; i < num; i++){
if (levalgroup) {
levalgroup.clear();
}
var polyline = "";
levalgroup = draw.group();
let num = Math.ceil(data.length / 6);
for (let i = 0; i <= num; i++) {
var laveData = this.setslaveData(data, i);
//当前点击节点信息
let linepoint = {
......@@ -335,45 +351,65 @@ export default {
y: ev.y() + 20
};
var _this = this;
console.log(laveData);
laveData.map((ele, index) => {
let point = {
x: 330 * i + 430,
y: linepoint.y + i * 70 + 30
x: 250 * i + 430,
y: linepoint.y + index * 65 + 30
};
if (index == 0) {
if (index == 0 && i == num - 1) {
var line = draw
.polyline([
[linepoint.x, linepoint.y],
[400, point.y - (index == 0 ? 30 : 58)]
[point.x - 50, point.y - (index == 0 ? 30 : 58)]
])
.stroke({ width: 1, color: "red" });
line.fill("none").stroke({
width: 2,
color: "green"
width: 1,
color: `rgb(${levalinecolor})`
});
levalgroup.add(line);
}
if (linepoint.y < 200) {
var polyline = draw
if (linepoint.y < 500) {
polyline = draw
.polyline([
[400, linepoint.y],
[400, point.y + 20],
[450, point.y + 20]
[point.x - 50, linepoint.y],
[point.x - 50, point.y + 20],
[point.x + 50, point.y + 20]
])
.stroke({ width: 1, color: "red" });
.stroke({ width: 1, color: `rgb(${levalinecolor})` });
polyline.fill("none").stroke({
width: 2,
color: "red"
width: 1,
color: `rgb(${levalinecolor})`
});
levalgroup.add(polyline);
} else {
point = {
x: 250 * i + 430,
y: linepoint.y - index * 70 - 90
};
polyline = draw
.polyline([
[point.x - 50, linepoint.y],
[point.x - 50, point.y + 20],
[point.x + 50, point.y + 20]
])
.stroke({ width: 1, color: `rgb(${levalinecolor})` });
polyline.fill("none").stroke({
width: 1,
color: `rgb(${levalinecolor})`
});
levalgroup.add(polyline);
}
var nested = draw
.nested()
.size(120, 40)
.size(130, 40)
.move(point.x, point.y)
.data("childsdv", ele);
var rect = nested
.rect(120, 40)
.attr({ fill: "#f06" })
.radius(5);
.rect(130, 40)
.attr({ fill: `rgb(${_this.setsubcolor(index)})` })
.radius(3);
var text = nested.text(function(add) {
add
.tspan(`${ele.device_name}`)
......@@ -381,14 +417,14 @@ export default {
.fill({ color: "#fff" }),
add.tspan(`${ele.in_ip}`).newLine();
});
levalgroup.add(nested);
//事件点击
nested.click(function() {
let data = this.data("childsdv");
_this.getleval(this, data);
this.curDevData = data;
});
});
}
}
},
setslaveData(data, index) {
return data.slice(index * 6, 6 * (index + 1));
......
<template>
<div class="contentBox">
<div class="content">
<div style="padding:8px 20px;">
<span style="float: right;">
<el-button type="info" @click="addUser">添加新用户</el-button>
</span>
<div style="clear: both;"></div>
</div>
<div style="padding: 0 15px 20px 23px;">
<el-table
:height="tableHeight"
:data="tableData"
stripe
border
style="width: 100%">
<el-table-column
align="center"
prop="num"
:formatter="numFormatter"
label="序号">
</el-table-column>
<el-table-column
prop="username"
align="center"
label="用户名">
</el-table-column>
<el-table-column
align="center"
prop="roles[0].name"
label="角色名">
</el-table-column>
<el-table-column
align="center"
prop="create_dt"
width="300"
label="创建时间">
</el-table-column>
<el-table-column
align="center"
width="300"
prop="operation"
label="操作">
<template slot-scope="scope">
<el-tooltip content="编辑用户" placement="bottom" effect="light" :visible-arrow=false>
<span class="icon-fanxing-xiugai editIcon" @click="editUser(scope.$index, scope.row)"></span>
</el-tooltip>
<!-- <span class="tableSpanBorder"></span>
<div class="content">
<div style="padding:8px 20px;">
<span style="float: right;">
<el-button type="info" @click="addUser">添加新用户</el-button>
</span>
<div style="clear: both;"></div>
</div>
<div style="padding: 0 15px 20px 23px;">
<el-table
:height="tableHeight"
:data="tableData"
stripe
border
style="width: 100%"
>
<el-table-column
align="center"
prop="num"
:formatter="numFormatter"
label="序号"
>
</el-table-column>
<el-table-column prop="username" align="center" label="用户名">
</el-table-column>
<el-table-column align="center" prop="roles[0].name" label="角色名">
</el-table-column>
<el-table-column
align="center"
prop="create_dt"
width="300"
label="创建时间"
>
</el-table-column>
<el-table-column
align="center"
width="300"
prop="operation"
label="操作"
>
<template slot-scope="scope">
<el-tooltip
content="编辑用户"
placement="bottom"
effect="light"
:visible-arrow="false"
>
<span
class="icon-fanxing-xiugai editIcon"
@click="editUser(scope.$index, scope.row)"
></span>
</el-tooltip>
<!-- <span class="tableSpanBorder"></span>
<el-tooltip content="重置密码" placement="bottom" effect="light" :visible-arrow=false>
<span class="icon-fanxing-xiugai editIcon2" @click="reset(scope.$index, scope.row)"></span>
</el-tooltip> -->
<span class="tableSpanBorder"></span>
<el-tooltip content="删除" placement="bottom" effect="light" :visible-arrow=false>
<span class="el-icon-delete delIcon" @click="delFun(scope.$index, scope.row)"></span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 28px;">
<el-pagination
style="float: right;"
background
prev-text="上一页"
next-text="下一页"
:page-sizes="[30, 50, 100, 200]"
layout="total, prev, pager, next,sizes, jumper"
:current-page="page"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:total="total">
</el-pagination>
<div style="clear: both;"></div>
</div>
</div>
</div>
<!-- 新增 -->
<el-dialog
title="新增用户"
:visible.sync="addVisible"
@open="openAddDialog"
width="30%">
<div>
<el-form label-position="left" label-width="80px" :model="addForm" :rules="rules" ref="addForm" inline-message hide-required-asterisk>
<el-form-item label="角色选项" prop="role_unid">
<el-select v-model="addForm.role_unid" placeholder="请选择" :popper-append-to-body=false>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.name"
:value="item.role_unid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="username">
<el-input v-model="addForm.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="addForm.password" type="password"></el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="checkPass">
<el-input v-model="addForm.checkPass" type="password"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="addVisible = false">取 消</el-button>
<el-button type="primary" @click="addFun('addForm')">确 定</el-button>
</span>
</el-dialog>
<!-- 编辑 -->
<el-dialog
title="编辑用户"
:visible.sync="editVisible"
width="30%">
<div>
<el-form label-position="left" label-width="80px" :model="editForm" :rules="rules" ref="editForm" inline-message hide-required-asterisk>
<el-form-item label="角色选项" prop="role_unid">
<el-select v-model="editForm.role_unid" placeholder="请选择" :popper-append-to-body=false>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.name"
:value="item.role_unid">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="editVisible = false">取 消</el-button>
<el-button type="primary" @click="editFun('editForm')">确 定</el-button>
</span>
</el-dialog>
<span class="tableSpanBorder"></span>
<el-tooltip
content="删除"
placement="bottom"
effect="light"
:visible-arrow="false"
>
<span
class="el-icon-delete delIcon"
@click="delFun(scope.$index, scope.row)"
></span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 28px;">
<el-pagination
style="float: right;"
background
prev-text="上一页"
next-text="下一页"
:page-sizes="[30, 50, 100, 200]"
layout="total, prev, pager, next,sizes, jumper"
:current-page="page"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:total="total"
>
</el-pagination>
<div style="clear: both;"></div>
</div>
</div>
</div>
<!-- 新增 -->
<el-dialog
title="新增用户"
:visible.sync="addVisible"
@open="openAddDialog"
width="30%"
>
<div>
<el-form
label-position="left"
label-width="80px"
:model="addForm"
:rules="rules"
ref="addForm"
inline-message
hide-required-asterisk
>
<el-form-item label="角色选项" prop="role_unid">
<el-select
v-model="addForm.role_unid"
placeholder="请选择"
:popper-append-to-body="false"
>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.name"
:value="item.role_unid"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="username">
<el-input v-model="addForm.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="addForm.password" type="password"></el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="checkPass">
<el-input v-model="addForm.checkPass" type="password"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="addVisible = false">取 消</el-button>
<el-button type="primary" @click="addFun('addForm')">确 定</el-button>
</span>
</el-dialog>
<!-- 编辑 -->
<el-dialog title="编辑用户" :visible.sync="editVisible" width="30%">
<div>
<el-form
label-position="left"
label-width="80px"
:model="editForm"
:rules="rules"
ref="editForm"
inline-message
hide-required-asterisk
>
<el-form-item label="角色选项" prop="role_unid">
<el-select
v-model="editForm.role_unid"
placeholder="请选择"
:popper-append-to-body="false"
>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.name"
:value="item.role_unid"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="editVisible = false">取 消</el-button>
<el-button type="primary" @click="editFun('editForm')">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data(){
var checkRole = (rule, value, callback) => {
if (value === '') {
callback(new Error('请选择角色'));
} else {
callback();
}
};
var checkUser = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入用户名'));
} else {
callback();
}
};
var validatePass = (rule, value, callback) => {
var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
if(!reg.test(value)){
callback(new Error('密码必须包含数字字母大于6位'));
}else{
callback();
}
};
var validatePass2 = (rule, value, callback) => {
console.log('aa',this.addForm.password)
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.addForm.password) {
callback(new Error('两次输入密码不一致!'));
export default {
data() {
var checkRole = (rule, value, callback) => {
if (value === "") {
callback(new Error("请选择角色"));
} else {
callback();
}
};
var checkUser = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入用户名"));
} else {
callback();
}
};
var validatePass = (rule, value, callback) => {
var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
if (!reg.test(value)) {
callback(new Error("密码必须包含数字字母大于6位"));
} else {
callback();
}
};
var validatePass2 = (rule, value, callback) => {
console.log("aa", this.addForm.password);
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.addForm.password) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
total: 0,
page: 1,
pageSize: 30,
addForm: {
norm_type: "login",
role_unid: "",
username: "",
password: "",
checkPass: ""
},
editForm: {
role_unid: ""
},
editRoleUnid: "",
editUnid: "",
tableData: [],
addVisible: false,
editVisible: false,
roleList: [],
rules: {
role_unid: [{ validator: checkRole, trigger: "change" }],
username: [{ validator: checkUser, trigger: "change" }],
password: [{ validator: validatePass, trigger: "change" }],
checkPass: [{ validator: validatePass2, trigger: "change" }]
},
tableHeight: window.opsTableHeight
};
},
components: {},
mounted() {
this.getTableList();
this.getRoleList();
},
methods: {
numFormatter(row, column, cellValue, index) {
return (index + 1) * this.page;
},
handleSizeChange(val) {
this.pageSize = val;
this.getTableList();
},
handleCurrentChange(val) {
this.page = val;
this.getTableList();
},
getTableList() {
this.tableData = [];
console.log("aa", this.userId);
let offset = (this.page - 1) * this.pageSize;
this.$api.ops
.getUserList({
limit: this.pageSize,
offset: offset
})
.then(res => {
this.total = res.total_num;
if (res.list_data == null) {
this.tableData = [];
} else {
this.tableData = res.list_data;
}
})
.catch(error => {});
},
getRoleList() {
this.roleList = [];
this.$api.ops
.getRoleList({
limit: 9999,
offset: 0,
is_active: true
})
.then(res => {
if (res.list_data == null) {
this.roleList = [];
} else {
this.roleList = res.list_data;
}
})
.catch(error => {});
},
delFun(index, row) {
this.$confirm("此操作将永久删除该选项, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$api.ops.delUser({}, row.user_unid).then(res => {
if (!res.ecode) {
this.$message({
type: "success",
message: "删除成功!"
});
this.getTableList();
} else {
this.$message({
type: "error",
message: "删除失败!"
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
},
reset(index, row) {
this.$confirm("此操作将重置密码, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$api.ops
.resetPwd(
{
reset_unid: row.unid
},
this.userId
)
.then(res => {
if (res.ecode == 200) {
this.$message({
type: "success",
message: "重置密码成功!"
});
} else {
this.$message({
type: "error",
message: "重置密码失败!"
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消"
});
});
},
editUser(index, row) {
this.editRoleUnid = row.roles[0].role_unid;
this.editForm.role_unid = row.roles[0].role_unid;
this.editUnid = row.user_unid;
this.editVisible = true;
},
openAddDialog() {
this.$refs["addForm"].resetFields();
},
addUser() {
this.addVisible = true;
},
addFun(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
this.$api.ops
.addUser({
norm_type: this.addForm.norm_type,
username: this.addForm.username,
password: this.addForm.password
})
.then(res => {
if (!res.ecode) {
this.$api.ops
.bindRole(
{
role_unid: this.addForm.role_unid
},
res.user_unid
)
.then(data => {
if (!data.ecode) {
this.$message({
type: "success",
message: "添加成功!"
});
this.addVisible = false;
this.getTableList();
} else {
this.$message({
type: "error",
message: "添加失败!"
});
}
});
} else {
this.$message({
type: "error",
message: "添加失败!"
});
}
});
} else {
callback();
return false;
}
};
return{
total:0,
page:1,
pageSize:30,
addForm:{
norm_type:"login",
role_unid:'',
username:'',
password:'',
checkPass:''
},
editForm:{
role_unid:'',
},
editRoleUnid:'',
editUnid:'',
tableData: [],
addVisible:false,
editVisible:false,
roleList:[],
rules: {
role_unid: [
{ validator: checkRole, trigger: 'change' }
],
username: [
{ validator: checkUser, trigger: 'change' }
],
password: [
{ validator: validatePass, trigger: 'change' }
],
checkPass:[
{ validator: validatePass2, trigger: 'change' }
]
},
tableHeight:window.opsTableHeight
}
},
components:{
},
mounted(){
this.getTableList();
this.getRoleList();
},
methods:{
numFormatter(row, column, cellValue, index) {
return (index+1)*this.page;
},
handleSizeChange(val) {
this.pageSize=val;
this.getTableList();
},
handleCurrentChange(val) {
this.page=val;
this.getTableList();
},
getTableList(){
this.tableData=[];
console.log('aa',this.userId)
let offset = (this.page - 1) * this.pageSize;
this.$api.ops.getUserList({
limit: this.pageSize,
offset: offset,
}).then((res)=>{
this.total=res.total_num;
if(res.list_data==null){
this.tableData=[]
}else{
this.tableData=res.list_data;
}
}).catch((error)=>{
})
},
getRoleList(){
this.roleList=[];
this.$api.ops.getRoleList({
limit: 9999,
offset: 0,
is_active:true
}).then((res)=>{
if(res.list_data==null){
this.roleList=[]
}else{
this.roleList=res.list_data;
}
}).catch((error)=>{
})
},
delFun(index,row){
this.$confirm('此操作将永久删除该选项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.ops.delUser({},row.user_unid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '删除成功!'
});
this.getTableList();
}else{
this.$message({
type: 'error',
message: '删除失败!'
});
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
reset(index,row){
this.$confirm('此操作将重置密码, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$api.ops.resetPwd({
reset_unid:row.unid
},this.userId).then(res=>{
if(res.ecode==200){
this.$message({
type: 'success',
message: '重置密码成功!'
});
}else{
this.$message({
type: 'error',
message: '重置密码失败!'
});
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
editUser(index,row){
this.editRoleUnid=row.roles[0].role_unid;
this.editForm.role_unid=row.roles[0].role_unid;
this.editUnid=row.user_unid;
this.editVisible=true;
},
openAddDialog(){
this.$refs['addForm'].resetFields();
},
addUser(){
this.addVisible=true;
},
addFun(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.addUser({
norm_type:this.addForm.norm_type,
username:this.addForm.username,
password:this.addForm.password
}).then(res=>{
if(!res.ecode){
this.$api.ops.bindRole({
"role_unid":this.addForm.role_unid,
},res.user_unid).then(data=>{
if(!data.ecode){
this.$message({
type: 'success',
message: '添加成功!'
});
this.addVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '添加失败!'
});
}
})
}else{
this.$message({
type: 'error',
message: '添加失败!'
});
}
})
} else {
return false;
}
});
},
editFun(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.unbindRole({},this.editUnid,this.editRoleUnid).then(res=>{
this.$api.ops.bindRole({
role_unid:this.editForm.role_unid
},this.editUnid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '修改成功!'
});
this.editVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '修改失败!'
});
}
})
})
} else {
return false;
}
});
}
},
}
});
},
editFun(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
this.$api.ops
.unbindRole({}, this.editUnid, this.editRoleUnid)
.then(res => {
this.$api.ops
.bindRole(
{
role_unid: this.editForm.role_unid
},
this.editUnid
)
.then(res => {
if (!res.ecode) {
this.$message({
type: "success",
message: "修改成功!"
});
this.editVisible = false;
this.getTableList();
} else {
this.$message({
type: "error",
message: "修改失败!"
});
}
});
});
} else {
return false;
}
});
}
}
};
</script>
<style lang="scss" scoped>
.topCon{
background: $white-back-color;
margin-bottom: 12px;
height: 100px;
.left{
display: inline-block;
margin: {
top: 22px;
left: 30px;
};
img{
width:65px ;
height: 55px;
margin-right: 11px;
}
.topText{
font-size:24px;
font-family:MicrosoftYaHeiUI-Bold,MicrosoftYaHeiUI;
font-weight:bold;
margin-bottom: 4px;
}
.bottomText{
font-size:14px;
font-family:MicrosoftYaHeiUI;
}
}
.right{
float: right;
.topText{
font-size:28px;
font-family:MicrosoftYaHeiUI-Bold,MicrosoftYaHeiUI;
font-weight:bold;
}
.bottomText{
position: relative;
top: -1px;
font-size:14px;
font-family:MicrosoftYaHeiUI;
}
}
.textCon{
display: inline-block;
vertical-align: top;
}
.border{
display: inline-block;
height: 40px;
border: {
left: 2px solid $border-color;
};
}
.rightBox{
margin-top: 14px;
display: inline-block;
img{
margin:{
top:15px;
right: 22px;
}
}
}
.rightBox:nth-of-type(1){
img{
width: 34px;
height: 34px;
}
.textCon{
margin-right:114px ;
}
}
.rightBox:nth-of-type(2){
position: relative;
top: 4px;
img{
width: 40px;
height: 40px;
margin-left: 102px;
}
.textCon{
margin-right:101px ;
}
}
.rightBox:nth-of-type(3){
img{
width: 34px;
height: 35px;
margin-left: 104px;
}
.textCon{
margin-right:184px ;
}
}
}
.content{
background: #FFFFFF;
}
.inputBox{
margin-right: 20px;
}
.selectBox{
margin-right: 20px;
}
.editIcon{
cursor: pointer;
color:#0069ff;
font-size:16px;
}
.editIcon2{
cursor: pointer;
color:#87d14b;
font-size:16px;
}
.playIcon{
cursor: pointer;
color:#34b3a2;
font-size:16px;
}
.pauseIcon{
cursor: pointer;
color:#ffc62e;
font-size:14px;
}
.delIcon{
cursor: pointer;
color:#f2365a;
font-size:16px;
}
</style>
\ No newline at end of file
.topCon {
background: $white-back-color;
margin-bottom: 12px;
height: 100px;
.left {
display: inline-block;
margin: {
top: 22px;
left: 30px;
}
img {
width: 65px;
height: 55px;
margin-right: 11px;
}
.topText {
font-size: 24px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
margin-bottom: 4px;
}
.bottomText {
font-size: 14px;
font-family: MicrosoftYaHeiUI;
}
}
.right {
float: right;
.topText {
font-size: 28px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
}
.bottomText {
position: relative;
top: -1px;
font-size: 14px;
font-family: MicrosoftYaHeiUI;
}
}
.textCon {
display: inline-block;
vertical-align: top;
}
.border {
display: inline-block;
height: 40px;
border: {
left: 2px solid $border-color;
}
}
.rightBox {
margin-top: 14px;
display: inline-block;
img {
margin: {
top: 15px;
right: 22px;
}
}
}
.rightBox:nth-of-type(1) {
img {
width: 34px;
height: 34px;
}
.textCon {
margin-right: 114px;
}
}
.rightBox:nth-of-type(2) {
position: relative;
top: 4px;
img {
width: 40px;
height: 40px;
margin-left: 102px;
}
.textCon {
margin-right: 101px;
}
}
.rightBox:nth-of-type(3) {
img {
width: 34px;
height: 35px;
margin-left: 104px;
}
.textCon {
margin-right: 184px;
}
}
}
.content {
background: #ffffff;
}
.inputBox {
margin-right: 20px;
}
.selectBox {
margin-right: 20px;
}
.editIcon {
cursor: pointer;
color: #0069ff;
font-size: 16px;
}
.editIcon2 {
cursor: pointer;
color: #87d14b;
font-size: 16px;
}
.playIcon {
cursor: pointer;
color: #34b3a2;
font-size: 16px;
}
.pauseIcon {
cursor: pointer;
color: #ffc62e;
font-size: 14px;
}
.delIcon {
cursor: pointer;
color: #f2365a;
font-size: 16px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!