|
@@ -71,21 +71,34 @@
|
|
|
</p>
|
|
</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="btn">
|
|
<div class="btn">
|
|
|
- <el-button type="success" @click="edit(item)" plain
|
|
|
|
|
|
|
+ <el-button size="small" type="success" @click="edit(item)" plain
|
|
|
>用户编辑</el-button
|
|
>用户编辑</el-button
|
|
|
>
|
|
>
|
|
|
|
|
+ <template v-if="have_type == 0 || staff == 1">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ v-if="item.user_have_type == '1'"
|
|
|
|
|
+ type="success"
|
|
|
|
|
+ @click="allotEquip(item.id, item.username)"
|
|
|
|
|
+ plain
|
|
|
|
|
+ >分配设备</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ v-if="item.user_have_type == '1'"
|
|
|
|
|
+ type="success"
|
|
|
|
|
+ @click="delUser(item.id, item.username)"
|
|
|
|
|
+ plain
|
|
|
|
|
+ >删除用户</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ </template>
|
|
|
<el-button
|
|
<el-button
|
|
|
type="success"
|
|
type="success"
|
|
|
|
|
+ size="small"
|
|
|
@click="resetPassword(item.id, item.username)"
|
|
@click="resetPassword(item.id, item.username)"
|
|
|
plain
|
|
plain
|
|
|
>重置密码</el-button
|
|
>重置密码</el-button
|
|
|
>
|
|
>
|
|
|
- <!-- <a @click="edit(item)">
|
|
|
|
|
- <i class="iconfont icon-iconfontedit"></i>编辑
|
|
|
|
|
- </a>
|
|
|
|
|
- <a @click="resetPassword(item.uid, item.username)">
|
|
|
|
|
- <i class="iconfont icon-mima"></i>密码
|
|
|
|
|
- </a> -->
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -127,9 +140,6 @@
|
|
|
v-model="resetPassForm.username"
|
|
v-model="resetPassForm.username"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="userType != 1" label="原始密码 : " prop="oldPass">
|
|
|
|
|
- <el-input type="password" v-model="resetPassForm.oldPass"></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
<el-form-item label="新密码 : " prop="pass">
|
|
<el-form-item label="新密码 : " prop="pass">
|
|
|
<el-input type="password" v-model="resetPassForm.pass"></el-input>
|
|
<el-input type="password" v-model="resetPassForm.pass"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -255,7 +265,6 @@ export default {
|
|
|
resetPassForm: {
|
|
resetPassForm: {
|
|
|
username: "",
|
|
username: "",
|
|
|
uid: "",
|
|
uid: "",
|
|
|
- oldPass: "",
|
|
|
|
|
pass: "",
|
|
pass: "",
|
|
|
checkPass: "",
|
|
checkPass: "",
|
|
|
},
|
|
},
|
|
@@ -292,7 +301,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
//重置密码格规则
|
|
//重置密码格规则
|
|
|
resetPassFormRules: {
|
|
resetPassFormRules: {
|
|
|
- oldPass: [{ required: true, message: "请填原始密码", trigger: "blur" }],
|
|
|
|
|
pass: [
|
|
pass: [
|
|
|
{ validator: validatePass, trigger: "blur" },
|
|
{ validator: validatePass, trigger: "blur" },
|
|
|
{ required: true, message: "请填写新密码", trigger: "blur" },
|
|
{ required: true, message: "请填写新密码", trigger: "blur" },
|
|
@@ -312,7 +320,6 @@ export default {
|
|
|
return window.sessionStorage.getItem("myuser_type");
|
|
return window.sessionStorage.getItem("myuser_type");
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- created() {},
|
|
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.getList();
|
|
this.getList();
|
|
|
this.have_type = localStorage.getItem("have_type"); // 0管理员 1用户
|
|
this.have_type = localStorage.getItem("have_type"); // 0管理员 1用户
|
|
@@ -327,60 +334,13 @@ export default {
|
|
|
typelist: 5,
|
|
typelist: 5,
|
|
|
page: this.page,
|
|
page: this.page,
|
|
|
uname: this.username,
|
|
uname: this.username,
|
|
|
|
|
+ page_size: 8,
|
|
|
}),
|
|
}),
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
this.userList = res.data.userlist;
|
|
this.userList = res.data.userlist;
|
|
|
this.totalNum = res.data.nums;
|
|
this.totalNum = res.data.nums;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- getUserGroup() {
|
|
|
|
|
- this.$axios({
|
|
|
|
|
- method: "POST",
|
|
|
|
|
- url: "api_gateway?method=pest.warning_record.rolemanage_view",
|
|
|
|
|
- data: this.qs.stringify({
|
|
|
|
|
- add_role: "all",
|
|
|
|
|
- }),
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- if (res.data.message == "") {
|
|
|
|
|
- this.userGroupList = res.data.data.data;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- recharge(id) {
|
|
|
|
|
- this.$confirm("是否向该用户充值一年费用?", "信息", {
|
|
|
|
|
- confirmButtonText: "确定",
|
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
|
- type: "warning",
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- this.$axios({
|
|
|
|
|
- method: "POST",
|
|
|
|
|
- url: "api_gateway?method=user.login.user_add_package_time",
|
|
|
|
|
- data: this.qs.stringify({
|
|
|
|
|
- uid: id,
|
|
|
|
|
- }),
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- if (res.data.message == "") {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- type: "success",
|
|
|
|
|
- message: "充值成功!",
|
|
|
|
|
- });
|
|
|
|
|
- this.getList();
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- type: "error",
|
|
|
|
|
- message: "充值失败!",
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- type: "info",
|
|
|
|
|
- message: "充值取消!",
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
// 编辑用户信息
|
|
// 编辑用户信息
|
|
|
edit(role) {
|
|
edit(role) {
|
|
|
this.editUserForm = JSON.parse(JSON.stringify(role));
|
|
this.editUserForm = JSON.parse(JSON.stringify(role));
|
|
@@ -429,50 +389,13 @@ export default {
|
|
|
this.editUserForm.user_area = value[1];
|
|
this.editUserForm.user_area = value[1];
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- login(uid, username) {
|
|
|
|
|
- //一键登录
|
|
|
|
|
- this.$confirm("一键登录将登录此用户,是否继续?", "提示", {
|
|
|
|
|
- confirmButtonText: "确定",
|
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
|
- type: "warning",
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- this.$axios({
|
|
|
|
|
- method: "POST",
|
|
|
|
|
- url: "api_gateway?method=user.login.auto_login",
|
|
|
|
|
- data: this.qs.stringify({
|
|
|
|
|
- uid,
|
|
|
|
|
- }),
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- if (res.data.message == "") {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- type: "success",
|
|
|
|
|
- message: "操作成功!",
|
|
|
|
|
- });
|
|
|
|
|
- localStorage.setItem("username", username); //修改当前登录的用户名
|
|
|
|
|
- this.reload(); //整体刷新
|
|
|
|
|
- this.$EventBus.$on("firstPage", (data) => {
|
|
|
|
|
- //默认显示菜单第一项
|
|
|
|
|
- this.$router.push(`${data}`);
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- type: "warning",
|
|
|
|
|
- message: res.data.message,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- type: "info",
|
|
|
|
|
- message: "取消一键登录!",
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // 分配设备
|
|
|
|
|
+ allotEquip(id, name) {
|
|
|
|
|
+ window.location.href = "allot?uname=" + name;
|
|
|
},
|
|
},
|
|
|
- //用户禁用
|
|
|
|
|
- forbidUse(id, state, txt) {
|
|
|
|
|
- this.$confirm(txt, "提示", {
|
|
|
|
|
|
|
+ // 删除普通用户
|
|
|
|
|
+ delUser(id, name) {
|
|
|
|
|
+ this.$confirm("删除用户, 是否继续?", "警告", {
|
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
type: "warning",
|
|
@@ -480,25 +403,25 @@ export default {
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
this.$axios({
|
|
this.$axios({
|
|
|
method: "POST",
|
|
method: "POST",
|
|
|
- url: "api_gateway?method=user.login.users_statu_updata",
|
|
|
|
|
|
|
+ url: "del_user",
|
|
|
data: this.qs.stringify({
|
|
data: this.qs.stringify({
|
|
|
- uid: id,
|
|
|
|
|
- state: state,
|
|
|
|
|
|
|
+ userid: id,
|
|
|
}),
|
|
}),
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
- if (res.data.message == "") {
|
|
|
|
|
|
|
+ if (res.data == 1) {
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ } else {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
- type: "success",
|
|
|
|
|
- message: "操作成功!",
|
|
|
|
|
|
|
+ type: "error",
|
|
|
|
|
+ message: res.data,
|
|
|
});
|
|
});
|
|
|
- this.getList();
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
type: "info",
|
|
type: "info",
|
|
|
- message: "禁用取消!",
|
|
|
|
|
|
|
+ message: "已取消删除",
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -544,41 +467,6 @@ export default {
|
|
|
addUser() {
|
|
addUser() {
|
|
|
this.addUserDialogVisible = true;
|
|
this.addUserDialogVisible = true;
|
|
|
},
|
|
},
|
|
|
- //监听用户类型改变
|
|
|
|
|
- userTypeChange(val) {
|
|
|
|
|
- if (val == 3) {
|
|
|
|
|
- this.editIsShow = true;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.editIsShow = false;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- //监听省/市/区
|
|
|
|
|
- pcdChange(val) {
|
|
|
|
|
- let addr_type = "";
|
|
|
|
|
- switch (val) {
|
|
|
|
|
- case "1":
|
|
|
|
|
- addr_type = "province";
|
|
|
|
|
- break;
|
|
|
|
|
- case "2":
|
|
|
|
|
- addr_type = "city";
|
|
|
|
|
- break;
|
|
|
|
|
- case "3":
|
|
|
|
|
- addr_type = "district";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- this.$axios({
|
|
|
|
|
- method: "POST",
|
|
|
|
|
- url: "api_gateway?method=device.device_manage.device_addr",
|
|
|
|
|
- data: this.qs.stringify({
|
|
|
|
|
- addr_type,
|
|
|
|
|
- }),
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- if (res.data.message == "") {
|
|
|
|
|
- this.areaList = res.data.data;
|
|
|
|
|
- this.editUserForm.user_area = "";
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
//添加用户提交
|
|
//添加用户提交
|
|
|
addUserSubm() {
|
|
addUserSubm() {
|
|
|
this.$refs.addUserFormRef.validate((valid) => {
|
|
this.$refs.addUserFormRef.validate((valid) => {
|
|
@@ -643,24 +531,6 @@ export default {
|
|
|
this.getList();
|
|
this.getList();
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- filters: {
|
|
|
|
|
- formatUserType(value) {
|
|
|
|
|
- switch (value) {
|
|
|
|
|
- case 1:
|
|
|
|
|
- return "超级管理员";
|
|
|
|
|
- break;
|
|
|
|
|
- case 2:
|
|
|
|
|
- return "经销商";
|
|
|
|
|
- break;
|
|
|
|
|
- case 3:
|
|
|
|
|
- return "农林政府单位";
|
|
|
|
|
- break;
|
|
|
|
|
- case 4:
|
|
|
|
|
- return "普通用户";
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|