123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- <template>
- <div class='electric-well-page'>
- <!-- 顶部条 -->
- <van-nav-bar title='电井间商铺控制范围' left-arrow @click-left='backPage' @click-right='handleRightClick'>
- <template #right>
- <i class='iconfont wanda-scan'></i>
- </template>
- </van-nav-bar>
- <!-- 搜索框 -->
- <div class='search-container'>
- <van-search class='search' v-model='keyword' placeholder='请输入电井间或商铺编号' @search='onSearch'>
- <!-- TODO: 空状态 自定义图标 -->
- <!-- <template #action>
- <div class='search' @click='onSearch'>搜索</div>
- </template>-->
- </van-search>
- </div>
- <!-- 电井列表 -->
- <div class='electric-well-list' v-if='list.length'>
- <div class='floor' v-for='(item,index) in list' :key='`${index}_${item.floor}`'>
- <!-- 楼层 -->
- <div class='title'>
- <div class='floor-left'>
- <i class='iconfont wanda-floor-func-active'></i>
- {{item.floor}}
- </div>
- <div class='floor-right'>
- 查看平面图
- <van-icon name='arrow' />
- </div>
- </div>
- <!-- 电井 -->
- <div class='well-container'>
- <div class='well' v-for='(detail) in item.data.slice(0,2)' :key='detail.meterbox'>
- <div class='well-title'>{{detail.welldes}}</div>
- <div class='meterbox'>
- <span class='well-left'>商铺电表箱:</span>
- <span class='value'>{{detail.meterbox}}</span>
- </div>
- <div class='meterbox'>
- <span class='well-left'>商铺编号:</span>
- <span class='value'>{{detail.shopsnumList}}</span>
- </div>
- </div>
- <!-- 加载更多 -->
- <div class='load-more' v-show='!item.loadMore && item.data.length>2' @click='loadMore(item)'>加载更多</div>
- <!-- 第三条以上 -->
- <div v-show='item.loadMore && item.data.length>2' :key='key'>
- <div class='well' v-for='(detail) in item.data.slice(2)' :key='detail.meterbox'>
- <div class='well-title'>{{detail.welldes}}</div>
- <div class='meterbox'>
- <span class='well-left'>商铺电表箱:</span>
- <span class='value'>{{detail.meterbox}}</span>
- </div>
- <div class='meterbox'>
- <span class='well-left'>商铺编号:</span>
- <span class='value'>{{detail.shopsnumList}}</span>
- </div>
- </div>
- </div>
- <!-- </div> -->
- </div>
- </div>
- </div>
- <!-- 无数据 -->
- <van-empty class='m-empty' v-if='!list.length' description='暂无数据'>
- <!-- <template #image>
- <img src="../../assets/images/xxx.png" alt="">
- </template>-->
- </van-empty>
- <!-- 点击头部筛选,出现的右侧弹窗 -->
- <van-popup class='m-popup-container' v-model='showPopup' position='right'>
- <div class='m-popup'>
- <!-- 系统 -->
- <div class='system'>
- <h1 class='title'>楼层</h1>
- <div class='system-btn-container'>
- <div class='system-btn' v-for='(item,index) in floorList' :key='index'>
- <van-button class='m-btn' :class='item.active' @click='changeFloor(item)'>{{item.code}}</van-button>
- </div>
- </div>
- </div>
- <div class='divider'></div>
- <!-- 设备设施 -->
- <div class='sbss'>
- <h1 class='title'>电井类型</h1>
- <!-- <div v-for='i in 10' :key='i'>{{i}}</div> -->
- </div>
- <div class='footer'>
- <van-button size='large' color='#025BAA' plain type='info' @click='reset'>重置</van-button>
- <van-button size='large' color='#025BAA' type='info' @click='confirm'>确定</van-button>
- </div>
- </div>
- </van-popup>
- </div>
- </template>
- <script>
- /**
- * 电井间控制商铺范围
- */
- import Vue from 'vue'
- import { NavBar, Search, List, Cell, Icon, Popup, Button, Empty } from 'vant'
- Vue.use(NavBar).use(Search).use(List).use(Cell).use(Icon).use(Popup).use(Button).use(Empty)
- import { mapGetters } from 'vuex'
- import { queryShops } from '@/api/equipmentList'
- import { sleep } from '@/utils/util'
- import { cloneDeep } from 'lodash'
- export default {
- name: 'ElectricWell',
- props: {},
- data() {
- return {
- keyword: '',
- page: 1,
- size: 20,
- list: [],
- key: new Date().getTime(),
- loading: false,
- showPopup: false,
- floorList: [],
- currentFloor: '全部',
- // 弹窗中使用数据
- modalData: {
- system: '',
- sbss: '',
- },
- // 弹窗中使用备份数据
- modalDataBak: {
- system: '',
- sbss: '',
- },
- }
- },
- computed: {
- ...mapGetters(['plazaId', 'smsxt', 'categoryId', 'floorsArr']),
- },
- components: {},
- created() {
- // code:"F6"
- // gcname:"f6"
- // gcode:"6F"
- // gname:"f6"
- // seq:600
- let floorList = [{ code: '全部', gcname: '全部', gcode: '全部', gname: '全部', seq: null, active: 'active' }]
- this.floorsArr.map(({ code, gcname, gcode, gname, seq }) => {
- floorList.push({ code, gcname, gcode, gname, seq, active: '' })
- })
- this.floorList = floorList
- console.log(this.floorList)
- this.getList()
- },
- beforeMount() {},
- mounted() {},
- methods: {
- backPage() {
- this.$router.go(-1)
- },
- /**
- * 点击右侧筛选
- */
- handleRightClick() {
- this.showPopup = true
- // 设置选中的专业系统
- this.changeFloor({ code: this.currentFloor })
- },
- /**
- * 获取电井列表
- */
- async getList() {
- console.log('getList')
- let getParams = {
- orderBy: `floor,1;welldesm,1;meterbox,1;`,
- plazaId: this.plazaId,
- }
- // getParams.keyword = ''
- // if (this.welldes) {
- // getParams.keyword += `${this.welldes}:welldes;`
- // }
- // if (this.shopsnum) {
- // getParams.keyword += `${this.shopsnum}:shopsnumList;`
- // }
- // if (getParams.keyword == '') {
- // delete getParams.keyword
- // }
- let resData = await queryShops({ getParams })
- console.log(resData)
- if (!resData && !resData?.data) {
- this.list = []
- return false
- }
- let res_data = resData.data[0] || []
- console.log(res_data)
- let list = []
- for (const item in res_data) {
- console.log(item)
- list.push({
- floor: item,
- data: res_data[item],
- })
- }
- this.list = list
- console.log(this.list)
- // console.log(JSON.stringify(res_data, null, 2))
- },
- /**
- * 点击加载更多,显示该楼层下的更多数据
- */
- loadMore(item) {
- item.loadMore = true
- this.key = new Date().getTime()
- },
- /**
- * 搜索
- */
- onSearch() {
- // 初始化数据,查询列表
- this.initData()
- this.getList()
- },
- /**
- * 初始化数据,查询列表
- */
- initData() {
- this.list = []
- },
- /**
- * popup 更改楼层
- */
- changeFloor(data) {
- console.log(data)
- let floorList = this.floorList
- floorList.map((item) => {
- item.active = ''
- if (item.code === data.code) {
- item.active = 'active'
- }
- })
- // 弹窗选中的系统
- this.$set(this.modalDataBak, 'system', data.smsxt)
- },
- /**
- * 重置
- */
- reset() {
- this.modalDataBak = {
- system: '',
- sbss: '',
- }
- this.modalData = {
- system: '',
- sbss: '',
- }
- this.system_code = this.smsxt
- this.showPopup = false
- },
- /**
- * 弹窗确认
- */
- confirm() {
- this.modalData = cloneDeep(this.modalDataBak)
- this.showPopup = false
- this.system_code = this.floorList.filter((v) => v.active)[0].smsxt
- // 初始化数据,查询列表
- this.initData()
- this.onLoad()
- },
- },
- }
- </script>
- <style lang='less' scoped>
- .electric-well-page {
- width: 100%;
- height: 100%;
- // display: flex;
- // flex-direction: column;
- background-color: #f5f6f7;
- // 返回箭头修改
- /deep/ .van-nav-bar .van-icon {
- color: #000;
- }
- // 搜索
- .search-container {
- width: 100%;
- height: 55px;
- // background-color: #fff;
- text-align: center;
- .search {
- width: 80%;
- margin: 0 auto;
- background: none;
- }
- .van-search__content {
- background: #fff;
- border-radius: 50px;
- }
- }
- // 设备列表
- .electric-well-list {
- width: 100%;
- // flex: 1;
- height: calc(100% - 100px);
- // padding: 0 10px;
- background-color: #fff;
- overflow: auto;
- font-size: 14px;
- font-weight: 400;
- color: #333333;
- .floor {
- width: 100%;
- max-height: 400px;
- overflow: auto;
- display: flex;
- flex-direction: column;
- // 楼层title
- .title {
- width: 100%;
- height: 40px;
- min-height: 40px;
- max-height: 40px;
- padding: 0 15px;
- background: #dce5ee;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .floor-left {
- color: #025baa;
- font-size: 16px;
- }
- .floor-right {
- color: #025baa;
- display: flex;
- align-items: center;
- i {
- margin-left: 5px;
- }
- }
- }
- // 电井列表
- .well-container {
- padding: 15px;
- flex: 1;
- overflow: auto;
- .well {
- width: 100%;
- // height: 130px;
- padding: 10px 0;
- border-bottom: 1px solid #e6e6e6;
- .well-title {
- font-size: 16px;
- font-weight: 500;
- color: #333;
- }
- .meterbox,
- .shopsnumList {
- width: 100%;
- height: auto;
- margin-top: 8px;
- display: flex;
- color: #666;
- .well-left {
- width: 80px !important;
- }
- .value {
- flex: 1;
- height: auto;
- word-wrap: break-word;
- word-break: break-all;
- }
- }
- }
- .load-more {
- width: 80px;
- height: 25px;
- line-height: 25px;
- text-align: center;
- margin: 0 auto;
- margin-top: 10px;
- color: #025baa;
- background: #e5eef6;
- }
- }
- }
- }
- // 空状态
- .m-empty {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- }
- // 筛选弹窗
- .m-popup-container {
- width: 80%;
- height: 100%;
- padding: 55px 20px 10px 20px;
- .m-popup {
- width: 100%;
- height: calc(100% - 80px);
- display: flex;
- flex-direction: column;
- .title {
- font-size: 16px;
- font-weight: 500;
- color: #333333;
- margin-bottom: 15px;
- }
- // 专业
- .system {
- width: 100%;
- height: auto;
- // 专业系统按钮
- .system-btn-container {
- display: flex;
- width: 100%;
- flex-wrap: wrap;
- flex-flow: wrap;
- .system-btn {
- width: 33% !important;
- min-width: 33% !important;
- max-width: 33% !important;
- height: 50px;
- box-sizing: border-box;
- padding: 5px 10px 5px 0;
- .m-btn {
- width: 100%;
- height: 40px !important;
- text-align: center;
- background: #eff0f1;
- border-radius: 2px;
- }
- }
- }
- .active {
- background-color: #025baa !important;
- color: #fff;
- }
- }
- // 设备设施
- .sbss {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow: auto;
- .title {
- width: 100%;
- height: 25px;
- }
- .system-btn-container {
- width: 100%;
- height: 40px;
- flex: 1;
- overflow: auto;
- .system-btn {
- width: 100% !important;
- box-sizing: border-box;
- background: #eff0f1 !important;
- margin: 10px 0 10px 0;
- .m-btn {
- display: block !important;
- width: 100% !important;
- height: 40px !important;
- text-align: center;
- background: #eff0f1;
- border-radius: 2px;
- }
- }
- }
- .active {
- background-color: #025baa !important;
- color: #fff;
- }
- .load-more {
- width: 80px;
- height: 25px;
- line-height: 25px;
- text-align: center;
- margin: 0 auto;
- color: #025baa;
- background: #e5eef6;
- }
- }
- .divider {
- border-bottom: 1px solid #e6e6e6;
- margin: 20px 0;
- }
- .footer {
- position: absolute;
- bottom: 30px;
- right: 0;
- width: 100%;
- height: 50px;
- display: flex;
- justify-content: space-around;
- .van-button {
- width: 40%;
- height: 100%;
- max-width: 40%;
- min-width: 40%;
- }
- }
- }
- }
- }
- </style>
|