| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <view>
- <!-- 详情 -->
- <u-popup v-model="popupShow" mode="center" width="650" :closeable="true" border-radius="10">
- <view style="padding: 60rpx 40rpx 10rpx;">
- <u-form label-width="150" :model="form">
- <u-form-item label="所属小区" :required="true">
- <u-input type="select" disabled @click="operaType=1;residentialShow=true" v-model="form.residentialName" />
- </u-form-item>
- <u-form-item label="车主姓名" ><u-input v-model="form.personName" /></u-form-item>
- <u-form-item label="车主电话" ><u-input v-model="form.personTel" /></u-form-item>
- </u-form>
- <view @click="submit" class="flex cu-btn bg-blue" style="margin: 60rpx 0 10rpx;padding: 40rpx;">
- 提交
- </view>
- </view>
- </u-popup>
-
- <!-- 筛选标签条 -->
- <view class="cu-bar bg-white flex justify-around" 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: 24%;text-align: center;height: 100%;">
- {{data[index]==""? item:data[index]}}
- <u-icon name="arrow-down-fill" size="20" style="padding-left: 10rpx;"></u-icon>
- </view>
-
- <view class="u-line-1" @click="filterShow=true" style="width: 26%;position: relative;text-align: center;height: 100%;">
- 筛选
- <text class="cuIcon-filter padding-left-10" ></text>
- <u-badge :offset="[2, 20]" 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" @edit="edit" :list="list"></card>
- </view>
- </mescroll-body>
-
- <!-- 地区选择器 -->
- <u-picker @confirm="regionConfirm" mode="region" v-model="regionShow"></u-picker>
- <!-- 小区 -->
- <u-popup border-radius="60" height="60%" mode="bottom" v-model="residentialShow">
- <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="keyword" 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="residentailConfirm(item)" hover-class="hoverClass" class="text-center padding-30 solid-bottom" v-for="(item,index) in residentialList" :key="index">
- <text>{{item.label}}</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-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 :border-bottom="false" label="车主姓名"><u-input placeholder="请输入车主姓名" v-model="params.personName" /></u-form-item>
- <u-form-item :border-bottom="false" label="车主号码"><u-input placeholder="请输入车主号码" v-model="params.personPhone" /></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 {
- //新增修改详情弹窗
- popupShow:false,
- form:{},
- operaType:0,
-
- //顶部菜单栏
- filterMenu: ["所属地区","所属小区"],
- data:['','',''],
-
- //地区
- regionShow:false,
- areaValue:'',
-
- //小区
- residentialShow:false,
- residentialList:[],
-
- //筛选
- filterShow:false,
- filterCount:0,
-
- //参数
- params:{},
- //小区关键字
- keyword:'',
-
- list: [],
- downOption: {
- use: true,
- auto: false
- },
- upOption: {
- page: {
- page: 0,
- size: 10
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
-
- }
- },
- onLoad(){
- that=this
- this.getResidentailList({isSelect:true})
- },
- watch:{
- keyword(){
- let that=this
- //节流函数
- if (this.timer){
- clearTimeout(this.timer)//阻止setTimeout函数的执行
- }
- this.timer = setTimeout(() => {
- that.searchList=[]
- let params = {
- isSelect: true,
- regionArea: that.areaValue,
- name: that.keyword
- }
- this.getResidentailList(params)
- }, 500)
- }
-
- },
- methods: {
- //添加车辆
- add(){
- uni.navigateTo({
- url:"./add"
- })
- },
- edit(item){
- let {orgId,orgPosition,...form}=item
- this.form=form
- this.popupShow=true
- console.log(this.form);
- },
- delItem(item){
- this.$dialog.showModal('确定要删除此记录吗?').then(res=>{
- this.$api.building.del({id:item.id}).then(res=>{
- if (res.data==true) {
- this.$u.toast('删除成功')
- this.mescroll.resetUpScroll()
- }else{
- this.$u.toast('删除失败')
- }
- })
- })
- },
-
- submit(){
- if (this.$isEmpty(this.form.name)) {
- this.$u.toast('请输入楼栋名')
- return
- }
- if (this.$isEmpty(this.form.residentialId) || this.$isEmpty(this.form.residentialName)) {
- this.$u.toast('请选择所属小区')
- return
- }
- if (!this.$isEmpty(this.form.personTel)) {
- if (!this.$verify.phone(this.form.personTel)&&!this.$verify.landline(this.form.personTel)) {
- this.$u.toast('请输入正确的联系方式')
- return
- }
- }
- console.log(this.form);
- if (this.$isEmpty(this.form.id)) {
- console.log('我是新增');
- this.$api.building.add(this.form).then(res=>{
- if (res.code==200) {
- this.popupShow=false
- this.$u.toast('添加成功')
- this.mescroll.resetUpScroll()
- }
- })
- }else{
- let {createAccountId,createDate,floorNumber,roomNumber,status,unitNumber,personNumber,...params}=this.form
- console.log(params);
- this.$api.building.update(params).then(res=>{
- if (res.data==true) {
- this.popupShow=false
- this.$u.toast('修改成功')
- this.mescroll.resetUpScroll()
- }
- })
- }
- },
- //获取小区列表
- getResidentailList(params){
- let list = [];
- this.$api.residential.page(params).then(res=>{
- let list=[]
- res.list.forEach(item=>{
- let obj={
- label:item.name,
- value:item.id
- }
- list.push(obj)
- })
- this.residentialList = list;
- })
- },
- /**
- * 获取筛选的条件数
- */
- getFilterCount(){
- let n=0
- console.log(this.areaValue);
- if (!this.$isEmpty(this.areaValue)) {
- //地区
- 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()
- try{
- if(params.personName == null || params.personPhone == null){
- console.log(params)
- this.$api.carManage.page(params).then(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);
- })
- }else{
- console.log(222)
- this.$api.carManage.pageBycondition(params).then(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.residentialList=[]
- //小区关键字
- this.keyword=''
- //数据列表
- this.list=[],
- this.getResidentailList()
- this.mescroll.resetUpScroll()
- },
- /**
- * 点击选择小区,重新获取楼栋列表
- */
- residentailConfirm(res){
- if (this.operaType==0) {
- // 筛选楼栋列表的选择小区
- this.params.residentialId =res.value
- this.data[1] = res.label
- this.residentialShow = false
- this.mescroll.resetUpScroll()
- }else if(this.operaType==1){
- // 添加操作的选择小区
- this.form.residentialName=res.label
- this.form.residentialId=res.value
- this.residentialShow=false
- this.operaType=0
- }
- },
- /**
- * 顶部菜单选择
- * @param {Object} index 菜单下标
- */
- showDown(index){
- if (index==0) {
- //地区
- this.regionShow=true
- return
- }
- if(index==1){
- //小区
- this.residentialShow = true;
- return;
- }
- },
- /**
- * 确认筛选
- */
- 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.getFilterCount()
- this.getResidentailList(params);
- },
- }
- }
- </script>
- <style>
- </style>
|