| | |
| | | </template> |
| | | </TitleBox> |
| | | </div> |
| | | <div class="mt--30" @click="toEquipmentInfo"> |
| | | <div class="mt--30" @click="toEquipmentInfo" v-if="permissionProject.includes('3')"> |
| | | <TitleBox> |
| | | <template #title> 设备信息 </template> |
| | | <template #content> |
| | |
| | | </template> |
| | | </TitleBox> |
| | | </div> |
| | | <div class="mt--30"> |
| | | <div class="mt--30" v-if="permissionProject.includes('1')"> |
| | | <TitleBox> |
| | | <template #title>各分项隐患趋势 </template> |
| | | <template #right> |
| | |
| | | </div> |
| | | <!-- 中间内容 --> |
| | | <div class="mid-card"> |
| | | <div @click="toHiddenDanger(1)" class="mid-info"> |
| | | <div @click="toHiddenDanger(1)" class="mid-info" v-if="permissionProject.includes('2')"> |
| | | <div class="flex a--center"> |
| | | <div @click.stop="toHiddenDanger(2)" class="mid-title">隐患数量</div> |
| | | <div class="flex a--center tab-border"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div @click="toPlanOfAudit" class="mid-more">查看报告</div> |
| | | <div v-if="permissionProject.includes('4')" @click="toPlanOfAudit" class="mid-more">查看报告</div> |
| | | </div> |
| | | <!-- 右边 --> |
| | | <div class="right-card"> |
| | | <div class="mt--16"> |
| | | <div class="mt--16" v-if="permissionProject.includes('5')"> |
| | | <TitleBox> |
| | | <template #title>人员在岗率 </template> |
| | | <template #right> |
| | |
| | | </template> |
| | | </TitleBox> |
| | | </div> |
| | | <div class="mt--30"> |
| | | <div class="mt--30" v-if="permissionProject.includes('6')"> |
| | | <TitleBox> |
| | | <template #title>重大风险源 </template> |
| | | <template #right> |
| | |
| | | </template> |
| | | </TitleBox> |
| | | </div> |
| | | <div class="mt--30"> |
| | | <div class="mt--30" v-if="permissionProject.includes('7')"> |
| | | <TitleBox> |
| | | <template #title>项目风险趋势 </template> |
| | | <template #right> |
| | |
| | | projectId: '', |
| | | projectName: '', |
| | | // 项目详情信息 |
| | | projectInfo: {},//项目信息 |
| | | dangerCount: {},//危险源统计 |
| | | projectInfo: { |
| | | addressInfo: {}, |
| | | address: '', |
| | | constructionCompanyInfo: {}, |
| | | developmentCompanyInfo: {}, |
| | | supervisorCompanyInfo: {}, |
| | | properties: [] |
| | | },//项目信息 |
| | | dangerCount: { |
| | | serious: 0, |
| | | rectified: 0, |
| | | unRectified: 0 |
| | | },//危险源统计 |
| | | deviceTypeList: [],//设备类型列表 |
| | | equipment: 0,//设备数量 |
| | | peopleList: [],//人员列表 |
| | |
| | | dangerSortType: 1, // 排序类型:1-隐患数量,2-趋势 |
| | | dangerSortDesc: true, // 是否倒序 |
| | | // 风险源数据 |
| | | riskSourceData: [ |
| | | { riskScale: '一般', content: '项目风险源内容1', status: '未开始' }, |
| | | { riskScale: '一般', content: '项目风险源内容2', status: '进行中' }, |
| | | { riskScale: '一般', content: '项目风险源内容3', status: '已完成' }, |
| | | { riskScale: '重大', content: '项目风险源内容4', status: '未开始' }, |
| | | { riskScale: '重大', content: '项目风险源内容5', status: '进行中' }, |
| | | ], |
| | | riskSourceData: [], |
| | | // 项目风险趋势数据 |
| | | riskTrendData: { |
| | | xAxisData: [], |
| | | seriesData: [] |
| | | } |
| | | }, |
| | | // 9各分项隐患趋势 10隐患数量 11设备数量 12查看报告入口 13人员在岗率 14重大风险源 15 项目风险趋势 |
| | | permissionProject: JSON.parse(localStorage.getItem("permissionProject")) || [], |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | }); |
| | | if (this.$route.query.projectId) { |
| | | this.projectId = this.$route.query.projectId || '' |
| | | // 添加错误处理,确保登录信息获取失败不影响其他模块 |
| | | getLoginInfo({ id: this.projectId, type: 2 }).then(res => { |
| | | console.log('res', res) |
| | | this.projectName = res.name |
| | | const permissions = res.permissionProject ? res.permissionProject.split(",") : [] |
| | | this.permissionProject =['1','2','3','4','5','6','7']|| permissions |
| | | localStorage.setItem( "permissionProject", JSON.stringify(permissions)); |
| | | localStorage.setItem('commentType', res.commentType) |
| | | }).catch(err => { |
| | | console.error('获取登录信息失败:', err) |
| | | // 设置默认值,确保页面可以继续渲染 |
| | | this.projectName = '项目详情' |
| | | this.permissionProject = [] |
| | | }) |
| | | this.getDetail() |
| | | this.getDangerTrendList() |
| | |
| | | methods: { |
| | | // 获取项目详情 |
| | | getDetail() { |
| | | // 设备类型 |
| | | // 设备类型 - 添加错误处理 |
| | | deviceTypes().then(res => { |
| | | this.deviceTypeList = res |
| | | }).catch(err => { |
| | | console.error('获取设备类型失败:', err) |
| | | this.deviceTypeList = [] |
| | | }) |
| | | // 获取项目详情 |
| | | |
| | | // 获取项目详情 - 添加错误处理 |
| | | getProjectDetail(this.projectId).then(res => { |
| | | const addressInfo = res.addressInfo ? JSON.parse(res.addressInfo) : {} |
| | | const constructionCompanyInfo = res.constructionCompanyInfo ? JSON.parse(res.constructionCompanyInfo) : {} |
| | | const developmentCompanyInfo = res.developmentCompanyInfo ? JSON.parse(res.developmentCompanyInfo) : {} |
| | | const supervisorCompanyInfo = res.supervisorCompanyInfo ? JSON.parse(res.supervisorCompanyInfo) : {} |
| | | |
| | | this.projectInfo = { |
| | | ...res, |
| | | addressInfo: JSON.parse(res.addressInfo), |
| | | address: JSON.parse(res.addressInfo).province + JSON.parse(res.addressInfo).city + JSON.parse(res.addressInfo).district + JSON.parse(res.addressInfo).detail, |
| | | constructionCompanyInfo: JSON.parse(res.constructionCompanyInfo), |
| | | developmentCompanyInfo: JSON.parse(res.developmentCompanyInfo), |
| | | supervisorCompanyInfo: JSON.parse(res.supervisorCompanyInfo), |
| | | addressInfo: addressInfo, |
| | | address: (addressInfo.province || '') + (addressInfo.city || '') + (addressInfo.district || '') + (addressInfo.detail || ''), |
| | | constructionCompanyInfo: constructionCompanyInfo, |
| | | developmentCompanyInfo: developmentCompanyInfo, |
| | | supervisorCompanyInfo: supervisorCompanyInfo, |
| | | } |
| | | console.log('projectInfo projectInfo', this.projectInfo) |
| | | }).catch(err => { |
| | | console.error('获取项目详情失败:', err) |
| | | // 设置默认值 |
| | | this.projectInfo = { |
| | | addressInfo: {}, |
| | | address: '', |
| | | constructionCompanyInfo: {}, |
| | | developmentCompanyInfo: {}, |
| | | supervisorCompanyInfo: {}, |
| | | properties: [] |
| | | } |
| | | }) |
| | | // 设备数量 |
| | | |
| | | // 设备数量 - 添加错误处理 |
| | | getProjectDeviceCount(this.projectId).then(res => { |
| | | this.equipment = 0 |
| | | this.legendData = res.map(item => { |
| | | this.equipment += item.count |
| | | const deviceType = this.deviceTypeList[item.type] |
| | | return { |
| | | ...item, |
| | | value: item.count || 0, |
| | | name: this.deviceTypeList[item.type].name, |
| | | name: deviceType && deviceType.name ? deviceType.name : '未知设备', |
| | | itemStyle: { color: this.generateRandomColor() } |
| | | } |
| | | }) |
| | | this.initPie3D() |
| | | }).catch(err => { |
| | | console.error('获取设备数量失败:', err) |
| | | this.equipment = 0 |
| | | this.legendData = [] |
| | | }) |
| | | // 隐患数量 |
| | | |
| | | // 隐患数量 - 添加错误处理 |
| | | getDangerCount(this.projectId).then(res => { |
| | | this.dangerCount = res |
| | | console.log('getDangerCount getDangerCount', res) |
| | | }).catch(err => { |
| | | console.error('获取隐患数量失败:', err) |
| | | this.dangerCount = { |
| | | serious: 0, |
| | | rectified: 0, |
| | | unRectified: 0 |
| | | } |
| | | }) |
| | | // 项目人员信息 |
| | | |
| | | // 项目人员信息 - 添加错误处理 |
| | | getProjectPersonInfo({ projectId: this.projectId }).then(res => { |
| | | this.peopleList = res |
| | | this.peopleList = res || [] |
| | | }).catch(err => { |
| | | console.error('获取人员信息失败:', err) |
| | | this.peopleList = [] |
| | | }) |
| | | // 获取项目风险源 |
| | | |
| | | // 获取项目风险源 - 添加错误处理 |
| | | getProjectSource({ projectId: this.projectId }).then(res => { |
| | | const riskSourceList = [] |
| | | |
| | |
| | | } |
| | | |
| | | this.riskSourceData = riskSourceList |
| | | }).catch(err => { |
| | | console.error('获取项目风险源失败:', err) |
| | | this.riskSourceData = [] |
| | | }) |
| | | }, |
| | | // 获取隐患趋势 |
| | |
| | | } |
| | | getDangerTrend(params).then(res => { |
| | | this.dangerTrendList = res || [] |
| | | }).catch(err => { |
| | | console.error('获取隐患趋势失败:', err) |
| | | this.dangerTrendList = [] |
| | | }) |
| | | }, |
| | | // 切换隐患排序方式 |
| | |
| | | this.updateRiskChart(); |
| | | } |
| | | } catch (error) { |
| | | console.error('获取项目风险趋势失败:', error); |
| | | console.error('获取项目风险趋势失败:', error) |
| | | // 设置默认值,确保图表可以正常显示 |
| | | this.riskTrendData.xAxisData = [] |
| | | this.riskTrendData.seriesData = [] |
| | | } |
| | | }, |
| | | // 更新风险趋势图表 |
| | | updateRiskChart() { |
| | | const riskChart = echarts.getInstanceByDom(document.getElementById('riskTrendChart')); |
| | | const chartDom = document.getElementById('riskTrendChart'); |
| | | if (!chartDom) { |
| | | console.warn('风险趋势图表DOM不存在,可能是权限限制导致该模块未渲染'); |
| | | return; |
| | | } |
| | | const riskChart = echarts.getInstanceByDom(chartDom); |
| | | if (!riskChart) { |
| | | console.warn('风险趋势图表实例不存在'); |
| | | return; |
| | | } |
| | | |
| | |
| | | }, |
| | | // 初始化折线图 |
| | | initRiskChart() { |
| | | const riskChart = echarts.init(document.getElementById('riskTrendChart')) |
| | | const chartDom = document.getElementById('riskTrendChart'); |
| | | if (!chartDom) { |
| | | console.warn('风险趋势图表DOM不存在,可能是权限限制导致该模块未渲染'); |
| | | return; |
| | | } |
| | | const riskChart = echarts.init(chartDom) |
| | | |
| | | // 文本换行处理函数 |
| | | const formatLabel = (text, maxWidth = 4) => { |