From 8304d6bfb004c51119819affa58c6cdbfbf3fabe Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Wed, 31 Aug 2022 12:02:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=9C=B0=E5=AD=97=E6=AE=B5=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../raininspection/raininspection.vue | 369 ++++++++++-------- 1 file changed, 197 insertions(+), 172 deletions(-) diff --git a/raininspection/raininspection/raininspection.vue b/raininspection/raininspection/raininspection.vue index 8b1a150..6573819 100644 --- a/raininspection/raininspection/raininspection.vue +++ b/raininspection/raininspection/raininspection.vue @@ -25,11 +25,11 @@ - @@ -43,12 +43,12 @@ - - - - - - + + + + + + + + + + + + @@ -79,7 +85,7 @@ - + --> - - - + + + @@ -117,34 +123,35 @@ {{item.name}} - - + + - 重新获取 - - - - - 重新获取 - - - - - - - - - - - - + 重新获取 + + + + + + 重新获取 + + + + + + + + + + + + + - + @@ -167,7 +174,7 @@ 提交 - + @@ -182,8 +189,8 @@ roadName: "", instype: 1, typeShow: false, - askShow: false, - unusualShow:false, + askShow: false, + unusualShow: false, formshow: true, lawshow: false, showInfoId: false, @@ -192,8 +199,8 @@ buildtypeName: "", typeName: "日常雨水设施", askName: "", - lawName: "", - unusualName:"", + lawName: "", + unusualName: "", buildName: "", confirmText: "确认", dateparams: { @@ -208,50 +215,50 @@ buildTypes: [], buildList: [], lawTypes: [], - askContentList: [], - unusualList:[], + askContentList: [], + unusualList: [], statuss: [{ - id:1, + id: 1, name: "在建" }, { - id:2, + id: 2, name: "完工" }, ], rainTypes: [{ - id:1, + id: 1, name: "日常雨水设施" }, { - id:2, + id: 2, name: "在建工地" } ], scenes: [{ - id:0, + id: 0, name: "否" }, { - id:1, + id: 1, name: "是" } ], laws: [{ - id:0, + id: 0, name: "否" }, { - id:1, + id: 1, name: "是" } ], unusuals: [{ - id:0, + id: 0, name: "否" }, { - id:1, + id: 1, name: "是" } ] @@ -270,12 +277,12 @@ tip: "", address: "", longitude: "", - latitude: "", - start_address:"", - start_longitude: "", - start_latitude: "", - end_address: "", - end_longitude: "", + latitude: "", + start_address: "", + start_longitude: "", + start_latitude: "", + end_address: "", + end_longitude: "", end_latitude: "", files_list: [], files_end_list: [], @@ -286,13 +293,12 @@ status: "", remark: "", is_law: "", - break_id: "", - mobile_worksheet_id:"", - build_unit:"", - carry_unit:"" + break_id: "", + mobile_worksheet_id: "", + build_unit: "", + carry_unit: "" }, rules: { - }, apis: { store: [ @@ -311,7 +317,7 @@ onLoad(options) { var that = this; this.loadAskContent(); - this.loadLawTypes(); + this.loadLawTypes(); this.loadUnusualContent(); // this.loadBuild(); this.loadBuildType(); @@ -347,24 +353,23 @@ } if (loc) { that.form.latitude = JSON.parse(loc).lat; - that.form.longitude = JSON.parse(loc).lon; - that.form.start_latitude = JSON.parse(loc).lat; - that.form.start_longitude = JSON.parse(loc).lon; - that.form.end_latitude = JSON.parse(loc).lat; + that.form.longitude = JSON.parse(loc).lon; + that.form.start_latitude = JSON.parse(loc).lat; + that.form.start_longitude = JSON.parse(loc).lon; + that.form.end_latitude = JSON.parse(loc).lat; that.form.end_longitude = JSON.parse(loc).lon; } else { that.form.latitude = res.latitude; - that.form.longitude = res.longitude; - that.form.start_latitude = res.latitude; - that.form.start_longitude = res.longitude; - that.form.end_latitude = res.latitude; + that.form.longitude = res.longitude; + that.form.start_latitude = res.latitude; + that.form.start_longitude = res.longitude; + that.form.end_latitude = res.latitude; that.form.end_longitude = res.longitude; } - - - - let _latlog= that.gcoord.transformFromWGSToGCJ(that.form.latitude,that.form.longitude); - + + + + let _latlog = that.gcoord.transformFromWGSToGCJ(that.form.latitude, that.form.longitude); const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location=" + @@ -372,8 +377,8 @@ that.$jsonp( url ).then(re => { - that.form.address = re.result.formatted_addresses.recommend - that.form.start_address = re.result.formatted_addresses.recommend + that.form.address = re.result.formatted_addresses.recommend + that.form.start_address = re.result.formatted_addresses.recommend that.form.end_address = re.result.formatted_addresses.recommend }) } @@ -431,9 +436,11 @@ that.form.remark = buildinfo.remark that.form.latitude = buildinfo.latitude; that.form.longitude = buildinfo.longitude; - that.form.address = buildinfo.address; - that.form.build_unit = buildinfo.build_unit - that.form.carry_unit = buildinfo.carry_unit + that.form.address = buildinfo.address; + that.form.build_unit = buildinfo.build_unit + that.form.carry_unit = buildinfo.carry_unit + that.form.link_name = buildinfo.link_name + that.form.link_mobile = buildinfo.link_mobile for (var m of that.rainArr.buildTypes) { if (that.form.type == m.id) { that.buildtypeName = m.value @@ -446,11 +453,11 @@ var that = this that.askName = val[0].label that.form.ask_content_id = val[0].value - }, - confirmUnusualType(val) { - var that = this - that.unusualName = val[0].label - that.form.unusual_type_id = val[0].value + }, + confirmUnusualType(val) { + var that = this + that.unusualName = val[0].label + that.form.unusual_type_id = val[0].value }, confirmLawType(val) { console.log(val) @@ -476,27 +483,26 @@ that.form.is_law = 0 if (val[0].value == 2) { that.formshow = false - that.lawshow = false - that.form.start_address="" - that.form.start_longitude="" - that.form.start_latitude="" - that.form.end_address="" - that.form.end_longitude="" - that.form.end_latitude="" - that.form.ask_content_id="" - that.askName="" - } - if (val[0].value == 1) { - that.loadAskContent() + that.lawshow = false + that.form.start_address = "" + that.form.start_longitude = "" + that.form.start_latitude = "" + that.form.end_address = "" + that.form.end_longitude = "" + that.form.end_latitude = "" + that.form.ask_content_id = "" + that.askName = "" + } + if (val[0].value == 1) { + that.loadAskContent() } console.log("res", that.form) }, chooseLocation(e) { //打开地图选择位置 - var that = this; - - - let _latlog= that.gcoord.transformFromWGSToGCJ(that.form.latitude,that.form.longitude); - + var that = this; + + + let _latlog = that.gcoord.transformFromWGSToGCJ(that.form.latitude, that.form.longitude); uni.chooseLocation({ longitude: _latlog.longitude, latitude: _latlog.latitude, @@ -506,45 +512,45 @@ that.form.latitude = res.latitude; } }); - }, - unusualchange(val){ - console.log(val) - var that = this - if(val==1){ - that.form.start_address = ""; - that.form.start_longitude = ""; - that.form.start_latitude = ""; - that.form.end_address = ""; - that.form.end_longitude = ""; - that.form.end_latitude = ""; - } - }, - chooseStartLocation(e) { //打开地图选择位置 - var that = this; - let s_latlog= that.gcoord.transformFromWGSToGCJ(that.form.start_latitude,that.form.start_longitude); - uni.chooseLocation({ - longitude: s_latlog.longitude, - latitude: s_latlog.latitude, - success: res => { - that.form.start_address = res.name; - that.form.start_longitude = res.longitude; - that.form.start_latitude = res.latitude; - } - }); - }, - chooseEndLocation(e) { //打开地图选择位置 - var that = this; - let e_latlog= that.gcoord.transformFromWGSToGCJ(that.form.end_latitude,that.form.end_longitude); - - uni.chooseLocation({ - longitude: e_latlog.end_longitude, - latitude: e_latlog.end_latitude, - success: res => { - that.form.end_address = res.name; - that.form.end_longitude = res.longitude; - that.form.end_latitude = res.latitude; - } - }); + }, + unusualchange(val) { + console.log(val) + var that = this + if (val == 1) { + that.form.start_address = ""; + that.form.start_longitude = ""; + that.form.start_latitude = ""; + that.form.end_address = ""; + that.form.end_longitude = ""; + that.form.end_latitude = ""; + } + }, + chooseStartLocation(e) { //打开地图选择位置 + var that = this; + let s_latlog = that.gcoord.transformFromWGSToGCJ(that.form.start_latitude, that.form.start_longitude); + uni.chooseLocation({ + longitude: s_latlog.longitude, + latitude: s_latlog.latitude, + success: res => { + that.form.start_address = res.name; + that.form.start_longitude = res.longitude; + that.form.start_latitude = res.latitude; + } + }); + }, + chooseEndLocation(e) { //打开地图选择位置 + var that = this; + let e_latlog = that.gcoord.transformFromWGSToGCJ(that.form.end_latitude, that.form.end_longitude); + + uni.chooseLocation({ + longitude: e_latlog.end_longitude, + latitude: e_latlog.end_latitude, + success: res => { + that.form.end_address = res.name; + that.form.end_longitude = res.longitude; + that.form.end_latitude = res.latitude; + } + }); }, toremove(index, lists, name, whatfile) { if (whatfile == "filesList") { @@ -661,30 +667,30 @@ number: "equiementList" }, utilSuccess: function(result) { - that.rainArr.askContentList = result.detail - that.form.ask_content_id = that.rainArr.askContentList[0].id+"" + that.rainArr.askContentList = result.detail + that.form.ask_content_id = that.rainArr.askContentList[0].id + "" that.askName = that.rainArr.askContentList[0].value }, utilFail: function(res) { that.util.alert(res); } }); - }, - loadUnusualContent() { - var that = this; - that.util.request({ - api: '/api/admin/parameter/show', - method: "get", - data: { - number: "unusualList" - }, - utilSuccess: function(result) { - that.rainArr.unusualList = result.detail - }, - utilFail: function(res) { - that.util.alert(res); - } - }); + }, + loadUnusualContent() { + var that = this; + that.util.request({ + api: '/api/admin/parameter/show', + method: "get", + data: { + number: "unusualList" + }, + utilSuccess: function(result) { + that.rainArr.unusualList = result.detail + }, + utilFail: function(res) { + that.util.alert(res); + } + }); }, showInfo(id) { @@ -703,8 +709,9 @@ that.instype = 1 that.form = result.rain_equipment_info; that.form.rain_equipment_id = result.rain_equipment_id; - that.askName = result.rain_equipment_info.ask_content_detail.value - that.unusualName = result.rain_equipment_info.unusual_type_detail?result.rain_equipment_info.unusual_type_detail.value:"" + that.askName = result.rain_equipment_info.ask_content_detail.value + that.unusualName = result.rain_equipment_info.unusual_type_detail ? result + .rain_equipment_info.unusual_type_detail.value : "" that.roadName = result.rain_equipment_info.road ? result.rain_equipment_info .road.name : "" let _files = []; @@ -736,8 +743,8 @@ that.form.building_site_content_id = result.building_site_content_id; that.buildName = result.building_site_info.building_site.name that.form.building_site_id = result.building_site_info.building_site.id - that.form.name = result.building_site_info.building_site.name - that.form.build_unit = result.building_site_info.building_site.build_unit + that.form.name = result.building_site_info.building_site.name + that.form.build_unit = result.building_site_info.building_site.build_unit that.form.carry_unit = result.building_site_info.building_site.carry_unit that.form.number = result.building_site_info.building_site.number that.form.type = result.building_site_info.building_site.type @@ -805,9 +812,27 @@ } } that.form.files_list = list; - that.form.files_end_list = deallist; + that.form.files_end_list = deallist; + if(that.instype==2){ + if(that.form.link_mobile!=""){ + let res = /^1[3456789]\d{9}$/ + if(!res.test(that.form.link_mobile)){ + this.$refs.uToast.show({ + title: '请填写正确的11位手机号' + }) + return + } + } + if(that.form.name==""||that.form.build_unit==""||that.form.carry_unit==""||that.form.link_name==""||that.form.type==""||that.form.status==""){ + this.$refs.uToast.show({ + title: '请填写完整信息后提交' + }) + return + + } + } console.log(that.form) - // return + return let api = ""; if (this.infoId) { api = this.apis.save[this.instype] @@ -882,4 +907,4 @@ color: #fff; padding: 20rpx 30rpx; } - +