Vue3解决el-table在换页和切换页数容量时,选择框选择的数据清空重置的问题。

背景

el-table在换页和切换页数容量时,选择框选择的数据会被清空重置,所以切换回去的时候,选择的数据为0.。

解决办法

思路:我们使用另一个数组来存放历史选择数据,该数组不会随着换页和切换页数容量操作而重置清空。

代码1:需要注意的是我们使用的是@select方法,而不是@selection-change

<el-table :data="tableData" v-loading="tableLoading" border :header-cell-style="{background: '#EEF3FF',color: '#333333'}" 
tooltip-effect="dark" style="width: 100%"  max-height="500" class="dataTable" @select="handleSelectionChange" @select-all="selectAll" v-horizontal-scroll="'always'" ref="tableRef">
    <el-table-column type="selection"></el-table-column>
    <el-table-column prop="id" label="id" show-overflow-tooltip />
    <el-table-column prop="name" label="名称" show-overflow-tooltip />
    <el-table-column prop="code" label="代码" show-overflow-tooltip />
    <el-table-column prop="cid" label="代号" show-overflow-tooltip />
</el-table>

<div class="pagination-container">
   <el-pagination :current-page="page.page" :page-sizes="[10, 20, 50, 100]" :page-size="page.pageSize"
          layout="total, sizes, prev, pager, next, jumper" background :total="page.total" style="margin: 20px 0 0 0;"
          @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>

代码2:所需要用到的一些参数的定义

let page = reactive({
  page: 1,
  pageSize: 10,
  total: 0
})
//表格数据
const tableData = ref([])
//实时选择的数据
const multipleSelection = ref([])
//
//历史选择的数据,仅存放id字段
const historySelection = ref([])
const tableRef = ref();

代码3:所用到的一些方法,在某些语句已做了对应的解释。


const handleSelectionChange = (selection, row) => {
    console.log('复选框参数',selection, row);
    if(selection.includes(row)){
        console.log('新增');
        multipleSelection.value.push(row)
    }else{
        console.log('取消',multipleSelection.value,historySelection.value);
        //如果是取消勾选操作,就把取消勾选后的选择数据selection传给multipleSelection,并且把historySelection里对应存的历史勾选id字段也去除,实现页数改变和一页展示总数改变也不会清空勾选数据。
        multipleSelection.value = selection
        historySelection.value.splice(historySelection.value.indexOf(row.id),1)
    }
    console.log("复选框变化", multipleSelection.value,historySelection.value)
}

const selectAll = (selection) => {
    console.log('全选',selection);
    multipleSelection.value = selection
    if(selection.length==0){
        //如果取消全选,那么将那一页的全部数据都从historySelection中移除
        console.log('tableData',tableData.value);
        tableData.value.forEach(i=>{
            if(historySelection.value.includes(i.id)){
                historySelection.value.splice(historySelection.value.indexOf(i.id),1)
            }
        })
    }else{
        //如果全选,将选择的数据全部放进到historySelection里
        selection.forEach(i=>{
        if(!historySelection.value.includes(i.id)){
            historySelection.value.push(i.id)
        }
    })
    }
}

async function handleSizeChange(val) {
    saveSelectId()
    page.pageSize = val
    await getData()
    reSelect()
}

async function handleCurrentChange(val) {
    saveSelectId()
    page.page = val
    await getData()
    reSelect()
}

async function saveSelectId(){
    //将选择的数据的id字段存进historySelection,已经存在的不存
    console.log('保存选择',multipleSelection.value,historySelection.value);
    multipleSelection.value.forEach(i=>{
        if(!historySelection.value.includes(i.id)){
            historySelection.value.push(i.id)
        }
    })
}

async function reSelect(){
    //将表格的数据与historySelection对比,将historySelection里的数据重新勾选
    console.log('改变后',multipleSelection.value,historySelection.value);
    for (let i = 0; i < tableData.value.length; i++) {
        if (historySelection.value.includes(tableData.value[i].id)) {
          const row = tableData.value[i];
          //选择的数据显示勾选
          tableRef.value.toggleRowSelection(row);
        }
      }
}

最终实现效果:无论怎么切换都会保留选择的数据。

