Commit 9d7c3ec9 by 潘建波

提交修改个人密码

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