zhgdyunapp/pages/projectEnd/safeManage/riskPoint/sourceDangerIdentify.vue
2025-08-26 18:09:17 +08:00

868 lines
18 KiB
Vue

<template>
<view class="addIssue">
<view class="fixedheader">
<headers :showBack="true" :themeType="true">
<view class="headerName">
辨识危险源
</view>
</headers>
</view>
<view class="search-box" :style="{paddingTop: mobileTopHeight + 44 + 'px'}">
<view class="uni-form-item">
<u-search class="uni-input" placeholder="请输入" :show-action="false" @change="loadData"
v-model="searchName"></u-search>
</view>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 100 + 'px'}">
<view class="content_main" v-if="selectWorkerInfoList.length > 0">
<view class="main3_box" v-for="item in selectWorkerInfoList" :key="item.id">
<view class="box-header">
<view @click.stop>
<u-checkbox-group>
<u-checkbox shape="circle" v-model="item.checked" :name="item.id"></u-checkbox>
</u-checkbox-group>
<view>
{{item.fullPath}}
</view>
</view>
<!-- <view :class="{'wks_active': item.status == 1, 'sgz_active': item.status == 2,'ztz_active': item.status == 3,'ywg_acitve': item.status == 4}">
{{statusUp(item.status)}}
</view> -->
</view>
<view class="box-item">
<view>分部分项工程/作业任务:</view>
<view>{{fullPathCutOut(item.fullPath, 4)}}</view>
</view>
<view class="box-item">
<view>作业活动名称及内容:</view>
<view>{{fullPathCutOut(item.fullPath, 2)}}</view>
</view>
<view class="box-item">
<view>风险描述:</view>
<view>{{item.riskDescription}}</view>
</view>
<view class="box-item">
<view>风险等级:</view>
<view class="riskcolor riskcolor_table" :class="{
riskcolor1: item.riskLevel == 1,
riskcolor2: item.riskLevel == 2,
riskcolor3: item.riskLevel == 3,
riskcolor4: item.riskLevel == 4,
}">{{riskLevelUp(item.riskLevel)}}</view>
</view>
<view class="box-item">
<view>潜在事故类型:</view>
<view>{{ accidentTypeUp(item.accidentTypeId)}}</view>
</view>
</view>
</view>
<view class="new-nodata" v-else>
<view></view>
<text>暂无数据...</text>
</view>
<view class="confrim-bottom">
<view class="">
<u-checkbox-group @change="checkedAll">
<u-checkbox shape="circle" v-model="checked">全选</u-checkbox>
</u-checkbox-group>
</view>
<view class="confrim-btn">
<view @click="onNavigateBack">取消</view>
<view class="btn-primary" @click="onSubmit">保存</view>
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
mobileTopHeight: 0,
projectDetail: {},
pageNo: 1,
pageSize: 10,
selectWorkerInfoList: [],
isLoadMore: false,
loadStatus: 'more',
activeName: "",
searchName: "",
libraryId: "",
checked: false,
riskLevelList: [{
id: 1,
name: "重大风险",
},
{
id: 2,
name: "较大风险",
},
{
id: 3,
name: "一般风险",
},
{
id: 4,
name: "低风险",
},
],
accidentTypeList: [],
}
},
onLoad(opts) {
console.log(112233, opts)
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
this.libraryId = opts.libraryId;
this.pointId = opts.id,
this.getDicProjectTypeList();
this.getSelectWorkerInfoList();
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo', res)
console.log(res)
}
})
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getSelectWorkerInfoList()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.selectWorkerInfoList = []
this.getSelectWorkerInfoList()
},
methods: {
onSubmit() {
let that = this;
const resultList = this.selectWorkerInfoList.filter(item => item.checked);
if (resultList.length == 0) {
this.showToast('请先勾选数据!', 'warning');
return
}
let data = {
projectSn: this.projectDetail.projectSn,
pointId: this.pointId,
detailIds: resultList.map(item => item.id).join(',')
};
this.sendRequest({
url: 'xmgl/riskListSource/identifySource',
method: 'POST',
data: data,
success: res => {
if (res.code == 200) {
that.showToast('保存成功!', 'success');
that.onNavigateBack();
}
}
})
},
// 取消
onNavigateBack() {
uni.navigateBack({
delta: 1
})
},
// 全选
checkedAll(e) {
this.selectWorkerInfoList.forEach(item => {
item.checked = this.checked;
})
},
loadData() {
this.pageNo = 1
this.selectWorkerInfoList = []
this.getSelectWorkerInfoList()
console.log(this.searchName)
},
getSelectWorkerInfoList() {
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
projectSn: this.projectDetail.projectSn,
containLibraryId: this.libraryId,
fullPath: this.searchName,
}
this.sendRequest({
url: 'xmgl/riskListDetail/page',
method: 'GET',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
const resultList = res.result.records.map(item => {
return {
...item,
checked: false,
expandMoreShow: false,
}
})
this.selectWorkerInfoList = this.selectWorkerInfoList.concat(resultList)
if (res.result.records.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
showToast(title, type) {
this.$refs.uToast.show({
title: title,
type: type,
})
},
// 获取字典工程类别列表
getDicProjectTypeList() {
let that = this;
let data = {
projectSn: this.projectDetail.projectSn,
};
this.sendRequest({
url: 'xmgl/riskListPotentialAccidentType/list',
method: 'GET',
data: data,
success: res => {
if (res.code == 200) {
this.accidentTypeList = res.result.sort(
(a, b) => Date.parse(a.createTime) - Date.parse(b.createTime)
);
}
}
})
},
// 截取指定/字符串
fullPathCutOut(strName, startIndex) {
const parts = strName.split('/');
if (startIndex < 1 || startIndex >= parts.length) return ''; // n 无效或超出范围
return parts.slice(startIndex).join('/'); // 拼接第 n 部分之后的内容
}
},
computed: {
riskLevelUp() {
return (riskLevel) => {
const find = this.riskLevelList.find((item) => riskLevel === item.id);
return find ? find.name : "--";
};
},
accidentTypeUp() {
return (accidentTypeId) => {
const find = this.accidentTypeList.find((item) => accidentTypeId === item.id);
return find ? find.type : "--";
};
},
}
}
</script>
<style scoped lang="scss">
.content {
.content_main {
margin-top: 26rpx;
// background-color: white;
padding-bottom: 138rpx;
min-height: calc(100vh - 130rpx - 138rpx - 26rpx);
>.main3_box:not(:first-child) {
margin-top: 20rpx;
}
.pb_140 {
padding-bottom: 140rpx !important;
}
.main3_box {
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;
}
}
.box-header {
display: flex;
align-items: center;
justify-content: space-between;
>view:first-child {
display: flex;
align-items: center;
>view:last-child {
font-weight: 800;
font-size: 30rpx;
color: #171717;
}
}
// >view:last-child {
// padding: 4rpx 36rpx 4rpx 20rpx;
// border-radius: 4rpx;
// // border: 2rpx solid #F1F1F1;
// font-weight: 500;
// font-size: 22rpx;
// position: relative;
// }
.wks_active {
color: #898989;
}
.wks_active::before {
content: '';
background-color: #898989;
width: 16rpx;
height: 16rpx;
border-radius: 50%;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
.sgz_active {
color: #498CEC;
}
.sgz_active::before {
content: '';
width: 16rpx;
height: 16rpx;
background: #498CEC;
border-radius: 50%;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
.ztz_active {
color: #C38100;
}
.ztz_active::before {
content: '';
width: 16rpx;
height: 16rpx;
background: #C38100;
border-radius: 50%;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
.ywg_acitve {
color: #88CF65;
}
.ywg_acitve::before {
content: '';
width: 16rpx;
height: 16rpx;
background: #88CF65;
border-radius: 50%;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
}
}
}
.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: space-between;
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;
}
}
}
}
.riskcolor {
color: white !important;
padding: 8rpx 12rpx;
// width: 128rpx;
flex: inherit !important;
text-align: center;
}
.riskcolor_table {
padding: 2rpx 12rpx;
display: inline-block;
}
.riskcolor1 {
background-color: #eb4047;
}
.riskcolor2 {
background-color: #ffbf00;
}
.riskcolor3 {
background-color: #ffff00;
}
.riskcolor4 {
background-color: #006fbf;
}
.icon-left,
.icon-right {
width: 32rpx;
height: 32rpx;
background-image: url('@/static/staffAttendance/attendance-icon1.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.icon-right {
transform: rotate(90deg);
}
.icon-top {
transform: rotate(-90deg);
}
.new-nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
>view {
width: 300rpx;
height: 300rpx;
background-image: url('@/static/staffAttendance/nodata.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
>text {
font-size: 22rpx;
color: #808080;
margin-top: 60rpx;
}
}
/deep/ .van-cell,
.item-cell {
padding: 22rpx 26rpx;
}
/deep/ .van-cell__title,
.item-cell_title {
font-weight: 500;
font-size: 30rpx;
color: #1A1A1A;
}
/deep/ .van-collapse-item__content,
/deep/ .uni-collapse-item__wrap-content {
background-color: #F2F3F7;
padding: 26rpx;
}
.content-main {
padding: 26rpx;
}
.content-box1 {
// height: 554rpx;
// margin-top: 26rpx;
position: relative;
padding-bottom: 120rpx !important;
.content-btn {
width: 100%;
padding: 18rpx 26rpx;
background: #FFFFFF;
box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(0, 0, 0, 0.05);
position: absolute;
bottom: 0;
left: 0;
display: flex;
justify-content: flex-end;
>view {
// width: 216rpx;
background: #5181F6;
border-radius: 6rpx;
padding: 18rpx 24rpx;
font-size: 28rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
}
.content-row {
display: flex;
align-items: flex-start;
padding: 20rpx 0;
// border-bottom: 2rpx solid #F2F2F2;
font-size: 28rpx;
>view:first-child {
width: 162rpx;
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;
}
}
.attachment {
flex-direction: column;
align-items: flex-start;
>view:not(:first-child) {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 32rpx;
width: 100%;
>view:first-child {
display: flex;
align-items: center;
width: 70%;
>image {
width: 40rpx;
height: 40rpx
}
>view {
font-size: 28rpx;
color: #171717;
margin-left: 32rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
>view:last-child {
font-size: 24rpx;
color: #808080;
}
}
}
}
.content-box {
width: 698rpx;
padding: 26rpx;
background: #FFFFFF;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(3, 92, 181, 0.1), 0rpx 8rpx 40rpx 0rpx rgba(0, 0, 0, 0.05);
// border-radius: 16rpx;
.content-header {
display: flex;
align-items: center;
justify-content: space-between;
.header-title {
font-weight: 500;
font-size: 30rpx;
color: #1A1A1A;
}
>view:last-child {
font-size: 22rpx;
color: #4D4D4D;
background-color: #FFFF00;
padding: 4rpx 14rpx;
}
}
}
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
/deep/ .headerBox {
border-bottom: none;
}
.headerName {
z-index: 1;
}
}
.addIssue {
min-height: 100vh;
background-color: #EFF3F7;
}
/deep/ .uni-collapse-item__title-arrow {
display: none;
}
.flex-center {
display: flex;
align-items: center;
justify-content: space-between;
}
.icon-screen {
display: flex;
flex-direction: column;
margin-left: 22rpx;
>view:nth-child(1) {
border-bottom: 12rpx solid #333333;
border-right: 10rpx solid transparent;
border-left: 10rpx solid transparent;
}
>view:nth-child(2) {
border-top: 12rpx solid #333333;
border-right: 10rpx solid transparent;
border-left: 10rpx solid transparent;
margin-top: 4rpx;
}
.icon-screen_active {
border-bottom-color: #108BC7 !important;
border-top-color: #108BC7 !important;
}
}
.search-box {
background-color: white;
width: 100%;
position: fixed;
z-index: 99;
.uni-form-item {
padding: 20rpx 26rpx;
position: relative;
display: flex;
.uni-input {
border: 2rpx solid #E4E4E4;
border-radius: 68rpx;
padding: 0;
font-size: 30rpx;
color: #444444;
/deep/ .u-content {
background-color: #FFFFFF !important;
.u-input {
background-color: #FFFFFF !important;
color: #999999 !important;
}
}
}
.search-btn {
width: 72rpx;
height: 72rpx;
background: #498CEC;
border-radius: 48rpx;
margin-left: 30rpx;
display: flex;
align-items: center;
justify-content: center;
>image {
width: 50rpx;
height: 50rpx;
}
}
}
/deep/ .u-dropdown {
padding-right: 60rpx;
}
.calendar_box {
position: absolute;
right: 28rpx;
bottom: 20rpx;
.calendar {
width: 32rpx;
height: 32rpx;
background-image: url('@/static/workTicketManage/calendar.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.calendar_active {
background-image: url('@/static/workTicketManage/calendar-active.png');
}
}
}
</style>