From 071c4f1658e172757c9dd37feaab0d26a8bde41b Mon Sep 17 00:00:00 2001 From: lancer <1905818361@qq.com> Date: Mon, 25 Oct 2021 14:31:21 +0800 Subject: [PATCH] init --- src/page/check/index.vue | 1 - src/page/index/top/index.vue | 166 +++++++++++++++-- src/page/login/userlogin.vue | 175 +++++++++++++++--- .../Equipment/equipmentOnlineRecordList.vue | 2 +- src/views/Statistics/index.vue | 133 ++++++------- 5 files changed, 372 insertions(+), 105 deletions(-) diff --git a/src/page/check/index.vue b/src/page/check/index.vue index 8088c06..1851b81 100644 --- a/src/page/check/index.vue +++ b/src/page/check/index.vue @@ -105,7 +105,6 @@ export default { .zkagentPage({ current: 1, pageSize: 10, - agentName: this.agentName, }) .then((res) => { // console.log(res); diff --git a/src/page/index/top/index.vue b/src/page/index/top/index.vue index c3020d7..d5a085d 100644 --- a/src/page/index/top/index.vue +++ b/src/page/index/top/index.vue @@ -133,7 +133,7 @@ import topTheme from "./top-theme"; import topLogs from "./top-logs"; import topColor from "./top-color"; import topSetting from "./top-setting"; - +import { getStore, setStore } from "@/util/store"; export default { name: "Top", components: { @@ -151,7 +151,7 @@ export default { value: "", companyName: localStorage.getItem('topName'), orgType:localStorage.getItem('orgType'), - + info:{}, }; }, computed: { @@ -181,6 +181,7 @@ export default { }, mounted() { listenfullscreen(this.setScreen); + this.info = getStore({ name: "userInfo" }); }, methods: { handleScreen() { @@ -201,33 +202,162 @@ export default { // }) // }, goChange() { + let that = this; this.$api.api.getTab().then((res) => { // console.log(res) // 循环数组,给定各种标志 - if (res.data.length == 0) { - let idx = res.data[0].orgType; - // localStorage.setItem("orgType", idx); - if (idx == 0) { - // 质控管家后台 - // this.$router.push({ path: "/wel" }); - this.$message('不能选择') + if (res.data.length == 0) { + // this.$message.warning("您已经被禁用"); + this.$message.warning("别看了你进不了"); + } else if (res.data.length == 1) { + let idx = res.data[0].orgType; + localStorage.setItem("orgType", idx); + // 给定一个判断是否可以跳转的东西 + localStorage.setItem("backFlag", false); + // 当他只有质控后台时,不需要多余操作 + if (idx == 0) { + // 质控管家后台 + localStorage.setItem("topName", ""); + localStorage.setItem("orgCode", ""); + localStorage.setItem("houseId", ""); + localStorage.setItem("agentId", ""); + that.$router.push({ path: "/wel" }); + } + // 当他为其他时 先获取是否只有一个选项,然后在来进行判断 + if (idx == 1) { + this.getAgentList(); + // 代理商 + } + if (idx == 2) { + this.getCompanyList(); + // 公司后台 + } + if (idx == 3) { + this.findByUserName(); + // 楼盘后台 + } } - if (idx == 1) { - // 代理商 + else { + this.$router.push({ path: "/check", query: { backFlag: true } }); + } + }); + }, + // 获取代理商 + getAgentList() { + this.$api.api + .zkagentPage({ + current: 1, + pageSize: 10, + }) + .then((res) => { + // console.log(res); + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 this.$router.push({ path: "/chose", query: { flag: 1 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].agentName); + localStorage.setItem("agentId", res.data.records[0].id); + localStorage.setItem("orgCode", ""); + localStorage.setItem("houseId", ""); } - if (idx == 2) { + }); + }, + getCompanyList() { + this.$api.api + .zkorg({ + current: 1, + size: 10, + name: this.companyName, + orgType: localStorage.getItem("orgType"), + }) + .then((res) => { + // console.log(res); + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { // 公司后台 this.$router.push({ path: "/chose", query: { flag: 2 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].name); + localStorage.setItem("orgCode", res.data.records[0].orgCode); + localStorage.setItem("agentId", ""); + localStorage.setItem("houseId", ""); } - if (idx == 3) { - // 楼盘后台 + }); + }, + findByUserName() { + this.$api.api + .findByUserName({ + username: this.info.username, + }) + .then((res) => { + // console.log(res); + this.info.selectHouseType = res.selectHouseType; + // 获取楼盘 + this.zkhousePage(); + }); + }, + zkhousePage() { + let obj = { + current: 1, + size: 10, + orgType: localStorage.getItem("orgType"), + }; + if (this.info.selectHouseType == 1) { + this.$api.api.zkhousePage(obj).then((res) => { + // console.log(res) + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 this.$router.push({ path: "/chose", query: { flag: 3 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].propertyName); + localStorage.setItem("orgCode", res.data.records[0].orgCode); + localStorage.setItem("agentId", ""); + localStorage.setItem("houseId", res.data.records[0].id); } - } else { - this.$router.push({ path: "/check", query: { backFlag: true } }); - } - }); + }); + } + if (this.info.selectHouseType == 2) { + this.$api.api + .findHouseByArea({ + id: null, + ...obj, + }) + .then((res) => { + // console.log(res) + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 + this.$router.push({ path: "/chose", query: { flag: 3 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].propertyName); + localStorage.setItem("orgCode", res.data.records[0].orgCode); + localStorage.setItem("houseId", res.data.records[0].id); + localStorage.setItem("agentId", ""); + } + }); + } }, setCollapse() { this.$store.commit("SET_COLLAPSE"); diff --git a/src/page/login/userlogin.vue b/src/page/login/userlogin.vue index 53d5feb..d31d809 100644 --- a/src/page/login/userlogin.vue +++ b/src/page/login/userlogin.vue @@ -61,7 +61,7 @@ import { randomLenNum } from "@/util/util"; import { mapGetters } from "vuex"; import { getCode } from "@/api/code"; import Verify from "@/components/verifition/Verify"; - +import { getStore, setStore } from "@/util/store"; export default { name: "Userlogin", components: { @@ -73,6 +73,7 @@ export default { code: "", state: "", }, + info:{}, loginForm: { username: "admin", password: "123456", @@ -117,38 +118,166 @@ export default { this.loginForm.code = params.captchaVerification; this.$store.dispatch("LoginByUsername", this.loginForm).then(() => { // this.$router.push({ path: this.tagWel.value }); + this.info = getStore({ name: "userInfo" }); that.$api.api.getTab().then((res) => { // console.log(res) // 循环数组,给定各种标志 if (res.data.length == 0) { // this.$message.warning("您已经被禁用"); this.$message.warning("别看了你进不了"); - } - // else if (res.data.length == 1) { - // let idx = res.data[0].orgType; - // localStorage.setItem("orgType", idx); - // if (idx == 0) { - // // 质控管家后台 - // that.$router.push({ path: "/wel" }); - // } - // if (idx == 1) { - // // 代理商 - // that.$router.push({ path: "/chose", query: { flag: 1 } }); - // } - // if (idx == 2) { - // // 公司后台 - // that.$router.push({ path: "/chose", query: { flag: 2 } }); - // } - // if (idx == 3) { - // // 楼盘后台 - // that.$router.push({ path: "/chose", query: { flag: 3 } }); - // } - // } - else { + } else if (res.data.length == 1) { + let idx = res.data[0].orgType; + localStorage.setItem("orgType", idx); + // 给定一个判断是否可以跳转的东西 + localStorage.setItem("backFlag", false); + // 当他只有质控后台时,不需要多余操作 + if (idx == 0) { + // 质控管家后台 + localStorage.setItem("topName", ""); + localStorage.setItem("orgCode", ""); + localStorage.setItem("houseId", ""); + localStorage.setItem("agentId", ""); + that.$router.push({ path: "/wel" }); + } + // 当他为其他时 先获取是否只有一个选项,然后在来进行判断 + if (idx == 1) { + this.getAgentList(); + // 代理商 + // that.$router.push({ path: "/chose", query: { flag: 1 } }); + } + if (idx == 2) { + this.getCompanyList(); + // 公司后台 + // that.$router.push({ path: "/chose", query: { flag: 2 } }); + } + if (idx == 3) { + this.findByUserName(); + // 楼盘后台 + // that.$router.push({ path: "/chose", query: { flag: 3 } }); + } + } else { that.$router.push({ path: "/check" }); } }); }); + }, + + // 获取代理商 + getAgentList() { + this.$api.api + .zkagentPage({ + current: 1, + pageSize: 10, + }) + .then((res) => { + // console.log(res); + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 + this.$router.push({ path: "/chose", query: { flag: 1 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].agentName); + localStorage.setItem("agentId", res.data.records[0].id); + localStorage.setItem("orgCode", ""); + localStorage.setItem("houseId", ""); + } + }); + }, + getCompanyList() { + this.$api.api + .zkorg({ + current: 1, + size: 10, + name: this.companyName, + orgType: localStorage.getItem("orgType"), + }) + .then((res) => { + // console.log(res); + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 + this.$router.push({ path: "/chose", query: { flag: 2 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].name); + localStorage.setItem("orgCode", res.data.records[0].orgCode); + localStorage.setItem("agentId", ""); + localStorage.setItem("houseId", ""); + } + }); + }, + findByUserName() { + this.$api.api + .findByUserName({ + username: this.info.username, + }) + .then((res) => { + // console.log(res); + this.info.selectHouseType = res.selectHouseType; + // 获取楼盘 + this.zkhousePage(); + }); + }, + zkhousePage() { + let obj = { + current: 1, + size: 10, + orgType: localStorage.getItem("orgType"), + }; + if (this.info.selectHouseType == 1) { + this.$api.api.zkhousePage(obj).then((res) => { + // console.log(res) + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 + this.$router.push({ path: "/chose", query: { flag: 3 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].propertyName); + localStorage.setItem("orgCode", res.data.records[0].orgCode); + localStorage.setItem("agentId", ""); + localStorage.setItem("houseId", res.data.records[0].id); + } + }); + } + if (this.info.selectHouseType == 2) { + this.$api.api + .findHouseByArea({ + id: null, + ...obj, + }) + .then((res) => { + // console.log(res) + // this.list = res.data.records; + // this.total = res.data.total; + if (res.data.total == 0) { + this.$message.warning("您当前并未绑定楼盘"); + return; + } else if (res.data.total > 1) { + // 公司后台 + this.$router.push({ path: "/chose", query: { flag: 3 } }); + } else { + this.$router.push({ path: "/wel" }); + localStorage.setItem("topName", res.data.records[0].propertyName); + localStorage.setItem("orgCode", res.data.records[0].orgCode); + localStorage.setItem("houseId", res.data.records[0].id); + localStorage.setItem("agentId", ""); + } + }); + } }, }, }; diff --git a/src/views/Equipment/equipmentOnlineRecordList.vue b/src/views/Equipment/equipmentOnlineRecordList.vue index fd7b345..dfa897e 100644 --- a/src/views/Equipment/equipmentOnlineRecordList.vue +++ b/src/views/Equipment/equipmentOnlineRecordList.vue @@ -262,7 +262,7 @@ @current-change="handleCurrentChange" :current-page="currentPage4" :page-sizes="[6, 10, 14, 20]" - :page-size="6" + :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total" > diff --git a/src/views/Statistics/index.vue b/src/views/Statistics/index.vue index 59e506e..b860dda 100644 --- a/src/views/Statistics/index.vue +++ b/src/views/Statistics/index.vue @@ -2,14 +2,15 @@
-
+
楼盘选择: - + + :value="item.id" + >
@@ -27,11 +28,11 @@
@@ -158,10 +159,10 @@ export default { namelist: [], numlist: [], objlist: [], - value:'', - + value: "", + orgType: localStorage.getItem("orgType"), houseId: "", - buildingoptions:[], + buildingoptions: [], TimetoAhoose: 2, customtime: [], fromobj: { @@ -172,39 +173,49 @@ export default { }, mounted() { // this.myChartinit(); - this.zkhousePage() + this.zkhousePage(); }, methods: { - houseChange(){ - this.getorgCode() + houseChange() { + this.getorgCode(); }, - Toview(item,index){ - let Userrecord={ - TimetoAhoose:this.TimetoAhoose, - keywordsId:item.matchKeywords[index].keywordsId, - customtime:this.customtime, - starttime:this.fromobj.starttime, - endoftime:this.fromobj.endoftime, - houseId:this.houseId, - } - this.$router.push({ path: "/Statistics/Insightintothedetails", query: { flag: Userrecord } }); + Toview(item, index) { + let Userrecord = { + TimetoAhoose: this.TimetoAhoose, + keywordsId: item.matchKeywords[index].keywordsId, + customtime: this.customtime, + starttime: this.fromobj.starttime, + endoftime: this.fromobj.endoftime, + houseId: this.houseId, + }; + this.$router.push({ + path: "/Statistics/Insightintothedetails", + query: { flag: Userrecord }, + }); }, //获取楼盘 -  zkhousePage() { - this.$api.api.findHouseByUser({ + zkhousePage() { + this.$api.api + .findHouseByUser({ orgType: localStorage.getItem("orgType"), - }).then((res) => { + }) + .then((res) => { this.buildingoptions = res.data; - this.houseId = res.data[0].id; - this.getorgCode() + if (localStorage.getItem("orgType") == 3) { + this.houseId = localStorage.getItem("houseId"); + } else { + this.houseId = res.data[0].id; + } + // this.houseId = res.data[0].id; + this.getorgCode(); }); -    }, + }, //自定义时间 confirmtime() { this.TimetoAhoose = 6; - this.fromobj.starttime = this.customtime[0]; - this.fromobj.endoftime = this.customtime[1]; - this.getorgCode() + this.fromobj.starttime = this.customtime[0]; + this.fromobj.endoftime = this.customtime[1]; + this.getorgCode(); }, //切换时间 tabtimetap(index) { @@ -215,39 +226,37 @@ export default { this.getorgCode(); }, //初始化 - getorgCode(){ - this.namelist=[]; - this.numlist=[]; - this.objlist=[]; - var dateType=''; - if(this.TimetoAhoose==6){ - dateType=''; - }else { - dateType=this.TimetoAhoose; - } - this.$api.http.findmatchdata({ - dateType:dateType, - houseId:this.houseId, - statDateStart:this.fromobj.starttime, - statDateEnd:this.fromobj.endoftime - }).then((res) => { - - this.objlist=res.data.list; - this.alllist=[{"name":'客户数量',"num":res.data.total}] - res.data.list.forEach((item,index)=>{ - this.alllist.push({ - name:item.name, - num:item.total - }) - }) - this.$nextTick(() => { - this.myChartinit() - }) + getorgCode() { + this.namelist = []; + this.numlist = []; + this.objlist = []; + var dateType = ""; + if (this.TimetoAhoose == 6) { + dateType = ""; + } else { + dateType = this.TimetoAhoose; + } + this.$api.http + .findmatchdata({ + dateType: dateType, + houseId: this.houseId, + statDateStart: this.fromobj.starttime, + statDateEnd: this.fromobj.endoftime, + }) + .then((res) => { + this.objlist = res.data.list; + this.alllist = [{ name: "客户数量", num: res.data.total }]; + res.data.list.forEach((item, index) => { + this.alllist.push({ + name: item.name, + num: item.total, + }); + }); + this.$nextTick(() => { + this.myChartinit(); + }); }); - }, - - - + }, myChartinit() { this.objlist.forEach((item, index) => {