This commit is contained in:
JIAL 2024-02-18 16:58:52 +08:00
parent 1232bdad89
commit 0401f54b05
2 changed files with 110 additions and 5 deletions

View File

@ -13,6 +13,11 @@
} }
/**找到表头那一行,然后把里面的复选框隐藏掉**/
.regionTable .el-table__header-wrapper .el-table__header .el-checkbox {
display: none;
}
.el-input__inner { .el-input__inner {
height: 30px; height: 30px;
/*font-family: Roboto, serif;*/ /*font-family: Roboto, serif;*/
@ -58,7 +63,7 @@
} }
.el-form-item { .form-box .el-form-item {
margin: 0px 15px 0px 15px; margin: 0px 15px 0px 15px;
} }

View File

@ -260,8 +260,64 @@
</el-table> </el-table>
</div> </div>
</div> </div>
<el-dialog title="选择地区" :visible.sync="dialogRegionVisible"> <el-dialog class="regionTable" :visible.sync="dialogRegionVisible" width="882px">
<el-form>
<el-form-item style="margin: 5px">
<el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称">
</el-input>
<el-button type="primary" size="small" @click="searchRegion">查询地区</el-button>
</el-form-item>
</el-form>
<el-table
:data="getCurrentPageData"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center'}"
:cell-style="{'text-align': 'center', 'padding': '1px 0px 1px 0px'}"
highlight-current-row
border>
<el-table-column
v-if="false"
label="uid"
type="index"
width="100">
</el-table-column>
<el-table-column
width="180"
prop="province"
label="省">
</el-table-column>
<el-table-column
width="180"
prop="city"
label="市">
</el-table-column>
<el-table-column
width="200"
prop="district"
label="区">
</el-table-column>
<el-table-column
width="200"
prop="kilometers"
label="公里数">
</el-table-column>
<el-table-column
width="80"
label="操作">
<template slot-scope="scope">
<el-button @click="chooseRegion(scope.row)" style="color: blue;" type="text">选择</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="regionTableData.length"
></el-pagination>
</div>
</el-dialog> </el-dialog>
</div> </div>
@ -304,10 +360,32 @@
{ kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' }, { kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' },
// Add more rows as needed // Add more rows as needed
], ],
regionTableData: [
{uid: '1001', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1002', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1003', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1004', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1001', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1002', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1003', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1004', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1001', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1002', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1003', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
{uid: '1004', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
],
dialogRegionVisible: false,
regionName: '',
currentPage: 1,
pageSize: 10,
} }
}, },
computed: { computed: {
getCurrentPageData() {
const start = (this.currentPage - 1) * this.pageSize;
const end = start + this.pageSize;
return this.regionTableData.slice(start, end);
},
}, },
created() { created() {
@ -335,9 +413,31 @@
}, },
selectedRegion(){ selectedRegion(){
this.dialogRegionVisible = true;
console.log(this.regionTableData)
},
} chooseRegion(row) {
this.dialogRegionVisible = false;
console.log(row)
this.formLabelAlign.province = row.province
this.formLabelAlign.city = row.city
this.formLabelAlign.district = row.district
this.formLabelAlign.kilometers = row.kilometers
},
searchRegion(){
},
handleSizeChange(val) {
this.pageSize = val;
this.currentPage = 1; // 切换每页显示条目数时回到第一页
},
handleCurrentChange(val) {
this.currentPage = val;
},