lancer 2 anni fa
parent
commit
f2f0c2072b
1 ha cambiato i file con 172 aggiunte e 130 eliminazioni
  1. +172
    -130
      src/views/admin/user/index.vue

+ 172
- 130
src/views/admin/user/index.vue Vedi File

@@ -143,12 +143,12 @@
<el-option label="经理" value="5"></el-option> <el-option label="经理" value="5"></el-option>
<el-option label="置业顾问" value="6"></el-option> --> <el-option label="置业顾问" value="6"></el-option> -->
<el-option <el-option
v-for="item in userRoleList"
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue"
>
</el-option>
v-for="item in userRoleList"
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue"
>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="lockFlag"> <el-form-item label="状态" prop="lockFlag">
@@ -197,7 +197,11 @@
<el-table-column prop="createTime" label="注册时间"> </el-table-column> <el-table-column prop="createTime" label="注册时间"> </el-table-column>
<el-table-column prop="address" label="操作"> <el-table-column prop="address" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="resetPassword" @click="resetPwd(scope.row)" type="text" size="small"
<el-button
v-if="resetPassword"
@click="resetPwd(scope.row)"
type="text"
size="small"
>密码重置</el-button >密码重置</el-button
> >
<el-button <el-button
@@ -310,20 +314,38 @@
<el-table-column prop="createTime" label="添加时间"> </el-table-column> <el-table-column prop="createTime" label="添加时间"> </el-table-column>
<el-table-column prop="address" label="操作" fixed="right" width="150"> <el-table-column prop="address" label="操作" fixed="right" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="editTwo(scope.row)" v-if="sys_user_edit1" type="text" size="small"
<el-button
@click="editTwo(scope.row)"
v-if="sys_user_edit1"
type="text"
size="small"
>编辑</el-button >编辑</el-button
> >
<el-button <el-button
v-if="(scope.row.orgType == 3)&&sys_user_choseHouse&&(scope.row.userRoleType != 8&&scope.row.userRoleType != 7)"
v-if="
scope.row.orgType == 3 &&
sys_user_choseHouse &&
scope.row.userRoleType != 8 &&
scope.row.userRoleType != 7
"
@click="gochosehouse(scope.row)" @click="gochosehouse(scope.row)"
type="text" type="text"
size="small" size="small"
>楼盘选择</el-button >楼盘选择</el-button
> >
<el-button v-if="sys_user_bind" @click="startorg(scope.row)" type="text" size="small">
<el-button
v-if="sys_user_bind"
@click="startorg(scope.row)"
type="text"
size="small"
>
{{ scope.row.lockFlag == 0 ? "禁用" : "启用" }}</el-button {{ scope.row.lockFlag == 0 ? "禁用" : "启用" }}</el-button
> >
<el-button v-if="sys_user_del" @click="deletes(scope.row)" type="text" size="small"
<el-button
v-if="sys_user_del"
@click="deletes(scope.row)"
type="text"
size="small"
>移除</el-button >移除</el-button
> >
</template> </template>
@@ -374,7 +396,7 @@
<el-radio label="1">女</el-radio> <el-radio label="1">女</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="手机号加密" prop="showPhoneStatus" v-if="addFlag">
<el-form-item label="手机号加密" prop="showPhoneStatus" v-if="addFlag">
<el-radio-group v-model="form.showPhoneStatus"> <el-radio-group v-model="form.showPhoneStatus">
<el-radio :label="0">是</el-radio> <el-radio :label="0">是</el-radio>
<el-radio :label="1">否</el-radio> <el-radio :label="1">否</el-radio>
@@ -396,11 +418,19 @@
v-model="form.orgType" v-model="form.orgType"
placeholder="请选择组织类型" placeholder="请选择组织类型"
style="width: 370px" style="width: 370px"
:disabled='losorgType!=2'
:disabled="losorgType != 2"
@change="typeChange" @change="typeChange"
> >
<el-option v-if='losorgType!=2' label="平台" :value="0"></el-option>
<el-option v-if='losorgType!=2' label="代理商" :value="1"></el-option>
<el-option
v-if="losorgType != 2"
label="平台"
:value="0"
></el-option>
<el-option
v-if="losorgType != 2"
label="代理商"
:value="1"
></el-option>
<el-option label="公司" :value="2"></el-option> <el-option label="公司" :value="2"></el-option>
<el-option label="楼盘" :value="3"></el-option> <el-option label="楼盘" :value="3"></el-option>
</el-select> </el-select>
@@ -489,7 +519,11 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="部门:" v-if="orgFlag && addFlag&&losorgType==3" prop="deptId">
<el-form-item
label="部门:"
v-if="orgFlag && addFlag && losorgType == 3"
prop="deptId"
>
<el-select <el-select
v-model="form.deptId" v-model="form.deptId"
filterable filterable
@@ -513,11 +547,8 @@
</div> </div>
</el-dialog> </el-dialog>


