Browse Source

init

newStyle
lancer 3 years ago
parent
commit
ec22e9fa92
3 changed files with 207 additions and 164 deletions
  1. +33
    -1
      src/api/modules/api.js
  2. +172
    -161
      src/views/admin/user/index.vue
  3. +2
    -2
      vue.config.js

+ 33
- 1
src/api/modules/api.js View File

@@ -85,7 +85,7 @@ export function userDelByIds(query) {
// 获取公司列表
export function deptGetOrgList(query) {
return request({
url: '/admin/dept/getOrgList',
url: '/admin/dept/deptGetOrgList',
method: 'get',
params: query
})
@@ -219,3 +219,35 @@ export function verPhone(username) {
method: 'get',
})
}
//获取用户代理商
export function findMyAgent(query) {
return request({
url: '/autoSR/zkagent/findMyAgent',
method: 'get',
params:query
})
}
//获取用户代理商
export function findMyOrg(query) {
return request({
url: '/autoSR/zkorg/findMyOrg',
method: 'get',
params:query
})
}
// 获取当前公司代理商的角色
export function findRoleByOrgCode(data) {
return request({
url: '/admin/role/findRoleByCondition',
method:'post',
data
})
}
// 添加用户
export function addUser(data) {
return request({
url: '/admin/user',
method:'post',
data
})
}

+ 172
- 161
src/views/admin/user/index.vue View File

@@ -110,7 +110,6 @@
>
</el-table-column>
<el-table-column
prop="userRoleTypeName"
label="性别">
<template slot-scope="{row}">
{{row.sex==0?'男':'女'}}
@@ -171,36 +170,34 @@
>
</el-table-column>
<el-table-column
prop="userRoleTypeName"
label="性别">
prop="orgName"
label="所属组织">
</el-table-column>
<el-table-column
prop="所属组织"
label="公司">
prop=""
label="组织类型">
</el-table-column>
<el-table-column
prop="createTime"
label="注册时间">
label="组织角色">
</el-table-column>
<el-table-column
prop="createTime"
label="用户身份">
</el-table-column>
<el-table-column
prop="createTime"
label="状态">
</el-table-column>
<el-table-column
prop="createTime"
label="添加时间">
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-tooltip style="font-size:18px" effect="dark" content="密码重置" placement="top-start">
<i class="el-icon-unlock" style="color:#ff892a;" @click="resetPwd(scope.row)"></i>
</el-tooltip>
<el-tooltip style="font-size:18px" effect="dark" content="查看" placement="top-start">
<i class="el-icon-zoom-in" style="color:#008EF2;" @click="editRole(scope.row,true)"></i>
</el-tooltip>
<el-tooltip style="font-size:18px" effect="dark" content="编辑" placement="top-start">
<i class="el-icon-edit" style="color:red" @click="editRole(scope.row,false)"></i>
</el-tooltip>
<el-tooltip style="font-size:18px" effect="dark" content="删除" placement="top-start">
<i class="el-icon-close" style="color:#428bca" @click="deletes(scope.row)"></i>
</el-tooltip>
<el-tooltip style="font-size:18px" effect="dark" content="修改客户信息状态" placement="top-start">
<i class="el-icon-view" style="color:#428bca" @click="editStatus(scope.row)"></i>
</el-tooltip>
<el-button @click="gochosehouse(scope.row)" type="text" size="small">楼盘选择</el-button>
</template>
</el-table-column>
</el-table>
@@ -220,92 +217,70 @@

