<template> <div class="product_container"> <div class="productFun"> <div class="productInput"> 用户账号 <div class="inputBox" style="width: 120px"> <el-input placeholder="请输入网点名称" v-model="selectInfo.account" clearable class="product-input" > </el-input> </div> 省 <div class="inputBox" style="width: 140px"> <el-select v-model="selectInfo.province" filterable clearable @change="changeProvince" > <el-option v-for="item in ProvinceList" :key="item.id" :label="item.areaName" :value="item.areaName" > </el-option> </el-select> </div> 市 <div class="inputBox" style="width: 140px"> <el-select v-model="selectInfo.city" filterable clearable @change="changeCity" > <el-option v-for="item in CityList" :key="item.id" :label="item.areaName" :value="item.areaName" > </el-option> </el-select> </div> 区/县 <div class="inputBox" style="width: 140px"> <el-select v-model="selectInfo.area" filterable clearable placeholder="热门推荐" > <el-option v-for="item in AreaList" :key="item.id" :label="item.areaName" :value="item.areaName" > </el-option> </el-select> </div> </div> <div class="productBtn"> <el-button type="primary" icon="el-icon-search" class="btnItem" @click="selectData" >查询</el-button > <el-button type="primary" icon="el-icon-refresh-right" class="btnItem" @click="reset">重置</el-button > </div> </div> <el-table :data="tableData.rows" :row-class-name="tableRowClassName" :header-cell-style="{ 'text-align': 'center', background: ' #2483b3', color: 'white', }" :row-style="{ 'text-align': 'center' }" style="width: 100%" > <!-- <el-table-column type="selection" width="55"> </el-table-column> --> <el-table-column prop="index" label="序号"> </el-table-column> <el-table-column prop="account" label="账号"> </el-table-column> <el-table-column prop="province" label="省"> </el-table-column> <el-table-column prop="city" label="市"> </el-table-column> <el-table-column prop="area" label="区/县"> </el-table-column> <el-table-column prop="street" label="街道"> </el-table-column> <el-table-column prop="detailAddress" label="详细地址"> </el-table-column> <el-table-column prop="postalCode" label="邮政编码"> </el-table-column> <!-- <el-table-column label="操作"> <template slot-scope="scope"> <el-button type="text" size="small">编辑</el-button> <el-button @click="Bdelete(scope.row)" type="text" size="small" >删除</el-button > </template> </el-table-column> --> </el-table> <!-- 分页组件 --> <group-page :limit ="limit" :total="total" :offset="offset" :count="tableData.total" @setOffset="setOffset" @setLimit ="setLimit" v-model="isFristPage"/> <!-- 新增弹框 --> <hotand-news-dialog :isShowInfo="isShowAdd" @close="closeAdd"></hotand-news-dialog> </div> </template> <script> //组件 import GroupPage from '../../components/mycomponent/groupPage.vue'; import HotandNewsDialog from '../../components/mycomponent/dialog/move/hotandNewsDialog.vue'; //逻辑 import { tableRowClassName } from "../../utils/myUtils/changeTableTr"; import { listPage ,SelectList,bdelete} from "../../api/move/addManagement" import { listMixin } from '../../utils/myUtils/mixins/listPage' import { order_area } from '../../api/order/order' export default { mixins:[listMixin], // 加入分页逻辑 components: { GroupPage, HotandNewsDialog }, mounted(){ // SelectList('').then(res => { // console.log(res); // }) order_area('pid=0').then(res=>{ console.log(res); this.ProvinceList = res }) }, data() { return { isShowAdd: false, //显示新增功能 selectInfo:{ account:'', province:'', city:'', area:'' }, ProvinceList:[], CityList:[], AreaList:[], }; }, methods: { tableRowClassName: tableRowClassName, closeAdd() { this.isShowAdd = false; }, addCategory() { this.isShowAdd = true; }, getListPage(limit,offset){ listPage(`limit=${limit}&offset=${offset}`,this.queryInfo).then(res => { // 得到相关数据 res.rows.forEach((item,index)=>{ item.index =(index+1)+((offset-1)*10) }) this.tableData = res }) }, reset(){ this.selectInfo = { recommendType:'', recommendTitle:"" } }, Bdelete(row){ // console.log(row); const id = row.id bdelete({id:id}).then(res => { // console.log(res); // 删除成功跟新数据 if(res!=''){ this.$message({ message: '删除成功', type: 'success' }); this.refresh() } }) }, changeProvince(e){ const index = this.ProvinceList.findIndex(item => { return item.areaName ==e }) const code = this.ProvinceList[index].id order_area('pid='+code).then(res=>{ console.log(res); this.CityList = res }) }, changeCity(e){ const index = this.CityList.findIndex(item => { return item.areaName == e }) const code = this.CityList[index].id order_area('pid='+code).then(res=>{ console.log(res); this.AreaList = res }) } } }; </script> <style lang="scss" scoped> .product_container { position: relative; width: 100%; min-height: 700px; overflow: auto; .productData { width: 100%; display: flex; justify-content: center; .middle { margin: 0 30px; } } .productFun { margin: 30px 0; display: flex; justify-content: space-between; .productInput { display: flex; align-items: center; .inputBox { margin: 0 50px 0 10px; } } .productBtn { .btnItem { margin-right: 10px; border-radius: 5px; // height: 32px; // width: 84px; font-size: 16px; } } } .footer { display: flex; justify-content: space-between; color: #6666; margin: 30px 10px; } } </style>