From ea8871d93be6cba8dedded9fef6d940921ba994c Mon Sep 17 00:00:00 2001
From: 13176889840 <13176889840@163.com>
Date: Thu, 30 Dec 2021 11:08:02 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=80=E4=BA=9B=E7=B1=BBbu?=
 =?UTF-8?q?g?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../visual/communityParty/community.vue       | 136 ++++++++++++++++--
 .../modules/visual/communityParty/party.vue   |  35 ++++-
 .../visual/components/screen-table/index.vue  |   4 +
 3 files changed, 157 insertions(+), 18 deletions(-)
diff --git a/src/views/modules/visual/communityParty/community.vue b/src/views/modules/visual/communityParty/community.vue
index 71601608e..e3e9fe846 100644
--- a/src/views/modules/visual/communityParty/community.vue
+++ b/src/views/modules/visual/communityParty/community.vue
@@ -6,13 +6,20 @@
              src="../../../../assets/img/shuju/title-tip.png" />
         
         党建单位分类统计
         
           
@@ -31,6 +38,7 @@
                           end-placeholder="结束日期"
                           prefix-icon="el-icon-caret-bottom"
                           value-format="yyyy-MM-dd HH:mm:ss"
+                          :clearable="false"
                           :default-time="['00:00:00', '23:59:59']"
                           >
           
