| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <view>
- <!-- 筛选标签条 -->
- <view class="cu-bar bg-white flex" style="z-index: 100;width: 100%;position: fixed;top: -2rpx;">
- <view class="u-line-1" @click="showDown(index)" v-for="(item,index) in filterMenu" :key="index" style="width: 20%;text-align: center;height: 100%;">
- <text v-text="data[index]==''?item:data[index]" :class="data[index]==''?'':'text-red'"></text>
- <u-icon v-if="index!=3" name="arrow-down-fill" size="20" style="padding-left: 10rpx;"></u-icon>
- <text class="cuIcon-filter padding-left-10" v-else></text>
- <u-badge :offset="[10, 8]" v-if="index==3" size="mini" type="error" :count="filterCount"></u-badge>
- </view>
- </view>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view style="margin-top: 110rpx;">
- <card @delItem="delItem" :list="list"></card>
- </view>
- </mescroll-body>
- <!-- 所属机构 -->
- <u-popup border-radius="60" height="60%" mode="bottom" v-model="popupShow">
- <view class="fixed cu-bar search bg-white">
- <view class="search-form round">
- <text class="cuIcon-search"></text>
- <u-input style="width: 90%;" v-model="agencyKeyword" type="text" :adjust-position="false" placeholder="请输入关键字搜索" confirm-type="search"/>
- </view>
- </view>
- <scroll-view v-if="!$isEmpty(searchList)" style="padding-top: 110rpx;height: 100%;" :scroll-y="true" >
- <view @click="residentailConfirm(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in searchList" :key="index">
- <text>{{item.label}}</text>
- </view>
- <u-divider v-if="searchList.length>=10" height="80">只显示十条数据</u-divider>
- </scroll-view>
- <u-empty v-else name="search"></u-empty>
- </u-popup>
- <!-- 楼栋 -->
- <u-popup border-radius="60" height="60%" mode="bottom" v-model="residentailShow">
- <view class="fixed cu-bar search bg-white">
- <view class="search-form round">
- <text class="cuIcon-search"></text>
- <u-input style="width: 90%;" v-model="residentialKeyWord" type="text" :adjust-position="false" placeholder="请输入关键字搜索" confirm-type="search"/>
- </view>
- </view>
- <scroll-view v-if="!$isEmpty(residentialList)" style="padding-top: 110rpx;height: 100%;" :scroll-y="true" >
- <view @click="buildingConfirm(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in residentialList" :key="index">
- <text>{{item.name}}</text>
- </view>
- <u-divider v-if="residentialList.length>=10" height="80">只显示十条数据</u-divider>
- </scroll-view>
- <u-empty v-else name="search"></u-empty>
- </u-popup>
-
- <!-- 地区选择器 -->
- <u-picker @confirm="regionConfirm" mode="region" v-model="regionShow"></u-picker>
-
- <!-- 筛选 -->
- <u-modal :show-cancel-button="true" cancel-text="重置" @cancel="reset" @confirm="filterConfirm" title="筛选" :mask-close-able="true" v-model="filterShow" >
- <view class="slot-content" style="margin: 20rpx;">
- <u-form label-width="150" :model="params" ref="uForm">
- <u-form-item label="小区名"><u-input v-model="params.name" /></u-form-item>
- <!-- <u-form-item :border-bottom="false" label="门牌号"><u-input v-model="params.houseNumber" /></u-form-item> -->
- </u-form>
- </view>
- </u-modal>
-
- <!-- 添加按钮 -->
- <add-btn @click.native="add"></add-btn>
- <!-- 通知alert -->
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import card from "./card.vue"
- import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
- let that;
- export default {
- components:{
- card
- },
- mixins:[MescrollMixin],
- data() {
- return {
- //顶部菜单栏
- filterMenu: ["地区","所属机构","物业名称","筛选"],
- data:['','','',''],
-
- //地区
- regionShow:false,
- areaValue:'',
-
- //底部弹出框
- popupShow:false,
- searchList:[],
- //筛选框
- filterShow:false,
- filterCount:0,
-
- // 列表数据
- params:{},
- agencyKeyword:'',
-
- //小区
- residentailShow:false,
- residentialKeyWord:'',
- residentialList:[],
-
- list: [],
- downOption: {
- use: true,
- auto: false
- },
- upOption: {
- page: {
- page: 0,
- size: 10
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
-
- }
- },
- onLoad(){
- that=this
- this.getListByLikeName({isSelect:true})
- },
- onShow() {
- if (this.canReset) {
- this.mescroll.resetUpScroll()
- }
- this.canReset=true
- },
- watch:{
- agencyKeyword(){
- let that=this
- //节流函数
- if (this.timer){
- clearTimeout(this.timer)//阻止setTimeout函数的执行
- }
- this.timer = setTimeout(() => {
- that.searchList=[]
- let params = {
- isSelect: true,
- regionArea: that.areaValue,
- agencyName: that.agencyKeyword
- }
- this.getListByLikeName(params)
- }, 500)
- },
- residentialKeyWord(){
- let that=this
- //节流函数
- if (this.timer){
- clearTimeout(this.timer)//阻止setTimeout函数的执行
- }
- this.timer = setTimeout(() => {
- that.residentialList=[]
- let params={
- agencyId:that.params.agencyId,
- name:that.residentialKeyWord
- }
- that.fetchresidentialList(params)
- }, 500)
- },
- },
- methods: {
- /**
- * 获取筛选的条件数
- */
- getFilterCount(){
- let n=0
- if (!this.$isEmpty(this.params.agencyId)) {
- //机构
- n++
- }
- if (!this.$isEmpty(this.params.estatePid)) {
- //物业
- n++
- }
- if (!this.$isEmpty(this.params.name)) {
- //小区名
- n++
- }
- this.filterCount=n
- },
- /**
- * 下拉回调
- */
- downCallback(){
- setTimeout(()=>{
- this.mescroll.resetUpScroll()
- },1500)
- },
- /**
- * 上拉回调
- * @param {Object} mescroll
- */
- upCallback(mescroll) {
- let params=this.params
- params.current=mescroll.num
- params.size=mescroll.size
- this.getFilterCount()
- console.log(111)
- try{
- this.$api.residential.pageBycondition(params).then(res=>{
- console.log(res)
- let data=res.data.records
- let length=data.length
- let total=res.data.total
- mescroll.endBySize(length, total);
- if(mescroll.num == 1) this.list = [];
- this.list=this.list.concat(data);
- })
- }catch(e){
- mescroll.endErr();
- }
- },
- /**
- * 重置
- */
- reset(){
- this.params={}
- this.data=['','','','','']
- this.areaValue=''
- this.searchList=[]
- this.agencyKeyword=''
- this.unitList=[]
- this.residentialKeyWord='',
- this.residentialList=[],
- this.list=[],
- this.mescroll.resetUpScroll()
- },
- /**
- * 点击选择机构
- */
- residentailConfirm(res){
- //筛选标题
- this.params.residentialId =res.value
- this.data[1] = res.label
- this.popupShow = false
- //获取机构
- let params={
- residentialId:this.params.residentialId
- }
- this.fetchresidentialList(params)
- this.mescroll.resetUpScroll()
- },
- /**
- * 顶部菜单选择
- * @param {Object} index 菜单下标
- */
- showDown(index){
- if (index==0) {
- //地区
- this.regionShow=true
- return
- }
- if(index==1){
- //机构
- this.popupShow = true;
- return;
- }else if(index==2){
- //物业名称
- this.residentailShow=true
- }else if (index==3) {
- //筛选
- this.filterShow=true
- }
-
- },
- /**
- * 确认筛选
- */
- filterConfirm(){
- this.mescroll.resetUpScroll()
- },
- /**
- * 地区确认回调
- * @param {Object} object
- */
- regionConfirm(object){
- this.data[0]= object.area.label;
- this.areaValue = object.area.value;
- let params = {
- isSelect: true,
- regionArea: this.areaValue
- };
- this.getListByLikeName(params);
- },
- /**
- * 获取机构列表
- * @param {Object} params
- */
- getListByLikeName(params){
- let list = [];
- this.$api.permissions.orgList(params).then(res=>{
- console.log(res)
- let list = [];
- for(let item of res.data.records){
- let element = {
- label: item.name,
- value: item.id
- }
- list.splice(list.length,0,element);
- // list.push(obj);
- }
- this.searchList = list;
- })
- },
- /**
- * 添加小区
- */
- add(){
- uni.navigateTo({
- url:"./add"
- })
- },
- delItem(item){
- this.$dialog.showModal('确定要删除此项吗?').then(res=>{
- this.$api,room.del({id:item.id}).then(res=>{
- if (res.data) {
- this.$showToast('删除成功')
- that.mescroll.resetUpScroll()
- }
- })
- })
- }
- }
- }
- </script>
- <style>
- </style>
|