scorpio 2 лет назад
Родитель
Сommit
96404768ff
4 измененных файлов с 87 добавлено и 45 удалено
  1. 8 2
      src/api/system/index.js
  2. 0 6
      src/page/login.vue
  3. 53 24
      src/views/invest/components/left.vue
  4. 26 13
      src/views/invest/index.vue

+ 8 - 2
src/api/system/index.js

@@ -5,7 +5,7 @@ export default {
    * 获取用户菜单
    * @returns {Promise<unknown>}
    */
-  getMenus () {
+  getMenus() {
     return fetch('/blade-system/menu/routes')
   },
   /**
@@ -13,7 +13,13 @@ export default {
    * @param params
    * @returns {Promise | Promise<unknown>}
    */
-  getDeptLazy (params) {
+  getDeptLazy(params) {
     return fetch('/blade-system/dept/lazy-list', params)
+  },
+  /**
+   * 机构详情
+   */
+  getDeptDetail(params) {
+    return fetch('blade-system/dept/detail', params)
   }
 }

+ 0 - 6
src/page/login.vue

@@ -103,10 +103,7 @@
                       placeholder="验证码"
                       prefix-icon="Refresh"
                       size="large"
-<<<<<<< HEAD
                       @keyup.enter="submint"
-=======
->>>>>>> prod
                     >
                       <template v-slot:append>
                         <img
@@ -118,10 +115,7 @@
                             background-color: red;
                             background-blend-mode: lighten;
                           "
-<<<<<<< HEAD
                           alt="code"
-=======
->>>>>>> prod
                         />
                       </template>
                     </el-input>

+ 53 - 24
src/views/invest/components/left.vue

@@ -2,21 +2,40 @@
   <div>
     <div class="flex flex-col flex-center full-height">
       <span class="font-16 grey-6 bold">年度资金管理</span>
-      <div v-if='user.info.viewStage === 1'>
-        <base-button  class="mt-20" title="全县投资情况" icon=""
-                     :type='active === -1 ? "1" :"2" ' @click='viewAll'/>
-        <el-link type='primary' class='mt-20 pointer' @click='download("https://wutong-1302848345.cos.ap-chengdu.myqcloud.com/wtzx/0c8500447e3947cab5a1353b891db963.docx")'>智能监测预警分析报告</el-link>
+      <div v-if="user.info.viewStage === 1">
+        <base-button
+          class="mt-20"
+          title="全县投资情况"
+          icon=""
+          :type="active === -1 ? '1' : '2'"
+          @click="viewAll"
+        />
+        <el-link
+          type="primary"
+          class="mt-20 pointer"
+          @click="
+            download(
+              'https://wutong-1302848345.cos.ap-chengdu.myqcloud.com/wtzx/0c8500447e3947cab5a1353b891db963.docx'
+            )
+          "
+          >智能监测预警分析报告</el-link
+        >
       </div>
-      <div v-else style='height: 55px'></div>
-      <div class='full-width flex flex-center mt-20'>
+      <div v-else style="height: 55px"></div>
+      <div class="full-width flex flex-center mt-20">
         <el-tabs v-model="activeName" class="font-16" @tab-change="getOrg">
-          <el-tab-pane label="部门" name="1"/>
-          <el-tab-pane label="乡镇" name="2"/>
+          <el-tab-pane label="部门" name="1" />
+          <el-tab-pane label="乡镇" name="2" v-if="user.info.viewStage === 1" />
         </el-tabs>
       </div>
-      <div class='content hide-scrollbar'>
-        <div v-for='(i,index) in deptList' class='item white bold font-16' :key='i.id'
-             :class='active === index ? "item-select white" : "" ' @click='change(index)'>
+      <div class="content hide-scrollbar">
+        <div
+          v-for="(i, index) in deptList"
+          class="item white bold font-16"
+          :key="i.id"
+          :class="active === index ? 'item-select white' : ''"
+          @click="change(index)"
+        >
           {{ i.deptName }}
         </div>
       </div>
@@ -31,22 +50,28 @@ import { useStore } from '@/store/user.js'
 export default {
   name: 'left',
   components: { baseButton },
-  setup () {
+  setup() {
     const user = useStore()
     return { user }
   },
-  data () {
+  props: {
+    hasChildren: {
+      type: Boolean,
+      default: true
+    }
+  },
+  data() {
     return {
       activeName: '1',
       deptList: [],
       active: -1
     }
   },
-  created () {
+  created() {
     this.getOrg()
   },
   methods: {
-    getOrg () {
+    getOrg() {
       this.$api.common.deptList({ type: this.activeName }).then(res => {
         if (res.code === 200) {
           this.deptList = res.data.map(e => {
@@ -56,21 +81,25 @@ export default {
           if (this.active !== -1) {
             this.change(0)
           }
+          // 如果不是住建局,默认选中第一条
+          if (this.user.info.viewStage !== 1) {
+            this.active = 0
+          }
         } else {
           this.$message.error(res.msg)
         }
       })
     },
 
-    change (index) {
+    change(index) {
       this.active = index
       this.$emit('change', this.deptList[index])
     },
-    viewAll () {
+    viewAll() {
       this.active = -1
       this.$emit('change', null)
     },
-    download (url) {
+    download(url) {
       window.open(
         url,
         '_blank' // <- This is what makes it open in a new window.
@@ -80,21 +109,21 @@ export default {
 }
 </script>
 
-<style lang='scss' scoped>
+<style lang="scss" scoped>
 .content {
-  height: 830px;
-  overflow-y: scroll
+  height: 835px;
+  overflow-y: scroll;
 }
 
 .item {
   padding: 10px 20px;
   margin-bottom: 10px;
-  color: #ABADAA;
-  border-bottom: #ABADAA solid 0.5px;
+  color: #abadaa;
+  border-bottom: #abadaa solid 0.5px;
 }
 
 .item-select {
-  background-color: #4390F9;
+  background-color: #4390f9;
   border-radius: 10px;
   padding: 10px 20px;
   margin-bottom: 10px;

+ 26 - 13
src/views/invest/index.vue

@@ -1,15 +1,14 @@
 <template>
   <div class="flex flex-center full-width">
-    <div class="ml-10 mr-10 mt-10 flex flex-align-start full-width">
-      <basic-container
-        style="flex: 1; padding: 0"
-        v-if="user.info.viewStage === 1"
-      >
-        <left @change="changeDept" />
-      </basic-container>
-      <div class="full-width ml-5" style="flex: 4">
-        <basic-container class="full-width">
-          <div class="flex flex-align-start mb-15">
+    <div class="full-width flex mt-10">
+      <el-col :span="4" v-if="hasChildrenDept">
+        <basic-container>
+          <left :has-children="hasChildrenDept" @change="changeDept" />
+        </basic-container>
+      </el-col>
+      <el-col :span="hasChildrenDept ? 20 : 24">
+        <basic-container>
+          <div class="flex flex-align-start">
             <el-select
               v-model="year"
               clearable
@@ -24,7 +23,7 @@
               />
             </el-select>
           </div>
-          <div>
+          <div class="mt-20">
             <years :dept-id="dept" :year="year" @change="change" />
           </div>
         </basic-container>
@@ -79,7 +78,7 @@
             <div class="white-bg padding"></div>
             <div class="flex-child-average">
               <amount
-                v-if="dept === null && user.info.viewStage === 1"
+                v-if="dept === null && hasChildrenDept"
                 :type="yearType"
                 :deptId="dept"
                 :year="year"
@@ -88,7 +87,7 @@
             </div>
           </div>
         </basic-container>
-      </div>
+      </el-col>
     </div>
   </div>
 </template>
@@ -124,6 +123,7 @@ export default {
       },
       dept: null,
       year: '',
+      hasChildrenDept: false,
       years: [
         {
           value: 2023
@@ -153,8 +153,21 @@ export default {
   created() {
     this.year = new Date().getFullYear()
     this.isBelowAverage()
+    this.deptDetail()
   },
   methods: {
+    deptDetail() {
+      this.$api.system
+        .getDeptDetail({ id: this.user.info.deptId })
+        .then(res => {
+          if (res.code === 200) {
+            this.hasChildrenDept = res.data.hasChildren
+            console.log(res.data)
+          } else {
+            console.log(res.msg)
+          }
+        })
+    },
     changeDept(res) {
       if (res === null) {
         this.dept = null