@@ -147,13 +155,15 @@ export default {
       value2: '',
       timeRange: '',
       visibleLoading: true,
-      serviceMatter: '',
+      serviceMatter: 'all',
       pageNo: 1,
       pageSize: 10,
       total: 0,
       activeIndex: 0,
       activeLevel: "1",
+      selectAgency: '',
       unitList: [],
+      propTree: [],
       partyItem: [
         {
           name: '楼宇党建',
@@ -231,33 +241,37 @@ export default {
   async mounted () {
     const { user } = this.$store.state
     this.agencyId = user.agencyId
+    console.log('agencyId-------', this.agencyId)
+    this.initTime()
     await nextTick(100);
+    await this.getAgencyList()
     this.loadUnit()
-    this.getList();
+    this.getList(this.agencyId)
     this.getCateCount()
     this.getCateType()
+    
     await this.getWorkUserInfo()
-    await this.getMapUnitList()
+    await this.getMapUnitList(this.agencyId)
   },
   watch: {
     timeRange(val) {
       console.log('val-www', val)
-      this.getList();
+      this.getList(this.agencyId);
     }
   },
   methods: {
 
     //具体人员列表
-    async getList () {
+    async getList (agencyId) {
       this.visibleLoading = true
 
       const url = "/heart/icpartyactivity/activitylist"
       // const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyactivity/list"
       let params = {
-        agencyId: this.agencyId,
+        agencyId,
         pageSize: this.pageSize,
         pageNo: this.pageNo,
-        serviceMatter: this.serviceMatter,
+        serviceMatter: this.serviceMatter == 'all' ? '' : this.serviceMatter,
         startTime: this.timeRange && this.timeRange[0] || '',
         endTime: this.timeRange && this.timeRange[1] || ''
       }
@@ -277,6 +291,55 @@ export default {
       }
       this.visibleLoading = false
     },
+    async getAgencyList() {
+      // const url = "/gov/org/customeragency/staffinagencylist";
+      // const url = '/gov/org/customeragency/agencygridtree'
+      const url = '/gov/org/customeragency/staffinagencylist'
+      // let params = {
+      //   agencyId: this.$store.state.user.agencyId,
+      // };
+      const { data, code, msg } = await requestPost(url);
+      if (code === 0) {
+        console.log('data-org----o', data)
+        let { agencyList, subAgencyList } = data
+        this.selectAgency = [`${agencyList.agencyId}-${agencyList.level}`]
+        let arr = []
+        agencyList.subAgencyList = subAgencyList
+        arr.push(agencyList)
+        this.propTree = arr && this.getTreeData(arr)
+
+      } else {
+        this.$message.error(msg)
+      }
+    },
+    getTreeData(data){
+      if (!Array.isArray(data)) return []
+      let arr = data.map(item => {
+        let _item = {}
+        if (item.subAgencyList) {
+          if (item.subAgencyList.length === 0) {
+            _item = { 
+              label: item.agencyName,
+              value: item.agencyId + '-' + item.level,
+              level: item.level,
+              children: undefined 
+            }
+          } else _item = { 
+            label: item.agencyName,
+            value: item.agencyId + '-' + item.level,
+            level: item.level,
+            children: this.getTreeData(item.subAgencyList)}
+        } else {
+          _item = { 
+            label: item.agencyName,
+            value: item.agencyId + '-' + item.level,
+            level: item.level,
+          }
+        }
+        return _item
+      })
+      return arr
+    },
     async getCateCount () {
 
       const url = "/heart/icpartyactivity/statistics"
@@ -352,7 +415,35 @@ export default {
         this.$message.error(msg)
       }
     },
-    
+    handleCascader(val) {
+      console.log('val-vvv', val)
+      if (val.length > 0) {
+        const _arr = val[val.length - 1].split('-')
+        const orgType = _arr[1] !== 'grid' ? 'agency': 'grid'
+        this.getList(_arr[0])
+        this.getMapUnitList(_arr[0])
+      }
+      
+    },
+    initTime() {
+      const end = new Date();
+      const start = new Date();
+      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+      console.log('time-rtt', this.timeFormat(start), this.timeFormat(end))
+      this.timeRange = [this.timeFormat(start), this.timeFormat(end)]
+    },
+    timeFormat(date) {
+      if (!date || typeof date === 'string') {
+        return false
+      }
+      var y = date.getFullYear() //年
+      var m = date.getMonth() + 1 //月
+      if (m < 10) m = '0' + m
+      var d = date.getDate() //日
+      if (d < 10) d = '0' + d
+
+      return y + '-' + m + '-' + d + ' 00:00:00'
+    },
     async loadUnit () {
       const url = "/heart/icresidemanddict/subcodelist"
       // const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/option"
@@ -365,7 +456,10 @@ export default {
 
       if (code === 0) {
         this.unitList = data
-
+        this.unitList.unshift({
+          label: '全部',
+          value: 'all'
+        })
       } else {
         this.$message.error(msg)
       }
@@ -419,12 +513,12 @@ export default {
     // },
 
     //获取联建单位分布图
-    async getMapUnitList () {
+    async getMapUnitList (agencyId) {
       const url = "/heart/icpartyunit/distribution"
       // const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/distribution"
 
       let params = {
-        agencyId: this.agencyId
+        agencyId
       }
 
       const { data, code, msg } = await requestPost(url, params)
@@ -492,7 +586,7 @@ export default {
       this.showedMoreInfo = true
     },
 
-    handleSelectChange () {
+    handleSelectChange (val) {
       this.getList();
     },
     pageSizeChangeHandleNew (val) {
@@ -562,8 +656,22 @@ export default {
     margin-right: 6px;
   }
   .title-label {
-    font-size: 16px;
+    font-size: 20px;
     font-weight: 800;
+    ::v-deep .el-input {
+      width: 180px;
+      margin-left: 10px;
+      .el-input__inner {
+        font-size: 18px;
+        font-weight: 800;
+        color: #fff;
+        background: transparent;
+        border: 0;
+      }
+      .el-icon-arrow-down::before {
+          content: "\e790";
+      }
+    }
   }
   ::v-deep .el-dropdown {
     font-size: 16px;
diff --git a/src/views/modules/visual/communityParty/party.vue b/src/views/modules/visual/communityParty/party.vue
index ca13dcaef..92019480e 100644
--- a/src/views/modules/visual/communityParty/party.vue
+++ b/src/views/modules/visual/communityParty/party.vue
@@ -59,6 +59,7 @@
               :tableData="ageList"
               :visibleLoading="visibleLoading"
               :operate="false"
+              @row="handleClickRow"
             >