scorpio hace 2 años
padre
commit
57834f434e

+ 4 - 0
src/api/common.js

@@ -1,4 +1,5 @@
 import fetch from '../api/fetch.js'
+import website from '@/config/website.js'
 
 export default {
   dicList(params) {
@@ -16,5 +17,8 @@ export default {
   },
   deptList(params) {
     return fetch('/blade-project-manage-v2/other/v2/deptList', params)
+  },
+  getMenus() {
+    return fetch('/blade-system/menu/routes', { clientId: website.clientId })
   }
 }

+ 1 - 0
src/api/fetch.js

@@ -14,6 +14,7 @@ axios.interceptors.request.use(
     // 小程序里用m的页面
     config.headers.Platform = 'pc'
     config.headers.type = 'web'
+    config.headers['data-type'] = 'project'
     if (getToken() === null || getToken() === undefined) {
       delete config.headers.token
     }

+ 37 - 75
src/layout/left.vue

@@ -11,7 +11,7 @@
       >
         <div
           v-for="(item, index) in data"
-          :key="item.name"
+          :key="item.id"
           class="full-width flex flex-col flex-center pointer"
         >
           <div
@@ -20,7 +20,7 @@
             :class="active === index ? 'item-s' : 'item'"
             @click="navClick(item, index)"
           >
-            <img :src="item.img" />
+            <img :src="item.source" />
             <span class="flex-child-average">{{ item.name }}</span>
           </div>
           <div
@@ -29,7 +29,7 @@
           >
             <div
               v-for="(sub, subIndex) in item.children"
-              :key="item.id"
+              :key="sub.id"
               class="padding full-width flex flex-center"
               :class="subIndex === subActive ? 'item-sub-active' : ''"
               @click="subClick(sub, subIndex)"
@@ -50,86 +50,48 @@ export default {
     return {
       active: 0,
       subActive: 0,
-      data: [
-        {
-          name: '投资管理',
-          img: new URL('../assets/svg/icon4.svg', import.meta.url).href,
-          children: [
-            {
-              name: '项目投资管理',
-              img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
-              path: '/'
-            },
-            {
-              name: '固定资产投资管理',
-              img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
-              path: '/'
-            }
-          ]
-        },
-        {
-          name: '项 目 库',
-          img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
-          children: [
-            {
-              name: '项目管理',
-              img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
-              path: '/home'
-            },
-            {
-              name: '固定资产管理',
-              img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
-              path: '/home'
-            }
-          ]
-        },
-        // {
-        //   name: '任务列表',
-        //   img: new URL('../assets/svg/icon1.svg', import.meta.url).href,
-        //   path: '/task'
-        // },
-        {
-          name: '资 料 库',
-          img: new URL('../assets/svg/icon2.svg', import.meta.url).href,
-          children: [
-            {
-              name: '项目资料',
-              img: new URL('../assets/svg/icon2.svg', import.meta.url).href,
-              path: '/database'
-            },
-            {
-              name: '内部资料',
-              img: new URL('../assets/svg/icon2.svg', import.meta.url).href,
-              path: '/company'
-            }
-          ]
-        },
-        {
-          name: '回 收 站',
-          img: new URL('../assets/svg/icon3.svg', import.meta.url).href,
-          path: '/recycle'
-        }
-      ],
+      data: [],
       currentPage: ''
     }
   },
+  watch: {
+    $route: {
+      immediate: false,
+      handler() {
+        this.currentPage = window.location.href
+        this.init()
+      }
+    }
+  },
   created() {
     this.currentPage = window.location.href
-    this.init()
+    this.menus()
   },
   methods: {
     init() {
-      if (this.currentPage.indexOf('/invest') > -1) {
-        this.active = 1
-        // } else if (this.currentPage.indexOf('/task') > -1) {
-        //   this.active = 2
-      } else if (this.currentPage.indexOf('/database') > -1) {
-        this.active = 2
-      } else if (this.currentPage.indexOf('/recycle') > -1) {
-        this.active = 3
-      } else {
-        this.active = 0
-      }
+      this.data.forEach((item, index) => {
+        if (item.children && item.children.length > 0) {
+          item.children.forEach((sub, subPoint) => {
+            if (this.currentPage.indexOf(sub.path) > -1) {
+              this.subActive = subPoint
+              this.active = index
+            }
+          })
+        } else {
+          const subIndex = this.currentPage.indexOf(item.path)
+          if (subIndex > -1) {
+            this.active = index
+          }
+        }
+      })
+    },
+    menus() {
+      this.$api.common.getMenus().then(res => {
+        if (res.code === 200) {
+          this.data = res.data
+          this.init()
+        }
+      })
     },
     navClick(item, index) {
       this.active = index

+ 171 - 117
src/views/company/index.vue

@@ -1,83 +1,112 @@
 <template>
-  <el-row :gutter="8" class='mt-10'>
-    <el-col :span="4">
-      <basic-container style='min-height: 720px;padding-left: 0'>
-        <div class='full-width  flex flex-center flex-justify-between'>
-          <span class='bold'>文件柜分类</span>
-          <el-button type='primary' @click='addFolder'>新 增</el-button>
+  <el-row :gutter="8" class="mt-10">
+    <el-col :span="6">
+      <basic-container style="min-height: 720px; padding-left: 0">
+        <div class="full-width flex flex-center flex-justify-between">
+          <span class="bold">文件柜分类</span>
+          <el-button type="primary" @click="addFolder">新 增</el-button>
         </div>
-        <el-divider/>
-        <div class='flex flex-col flex-justify-start flex-align-start padding' style='min-height: 900px'>
-          <span class=' full-width' v-for='(item,index) in folders' :key='item.id'>
-            <div class='item full-width flex flex-col pointer' :class='active === index ? "item-selected":"" '
-                 @click='changeFolder(index)'>
+        <el-divider />
+        <div
+          class="flex flex-col flex-justify-start flex-align-start padding"
+          style="min-height: 900px"
+        >
+          <span
+            class="full-width"
+            v-for="(item, index) in folders"
+            :key="item.id"
+          >
+            <div
+              class="item full-width flex flex-col pointer"
+              :class="active === index ? 'item-selected' : ''"
+              @click="changeFolder(index)"
+            >
               {{ item.title }}
             </div>
           </span>
         </div>
       </basic-container>
     </el-col>
-    <el-col :span="20">
+    <el-col :span="18">
       <basic-container class="grid-content bg-purple">
-        <div class='flex flex-center flex-justify-between'>
-          <div class='flex flex-center'>
-            <base-button class="ml-20 " icon="Plus" title="上传文件"
-                         @click="show = true"/>
-            <base-button class="ml-20 " icon="Back" title="返回上一层"
-                         v-if='currentFolder && currentFolder.parentId !== "0"'
-                         @click="backFolder"/>
+        <div class="flex flex-center flex-justify-between">
+          <div class="flex flex-center">
+            <base-button
+              class="ml-20"
+              icon="Plus"
+              title="上传文件"
+              @click="show = true"
+            />
+            <base-button
+              class="ml-20"
+              icon="Back"
+              title="返回上一层"
+              v-if="currentFolder && currentFolder.parentId !== '0'"
+              @click="backFolder"
+            />
           </div>
 
-          <div class='flex flex-center'>
-            <base-button class="ml-20 " icon="Plus" title="授权"
-                         @click="authorShow = true"/>
-            <base-button class="ml-20 " icon="Plus" title="新建文件夹"
-                         @click="addSubFolder"/>
+          <div class="flex flex-center">
+            <base-button
+              class="ml-20"
+              icon="Plus"
+              title="授权"
+              @click="authorShow = true"
+            />
+            <base-button
+              class="ml-20"
+              icon="Plus"
+              title="新建文件夹"
+              @click="addSubFolder"
+            />
           </div>
         </div>
         <basic-curd
-            :option="option"
-            :data="data"
-            @row-view='rowDetail'
-            @row-del="rowDel"
+          :option="option"
+          :data="data"
+          @row-view="rowDetail"
+          @row-del="rowDel"
         ></basic-curd>
       </basic-container>
     </el-col>
     <!--    dialog-->
-    <el-dialog v-model='show' title='上传文件'>
+    <el-dialog v-model="show" title="上传文件">
       <div>
         <el-upload
-            drag
-            :action="action"
-            multiple
-            accept='.doc,.docx,.pdf,.xls,.xlsx,.png,.jpg,.jpeg,.ppt,pptx'
-            show-file-list
-            :headers="{'Authorization':`Basic ${clientId}`}"
-            :on-success='uploadSuccess'
+          drag
+          :action="action"
+          multiple
+          accept=".doc,.docx,.pdf,.xls,.xlsx,.png,.jpg,.jpeg,.ppt,pptx"
+          show-file-list
+          :headers="{ Authorization: `Basic ${clientId}` }"
+          :on-success="uploadSuccess"
         >
           <el-icon class="el-icon--upload">
-            <upload-filled/>
+            <upload-filled />
           </el-icon>
-          <div class="el-upload__text">
-            拖拽或者 <em>点击上传文件</em>
-          </div>
+          <div class="el-upload__text">拖拽或者 <em>点击上传文件</em></div>
         </el-upload>
-        <el-divider/>
-        <div class='flex flex-justify-end'>
-          <el-button @click='show = false'>取 消</el-button>
-          <el-button type='primary' @click='saveFile'>确 定</el-button>
+        <el-divider />
+        <div class="flex flex-justify-end">
+          <el-button @click="show = false">取 消</el-button>
+          <el-button type="primary" @click="saveFile">确 定</el-button>
         </div>
       </div>
     </el-dialog>
 
     <el-image-viewer
-        v-if='showImage'
-        :url-list="imgList"
-        @close='showImage = false'
+      v-if="showImage"
+      :url-list="imgList"
+      @close="showImage = false"
     />
-    <el-dialog v-model='authorShow' title='批量授权'>
-      <authorize :list='data' :folder-id='currentFolder.id' :extra='{type:2}' :author-type='false'
-                 @close='authorShow = false'/>
+    <el-dialog v-model="authorShow" title="批量授权">
+      <authorize
+        :list="data"
+        :folder-id="currentFolder.id"
+        :extra="{ type: 2 }"
+        :author-type="false"
+        @close="authorShow = false"
+      />
     </el-dialog>
   </el-row>
 </template>
@@ -94,12 +123,12 @@ import baseButton from '@/components/base-button.vue'
 import basicCurd from '@/components/basic-curd/index.vue'
 import api from '@/api'
 import authorize from '@/views/home/component/authorize.vue'
-import {Base64} from 'js-base64'
+import { Base64 } from 'js-base64'
 import website from '@/config/website.js'
 
 export default {
   name: 'index',
-  components: {BasicContainer, baseButton, basicCurd, authorize},
+  components: { BasicContainer, baseButton, basicCurd, authorize },
   data() {
     return {
       clientId: '',
@@ -155,24 +184,26 @@ export default {
   },
   methods: {
     list() {
-      this.$api.company.list({current: 1, size: 100, parentId: ''}).then(res => {
-        if (res.code === 200) {
-          this.folders = res.data.records
-          if (this.folders.length > 0) {
-            this.currentFolder = this.folders[0]
+      this.$api.company
+        .list({ current: 1, size: 100, parentId: '' })
+        .then(res => {
+          if (res.code === 200) {
+            this.folders = res.data.records
+            if (this.folders.length > 0) {
+              this.currentFolder = this.folders[0]
+            }
+            this.onLoad()
+          } else {
+            this.$message.error(res.msg)
           }
-          this.onLoad()
-        } else {
-          this.$message.error(res.msg)
-        }
-      })
+        })
     },
     addFolder() {
       this.$prompt('请输入分类名称', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消'
-      }).then(({value}) => {
-        this.$api.company.submint({title: value, type: 2}).then(res => {
+      }).then(({ value }) => {
+        this.$api.company.submint({ title: value, type: 2 }).then(res => {
           if (res.code === 200) {
             this.$message.success(res.msg)
             this.list()
@@ -189,63 +220,81 @@ export default {
       this.onLoad()
     },
     onLoad() {
-      const data = {parentId: this.currentFolder.id}
-      this.$api.company.list(Object.assign(data, this.page)).then(res => {
-        if (res.code === 200) {
-          this.data = res.data.records
-          this.page.total = res.data.total
-        } else {
-          this.$message.error(res.msg)
-        }
-      }).finally(() => {
-        this.loading = false
-      })
+      const data = { parentId: this.currentFolder.id }
+      this.$api.company
+        .list(Object.assign(data, this.page))
+        .then(res => {
+          if (res.code === 200) {
+            this.data = res.data.records
+            this.page.total = res.data.total
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+        .finally(() => {
+          this.loading = false
+        })
     },
     rowSave(row, done, loading) {
       const data = {
         projectInfoId: this.info.id
       }
-      this.$api.projects.meeting.save(Object.assign(row, data)).then((res) => {
-        if (res.code === 200) {
-          this.$message.success(res.msg)
-        } else {
-          this.$message.error(res.msg)
+      this.$api.projects.meeting.save(Object.assign(row, data)).then(
+        res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+          done(row)
+          this.onLoad()
+        },
+        error => {
+          window.console.log(error)
+          loading()
         }
-        done(row)
-        this.onLoad()
-      }, error => {
-        window.console.log(error)
-        loading()
-      })
+      )
     },
     rowUpdate(row, index, done, loading) {
       const data = {
         projectInfoId: this.info.id
       }
-      this.$api.projects.meeting.update(Object.assign(row, data)).then((res) => {
-        if (res.code === 200) {
-          this.$message.success(res.msg)
-        } else {
-          this.$message.error(res.msg)
+      this.$api.projects.meeting.update(Object.assign(row, data)).then(
+        res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+          done(row)
+          this.onLoad()
+        },
+        error => {
+          window.console.log(error)
+          loading()
         }
-        done(row)
-        this.onLoad()
-      }, error => {
-        window.console.log(error)
-        loading()
-      })
+      )
     },
     rowDetail(row, index) {
       if (row.type === 1) {
-        if (['pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'].includes(row.suffix)) {
-          const routeData = this.$router.resolve({path: '/home/file_detail', query: {id: row.fileId}})
+        if (
+          ['pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'].includes(
+            row.suffix
+          )
+        ) {
+          const routeData = this.$router.resolve({
+            path: '/home/file_detail',
+            query: { id: row.fileId }
+          })
           window.open(routeData.href, '_blank')
         } else {
           this.imgList = [row.url]
           this.showImage = true
         }
       } else {
-        this.lastParentFolder = this.lastParentFolder.filter(sub => sub.id !== this.currentFolder.id)
+        this.lastParentFolder = this.lastParentFolder.filter(
+          sub => sub.id !== this.currentFolder.id
+        )
         this.lastParentFolder.push(this.currentFolder)
         this.currentFolder = row
         this.onLoad()
@@ -257,17 +306,19 @@ export default {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
-      }).then(() => {
-        return this.$api.company.removeList({ids: row.id})
-      }).then(() => {
-        this.$message({
-          type: 'success',
-          message: '操作成功!'
-        })
-        // 数据回调进行刷新
-        this.onLoad()
-      }).catch(() => {
       })
+        .then(() => {
+          return this.$api.company.removeList({ ids: row.id })
+        })
+        .then(() => {
+          this.$message({
+            type: 'success',
+            message: '操作成功!'
+          })
+          // 数据回调进行刷新
+          this.onLoad()
+        })
+        .catch(() => {})
     },
     uploadSuccess(res, file, files) {
       this.fileList = files.map(sub => sub.response.data)
@@ -330,8 +381,8 @@ export default {
       this.$prompt('请输入文件夹名称', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消'
-      }).then(({value}) => {
-        const data = {parentId: this.currentFolder.id, title: value, type: 2}
+      }).then(({ value }) => {
+        const data = { parentId: this.currentFolder.id, title: value, type: 2 }
         this.$api.company.submint(data).then(res => {
           if (res.code === 200) {
             this.$message.success(res.msg)
@@ -343,8 +394,11 @@ export default {
       })
     },
     backFolder() {
-      this.currentFolder = this.lastParentFolder[this.lastParentFolder.length - 1]
-      this.lastParentFolder = this.lastParentFolder.filter(sub => sub.id !== this.currentFolder.id)
+      this.currentFolder =
+        this.lastParentFolder[this.lastParentFolder.length - 1]
+      this.lastParentFolder = this.lastParentFolder.filter(
+        sub => sub.id !== this.currentFolder.id
+      )
       this.onLoad()
     }
   }
@@ -357,16 +411,16 @@ export default {
   margin-bottom: 10px;
   border-radius: 8px;
   text-align: left;
-  background-color: #E4E4E4;
+  background-color: #e4e4e4;
 }
 
 .item:hover {
-  background-color: #AB7630;
+  background-color: #ab7630;
   color: white;
 }
 
 .item-selected {
-  background-color: #AB7630;
+  background-color: #ab7630;
   color: white;
 }
 

+ 9 - 13
src/views/home/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="flex flex-col full-height full-width">
-    <top-serach v-if="type === 0"/>
-    <owner-serach v-else-if="type === 1"/>
+    <top-serach v-if="type === 0" />
+    <owner-serach v-else-if="type === 1" />
     <div class="full-width full-height mt-10">
-      <dash/>
+      <dash />
     </div>
   </div>
 </template>
@@ -11,7 +11,7 @@
 <route>
 {
 path: '/home',
-name: '项目库',
+name: '固定资产项目管理',
 }
 </route>
 
@@ -25,27 +25,23 @@ import tokenStore from '../../store/token.js'
 
 export default {
   components: { topSerach, dash, ownerSerach },
-  setup () {
+  setup() {
     const store = useStore()
     const token = tokenStore()
     return { store, token }
   },
-  data () {
+  data() {
     return {
       type: 1
     }
   },
-  created () {
-
-  },
+  created() {},
   methods: {
-    push () {
+    push() {
       this.$router.push({ path: '/setting', query: { id: 12, type: 'test' } })
     }
   }
 }
 </script>
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>

+ 47 - 0
src/views/home/project.vue

@@ -0,0 +1,47 @@
+<template>
+  <div class="flex flex-col full-height full-width">
+    <top-serach v-if="type === 0" />
+    <owner-serach v-else-if="type === 1" />
+    <div class="full-width full-height mt-10">
+      <dash />
+    </div>
+  </div>
+</template>
+
+<route>
+{
+path: '/project',
+name: '项目管理',
+}
+</route>
+
+<script>
+import topSerach from './component/top_serach.vue'
+import ownerSerach from './component/owner_serach.vue'
+import dash from './component/dash.vue'
+import { useStore } from '@/store/user.js'
+
+import tokenStore from '../../store/token.js'
+
+export default {
+  components: { topSerach, dash, ownerSerach },
+  setup() {
+    const store = useStore()
+    const token = tokenStore()
+    return { store, token }
+  },
+  data() {
+    return {
+      type: 1
+    }
+  },
+  created() {},
+  methods: {
+    push() {
+      this.$router.push({ path: '/setting', query: { id: 12, type: 'test' } })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 2 - 2
src/views/invest/index.vue

@@ -1,12 +1,12 @@
 <template>
   <div class="flex flex-center full-width">
     <div class="full-width flex mt-10">
-      <el-col :span="4" v-if="hasChildrenDept">
+      <el-col :span="6" v-if="hasChildrenDept">
         <basic-container>
           <left :has-children="hasChildrenDept" @change="changeDept" />
         </basic-container>
       </el-col>
-      <el-col :span="hasChildrenDept ? 20 : 24">
+      <el-col :span="hasChildrenDept ? 18 : 24">
         <basic-container>
           <div class="flex flex-align-start">
             <el-select

+ 95 - 0
src/views/invest/resource.vue

@@ -0,0 +1,95 @@
+<template>
+  <div class="full-width flex flex-align-start flex-justify-center mt-10">
+    <el-col :span="6">
+      <basic-container>
+        <left />
+      </basic-container>
+    </el-col>
+    <el-col :span="18">
+      <basic-container>
+        <!--        年度-->
+        <years />
+      </basic-container>
+
+      <basic-container>
+        <div class="flex query-screen">
+          <div class="flex flex-col flex-child-average">
+            <div class="flex flex-center flex-justify-between">
+              <span class="font-16 bold full-width text-left"
+                >投资数据统计 单位(亿元)</span
+              >
+              <div
+                class="flex flex-center"
+                :class="isAverage ? 'green' : 'red'"
+              >
+                <el-icon>
+                  <Warning />
+                </el-icon>
+                <span
+                  class="full-width text-right ml-5 nowrap mr-20"
+                  v-if="isAverage"
+                  >上月已完成平均投资指标</span
+                >
+                <span class="full-width text-right ml-5 nowrap mr-20" v-else
+                  >上月未完成平均投资指标</span
+                >
+              </div>
+            </div>
+            <div class="flex flex-center flex-justify-between">
+              <span class="font-16 bold full-width text-left"
+                >项目入库统计 单位(个)</span
+              >
+            </div>
+          </div>
+
+          <div class="flex flex-center flex-justify-between flex-child-average">
+            <span class="font-16 bold full-width text-left">
+              各部门/乡镇投资完成情况总览
+            </span>
+          </div>
+        </div>
+      </basic-container>
+    </el-col>
+  </div>
+</template>
+
+<route>
+{
+name: '固定资产投资管理',
+}
+</route>
+
+<script>
+import BasicContainer from '@/components/basic-container/main.vue'
+import years from '@/views/invest/components/years.vue'
+import left from '@/views/invest/components/left.vue'
+
+export default {
+  components: { BasicContainer, years, left },
+  data() {
+    return {}
+  },
+  mounted() {
+    this.init()
+  },
+  methods: {
+    init() {
+      const screenWidth = window.innerWidth
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.content {
+  border-radius: 10px;
+  background-color: white;
+  font-size: 23px;
+}
+
+@media (max-width: 1440px) {
+  .query-screen {
+    flex-direction: column;
+  }
+}
+</style>