Browse Source

merge fix

scorpio 2 năm trước cách đây
mục cha
commit
b9a385043b

+ 6 - 1
src/layout/index.vue

@@ -7,7 +7,7 @@
       <el-header class='header'>
         <top/>
       </el-header>
-      <el-main class='wt-main orange-bg'>
+      <el-main class='wt-main orange-bg' @scroll='scroll'>
         <div>
           <router-view v-slot="{ Component, route }">
             <keep-alive :include='keepAlive.list'>
@@ -36,6 +36,11 @@ export default {
     this.keepAlive.$subscribe((res) => {
       console.log(this.keepAlive.list)
     })
+  },
+  methods: {
+    scroll (event) {
+      this.$bus.emit('scorll', event)
+    }
   }
 }
 </script>

+ 47 - 43
src/views/home/component/dash.vue

@@ -126,18 +126,18 @@
 <script>
 import BaseButton from '../../../components/base-button.vue'
 import permissionStore from '@/store/permission.js'
-import {vaildData} from '@/utils/tools.js'
+import { vaildData } from '@/utils/tools.js'
 import form_dialog from '@/views/home/component/form_dialog.vue'
-import {getLazyList} from '@/api/project/index.js'
+import { getLazyList } from '@/api/project/index.js'
 
 export default {
   name: 'dash',
-  components: {BaseButton, form_dialog},
-  setup() {
+  components: { BaseButton, form_dialog },
+  setup () {
     const permissions = permissionStore()
-    return {permissions}
+    return { permissions }
   },
-  data() {
+  data () {
     return {
       disable: false,
       showAdd: false,
@@ -152,6 +152,7 @@ export default {
         lazy: true,
         columnBtn: false,
         searchShow: true,
+        selection: true,
         editBtn: true,
         editBtnText: '资料管理',
         editBtnIcon: 'Document',
@@ -162,7 +163,7 @@ export default {
         align: 'center',
         viewBtn: true,
         viewBtnText: '详情',
-        menuWidth: 320,
+        menuWidth: 380,
         dialogClickModal: false,
         column: [
           {
@@ -194,16 +195,18 @@ export default {
           },
           {
             label: '股(科)室',
-            prop: 'createDeptName'
+            prop: 'createDeptName',
+            width: 180
           },
           {
             label: '子项目数量',
-            prop: 'lot'
+            prop: 'lot',
+            width: 180
           },
           {
             label: '是否开工',
             prop: 'isStart',
-            width: 120,
+            width: 180,
             dicData: [
               {
                 label: '否',
@@ -218,11 +221,12 @@ export default {
           {
             label: '项目类型',
             prop: 'projectTypeName',
-            width: 120
+            width: 180
           },
           {
             label: '创建时间',
-            prop: 'createTime'
+            prop: 'createTime',
+            width: 180
           }]
       },
       page: {
@@ -265,7 +269,7 @@ export default {
       },
       rules: {
         name: [
-          {required: true, message: '请输入项目名称', trigger: 'blur'}
+          { required: true, message: '请输入项目名称', trigger: 'blur' }
         ],
         projectType: [
           {
@@ -286,27 +290,27 @@ export default {
       parentId: 0
     }
   },
-  created() {
+  created () {
     this.getTypeList()
     this.$bus.on('serach', (res) => {
       this.onLoad(res)
     })
   },
   computed: {
-    permissionList() {
+    permissionList () {
       return {
         delBtn: vaildData(this.permissions.permissions.home_del, false)
       }
     }
   },
   methods: {
-    switchTab(item, index) {
+    switchTab (item, index) {
       this.active = index
       this.onLoad()
     },
-    onLoad(query = {}) {
+    onLoad (query = {}) {
       this.loading = true
-      const data = {...query, parentId: this.parentId}
+      const data = { ...query, parentId: this.parentId }
       this.$api.project.projectList(this.page.currentPage, this.page.pageSize, data).then(res => {
         this.loading = false
         if (res.code === 200) {
@@ -320,11 +324,11 @@ export default {
         this.loading = false
       })
     },
-    beforeOpen(done, type) {
+    beforeOpen (done, type) {
       if (['edit'].includes(type)) {
         this.$router.push({
           path: '/home/details',
-          query: {id: this.form.id, type: '0', ownerId: this.form.createUser}
+          query: { id: this.form.id, type: '0', ownerId: this.form.createUser }
         })
       } else if (type === 'view') {
         // this.$alert('功能建设中,尽情期待...', '消息提醒', {
@@ -332,51 +336,51 @@ export default {
         // })
         this.$router.push({
           path: '/home/pro_detail',
-          query: {id: this.form.id}
+          query: { id: this.form.id }
         })
       }
     },
-    currentChange(currentPage) {
+    currentChange (currentPage) {
       this.page.current = currentPage
     },
-    sizeChange(pageSize) {
+    sizeChange (pageSize) {
       this.page.size = pageSize
     },
-    refreshChange() {
+    refreshChange () {
       this.onLoad()
     },
-    treeLoad(tree, treeNode, resolve) {
+    treeLoad (tree, treeNode, resolve) {
       this.loading = true
       getLazyList(tree.id).then(res => {
         this.loading = false
         resolve(res.data.data.childrenList)
       })
     },
-    rowDel(row) {
+    rowDel (row) {
       this.$confirm('确定删除选择的项目?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
-          .then(() => {
-            this.$api.project.projectRemove({ids: row.id}).then(res => {
-              if (res.code === 200) {
-                this.$message.success(res.msg)
-                this.onLoad()
-              } else {
-                this.$message.error(res.msg)
-              }
-            })
+        .then(() => {
+          this.$api.project.projectRemove({ ids: row.id }).then(res => {
+            if (res.code === 200) {
+              this.$message.success(res.msg)
+              this.onLoad()
+            } else {
+              this.$message.error(res.msg)
+            }
           })
+        })
     },
-    getStageList() {
+    getStageList () {
       this.$api.project.userStageList().then(res => {
         if (res.code === 200) {
           this.stage = res.data
         }
       })
     },
-    getTotalAmount(data) {
+    getTotalAmount (data) {
       this.$api.project.totalAmount(Object.assign(data, this.query)).then(res => {
         if (res.code === 200) {
           this.num = res.data
@@ -385,17 +389,17 @@ export default {
         }
       })
     },
-    getTypeList() {
-      this.$api.project.typeList({type: 1, size: 999, current: 1}).then(res => {
+    getTypeList () {
+      this.$api.project.typeList({ type: 1, size: 999, current: 1 }).then(res => {
         this.typeList = res.data.records
       })
-      this.$api.common.dicList({code: 'project-tags'}).then(res => {
+      this.$api.common.dicList({ code: 'project-tags' }).then(res => {
         if (res.code === 200) {
           this.tagsList = res.data
         }
       })
     },
-    track(res) {
+    track (res) {
       if (res.isReport === 1) {
         this.$message.error('该项目已经上报')
         return
@@ -405,7 +409,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        const data = {id: res.id, isReport: 1}
+        const data = { id: res.id, isReport: 1 }
         this.$api.project.proUpdate(data).then(res => {
           if (res.code === 200) {
             console.log(res)
@@ -416,7 +420,7 @@ export default {
         })
       })
     },
-    projectSave() {
+    projectSave () {
       if (this.disable) {
         this.$message.error('正在处理,请稍后...')
         return

+ 2 - 2
src/views/home/component/params/params1.vue

@@ -1,6 +1,6 @@
 <template>
   <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='full-width text-left'>{{ info.dictValue }}</span>
+    <span class='full-width text-left bold'>{{ info.dictValue }}</span>
     <div class='mt-10' style='width: 80%;'>
       <el-form
           :model="form"
@@ -116,7 +116,7 @@ export default {
       default: null
     }
   },
-  data() {
+  data () {
     return {
       form: {
         name: '',

+ 3 - 3
src/views/home/component/params/params2.vue

@@ -1,6 +1,6 @@
 <template>
   <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='full-width text-left'>{{ info.dictValue }}</span>
+    <span class='full-width text-left bold'>{{ info.dictValue }}</span>
     <div class='mt-10' style='width: 80%;'>
       <el-form
           :model="form"
@@ -58,14 +58,14 @@
 
 <script>
 export default {
-  name: "params2",
+  name: 'params2',
   props: {
     info: {
       type: Object,
       default: null
     }
   },
-  data() {
+  data () {
     return {
       form: {
         name: '',

+ 5 - 5
src/views/home/component/params/params3.vue

@@ -1,6 +1,6 @@
 <template>
   <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='full-width text-left'>{{ info.dictValue }}</span>
+    <span class='full-width text-left bold'>{{ info.dictValue }}</span>
     <div class="mt-10 mb-10 full-width" style="width: 93%;">
       <base-button title="新增年度" icon="Plus"/>
     </div>
@@ -79,18 +79,18 @@
 </template>
 
 <script>
-import baseButton from "@/components/base-button.vue";
+import baseButton from '@/components/base-button.vue'
 
 export default {
-  name: "params3",
-  components: {baseButton},
+  name: 'params3',
+  components: { baseButton },
   props: {
     info: {
       type: Object,
       default: null
     }
   },
-  data() {
+  data () {
     return {
       form: {
         name: '',

+ 3 - 3
src/views/home/component/params/params4.vue

@@ -1,6 +1,6 @@
 <template>
   <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='full-width text-left'>{{ info.dictValue }}</span>
+    <span class='full-width text-left bold'>{{ info.dictValue }}</span>
     <div class='mt-10' style='width: 80%;'>
       <el-form
           :model="form"
@@ -66,14 +66,14 @@
 
 <script>
 export default {
-  name: "params4",
+  name: 'params4',
   props: {
     info: {
       type: Object,
       default: null
     }
   },
-  data() {
+  data () {
     return {
       form: {
         name: '',

+ 3 - 3
src/views/home/component/params/params5.vue

@@ -1,6 +1,6 @@
 <template>
   <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='full-width text-left'>{{ info.dictValue }}</span>
+    <span class='full-width text-left bold'>{{ info.dictValue }}</span>
     <div class='mt-10' style='width: 80%;'>
       <el-form
           :model="form"
@@ -66,14 +66,14 @@
 
 <script>
 export default {
-  name: "params5",
+  name: 'params5',
   props: {
     info: {
       type: Object,
       default: null
     }
   },
-  data() {
+  data () {
     return {
       form: {
         name: '',

+ 3 - 3
src/views/home/component/params/params6.vue

@@ -1,6 +1,6 @@
 <template>
   <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='full-width text-left'>{{ info.dictValue }}</span>
+    <span class='full-width text-left bold'>{{ info.dictValue }}</span>
     <div class='mt-10' style='width: 80%;'>
       <el-form
           :model="form"
@@ -66,14 +66,14 @@
 
 <script>
 export default {
-  name: "params6",
+  name: 'params6',
   props: {
     info: {
       type: Object,
       default: null
     }
   },
-  data() {
+  data () {
     return {
       form: {
         name: '',

+ 47 - 7
src/views/home/component/pro_left.vue

@@ -8,12 +8,12 @@
             data.totalAmount ? data.totalAmount.toLocaleString() : '-'
           }}万元</span>
         <div class="flex flex-center mt-10">
-          <span class="bold mr-15" style="color:#787C90;">{{ currentSituation.dictValue }}</span>
+          <!--          <span class="bold mr-15" style="color:#787C90;">{{ currentSituation.dictValue }}</span>-->
           <el-select
               v-model="keyWords"
-              placeholder="修改"
+              class='bold'
+              :placeholder="currentSituation.dictValue"
               size="small"
-              style="width: 60px"
               @change="result"
           >
             <el-option
@@ -33,7 +33,7 @@
            style="height: 50vh;overflow-x: auto;">
         <div class="flex flex-center grey-9 font-15 bold pointer"
              :class="active === index ? 'box-s' : 'box'"
-             v-for="(item,index) in dicList1" :key="item.id" @click="active = index">{{
+             v-for="(item,index) in dicList1" :key="item.id" @click="change(index)">{{
             item.dictValue
           }}
         </div>
@@ -46,12 +46,11 @@
 </template>
 
 <script>
-import mainButton from '@/components/main-button.vue'
 import proRelation from '@/views/home/component/pro_relation.vue'
 
 export default {
   name: 'pro_left',
-  components: { mainButton, proRelation },
+  components: { proRelation },
   props: {
     data: Object,
     code: {
@@ -86,13 +85,26 @@ export default {
       active: 0,
       showRelation: false,
       projectId: '',
-      resultList: []
+      resultList: [],
+      scorllTopList: []
     }
   },
   created () {
     this.getDic(this.code)
+    this.onScroll()
   },
   methods: {
+    onScroll (event) {
+      this.$bus.on('scorll', (e) => {
+        const scrollTop = e.target.scrollTop
+        const index = this.scorllTopList.findIndex(e => scrollTop >= e.start && scrollTop < e.end)
+        console.log(index)
+        this.active = index
+        if (e.target.scrollTop === 0) {
+          this.active = 0
+        }
+      })
+    },
     getDic (code) {
       this.$api.common.dicList({ code }).then(res => {
         if (res.code === 200) {
@@ -106,6 +118,18 @@ export default {
             this.dicList1 = res.data
             this.resultList = this.dicList1
             this.$emit('success', this.resultList)
+            this.scorllTopList = []
+            setTimeout(() => {
+              for (let i = 0; i < this.resultList.length; i++) {
+                const start = i === 0 ? 0 : document.getElementById('header' + i).offsetTop
+                const end = document.getElementById('header' + (i + 1)).offsetTop
+                const data = {
+                  index: i, start, end
+                }
+                console.log(data)
+                this.scorllTopList.push(data)
+              }
+            }, 500)
           }
         }
       })
@@ -115,6 +139,22 @@ export default {
     },
     record () {
       this.$emit('typeChange1')
+    },
+    result (item) {
+      const data = { id: this.data.id, projectStage: item }
+      this.$api.project.proUpdate(data).then(res => {
+        if (res.code === 200) {
+          this.$message.success(res.msg)
+          const local = this.dicList.findIndex(e => e.dictKey === item)
+          this.currentSituation = this.dicList[local]
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
+    },
+    change (index) {
+      this.active = index
+      this.$emit('change', index)
     }
   }
 }

+ 36 - 27
src/views/home/pro_detail.vue

@@ -1,25 +1,23 @@
 <template>
   <div class='flex flex-justify-start'>
     <div class="full-height">
-      <pro-left :data="data" :code='code' @success='listSucc'/>
+      <pro-left :data="data" :code='code' @success='listSucc' @change='changeIndex'/>
     </div>
-    <div style='margin-left: 300px' class='full-width'>
+    <div style='margin-left: 300px;' class='full-width' ref='content'>
       <basic-container>
         <basic-tab :tabs='tabs' @change='change'></basic-tab>
       </basic-container>
 
       <div v-if='currentTab.value === 1'>
         <basic-container v-for='(item,index) in resultList' :key='item.id'>
-          <a :href='`#header`+(index+1)'>
-            <div class='full-width' :id="`header`+(index+1)">
-              <params1 v-if='item.dictKey === "1" ' :info='item'/>
-              <params2 v-if='item.dictKey === "2" ' :info='item'/>
-              <params3 v-if='item.dictKey === "3" ' :info='item'/>
-              <params4 v-if='item.dictKey === "4" ' :info='item'/>
-              <params5 v-if='item.dictKey === "5" ' :info='item'/>
-              <params6 v-if='item.dictKey === "6" ' :info='item'/>
-            </div>
-          </a>
+          <div class='full-width padding-top' :id="`header`+(index+1)">
+            <params1 v-if='item.dictKey === "1" ' :info='item'/>
+            <params2 v-if='item.dictKey === "2" ' :info='item'/>
+            <params3 v-if='item.dictKey === "3" ' :info='item'/>
+            <params4 v-if='item.dictKey === "4" ' :info='item'/>
+            <params5 v-if='item.dictKey === "5" ' :info='item'/>
+            <params6 v-if='item.dictKey === "6" ' :info='item'/>
+          </div>
         </basic-container>
       </div>
       <div v-else-if='currentTab.value === 2'>
@@ -49,52 +47,63 @@ import proLeft from '@/views/home/component/pro_left.vue'
 import BasicContainer from '@/components/basic-container/main.vue'
 import BasicTab from '@/components/basic-tab/index.vue'
 import params1 from '@/views/home/component/params/params1.vue'
-import params2 from "@/views/home/component/params/params2.vue";
-import params3 from "@/views/home/component/params/params3.vue";
-import params4 from "@/views/home/component/params/params4.vue";
-import params5 from "@/views/home/component/params/params5.vue";
-import params6 from "@/views/home/component/params/params6.vue";
+import params2 from '@/views/home/component/params/params2.vue'
+import params3 from '@/views/home/component/params/params3.vue'
+import params4 from '@/views/home/component/params/params4.vue'
+import params5 from '@/views/home/component/params/params5.vue'
+import params6 from '@/views/home/component/params/params6.vue'
 import inspect1 from '@/views/home/component/inspect/Inspect1.vue'
 
 export default {
   name: 'pro_detail',
-  components: {BasicContainer, proLeft, BasicTab, params1, inspect1, params2, params3, params4, params5, params6},
-  data() {
+  components: { BasicContainer, proLeft, BasicTab, params1, inspect1, params2, params3, params4, params5, params6 },
+  data () {
     return {
       id: '',
       data: {},
       tabs: [
-        {name: '项目信息管理', value: 1, code: 'params_type'},
-        {name: '项目督查情况', value: 2, code: 'inspect_type'},
-        {name: '项目数据明细管理', value: 3}
+        { name: '项目信息管理', value: 1, code: 'params_type' },
+        { name: '项目督查情况', value: 2, code: 'inspect_type' },
+        { name: '项目数据明细管理', value: 3 }
       ],
       currentTab: null,
       resultList: [],
-      code: 'params_type'
+      code: 'params_type',
+      url: ''
     }
   },
-  created() {
+  created () {
     this.id = this.$route.query.id
+    const tmp = window.location.href
+    if (tmp.indexOf('#header') > 0) {
+      this.url = tmp.split('#header')[0]
+    }
     this.currentTab = this.tabs[0]
     this.proInfo()
   },
   methods: {
-    change(res, index) {
+    change (res, index) {
       this.currentTab = res
       this.code = this.currentTab.code
     },
     /**
      * 项目信息
      */
-    proInfo() {
+    proInfo () {
       this.$api.project.projectInfo(this.id).then(res => {
         if (res.code === 200) {
           this.data = res.data
         }
       })
     },
-    listSucc(list) {
+    listSucc (list) {
       this.resultList = list
+    },
+    changeIndex (index) {
+      // window.location.hash = '#header' + (index + 1)
+      document.getElementById('header' + (index + 1)).scrollIntoView()
+      // this.$nextTick(() => {
+      // })
     }
   }
 }