【GET】/sshm/rest/periodicInspection/getPeriodicInspectionPageList-------取得定期检查分页列表接口 String searchKey-----查询条件:项目名称或项目编码 String status-----检查状态,字典:【Inspection.Periodic.PeriodicInspectionStatus】 Long startTime-----开始间 Long endTime-----结束间 int pageNo-----页数 int pageSize-----每页条数<template> <div style=" display: flex; justify-content: center; align-items: center; height: 100%; width: 100%; background-color: #fff; "> <!-- 封装后的弹窗组件 --> <side-slope-dialog :visible="dialogVisible" :mode="dialogMode" :initial-form="currentForm" @update:visible="dialogVisible = $event" @success="handleDialogSuccess" /> <!-- 页面主体内容 --> <el-container style="height: 100%;"> <el-header> <el-row :gutter="10" type="flex" justify="left"> <el-col :span="3"><el-input v-model="Ceshibianhao" placeholder="项目名称" size="mini"></el-input></el-col> <el-col :span="3"><el-select v-model="selectStatus" placeholder="项目状态" size="mini" clearable> <el-option v-for="item in StatusOptions" :key="item.value" :label="item.label" :value="item.value" filterable></el-option> </el-select></el-col> <el-col :span="6"><el-date-picker v-model="searchProjectDate" range-separator="→" start-placeholder="请选择开始日期" end-placeholder="请选择结束日期" type="daterange" size="mini" style="width: 100%;"> </el-date-picker> </el-col> <el-col :span="1"><el-button type="primary" size="mini" @click="searchMainTable">查询</el-button></el-col> <el-col :span="1" ><el-button type="success" size="mini" style="width:100%" @click="openCreateDialog">新建</el-button></el-col> </el-row> </el-header> <el-main> <el-table :data="tableData" border style="width: 100%;" :main-height="400" :header-row-style="() => { return &#39;line-height:15px&#39;; }" :cell-style="{ textAlign: &#39;center&#39; }" :header-cell-style="{ textAlign: &#39;center&#39; }"> <el-table-column label="序号" type="index" width="120"></el-table-column> <el-table-column label="项目名称" prop="projectName" width="250"></el-table-column> <el-table-column label="项目编号" prop="projectCode" width="150"></el-table-column> <el-table-column label="项目周期" width="250"> <template slot-scope="scope"> {{ formatDateRange(scope.row.projectStartDate, scope.row.projectEndDate) }} </template> </el-table-column> <el-table-column label="项目状态" prop="status" width="200"></el-table-column> <el-table-column label="边坡总数" prop="sideSlopeTotalCount" width="150"></el-table-column> <el-table-column label="已完成边坡数" prop="sideSlopeCompleteCount" width="194"></el-table-column> <el-table-column label="完成率" width="150"> <template slot-scope="scope"> {{ calculateCompletionRate(scope.row.sideSlopeCompleteCount, scope.row.sideSlopeTotalCount) }} </template> </el-table-column> <el-table-column label="操作" width="200"> <template slot-scope="scope"> <el-button @click="openViewDialog(scope.row)" type="text" size="small">查看</el-button> <el-button @click="openEditDialog(scope.row)" type="text" size="small">编辑</el-button> <el-button @click="deleteItem(scope.row)" type="text" size="small">删除</el-button> </template> </el-table-column> </el-table> </el-main> <el-footer> <!-- 分页 --> <div class="pagination" style="margin-top:20px;text-align:center;"> <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" layout="total,prev, sizes, pager, next,jumper" :current-page.sync="pageParams.pageNo" :page-size="pageParams.pageSize" :page-sizes="[10, 40, 60, 100]" :total="pageParams.total"> </el-pagination> </div> </el-footer> </el-container> </div> </template> <script> import sideSlopeDialog from &#39;./sideSlopeDialog.vue&#39;; import { getPeriodicInspectionPageList, deletePeriodicInspection } from &#39;../../api/testProject&#39;; export default { name: "ProjectManagement", components: { sideSlopeDialog }, data() { return { Ceshibianhao: &#39;&#39;, selectStatus: &#39;&#39;, StatusOptions: [], searchProjectDate: [], tableData: [], pageParams: { pageNo: 1, pageSize: 10, total: 0 }, // 弹窗相关状态 dialogVisible: false, dialogMode: "create", currentForm: { projectCode: &#39;&#39;, projectName: &#39;&#39;, projectStartDate: &#39;&#39;, projectEndDate: &#39;&#39;, projectUser: &#39;&#39;, remark: &#39;&#39;, sideSlopeDetailList: [] } } }, computed:{ }, async created() { await this.getStatus(); this.loadTableData(); }, methods: { // 打开新建弹窗 openCreateDialog() { this.dialogMode = &#39;create&#39;; this.currentForm = { projectCode: &#39;&#39;, projectName: &#39;&#39;, projectStartDate: &#39;&#39;, projectEndDate: &#39;&#39;, projectUser: &#39;&#39;, remark: &#39;&#39;, sideSlopeDetailList: [] }; this.dialogVisible = true; }, // 打开编辑弹窗 openEditDialog(row) { this.dialogMode = &#39;edit&#39;; this.currentForm = { ...row, projectStartDate: row.projectStartDate, projectEndDate: row.projectEndDate }; this.dialogVisible = true; }, // 打开查看弹窗 openViewDialog(row) { this.dialogMode = &#39;view&#39;; this.currentForm = { ...row, projectStartDate: row.projectStartDate, projectEndDate: row.projectEndDate }; this.dialogVisible = true; }, // 弹窗提交成功后的处理 handleDialogSuccess() { this.loadTableData(); }, // 加载主表格数据 async loadTableData() { try { const params = { pageNo: this.pageParams.pageNo, pageSize: this.pageParams.pageSize, projectName: this.Ceshibianhao, status: this.selectStatus, startDate: this.searchProjectDate[0], endDate: this.searchProjectDate[1] }; const res = await getPeriodicInspectionPageList(params); this.tableData = res.entities || []; this.pageParams.total = res.entityCount || 0; } catch (error) { console.error(&#39;加载数据失败&#39;, error); this.$message.error(&#39;加载数据失败&#39;); } }, // 搜索主表格 searchMainTable() { this.pageParams.pageNo = 1; this.loadTableData(); }, // 删除项目 async deleteItem(row) { try { await this.$confirm(&#39;确定要删除该项目吗?&#39;, &#39;提示&#39;, { confirmButtonText: &#39;确定&#39;, cancelButtonText: &#39;取消&#39;, type: &#39;warning&#39; }); await deletePeriodicInspection({ id: row.id }); this.$message.success(&#39;删除成功&#39;); this.loadTableData(); } catch (error) { if (error !== &#39;cancel&#39;) { console.error(&#39;删除失败&#39;, error); this.$message.error(&#39;删除失败&#39;); } } }, // 项目状态字典 async getStatus() { try { const dictList = await this.$mapCfg("Inspection.Periodic.PeriodicInspectionStatus")(); this.StatusOptions = dictList.map(item => ({ value: item.key, label: item.value })); } catch (error) { console.error(&#39;获取状态失败&#39;, error); } }, // 格式化日期范围 formatDateRange(start, end) { if (!start || !end) return &#39;&#39;; return `${start} 至 ${end}`; }, // 计算完成率 calculateCompletionRate(completed, total) { if (!total) return &#39;0%&#39;; return `${((completed / total) * 100).toFixed(1)}%`; }, // 分页处理 handleSizeChange(val) { this.pageParams.pageSize = val; this.loadTableData(); }, handleCurrentChange(val) { this.pageParams.pageNo = val; this.loadTableData(); } } } </script> <style lang="scss" scoped> .el-header { color: #333; text-align: center; line-height: 60px; } .el-main { color: #333; text-align: center; line-height: 100%; padding-left: 5px; padding-top: 0px; } .pagination { margin-top: 20px; text-align: center; } </style> 实现项目状态
08-15
<template> <el-dialog :title="dialogMode === &#39;create&#39; ? &#39;新建&#39; : dialogMode === &#39;edit&#39; ? &#39;修改&#39; : &#39;查看&#39;" :visible.sync="dialogVisible" :modal-append-to-body="true" append-to-body :close-on-click-modal="false" custom-class="fixed-height-dialog" width="60%" top="5vh"> <el-form label-width="80px" ref="formRef" :model="currentForm" style="height: 100%; display: flex; flex-direction: column;" :rules="rules"> <!-- 项目信息区域 --> <div class="formBorder"> <el-row :gutter="10"> <el-col :span="6"> <el-form-item size="mini" label="项目名称" prop="projectName"> <el-input v-model="currentForm.projectName" clearable style="width:100%" size="mini" :disabled="dialogMode === &#39;view&#39;"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item size="mini" label="项目编号" prop="projectCode"> <el-input v-model="currentForm.projectCode" clearable style="width:100%" size="mini" :disabled="dialogMode === &#39;view&#39;"></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item size="mini" label="项目周期" prop="projectDate"> <el-date-picker v-model="projectDate" range-separator="→" start-placeholder="请选择开始日期" end-placeholder="请选择结束日期" type="daterange" size="mini" style="width: 100%;" unlink-panels :disabled="dialogMode === &#39;view&#39;"> </el-date-picker> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="6"> <el-form-item label="负责人" size="mini" style="width: fit-content;"> <el-input v-model="currentForm.projectUser" clearable style="width:100%" size="mini" :disabled="dialogMode === &#39;view&#39;"></el-input> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="项目概述"> <el-input v-model="currentForm.remark" :rows="2" :disabled="dialogMode === &#39;view&#39;"></el-input> </el-form-item> </el-col> </el-row> </div> <!-- 待检边坡区域 - 使用纯CSS控制高度 --> <div class="formBorder2"> <el-container style="height: 100%;"> <!-- 搜索区域 --> <el-header style="height: auto; flex-shrink: 0; padding-bottom: 10px;"> <el-row :gutter="10" type="flex" class="searchDialog"> <el-col :span="5"> <el-select v-model="filterForm.maintenanceCompanyName" placeholder="请选择管养单位" size="mini" clearable filterable @clear="resetSearch" :disabled="dialogMode === &#39;view&#39;"> <el-option v-for="item in MaintenanceUnitoptions" :key="item.value" :label="item.label" :value="item.value"></el-option> </el-select> </el-col> <el-col :span="5"> <el-select v-model="filterForm.routeCode" placeholder="请选择路线编号" size="mini" clearable filterable @clear="resetSearch" :disabled="dialogMode === &#39;view&#39;"> <el-option v-for="item in routeCodeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option> </el-select> </el-col> <el-col :span="5"> <el-input v-model="filterForm.searchKey" placeholder="请输入边坡编号或名称" size="mini" clearable @keyup.enter.native="searchForm" @clear="resetSearch" :disabled="dialogMode === &#39;view&#39;"> <i slot="suffix" class="el-input__icon el-icon-search"></i> </el-input> </el-col> <el-col :span="5"> <el-select v-model="filterForm.evaluateLevel" placeholder="请选择技术状态等级" size="mini" clearable @clear="resetSearch" :disabled="dialogMode === &#39;view&#39;"> <el-option v-for="item in evaluateLeveloptions" :key="item.value" :label="item.label" :value="item.value" /> </el-select> </el-col> <el-col :span="2" :offset="4"> <el-button type="primary" size="mini" style="width:100%" icon="el-icon-search" @click="searchForm" :loading="loading" :disabled="dialogMode === &#39;view&#39;">搜索</el-button> </el-col> </el-row> </el-header> <!-- 边坡表格 - 移除动态高度绑定 --> <el-main style="overflow-y: auto;"> <el-table ref="scrollTable" v-loading="loading" style="width: 100%;" border :data="formTabledata" :header-row-style="{ height: &#39;40px&#39; }" :header-cell-style="{ padding: &#39;0&#39;, height: &#39;40px&#39;, lineHeight: &#39;40px&#39;, textAlign: &#39;center&#39;, }" :cell-style="{ textAlign: &#39;center&#39; }" :row-key="getRowkey"> <!-- 选择列(查看模式禁用) --> <el-table-column type="selection" width="55" :selectable="isRowSelectable" :reserve-selection="true"> </el-table-column> <!-- 其他数据--> <el-table-column label="管养单位" prop="maintenanceCompanyName" width="290" show-overflow-tooltip></el-table-column> <el-table-column label="路线编号" prop="routeCode" width="100"></el-table-column> <el-table-column label="边坡编号" prop="sideSlopeCode" width="240" show-overflow-tooltip></el-table-column> <el-table-column label="边坡名称" prop="sideSlopeName" width="267" show-overflow-tooltip></el-table-column> <el-table-column label="技术状态等级" width="137"> <template slot-scope="scope"> {{ mapEvaluateLevel(scope.row.evaluateLevel) }} </template> </el-table-column> </el-table> </el-main> <!-- 分页区域 --> <el-footer style="flex-shrink: 0; padding-top: 10px;"> <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageParams.pageNo" :page-sizes="[10, 20, 50, 100]" :page-size="pageParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"> </el-pagination> </el-footer> </el-container> </div> </el-form> <!-- 弹窗底部按钮 --> <div slot="footer" class="dialog-footer" v-if="dialogMode === &#39;create&#39; || dialogMode === &#39;edit&#39;"> <el-button @click="dialogVisible = false">取消</el-button> <el-button type="primary" @click="submitForm">提交</el-button> </div> </el-dialog> </template> <script> import { mapCfg } from "@/utils"; import { getPeriodicInspectionSideSlopePageList, addPeriodicInspection, modifyPeriodicInspection, getSelectedPeriodicInspectionSideSlopeList } from "../../api/testProject"; import { getMaintenanceCompanyList, getRouteList } from "../../api/basicInformation"; export default { name: "SideSlopeDialog", props: { visible: Boolean, // 控制弹窗显示 mode: String, // 模式:create/edit/view initialForm: Object, // 初始表单数据 }, data() { return { dialogVisible: this.visible, // 弹窗显示状态 dialogMode: this.mode, // 当前模式 currentForm: { ...this.initialForm }, // 当前表单数据 projectDate: [], // 项目日期范围 total: 0, // 总数据量 loading: false, // 加载状态 pageParams: { // 分页参数 pageNo: 1, pageSize: 10, }, filterForm: { // 搜索条件 maintenanceCompanyName: "", routeCode: "", searchKey: "", evaluateLevel: "", }, mulitipleSelection: [], // 存储所有选择的边坡(使用Map提高性能) MaintenanceUnitoptions: [], // 管养单位选项 routeCodeOptions: [], // 路线编号选项 formTabledata: [], // 表格数据 evaluateLeveloptions: [], // 技术状态等级选项 rules: { // 表单验证规则 projectName: [ { required: true, message: "项目名称不能为空", trigger: "blur" }, ], projectCode: [ { required: true, message: "项目编码不能为空", trigger: "blur" }, ], }, }; }, watch: { // 监听模式变化 mode(val) { this.dialogMode = val; }, // 监听弹窗显示状态变化 async visible(val) { this.dialogVisible = val; if (val) { // 打开对话框 if (this.dialogMode !== &#39;create&#39; && this.currentForm.id) { this.LoadListData(); } else { this.resetAllData(); // 新增:完全重置状态 } } else { // 关闭对话框 - 关键修复:完全重置组件状态 this.resetAllData(); } }, // 同步弹窗显示状态到父组件 dialogVisible(val) { this.$emit("update:visible", val); }, // 监听初始表单数据变化 initialForm: { immediate: true, handler(val) { // 仅当ID变化更新 if (val.id !== this.currentForm.id) { this.currentForm = { ...val }; this.projectDate = [val.projectStartDate, val.projectEndDate]; } } }, // 处理日期范围变化 projectDate: { deep: true, handler(value) { if (value && value.length === 2) { this.currentForm.projectStartDate = value[0]; this.currentForm.projectEndDate = value[1]; } }, }, }, async created() { // 初始化数据 this.getRouteList(); await this.getEvaluateLevel(); this.getMaintenanceCompanyList(); }, methods: { getRowkey(row) { return row.id }, // 判断行是否可选(查看模式禁用选择) isRowSelectable(row, index) { return this.dialogMode !== "view"; }, // 获取管养单位列表 async getMaintenanceCompanyList() { const res = await getMaintenanceCompanyList(); this.MaintenanceUnitoptions = res.map((item) => ({ value: item, label: item, })); }, // 获取路线列表 async getRouteList() { const res = await getRouteList(); this.routeCodeOptions = res.map((item) => ({ value: item.id, label: item.routeCode, })); }, // 搜索方法 searchForm() { this.pageParams.pageNo = 1; this.LoadListData(); }, // 重置搜索条件 resetSearch() { this.filterForm = { maintenanceCompanyName: "", routeCode: "", searchKey: "", evaluateLevel: "", }; this.pageParams.pageNo = 1; this.LoadListData(); }, // 重置组件状态 resetAllData() { this.resetSelection(); this.formTabledata = []; // 清空表格数据 this.total = 0; // 重置总条数 this.pageParams = { // 重置分页 pageNo: 1, pageSize: 10 }; // 重置搜索条件(可选) this.filterForm = { maintenanceCompanyName: "", routeCode: "", searchKey: "", evaluateLevel: "" }; }, // 修改原有方法 resetSelection() { this.allSelection = new Map(); if (this.$refs.scrollTable) { this.$refs.scrollTable.clearSelection(); } }, // 映射技术状态等级 mapEvaluateLevel(level) { const option = this.evaluateLeveloptions.find( (item) => item.value === level ); return option.label; }, // 加载表格数据 async LoadListData() { this.loading = true; const params = { orgId: this.filterForm.maintenanceCompanyName, routeId: this.filterForm.routeCode, searchKey: this.filterForm.searchKey, evaluateLevel: this.filterForm.evaluateLevel, pageSize: this.pageParams.pageSize, pageNo: this.pageParams.pageNo, }; try { const res = await getPeriodicInspectionSideSlopePageList(params); // 关键修改:保留原数据的选中状态 this.formTabledata = res.entities; this.total = res.entityCount; if (this.dialogMode !== &#39;create&#39; && this.currentForm.id) { const data = { periodicId: this.currentForm.id, pageSize: this.pageParams.pageSize, pageNo: this.pageParams.pageNo }; const selected = await getSelectedPeriodicInspectionSideSlopeList(data); this.mulitipleSelection = selected.entities; if (this.mulitipleSelection.length > 0) { this.formTabledata.forEach(row => { this.mulitipleSelection.forEach(item => { if (row.sideSlopeUniqueCode === item.sideSlopeUniqueCode) { this.$refs.scrollTable.toggleRowSelection(row, true) } }) }) } } this.$nextTick(() => { }) } finally { this.loading = false; } }, // 分页大小变化 handleSizeChange(val) { this.pageParams.pageSize = val; this.pageParams.pageNo = 1; this.LoadListData(); }, // 当前页码变化 handleCurrentChange(val) { this.pageParams.pageNo = val; this.LoadListData(); }, // 获取技术状态等级选项 async getEvaluateLevel() { const levelList = await mapCfg("Inspection.Regular.RegularEvaluateLevel")(); this.evaluateLeveloptions = levelList.map((item) => ({ value: item.key, label: item.value, })); }, // 提交表单 async submitForm() { this.$refs.formRef.validate(async (valid) => { if (valid) { // 验证是否选择了边坡 if (this.allSelection.size === 0) { this.$message.warning("请至少选择一个边坡"); return; } // 构造提交参数 const params = { ...this.currentForm, sideSlopeDetailList: Array.from(this.allSelection.values()).map((item) => ({ sideSlopeUniqueCode: item.sideSlopeUniqueCode, evaluateLevel: item.evaluateLevel, evaluateDate: item.evaluateDate ? item.evaluateDate : undefined, })), }; // 根据模式选择操作 const action = this.dialogMode === "create" ? addPeriodicInspection : modifyPeriodicInspection; // 执行操作 try { const success = await action(params); if (success) { this.$message.success( this.dialogMode === "create" ? "新建成功" : "修改成功" ); this.$refs.scrollTable.clearSelection(); this.$emit("success"); this.dialogVisible = false; } else { this.$message.error("操作失败"); } } catch (error) { this.$message.error(error.message || "操作失败"); } } }); } }, }; </script> <style lang="scss" scoped> :deep(.fixed-height-dialog) { .el-dialog { display: flex; flex-direction: column; max-height: 80vh !important; height: 80vh !important; .el-dialog__body { flex: 1; overflow: hidden; padding: 15px 20px; display: flex; flex-direction: column; } } } // 项目信息区域样式 .formBorder { position: relative; border: thin dotted black; padding: 10px; flex-shrink: 0; &::before { content: "项目信息"; position: absolute; top: -10px; left: 40px; background-color: #fff; padding: 0 10px; font-size: 14px; color: #606266; } } .formBorder2 { margin-top: 15px; position: relative; border: thin dotted black; padding: 10px; flex-shrink: 0; &::before { content: "待检边坡"; position: absolute; top: -10px; left: 40px; background-color: #fff; padding: 0 10px; font-size: 14px; color: #606266; } .el-container { height: 100%; display: flex; flex-direction: column; .el-header { flex-shrink: 0; /* 固定高度 */ } .el-main { flex: 1; /* 占据剩余空间 */ overflow-y: auto; /* 自动滚动 */ padding: 0; } .el-footer { flex-shrink: 0; /* 固定高度 */ } } } // 弹窗底部按钮区域 .dialog-footer { padding: 10px 20px; border-top: 1px solid #ebeef5; text-align: center; } // 搜索区域样式 .searchDialog { margin-top: 5px; } // 空数据样式 :deep(.el-table__empty-block) { min-height: 200px; display: flex; justify-content: center; align-items: center; } // 分页样式 :deep(.el-pagination) { padding: 5px 0; } </style> 怎么在这个代码的修改上点击查看编辑只显示已选择的边坡
最新发布
08-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值