<template>
<div class="index_box">
<div class="search_box">
<el-form :label-position="labelPosition" inline size="small">
<el-form-item label="xxx">
<el-input v-model="projectaName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="省份">
<el-select v-model="proviceName" placeholder="请选择" @change="getcityNames">
<el-option v-for="(item,index) in proviceList" :key="item.code" :label="item.name" :value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="城市">
<el-select v-model="cityNames" placeholder="请选择">
<el-option v-for="(item,index) in cityList" :key="item.code" :label="item.name" :value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="xxx">
<el-select v-model="getWayValue" placeholder="请选择">
<el-option v-for="(item,index) in accessList" :key="index+1" :label="item.paramValue" :value="index+1">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div class="search_btn_box fr">
<el-button type="primary" size="mini" icon="el-icon-search" @click="searchData">查询</el-button>
<el-button type="primary" size="mini" icon="el-icon-circle-plus-outline" @click="goNewProject">新增</el-button>
</div>
</div>
<!-- 表格 -->
<div class="table_box mt40">
<el-table :data="projectData" border style="width: 100%" @row-click="goDetail">
<el-table-column label="xxx所属一级单元" align="center">
<template slot-scope="scope">
<span>{{ scope.row.region }}</span>
</template>
</el-table-column>
<el-table-column label="xx所属二级单元" align="center">
<template slot-scope="scope">
<span>{{scope.row.company }}</span>
</template>
</el-table-column>
<el-table-column label="xx所在城市" align="center">
<template slot-scope="scope">
<span>{{ scope.row.city }}</span>
</template>
</el-table-column>
<el-table-column label="xx项目名称" align="center">
<template slot-scope="scope">
<span>{{ scope.row.projectName }}</span>
</template>
</el-table-column>
<el-table-column label="xxx项目代码" align="center">
<template slot-scope="scope">
<span>{{ scope.row.afterInvestCode }}</span>
</template>
</el-table-column>
<el-table-column label="xxx项目编码" align="center">
<template slot-scope="scope">
<span>{{scope.row.projectNo}}</span>
</template>
</el-table-column>
<el-table-column label="xx获取方式" align="center">
<template slot-scope="scope">
<span>{{scope.row.acessWayValue}}</span>
</template>
</el-table-column>
<el-table-column label="xx类型" align="center">
<template slot-scope="scope">
<span>{{scope.row.assetPropertyValue}}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="page_box fr mt20">
<el-pagination class="el-paging" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40, 50]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total" :background='true' prev-text="上一页" next-text="下一页">
</el-pagination>
</div>
</div>
</div>
</template>
<script>
import { projectList, projectType } from '../../http/api'
export default {
data() {
return {
labelPosition: 'right',
accessList: [], //xxx方式
proviceList: [], //xxx
cityList: [], //xxx
currentPage: 1, //当前页数
pagesize: 10, //每页显示多少条
total: 0, //默认数据总数
pageCount: 0, //总页数
projectaName: '', //xxx名称
proviceName: '', //xxx省份
cityNames: '', //xxx城市
//businessTypeValue: '', //xxxx
getWayValue: '', //xx方式
projectList: {}, //xxx档案list
projectData: [],
}
},
methods: {
//xxx新增界面
goNewProject() {
this.$router.push({ name: 'xxx' })
},
//xxx详情界面
goDetail(row, event, column) {
this.$router.push({ name: 'xxxx', query: { projectNo: row.projectNo } })
},
// 分页
handleSizeChange(size) {
this.pagesize = size;
this.getData(this.currentPage, size);
},
//当前页改变
handleCurrentChange(currentPage) {
this.currentPage = currentPage;
this.getData(this.currentPage);
},
//查询数据
searchData() {
this.getData();
},
//分页接口
getData(currentPage = this.currentPage, pagesize = this.pagesize) {
let data = {
pageNo: currentPage,
pageSize: pagesize,
projectName: this.projectaName, //xx名称
proviceCode: this.proviceName, //省份
cityCode: this.cityNames, //城市
accessWay: this.getWayValue, //xxx方式
}
projectList(data).then(res => {
console.log(res)
if (res.code == 0) {
if (res.data.projectList != null) {
this.projectData = res.data.projectList.list; //赋值列表数据
this.total = res.data.totalRecords; //设置数据总数目!!!
}
}
}).catch(err => {
this.$message({
showClose: true,
message: '服务器内部错误'
});
})
},
//获取顶部的select基础数据
getProjectType() {
projectType(null).then(res => {
console.log(res)
if (res.code == 0) {
this.accessList = res.data.accessList; //xxx
this.proviceList = res.data.proviceList; //xxx
}
}).catch(err => {
this.$message({
showClose: true,
message: '服务器内部错误'
});
})
},
//onchange事件
getcityNames(value) {
let fIndex = this.proviceList.findIndex(e => { //下标方法
return e.code == value
})
this.cityList = this.proviceList[fIndex].childrens //数组
if (this.cityList.length) {
this.cityNames = this.cityList[0].code; //名字
} else {
this.cityNames = ''; //名字
}
}
},
created() {
this.getData();
this.getProjectType();
}
} </script>
<style lang="scss" scoped>
</style>

