403 lines
8.7 KiB
Vue

<template>
<view class="addIssue">
<view class="fixedheader">
<headers :showBack="true" :themeType="true">
<view class="headerName">
风险点清单
</view>
</headers>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 44 + 'px'}">
<view class="content_main">
<view class="box-header">
<view @click.stop>
<view>
{{riskListPointInfo.riskPointName}}
</view>
</view>
</view>
<view class="box-item">
<view>风险描述:</view>
<view>
{{riskListPointInfo.riskSituationDescription ? riskListPointInfo.riskSituationDescription : '--'}}
</view>
</view>
<view class="box-item">
<view>具体责任区域:</view>
<view v-if="riskListPointInfo.specificResponsibilityAreaNames">
{{ riskListPointInfo.specificResponsibilityAreaNames }}
</view>
<view v-else class="color-error">
未设置具体责任区域
</view>
</view>
<view class="box-item">
<view>有效时间:</view>
<view v-if="riskListPointInfo.effectiveTimeBegin">{{ riskListPointInfo.effectiveTimeBegin }}
{{ riskListPointInfo.effectiveTimeEnd }}
</view>
<view v-else class="color-error">
未设置有效时间
</view>
</view>
<view class="box-item">
<view>区域/部位:</view>
<view>{{riskListPointInfo.areaLocation ? riskListPointInfo.areaLocation : '--'}}</view>
</view>
<view class="box-item">
<view>危险源数:</view>
<view @click="onNavigateToDetail(4)" class="color-49" v-if="riskListPointInfo.hazardSourceNumber">
{{riskListPointInfo.hazardSourceNumber}}
</view>
<view v-else class="color-49">
辨识危险源
</view>
</view>
<view class="box-item">
<view>活动频率:</view>
<view>{{riskListPointInfo.activityFrequency ? riskListPointInfo.activityFrequency : '--'}}</view>
</view>
<view class="box-item">
<view>关联业务:</view>
<view>{{riskListPointInfo.relatedBusiness ? riskListPointInfo.relatedBusiness : '--'}}</view>
</view>
<view class="box-item">
<view>识别人/识别时间:</view>
<view>{{riskListPointInfo.identifierName}}/{{riskListPointInfo.identificationTime}}</view>
</view>
</view>
<view class="confrim-bottom">
<view class="confrim-btn">
<view class="btn-primary" @click="copyBtn">复制</view>
<view @click="onNavigateToDetail(1)" class="btn-primary">关联业务</view>
<view @click="onNavigateToDetail(2)"
class="btn-primary">辨识危险源</view>
<view @click="onNavigateToDetail(3)" class="btn-primary">设置</view>
<view @click="onDelete">删除</view>
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
mobileTopHeight: 0,
projectDetail: {},
riskListPointId: "",
riskListPointInfo: {},
}
},
onLoad(opts) {
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'));
this.riskListPointId = opts.id;
},
onShow() {
this.getRiskListPointQueryByIdFn()
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo', res)
console.log(res)
}
})
},
methods: {
// 关联业务
onNavigateToDetail(type) {
if (type == 1) {
uni.navigateTo({
url: `./relatedBusiness?id=${this.riskListPointId}`
})
} else if (type == 2) {
uni.navigateTo({
url: `./sourceDangerIdentify?libraryId=${this.riskListPointInfo.riskListLibraryId}&id=${this.riskListPointId}`
})
} else if (type == 3) {
uni.navigateTo({
url: `./riskPointSet?id=${this.riskListPointId}`
})
} else if (type == 4) {
uni.navigateTo({
url: `./riskPointSourceDangerList?id=${this.riskListPointId}`
})
}
},
// 返回上一级
onNavigateBack() {
uni.navigateBack({
delta: 0
})
},
// 复制
copyBtn() {
let that = this;
let data = {
...this.riskListPointInfo,
createTime: this.$dayjs().format("YYYY-MM-DD HH:mm:ss")
};
this.sendRequest({
url: 'xmgl/riskListPoint/copy',
method: 'POST',
data: data,
success: res => {
if (res.code == 200) {
this.showToast('复制成功!', 'success');
setTimeout(()=> {
uni.$emit('updateData');
that.onNavigateBack();
}, 500)
}
}
})
},
// 删除
onDelete() {
let that = this;
let data = {
id: this.riskListPointInfo.id
};
uni.showModal({
title: '提示',
content: '确定删除该作业吗?',
success: function(res) {
if (res.confirm) {
that.sendRequest({
url: 'xmgl/riskListPoint/delete',
method: 'POST',
data: data,
success: res => {
if (res.code == 200) {
that.showToast('删除成功!', 'success');
setTimeout(()=> {
uni.$emit('updateData');
that.onNavigateBack();
}, 500)
}
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
showToast(title, type) {
this.$refs.uToast.show({
title: title,
type: type,
})
},
// 通过id查询管控清单信息
getRiskListPointQueryByIdFn() {
let that = this;
let data = {
projectSn: this.projectDetail.projectSn,
id: this.riskListPointId,
};
this.sendRequest({
url: 'xmgl/riskListPoint/queryById',
method: 'GET',
data: data,
success: res => {
if (res.code == 200) {
that.riskListPointInfo = res.result;
}
}
})
},
}
}
</script>
<style scoped lang="scss">
.content {
.content_main {
padding: 30rpx 28rpx;
background-color: white;
border-radius: 18rpx;
position: relative;
.box-bottom {
width: 100%;
padding: 0 26rpx;
height: 112rpx;
display: flex;
align-items: center;
background-color: #FFFFFF;
box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 0 0 18rpx 18rpx;
justify-content: flex-end;
position: absolute;
left: 0;
bottom: 0;
>view {
padding: 10rpx 18rpx;
border-radius: 6rpx;
border: 2rpx solid #3E89FD;
font-size: 28rpx;
color: #3E89FD;
}
>view:not(:first-child) {
margin-left: 20rpx;
}
.btn-error {
border-color: #ED2B29;
color: #ED2B29;
}
.btn-start {
background-color: #3E89FD;
border-color: #3E89FD;
color: #FFFFFF;
}
}
.box-content_detail {
font-size: 28rpx;
color: #4D4D4D;
margin-top: 4rpx;
}
.webkit-clamp_2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/* 限制为两行 */
overflow: hidden;
}
.box-content {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 26rpx;
font-size: 28rpx;
>view:first-child {
color: #808080;
}
>view:last-child {
font-size: 24rpx;
color: #4D8EEC;
}
}
.box-item {
display: flex;
align-items: center;
margin-top: 26rpx;
font-size: 28rpx;
>view:first-child {
width: 220rpx;
margin-right: 26rpx;
color: #808080;
}
>view:last-child {
flex: 1;
color: #4D4D4D;
word-break: break-all;
// display: -webkit-box;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 1;
// /* 限制为两行 */
// overflow: hidden;
}
.color-error {
color: #FF0000 !important;
}
.color-49 {
color: #498CEC !important;
}
}
}
.confrim-bottom {
width: 100%;
padding: 26rpx 26rpx;
background-color: #FFFFFF;
box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
justify-content: flex-end;
position: fixed;
bottom: 0;
z-index: 1;
>view:first-child {
display: flex;
align-items: center;
}
.confrim-btn {
display: flex;
>view {
padding: 10rpx 20rpx;
font-weight: 500;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
border: 2rpx solid #D9D9D9;
border-radius: 6rpx;
color: #808080;
}
.btn-error {
border: 2rpx solid #ED2B29;
color: #ED2B29;
}
.btn-primary {
background-color: #5181F6;
color: #FFFFFF;
}
>view:nth-child(n + 2) {
margin-left: 12rpx;
}
}
}
}
.addIssue {
min-height: 100vh;
background-color: #FFFFFF;
}
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
/deep/ .headerBox {
border-bottom: none;
}
.headerName {
z-index: 1;
}
}
</style>