From f2f0c2072bd270e0a9bdfef4c94699d46f9ad505 Mon Sep 17 00:00:00 2001
From: lancer <1905818361@qq.com>
Date: Wed, 10 Nov 2021 19:44:27 +0800
Subject: [PATCH] init
---
src/views/admin/user/index.vue | 302 +++++++++++++++++++--------------
1 file changed, 172 insertions(+), 130 deletions(-)
diff --git a/src/views/admin/user/index.vue b/src/views/admin/user/index.vue
index dd0fe4c..8851c43 100644
--- a/src/views/admin/user/index.vue
+++ b/src/views/admin/user/index.vue
@@ -143,12 +143,12 @@
-->
-
+ v-for="item in userRoleList"
+ :key="item.dictValue"
+ :label="item.dictName"
+ :value="item.dictValue"
+ >
+
@@ -197,7 +197,11 @@
- 密码重置
- 编辑
楼盘选择
-
+
{{ scope.row.lockFlag == 0 ? "禁用" : "启用" }}
- 移除
@@ -374,7 +396,7 @@
女
-
+
是
否
@@ -396,11 +418,19 @@
v-model="form.orgType"
placeholder="请选择组织类型"
style="width: 370px"
- :disabled='losorgType!=2'
+ :disabled="losorgType != 2"
@change="typeChange"
>
-
-
+
+
@@ -489,7 +519,11 @@
-
+
-
-
+
+
-
+
是
否
-
+
-
+
@@ -985,7 +1020,7 @@ export default {
fourthList: [],
allCityList: [],
managerList: [],
- houseUserRoleType:'',
+ houseUserRoleType: "",
bindFlag: "0",
treeClick: "", //点击样式
keywork: "", //搜索关键字
@@ -994,7 +1029,7 @@ export default {
orgFlag: false,
roleFlag: false,
identityFlag: false,
- editVisible:false,
+ editVisible: false,
agentFlag: false,
treeProps: {
children: "children",
@@ -1048,28 +1083,28 @@ export default {
form: {
name: "", //用户名
username: "", //手机号
- sex: '0', //性别
+ sex: "0", //性别
password: "", //密码
orgType: "", //组织类型
roleId: "", //角色id
agentId: "", //代理商id
orgCode: "", //公司标识
userRoleType: "", //身份
- deptId:'',//部门
- houseId:"",
- showPhoneStatus:0//手机号显隐
+ deptId: "", //部门
+ houseId: "",
+ showPhoneStatus: 0, //手机号显隐
},
formTwo: {
username: "", //手机号
userRoleType: "", //身份
- deptId:'',//部门
- roleId:'',//角色
- newRoleId:"",
- showPhoneStatus:0,//手机号显隐
- userRoleType:'',
+ deptId: "", //部门
+ roleId: "", //角色
+ newRoleId: "",
+ showPhoneStatus: 0, //手机号显隐
+ userRoleType: "",
},
- userRoleTypeList:[],
- userRoleList:[],
+ userRoleTypeList: [],
+ userRoleList: [],
phoneFlag: false,
rolesOptions: [],
checkHouse: [],
@@ -1107,12 +1142,12 @@ export default {
checkRole: [],
code: {},
formTitle: "新增",
- deptList:[],
+ deptList: [],
dialogFormVisible: false,
houseVisible: false,
deptTreeList: [], //部门树
roelFlag: false,
- losorgType:localStorage.getItem('orgType'),
+ losorgType: localStorage.getItem("orgType"),
systemFlag: true, //判断是否为系统用户
accountId: "",
passwordForm: {
@@ -1125,7 +1160,7 @@ export default {
phoneVisible: false, //验证手机号
userRoleFlag: true,
passwordVisible: false,
- dialogFormVisibleTwo:false,
+ dialogFormVisibleTwo: false,
orgList: [],
phoneRules: {
phone: [
@@ -1219,12 +1254,12 @@ export default {
this.deptGetOrgList(); //获取公司列表
this.getAgentList(); //获取代理商列表
this.userDict(
- {
- dictKey: localStorage.getItem('orgType'),
- dictType: 3,
- },
- "userRoleList"
- );
+ {
+ dictKey: localStorage.getItem("orgType"),
+ dictType: 3,
+ },
+ "userRoleList"
+ );
},
methods: {
// 区域改变
@@ -1403,7 +1438,7 @@ export default {
},
// 下一步
nextshow() {
- let that=this
+ let that = this;
this.$refs.phoneForm.validate((valid) => {
if (valid) {
// 验证电话号码
@@ -1412,33 +1447,33 @@ export default {
// 判断数据是否已经有了
if (res.data) {
// 由用户
- this.$api.api.userVerify({
- orgType:localStorage.getItem('orgType'),
- accountId:res.data.sysUser.accountId,
- username:res.data.sysUser.username,
- agentId:localStorage.getItem('agentId'),
- orgCode:localStorage.getItem('orgCode'),
- })
- .then(res1=>{
- // console.log(res1);
- this.phoneFlag = true;
- // console.log(res.data.sysUser);
- this.form.name = res.data.sysUser.name;
- this.form.username = res.data.sysUser.username;
- this.form.sex = res.data.sysUser.sex;
- this.phoneVisible=false
- this.dialogFormVisible = true;
- })
- .catch(err=>{
- console.log(err)
- })
-
+ this.$api.api
+ .userVerify({
+ orgType: localStorage.getItem("orgType"),
+ accountId: res.data.sysUser.accountId,
+ username: res.data.sysUser.username,
+ agentId: localStorage.getItem("agentId"),
+ orgCode: localStorage.getItem("orgCode"),
+ })
+ .then((res1) => {
+ // console.log(res1);
+ this.phoneFlag = true;
+ // console.log(res.data.sysUser);
+ this.form.name = res.data.sysUser.name;
+ this.form.username = res.data.sysUser.username;
+ this.form.sex = res.data.sysUser.sex;
+ this.phoneVisible = false;
+ this.dialogFormVisible = true;
+ })
+ .catch((err) => {
+ console.log(err);
+ });
} else {
// 没有用户
console.log("没有用户");
this.form.username = this.phoneForm.phone;
this.phoneFlag = false;
- this.phoneVisible=false
+ this.phoneVisible = false;
this.dialogFormVisible = true;
}
});
@@ -1447,13 +1482,13 @@ export default {
});
},
search() {
- this.page.current1
+ this.page.current1;
console.log(this.searchMsg, "搜索内容1");
// return
this.roleList();
},
search1() {
- this.page.current=1
+ this.page.current = 1;
console.log(this.searchMsg1, "搜索内容2");
// return
this.roleList();
@@ -1642,6 +1677,7 @@ export default {
orgType: localStorage.getItem("orgType"),
orgCode: localStorage.getItem("orgCode"),
agentId: localStorage.getItem("agentId"),
+ houseId: localStorage.getItem("houseId"),
})
.then((res) => {
// console.log(res);
@@ -1668,7 +1704,7 @@ export default {
async gochosehouse(row) {
console.log(row);
this.code = row;
- this.houseUserRoleType=row.userRoleType
+ this.houseUserRoleType = row.userRoleType;
this.accountId = row.accountId;
this.houseVisible = true;
// 判断是否有绑定以及绑定方式
@@ -1802,17 +1838,20 @@ export default {
handleSelectionChange1(e) {
this.checkHouse = [];
console.log(e);
- if(this.houseUserRoleType==6&&e.length>1){
+ if (this.houseUserRoleType == 6 && e.length > 1) {
// 单选
- this.$refs.multipleTable.clearSelection();
- this.$message.warning('您只能选择一个楼盘')
+ // this.$refs.multipleTable.clearSelection();
+ let idx = this.housedata.findIndex((item) => item.id == e[0].id);
+ if (idx != -1) {
+ this.$refs.multipleTable.toggleRowSelection(this.housedata[idx]);
+ }
+ this.$message.warning("您只能选择一个楼盘");
- return
+ return;
}
e.map((item) => {
this.checkHouse.push(item.id);
});
-
},
delIds() {
console.log(this.checkRole);
@@ -1877,9 +1916,12 @@ export default {
if (this.addFlag) {
this.$refs.form.validate((valid) => {
if (valid) {
- if(localStorage.getItem('orgType')==2||localStorage.getItem('orgType')==3){
+ if (
+ localStorage.getItem("orgType") == 2 ||
+ localStorage.getItem("orgType") == 3
+ ) {
// console.log(123);
- this.form.orgCode=localStorage.getItem('orgCode')
+ this.form.orgCode = localStorage.getItem("orgCode");
}
this.$api.api.addUser(this.form).then((res) => {
console.log(res);
@@ -1916,16 +1958,16 @@ export default {
this.form = {
name: "", //用户名
username: "", //手机号
- sex: '0', //性别
+ sex: "0", //性别
password: "", //密码
orgType: "", //组织类型
- houseId:"",
+ houseId: "",
roleId: "", //角色id
agentId: "", //代理商id
orgCode: "", //公司标识
userRoleType: "", //身份
- deptId:'',
- showPhoneStatus:0
+ deptId: "",
+ showPhoneStatus: 0,
};
this.roelFlag = false;
this.houseIdList = [];
@@ -2135,7 +2177,7 @@ export default {
if (idx == 0) {
this.$api.api
.findRoleByOrgCode({
- orgType:this.form.orgType,
+ orgType: this.form.orgType,
orgCode: e,
})
.then((res) => {
@@ -2144,7 +2186,7 @@ export default {
} else {
this.$api.api
.findRoleByOrgCode({
- orgType:this.form.orgType,
+ orgType: this.form.orgType,
agentId: e,
})
.then((res) => {
@@ -2153,54 +2195,54 @@ export default {
}
this.$forceUpdate();
},
- editTwo(row){
- this.formTwo.username=row.username
- this.formTwo.showPhoneStatus=row.showPhoneStatus
- this.formTwo.roleId=row.roleId
- this.form.orgType=row.orgType
- this.formTwo.accountId=row.accountId
- this.formTwo.orgType=row.orgType
- this.formTwo.houseId=row.houseId
- this.formTwo.newRoleId=row.roleId
- this.formTwo.deptId=row.deptId
- this.formTwo.userRoleType=row.userRoleType+''
+ editTwo(row) {
+ this.formTwo.username = row.username;
+ this.formTwo.showPhoneStatus = row.showPhoneStatus;
+ this.formTwo.roleId = row.roleId;
+ this.form.orgType = row.orgType;
+ this.formTwo.accountId = row.accountId;
+ this.formTwo.orgType = row.orgType;
+ this.formTwo.houseId = row.houseId;
+ this.formTwo.newRoleId = row.roleId;
+ this.formTwo.deptId = row.deptId;
+ this.formTwo.userRoleType = row.userRoleType + "";
console.log(this.formTwo);
// 获取角色列表
- this.typeChange1(row)
- this.userDict(
- {
- dictKey:row.orgType,
- dictType: 3,
- },
- "userRoleTypeList"
- );
+ this.typeChange1(row);
+ let obj = {
+ dictKey: row.orgType,
+ dictType: 3,
+ };
+ if (row.userRoleType != 6) {
+ obj.notInValue = 6;
+ }
+ this.userDict(obj, "userRoleTypeList");
// 获取部门列表
- this.dialogFormVisibleTwo=true
+ this.dialogFormVisibleTwo = true;
},
- editSureTwo(){
- this.$refs.formTwo.validate(valid=>{
- if(valid){
+ editSureTwo() {
+ this.$refs.formTwo.validate((valid) => {
+ if (valid) {
console.log(this.formTwo);
- this.$api.api.editRoleAndDept(this.formTwo)
- .then(res=>{
- this.$message.success('修改成功')
- this.dialogFormVisibleTwo=false
+ this.$api.api.editRoleAndDept(this.formTwo).then((res) => {
+ this.$message.success("修改成功");
+ this.dialogFormVisibleTwo = false;
this.roleList();
- })
+ });
}
- })
+ });
},
- getDeptList(houseId){
- this.$api.api
+ getDeptList(houseId) {
+ this.$api.api
.deptFindList({
- houseId
- })
- .then(res=>{
- this.deptList=res.data
+ houseId,
})
+ .then((res) => {
+ this.deptList = res.data;
+ });
},
- typeChange1(row) {
+ typeChange1(row) {
console.log(row);
this.userList = [];
this.identityList = [];
@@ -2209,7 +2251,7 @@ export default {
this.orgFlag = false;
this.$api.api
.findRoleByOrgCode({
- orgType:this.form.orgType,
+ orgType: this.form.orgType,
orgCode: null,
agentId: null,
})
@@ -2228,7 +2270,7 @@ export default {
// 楼盘 选择公司 角色 角色身份
this.orgFlag = true;
this.orgCodeChange(row.orgCode, 0);
- this.getDeptList(row.houseId)
+ this.getDeptList(row.houseId);
}
},
typeChange(e) {
@@ -2244,7 +2286,7 @@ export default {
// this.agentFlag = false;
this.$api.api
.findRoleByOrgCode({
- orgType:this.form.orgType,
+ orgType: this.form.orgType,
orgCode: null,
agentId: null,
})
@@ -2257,7 +2299,7 @@ export default {
this.roleFlag = true;
this.identityFlag = true;
// this.agentFlag = true;
- this.form.agentId=localStorage.getItem("agentId")
+ this.form.agentId = localStorage.getItem("agentId");
this.orgCodeChange(localStorage.getItem("agentId"), 1);
} else if (e == 2) {
// 公司 选择公司和角色
@@ -2265,7 +2307,7 @@ export default {
this.roleFlag = true;
this.identityFlag = true;
// this.agentFlag = false;
- this.form.orgCode=localStorage.getItem("orgCode")
+ this.form.orgCode = localStorage.getItem("orgCode");
this.orgCodeChange(localStorage.getItem("orgCode"), 0);
} else {
// 楼盘 选择公司 角色 角色身份
@@ -2273,9 +2315,9 @@ export default {
this.roleFlag = true;
this.identityFlag = true;
// this.agentFlag = false;
- this.form.houseId=localStorage.getItem("houseId")
+ this.form.houseId = localStorage.getItem("houseId");
this.orgCodeChange(localStorage.getItem("orgCode"), 0);
- this.getDeptList(localStorage.getItem('houseId'))
+ this.getDeptList(localStorage.getItem("houseId"));
}
// 字典表接口
this.userDict(