瀏覽代碼

假分页

caozhaorui 1 年之前
父節點
當前提交
852628832a
共有 2 個文件被更改,包括 33 次插入6 次删除
  1. 0 1
      src/router/index.ts
  2. 33 5
      src/views/system/seat-manage/index.vue

+ 0 - 1
src/router/index.ts

@@ -155,7 +155,6 @@ const setRouters = () => {
     })
     systemRouter.children = roleChildren
     const arr = [stagingRouter, systemRouter]
-    console.log(systemRouter)
     const menuRouters = deep(arr, [])
     //  初始化一级菜单默认重定向地址
     menuRouters.forEach(v => {

+ 33 - 5
src/views/system/seat-manage/index.vue

@@ -100,9 +100,12 @@
           </div>
           <div class="dept-duty-table">
             <CusTable
-                :tableData="seatInfo.editDutyInfo.tableData"
+                :tableData="editDutyInfoTableDataCpt"
                 :tableHead="seatInfo.editDutyInfo.tableHead"
-                noPage
+                :total="seatInfo.editDutyInfo.tableData.length"
+                :page="seatInfo.editDutyInfo.pageNum"
+                :pageSize="seatInfo.editDutyInfo.pageSize"
+                @handlePage="handlePageEditDutyInfo"
             >
               <template #do-column-value="{ scope }">
                 <div class="__cus-table_do">
@@ -136,9 +139,12 @@
           <div class="dept-duty-table">
             <CusTable
                 v-loading="seatInfo.dutyInfo.loading"
-                :tableData="seatInfo.dutyInfo.tableData"
+                :tableData="dutyInfoTableDataCpt"
                 :tableHead="seatInfo.dutyInfo.tableHead"
-                noPage
+                :total="seatInfo.dutyInfo.tableData.length"
+                :page="seatInfo.dutyInfo.pageNum"
+                :pageSize="seatInfo.dutyInfo.pageSize"
+                @handlePage="handlePageDutyInfo"
             >
             </CusTable>
           </div>
@@ -188,6 +194,8 @@ export default defineComponent({
         dutyInfo: {
           tableData: [],
           loading: false,
+          pageNum: 1,
+          pageSize: 10,
           tableHead: [
             {value: "name", label: "姓名", show: true},
             {value: "linkPhone", label: "联系电话", show: true},
@@ -202,6 +210,8 @@ export default defineComponent({
             {value: "time", label: "更新时间", show: true, width: 180},
             {value: "do", label: "操作", show: true},
           ],
+          pageNum: 1,
+          pageSize: 10,
           deptForm: {}
         },
       },
@@ -372,6 +382,20 @@ export default defineComponent({
     watch(() => store.state.app.dutyInfo, () => {
       initDuty()
     })
+    const dutyInfoTableDataCpt = computed(() => {
+      return state.seatInfo.dutyInfo.tableData.slice((state.seatInfo.dutyInfo.pageNum - 1) * state.seatInfo.dutyInfo.pageSize, state.seatInfo.dutyInfo.pageNum * state.seatInfo.dutyInfo.pageSize)
+    })
+    const handlePageDutyInfo = ({page, pageSize}: any) => {
+      state.seatInfo.dutyInfo.pageNum = page
+      state.seatInfo.dutyInfo.pageSize = pageSize
+    }
+    const editDutyInfoTableDataCpt = computed(() => {
+      return state.seatInfo.editDutyInfo.tableData.slice((state.seatInfo.editDutyInfo.pageNum - 1) * state.seatInfo.editDutyInfo.pageSize, state.seatInfo.editDutyInfo.pageNum * state.seatInfo.editDutyInfo.pageSize)
+    })
+    const handlePageEditDutyInfo = ({page, pageSize}: any) => {
+      state.seatInfo.editDutyInfo.pageNum = page
+      state.seatInfo.editDutyInfo.pageSize = pageSize
+    }
     onMounted(() => {
       initDictionary()
       initDuty()
@@ -389,7 +413,11 @@ export default defineComponent({
       getPeople,
       delPeople,
       onReset,
-      onSave
+      onSave,
+      dutyInfoTableDataCpt,
+      handlePageDutyInfo,
+      editDutyInfoTableDataCpt,
+      handlePageEditDutyInfo
     }
   },
 })