xieqy před 2 roky
rodič
revize
8e1f123c7c

+ 19 - 0
src/views/groupPage/apis.ts

@@ -59,6 +59,25 @@ export function getUserList(params) {
         params
     })
 }
+
+//获取全部项目信息
+export function getEpcProjectList(params) {
+    return request({
+        url: '/tofly-sxgk/epc/epcProjectList',
+        method: 'get',
+        params
+    })
+}
+
+//查询分公司项目信息
+export function findByCode(params) {
+    return request({
+        url: `/tofly-sxgk/areacompany/findByCode`,
+        method: 'get',
+        params
+    })
+}
+
 /********************************************智慧工地*********************************************/
 //获取智慧工地摄像头
 export function getZhgdCameraData(params) {

+ 1 - 1
src/views/groupPage/baseMap/components/EchartsMap.vue

@@ -441,7 +441,7 @@ export default {
     getMapJsonData() {
       this.mapData = []
       //地图json数据
-      if (this.groupName !== '三峡分公司') {
+      if (this.groupName === '三峡发展') {
         // if(this.groupName==null){
         this.mapname = mainMap
         // this.userBindInfo.forEach(item=>{

+ 1 - 1
src/views/groupPage/baseMap/components/ProjectMap.vue

@@ -86,7 +86,7 @@ export default {
       if (this.monitorTreeInfo) this.monitorTreeInfo.clearDataSource()
       this.$store.state.bigScreen.isInitViewer = false
       if (this.viewer) this.viewer.destroy()
-      this.$refs['ComInfoBox'].handelClose()
+      if (this.$refs['ComInfoBox']) this.$refs['ComInfoBox'].handelClose()
       this.$nextTick(() => {
         this.initData().then((result) => {
           this.addToMap()

+ 1 - 1
src/views/groupPage/baseMap/components/mapJson/config.json

@@ -100,7 +100,7 @@
         },
         {
             "name": "重庆",
-            "json": "/mapJson/upStream.json"
+            "json": "/mapJson/三峡分公司.json"
         }
     ]
 }

+ 1 - 1
src/views/groupPage/districtPageModules/customTools/monitorTree.vue

@@ -297,7 +297,7 @@ export default class monitorTree extends Vue {
   clearDataSource() {
     if (this.viewer && Cesium.defined(customDataSource)) {
       customDataSource.entities.removeAll()
-      this.viewer.dataSources.remove(customDataSource)
+      this.viewer.dataSources && this.viewer.dataSources.remove(customDataSource)
     }
     if (timeInterval) {
       clearInterval(timeInterval)

+ 5 - 0
src/views/groupPage/districtPageModules/projectPanoramic/ProjectProgress.vue

@@ -161,6 +161,7 @@ export default class ProjectProgress extends Vue {
   getPageData() {
     let data = { blockCode: 'ycepclist' }
     let projectCode = this.projectCode
+    this.reset()
     //获取全部数据
     getRequestResult(data).then((res: Array<any>) => {
       res = res.filter((item) => item.indexCode.indexOf(projectCode + '-') != -1)
@@ -240,6 +241,10 @@ export default class ProjectProgress extends Vue {
         })
     })
   }
+  reset() {
+    this.staffingList = []
+    this.devicesList = []
+  }
 }
 </script>
 

+ 1 - 1
src/views/groupPage/groupPageModules/ContractInfo.vue

@@ -209,7 +209,7 @@ export default {
     },
     //获取分公司数据
     getBranchPageData() {
-      let data = { blockCode: 'ycepclist', 'paras[0].name': 'projectCode', 'paras[0].val': this.code }
+      let data = { blockCode: 'ycepclist', 'paras[0].name': 'projectName', 'paras[0].val': this.code }
       //获取全部数据
       getRequestResult(data).then((res) => {
         res = res.map((item) => {

+ 1 - 1
src/views/groupPage/groupPageModules/IndexStatistic.vue

@@ -78,7 +78,7 @@ export default {
       })
     },
     getBranchPageData() {
-      let data = { blockCode: 'ycepclist', 'paras[0].name': 'projectCode', 'paras[0].val': this.code }
+      let data = { blockCode: 'ycepclist', 'paras[0].name': 'projectName', 'paras[0].val': this.code }
       //获取全部数据
       getRequestResult(data).then((res) => {
         res = res.map((item) => {

+ 3 - 2
src/views/groupPage/groupPageModules/ProjectInfo.vue

@@ -216,7 +216,7 @@ export default {
         })
     },
     getBranchPageData() {
-      let data = { blockCode: 'ycepclist', 'paras[0].name': 'projectCode', 'paras[0].val': this.code }
+      let data = { blockCode: 'ycepclist', 'paras[0].name': 'projectName', 'paras[0].val': this.code }
       //获取全部数据
       getRequestResult(data)
         .then((res) => {
@@ -245,7 +245,8 @@ export default {
           let data = { blockCode: 'prjInfo' }
           //获取全部数据
           getRequestResult(data).then((res) => {
-            if (this.groupName === '三峡分公司') res = res.filter((item) => item.branch == this.groupName)
+            // if (this.groupName === '三峡分公司') res = res.filter((item) => item.branch == this.groupName)
+            if (this.groupName === this.code) res = res.filter((item) => item.branch == this.groupName)
             res.sort((a, b) => {
               return a.planInvestment - b.planInvestment
             }) //升序

+ 4 - 1
src/views/groupPage/groupPageModules/ProjectStatistic.vue

@@ -99,6 +99,9 @@ export default {
     },
     groupName() {
       return this.$store.state.bigScreen.groupName
+    },
+    code() {
+      return this.$store.state.bigScreen.groupCodeValue
     }
   },
   methods: {
@@ -123,7 +126,7 @@ export default {
           Object.keys(item).forEach((val) => (item[val] = item[val] || '/'))
           return { ...item }
         })
-        if (this.groupName === '三峡分公司') this.prjInfo = this.prjInfo.filter((item) => item.branch == this.groupName)
+        if (this.groupName === this.code) this.prjInfo = this.prjInfo.filter((item) => item.branch == this.groupName)
         this.prjList = [
           { name: '建管项目', num: this.prjInfo.filter((item) => item.type !== '未移交').length, status: true },
           { name: 'EPC项目', num: this.prjInfo.filter((item) => item.type === '建管/EPC').length, status: false },

+ 40 - 20
src/views/groupPage/header/header.vue

@@ -25,11 +25,12 @@
                   :label="treeValue.label"
                   style="max-width: 1.354167rem /* 260/192 */; height: auto; padding: 0"
                 >
+                  <!-- style="max-width: 1.354167rem /* 260/192 */; height: auto; padding: 0" -->
                   <el-tree
                     :data="treeDatas"
                     :props="defaultProps"
                     :expand-on-click-node="false"
-                    default-expand-all=""
+                    default-expand-all
                     node-key="name"
                     highlight-current
                     @node-click="nodeClick"
@@ -56,7 +57,7 @@
         </div>
         <div class="otherItem">
           <div class="specificTime">{{ specificTime }}</div>
-          <div class="entrySys" v-if="treeValue.pid === 2" @click="enterSys()">{{ operationName }}</div>
+          <div class="entrySys" v-if="!isShowGroupPage" @click="enterSys()">{{ operationName }}</div>
         </div>
       </div>
       <div class="underline"></div>
@@ -70,6 +71,7 @@ import { appconfig } from '@/config/bigScreenConfig'
 import { getUserMenu } from '@/api/user'
 import { setParams } from 'staticPub/config'
 import { fetchProjects, setProjectKey } from '@/api/common'
+import { findByCode } from '../apis'
 import { setSessionStorage } from '@/utils/auth'
 export default {
   name: 'bigScreenHeader', //大屏头部菜单栏
@@ -83,7 +85,7 @@ export default {
       specificTime: null, //系统当前时间
       operationName: null,
       //
-      treeSelectText: '三峡发展',
+      treeSelectText: '',
       treeValue: {},
       defaultProps: {
         children: 'children',
@@ -106,6 +108,9 @@ export default {
     },
     currentProjectInfo() {
       return this.$store.state.bigScreen.currentProjectInfo
+    },
+    isShowGroupPage() {
+      return this.$store.state.bigScreen.isShowGroupPage
     }
   },
   mounted() {
@@ -142,22 +147,33 @@ export default {
   },
   methods: {
     //项目切换
-    switchingItems(val) {
-      console.log('项目切换')
-      const { label, value, pid, id, data } = val
-      const { geo_info } = data
+    async switchingItems(val) {
+      console.log('项目切换', val)
+      const { label, value, pid } = val
       this.treeSelectText = label
       if (pid == 2) {
-        this.getUserActiveModule()
-        this.setCurrentPrj(data)
-        appconfig.bigScreenMapSettings.initPosition = geo_info && JSON.parse(geo_info)
-        this.$store.state.bigScreen.isShowGroupPage = false
-        this.$store.state.bigScreen.currentProjectCode = value
+        const currentPrj = await this.setCurrentPrj(value)
+        if (!currentPrj) {
+          this.$message.info('暂未查询到此项目信息')
+          return
+        } else {
+          const { geo_info, id } = currentPrj
+          if (!geo_info) {
+            this.$message.info('暂无此项目GIS信息')
+            return
+          }
+          this.getUserActiveModule()
+          appconfig.bigScreenMapSettings.initPosition = geo_info && JSON.parse(geo_info)
+          this.$store.state.bigScreen.currentProjectInfo = currentPrj //设置当前项目信息
+          this.$store.state.bigScreen.currentPrjId = id //设置项目id
+          this.$store.state.bigScreen.isShowGroupPage = false //切换显示为项目级大屏
+          this.$store.state.bigScreen.currentProjectCode = value //设置指标代码
+        }
       } else {
         this.menuList = []
         this.$store.state.bigScreen.groupName = label
-        this.$store.state.bigScreen.groupCodeValue = value
-        this.$store.state.bigScreen.isShowGroupPage = true
+        this.$store.state.bigScreen.groupCodeValue = pid == 0 ? value : label //设置指标代码,总公司为0,分公司为指标名称
+        this.$store.state.bigScreen.isShowGroupPage = true //切换显示为公司级大屏
       }
     },
     // 点击tree节点
@@ -275,12 +291,16 @@ export default {
         this.specificTime = getnow()
       }, 100)
     },
-    async setCurrentPrj(data) {
-      const { id } = data || {}
-      const { result } = await setProjectKey(id)
-      if (result) {
-        this.$store.state.bigScreen.currentProjectInfo = data
-        this.$store.state.bigScreen.currentPrjId = id
+    async setCurrentPrj(code) {
+      const res = await findByCode({ prjCode: code })
+      const { result } = res || {}
+      if (res.code != 1 || result.length == 0) return false
+      else {
+        const { id } = result[0]
+        const isSetting = await setProjectKey(id)
+        if (isSetting.result) {
+          return result[0]
+        } else return false
       }
     },
     async onProjectSelect() {

+ 108 - 72
src/views/groupPage/index.vue

@@ -21,7 +21,7 @@ import GroupPageModules from './groupPageModules/index.vue'
 //项目级页面模块
 import DistrictPageModules from './districtPageModules/index.vue'
 //
-import { getUserList, getBlockPage } from '@/views/groupPage/apis'
+import { getUserList, getBlockPage, getEpcProjectList } from '@/views/groupPage/apis'
 
 import { fetchProjects } from '@/api/common'
 
@@ -56,19 +56,20 @@ export default {
   methods: {
     async getUserRole() {
       const username = sessionStorage.getItem('username') || this.$store.state.user.username
-      const { result } = await fetchProjects()
-      let prjInfo = result.map((item) => {
-        return {
-          name: item.orgName,
-          value: 'B06',
-          pid: 1,
-          children: item.prjList.map((i) => {
-            return { ...i, value: 'HB06', pid: 2, children: [] }
-          })
-        }
-      })
+      // const { result } = await fetchProjects()
+      // let prjInfo = result.map((item) => {
+      //   return {
+      //     name: item.orgName,
+      //     value: 'B06',
+      //     pid: 1,
+      //     children: item.prjList.map((i) => {
+      //       return { ...i, value: 'HB06', pid: 2, children: [] }
+      //     })
+      //   }
+      // })
+      // prjInfo = { name: '三峡发展', value: null, pid: 0, children: prjInfo }
+      let prjInfo = await this.getEpcProject()
       prjInfo = { name: '三峡发展', value: null, pid: 0, children: prjInfo }
-      console.log('用户项目信息', prjInfo)
       getUserList({ username: username }).then((res) => {
         try {
           // console.log(res.result.records[0].roleName)
@@ -79,80 +80,115 @@ export default {
           })
           if (!roleArr.includes(this.roc.description) && !roleArr.includes(this.robc.description)) {
             this.$store.state.bigScreen.isShowGroupPage = false
-            this.$store.dispatch('bigScreen/setProjectTreeData', [
-              {
-                name: '宜昌两网二期',
-                value: 'HB06',
-                pid: 2,
-                children: []
-              }
-            ])
+            this.$store.dispatch(
+              'bigScreen/setProjectTreeData',
+              this.flatten([prjInfo]).filter((e) => e.pid == 2)
+            )
+            //  [
+            //   {
+            //     name: '宜昌两网二期',
+            //     value: 'HB06',
+            //     pid: 2,
+            //     children: []
+            //   }
+            // ]
           } else {
             this.$store.state.bigScreen.isShowGroupPage = true
-            this.$store.dispatch('bigScreen/setProjectTreeData', [
-              prjInfo
-              // {
-              //   name: '三峡发展',
-              //   value: null,
-              //   pid: 0,
-              //   children: [
-              //     {
-              //       name: '三峡分公司',
-              //       value: 'B01',
-              //       pid: 1,
-              //       children: [
-              //         {
-              //           name: '宜昌两网二期',
-              //           value: 'HB06',
-              //           pid: 2,
-              //           children: []
-              //         }
-              //       ]
-              //     }
-              //   ]
-              // }
-            ])
+            this.$store.dispatch('bigScreen/setProjectTreeData', [prjInfo])
+            // {
+            //   name: '三峡发展',
+            //   value: null,
+            //   pid: 0,
+            //   children: [
+            //     {
+            //       name: '三峡分公司',
+            //       value: 'B01',
+            //       pid: 1,
+            //       children: [
+            //         {
+            //           name: '宜昌两网二期',
+            //           value: 'HB06',
+            //           pid: 2,
+            //           children: []
+            //         }
+            //       ]
+            //     }
+            //   ]
+            // }
           }
           if (roleArr.includes(this.roc.description) && !roleArr.includes(this.robc.description)) {
             this.$store.state.bigScreen.isShowGroupPage = true
             this.$store.dispatch('bigScreen/setProjectTreeData', [
-              {
-                name: '三峡发展',
-                value: null,
-                pid: 0,
-                children: [
-                  {
-                    name: '宜昌两网二期',
-                    value: 'HB06',
-                    pid: 2,
-                    children: []
-                  }
-                ]
-              }
+              { name: '三峡发展', value: null, pid: 0, children: this.flatten([prjInfo]).filter((e) => e.pid == 2) }
             ])
+            // [
+            //   {
+            //     name: '三峡发展',
+            //     value: null,
+            //     pid: 0,
+            //     children: [
+            //       {
+            //         name: '宜昌两网二期',
+            //         value: 'HB06',
+            //         pid: 2,
+            //         children: []
+            //       }
+            //     ]
+            //   }
+            // ]
           }
           if (!roleArr.includes(this.roc.description) && roleArr.includes(this.robc.description)) {
             this.$store.state.bigScreen.isShowGroupPage = true
-            this.$store.dispatch('bigScreen/setProjectTreeData', [
-              {
-                name: '三峡分公司',
-                value: 'B01',
-                pid: 1,
-                children: [
-                  {
-                    name: '宜昌两网二期',
-                    value: 'HB06',
-                    pid: 2,
-                    children: []
-                  }
-                ]
-              }
-            ])
+            this.$store.dispatch('bigScreen/setProjectTreeData', prjInfo.children)
+            // [
+            //   {
+            //     name: '三峡分公司',
+            //     value: 'B01',
+            //     pid: 1,
+            //     children: [
+            //       {
+            //         name: '宜昌两网二期',
+            //         value: 'HB06',
+            //         pid: 2,
+            //         children: []
+            //       }
+            //     ]
+            //   }
+            // ]
           }
         } catch (err) {
           console.log(err)
         }
       })
+    },
+    async getEpcProject() {
+      const res = await getEpcProjectList()
+      if (!res || res.code != 1) return
+      let tree = []
+      res.result.forEach((item) => {
+        const { son_company_name, son_company_code } = item || {}
+        let target = tree.find((e) => e.value == son_company_code)
+        if (!target) {
+          tree.push({
+            name: son_company_name,
+            value: son_company_code,
+            pid: 1,
+            children: [{ ...item, name: item.simple_name, pid: 2, value: item.project_parent_code, children: [] }]
+          })
+        } else {
+          target.children.push({
+            ...item,
+            name: item.simple_name,
+            pid: 2,
+            value: item.project_parent_code,
+            children: []
+          })
+        }
+      })
+      return tree
+    },
+    flatten(data) {
+      return [].concat(...data.map((item) => [].concat(item, ...this.flatten(item.children))))
     }
   },
   destroyed() {