element ui select组件和table做分页完整功能和二级联动效果的更多相关文章

  1. 使用 Element UI Select 组件的 value-key 属性,让绑定值可以为一个对象

    EsunR 2019-11-07 12:14:42  12264  收藏 6 分类专栏: Vue 文章标签: element-ui 版权 当我们使用 Elemet UI 的选择组件进行多选时,Sele ...

  2. [转]vue Element UI走马灯组件重写

    https://blog.csdn.net/u013750989/article/details/82885482 1.element ui走马灯组件 -- carousel分析一波源代码:carou ...

  3. 封装一个优雅的element ui表格组件

    现在做后台系统用vue + elementUI 的越来越多,那element ui的 el-table 组件肯定也离不开.虽然element ui的table组件很好.但是表格和分页是分离的.每次写表 ...

  4. Element UI表格组件技巧:如何简洁实现跨页勾选、跨页统计功能

    业务场景 在使用Element UI的Table组件时,常常面对这样的业务需求: 表格数据的每一项都要提供勾选框,当切换分页时,能够记忆所有页面勾选的数据,以实现批量提交不同页面勾选数据的功能.并且, ...

  5. element ui step组件在另一侧加时间轴显示

    这是我开发的时候遇到的一个问题:项目需要在步骤条(竖直方向)的另一侧加时间显示,但是我在element ui 的step组件中一直没找着设置方法,所以就自己想了个办法加进来,效果如下: 代码如下,先上 ...

  6. Element UI 中组件this.$message报错

    最近在做毕设的时候,用Element UI中的消息提示message一直报以下的错误: 展示的效果也不好看,没有图标什么的: 但我明明有在main.js引入了element-ui 呀,因为毕设时间很赶 ...

  7. element UI datepicker组件限制可选日期范围

    长话短说,简单粗暴上代码了,在element中的datepicker,可以自由选择日期,如下: 然后我们根据element 官网的文档,给datepicker组件动态改变 picker-options ...

  8. element UI select 设定默认值

    要为select设定默认值,有两个步骤 1.数据中,声明一个变量param:该变量的值设为你想设定的select option中value 2.控件的 v-model 绑定 param 即可 < ...

  9. vue+element UI以组件递归方式实现多级导航菜单

    介绍 这是一个是基于element-UI的导航菜单组件基础上,进行了二次封装的菜单组件,该组件以组件递归的方式,实现了可根据从后端接收到的json菜单数据,动态渲染多级菜单的功能. 使用方法 由于该组 ...

随机推荐

  1. 一步一步学Silverlight 2系列(32):图形图像综合实例—“功夫之王”剧照播放

    概述 Silverlight 2 Beta 1版本发布了,无论从Runtime还是Tools都给我们带来了很多的惊喜,如支持框架语言Visual Basic, Visual C#, IronRuby, ...

  2. 老毛桃U盘启动盘,通过ghost创建xp系统蓝屏问题

    新买的东芝笔记本只预安装了dos,找来一个老毛桃U盘启动盘,进入winpe用ghost恢复成xp系统:重启后,系统蓝屏,提示的主要报错代码 0x0000007B 与 要求“chkdsk /f”处理. ...

  3. 屏幕适配-使用autoLayout

    当遇见xib中无法删除的控件时. 将这个错误的控件拖离本xib(第一个元素.xib文件是有许多元素组成的集合),确保这个xib是正确的.重新创建一个xib文件,将这个正确的xib元素整个复制过去. 在 ...

  4. 如何让虚拟机的Ubuntu上网?

    先声明 本文使用的虚拟机: VMware Workstation 14 Pro 本文使用的Ubuntu : ARM裸机1期加强版配套的Ubuntu16.04 特别注意:如果你使用的虚拟机和Ubuntu ...

  5. 【212】HDF更新数据&HDF创建

    HDF更新数据:对原有HDF数据进行数据更新,不破坏HDF的数据结构 pro add_data_sst ;实现将SST增加1度,再将结果更新到SST中 ;1. 获取SST索引 ;2. 通过索引获取ID ...

  6. 清理c盘的文件

    C:/Users/用户名/AppData里面默认有三个文件夹,分别是Local,LocalLow,Roaming,简单地来说,都是用来存放软件的配置文件和临时文件的,里面有很多以软件公司或者软件名称命 ...

  7. c语言函数参考

                                                                                                        ...

  8. Swift3的闭包相关

    几乎所有编程语言里都有简化的函数写法,c语言里是宏函数(#define),c++里是内联函数(inline,顺带一说,inline是内联的意思,在html里display里指定的inline也是内联的 ...

  9. Tasks 多核查找最大最小值问题

    先贴下代码 _Datas.ParallelForEach(arg_nDataStartIndex, arg_nDataCount, (data) => { dMax = dMax.Max(dat ...

  10. python list生成表达式

    列表生成式即List Comprehensions,是Python内置的非常简单却强大的可以用来创建list的生成式.运用列表生成式,可以写出非常简洁的代码. >>> list(ra ...