From 54d3f1426c91aeeb50a167346c751ee9b46652cb Mon Sep 17 00:00:00 2001 From: lancer <1905818361@qq.com> Date: Thu, 28 Oct 2021 18:35:30 +0800 Subject: [PATCH] init --- src/api/modules/api.js | 43 +++++++- src/api/modules/http.js | 2 +- src/views/Customer/AgentManagement.vue | 2 +- src/views/Customer/Companymanagement.vue | 98 +++++++++++++++--- src/views/admin/dept/index.vue | 121 +++++++++++++++-------- src/views/admin/role/index.vue | 34 +++++-- src/views/admin/user/index.vue | 86 ++++++++++++---- src/views/building/index.vue | 84 +++++++++++++++- vue.config.js | 2 +- 9 files changed, 384 insertions(+), 88 deletions(-) diff --git a/src/api/modules/api.js b/src/api/modules/api.js index 9c83eea..87f956e 100644 --- a/src/api/modules/api.js +++ b/src/api/modules/api.js @@ -208,7 +208,7 @@ export function zkagentPage(query) { return request({ url: '/autoSR/zkagent/page', method: 'get', - params: query + params: {orgType:localStorage.getItem('orgType'),...query} }) } // 获取公司列表 @@ -755,3 +755,44 @@ export function deptDel(data) { data }) } +// 部门编辑 +export function deptUpdate(data) { + return request({ + url: 'admin/dept/update', + method:'post', + data + }) +} +// 根据楼盘获取部门 +export function deptFindList(query) { + return request({ + url: 'admin/dept/findList', + method:'get', + params:query + }) +} +// 获取代理商回显 +export function findAgentByOrgCode(query) { + return request({ + url: 'autoSR/zkagentcompanybind/findAgentByOrgCode', + method:'get', + params:query + }) +} +// 公司绑定代理商 +export function bindAgent(data) { + return request({ + url: 'autoSR/zkagentcompanybind/bindAgent', + method:'post', + data + }) +} +// 楼盘绑定代理商 +export function saveAgent(data) { + return request({ + url: 'autoSR/zkhouse/saveAgent', + method:'post', + data + }) +} + diff --git a/src/api/modules/http.js b/src/api/modules/http.js index 2d656ec..5db5804 100644 --- a/src/api/modules/http.js +++ b/src/api/modules/http.js @@ -68,7 +68,7 @@ export function getAgentList(query) { return request({ url: '/autoSR/zkagent/page', method:'get', - params:query + params: {orgType:localStorage.getItem('orgType'),...query} }) } diff --git a/src/views/Customer/AgentManagement.vue b/src/views/Customer/AgentManagement.vue index 6bab598..dc8dc21 100644 --- a/src/views/Customer/AgentManagement.vue +++ b/src/views/Customer/AgentManagement.vue @@ -313,7 +313,7 @@ - + 更换账号 删除 管理运营人员 + 绑定代理商 @@ -114,12 +115,12 @@ - + - + + @@ -177,12 +178,12 @@ - + - + + @@ -248,7 +249,7 @@ - + 保存 + + + + + + + + + + + + @@ -326,6 +347,7 @@ export default { dialogVisible2:false, dialogVisible3:false, operaVisible:false, + agentVisible:false, currentPage4:1, operatorName:'',//代理商名称 operationStaffName:'',//运营人员名称 @@ -361,11 +383,19 @@ export default { operaForm:{ operationalPeople:'' }, + agentForm:{ + agentId:[], + }, operaRules:{ operationalPeople: [ { required: true, message: '请选择运营人员', trigger: 'blur' }, ], }, + agentRule:{ + agentId: [ + { required: true, message: '请选择代理商', trigger: 'blur' }, + ], + }, editorrules:{ // operator: [ // { required: true, message: '请选择代理商', trigger: 'blur' }, @@ -400,6 +430,28 @@ export default { this.getcompanyList() }, methods: { + bindAgent(row){ + // console.log(row); + this.agentForm.orgCode=row.orgCode + this.agentForm.agentId=[] + this.findMyAgent() + this.agentVisible=true + }, + saveAgent(){ + this.$refs.agentForm.validate(valid=>{ + if(valid){ + console.log(this.agentForm); + this.$api.api.bindAgent({ + agentIds:this.agentForm.agentId.join(','), + orgCode:this.agentForm.orgCode + }) + .then(res=>{ + this.$message.success('操作成功') + this.agentVisible=false + }) + } + }) + }, saveOpera(){ this.$refs.operaForm.validate(valid=>{ if(valid){ @@ -458,7 +510,7 @@ export default { this.editoragentobj.address=res.data.address; // this.editoragentobj.operationStaff=res.data.operationStaff; }); - this.findMyAgent() + // this.findMyAgent() this.getparentIdList() this.clickprovinceId2(this.editoragentobj.provinceId) this.dialogVisible2=true; @@ -568,14 +620,16 @@ export default { //新增 infoadd(){ - this.findMyAgent() + // this.findMyAgent() this.getparentIdList() this.dialogVisible=true; }, //获取运营人员 getAllOperationsStaff(){ this.optionsoperationStaff=[]; - this.$api.http.getAllOperationsStaffByAgent().then((res) => { + this.$api.http.getAllOperationsStaffByAgent({ + agentId:localStorage.getItem('agentId') + }).then((res) => { this.optionsoperationStaff= res.data }); }, @@ -594,7 +648,27 @@ export default { this.$api.http.findMyAgent({orgType:this.orgType}).then((res) => { console.log(res.data) this.optionsagentId= res.data + this.findAgentByOrgCode() }); + }, + findAgentByOrgCode(){ + this.$api.api.findAgentByOrgCode({ + orgCode:this.agentForm.orgCode + }) + .then(res=>{ + if(res.data.length==0){ + // 没有代理商 + this.agentForm.agentId=[] + }else{ + let arr=[] + // 有 + res.data.map(item=>{ + arr.push(item.agentId) + }) + // console.log(arr,'123'); + this.agentForm.agentId=arr + } + }) }, //选择省的时候请求市并清空市 clickprovinceId(){ diff --git a/src/views/admin/dept/index.vue b/src/views/admin/dept/index.vue index cfd582e..5fe7a53 100644 --- a/src/views/admin/dept/index.vue +++ b/src/views/admin/dept/index.vue @@ -18,7 +18,7 @@ - + @@ -67,6 +67,38 @@ 保存 + + + + + + + + + + + + @@ -79,12 +111,18 @@ export default { input: "", tableData: [], multipleSelection: [], + deptList:[], dialogVisible: false, - orgType:localStorage.getItem('orgType'), + deptVisible: false, + orgType: localStorage.getItem("orgType"), ruleForm: { name: "", id: "", }, + deptForm: { + deptId: "", + newDeptId:'' + }, houseId: "", houseList: [], Page: 1, @@ -92,22 +130,20 @@ export default { words: "", total: 0, ruleser: { - name: [{ required: true, message: "请填部门名称", trigger: "blur" }], + name: [{ required: true, message: "请选择部门", trigger: "blur" }], + }, + ruler: { + newDeptId: [{ required: true, message: "请选择部门", trigger: "blur" }], }, editFlag: false, }; }, mounted() { // this.zkhousePage(); - this.houseId=localStorage.getItem("houseId"); + this.houseId = localStorage.getItem("houseId"); this.deptFindByPage(); }, methods: { - houseChange() { - this.Page = 1; - this.words = ""; - this.deptFindByPage(); - }, zkhousePage() { this.$api.api .findHouseByUser({ @@ -128,7 +164,7 @@ export default { let obj = { current: this.Page, size: this.size, - houseId:this.houseId, + houseId: this.houseId, words: this.words, }; this.$api.api.deptFindByPage(obj).then((res) => { @@ -141,39 +177,44 @@ export default { this.Page = 1; this.deptFindByPage(); }, + delSure(){ + this.$refs.deptForm.validate((valid) => { + if(valid){ + this.$api.api.deptDel({ + houseId:this.houseId, + ...this.deptForm, + }) + .then(res=>{ + console.log(res); + this.deptFindByPage(); + this.$message.success('移除成功') + this.deptVisible=false + }) + } + }) + }, //删除 - del(item) { - this.$confirm("此操作将永久删除, 是否继续?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - distinguishCancelAndClose: true, - type: "warning", - }) - .then(() => { - this.$api.api.deptDel({ id: item.id }).then((res) => { - if (res.code == 0) { - this.$message({ - type: "success", - message: "删除成功!", - }); - this.Page = 1; - this.words = ""; - this.deptFindByPage(); - } else { - this.$message.error(res.message); - } - }); + del(row) { + this.deptForm.deptId = row.deptId; + this.$api.api + .deptFindList({ + houseId: this.houseId, + deptId:row.deptId }) - .catch(() => { - this.$message({ - type: "info", - message: "已取消删除", - }); + .then((res) => { + console.log(res); + this.deptList=res.data + if(this.deptList.length==0){ + this.$message.warning('没有别的部门啦!') + }else{ + this.deptVisible = true; + } + }); }, //编辑 bianji(row) { - this.ruleForm.id = row.id; + this.ruleForm.deptId = row.deptId; this.dialogVisible = true; this.ruleForm.name = row.name; this.editFlag = true; @@ -197,7 +238,6 @@ export default { this.dialogVisible = false; this.$refs.ruleForm.resetFields(); this.Page = 1; - this.words = ""; this.deptFindByPage(); } else { this.$message.error(res.message); @@ -205,8 +245,8 @@ export default { }); } else { this.$api.api - .tabooupdate({ - id: this.ruleForm.id, + .deptUpdate({ + deptId: this.ruleForm.deptId, name: this.ruleForm.name, }) .then((res) => { @@ -214,7 +254,6 @@ export default { this.dialogVisible = false; this.$refs.ruleForm.resetFields(); this.Page = 1; - this.words = ""; this.deptFindByPage(); } else { this.$message.error(res.message); diff --git a/src/views/admin/role/index.vue b/src/views/admin/role/index.vue index 90d5785..54857e6 100644 --- a/src/views/admin/role/index.vue +++ b/src/views/admin/role/index.vue @@ -8,6 +8,7 @@ 代理商角色 系统角色 + 运营角色 - - + @@ -434,14 +434,16 @@ export default { // 单选框改变 radioChange(e) { // console.log(e) + this.treeDataList = []; if (e == 0 || e == 1) { this.findMyOrg(); - } - if (e == 2) { + } else if (e == 2) { this.findMyAgent(); // this.getList(); + } else if (e == 4) { + // console.log("这是运营"); + this.getList(); } else { - this.treeDataList = []; this.getList(); } }, @@ -505,6 +507,9 @@ export default { if (this.tabselect == 2) { obj.agentId = this.orgCode; } + if (this.tabselect == 4) { + obj.agentId = 0; + } this.$api.api.rolePage(obj).then((res) => { this.list = res.data.records; this.page.total = res.data.total; @@ -550,6 +555,10 @@ export default { }, addRole() { // console.log(1); + if(this.tabselect==4){ + this.$message.warning('运营角色不能添加!') + return + } this.dialogFormVisible = true; this.addFlag = true; this.editFlag = false; @@ -569,7 +578,18 @@ export default { this.dialogFormVisible = false; return; } - this.form.orgCode = this.orgCode; + if(this.tabselect==0){ + this.form.orgCode = this.orgCode; + this.form.agentId = null; + } + else if(this.tabselect==2){ + this.form.orgCode = null; + this.form.agentId = this.orgCode; + } + else{ + this.form.orgCode = null; + this.form.agentId = null; + } console.log(this.form); // return if (this.addFlag) { diff --git a/src/views/admin/user/index.vue b/src/views/admin/user/index.vue index 9beb793..edc9923 100644 --- a/src/views/admin/user/index.vue +++ b/src/views/admin/user/index.vue @@ -163,9 +163,7 @@
- 添加 + 添加
@@ -195,7 +193,10 @@ 密码重置 - 编辑 + + + + + +
+ + + + + + + + + + + + @@ -530,7 +564,7 @@ export default { propertyName: "", serviceStatus: "", houseType: "", - residueTime: 7, + // residueTime: 7, startWorking: "", endWorking: "", agentName: "", @@ -572,6 +606,7 @@ export default { operationList: [], dialogVisible: false, dialogVisible1: false, + agentVisible:false, time: [], addressOptions: [], accountForm: { @@ -598,6 +633,7 @@ export default { cityId: "", //市id }, ruleForm1: {}, + optionsagentId:[], rules: { orgCode: [{ required: true, message: "请选择公司", trigger: "blur" }], propertyName: [ @@ -617,6 +653,12 @@ export default { { required: true, message: "请选择运营人员", trigger: "blur" }, ], }, + agentRule: { + agentId: [{ required: true, message: "请选择代理商", trigger: "blur" }], + }, + agentForm: { + agentId:'', + }, }; }, mounted() { @@ -629,6 +671,37 @@ export default { this.zkhousePage(); }, methods: { + bindAgent(row) { + // console.log(row); + this.findMyAgent(row); + this.agentVisible = true; + }, + saveAgent() { + this.$refs.agentForm.validate((valid) => { + if (valid) { + console.log(this.agentForm); + this.$api.api + .saveAgent({ + agentId: this.agentForm.agentId, + id: this.agentForm.houseId, + }) + .then((res) => { + this.$message.success("操作成功"); + this.zkhousePage(); + this.agentVisible = false; + }); + } + }); + }, + findMyAgent(row) { + this.$api.http.findMyAgent({ orgType: this.orgType }).then((res) => { + console.log(res.data); + this.optionsagentId = res.data; + this.agentForm.orgCode = row.orgCode; + this.agentForm.houseId = row.id; + this.agentForm.agentId=row.agentId + }); + }, saveOpera() { this.$refs.operaForm.validate((valid) => { if (valid) { @@ -653,7 +726,7 @@ export default { // 获取运营人员列表 this.operaForm.orgId = row.id; this.operaForm.orgCode = row.orgCode; - this.AllOperationsStaff(); + this.AllOperationsStaff(row.agentId); this.operaVisible = true; this.zkoperationrecordFindByOrg(row.id); }, @@ -679,9 +752,10 @@ export default { }); }, //获取运营人员 - AllOperationsStaff() { + AllOperationsStaff(agentId) { + console.log(agentId); this.optionsoperationalPeople = []; - this.$api.http.getAllOperationsStaff().then((res) => { + this.$api.api.getAllOperationsStaff({agentId}).then((res) => { this.optionsoperationalPeople = res.data; }); }, diff --git a/vue.config.js b/vue.config.js index 0c27fdb..e54ec5a 100644 --- a/vue.config.js +++ b/vue.config.js @@ -4,7 +4,7 @@ */ // const url = 'http://pigx-gateway' // const url = 'http://39.97.167.65:9999' //测试 -const url = 'http://192.168.31.168:9999' //长龙 +const url = 'http://192.168.1.181:9999' //长龙 // const url = 'http://192.168.31.133:9999' //嘉豪 // const url = 'http://192.168.31.100:9999' //王笑