house.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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} 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'}],
  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. }
  95. deleteResident(params).then(res=>{
  96. if(res.code==200){
  97. this.$toast("删除成功");
  98. setTimeout(function(){
  99. that.getrefreshData()
  100. },1500)
  101. }
  102. })
  103. },
  104. init(){
  105. // 房屋状态
  106. getDictionaryFn('house_status').then(res=>{
  107. if(res.code==200){
  108. this.fwztList = res.data.map(v => {
  109. var obj={
  110. tit: v.dictLabel,
  111. val: v.dictValue
  112. }
  113. this.tablist.push(obj)
  114. return {
  115. dictLabel: v.dictLabel,
  116. dictValue: v.dictValue
  117. }
  118. })
  119. }
  120. })
  121. //人员类型
  122. getDictionaryFn('resident_Type').then(res=>{
  123. if(res.code==200){
  124. this.rylxList = res.data.map(v => {
  125. return {
  126. dictLabel: v.dictLabel,
  127. dictValue: v.dictValue
  128. }
  129. })
  130. }
  131. })
  132. },
  133. getAddFn(){
  134. this.$tab.navigateTo("/work/pages/manage/houseadd")
  135. },
  136. getDetail(data){
  137. var info=JSON.parse(JSON.stringify(data))
  138. var tabval=this.tabval;
  139. if(tabval=='-1'||tabval=='wtg'){
  140. var id=info.residentId
  141. this.$tab.navigateTo(`/work/pages/manage/housedetail?id=${id}`)
  142. }else{
  143. var id=info.houseId
  144. this.$tab.navigateTo(`/work/pages/manage/addhouse?id=${id}`)
  145. }
  146. },
  147. getPut(e){
  148. this.$tab.navigateTo("/work/pages/manage/addhouse?id="+e)
  149. },
  150. getCar(e){
  151. this.$tab.navigateTo("/work/pages/manage/car?id="+e)
  152. },
  153. getShFn(data){
  154. var that=this;
  155. var info=JSON.parse(JSON.stringify(data))
  156. var params=JSON.parse(JSON.stringify(info.ite))
  157. params.examine=info.sh;
  158. examineResident(params).then(res=>{
  159. if(res.code==200){
  160. this.$toast('审核成功')
  161. setTimeout(function() {
  162. that.getrefreshData()
  163. }, 1500);
  164. }
  165. })
  166. },
  167. getJuzhu(e){
  168. var data={
  169. id:e,
  170. type:"house"
  171. }
  172. this.$tab.navigateTo("/people/pages/people/fwindex?data="+encodeURIComponent(JSON.stringify(data)))
  173. },
  174. getTabFn(val){
  175. this.tabval=val;
  176. this.getrefreshData()
  177. },
  178. getConfirm(){
  179. this.getrefreshData()
  180. },
  181. getReset(){
  182. this.cxrq='';
  183. this.text='';
  184. this.getrefreshData()
  185. },
  186. getrefreshData(){
  187. this.pageNum=1;
  188. this.list=[];
  189. this.reachflag=true;
  190. this.getDataFn()
  191. },
  192. bindDateChangea(e){
  193. var val=e.detail.value;
  194. this.cxrq=val;
  195. },
  196. getDataFn(){
  197. var params={
  198. pageSize:this.pageSize,
  199. pageNum: this.pageNum,
  200. }
  201. if(this.tabval!=-1&&this.tabval!='wtg'){
  202. params.houseStatus=this.tabval
  203. }
  204. if(this.text){
  205. params.detailedAddress=this.text
  206. }
  207. if(this.tabval==-1||this.tabval=='wtg'){
  208. if(this.tabval=='wtg'){
  209. params.examine=3
  210. }else{
  211. params.examine=1
  212. }
  213. residentInfoList(params).then(res=>{
  214. if(res.code==200){
  215. if (res.rows.length < this.pageSize) {
  216. this.reachflag = false
  217. this.wtdt = '到底了~';
  218. } else {
  219. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  220. if (num < res.total) {
  221. this.reachflag = true
  222. this.wtdt = ''
  223. } else {
  224. this.reachflag = false
  225. this.wtdt = '到底了~';
  226. }
  227. }
  228. if (this.pageNum == 1) {
  229. this.list = res.rows;
  230. } else {
  231. this.list = this.list.concat(res.rows)
  232. }
  233. }else{
  234. this.$toast(res.msg)
  235. }
  236. })
  237. }else{
  238. houseInfoList(params).then(res=>{
  239. if(res.code==200){
  240. if (res.rows.length < this.pageSize) {
  241. this.reachflag = false
  242. this.wtdt = '到底了~';
  243. } else {
  244. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  245. if (num < res.total) {
  246. this.reachflag = true
  247. this.wtdt = ''
  248. } else {
  249. this.reachflag = false
  250. this.wtdt = '到底了~';
  251. }
  252. }
  253. if (this.pageNum == 1) {
  254. this.list = res.rows;
  255. } else {
  256. this.list = this.list.concat(res.rows)
  257. }
  258. }else{
  259. this.$toast(res.msg)
  260. }
  261. })
  262. }
  263. },
  264. }
  265. }
  266. </script>
  267. <style>
  268. page{background: #F3F3F0;}
  269. </style>
  270. <style lang="scss" scoped>
  271. .car{padding: 224rpx 0 110rpx;}
  272. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  273. .topa{padding: 20rpx ;
  274. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  275. .chekt{min-width: 180rpx;
  276. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  277. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  278. }
  279. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  280. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  281. input{flex: 1;font-size: 26rpx;color: #272727;}
  282. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  283. font-size: 26rpx;
  284. color: #FFFFFF;}
  285. }
  286. }
  287. .tabtopa{padding-right: 180rpx;position: relative;
  288. .tabtop{padding-bottom: 40rpx;overflow: auto;
  289. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;flex: 0 0 auto;
  290. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  291. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  292. }
  293. }
  294. }
  295. .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;
  296. &.act{
  297. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  298. }
  299. }
  300. }
  301. }
  302. .cdbtns{position: fixed;left: 0;right: 0;height: 98rpx;z-index: 2;display: flex;align-items: center;bottom: 0;
  303. view{flex: 1;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 26rpx;height: 98rpx;
  304. &.btna{background: #FFFFFF;color: #0156FE;}
  305. &.btnb{background: #0156FE;color: #FFFFFF;}
  306. }
  307. }
  308. .carlists{padding: 0 18rpx;}
  309. </style>