diff --git a/src/api/homestead/index.js b/src/api/homestead/index.js index c0c4737b..034dd64e 100644 --- a/src/api/homestead/index.js +++ b/src/api/homestead/index.js @@ -35,4 +35,37 @@ export function hcBottomSearch(query) { method: 'get', params: query }) -} \ No newline at end of file +} + +//上传附件图片 +export function commonUpload(query) { + return request({ + url: '/common/upload', + method: 'post', + data: query + }) +} + +//农房新增 +export function houseAdd(query) { + return request({ + url: '/geo/house/add', + method: 'post', + data: query + }) +} + + +//农地新增 +export function landAdd(query) { + return request({ + url: '/geo/land/add', + method: 'post', + data: query + }) +} + + + + + diff --git a/src/views/homestead/index.vue b/src/views/homestead/index.vue index 060ac5f3..ada07287 100644 --- a/src/views/homestead/index.vue +++ b/src/views/homestead/index.vue @@ -418,12 +418,12 @@ v-show="landHomesteadEditVisbile" style="bottom: 0" > -
+
{{ this.farmhouseStatus == 0 ? "录入宗地信息" : "录入农地信息" }}
-
+
农房编号
@@ -459,7 +459,7 @@
-
农房权属
+
土地性质
@@ -570,16 +570,31 @@
-
-
土地性质
-
+
+
房屋类型
+
+ + + +
+
土地面积
@@ -648,12 +663,12 @@ placeholder="流转合同截止日期" class="landHomesteadEdit_input" readonly - @click="landHomesteadEditcalendar = true" + @click="houseHomesteadEditcalendar = true" />
@@ -662,12 +677,12 @@
上传图片
- +
-
+
@@ -684,7 +699,7 @@
农地使用人名称
@@ -694,52 +709,6 @@
-
村名
-
- -
-
-
-
土地证号
-
- -
-
-
- -
-
-
是否有审批手续
-
- - - - - -
-
-
现状情况
@@ -763,8 +732,18 @@
+
+
土地证号
+
+ +
+
- +
@@ -833,7 +812,7 @@
承包人
@@ -857,7 +836,7 @@
流转合同截止日期
-
@@ -877,7 +855,8 @@
上传图片
- + +
@@ -911,7 +890,11 @@ import { bigDataHcCountyInfo, bigDataHcVillageInfo, hcBottomSearch, + commonUpload, + houseAdd, + landAdd } from "@/api/homestead/index"; + export default { name: "homesteadLogin", data() { @@ -957,15 +940,19 @@ export default { drawMapPolygon: false, //绘制地图 }, //地图绘制坐标存储 - coordinateList: [], + coordinateList: '', //新建选择农房土地弹窗 显隐 farmlandEditSwitchVisbule: false, //false + //编辑房屋土地块高度 + landHomesteadEditWrapHeight:0, //编辑房屋土地信息--显隐 landHomesteadEditVisbile: false, //查看编辑房屋、土地--类型 0 农房 1 农地 farmhouseStatus: 0, - //新增日历显影 - landHomesteadEditcalendar: false, + //新增农房日历显影 + houseHomesteadEditcalendar: false, + //新增农地日历显影 + landHomesteadEditcalendar:false, //选择顺序 selectChooseOrder: 0, @@ -981,7 +968,7 @@ export default { nydlx: "", // String 否 农用地类型 mj: "", // String 否 面积 lzsynx: "", // String 否 流转剩余年限 - zlhtjzrq: "", // String 否 日期 + lzhtjzrq: "", // String 否 日期 sfylzyx: "", // String 否 是否流转意向 xzqk: "", // String 否 现状情况 theGeom: "", //String 否 空间坐标 @@ -1004,7 +991,6 @@ export default { tdzh: "", // String 否 土地证号 jzmj: "", // String 否 建筑面积 tdmj: "", // String 否 土地面积 - tdzx: "", // String 否 土地性质 sfyspsx: "", // String 否 是否有审批手续 xzqk: "", // String 否 现状情况 theGeom: "", // String 否 空间坐标 @@ -1024,6 +1010,9 @@ export default { tdxzOptions: [], tdxzOptionsVibile: false, //农房 - 农房权属 -弹窗 tdxzOptionsValue: "", //农房 - 农房权属 值 + //农房 - 房屋类型 + fwdlxOptions: ["个人", "集体"], + fwdlxOptionsVibile: false, // 农地 -- 农用地类型--弹窗 //农房 - 现状情况 xzqkOptions: [], xzqkOptionsVisbile: false, //农房 - 现状情况 弹窗 @@ -1034,9 +1023,6 @@ export default { xfApprovalOptions: ["是", "否"], xfCirculationVisbile: false, //农房 - 是否有审批 -弹窗 - //农地 -- 是否有审批手续 - xdApprovalOptions: ["是", "否"], - xdCirculationVisbile: false, //农房 - 是否有审批 -弹窗 //农地 -- 现状情况 ndxzqkOptions: [], ndxzqkOptionsVisbile: false, @@ -1049,8 +1035,10 @@ export default { xdCirculationOptions: ["是", "否"], xdlzCirculationVisbile: false, //农房 - 是否有流转 弹窗 - //以下删 - fileList: [], + //农房上传图片附件 + nfAddfileList: [], + //农地上传图片附件 + ndAddfileList: [], }; }, mounted() { @@ -1070,7 +1058,7 @@ export default { }, //新建选择农房土地弹窗 farmlandEditSwitchFun() { - if (this.coordinateList.length == 0) { + if (this.coordinateList == '') { this.$toast("请先完成绘制"); return false; } @@ -1119,6 +1107,15 @@ export default { this.landHomesteadEditVisbile = false; }, 300); } + setTimeout(()=>{ + //新建土地、房屋高度 + let landHomesteadEditWrap = this.$refs.landHomesteadEditWrap.offsetHeight; + let landHomesteadEditWrapPdg = $('.landHomesteadEdit_wrap .content_mian').css('paddingTop').replace('px','') + let landHomesteadEditWrapTitHei = $('.landHomesteadEdit_wrap .info_title').css('height').replace('px','') + if(landHomesteadEditWrap && landHomesteadEditWrapPdg && landHomesteadEditWrapTitHei){ + this.landHomesteadEditWrapHeight = landHomesteadEditWrap-landHomesteadEditWrapPdg*2-landHomesteadEditWrapTitHei-10; + } + },301) }, //选择农地 农房显影 farmlandEditSwitchVisbuleFun(type) { @@ -1151,20 +1148,214 @@ export default { }, //新增地块 编辑页 保存 landHomesteadEditSave() { - this.landHomesteadEditVisbileFun("hide"); - this.initDraw(); + + if(this.farmhouseStatus == 0){ + //农房 + let houseInfoList = this.houseInfoList; + houseInfoList.theGeom= this.coordinateList; + // orgCode 后期传 + // cdm 后期传 + // cm 后期传 + + if(houseInfoList.xh ==''){ + this.$toast("请填写序号"); + return false; + }else if(houseInfoList.fwsyrmc ==''){ + this.$toast("请填写房屋所有人名称"); + return false; + }else if(houseInfoList.fwsyqh ==''){ + this.$toast("请填写房屋所有权证号"); + return false; + }else if(houseInfoList.tdzh ==''){ + this.$toast("请填写土地证号"); + return false; + }else if(houseInfoList.jzmj ==''){ + this.$toast("请填写建筑面积"); + return false; + }else if(houseInfoList.tdmj ==''){ + this.$toast("请填写土地面积"); + return false; + }else if(houseInfoList.tdxz ==''){ + this.$toast("请选择土地性质"); + return false; + }else if(houseInfoList.sfyspsx ==''){ + this.$toast("请选择是否有审批手续"); + return false; + }else if(houseInfoList.xzqk ==''){ + this.$toast("请选择现状情况"); + return false; + }else if(houseInfoList.theGeom ==''){ + this.$toast("请选择地图坐标"); + return false; + }else if(houseInfoList.frontHouse ==''){ + this.$toast("请选择上传图片"); + return false; + }else if(houseInfoList.dz ==''){ + this.$toast("请填写地址"); + return false; + }else if(houseInfoList.zlrxm ==''){ + this.$toast("请填写租赁人姓名"); + return false; + }else if(houseInfoList.zlhtjzrq ==''){ + this.$toast("请填写租赁合同截止日期"); + return false; + }else if(houseInfoList.zlsynx ==''){ + this.$toast("请填写租赁剩余年限"); + return false; + }else if(houseInfoList.xzfwsfylzy ==''){ + this.$toast("请选择闲置房屋是否有流转意愿"); + return false; + }else if(houseInfoList.tdfl ==''){ + this.$toast("请选择房屋类型"); + return false; + } + console.log(houseInfoList) + + houseAdd(houseInfoList).then((res)=>{ + if(res.code == 200){ + this.$toast("农房新建成功"); + this.landHomesteadEditVisbileFun("hide"); + this.initDraw(); + } + }) + + + + }else if(this.farmhouseStatus == 1){ + // orgCode: "", // String 否 行政区代码 + // cdm: "", // String 否 村代码 + // cm: "", //String 否 村名 + //农地 + let landInfoList = this.landInfoList; + landInfoList.theGeom= this.coordinateList; + + if(landInfoList.xh ==''){ + this.$toast("请填写序号"); + return false; + }else if(landInfoList.cbrmc==''){ + this.$toast("请填写承包人名称"); + return false; + }else if(landInfoList.syrmc==''){ + this.$toast("请填写使用人名称"); + return false; + }else if(landInfoList.nydlx==''){ + this.$toast("请选择农用地类型"); + return false; + }else if(landInfoList.mj==''){ + this.$toast("请填写面积"); + return false; + }else if(landInfoList.lzsynx==''){ + this.$toast("请填写流转剩余年限"); + return false; + }else if(landInfoList.lzhtjzrq==''){ + this.$toast("请填写流转合同截止日期"); + return false; + }else if(landInfoList.sfylzyx==''){ + this.$toast("请填写是否流转意向"); + return false; + }else if(landInfoList.xzqk==''){ + this.$toast("请填写现状情况"); + return false; + }else if(landInfoList.theGeom==''){ + this.$toast("请勾选空间坐标"); + return false; + }else if(landInfoList.frontland==''){ + this.$toast("请上传图片"); + return false; + } + + + landAdd(landInfoList).then((res)=>{ + if(res.code == 200){ + this.$toast("农地新建成功"); + this.landHomesteadEditVisbileFun("hide"); + this.initDraw(); + } + }) + + + + + } + //保存成功触发 + }, - landHomesteadEdConfirm(data) { + landHomesteadEdConfirm(value) { + //农地 this.landHomesteadEditcalendar = false; - //获取日历的值 + this.landInfoList.lzhtjzrq = this.getDate(new Date(value)); + }, + houseHomesteadEdConfirm(value){ + //农房 + this.houseHomesteadEditcalendar = false; + this.houseInfoList.zlhtjzrq = this.getDate(new Date(value)); + }, + getDate(date){ + //date是传过来的时间戳,注意需为13位,10位需*1000 + //也可以不传,获取的就是当前时间 + var time = new Date(date); + var year= time.getFullYear() //年 + var month = ("0" + (time.getMonth() + 1)).slice(-2); //月 + var day = ("0" + time.getDate()).slice(-2); //日 + var mydate = year + "-" + month + "-" + day; + return mydate }, //初始化绘制 initDraw() { //清除数据 $("#drawRemove").trigger("click"); $("#drawReset").trigger("click"); - this.coordinateList = []; + this.coordinateList = ''; + //农地数据初始化 + this.landInfoList = { + id: "", //String 是 主键id + orgCode: "", // String 否 行政区代码 + cdm: "", // String 否 村代码 + cm: "", //String 否 村名 + xh: "", // String 否 序号 + cbrmc: "", //String 否 承包人名称 + syrmc: "", //String 否 使用人名称 + nydlx: "", // String 否 农用地类型 + mj: "", // String 否 面积 + lzsynx: "", // String 否 流转剩余年限 + zlhtjzrq: "", // String 否 日期 + sfylzyx: "", // String 否 是否流转意向 + xzqk: "", // String 否 现状情况 + theGeom: "", //String 否 空间坐标 + xzqkKey: "", // String 否 忽略 + nydlxKey: "", // String 否 忽略 + frontland: "", //String 否 图片前 + behindland: "", //String 否 图片后 + }; + + //农房数据初始化 + this.houseInfoList = { + id: "", // String 是 主键id + orgCode: "", // String 否 行政区代码 + cdm: "", // String 否 村代码 + cm: "", // String 否 村名 + xh: "", // String 否 序号 + tdxz: "", //土地性质 + fwsyrmc: "", // String 否 房屋所有人名称 + fwsyqh: "", // String 否 房屋所有权证号 + tdzh: "", // String 否 土地证号 + jzmj: "", // String 否 建筑面积 + tdmj: "", // String 否 土地面积 + sfyspsx: "", // String 否 是否有审批手续 + xzqk: "", // String 否 现状情况 + theGeom: "", // String 否 空间坐标 + xzqkKey: "", // String 否 忽略传null + tdxzKey: "", // String 否 忽略传null + frontHouse: "", // String 否 图片前 + behindHouse: "", // String 否 图片后 + dz: "", // String 否 地址 + zlrxm: "", // String 否 租赁人姓名 + zlhtjzrq: "", // 租赁合同截止日期 + zlsynx: "", // 租赁剩余年限 + xzfwsfylzy: "", // 闲置房屋是否有流转意愿 + tdfl: "", // 集体/个人 + }; this.draw.drawMapPolygon = false; //绘制地图 }, @@ -1189,12 +1380,11 @@ export default { ndDictionary() { //农用地类型 this.getDicts("sub_object_type").then((response) => { - console.log(response); this.nydlxOptions = response.data; }); //现状情况 this.getDicts("geo_hc_land").then((response) => { - console.log(response); + this.ndxzqkOptions = response.data; }); }, @@ -2231,7 +2421,6 @@ export default { var draw; //开始绘制地图 $("#drawPolygon").click(function () { - console.log("111"); //map.removeLayer(zjd_land); map.removeLayer(vector_drawing); //var source = new ol.source.Vector({wrapX: false}); @@ -2250,8 +2439,11 @@ export default { var geometry = feature.getGeometry(); var coordinate = geometry.getCoordinates(); console.log("打印" + coordinate); - _this.coordinateList.push(coordinate); - + _this.coordinateList= coordinate; + + $("#drawRemove").trigger("click"); + _this.$set(_this.draw, "drawMapPolygon", false); + //that.drawInsert = coordinate; }); map.addInteraction(draw); @@ -2597,11 +2789,13 @@ export default { //-----------------------------------------------------------------------------特效农地加载结束 end }, - //农房 - 农房权属 选择值 + //农房 - 土地性质 选择值 tdxzOptionsFun(value) { - this.houseInfoList.tdxz = value.dictValue; + this.houseInfoList.tdxz = value.dictLabel; this.tdxzOptionsValue = value.dictLabel; this.tdxzOptionsVibile = false; + console.log(value) + console.log( this.houseInfoList) }, //农房 - 是否有审批 选择值 xfCirculationFun(value) { @@ -2618,10 +2812,10 @@ export default { this.xflzCirculationVisbile = false; this.houseInfoList.xzfwsfylzy = value; }, - //农地 - 是否有审批 选择值 - xdCirculationFun(value) { - this.xdCirculationVisbile = false; - this.landInfoList.sfyspsx = value; + //农房 - 房屋类型 + fwdlxOptionsFun(value){ + this.houseInfoList.tdfl = value; + this.fwdlxOptionsVibile = false; }, //农地 - 现状情况 选择值 ndxzqkOptionsFun(value) { @@ -2630,7 +2824,7 @@ export default { }, //农地 - 农用地类型 选择值 nydlxOptionsFun(value) { - this.landInfoList.nydlx = value.dictValue; + this.landInfoList.nydlx = value.dictLabel; this.nydlxOptionsValue = value.dictLabel; this.nydlxOptionsVibile = false; }, @@ -2639,7 +2833,24 @@ export default { this.xdlzCirculationVisbile = false; this.landInfoList.sfylzyx = value; }, + //农房 -- 新建 上传图片方法 + nfAddimgonRead(file){ + var formData =new FormData();//构造一个 FormData,把后台需要发送的参数添加 +   formData.append('file', file.file);//接口需要传的参数 + commonUpload(formData).then((res)=>{ + this.houseInfoList.frontHouse = res.url; + }) + }, + //农地 -- 新建 上传图片方法 + ndAddimgonRead(file){ + var formData =new FormData();//构造一个 FormData,把后台需要发送的参数添加 +   formData.append('file', file.file);//接口需要传的参数 + commonUpload(formData).then((res)=>{ + this.landInfoList.frontland = res.url; + }) + }, }, + };