hejianhao
2025-04-01 1b15ce526e8fc381614083df69e020b73ea34a9b
分页参数
5个文件已修改
1个文件已添加
103 ■■■■ 已修改文件
src/assets/public/notice@2x.png 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/index.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/TableSlot/index.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/showDelConfirm/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectList/index.vue 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/public/notice@2x.png
src/components/Table/index.vue
@@ -3,9 +3,10 @@
        <el-table border :data="tableData" :height="height">
            <slot></slot>
        </el-table>
        <div>
        <div v-if="total > 0">
            <el-pagination layout="slot, prev, pager, next, sizes, jumper" :page-size="queryForm.pageSize"
                :current-page="queryForm.pageNum" :total="total" class="pagination">
                :current-page="queryForm.pageNum" :total="total" @current-change="handleCurrentChange"
                @size-change="handleSizeChange" class="pagination">
                <div class="pagination-info">第 {{ (queryForm.pageNum == 1) ? 1 : (queryForm.pageNum - 1) *
                    queryForm.pageSize + 1 }}-{{
                        queryForm.pageNum * queryForm.pageSize }} 条/总共 {{ total }} 条</div>
@@ -40,6 +41,14 @@
            return this.$baseTableHeight()
        },
    },
    methods: {
        handleCurrentChange(page) {
            this.$emit('handleCurrentChange', page)
        },
        handleSizeChange(size) {
            this.$emit('handleSizeChange', size)
        }
    }
}
</script>
src/components/TableSlot/index.vue
@@ -5,7 +5,7 @@
        </div>
        <div class="table">
            <slot name="setting"></slot>
            <Table :tableData="tableData">
            <Table :tableData="tableData" :total="total" :queryForm="queryForm" @currentChange="handleCurrentChange" @sizeChange="handleSizeChange">
                <slot name="table"></slot>
            </Table>
        </div>
@@ -22,6 +22,27 @@
        tableData: {
            type: Array,
            default: () => []
        },
        total: {
            type: Number,
            default: 0
        },
        queryForm: {
            type: Object,
            default: () => {
                return {
                    pageSize: 10,
                    pageNum: 1
                }
            }
        }
    },
    methods: {
        handleCurrentChange(page) {
            this.$emit('handleCurrentChange', page)
        },
        handleSizeChange(size) {
            this.$emit('handleSizeChange', size)
        }
    }
}
src/components/showDelConfirm/index.vue
@@ -4,7 +4,7 @@
            :close-on-click-modal="false" width="433px">
            <div class="top-con a-center" slot="title">
                <div class="left">
                    <img src="@/assets/notice@2x.png" style="width: 24px;height: 24px;margin-right: 14px;" />
                    <img src="@/assets/public/notice@2x.png" style="width: 24px;height: 24px;margin-right: 14px;" />
                    <div class="title">{{ title }}</div>
                </div>
            </div>
src/main.js
@@ -5,10 +5,12 @@
import router from "./router";
import store from './store'
import TableCustom from '@/components/TableSlot/index.vue'
import ShowDelConfirm from '@/components/showDelConfirm/index.vue'
Vue.config.productionTip = false;
Vue.use(ElementUI, { size: 'small' })
Vue.component('TableCustom', TableCustom)
Vue.component('ShowDelConfirm', ShowDelConfirm)
Vue.prototype.msgsuccess = function (msg) {
  this.$message({
src/views/projectList/index.vue
@@ -1,6 +1,6 @@
<template>
    <div class="list">
        <TableCustom>
        <TableCustom :queryForm="queryForm" :total="total" @currentChange="handleCurrentChange" @sizeChange="handleSizeChange">
            <template #search>
                <el-form :model="form" label-width="140px" inline>
                    <el-form-item label="项目组名称:">
@@ -22,14 +22,29 @@
                <el-button class="el-icon-plus" style="margin-bottom: 20px;" type="primary"> 新增项目组</el-button>
            </template>
            <template #table>
                <el-table-column prop="name" label="项目组名称"></el-table-column>
                <el-table-column prop="age" label="项目负责人"></el-table-column>
                <el-table-column prop="age" label="项目组成员"></el-table-column>
                <el-table-column prop="age" label="项目创建时间"></el-table-column>
                <el-table-column prop="age" label="状态"></el-table-column>
                <el-table-column prop="age" label="操作"></el-table-column>
                <el-table-column prop="name" label="项目组名称" />
                <el-table-column prop="age" label="项目负责人" />
                <el-table-column prop="age" label="项目组成员" />
                <el-table-column prop="age" label="项目创建时间" />
                <el-table-column prop="age" label="状态">
                    <template #default="{ row }">
                        <el-tag v-if="row.status == 1" type="success">正常运作</el-tag>
                        <el-tag v-else type="danger">已封存</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="age" label="操作">
                    <template #default="{ row }">
                        <el-button type="text" @click="handleChangeStatus(row, 1)">封存</el-button>
                        <el-button type="text" @click="handleChangeStatus(row, 0)">解封</el-button>
                        <el-button type="text">编辑</el-button>
                        <el-button type="text">详情</el-button>
                        <el-button type="text" @click="handleDel(row)">删除</el-button>
                    </template>
                </el-table-column>
            </template>
        </TableCustom>
        <ShowDelConfirm :show="showDelConfirm" @close="showDelConfirm = false" @confirm="handleDelConfirm" />
        <ShowDelConfirm :title="changeStatusTitle" :tip="changeStatusTip" :show="changeStatus" @close="changeStatus = false" @confirm="handleChangeStatus" />
    </div>
</template>
@@ -40,9 +55,41 @@
        return {
            form: {
                name: ''
            }
            },
            showDelConfirm: false,
            rowId: '',
            changeStatus: false,
            changeStatusTitle: '',
            changeStatusTip: '',
            queryForm: {
                pageSize: 10,
                pageNum: 1
            },
            total: 0
        }
    },
    methods: {
        handleDel(row) {
            this.showDelConfirm = true
            this.rowId = row.id
        },
        handleDelConfirm() {
            this.showDelConfirm = false
            this.msgsuccess('删除成功')
        },
        handleChangeStatus(row, status) {
            this.changeStatus = true
            this.rowId = row.id
            this.changeStatusTitle = status == 1 ? '确认要封存这个项目组吗?' : '确认要解封该项目组吗?'
            this.changeStatusTip = status == 1 ? '封存后项目组内人员看不到数据,审批人仍然可见数据。' : '解封后项目组内人员数据恢复。'
        },
        handleCurrentChange(page) {
            this.queryForm.pageNum = page
        },
        handleSizeChange(size) {
            this.queryForm.pageSize = size
        }
    }
}
</script>