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="6"></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-form-item>
<el-form-item label="状态" prop="lockFlag">
@@ -197,7 +197,11 @@
<el-table-column prop="createTime" label="注册时间"> </el-table-column>
<el-table-column prop="address" label="操作">
<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
@@ -310,20 +314,38 @@
<el-table-column prop="createTime" label="添加时间"> </el-table-column>
<el-table-column prop="address" label="操作" fixed="right" width="150">
<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
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)"
type="text"
size="small"
>楼盘选择</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
>
<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
>
</template>
@@ -374,7 +396,7 @@
<el-radio label="1">女</el-radio>
</el-radio-group>
</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 :label="0">是</el-radio>
<el-radio :label="1">否</el-radio>
@@ -396,11 +418,19 @@
v-model="form.orgType"
placeholder="请选择组织类型"
style="width: 370px"
:disabled='losorgType!=2'
:disabled="losorgType != 2"
@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="3"></el-option>
</el-select>
@@ -489,7 +519,11 @@
</el-option>
</el-select>
</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
v-model="form.deptId"
filterable
@@ -513,11 +547,8 @@
</div>
</el-dialog>

<!-- 组织用户编辑 -->
<el-dialog
title="编辑用户"
:visible.sync="dialogFormVisibleTwo"
>
<!-- 组织用户编辑 -->
<el-dialog title="编辑用户" :visible.sync="dialogFormVisibleTwo">
<el-form
:model="formTwo"
label-width="120px"
@@ -531,13 +562,13 @@
style="width: 370px"
></el-input>
</el-form-item>
<el-form-item label="手机号加密" prop="showPhoneStatus" >
<el-form-item label="手机号加密" prop="showPhoneStatus">
<el-radio-group v-model="formTwo.showPhoneStatus">
<el-radio :label="0">是</el-radio>
<el-radio :label="1">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="角色:" prop="newRoleId">
<el-form-item label="角色:" prop="newRoleId">
<el-select
v-model="formTwo.newRoleId"
filterable
@@ -555,18 +586,22 @@
</el-select>
</el-form-item>
<!-- <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
v-model="formTwo.userRoleType"
filterable
:disabled='formTwo.userRoleType==6||formTwo.userRoleType==7||formTwo.userRoleType==8'
:disabled="
formTwo.userRoleType == 6 ||
formTwo.userRoleType == 7 ||
formTwo.userRoleType == 8
"
value-key="key"
style="width: 370px"
placeholder="请选择身份"
>
<el-option
v-for="item in userRoleTypeList"
:key="item.dictValue"
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue"
>
@@ -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(


Caricamento…
Annulla
Salva