Browse Source

fix:修改首页和备忘录调用接口

luzhixia 1 month ago
parent
commit
1ee51bf1dc

+ 9 - 0
src/api/memoManage.js

@@ -10,6 +10,15 @@ export function getMemoList(_url, params) {
     data: params,
   })
 }
+// /api/costProjectMemo/v1/getDataMonth?month=
+// /api/costProjectMemo/v1/getIndexDataMonth
+export function getMemoMonth(_url, params) {
+  return request({
+    url: `${url}${_url}`,
+    method: 'get',
+    params: params,
+  })
+}
 
 // 备忘录详情
 export function getMemoDetail(params) {

+ 21 - 2
src/views/costAudit/projectInfo/auditProjectManage/memoManage/memoManageMixin.js

@@ -5,6 +5,7 @@ import {
   updateMemo,
   deleteMemo,
   deleteMemoBatch,
+  getMemoMonth,
 } from '@/api/memoManage.js'
 import { getAuditTaskList } from '@/api/auditInitiation.js'
 import moment from 'moment'
@@ -95,7 +96,7 @@ export const memoManageMixin = {
         pageSize: 50,
       },
       listTotal: 0,
-
+      calendarData: {},
       memoList: [],
       formTitle: '',
       formDisabled: false,
@@ -150,7 +151,8 @@ export const memoManageMixin = {
     getTasksByDate() {
       return (date) => {
         const dateStr = moment(date).format('YYYY-MM-DD')
-        return this.memoList.filter((task) => task.memoDate === dateStr)
+        // return this.memoList.filter((task) => task.memoDate === dateStr)
+        return this.calendarData[dateStr] || []
       }
     },
   },
@@ -168,6 +170,21 @@ export const memoManageMixin = {
     },
   },
   methods: {
+    getMemoMonth() {
+      let _url = ''
+      if (this.type === 'memoManage') {
+        _url = '/api/costProjectMemo/v1/getDataMonth'
+      } else {
+        _url = '/api/costProjectMemo/v1/getIndexDataMonth'
+      }
+      //将 month 设置为当前月的第一天
+      let month = moment().startOf('month').format('YYYY-MM-DD')
+      getMemoMonth(_url, {
+        month,
+      }).then((res) => {
+        this.calendarData = res.value || {}
+      })
+    },
     // 优化后的获取详情方法,不再接收单个item参数
     async getTasksByDateList() {
       if (this.memoList.length > 0) {
@@ -393,6 +410,7 @@ export const memoManageMixin = {
           _url = '/api/costProjectMemo/v1/pageList'
         } else {
           _url = '/api/costProjectMemo/v1/pageIndexList'
+          // _url = '/api/costProjectMemo/v1/getDataMonth'
         }
         if (this.activeTab == 'project') {
           delete params.memoDate
@@ -450,6 +468,7 @@ export const memoManageMixin = {
       this.type = type
       this.selectedDate = new Date()
       this.lunarInfo = this.getLunarInfo(this.selectedDate)
+      this.getMemoMonth()
       // this.handleSearch(num)
     },
     onTabChange(tab) {

+ 71 - 18
src/views/home/index.vue

@@ -119,10 +119,13 @@
                 </span>
                 <!-- 只显示父节点的序号 -->
                 <div v-else>
-                  <span v-if="scope.row.children">
+                  <!-- <span v-if="scope.row.children">
+                    {{ getParentNodeIndex(scope.row) }}
+                  </span>
+                  <span v-else></span> -->
+                  <span>
                     {{ getParentNodeIndex(scope.row) }}
                   </span>
-                  <span v-else></span>
                 </div>
               </template>
             </el-table-column>
@@ -306,6 +309,19 @@
               </template>
             </el-table-column>
           </el-table>
+          <!-- 分页 -->
+          <el-pagination
+            v-if="pagination.total > 0"
+            class="pagination"
+            background
+            :page-sizes="[50, 100]"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="pagination.total"
+            :page-size="pagination.pageSize"
+            :current-page="pagination.page"
+            @current-change="handlePageChange"
+            @size-change="handlePageSizeChange"
+          ></el-pagination>
         </el-card>
       </el-col>
     </el-row>
@@ -551,13 +567,14 @@
   import { memoManageMixin } from '@/views/costAudit/projectInfo/auditProjectManage/memoManage/memoManageMixin'
   import { doProcessBtn } from '@/api/dataPreliminaryReview'
   import { getReviewTaskList } from '@/api/audit/auditIndex'
-  import { getChartList, getMsgList, getEnterpriseList } from '@/api/home'
+  import { getChartList, getMsgList } from '@/api/home'
   import detailsDialog from '@/views/costAudit/auditInfo/auditManage/details.vue'
   import mainDetailsDialog from '@/views/costAudit/auditInfo/auditManage/mainDetails.vue'
   import taskInfo from '@/components/task/taskInfo.vue'
   import cbjsInfo from '@/components/task/cbjsInfo.vue'
   import taskDetail from '@/components/task/taskDetail.vue'
   import TaskFillIn from '@/views/EntDeclaration/auditTaskManagement/taskFillIn.vue'
+  import { getTaskHandlingList } from '@/api/auditTaskProcessing'
   export default {
     name: 'Dashboard',
     components: {
@@ -591,6 +608,11 @@
         currentDate: new Date(),
         selectedDate: '',
         showTooltip: false,
+        pagination: {
+          page: 1,
+          pageSize: 50,
+          total: 0,
+        },
         // 成本审核列表相关
         currentPage: 1,
         pageSize: 100,
@@ -661,7 +683,7 @@
       },
       // 待办事项搜索
       handleTodoSearch() {
-        this.currentPage = 1
+        this.pagination.page = 1
         if (this.curOrg === '企业单位') {
           this.getEnterpriseTodoList()
         } else {
@@ -673,15 +695,16 @@
         try {
           this.loading = true
           const params = {
-            currentPage: this.currentPage,
-            pageSize: this.pageSize,
+            pageNum: this.pagination.page,
+            pageSize: this.pagination.pageSize,
             projectName: this.todoSearchQuery,
           }
-          const response = await getEnterpriseList(params)
+          const response = await getTaskHandlingList(params)
 
           if (response.state && response.value) {
             const records = response.value.records || []
             this.todoList = records
+            this.pagination.total = response.value.total
           }
         } catch (error) {
           console.error('获取企业待办列表失败:', error)
@@ -716,8 +739,8 @@
         try {
           this.loading = true
           const params = {
-            currentPage: this.currentPage,
-            pageSize: this.pageSize,
+            pageNum: this.pagination.page,
+            pageSize: this.pagination.pageSize,
             projectName: this.todoSearchQuery,
           }
           const response = await getReviewTaskList(params)
@@ -760,10 +783,17 @@
                   : [],
               }
             })
-            this.total = response.value.total || 0
+            let parentIndex = 1
+            this.todoList.forEach((item) => {
+              if (item.pid == 0) {
+                item.parentIndex = parentIndex++
+              }
+            })
+
+            this.pagination.total = response.value.total || 0
           } else {
             this.todoList = []
-            this.total = 0
+            this.pagination.total = 0
           }
         } catch (error) {
           console.error('加载审核项目列表失败:', error)
@@ -773,14 +803,18 @@
       },
       // 获取父节点的连续序号
       getParentNodeIndex(row) {
-        // 过滤出所有父节点
-        const parentNodes = this.todoList.filter(
-          (item) => item.children && item.children.length > 0
-        )
-        // 找到当前行在父节点数组中的索引
-        const index = parentNodes.findIndex((item) => item.id === row.id)
+        // // 过滤出所有父节点
+        // const parentNodes = this.todoList.filter(
+        //   (item) => item.children && item.children.length > 0
+        // )
+        // // 找到当前行在父节点数组中的索引
+        // const index = parentNodes.findIndex((item) => item.id === row.id)
+        // // 返回序号(索引+1)
+        // return index + 1
+        // 找到当前行在 todoList 中的索引位置
+        const index = this.todoList.findIndex((item) => item.id === row.id)
         // 返回序号(索引+1)
-        return index + 1
+        return index + 1 || ''
       },
       // 获取来源类型文本
       getSourceTypeText(type) {
@@ -1138,6 +1172,22 @@
       addMemo() {
         this.$message.info('添加新备忘录')
       },
+      handlePageChange(page) {
+        this.pagination.page = page
+        if (this.curOrg === '企业单位') {
+          this.getEnterpriseTodoList()
+        } else {
+          this.loadAuditProjectList()
+        }
+      },
+      handlePageSizeChange(size) {
+        this.pagination.pageSize = size
+        if (this.curOrg === '企业单位') {
+          this.getEnterpriseTodoList()
+        } else {
+          this.loadAuditProjectList()
+        }
+      },
     },
   }
 </script>
@@ -1436,4 +1486,7 @@
       border-radius: 6px;
     }
   }
+  .pagination {
+    margin: 20px;
+  }
 </style>