From 78c8bd01f869d5ba433f27f04269f33071547da0 Mon Sep 17 00:00:00 2001 From: liuye Date: Fri, 14 Jan 2022 10:56:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/AppGridManagement/AddGird.vue | 61 ++++++- src/apps/AppGridManagement/Organization.vue | 16 +- src/apps/AppGridManagement/SelectGird.vue | 51 +++--- src/apps/AppGridManagement/SelectUser.vue | 173 +++++--------------- src/apps/AppGridManagement/SetGird.vue | 168 +++++++++---------- src/apps/AppGridManagement/Statistics.vue | 13 +- 6 files changed, 230 insertions(+), 252 deletions(-) diff --git a/src/apps/AppGridManagement/AddGird.vue b/src/apps/AppGridManagement/AddGird.vue index 3def509c..a65ad1bf 100644 --- a/src/apps/AppGridManagement/AddGird.vue +++ b/src/apps/AppGridManagement/AddGird.vue @@ -4,21 +4,23 @@
*网格名称
-
请输入
+
+ +
网格长
-
请选择
+
请选择
网格员
-
请选择
+
请选择
- + @@ -26,17 +28,62 @@ export default { data() { return { - + id: '', + form: {}, + detailInfo: {}, + fromType: 'add', //add新增 edit编辑, + addUserType: 'manage', //manage网格长 Member管理员 } }, methods: { + }, + onLoad(option) { + this.id = option.id + this.getDetail() + uni.$on('selectUser', res => { + if(this.addUserType == 'manage') { + this.form.girdMemberManageList = res + }else { + this.form.girdMemberList = res + } + }) }, onShow() { document.title = '添加网格' }, - linkTo(url) { - uni.navigateTo({url}) + methods: { + getDetail() { + this.$http.post(`/app/appgirdinfo/queryDetailById?id=${this.id}`).then((res) => { + if (res.code == 0) { + this.detailInfo = res.data + if(this.fromType == 'edit') { + this.form = res.data + } + } + }) + }, + toAddUser(type) { + this.addUserType = type + var selectUserList = [] + if(type == 'manage') { + selectUserList = this.form.girdMemberManageList + }else { + selectUserList = this.form.girdMemberList + } + uni.navigateTo({url: `./SelectUser?selectUserList=${selectUserList}`}) + }, + confirm() { + if(!this.form.girdName){ + return this.$u.toast('请输入网格名称') + } + this.$http.post(`/app/appgirdinfo/addOrUpdate`).then((res) => { + if (res.code == 0) { + this.form = res.data + } + }) + + } } } diff --git a/src/apps/AppGridManagement/Organization.vue b/src/apps/AppGridManagement/Organization.vue index f4f3cd54..d4b7d4ac 100644 --- a/src/apps/AppGridManagement/Organization.vue +++ b/src/apps/AppGridManagement/Organization.vue @@ -29,7 +29,7 @@

{{item.girdName}}

- +
@@ -38,20 +38,27 @@ export default { data() { return { userGird: {}, - dataInfo: {} + dataInfo: {}, + checkType: '' } }, onShow() { document.title = '网格管理' + }, mounted() { this.isGirdUser() + uni.$on('goback', (res) => { + this.userGird = res + this.getGirdUserList() + }) }, methods: { isGirdUser() { this.$http.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => { if (res.code == 0) { if (res.data.checkType) { + this.checkType = res.data.checkType this.userGird = res.data.appGirdInfo this.getGirdUserList() } else { @@ -76,8 +83,8 @@ export default { diff --git a/src/apps/AppGridManagement/SelectGird.vue b/src/apps/AppGridManagement/SelectGird.vue index cde8b0c8..b5610e26 100644 --- a/src/apps/AppGridManagement/SelectGird.vue +++ b/src/apps/AppGridManagement/SelectGird.vue @@ -40,19 +40,31 @@ export default { allData: null, treeList: [], slectList: [], + userGird: {}, userList: [], - - type: 0, //0统计 1组织 + girdLevel: 0, + parentGirdId: '' } }, - onLoad(option) { - this.type = option.type - this.getTree() + onLoad() { + this.isGirdUser() }, methods: { + isGirdUser() { + this.$http.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => { + if (res.code == 0) { + if (res.data.checkType) { + this.userGird = res.data + this.getTree() + } else { + this.$u.toast('当前人员不是网格员或网格管理员') + } + } + }) + }, getTree() { this.slectList = [] - this.$http.post('/app/appgirdinfo/listAllByTop').then((res) => { + this.$http.post(`/app/appgirdinfo/queryAppGirdInfoByGirdLevel?girdLevel=${this.girdLevel}&girdMemberId=${this.userGird.girdMemberId}&parentGirdId=${this.parentGirdId}`).then((res) => { if (res?.data) { this.allData = res.data this.treeInit() @@ -61,18 +73,14 @@ export default { }, treeInit() { - if(this.allData[0].isLastLevel == 1) { - this.userList = this.allData[0].girdMemberList - this.userList.map((item) => { - item.isChecked = false - }) - }else { - this.treeList = this.allData[0].girdList - } + this.treeList = this.allData + this.treeList.map((item) => { + item.isChecked = false + }) var obj = { - girdName: this.allData[0].girdName, - id: this.allData[0].id, - girdLevel: this.allData[0].girdLevel + girdName: '可选范围', + id: '', + girdLevel: '' } this.slectList.push(obj) }, @@ -90,9 +98,10 @@ export default { searckGird(row) { if(row.girdLevel == 2) return - this.$http.post(`/app/appgirdinfo/list?parentGirdId=${row.id}&size=999`).then((res) => { + var girdLevel = Number(row.girdLevel)+1 + this.$http.post(`/app/appgirdinfo/queryAppGirdInfoByGirdLevel?girdLevel=${girdLevel}&girdMemberId=${this.userGird.girdMemberId}&parentGirdId=${row.id}`).then((res) => { if (res?.data) { - this.treeList = res.data.records + this.treeList = res.data } }) }, @@ -138,10 +147,6 @@ export default { return this.$u.toast('请选择网格') } }, - - callPhone(phone) { - uni.makePhoneCall({phoneNumber: phone}) - }, } } diff --git a/src/apps/AppGridManagement/SelectUser.vue b/src/apps/AppGridManagement/SelectUser.vue index 8c4485b0..5678e23c 100644 --- a/src/apps/AppGridManagement/SelectUser.vue +++ b/src/apps/AppGridManagement/SelectUser.vue @@ -2,35 +2,15 @@
- /{{item.girdName}} +
-
-
-
-
- - - - - -
-
-
{{ item.girdName }}
- -
-
-
- - -
- -
+
- - + +
@@ -58,128 +38,63 @@ export default { name: 'SelectUser', data() { return { - selectUser: {}, - allData: null, - treeList: [], - slectList: [], + selectUserList: [], userList: [], + name: '', } }, - onLoad() { - this.getTree() + onLoad(option) { + this.selectUserList = option.selectUserList + this.getList() }, methods: { - getTree() { - this.slectList = [] - this.$http.post('/app/appgirdinfo/listAllByTop').then((res) => { + getListInit() { + this.userList = [] + this.current = 1 + }, + getList() { + this.$http.post(`/app/appgirdmemberinfo/list?name=${this.name}¤t=${this.current}&size=20`).then((res) => { if (res?.data) { - this.allData = res.data - this.treeInit() + res.data.records.map((item) => { + item.isChecked = false + }) + + this.userList = this.current > 1 ? res.data.records : [...this.userList, ...res.data.records] + + this.userList.map((item) => { + this.selectUserList.map((e) => { + if(e.id == item.id) { + item.isChecked = true + } + }) + }) } }) }, - treeInit() { - if(this.allData[0].isLastLevel == 1) { - this.userList = this.allData[0].girdMemberList - this.userList.map((item) => { - item.isChecked = false - }) - }else { - this.treeList = this.allData[0].girdList - } - var obj = { - girdName: this.allData[0].girdName, - id: this.allData[0].id, - girdLevel: this.allData[0].girdLevel - } - this.slectList.push(obj) - }, - - itemClick(row) { - console.log(row) - var obj = { - girdName: row.girdName, - id: row.id, - girdLevel: row.girdLevel - } - this.slectList.push(obj) - this.searckGird(row) - }, - - searckGird(row) { - if(row.girdLevel != 2) { //查网格 - this.$http.post(`/app/appgirdinfo/list?parentGirdId=${row.id}&size=999`).then((res) => { - if (res?.data) { - this.treeList = res.data.records - } - }) - }else { //查网格员 - this.$http.post(`/app/appgirdmemberinfo/listByGirdIdByThree?girdId=${row.id}`).then((res) => { - if (res?.data) { - this.userList = res.data - this.userList.map((item) => { - item.isChecked = false - }) - } - }) - } - }, - - girdNameClick(row, index) { - this.userList = [] - if(!index) { //第一级别 - this.slectList = [] - this.treeInit() - }else { - var list = [] - this.slectList.map((item, i) => { - if(i <= index) { - list.push(item) - } - }) - this.slectList = list - this.searckGird(row) - } - }, - - - girdClick(row, index) { - if (this.treeList[index].isChecked) {//取消 - this.treeList[index].isChecked = false - this.selectUser = {} - } else { - this.treeList.map((item) => { - item.isChecked = false - }) - this.treeList[index].isChecked = true - this.selectUser = row - } - this.$forceUpdate() - }, - - userClick(row, index) { - if (this.userList[index].isChecked) {//取消 - this.userList[index].isChecked = false - this.selectUser = {} - } else { - this.userList.map((item) => { - item.isChecked = false - }) - this.userList[index].isChecked = true - this.selectUser = row - } + userClick(index) { + this.userList[index].isChecked = !this.userList[index].isChecked this.$forceUpdate() }, submit() { - if (this.selectUser.id != null) { - uni.$emit('goback', this.selectUser) - uni.navigateBack() + var selectUserList = [] + this.userList.map((item) => { + if(item.isChecked) { + selectUserList.push(item) + } + }) + if (!selectUserList.length) { + return this.$u.toast('请选择人员') } else { - return this.$u.toast('请选择网格或网格员') + uni.$emit('selectUser', selectUserList) + uni.navigateBack() } }, + }, + onReachBottom() { + this.current ++ + this.getList() } } diff --git a/src/apps/AppGridManagement/SetGird.vue b/src/apps/AppGridManagement/SetGird.vue index 7b86930e..5c7c5f47 100644 --- a/src/apps/AppGridManagement/SetGird.vue +++ b/src/apps/AppGridManagement/SetGird.vue @@ -7,37 +7,17 @@
-
+
- +
-
{{ item.girdName }}
- -
-
-
- - -
- -
-
-
-
- - - - -
- -
-
{{ e.name }}
-
{{ e.phone }}
+
{{ item.girdName }}
+
@@ -54,25 +34,35 @@