From 427bc8c917da1d230e7888977094bd8e585fec89 Mon Sep 17 00:00:00 2001 From: limingtao <@ming_tao_li> Date: Wed, 31 Jul 2024 14:30:59 +0800 Subject: [PATCH] 1 --- pages/index/index.vue | 4 +- pages/investigation/index.vue | 6 +- pages/investigation/task.vue | 378 +++++++++++++++++++++++++--------- 3 files changed, 283 insertions(+), 105 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 2a2ca19..ece0606 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -182,11 +182,11 @@ if (row.pcType == 2) { this.$.open("/pages/investigation/task" + "?id=" + row.businessId+ '§ionId=' + row.sectionCode + '&operator=' + row.operator + '&deptId=' + row.handleDept + '&taskName=' + row.name + - '&pcType' + row.pcType+'§ionName='+row.sectionName); + '&pcType' + row.pcType+'§ionName='+row.sectionName+'§ionCode='+row.sectionCode); } else { this.$.open('/pages/map/index?businessId=' + row.businessId + '§ionId=' + row.sectionCode + '&operator=' + row.operator + '&deptId=' + row.handleDept + '&taskName=' + row.name + - '&pcType' + row.pcType+'§ionName='+row.sectionName) + '&pcType' + row.pcType+'§ionName='+row.sectionName+'§ionCode='+row.sectionCode) } }, konw() { diff --git a/pages/investigation/index.vue b/pages/investigation/index.vue index 74803bf..9d93bda 100644 --- a/pages/investigation/index.vue +++ b/pages/investigation/index.vue @@ -207,13 +207,13 @@ if (row.pcType == 2) { this.$.open("/pages/investigation/task" + "?id=" + row.businessId+ '§ionId=' + row.sectionCode + '&operator=' + row.operator + '&deptId=' + row.handleDept + '&taskName=' + row.name + - '&pcType' + row.pcType+'§ionName='+row.sectionName); + '&pcType' + row.pcType+'§ionName='+row.sectionName+'§ionCode='+row.sectionCode); } else { this.$.open('/pages/map/index?businessId=' + row.businessId + '&operator=' + row.operator + '&deptId=' + row.handleDept + '&pcType=' + row.pcType + - '&type=' + (this.tab == 1 ? 'edit' : 'view')+'§ionName='+row.sectionName) + '&type=' + (this.tab == 1 ? 'edit' : 'view')+'§ionName='+row.sectionName+'§ionCode='+row.sectionCode) // this.$.open('/pages/map/index?businessId=' + row.businessId) } @@ -222,7 +222,7 @@ // 'view')) this.$.open("/pages/investigation/complete" + "?id=" + row.businessId+ '§ionId=' + row.sectionCode + '&operator=' + row.operator + '&deptId=' + row.handleDept + '&taskName=' + row.name + - '&pcType' + row.pcType+'§ionName='+row.sectionName); + '&pcType' + row.pcType+'§ionName='+row.sectionName+'§ionCode='+row.sectionCode); } }, diff --git a/pages/investigation/task.vue b/pages/investigation/task.vue index b9abf10..fab22a8 100644 --- a/pages/investigation/task.vue +++ b/pages/investigation/task.vue @@ -49,7 +49,7 @@ {{ formData.xqname?formData.xqname:'请选择所属辖区' }} + @click="showxqPicker=true">{{ formData.xqname?formData.xqname:'请选择所属辖区' }} {{ formData.xqname }} @@ -57,7 +57,7 @@ {{ formData.jdname?formData.jdname:'请选择所属街道' }} + @click="showjdPicker=true">{{ formData.jdname?formData.jdname:'请选择所属街道' }} {{ formData.jdname }} @@ -65,10 +65,13 @@ {{sectionName}} + - + + {{ formData.roadType?formData.roadType:'请选择道路类型' }} {{ formData.roadType }} @@ -134,8 +137,12 @@ --> - + + + + - { - console.log(res); - const coord = wgs84LL2gcjLL2(res.longitude, res.latitude); - this.longitude = coord[0]; //118.787575; - this.latitude = coord[1]; //32.05024; - // this.longitude = 120.38771; - // this.latitude = 36.110146; - - }, - }); + uni.getLocation({ + type: "wgs84", + success: (res) => { + console.log(res); + const coord = wgs84LL2gcjLL2(res.longitude, res.latitude); + this.longitude = coord[0]; //118.787575; + this.latitude = coord[1]; //32.05024; + // this.longitude = 120.38771; + // this.latitude = 36.110146; + + }, + }); }, getSystemInfo() { - // #ifdef APP-PLUS - // 在 App 端执行的代码 - // 获取系统信息 - uni.getSystemInfo({ - success: function (res) { - // 判断运行环境是否为 App - // if (res.platform === 'android' || res.platform === 'ios') { - // 在 App 端执行获取定位信息的逻辑 - uni.getLocation({ - success: function (locationRes) { - console.log('已获取定位信息', locationRes); - // 在这里处理定位成功的逻辑 - }, - fail: function (error) { - console.error('获取定位信息失败', error); - if (error.errMsg.indexOf('auth deny') !== -1) { - // 用户拒绝授权定位权限,可以引导用户打开权限设置页面 - uni.showModal({ - title: '提示', - content: '请授权使用您的定位服务', - confirmText: '去授权', - success: function (modalRes) { - if (modalRes.confirm) { - uni.openSetting({ - success: (settingRes) => { - console.log('openSetting success', settingRes.authSetting); - // 在这里可以处理打开设置页面后的逻辑 - this.getLocationInfo(); - }, - fail: (settingError) => { - console.log('openSetting fail', settingError); - // 打开设置页面失败的处理逻辑 - } - }); - } - } - }); - } - } - }); - // } else { - // console.log('当前不在 App 环境中'); - // // 在非 App 环境中的处理逻辑 - // } - } - }); - // #endif + // #ifdef APP-PLUS + // 在 App 端执行的代码 + // 获取系统信息 + uni.getSystemInfo({ + success: function(res) { + // 判断运行环境是否为 App + // if (res.platform === 'android' || res.platform === 'ios') { + // 在 App 端执行获取定位信息的逻辑 + uni.getLocation({ + success: function(locationRes) { + console.log('已获取定位信息', locationRes); + // 在这里处理定位成功的逻辑 + }, + fail: function(error) { + console.error('获取定位信息失败', error); + if (error.errMsg.indexOf('auth deny') !== -1) { + // 用户拒绝授权定位权限,可以引导用户打开权限设置页面 + uni.showModal({ + title: '提示', + content: '请授权使用您的定位服务', + confirmText: '去授权', + success: function(modalRes) { + if (modalRes.confirm) { + uni.openSetting({ + success: (settingRes) => { + console.log( + 'openSetting success', + settingRes + .authSetting + ); + // 在这里可以处理打开设置页面后的逻辑 + this + .getLocationInfo(); + }, + fail: (settingError) => { + console.log( + 'openSetting fail', + settingError + ); + // 打开设置页面失败的处理逻辑 + } + }); + } + } + }); + } + } + }); + // } else { + // console.log('当前不在 App 环境中'); + // // 在非 App 环境中的处理逻辑 + // } + } + }); + // #endif }, showInvestigationTag(v) { console.log(v) @@ -881,18 +938,36 @@ } }, - pickerCancel(e) { - this.showPicker = false + pickerxqCancel(e) { + this.showxqPicker = false }, - pickerConfirm(e) { - console.log(e.value) - this.showPicker = false - this.formData.jdcode = e.value[0].jdcode + pickerxqConfirm(e) { + this.showxqPicker = false + this.formData.jdcode = null this.formData.xqcode = e.value[0].xqcode - this.$set(this.formData, 'jdname', e.value[0].jdname) + this.$set(this.formData, 'jdname', null) this.$set(this.formData, 'xqname', e.value[0].xqname) + this.getStreetCommunityByXq() }, + pickerjdCancel(e) { + this.showjdPicker = false + }, + pickerjdConfirm(e) { + this.showjdPicker = false + this.formData.jdcode = e.value[0].jdcode + // this.formData.xqcode = e.value[0].xqcode + this.$set(this.formData, 'jdname', e.value[0].jdname) + // this.$set(this.formData, 'xqname', e.value[0].xqname) + + }, + pickerdlConfirm(e){ + this.showdlPicker = false + this.$set(this.formData, 'roadType', e.value[0].label) + }, + pickerdlCancel(e) { + this.showdlPicker = false + }, openPicker() { this.showPicker = true @@ -1078,15 +1153,108 @@ ) .then((res) => { if (res.code === 200) { - console.log(res) let arr = res.result for (let item of arr) { - item.label = item.xqname + '-' + item.jdname + item.label = item.xqname } - this.columnsPicker = [arr] + // 使用 reduce 方法根据 xqcode 去重 + const uniqueByXqcode = res.result.reduce((acc, current) => { + // 检查累加器(acc)中是否已经有当前元素的 xqcode + const existing = acc.find(item => item.xqcode === current.xqcode); + if (!existing) { + // 如果没有,将当前元素添加到累加器中 + acc.push(current); + } + // 无论是否添加,都返回累加器供下一次迭代使用 + return acc; + }, []); + this.columnsxqPicker = [uniqueByXqcode] } }); }, + getStreetCommunityByXq() { + if (!this.formData.xqcode) { + return false + } + this.$request + .globalRequest( + "/hiddenDanger/config/getStreetCommunityByXq", { + xqcode: this.formData.xqcode + }, + "GET" + ) + .then((res) => { + if (res.code === 200) { + console.log(res.result) + // console.log(res) + let arr = res.result + for (let item of arr) { + item.label = item.jdname + } + this.columnsjdPicker = [arr] + } + }); + }, + getRoadTypes() { + + this.$request + .globalRequest( + "/hiddenDanger/highDanger/getRoadTypes", { + + }, + "GET" + ) + .then((res) => { + if (res.code === 200) { + console.log(res.result) + // console.log(res) + let arr = res.result + for (let item of arr) { + item.label = item.enumName + } + this.columnsdlPicker = [arr] + } + }); + }, + + getBaseDefaultData() { + this.$request + .globalRequest( + "/hiddenDanger/config/getDangerBaseData", { + nuserid: this.$.getData("token"), + sectionCode: this.sectionCode + }, + "GET" + ) + .then((res) => { + if (res.code === 200) { + // console.log(res,11111) + if (!this.formData.roadType) { + this.$set(this.formData, 'roadType', res.result.sectionType) + } + if (!this.formData.roadWidth) { + this.$set(this.formData, 'roadWidth', res.result.width) + } + if (!this.formData.laneCount) { + this.$set(this.formData, 'laneCount', res.result.laneNum) + } + if (!this.formData.limitSpeed) { + this.$set(this.formData, 'limitSpeed', res.result.speed) + } + + // for (let k in res.result) { + // if (res.result[k] == 0) { + // res.result[k] = "" + // } + // } + // this.formData = { + // ...this.formData, + // ...res.result + // }; + } + }); + }, + // "/hiddenDanger/highDanger/getSectionInfo", getBaseData(businessId) { this.$request .globalRequest( @@ -1107,6 +1275,8 @@ ...this.formData, ...res.result }; + this.getStreetCommunityByXq() + this.getBaseDefaultData() } }); this.$request @@ -1380,7 +1550,9 @@ getChartsData() { //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 let res = { - categories: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], + categories: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "14", "16", + "17", "18", "19", "20", "21", "22", "23", "24" + ], series: [{ name: "总量", legendShape: "line", @@ -1403,8 +1575,14 @@ getChartsData2() { //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 let res = { - categories: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], - series: [], + categories: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "14", "16", + "17", "18", "19", "20", "21", "22", "23", "24" + ], + series: [{ + name: "总量", + legendShape: "line", + data: [], + }], }; this.chartData2 = JSON.parse(JSON.stringify(res)); }, @@ -1474,9 +1652,9 @@ }, bottomButtonTwo() { console.log(this.type) - if(!this.type) { + if (!this.type) { if (!this.formData.roadType) { - return this.$.toast("请输入道路类型"); + return this.$.toast("请输入道路类型"); } if (!this.formData.roadWidth) { return this.$.toast("请输入道路宽度"); @@ -1491,7 +1669,7 @@ return this.$.toast("请输入限速"); } } - + this.isEdit = false; this.active = 2; }, @@ -1744,8 +1922,8 @@ }).exec(); // 执行查询 }, onLongPressZD(item) { - if(this.nidZD == item.nid){ - if(this.lockZD){ + if (this.nidZD == item.nid) { + if (this.lockZD) { this.lockZD = false this.nidZD = '' } else { @@ -1771,8 +1949,8 @@ this.nidZD = '' }, onLongPressYH(item) { - if(this.nidYH == item.nid){ - if(this.lockYH){ + if (this.nidYH == item.nid) { + if (this.lockYH) { this.lockYH = false this.nidYH = '' } else {