houseadd.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="check">
  3. <view class="cbox">
  4. <view class="chtop flexc">
  5. <view class="line"></view>
  6. <view>房屋信息</view>
  7. </view>
  8. <view class="chmain">
  9. <uni-forms ref="form" :model="datainfo" :rules="rules">
  10. <uni-forms-item label="房屋坐落" required name="location">
  11. <view class="flexc">
  12. <uni-easyinput :disabled="isdisabled" v-model="datainfo.location" :inputBorder='false' placeholder="请输入房屋坐落" />
  13. <view class="rimg"></view>
  14. </view>
  15. </uni-forms-item>
  16. <uni-forms-item label="房屋类型" required name="houseType">
  17. <picker range-key='dictLabel' :disabled="isdisabled" :value="fwlxidx" :range="fwlxList" @change='bindDateChangee'>
  18. <view class="flexc mh35">
  19. <view class="flex1 txr f13 co27" v-if="datainfo.houseType&&!fwlx">{{statusFormats(datainfo.houseType,fwlxList,'fwlx')}}</view>
  20. <view class="flex1 txr f13" v-else :class="fwlx?'co27':'coa'">{{fwlx||"请选择房屋类型"}}</view>
  21. <view class="rimg"><image :src="rimg"></image></view>
  22. </view>
  23. </picker>
  24. </uni-forms-item>
  25. <uni-forms-item label="权利人姓名" name="ownerName">
  26. <view class="flexc">
  27. <uni-easyinput :disabled="isdisabled" v-model="datainfo.ownerName" :inputBorder='false' placeholder="请输入权利人姓名" />
  28. <view class="rimg"></view>
  29. </view>
  30. </uni-forms-item>
  31. <uni-forms-item label="建筑面积" required name="area">
  32. <view class="flexc">
  33. <uni-easyinput :disabled="isdisabled" type="number" v-model="datainfo.area" :inputBorder='false' placeholder="请输入建筑面积" />
  34. <view class="tips">m²</view>
  35. <view class="rimg"></view>
  36. </view>
  37. </uni-forms-item>
  38. <uni-forms-item label="小区名称" name="communityName">
  39. <view class="flexc">
  40. <uni-easyinput :disabled="isdisabled" v-model="datainfo.communityName" :inputBorder='false' placeholder="请输入小区名称" />
  41. <view class="rimg"></view>
  42. </view>
  43. </uni-forms-item>
  44. <uni-forms-item label="楼栋" required name="loudong">
  45. <view class="flexcc">
  46. <view class="flexc ml10">
  47. <uni-easyinput :disabled="isdisabled" v-model="datainfo.loudong" :inputBorder='false' placeholder="请输入" />
  48. <view class="tips">栋</view>
  49. </view>
  50. <view class="flexc ml10">
  51. <uni-easyinput :disabled="isdisabled" v-model="datainfo.danyuan" :inputBorder='false' placeholder="请输入" />
  52. <view class="tips">单元</view>
  53. </view>
  54. <view class="rimg"></view>
  55. </view>
  56. </uni-forms-item>
  57. <uni-forms-item label="门牌号" required name="xxaddress">
  58. <view class="flexc">
  59. <uni-easyinput :disabled="isdisabled" v-model="datainfo.xxaddress" :inputBorder='false' placeholder="请输入门牌号" />
  60. <view class="rimg"></view>
  61. </view>
  62. </uni-forms-item>
  63. <uni-forms-item label="有无车位" name="hasParkingSpace">
  64. <picker range-key='dictLabel' :disabled="isdisabled" :value="ywcwidx" :range="ywcwList" @change='bindDateChanged'>
  65. <view class="flexc">
  66. <view class="flex1 txr f13 co27" v-if="datainfo.hasParkingSpace&&!ywcw">{{statusFormats(datainfo.hasParkingSpace,ywcwList,'ywcw')}}</view>
  67. <view class="flex1 txr f13" v-else :class="ywcw?'co27':'coa'">{{ywcw||"请选择有/无"}}</view>
  68. <view class="rimg"><image :src="rimg"></image></view>
  69. </view>
  70. </picker>
  71. </uni-forms-item>
  72. <uni-forms-item label="车位号" name="phonenumber">
  73. <view class="flexc">
  74. <uni-easyinput :disabled="isdisabled" v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请输入车位号" />
  75. <view class="rimg"></view>
  76. </view>
  77. </uni-forms-item>
  78. </uni-forms>
  79. <view class="rhbtn mt30" @click="getSubmit">确定添加</view>
  80. </view>
  81. </view>
  82. <loading></loading>
  83. </view>
  84. </template>
  85. <script>
  86. import config from '@/config'
  87. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  88. import {uploadIdentify,selectValueKey,geocodeAddress} from '@/utils/common.js'
  89. import {getDictionaryFn} from "@/api/system/user.js"
  90. import {houseInfoAdd,houseInfoPut,houseInfoDet} from "@/api/work/work.js"
  91. export default{
  92. components:{},
  93. data(){
  94. return{
  95. rimg: require('@/people/static/people/rimg.png'),
  96. cmico:require('@/people/static/people/cmico.png'),
  97. baseUrl:config.baseUrl,
  98. datainfo:{
  99. // "houseId":"",//房屋信息主键
  100. "ownerName":null,//权利人姓名
  101. "location":null,//房屋坐落位置
  102. "rightType":null,//权利类型,如所有权、使用权等
  103. "area":null,//房屋面积,单位为平方米
  104. "loudong":null,//楼栋
  105. "danyuan":null,//单元
  106. "xxaddress":null,//详细
  107. "houseType":null,//房屋类型 1:普通住宅,2:洋房
  108. // "documentNumber":"",//房屋相关的字第号
  109. // "propertyUnitNumber":"",//不动产单元号
  110. // "coOwnership":"",//房屋的共有情况,如共有比例等
  111. // "usageType":"",//房屋用途,如住宅、商业等
  112. // "usagePeriod":"",//房屋使用期限
  113. // "registrationDate":"",//房屋登记日期
  114. // "coOwner":"",//共有人姓名,多个共有人可以用逗号分隔
  115. "detailedAddress":null,//房屋的门牌号
  116. "hasParkingSpace":null,//是否有车位,Y表示有,N表示无
  117. "communityName":this.$store.state.user.companyName,//房屋所在小区名称
  118. // "houseStatus":""//房屋状态:1-自住,2-出租,3-空闲,4-待售
  119. },
  120. rules: {
  121. location: {rules: [{required: true,errorMessage: '请输入房屋坐落位置' }]},
  122. houseType: {rules: [{required: true,errorMessage: '请选择房屋类型' }]},
  123. // detailedAddress: {rules: [{required: true,errorMessage: '请输入门牌号' }]},
  124. area: {rules: [{required: true,errorMessage: '请输入面积' }]},
  125. },
  126. id:'',
  127. ptype:'add',
  128. fwzt:'',
  129. qllx:'',
  130. fwyt:'',
  131. ywcw:'',
  132. fwlx:'',
  133. fwztidx:'',
  134. qllxidx:'',
  135. fwytidx:'',
  136. ywcwidx:'',
  137. fwlxidx:'',
  138. fwztList:[],
  139. qllxList:[],
  140. fwytList:[],
  141. fwlxList:[],
  142. ywcwList:[{dictLabel:'有',dictValue:'Y'},{dictLabel:'无',dictValue:'N'},],
  143. isdisabled:false,
  144. latitude:'',
  145. longitude:"",
  146. }
  147. },
  148. onLoad: function(e) {
  149. this.init()
  150. },
  151. methods:{
  152. checkPermi, checkRole,
  153. statusFormats(data, list,type) {
  154. var aite=selectValueKey(list, data);
  155. if(type=='ywcw'){
  156. this.ywcwidx=aite.key
  157. }else if(type=='fwlx'){
  158. this.fwlxidx=aite.key;
  159. }
  160. return aite.actions;
  161. },
  162. init(){
  163. // 房屋类型
  164. getDictionaryFn('house_type').then(res=>{
  165. if(res.code==200){
  166. this.fwlxList = res.data.map(v => {
  167. return {
  168. dictLabel: v.dictLabel,
  169. dictValue: v.dictValue
  170. }
  171. })
  172. }
  173. })
  174. },
  175. bindDateChangee(e){
  176. var val=e.detail.value;
  177. this.datainfo.houseType=this.fwlxList[val].dictValue;
  178. this.fwlx=this.fwlxList[val].dictLabel;
  179. },
  180. bindDateChanged(e){
  181. var val=e.detail.value;
  182. this.datainfo.hasParkingSpace=this.ywcwList[val].dictValue;
  183. this.ywcw=this.ywcwList[val].dictLabel;
  184. },
  185. getSubmit(){
  186. this.$refs.form.validate().then(res => {
  187. var params=JSON.parse(JSON.stringify(this.datainfo))
  188. if(!params.loudong||!params.danyuan){
  189. this.$toast("请输入楼栋")
  190. return
  191. }
  192. if(!params.xxaddress){
  193. this.$toast("请输入门牌号")
  194. return
  195. }
  196. params.detailedAddress=`${params.loudong?params.loudong+'栋':''}` + `${params.danyuan?params.danyuan+'单元':''}` + params.xxaddress;
  197. houseInfoAdd(params).then(res=>{
  198. if(res.code==200){
  199. this.$toast("新增成功")
  200. setTimeout(function(){
  201. uni.$emit("refHouseList")
  202. uni.navigateBack({
  203. delta:1
  204. })
  205. },1500)
  206. }
  207. })
  208. })
  209. },
  210. }
  211. }
  212. </script>
  213. <style>
  214. page{background: #F3F3F0;}
  215. </style>
  216. <style lang="scss" scoped>
  217. .coa /deep/ .uni-date__x-input{text-align: right;color: #AAAAAA;}
  218. .check /deep/ .uni-date-editor--x__disabled{opacity: 1;}
  219. .check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  220. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  221. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  222. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  223. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  224. .check /deep/ .uni-input-input{font-size: 26rpx;}
  225. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  226. .check /deep/ .uni-forms-item__label text{width: 110rpx;text-align-last: justify;}
  227. .check /deep/ .uni-forms-item__label .is-required{width: auto;}
  228. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  229. .check{min-height: 100vh;padding: 20rpx 18rpx 22rpx;box-sizing: border-box;display: flex;box-sizing: border-box;}
  230. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;padding-bottom: 28rpx;
  231. .chtop{padding-top: 32rpx;margin-bottom: 22rpx;
  232. .line{width: 14rpx;height: 48rpx;background: #0256FD;border-radius:0 12rpx 12rpx 0;margin-right: 18rpx;}
  233. view{font-weight: bold;font-size: 32rpx;color: #272727;}
  234. }
  235. .chmain{
  236. padding: 0 32rpx;
  237. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  238. .img{width: 100%;height: 100%;}
  239. .addimg{width: 90rpx;height: 90rpx;margin-bottom: 8rpx;}
  240. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  241. }
  242. }
  243. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  244. image{width: 100%;height: 100%;}
  245. }
  246. }
  247. .tips{font-weight: bold;color: #272727;font-size: 26rpx;margin-left: 8rpx;}
  248. </style>