This commit is contained in:
yunkexin 2025-10-28 11:17:06 +08:00
parent b63792e74c
commit 658191f0e2
2 changed files with 93 additions and 31 deletions

View File

@ -20,7 +20,7 @@
<u-button type="primary" text="查询" @click="filterData"></u-button> <u-button type="primary" text="查询" @click="filterData"></u-button>
</u--form> </u--form>
<u--form labelWidth="auto" :model="model" ref="wForm" class="demo-ruleForm" style="margin-top: 20px;"> <u--form labelWidth="auto" :model="model" ref="wForm" class="demo-ruleForm" style="margin-top: 20px;" v-if="filterDatas&&filterDatas.Nav_Librarys&&filterDatas.Nav_Librarys.length>0">
<view style="position: relative;"> <view style="position: relative;">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view> <view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view> </view>
@ -36,7 +36,7 @@
</u-checkbox> </u-checkbox>
<u-form-item label="辨识区域" prop="Nav_Contents.CHECKCONTENT" borderBottom> <u-form-item label="辨识区域" prop="Nav_Contents.CHECKCONTENT" borderBottom>
<u--input fontSize="14px" disabled disabledColor="#fff" v-model="item.AREA_NAME" border="none" inputAlign="right"></u--input> <u--input fontSize="14px" disabled disabledColor="#fff" v-model="(item.Nav_Area||{}).NAME" border="none" inputAlign="right"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="风险名称" prop="HIDDEN_PLACE" borderBottom> <u-form-item label="风险名称" prop="HIDDEN_PLACE" borderBottom>
@ -46,7 +46,7 @@
</u-form-item> </u-form-item>
<u--textarea fontSize="14px" disabled disabledColor="#fff" v-model="item.RISK_DESCRIPTION" border="none" inputAlign="right" autoHeight></u--textarea> <u--textarea fontSize="14px" disabled disabledColor="#fff" v-model="item.RISK_DESCRIPTION" border="none" inputAlign="right" autoHeight></u--textarea>
<u-form-item label="风险类别" prop="HIDDEN_PLACE" borderBottom> <u-form-item label="风险类别" prop="HIDDEN_PLACE" borderBottom>
<u--input fontSize="14px" disabled disabledColor="#fff" v-model="item.TYPE_NAME" border="none" inputAlign="right"></u--input> <u--input fontSize="14px" disabled disabledColor="#fff" v-model="(item.Nav_Type||{}).NAME" border="none" inputAlign="right"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="风险等级" prop="HIDDEN_PLACE" borderBottom> <u-form-item label="风险等级" prop="HIDDEN_PLACE" borderBottom>
<u--input fontSize="14px" disabled disabledColor="#fff" v-model="item.EVALUATE_LEVELName" border="none" inputAlign="right"></u--input> <u--input fontSize="14px" disabled disabledColor="#fff" v-model="item.EVALUATE_LEVELName" border="none" inputAlign="right"></u--input>
@ -58,7 +58,7 @@
</u--form> </u--form>
</view> </view>
<view style="padding: 10px 16px;" class="bottom-button"> <view style="padding: 10px 16px;" class="bottom-button" v-if="filterDatas&&filterDatas.Nav_Librarys&&filterDatas.Nav_Librarys.length>0">
<u-button type="primary" @click="submit" color="#3d4b70">生产岗位告知卡</u-button> <u-button type="primary" @click="submit" color="#3d4b70">生产岗位告知卡</u-button>
</view> </view>
<query-selector :show="selectorInfo.showPopup" :defaultChecked="selectorInfo.defaultChecked" :title="selectorInfo.title" :lists="selectorInfo.dataLists" @search="handleSearch" @select="handleSelected" <query-selector :show="selectorInfo.showPopup" :defaultChecked="selectorInfo.defaultChecked" :title="selectorInfo.title" :lists="selectorInfo.dataLists" @search="handleSearch" @select="handleSelected"
@ -142,7 +142,7 @@
onLoad(option) { onLoad(option) {
this.OrgId = option.OrgId // 'B043B28B-BBC3-C452-6052-4FBA1457ABFA' this.OrgId = option.OrgId // 'B043B28B-BBC3-C452-6052-4FBA1457ABFA'
// const orgId = uni.getStorageSync('orgId') // const orgId = uni.getStorageSync('orgId')
this.fetchEnums(['SKEvaluateLevelEnum']); this.fetchEnums(['SKEvaluateLevelEnum','SKProductionUnit']);
}, },
// onReady() { // onReady() {
// //setRules // //setRules
@ -198,6 +198,10 @@
if (item.Nav_Librarys && item.Nav_Librarys.length > 0) { if (item.Nav_Librarys && item.Nav_Librarys.length > 0) {
item.Nav_Librarys.map(item1 => { item.Nav_Librarys.map(item1 => {
item1.EVALUATE_LEVELName = item1.EVALUATE_LEVEL !== undefined ? this.enumsData['SKEvaluateLevelEnum'].find(item => item.code === item1.EVALUATE_LEVEL).name : ''; item1.EVALUATE_LEVELName = item1.EVALUATE_LEVEL !== undefined ? this.enumsData['SKEvaluateLevelEnum'].find(item => item.code === item1.EVALUATE_LEVEL).name : '';
if(!item1.MINE_NAME){
item1.MINE_NAME = item1.MineType !== undefined ? this.enumsData['SKProductionUnit'].find(item => item.code === item1.MineType).name : '';
}
}) })
} }
}) })
@ -269,15 +273,6 @@
if (e.length === allIds.length && allIds.length > 0) { if (e.length === allIds.length && allIds.length > 0) {
this.checkedItems.unshift('all'); this.checkedItems.unshift('all');
} }
// const diff = this.checkedItems.filter(item => !e.includes(item));
// //
// this.checkedItems = e.filter(item => item !== 'all');
// //
// if (this.checkedItems.length === allIds.length && allIds.length > 0) {
// this.checkedItems.unshift('all');
// }
} }
} }
} }
@ -286,16 +281,10 @@
this.allData.map(item => { this.allData.map(item => {
if (item.DEPARTMENT_ID == this.model.DEPARTMENT_ID && item.POST_NAME == this.model.Nav_Post.NAME) { if (item.DEPARTMENT_ID == this.model.DEPARTMENT_ID && item.POST_NAME == this.model.Nav_Post.NAME) {
this.filterDatas = item this.filterDatas = item
console.log(this.filterDatas, 'this.filterData')
} }
}) })
}, },
checkChange(e) {
console.log(e, '888')
},
submit() { submit() {
console.log(this.checkedItems, '9999')
console.log(this.filterDatas, '9999')
let arr = [] let arr = []
this.filterDatas.Nav_Librarys.map(item => { this.filterDatas.Nav_Librarys.map(item => {
this.checkedItems.map(item1 => { this.checkedItems.map(item1 => {
@ -304,7 +293,6 @@
} }
}) })
}) })
console.log(arr, 'arr')
//MEASURES_NAME //MEASURES_NAME
const groupedData = arr.reduce((acc, item) => { const groupedData = arr.reduce((acc, item) => {
const riskName = item.RISK_NAME; const riskName = item.RISK_NAME;
@ -325,7 +313,22 @@
// //
// 1. RISK_NAME RISK_DESCRIPTION // 1. RISK_NAME RISK_DESCRIPTION
const allPhotos = [];
const photoNames = new Set(); // name
arr.forEach(item => {
// Nav_Photo
if (Array.isArray(item.Nav_Photo)) {
item.Nav_Photo.forEach(photo => {
// name
if (!photoNames.has(photo.name)) {
allPhotos.push(photo);
photoNames.add(photo.name);
}
});
}
});
// allPhotos Nav_Photo
let newarr = { let newarr = {
departName: this.filterDatas.Nav_Department ? this.filterDatas.Nav_Department.NAME : '', departName: this.filterDatas.Nav_Department ? this.filterDatas.Nav_Department.NAME : '',
userName: this.filterDatas.USER_NAME, userName: this.filterDatas.USER_NAME,
@ -357,13 +360,9 @@
}) })
.join(''), .join(''),
RISK_DESCRIPTION: this.handleData(arr,'RISK_DESCRIPTION'), RISK_DESCRIPTION: this.handleData(arr,'RISK_DESCRIPTION'),
EMERGENCY: this.handleData(arr,'EMERGENCY') EMERGENCY: this.handleData(arr,'EMERGENCY'),
Nav_Photo:allPhotos
} }
console.log(newarr, 'nnnnnnnnnnnnn')
uni.setStorageSync('detailData', newarr); uni.setStorageSync('detailData', newarr);
uni.navigateTo({ uni.navigateTo({
url: '/pages/apply/jobRiskShow' url: '/pages/apply/jobRiskShow'

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="todo-page"> <view class="todo-page" style="padding-bottom: 10px;">
<view class="background"></view> <view class="background"></view>
<view class="card"> <view class="card">
@ -21,8 +21,27 @@
<u-form-item label="风险描述" prop="HIDDEN_PLACE" borderBottom> <u-form-item label="风险描述" prop="HIDDEN_PLACE" borderBottom>
</u-form-item> </u-form-item>
<u--textarea fontSize="14px" disabled disabledColor="#fff" v-model="detailData.RISK_DESCRIPTION" border="none" inputAlign="right" autoHeight></u--textarea> <u--textarea fontSize="14px" disabled disabledColor="#fff" v-model="detailData.RISK_DESCRIPTION" border="none" inputAlign="right" autoHeight></u--textarea>
<u-form-item label="安全标志" prop="HIDDEN_PLACE" borderBottom> <u-form-item label="安全标志" prop="HIDDEN_PLACE" >
</u-form-item> </u-form-item>
<!-- 安全标志图片列表 -->
<view class="safety-sign-list">
<!-- 循环展示所有图片 -->
<view class="safety-sign-item" v-for="(photo, index) in detailData.Nav_Photo" :key="index">
<!-- 图片展示 -->
<image
:src="hosturl +photo.Nav_ImgFile.FILE_PATH"
mode="widthFix"
class="sign-image"
alt="安全标志图片"
></image>
<!-- 图片对应的名称 -->
<view class="sign-name">{{ photo.NAME }}</view>
</view>
<!-- 没有图片时的提示 -->
<view v-if="!detailData.Nav_Photo || detailData.Nav_Photo.length === 0" class="no-data">
暂无安全标志图片
</view>
</view>
<!-- <u--textarea fontSize="14px" disabled disabledColor="#fff" v-model="detailData.RISK_DESCRIPTION" border="none" inputAlign="right" autoHeight></u--textarea> --> <!-- <u--textarea fontSize="14px" disabled disabledColor="#fff" v-model="detailData.RISK_DESCRIPTION" border="none" inputAlign="right" autoHeight></u--textarea> -->
<u-form-item label="管控措施" prop="HIDDEN_PLACE" borderBottom> <u-form-item label="管控措施" prop="HIDDEN_PLACE" borderBottom>
</u-form-item> </u-form-item>
@ -65,12 +84,12 @@
data() { data() {
return { return {
detailData: {}, detailData: {},
model: {} model: {},
hosturl:config.uni_app_web_source_url
} }
}, },
onLoad(option) { onLoad(option) {
this.detailData = uni.getStorageSync('detailData'); this.detailData = uni.getStorageSync('detailData');
console.log(this.detailData, 'this.detailData')
}, },
onUnload() { onUnload() {
// //
@ -86,4 +105,48 @@
<style> <style>
@import url("../../style/css/newTemplate.css"); @import url("../../style/css/newTemplate.css");
.safety-sign-list {
padding: 0 16px;
/* margin-bottom: 5px; */
/* 启用 Flex 布局 */
display: flex;
/* 允许换行 */
flex-wrap: wrap;
/* 子元素之间的间距(可选,调整水平间距) */
gap: 10px;
}
.safety-sign-item {
/* 每个元素占 1/3 宽度(减去间距的容错) */
width: calc(33.33% - 10px);
margin-bottom: 15px;
text-align: center;
/* 避免内容溢出时压缩元素宽度 */
box-sizing: border-box;
}
/* 其他样式保持不变 */
.sign-image {
width: 100%; /* 图片自适应父元素宽度 */
max-width: 300px;
border-radius: 4px;
margin-bottom: 5px;
}
.sign-name {
font-size: 14px;
color: #333;
line-height: 1.5;
/* 文字超长时自动换行 */
word-wrap: break-word;
}
.no-data {
font-size: 14px;
color: #999;
padding: 10px 0;
text-align: center;
/* 占满整行 */
width: 100%;
}
</style> </style>