<el-dialog :title="formTitle" :visible.sync="dialogFormVisible" @close='resetForm'>
<el-form :model="form" label-width="120px" ref="form" :rules="rules" :disabled='editFlag'>
<el-form-item label="状态:">
<el-switch v-model="form.lockFlag" active-value="0" inactive-value="9"></el-switch>
</el-form-item>
<el-form-item label="性别:" prop="sex">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option label="男" value="0"></el-option>
<el-option label="女" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="用户类型:" prop="sign" v-if="sign!=1">
<el-select v-model="form.sign" placeholder="请选择用户类型" @change="signChange">
<el-option label="系统用户" :value="0"></el-option>
<el-option label="公司用户" :value="1"></el-option>
<el-option label="运营用户" :value="2"></el-option>
</el-select>
<el-form-item label="登录手机" prop="username">
<el-input v-model="form.username" :disabled='phoneFlag' style="width:370px"></el-input>
</el-form-item>
<el-form-item label="用户名" prop="name">
<el-input v-model="form.name" :disabled='phoneFlag' style="width:370px"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="form.sex">
<el-radio label="0">男</el-radio>
<el-radio label="1">女</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="身份:" prop="userRoleType" v-if="sign==1||form.sign==1">
<el-select v-model="form.userRoleType" placeholder="请选择用户身份">
<el-option label="项目总" value="2"></el-option>
<el-option label="客服" value="3"></el-option>
<el-option label="策划" value="4"></el-option>
<el-option label="经理" value="5"></el-option>
<el-option label="置业顾问" value="6"></el-option>
<el-form-item label="登录密码" prop="password" v-if="!phoneFlag">
<el-input v-model="form.password" style="width:370px" show-password></el-input>
</el-form-item>
<el-form-item label="组织类型:" prop="orgType">
<el-select v-model="form.orgType" placeholder="请选择组织类型" style="width:370px" @change="typeChange">
<el-option label="平台" :value="0"></el-option>
<el-option label="代理商" :value="1"></el-option>
<el-option label="公司" :value="2"></el-option>
<el-option label="楼盘" :value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="登录名:" prop="username">
<el-input v-model="form.username" ></el-input>
</el-form-item>
<el-form-item label="公司:" prop="deptId" >
<!-- <el-form-item label="公司:" prop="deptId" v-if="form.sign==1"> -->
<!-- <el-select size="small" placeholder="请选择" clearable v-model="form.deptName" @clear="selectClear">
<el-option class="option-style" :label="form.deptName" :value="form.deptId">
<el-input class="search" size="small" placeholder="输入关键字进行过滤" v-model="keywork" @click.stop.native></el-input>
<el-tree
ref="tree"
:data="deptTreeList"
:props="treeProps"
:filter-node-method="filterNode"
@node-click="nodeClick"
@check-change="checkChange">
<div slot-scope="{node, data}">
<span :class="[{'tree-click': treeClick==data.aid}]">{{data.name}}</span>
</div>
</el-tree>
</el-option>
</el-select> -->
<avue-input-tree
ref="tree"
v-model="form.deptId"
:dic="deptTreeList"
:props="defaultProps1"
@change="nodeClick($event)"
@blur="radioBlur"
placeholder="请选择所属公司"/>
</el-form-item>
<!-- <el-form-item label="公司角色:" v-if="roelFlag&&form.sign==1" prop="userRoleId"> -->
<el-form-item label="公司角色:" v-if="roelFlag" prop="userRoleId">
<el-select v-model="form.userRoleId" placeholder="请选择公司角色" @change="userRoleIdChange">
<el-form-item label="选择公司:" v-if="orgFlag" prop="orgCode">
<el-select v-model="form.orgCode" filterable placeholder="请选择公司" style="width:370px" @change="orgCodeChange($event,0)">
<el-option
v-for="item in RoleByOrgCodeList"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
v-for="item in orgList"
:key="item.orgCode"
:label="item.name"
:value="item.orgCode"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户名:" prop="name">
<el-input v-model="form.name" ></el-input>
</el-form-item>
<el-form-item label="楼盘:" prop="houseIdList" v-if="form.sign!=0">
<el-select v-model="houseIdList" multiple value-key="key" placeholder="请选择楼盘" @change="houseListChange">
<el-form-item label="选择代理商:" v-if="agentFlag" prop="agentId">
<el-select v-model="form.agentId" filterable placeholder="请选择代理商" style="width:370px" @change="orgCodeChange($event,1)">
<el-option
v-for="item in houseNameList"
v-for="item in agentList"
:key="item.id"
:label="item.propertyName"
:label="item.agentName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="证件号码:" prop="identityId">
<el-input v-model="form.identityId" ></el-input>
<el-form-item label="角色:" v-if="roleFlag" prop="roleId">
<el-select v-model="form.roleId" filterable value-key="key" style="width:370px" placeholder="请选择角色">
<el-option
v-for="item in userList"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="描述:" prop="description">
<el-input v-model="form.description" type="textarea"></el-input>
<el-form-item label="身份" prop="userRoleType" v-if="identityFlag">
<el-select v-model="form.userRoleType" value-key="key" style="width:370px" placeholder="请选择身份" >
<el-option label="项目总" value="2"></el-option>
<el-option label="客服" value="3"></el-option>
<el-option label="策划" value="4"></el-option>
<el-option label="经理" value="5"></el-option>
<el-option label="置业顾问" value="6"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -371,6 +346,10 @@
keywork: '',       //搜索关键字
selectLabel: '',   //下拉框显示名称
selectValue: '',
orgFlag:false,
roleFlag:false,
identityFlag:false,
agentFlag:false,
treeProps: {
  children: "children",
  label: "label"
@@ -411,22 +390,20 @@
listLoading: true,
role: [],
houseIdList:[],
agentList:[],
codeOrg:'',
form: {
lockFlag:"0",//状态
sex:'',//性别
sign:null,//用户类型
username:'',//用户名
deptName:'',
userRoleType:null,
deptId:'',//公司id
name:'',//用户名
houseIdList:'',//楼盘id
identityId:'',//证件号码
description:'',//描述
userRoleId:'',

username:'',//手机号
sex:'0',//性别
password:'',//密码
orgType:'',//组织类型
roleId:'',//角色id
agentId:'',//代理商id
orgCode:'',//公司标识
userRoleType:'',//身份
},
phoneFlag:false,
rolesOptions: [],
searchMsg:{
flag:'1',
@@ -448,7 +425,7 @@
roleNameList:[],
editFlag:false,
addFlag:true,
houseNameList:[],
userList:[],
orgNameList:[],
RoleByOrgCodeList:[],
tableData:[],
@@ -478,36 +455,35 @@
passwordRules:{
password: [
{ required: true, message: '请填写密码', trigger: 'blur' },
{ min: 6, max: 11, message: '长度在 6 到 11 位', trigger: 'blur' }
]
},
rules:{
sex: [
{ required: true, message: '请选择性别', trigger: 'blur' },
username: [
{ required: true, message: '请填写登录手机', trigger: 'blur' },
],
name: [
{ required: true, message: '请填写用户名', trigger: 'blur' },
],
sign: [
{ required: true, message: '请选择用户类型', trigger: 'blur' },
password: [
{ required: true, message: '请填写密码', trigger: 'blur' },
{ min: 6, max: 11, message: '长度在 6 到 11 位', trigger: 'blur' }
],
username: [
{ required: true, message: '请填写用户登录名', trigger: 'blur' },
orgType: [
{ required: true, message: '请选择组织类型', trigger: 'blur' },
],
roleName: [
{ required: true, message: '请选择用户角色', trigger: 'blur' },
agentId: [
{ required: true, message: '请选择代理商', trigger: 'blur' },
],
deptId: [
orgCode: [
{ required: true, message: '请选择公司', trigger: 'blur' },
],
name: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
],
userRoleId:[
{ required: true, message: '请选择公司角色', trigger: 'blur' },
roleId:[
{ required: true, message: '请选择角色', trigger: 'blur' },
],
userRoleType:[
{ required: true, message: '请选择角色身份', trigger: 'blur' },
],
houseIdList: [
{ required: true, message: '请选择楼盘', trigger: 'blur' },
],
}
}
},
@@ -543,10 +519,10 @@
// let info=getStore({name:'userInfo'})
// this.sign=info.sign
// console.log(info);
// this.init()
this.roleList() //table 列表
// this.userDeptTree()// 获取部门树
// this.deptGetOrgList()//获取公司列表
this.deptGetOrgList()//获取公司列表
this.getAgentList()//获取代理商列表
},
methods: {
// 下一步
@@ -559,15 +535,23 @@
console.log(res)
// 判断数据是否已经有了
if(res.data){
// 没有用户
// 由用户
this.phoneFlag=true
console.log(res.data.sysUser);
this.form.name=res.data.sysUser.name
this.form.username=res.data.sysUser.phone
this.form.sex=res.data.sysUser.sex
}else{
// 没有用户
console.log('没有用户');
this.form.username=this.phoneForm.phone
this.phoneFlag=false
}
this.phoneVisible=false
this.dialogFormVisible=true
})
// return
this.phoneVisible=false
this.dialogFormVisible=true

}
})

