qa-prevention-gwj-first-app/pages/basics/risk-distribution/risk-distribution-detail.vue

282 lines
7.2 KiB
Vue
Raw Normal View History

2023-11-07 09:43:46 +08:00
<template>
<view>
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">风险分布-详情</block>
</cu-custom>
<scroll-view scroll-y>
<view class="dy-card">
<view class="dy-card-title">
<text>{{pd.RISKUNITNAME}}</text>
<text>{{pd.PARTSNAME}}</text>
</view>
<view class="dy-card-content">
<view class="dy-card-content-item">
<view class="title">
<text class="l"></text>
<text>存在风险</text>
</view>
<view class="content" v-for="(item,index) in varList" >{{index+1}}. {{item.RISK_DESCR}}</view>
</view>
<view class="dy-card-content-item">
<view class="title">
<text class="l"></text>
<text>主要管控措施</text>
</view>
<view class="content" v-for="(item,index) in varList">{{index+1}}. {{item.MEASURES}}
</view>
</view>
<view class="dy-card-content-item">
<view class="title">
<text class="l"></text>
<text>管控部门</text>
</view>
<view class="name">
<text>{{DEPT_NAME}}</text>
</view>
</view>
<view class="dy-card-content-item">
<view class="title">
<text class="l"></text>
<text>事故类型</text>
</view>
<view class="name">
<text>{{ACCIDENTS_NAME}}</text>
</view>
</view>
</view>
<view class="dy-card-foot">
<!-- <text class="cu-tag radius bg-yellow light">{{pd.DNAME5}}</text> -->
<text v-if="LEVELID=='levelA'"class="bg-red light cu-tag radius"></text>
<text v-else-if="LEVELID=='levelB'"class="bg-orange light cu-tag radius">较大风险</text>
<text v-else-if="LEVELID=='levelC'"class="bg-yellow light cu-tag radius">一般风险</text>
<text v-else-if="LEVELID=='levelD'"class="bg-blue light cu-tag radius">低风险</text>
</view>
<view class="cu-form-group">
<view class="title">地点坐标</view>
<button class="cu-btn bg-green shadow" @tap="showMapModal"></button>
</view>
<view class="cu-form-group" v-if="form.WORK_LONGITUDE">
<view class="title">经度</view>
<view>{{form.WORK_LONGITUDE}}</view>
</view>
<view class="cu-form-group" v-if="form.WORK_LATITUDE">
<view class="titletitle">纬度</view>
<view >{{form.WORK_LATITUDE}}</view>
</view>
</view>
<view class="cu-tabbar-height"></view>
</scroll-view>
<view class="bottom-fixed" @click="$noMultipleClicks(editLocation)">
<button class="cu-btn bg-green" >提交位置</button>
</view>
</view>
</template>
<script>
import {
basePath,corpinfoId
} from '@/common/tool.js';
import gcoord from '@/common/gcoord.js'
export default {
data() {
return {
IDENTIFICATION_ID : '',
varList:[],
pd:[],
longitude : '',
noClick:true,
latitude :'',
LEVELID:'',
DEPT_NAME:'',
ACCIDENTS_NAME:"",
form: {
WORK_LONGITUDE: '',
WORK_LATITUDE: '',
},
}
},
onLoad(e){
var _this = this;
_this.IDENTIFICATION_ID=e.id;
_this.LEVELID=e.LEVELID;
_this.DEPT_NAME=e.DEPT_NAME;
_this.getData();
uni.getLocation({
type: 'wgs84 ',
success: function (res) {
_this.longitude = res.longitude;
_this.latitude = res.latitude;
},
cancel: function (res) {
uni.showToast({
icon: 'none',
title: '用户拒绝授权获取地理位置',
duration: 1500
});
}
});
},
methods: {
//跳转事件
goToEdit(e) {
uni.navigateTo({
url: '/pages/application/basic-info-manage/basic-information/basic-information-edit'
});
},
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/riskpoint/getForIdentification',
method: 'POST',
dataType: 'json',
header:{
'Content-type':'application/x-www-form-urlencoded'
},
data: {
CHECK_IDENTIFICATION_ID: _this.IDENTIFICATION_ID,
},
success: (res) => {
if (res.data != null) {
uni.hideLoading();
_this.varList = res.data.varList;
_this.pd = res.data.varList[0];
_this.form.WORK_LONGITUDE = res.data.varList[0].LONGITUDE_VALUE;
_this.form.WORK_LATITUDE = res.data.varList[0].LATITUDE_VALUE;
let nameArray=[];
for (let i = 0; i < _this.varList.length; i++) {
let ACCIDENTS_NAME=_this.varList[i].ACCIDENTS_NAME
let names=ACCIDENTS_NAME.split(",")
for(let j = 0; j < names.length; j++) {
nameArray.distinctPush(names[j])
}
}
_this.ACCIDENTS_NAME=nameArray.join(",")
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
},
editLocation (){
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + "/app/riskpoint/editLonAndLat", //提交接口
method: 'POST',
dataType: 'json',
header:{
'Content-type':'application/x-www-form-urlencoded'
},
data: {
LONGITUDE: _this.form.WORK_LONGITUDE,
LATITUDE: _this.form.WORK_LATITUDE,
IDENTIFICATIONPARTS_ID: _this.IDENTIFICATION_ID,
},
success: (res) => {
uni.hideLoading();
if ("success" == res.data.result) {
uni.showToast({
icon: 'none',
title: '提交成功',
duration: 1500
});
setTimeout(function(){
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上一个页面
prePage.$vm.initflag = true; // A 页面 init方法 为true
uni.navigateBack({});
uni.hideLoading();
},1500);
}else{
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
},
/** 坐标定位 */
showMapModal() {
var _this = this
uni.navigateTo({
2023-12-11 17:15:23 +08:00
url: '/pages/map/mapPro',
2023-11-07 09:43:46 +08:00
events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
acceptDataFromOpenedPage: function (e) {
// console.log(e.data)
// console.info(e.data.longitue)
_this.form.WORK_LONGITUDE = e.data.longitue;
_this.form.WORK_LATITUDE = e.data.latitude;
// console.info(_this.pd)
}
},
})
},
}
}
</script>
<style>
.dy-card{
background-color: #fff;
border-radius: 10upx;
margin:30upx
}
.dy-card-title{
display: flex;
justify-content: space-between;
border-bottom: 1px solid #eee;
min-height: 80upx;
line-height: 80upx;
padding: 0 30upx;
}
.dy-card-content{
padding: 0upx 30upx 30upx;
}
.dy-card-content-item{
margin-top: 20upx;
}
.dy-card-content-item .title{
display: flex;
align-items: center;
}
.dy-card-content-item .title .l{
width: 10upx;
height: 30upx;
border-radius: 20upx;
background-color: #666;
margin-right: 10upx;
}
.dy-card-content-item .content{
background-color: #F1F1F1;
padding: 10upx 14upx;
margin-top: 14upx;
line-height: 1.6;
}
.dy-card-content-item .name text{
background-color: #F1F1F1;
padding: 10upx 14upx;
margin-top: 14upx;
line-height: 1.6;
display: inline-block;
}
.dy-card-foot{
border-top: 1px solid #eee;
padding: 30upx;
}
</style>