<!-- 组织用户编辑 -->
<el-dialog
title="编辑用户"
:visible.sync="dialogFormVisibleTwo"
>
<!-- 组织用户编辑 -->
<el-dialog title="编辑用户" :visible.sync="dialogFormVisibleTwo">
<el-form <el-form
:model="formTwo" :model="formTwo"
label-width="120px" label-width="120px"
@@ -531,13 +562,13 @@
style="width: 370px" style="width: 370px"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="手机号加密" prop="showPhoneStatus" >
<el-form-item label="手机号加密" prop="showPhoneStatus">
<el-radio-group v-model="formTwo.showPhoneStatus"> <el-radio-group v-model="formTwo.showPhoneStatus">
<el-radio :label="0">是</el-radio> <el-radio :label="0">是</el-radio>
<el-radio :label="1">否</el-radio> <el-radio :label="1">否</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="角色:" prop="newRoleId">
<el-form-item label="角色:" prop="newRoleId">
<el-select <el-select
v-model="formTwo.newRoleId" v-model="formTwo.newRoleId"
filterable filterable
@@ -555,18 +586,22 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="身份:" prop="newRoleId" v-if="formTwo.userRoleType!=6&&formTwo.userRoleType!=7&&formTwo.userRoleType!=8"> --> <!-- <el-form-item label="身份:" prop="newRoleId" v-if="formTwo.userRoleType!=6&&formTwo.userRoleType!=7&&formTwo.userRoleType!=8"> -->
<el-form-item label="身份:" v-if="orgFlag" prop="newRoleId">
<el-form-item label="身份:" v-if="orgFlag" prop="newRoleId">
<el-select <el-select
v-model="formTwo.userRoleType" v-model="formTwo.userRoleType"
filterable filterable
:disabled='formTwo.userRoleType==6||formTwo.userRoleType==7||formTwo.userRoleType==8'
:disabled="
formTwo.userRoleType == 6 ||
formTwo.userRoleType == 7 ||
formTwo.userRoleType == 8
"
value-key="key" value-key="key"
style="width: 370px" style="width: 370px"
placeholder="请选择身份" placeholder="请选择身份"
> >
<el-option <el-option
v-for="item in userRoleTypeList" v-for="item in userRoleTypeList"
:key="item.dictValue"
:key="item.dictValue"
:label="item.dictName" :label="item.dictName"
:value="item.dictValue" :value="item.dictValue"
> >
@@ -985,7 +1020,7 @@ export default {
fourthList: [], fourthList: [],
allCityList: [], allCityList: [],
managerList: [], managerList: [],
houseUserRoleType:'',
houseUserRoleType: "",
bindFlag: "0", bindFlag: "0",
treeClick: "", //点击样式 treeClick: "", //点击样式
keywork: "", //搜索关键字 keywork: "", //搜索关键字
@@ -994,7 +1029,7 @@ export default {
orgFlag: false, orgFlag: false,
roleFlag: false, roleFlag: false,
identityFlag: false, identityFlag: false,
editVisible:false,
editVisible: false,
agentFlag: false, agentFlag: false,
treeProps: { treeProps: {
children: "children", children: "children",
@@ -1048,28 +1083,28 @@ export default {
form: { form: {
name: "", //用户名 name: "", //用户名
username: "", //手机号 username: "", //手机号
sex: '0', //性别
sex: "0", //性别
password: "", //密码 password: "", //密码
orgType: "", //组织类型 orgType: "", //组织类型
roleId: "", //角色id roleId: "", //角色id
agentId: "", //代理商id agentId: "", //代理商id
orgCode: "", //公司标识 orgCode: "", //公司标识
userRoleType: "", //身份 userRoleType: "", //身份
deptId:'',//部门
houseId:"",
showPhoneStatus:0//手机号显隐
deptId: "", //部门
houseId: "",
showPhoneStatus: 0, //手机号显隐
}, },
formTwo: { formTwo: {
username: "", //手机号 username: "", //手机号
userRoleType: "", //身份 userRoleType: "", //身份
deptId:'',//部门
roleId:'',//角色
newRoleId:"",
showPhoneStatus:0,//手机号显隐
userRoleType:'',
deptId: "", //部门
roleId: "", //角色
newRoleId: "",
showPhoneStatus: 0, //手机号显隐
userRoleType: "",
}, },
userRoleTypeList:[],
userRoleList:[],
userRoleTypeList: [],
userRoleList: [],
phoneFlag: false, phoneFlag: false,
rolesOptions: [], rolesOptions: [],
checkHouse: [], checkHouse: [],
@@ -1107,12 +1142,12 @@ export default {
checkRole: [], checkRole: [],
code: {}, code: {},
formTitle: "新增", formTitle: "新增",
deptList:[],
deptList: [],
dialogFormVisible: false, dialogFormVisible: false,
houseVisible: false, houseVisible: false,
deptTreeList: [], //部门树 deptTreeList: [], //部门树
roelFlag: false, roelFlag: false,
losorgType:localStorage.getItem('orgType'),
losorgType: localStorage.getItem("orgType"),
systemFlag: true, //判断是否为系统用户 systemFlag: true, //判断是否为系统用户
accountId: "", accountId: "",
passwordForm: { passwordForm: {
@@ -1125,7 +1160,7 @@ export default {
phoneVisible: false, //验证手机号 phoneVisible: false, //验证手机号
userRoleFlag: true, userRoleFlag: true,
passwordVisible: false, passwordVisible: false,
dialogFormVisibleTwo:false,
dialogFormVisibleTwo: false,
orgList: [], orgList: [],
phoneRules: { phoneRules: {
phone: [ phone: [
@@ -1219,12 +1254,12 @@ export default {
this.deptGetOrgList(); //获取公司列表 this.deptGetOrgList(); //获取公司列表
this.getAgentList(); //获取代理商列表 this.getAgentList(); //获取代理商列表
this.userDict( this.userDict(
{
dictKey: localStorage.getItem('orgType'),
dictType: 3,
},
"userRoleList"
);
{
dictKey: localStorage.getItem("orgType"),
dictType: 3,
},
"userRoleList"
);
}, },
methods: { methods: {
// 区域改变 // 区域改变
@@ -1403,7 +1438,7 @@ export default {
}, },
// 下一步 // 下一步
nextshow() { nextshow() {
let that=this
let that = this;
this.$refs.phoneForm.validate((valid) => { this.$refs.phoneForm.validate((valid) => {
if (valid) { if (valid) {
// 验证电话号码 // 验证电话号码
@@ -1412,33 +1447,33 @@ export default {
// 判断数据是否已经有了 // 判断数据是否已经有了
if (res.data) { 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 { } else {
// 没有用户 // 没有用户
console.log("没有用户"); console.log("没有用户");
this.form.username = this.phoneForm.phone; this.form.username = this.phoneForm.phone;
this.phoneFlag = false; this.phoneFlag = false;
this.phoneVisible=false
this.phoneVisible = false;
this.dialogFormVisible = true; this.dialogFormVisible = true;
} }
}); });
@@ -1447,13 +1482,13 @@ export default {
}); });
}, },
search() { search() {
this.page.current1
this.page.current1;
console.log(this.searchMsg, "搜索内容1"); console.log(this.searchMsg, "搜索内容1");
// return // return
this.roleList(); this.roleList();
}, },
search1() { search1() {
this.page.current=1
this.page.current = 1;
console.log(this.searchMsg1, "搜索内容2"); console.log(this.searchMsg1, "搜索内容2");
// return // return
this.roleList(); this.roleList();
@@ -1642,6 +1677,7 @@ export default {
orgType: localStorage.getItem("orgType"), orgType: localStorage.getItem("orgType"),
orgCode: localStorage.getItem("orgCode"), orgCode: localStorage.getItem("orgCode"),
agentId: localStorage.getItem("agentId"), agentId: localStorage.getItem("agentId"),
houseId: localStorage.getItem("houseId"),
}) })
.then((res) => { .then((res) => {
// console.log(res); // console.log(res);
@@ -1668,7 +1704,7 @@ export default {
async gochosehouse(row) { async gochosehouse(row) {
console.log(row); console.log(row);
this.code = row; this.code = row;
this.houseUserRoleType=row.userRoleType
this.houseUserRoleType = row.userRoleType;
this.accountId = row.accountId; this.accountId = row.accountId;
this.houseVisible = true; this.houseVisible = true;
// 判断是否有绑定以及绑定方式 // 判断是否有绑定以及绑定方式
@@ -1802,17 +1838,20 @@ export default {
handleSelectionChange1(e) { handleSelectionChange1(e) {
this.checkHouse = []; this.checkHouse = [];
console.log(e); 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) => { e.map((item) => {
this.checkHouse.push(item.id); this.checkHouse.push(item.id);
}); });

}, },
delIds() { delIds() {
console.log(this.checkRole); console.log(this.checkRole);
@@ -1877,9 +1916,12 @@ export default {
if (this.addFlag) { if (this.addFlag) {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
if(localStorage.getItem('orgType')==2||localStorage.getItem('orgType')==3){
if (
localStorage.getItem("orgType") == 2 ||
localStorage.getItem("orgType") == 3
) {
// console.log(123); // console.log(123);
this.form.orgCode=localStorage.getItem('orgCode')
this.form.orgCode = localStorage.getItem("orgCode");
} }
this.$api.api.addUser(this.form).then((res) => { this.$api.api.addUser(this.form).then((res) => {
console.log(res); console.log(res);
@@ -1916,16 +1958,16 @@ export default {
this.form = { this.form = {
name: "", //用户名 name: "", //用户名
username: "", //手机号 username: "", //手机号
sex: '0', //性别
sex: "0", //性别
password: "", //密码 password: "", //密码
orgType: "", //组织类型 orgType: "", //组织类型
houseId:"",
houseId: "",
roleId: "", //角色id roleId: "", //角色id
agentId: "", //代理商id agentId: "", //代理商id
orgCode: "", //公司标识 orgCode: "", //公司标识
userRoleType: "", //身份 userRoleType: "", //身份
deptId:'',
showPhoneStatus:0
deptId: "",
showPhoneStatus: 0,
}; };
this.roelFlag = false; this.roelFlag = false;
this.houseIdList = []; this.houseIdList = [];
@@ -2135,7 +2177,7 @@ export default {
if (idx == 0) { if (idx == 0) {
this.$api.api this.$api.api
.findRoleByOrgCode({ .findRoleByOrgCode({
orgType:this.form.orgType,
orgType: this.form.orgType,
orgCode: e, orgCode: e,
}) })
.then((res) => { .then((res) => {
@@ -2144,7 +2186,7 @@ export default {
} else { } else {
this.$api.api this.$api.api
.findRoleByOrgCode({ .findRoleByOrgCode({
orgType:this.form.orgType,
orgType: this.form.orgType,
agentId: e, agentId: e,
}) })
.then((res) => { .then((res) => {
@@ -2153,54 +2195,54 @@ export default {
} }
this.$forceUpdate(); 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); 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); 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(); this.roleList();
})
});
} }
})
});
}, },
getDeptList(houseId){
this.$api.api
getDeptList(houseId) {
this.$api.api
.deptFindList({ .deptFindList({
houseId
})
.then(res=>{
this.deptList=res.data
houseId,
}) })
.then((res) => {
this.deptList = res.data;
});
}, },
typeChange1(row) {
typeChange1(row) {
console.log(row); console.log(row);
this.userList = []; this.userList = [];
this.identityList = []; this.identityList = [];
@@ -2209,7 +2251,7 @@ export default {
this.orgFlag = false; this.orgFlag = false;
this.$api.api this.$api.api
.findRoleByOrgCode({ .findRoleByOrgCode({
orgType:this.form.orgType,
orgType: this.form.orgType,
orgCode: null, orgCode: null,
agentId: null, agentId: null,
}) })
@@ -2228,7 +2270,7 @@ export default {
// 楼盘 选择公司 角色 角色身份 // 楼盘 选择公司 角色 角色身份
this.orgFlag = true; this.orgFlag = true;
this.orgCodeChange(row.orgCode, 0); this.orgCodeChange(row.orgCode, 0);
this.getDeptList(row.houseId)
this.getDeptList(row.houseId);
} }
}, },
typeChange(e) { typeChange(e) {
@@ -2244,7 +2286,7 @@ export default {
// this.agentFlag = false; // this.agentFlag = false;
this.$api.api this.$api.api
.findRoleByOrgCode({ .findRoleByOrgCode({
orgType:this.form.orgType,
orgType: this.form.orgType,
orgCode: null, orgCode: null,
agentId: null, agentId: null,
}) })
@@ -2257,7 +2299,7 @@ export default {
this.roleFlag = true; this.roleFlag = true;
this.identityFlag = true; this.identityFlag = true;
// this.agentFlag = true; // this.agentFlag = true;
this.form.agentId=localStorage.getItem("agentId")
this.form.agentId = localStorage.getItem("agentId");
this.orgCodeChange(localStorage.getItem("agentId"), 1); this.orgCodeChange(localStorage.getItem("agentId"), 1);
} else if (e == 2) { } else if (e == 2) {
// 公司 选择公司和角色 // 公司 选择公司和角色
@@ -2265,7 +2307,7 @@ export default {
this.roleFlag = true; this.roleFlag = true;
this.identityFlag = true; this.identityFlag = true;
// this.agentFlag = false; // this.agentFlag = false;
this.form.orgCode=localStorage.getItem("orgCode")
this.form.orgCode = localStorage.getItem("orgCode");
this.orgCodeChange(localStorage.getItem("orgCode"), 0); this.orgCodeChange(localStorage.getItem("orgCode"), 0);
} else { } else {
// 楼盘 选择公司 角色 角色身份 // 楼盘 选择公司 角色 角色身份
@@ -2273,9 +2315,9 @@ export default {
this.roleFlag = true; this.roleFlag = true;
this.identityFlag = true; this.identityFlag = true;
// this.agentFlag = false; // this.agentFlag = false;
this.form.houseId=localStorage.getItem("houseId")
this.form.houseId = localStorage.getItem("houseId");
this.orgCodeChange(localStorage.getItem("orgCode"), 0); this.orgCodeChange(localStorage.getItem("orgCode"), 0);
this.getDeptList(localStorage.getItem('houseId'))
this.getDeptList(localStorage.getItem("houseId"));
} }
// 字典表接口 // 字典表接口
this.userDict( this.userDict(


Caricamento…
Annulla
Salva