@@ -639,16 +623,6 @@
}
})
}
// fetchList({...this.page,...this.searchMsg})
// .then(res=>{
// // console.log(res);
// if(res.code==0){
// this.tableData=res.data.records
// this.page.total=res.data.total
// }else{
// this.$message.waring(res.msg)
// }
// })
},
// 获取部门树
userDeptTree(){
@@ -661,8 +635,9 @@
}
})
},
houseListChange(e){
this.form.houseIdList=e.join(',')
// 去楼盘选择
gochosehouse(row){
console.log(row)
},
// 获取用户信息
getUserMsg(userId){
@@ -741,11 +716,9 @@
if(this.addFlag){
this.$refs.form.validate((valid) => {
if (valid) {
this.form.sign=this.form.sign/1
this.form.userRoleType?this.form.userRoleType=this.form.userRoleType+'':this.form.userRoleType=null
this.$api.api.addUserMsg(this.form)
this.$api.api.addUser(this.form)
.then(res=>{
// console.log(res);
console.log(res);
this.roleList()
this.dialogFormVisible=false
})
@@ -757,8 +730,6 @@
}else{
this.$refs.form.validate((valid) => {
if (valid) {
this.form.sign=this.form.sign/1
this.form.userRoleType?this.form.userRoleType=this.form.userRoleType+'':this.form.userRoleType=null
this.$api.api.editUserMsg(this.form)
.then(res=>{
// console.log(res);
@@ -839,12 +810,20 @@
},
// 获取公司列表
deptGetOrgList(){
this.$api.api.deptGetOrgList()
this.$api.api.findMyOrg({orgType:localStorage.getItem('orgType')})
.then(res=>{
console.log(res);
this.orgList=res.data
})
},
getAgentList(){
// console.log(localStorage.getItem('orgType'))
this.$api.api.findMyAgent({orgType:localStorage.getItem('orgType')})
.then(res=>{
// console.log(res)
this.agentList=res.data
})
},
//分页器
handleSizeChange(val) {
this.page.pageSize = val;
@@ -923,29 +902,61 @@
checkChange(obj, node){
console.log(obj, node);
},
userRoleIdChange(e){
orgCodeChange(e,idx){
// console.log(e);
this.form.userRoleId=e
// console.log(this.form.userRoleId,'123');
this.form.roleId=''
if(idx==0){
this.$api.api.findRoleByOrgCode({
orgCode:e
})
.then(res=>{
this.userList=res.data
})
}else{
this.$api.api.findRoleByOrgCode({
agentId:e
})
.then(res=>{
this.userList=res.data
})
}
this.$forceUpdate()
},
signChange(e){
typeChange(e){
console.log(e);
if(e==0){
this.form.houseIdList=''
this.form.deptId=''
this.form.deptName=''
this.form.userRoleId=''
this.form.userRoleType=null
this.RoleByOrgCodeList=[]
this.houseIdList=[]
// 平台 只显示角色
this.orgFlag=false
this.roleFlag=true
this.identityFlag=false
this.agentFlag=false
this.$api.api.findRoleByOrgCode({
orgCode:null,
agentId:null
})
.then(res=>{
this.userList=res.data
})
}
else if(e==1){
// 代理商 选择代理商和角色
this.orgFlag=false
this.roleFlag=true
this.identityFlag=false
this.agentFlag=true
}
else if(e==2){
this.form.deptId=''
this.form.deptName=''
this.form.userRoleId=''
this.form.userRoleType=null
this.RoleByOrgCodeList=[]
// 公司 选择公司和角色
this.orgFlag=true
this.roleFlag=true
this.identityFlag=false
this.agentFlag=false
}else{
// 楼盘 选择公司 角色 角色身份
this.orgFlag=true
this.roleFlag=true
this.identityFlag=true
this.agentFlag=false
}
},
getList(page, params) {


+ 2
- 2
vue.config.js View File

@@ -3,8 +3,8 @@
* https://cli.vuejs.org/zh/config/
*/
// const url = 'http://pigx-gateway'
const url = 'http://39.97.167.65:9999' //测试
// const url = 'http://192.168.31.161:9999' //长龙
// const url = 'http://39.97.167.65:9999' //测试
const url = 'http://192.168.31.161:9999' //长龙
// const url = 'http://192.168.31.128:9999' //嘉豪

const CompressionWebpackPlugin = require('compression-webpack-plugin')


Loading…
Cancel
Save