house.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="topa flexc">
  5. <!-- <image :src="reset" class="resetimg" @click="getReset"></image>
  6. <picker mode="date" @change='bindDateChangea'>
  7. <view class="chekt flexc">
  8. <view>{{cxrq|| "选择日期"}}</view>
  9. <image :src="up"></image>
  10. </view>
  11. </picker> -->
  12. <view class="search flexc">
  13. <image :src="search"></image>
  14. <!-- confirm-type="search" @confirm="getConfirm" -->
  15. <input placeholder="请输入户号进行搜索" v-model="text"/>
  16. <view class="btn" @click="getConfirm">搜索</view>
  17. </view>
  18. </view>
  19. <view class="tabtopa">
  20. <view class="tabtop flexc">
  21. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  22. <view class="tabbtn" :class="tabval=='wtg'?'act':''" @click="getTabFn('wtg')">未通过审核</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 列表 -->
  27. <view class="carlists">
  28. <car-list :datainfo="list" :wtdt="wtdt" :tabval="tabval" :rylxList="rylxList" type='comehouse' @getDetail="getDetail" @getPut="getPut" @getJuzhu="getJuzhu" @getDelFn="getDelFn" @getCar="getCar" @getShFn="getShFn"></car-list>
  29. </view>
  30. <view class="cdbtns">
  31. <!-- <view class="btna" @click="getAddFn">单个添加</view>
  32. <view class="btnb" @click="getReplyFn">一键导入</view> -->
  33. <view class="btnb" @click="getAddFn">添加房屋</view>
  34. <!-- <view class="btnb" @click="getReplyFn">一键导入</view> -->
  35. </view>
  36. <loading></loading>
  37. </view>
  38. </template>
  39. <script>
  40. import config from '@/config'
  41. const baseUrl = config.baseUrl
  42. import carList from "@/work/components/car/list.vue"
  43. import {houseInfoList,examineResident,deleteResident,houseInfowyList} from "@/api/work/work.js"
  44. import {residentInfoList} from "@/api/work/people.js"
  45. import {getDictionaryFn} from "@/api/system/user.js"
  46. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  47. export default{
  48. components:{carList},
  49. data(){
  50. return{
  51. reset:require('@/car/static/car/reset.png'),
  52. search:require('@/car/static/car/search.png'),
  53. up:require('@/car/static/car/up.png'),
  54. cxrq:"",
  55. text:'',
  56. list:[],
  57. pageSize: 10,
  58. pageNum: 1,
  59. reachflag: true,
  60. wtdt:'',
  61. tabval:'-1',
  62. tablist:[{tit:"待审核",val:'-1'},{tit:"全部",val:'-2'}],
  63. fwztList:[],
  64. rylxList:[],
  65. }
  66. },
  67. onUnload() {
  68. uni.$off('refHouseList')
  69. },
  70. onLoad: function(e) {
  71. uni.$on('refHouseList',(res)=>{
  72. this.getrefreshData()
  73. })
  74. this.init()
  75. this.getDataFn();
  76. },
  77. // 上拉触底加载更多触发事件
  78. onReachBottom() {
  79. if (this.reachflag) {
  80. this.pageNum++
  81. this.getDataFn()
  82. }
  83. },
  84. methods:{
  85. checkPermi, checkRole,
  86. getDelFn(data){
  87. var that=this;
  88. var info=JSON.parse(JSON.stringify(data))
  89. var params={
  90. residentId:info.residentId,
  91. userId:info.userId,
  92. tenantId:info.tenantId,
  93. houseId:info.houseId,
  94. examine:info.examine,
  95. }
  96. deleteResident(params).then(res=>{
  97. if(res.code==200){
  98. this.$toast("删除成功");
  99. setTimeout(function(){
  100. that.getrefreshData()
  101. },1500)
  102. }
  103. })
  104. },
  105. init(){
  106. // 房屋状态
  107. getDictionaryFn('house_status').then(res=>{
  108. if(res.code==200){
  109. this.fwztList = res.data.map(v => {
  110. var obj={
  111. tit: v.dictLabel,
  112. val: v.dictValue
  113. }
  114. this.tablist.push(obj)
  115. return {
  116. dictLabel: v.dictLabel,
  117. dictValue: v.dictValue
  118. }
  119. })
  120. }
  121. })
  122. //人员类型
  123. getDictionaryFn('resident_Type').then(res=>{
  124. if(res.code==200){
  125. this.rylxList = res.data.map(v => {
  126. return {
  127. dictLabel: v.dictLabel,
  128. dictValue: v.dictValue
  129. }
  130. })
  131. }
  132. })
  133. },
  134. getAddFn(){
  135. this.$tab.navigateTo("/work/pages/manage/houseadd")
  136. },
  137. getDetail(data){
  138. var info=JSON.parse(JSON.stringify(data))
  139. var tabval=this.tabval;
  140. if(tabval=='-1'||tabval=='wtg'){
  141. var id=info.residentId
  142. this.$tab.navigateTo(`/work/pages/manage/housedetail?id=${id}`)
  143. }else{
  144. var id=info.houseId
  145. this.$tab.navigateTo(`/work/pages/manage/addhouse?id=${id}`)
  146. }
  147. },
  148. getPut(e){
  149. this.$tab.navigateTo("/work/pages/manage/addhouse?id="+e)
  150. },
  151. getCar(e){
  152. this.$tab.navigateTo("/work/pages/manage/car?id="+e)
  153. },
  154. getShFn(data){
  155. var that=this;
  156. var info=JSON.parse(JSON.stringify(data))
  157. var params=JSON.parse(JSON.stringify(info.ite))
  158. params.examine=info.sh;
  159. examineResident(params).then(res=>{
  160. if(res.code==200){
  161. this.$toast('审核成功')
  162. setTimeout(function() {
  163. that.getrefreshData()
  164. }, 1500);
  165. }
  166. })
  167. },
  168. getJuzhu(e){
  169. var data={
  170. id:e,
  171. type:"house"
  172. }
  173. this.$tab.navigateTo("/people/pages/people/fwindex?data="+encodeURIComponent(JSON.stringify(data)))
  174. },
  175. getTabFn(val){
  176. this.tabval=val;
  177. this.getrefreshData()
  178. },
  179. getConfirm(){
  180. this.getrefreshData()
  181. },
  182. getReset(){
  183. this.cxrq='';
  184. this.text='';
  185. this.getrefreshData()
  186. },
  187. getrefreshData(){
  188. this.pageNum=1;
  189. this.list=[];
  190. this.reachflag=true;
  191. this.getDataFn()
  192. },
  193. bindDateChangea(e){
  194. var val=e.detail.value;
  195. this.cxrq=val;
  196. },
  197. getDataFn(){
  198. var params={
  199. pageSize:this.pageSize,
  200. pageNum: this.pageNum,
  201. }
  202. if(this.tabval!=-1&&this.tabval!='wtg'&&this.tabval!=-2){
  203. params.houseStatus=this.tabval
  204. }
  205. if(this.text){
  206. params.detailedAddress=this.text
  207. }
  208. if(this.tabval==-1||this.tabval=='wtg'){
  209. if(this.tabval=='wtg'){
  210. params.examine=3
  211. }else{
  212. params.examine=1
  213. }
  214. residentInfoList(params).then(res=>{
  215. if(res.code==200){
  216. if (res.rows.length < this.pageSize) {
  217. this.reachflag = false
  218. this.wtdt = '到底了~';
  219. } else {
  220. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  221. if (num < res.total) {
  222. this.reachflag = true
  223. this.wtdt = ''
  224. } else {
  225. this.reachflag = false
  226. this.wtdt = '到底了~';
  227. }
  228. }
  229. if (this.pageNum == 1) {
  230. this.list = res.rows;
  231. } else {
  232. this.list = this.list.concat(res.rows)
  233. }
  234. }else{
  235. this.$toast(res.msg)
  236. }
  237. })
  238. }else{
  239. houseInfowyList(params).then(res=>{
  240. if(res.code==200){
  241. if (res.rows.length < this.pageSize) {
  242. this.reachflag = false
  243. this.wtdt = '到底了~';
  244. } else {
  245. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  246. if (num < res.total) {
  247. this.reachflag = true
  248. this.wtdt = ''
  249. } else {
  250. this.reachflag = false
  251. this.wtdt = '到底了~';
  252. }
  253. }
  254. if (this.pageNum == 1) {
  255. this.list = res.rows;
  256. } else {
  257. this.list = this.list.concat(res.rows)
  258. }
  259. }else{
  260. this.$toast(res.msg)
  261. }
  262. })
  263. }
  264. },
  265. }
  266. }
  267. </script>
  268. <style>
  269. page{background: #F3F3F0;}
  270. </style>
  271. <style lang="scss" scoped>
  272. .car{padding: 224rpx 0 110rpx;}
  273. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  274. .topa{padding: 20rpx ;
  275. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  276. .chekt{min-width: 180rpx;
  277. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  278. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  279. }
  280. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  281. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  282. input{flex: 1;font-size: 26rpx;color: #272727;}
  283. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  284. font-size: 26rpx;
  285. color: #FFFFFF;}
  286. }
  287. }
  288. .tabtopa{padding-right: 180rpx;position: relative;
  289. .tabtop{padding-bottom: 40rpx;overflow: auto;
  290. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;flex: 0 0 auto;
  291. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  292. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  293. }
  294. }
  295. }
  296. .tabbtn{border-radius: 58rpx 0 0 58rpx;background: #E6E6E6;padding: 0 18rpx 0 26rpx;font-weight: 500;font-size: 26rpx;color: #3565ED;line-height: 58rpx;position: absolute;right: 0;top: 0;
  297. &.act{
  298. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  299. }
  300. }
  301. }
  302. }
  303. .cdbtns{position: fixed;left: 0;right: 0;height: 98rpx;z-index: 2;display: flex;align-items: center;bottom: 0;
  304. view{flex: 1;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 26rpx;height: 98rpx;
  305. &.btna{background: #FFFFFF;color: #0156FE;}
  306. &.btnb{background: #0156FE;color: #FFFFFF;}
  307. }
  308. }
  309. .carlists{padding: 0 18rpx;}
  310. </style>