forked from xxhjsb/hbt-prevention-ui
feat:安全维护公告和首页
parent
c1fc3b3b9c
commit
9c140b1bd3
|
@ -3,7 +3,7 @@
|
|||
<!-- 安全状态 -->
|
||||
<div class="status">
|
||||
<div class="title">{{ noticeDataList.state.description }}</div>
|
||||
<el-form ref="basicForm" :model="basicForm" :rules="rules" label-width="80px" class="form">
|
||||
<el-form ref="basicForm" :model="basicForm" label-width="80px" class="form">
|
||||
<div v-for="(items, index) in noticeDataList.state.content" :key="index" class="line-content">
|
||||
<div class="content-items" v-if="!items.children" :style="{ width: items.width }">
|
||||
<span class="content-children-item-title">
|
||||
|
@ -13,8 +13,7 @@
|
|||
{{ basicForm[items.key] }}
|
||||
</span>
|
||||
<span class="isreadonly" v-if="isReadonly && items.type === 'radio'">
|
||||
{{ basicForm[items.key] === 1 ?
|
||||
'是' : '否' }}
|
||||
{{ radioTransformName(basicForm[items.key]) }}
|
||||
</span>
|
||||
<el-form-item v-if="!isReadonly && items.type === 'number'" :prop="items.key"
|
||||
:rules="{ required: items.required, message: `${items.name}不能为空`, trigger: 'blur' }">
|
||||
|
@ -47,7 +46,7 @@
|
|||
{{ basicForm[item.key] }}
|
||||
</span>
|
||||
<span class="isreadonly" v-if="isReadonly && item.type === 'radio'">
|
||||
{{ basicForm[item.key] === 1 ? '是' : '否' }}
|
||||
{{ radioTransformName(basicForm[item.key]) }}
|
||||
</span>
|
||||
<el-form-item v-if="!isReadonly && item.type === 'number'" :prop="item.key"
|
||||
:rules="{ required: item.required, message: `${item.name}不能为空`, trigger: 'blur' }">
|
||||
|
@ -84,7 +83,7 @@
|
|||
{{ judgmentForm[items.key] }}
|
||||
</span>
|
||||
<span class="isreadonly" v-if="isReadonly && items.type === 'radio'">
|
||||
{{ judgmentForm[items.key] === 1 ? '是' : '否' }}
|
||||
{{ radioTransformName(judgmentForm[items.key]) }}
|
||||
</span>
|
||||
<el-form-item :rules="{ required: items.required, message: `${items.name}不能为空`, trigger: 'blur' }">
|
||||
<!-- 数字框-number -->
|
||||
|
@ -114,7 +113,7 @@
|
|||
{{ judgmentForm[item.key] }}
|
||||
</span>
|
||||
<span class="isreadonly" v-if="isReadonly && item.type === 'radio'">
|
||||
{{ judgmentForm[item.key] === 1 ? '是' : '否' }}
|
||||
{{ radioTransformName(judgmentForm[item.key]) }}
|
||||
</span>
|
||||
<el-form-item
|
||||
:rules="{ required: item.required, message: `${items.name}不能为空`, trigger: 'blur' }">
|
||||
|
@ -177,7 +176,7 @@ export default class NoticeComponent extends Vue {
|
|||
handleData() {
|
||||
//处理数据
|
||||
this.basicForm = this.updateParams;
|
||||
this.judgmentForm = this.updateParams.researchContent ? JSON.parse(this.updateParams.researchContent) : {};
|
||||
this.judgmentForm = this.updateParams.researchContent ? JSON.parse(this.updateParams.researchContent) : this.formDefaultValues();
|
||||
}
|
||||
// 操作按钮
|
||||
@Prop({
|
||||
|
@ -196,24 +195,28 @@ export default class NoticeComponent extends Vue {
|
|||
@Prop()
|
||||
public isReadonly: boolean;
|
||||
|
||||
//定义规则
|
||||
public rules = {
|
||||
riskNumber: [
|
||||
{ required: true, message: '请输入活动名称', trigger: 'blur' },
|
||||
],
|
||||
measureFlag: [
|
||||
{ required: true, message: '请选择活动区域', trigger: 'change' }
|
||||
],
|
||||
basicwork: [
|
||||
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
|
||||
],
|
||||
};
|
||||
/**
|
||||
* 表单默认值
|
||||
*/
|
||||
public formDefaultValues() {
|
||||
let tmpJudementForm = {}
|
||||
this.noticeDataList.situation.content.forEach((item: any) => {
|
||||
item.children.forEach((children: any) => {
|
||||
if (children.defaultValue !== undefined || children.defaultValue !== null) {
|
||||
tmpJudementForm[children.key] = children.defaultValue
|
||||
}
|
||||
})
|
||||
})
|
||||
return tmpJudementForm
|
||||
}
|
||||
|
||||
created() {
|
||||
//
|
||||
}
|
||||
|
||||
//提交
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
public onSubmit() {
|
||||
(this.$refs.basicForm as any).validate((valid: any) => {
|
||||
if (valid) {
|
||||
|
@ -226,10 +229,22 @@ export default class NoticeComponent extends Vue {
|
|||
});
|
||||
}
|
||||
|
||||
//取消
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
public cancel() {
|
||||
this.actionCallback('cancel')
|
||||
}
|
||||
|
||||
/**
|
||||
* 单选 转换name显示
|
||||
* @param value 值
|
||||
*/
|
||||
public radioTransformName(value: any) {
|
||||
if (value === 1) return '是'
|
||||
if (value === 0) return '否'
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -294,6 +294,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -312,6 +313,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -330,6 +332,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -348,6 +351,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -372,6 +376,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -390,6 +395,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:0,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -408,6 +414,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -426,6 +433,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -444,6 +452,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -462,6 +471,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:0,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -486,6 +496,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -504,6 +515,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
@ -522,6 +534,7 @@ export default {
|
|||
required: false,
|
||||
width: "100%",
|
||||
labelWidth: "600px",
|
||||
defaultValue:1,
|
||||
datas: [
|
||||
{
|
||||
name: "是",
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import BaseService from "hbt-common/service/base.service"
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import { ActionResult } from "hbt-common/models/actionResult";
|
||||
export default class HomeService extends BaseService<any>{
|
||||
constructor(){
|
||||
super()
|
||||
}
|
||||
//安全承诺公告
|
||||
public getHomePromise(params: any):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/home/promise';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
//企业风险辨识
|
||||
public getHomeRisk(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/home/risk';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
|
||||
public getFileUrls(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.file+'/getSysFiles';
|
||||
return this.get(url,params,false)
|
||||
}
|
||||
}
|
|
@ -15,6 +15,11 @@ export default class SafetyNoticeService extends BaseService<any>{
|
|||
const url = this.prefix.prevention+'/safety/promise/task';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
//获取次级详细信息
|
||||
public selectTaskByDetail(params: any):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/safety/promise/task/promise/detail';
|
||||
return this.get(url,params,true)
|
||||
}
|
||||
// 批量删除
|
||||
public deleteByIds(params,showLoading?):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/safety/promise/task';
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
|
||||
<div class="home-box dis-flex flex-col">
|
||||
<div class="overview-box">
|
||||
<div class="inner-echarts-box custom-box dis-flex flex-col">
|
||||
<div class="title">安全承诺公告</div>
|
||||
<div class="static-box full dis-flex">
|
||||
<div class="static dis-flex">
|
||||
<span>进入受限空间作业 (处)</span>
|
||||
<span class="count">13</span>
|
||||
<span>进入受限空间作业 (处)</span>
|
||||
<span class="count">{{promiseData.confinedSpaceWork ? promiseData.confinedSpaceWork:0}}</span>
|
||||
</div>
|
||||
<div class="static dis-flex">
|
||||
<span>是否处于试生产</span>
|
||||
<span class="count icon yes">是</span>
|
||||
<span class="count icon yes" v-if="promiseData.trialFlag">是</span>
|
||||
<span class="count icon no" v-else>否</span>
|
||||
</div>
|
||||
<div class="static dis-flex">
|
||||
<span>开停车状态</span>
|
||||
<span class="count icon no">否</span></span>
|
||||
<span class="count icon yes" v-if="promiseData.parkFlag">是</span>
|
||||
<span class="count icon no" v-else>否</span>
|
||||
</div>
|
||||
<div class="static dis-flex">
|
||||
<span>罐装、仓库等重大危险源<br>是否处于安全状态</span>
|
||||
<span class="count icon yes">是</span>
|
||||
<span class="count icon yes" v-if="promiseData.safetyFlag">是</span>
|
||||
<span class="count icon no" v-else>否</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="charts-box">
|
||||
|
@ -29,14 +31,17 @@
|
|||
<div class="custom-box info-box">
|
||||
<div class="title">企业承诺</div>
|
||||
<div class="text">
|
||||
今天我公司已经过安全风险研判,各项安全风险防控措施已落实到位,我承诺所有运行的生产装置处于安全状态,69个重大危险源安全风险得到有效管控,已落实重大危险源安全包保责任
|
||||
{{promiseData.promise}}
|
||||
<!-- 今天我公司已经过安全风险研判,各项安全风险防控措施已落实到位,我承诺所有运行的生产装置处于安全状态,69个重大危险源安全风险得到有效管控,已落实重大危险源安全包保责任 -->
|
||||
</div>
|
||||
<div class="text-i">
|
||||
<img :src="promiseData.resourceUrl" style="width: auto;height: auto;max-width: 100%;max-height: 100%;" alt="">
|
||||
</div>
|
||||
<div class="text-r">吴延福</div>
|
||||
<div class="text-r">2023-05-29 15:03:22</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-box echarts-box dis-flex flex-col">
|
||||
<div class="title">企业风险辨识</div>
|
||||
<hbt-echarts class="echarts" :options="buildBarOption()" @onChartInit="getChart($event,true)"></hbt-echarts>
|
||||
</div>
|
||||
<hbt-echarts class="echarts" :options="buildBarOption()" @onChartInit="getChart($event,true)"></hbt-echarts>
|
||||
</div>
|
||||
</div>
|
|
@ -98,6 +98,10 @@
|
|||
margin-top: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
.text-i{
|
||||
width: 80px;
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
.echarts-box{
|
||||
|
|
|
@ -1,96 +1,154 @@
|
|||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import template from "./home.component.html"
|
||||
import template from "./home.component.html";
|
||||
import HomeService from '@/service/home.service'
|
||||
|
||||
@Component({
|
||||
template,
|
||||
components:{
|
||||
components: {
|
||||
},
|
||||
})
|
||||
export default class HomeComponent extends Vue {
|
||||
public tableService = new HomeService();
|
||||
// 数据直接定义
|
||||
// 所有可用
|
||||
public datas = [
|
||||
////////////////////////////////////////
|
||||
[
|
||||
{ name: '运行', value: 11 },
|
||||
{ name: '停产', value: 13 },
|
||||
{ name: '检修', value: 8 },
|
||||
],
|
||||
// ////////////////////////////////////////
|
||||
[
|
||||
{ name: '特殊', value: 13 },
|
||||
{ name: '一级', value: 11 },
|
||||
{ name: '二级', value: 8 },
|
||||
]];
|
||||
////////////////////////////////////////
|
||||
[
|
||||
{ name: '运行', value: 0, key: "equipmentRunNum" },
|
||||
{ name: '停产', value: 0, key: "equipmentStopNum" },
|
||||
{ name: '检修', value: 0, key: "equipmentOverhaulNum" },
|
||||
],
|
||||
// ////////////////////////////////////////
|
||||
[
|
||||
{ name: '特殊', value: 0, key: "specialHotWork" },
|
||||
{ name: '一级', value: 0, key: "twoHotWork" },
|
||||
{ name: '二级', value: 0, key: "oneHotWork" },
|
||||
]];
|
||||
// 饼图
|
||||
public pieChart:any;
|
||||
public pieChart: any;
|
||||
// 柱图
|
||||
public barChart:any
|
||||
public barChart: any;
|
||||
//安全承诺公告
|
||||
public promiseData = {} as any;
|
||||
//企业风险辨识
|
||||
public riskData = {
|
||||
deptName: [],
|
||||
low: [],
|
||||
general: [],
|
||||
greater: [],
|
||||
significant: []
|
||||
} as any;
|
||||
|
||||
|
||||
created() {
|
||||
//安全承诺数据
|
||||
this.getPromiseDataMethod();
|
||||
//获取风险数据
|
||||
this.getRiskDataMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取风险数据
|
||||
*/
|
||||
public getRiskDataMethod() {
|
||||
this.tableService.getHomeRisk({}).then((res: any) => {
|
||||
res.data.forEach((item: any) => {
|
||||
this.riskData.deptName.push(item.deptName);
|
||||
this.riskData.low.push(item.low);
|
||||
this.riskData.general.push(item.general);
|
||||
this.riskData.greater.push(item.greater);
|
||||
this.riskData.significant.push(item.significant);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 获取安全承诺数据
|
||||
*/
|
||||
public getPromiseDataMethod() {
|
||||
this.tableService.getHomePromise({}).then((res: any) => {
|
||||
console.log('res', res);
|
||||
|
||||
if (res.data.resourceId) {
|
||||
this.tableService.getFileUrls({ ids: res.data.resourceId }).then((files: any) => {
|
||||
this.promiseData = res.data;
|
||||
this.promiseData.resourceUrl = files.data[0]['url'];
|
||||
});
|
||||
} else {
|
||||
this.promiseData = res.data;
|
||||
}
|
||||
this.datas[0].forEach((item: any) => {
|
||||
item.value = this.promiseData[item.key] ? this.promiseData[item.key] : 0;
|
||||
});
|
||||
this.datas[1].forEach((item: any) => {
|
||||
item.value = this.promiseData[item.key] ? this.promiseData[item.key] : 0;
|
||||
});
|
||||
});
|
||||
}
|
||||
// 组件渲染完成
|
||||
mounted(){
|
||||
window.addEventListener("resize",this.resize)
|
||||
mounted() {
|
||||
window.addEventListener("resize", this.resize)
|
||||
}
|
||||
beforeDestory(){
|
||||
window.removeEventListener("resize",this.resize)
|
||||
beforeDestory() {
|
||||
window.removeEventListener("resize", this.resize)
|
||||
}
|
||||
|
||||
public buildPieOption(){
|
||||
public buildPieOption() {
|
||||
return {
|
||||
title:[{
|
||||
show:true,
|
||||
text:this.datas[0].reduce((total,cur)=>{
|
||||
return total+cur.value
|
||||
},0),
|
||||
textAlign:"center",
|
||||
textStyle:{
|
||||
fontSize:24
|
||||
title: [{
|
||||
show: true,
|
||||
text: this.datas[0].reduce((total, cur) => {
|
||||
return total + cur.value
|
||||
}, 0),
|
||||
textAlign: "center",
|
||||
textStyle: {
|
||||
fontSize: 24
|
||||
},
|
||||
subtextStyle:{
|
||||
fontSize:14
|
||||
subtextStyle: {
|
||||
fontSize: 14
|
||||
},
|
||||
subtext:"生产装备(套)",
|
||||
left:"20%",
|
||||
top:"40%"
|
||||
},{
|
||||
show:true,
|
||||
text:this.datas[1].reduce((total,cur)=>{
|
||||
return total+cur.value
|
||||
},0),
|
||||
textAlign:"center",
|
||||
subtext:"动火作业(处)",
|
||||
textStyle:{
|
||||
fontSize:24
|
||||
subtext: "生产装备(套)",
|
||||
left: "20%",
|
||||
top: "40%"
|
||||
}, {
|
||||
show: true,
|
||||
text: this.datas[1].reduce((total, cur) => {
|
||||
return total + cur.value
|
||||
}, 0),
|
||||
textAlign: "center",
|
||||
subtext: "动火作业(处)",
|
||||
textStyle: {
|
||||
fontSize: 24
|
||||
},
|
||||
subtextStyle:{
|
||||
fontSize:14
|
||||
subtextStyle: {
|
||||
fontSize: 14
|
||||
},
|
||||
left:"70%",
|
||||
top:"40%"
|
||||
left: "70%",
|
||||
top: "40%"
|
||||
}],
|
||||
color:["#409EFF","#BFCBD9","#E6A23C","#A67AFF","#409EFF","#F56C6C"],
|
||||
legend:[{
|
||||
right:"53%",
|
||||
itemWidth:14,
|
||||
top:"center",
|
||||
data:this.datas[0],
|
||||
orient:"vertical"
|
||||
},{
|
||||
right:"0%",
|
||||
top:"center",
|
||||
itemWidth:14,
|
||||
data:this.datas[1],
|
||||
orient:"vertical"
|
||||
color: ["#409EFF", "#BFCBD9", "#E6A23C", "#A67AFF", "#409EFF", "#F56C6C"],
|
||||
legend: [{
|
||||
right: "53%",
|
||||
itemWidth: 14,
|
||||
top: "center",
|
||||
data: this.datas[0],
|
||||
orient: "vertical"
|
||||
}, {
|
||||
right: "0%",
|
||||
top: "center",
|
||||
itemWidth: 14,
|
||||
data: this.datas[1],
|
||||
orient: "vertical"
|
||||
}],
|
||||
series:this.datas.map((data,idx)=>{
|
||||
series: this.datas.map((data, idx) => {
|
||||
const left = idx * (100 / this.datas.length);
|
||||
return {
|
||||
type: 'pie',
|
||||
radius: ["45%", "60%"],
|
||||
center:["40%","50%"],
|
||||
center: ["40%", "50%"],
|
||||
top: 'center',
|
||||
height: '100%',
|
||||
left: left+'%',
|
||||
left: left + '%',
|
||||
width: "50%",
|
||||
itemStyle: {
|
||||
borderColor: '#fff',
|
||||
|
@ -112,29 +170,29 @@ export default class HomeComponent extends Vue {
|
|||
}
|
||||
}
|
||||
|
||||
public buildBarOption(){
|
||||
public buildBarOption() {
|
||||
return {
|
||||
tooltip:{
|
||||
tooltip: {
|
||||
|
||||
},
|
||||
color:["#68C23A","#409EFF","#E6A23C","#F56C6C"],
|
||||
grid:{
|
||||
left:24,
|
||||
right:24,
|
||||
bottom:24,
|
||||
containLabel:true
|
||||
color: ["#116FF5", "#FFC019", "#FF7802", "#E31C21"],
|
||||
grid: {
|
||||
left: 24,
|
||||
right: 24,
|
||||
bottom: 24,
|
||||
containLabel: true
|
||||
},
|
||||
legend:{
|
||||
top:25,
|
||||
left:"center",
|
||||
legend: {
|
||||
top: 25,
|
||||
left: "center",
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name:"单位:个",
|
||||
splitLine:{
|
||||
lineStyle:{
|
||||
type:"dashed"
|
||||
name: "单位:个",
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: "dashed"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,52 +201,52 @@ export default class HomeComponent extends Vue {
|
|||
{
|
||||
type: 'category',
|
||||
axisTick: { show: false },
|
||||
data: ['部门1', '部门2', '部门3', '部门4', '部门5']
|
||||
data: this.riskData.deptName,
|
||||
}
|
||||
],
|
||||
series:[{
|
||||
name:"低风险",
|
||||
series: [{
|
||||
name: "低风险",
|
||||
type: 'bar',
|
||||
barWidth:40,
|
||||
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100))
|
||||
},{
|
||||
name:"一般风险",
|
||||
barWidth: 12,
|
||||
data: this.riskData.low,
|
||||
}, {
|
||||
name: "一般风险",
|
||||
type: 'bar',
|
||||
barWidth:40,
|
||||
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100))
|
||||
},{
|
||||
name:"较高风险",
|
||||
barWidth: 12,
|
||||
data: this.riskData.general,
|
||||
}, {
|
||||
name: "较大风险",
|
||||
type: 'bar',
|
||||
barWidth:40,
|
||||
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100))
|
||||
},{
|
||||
name:"高风险",
|
||||
barWidth: 12,
|
||||
data: this.riskData.greater,
|
||||
}, {
|
||||
name: "重大风险",
|
||||
type: 'bar',
|
||||
barWidth:40,
|
||||
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100))
|
||||
barWidth: 12,
|
||||
data: this.riskData.significant,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
public getChart(charts,isBar?){
|
||||
if(!isBar){
|
||||
public getChart(charts, isBar?) {
|
||||
if (!isBar) {
|
||||
this.pieChart = charts
|
||||
}else{
|
||||
} else {
|
||||
this.barChart = charts
|
||||
}
|
||||
}
|
||||
public resize(){
|
||||
if(this.pieChart){
|
||||
public resize() {
|
||||
if (this.pieChart) {
|
||||
this.pieChart.resize()
|
||||
}
|
||||
if(this.barChart){
|
||||
if (this.barChart) {
|
||||
this.barChart.resize()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 计算属性 === computed
|
||||
get ValueA(){
|
||||
get ValueA() {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -405,8 +405,8 @@ export default class RiskJudgment extends BaseRecordComponent<any> {
|
|||
return "<span class='link total'>" + (data.total ? data.total : 0) + "</span>"
|
||||
}
|
||||
});
|
||||
this.subTableColumn.push({ name: "重大风险", key: "greater" });
|
||||
this.subTableColumn.push({ name: "较大风险", key: "significant" });
|
||||
this.subTableColumn.push({ name: "重大风险", key: "significant" });
|
||||
this.subTableColumn.push({ name: "较大风险", key: "greater" });
|
||||
this.subTableColumn.push({ name: "一般风险", key: "general" });
|
||||
this.subTableColumn.push({ name: "低风险", key: "low" });
|
||||
this.subTableColumn.push({
|
||||
|
|
|
@ -28,19 +28,19 @@
|
|||
:width="item.width" :key="item.key">
|
||||
<div :class="item.showTip ?'column-cell-render' :''" slot-scope="scope"
|
||||
v-html="item.render(scope.row)" :filters="item.filters"
|
||||
:filter-method="item.filterMethod">
|
||||
:filter-method="item.filterMethod" @click="showDetails($event,scope.row)">
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"
|
||||
:filters="item.filters" :filter-method="item.filterMethod"
|
||||
:show-overflow-tooltip="item.showTip">
|
||||
:show-overflow-tooltip="item.showTip" @click="showDetails($event,scope.row)">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" fixed="right" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
|
||||
<el-button
|
||||
v-if="(params.type === 1 && scope.row.status === 1)|| (params.type !== 1 &&scope.row.doFlag === 1)"
|
||||
v-if="(params.type === 1 && scope.row.status !== 3)|| (params.type !== 1 &&scope.row.doFlag === 1)"
|
||||
type="text" @click="showUpdateModel(scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -60,4 +60,33 @@
|
|||
</NoticeComponent>
|
||||
</FormComponent>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 公告情况 -->
|
||||
<el-dialog :close-on-click-modal="false" :title="subTitle" :visible.sync="showNoticeInfo" width="1080px"
|
||||
destroy-on-close>
|
||||
<el-table :data="noticeInfoData" height="100%" border row-key="checked" style="width: 100%">
|
||||
<el-table-column label="序号" width="60">
|
||||
<template slot-scope="scope">
|
||||
{{scope.$index+1}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="item in noticeInfoColumn">
|
||||
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name"
|
||||
:width="item.width" :key="item.key">
|
||||
<div :class="item.showTip ?'column-cell-render' :''" slot-scope="scope"
|
||||
v-html="item.render(scope.row)" :filters="item.filters" :filter-method="item.filterMethod"
|
||||
@click="showDetails($event,scope.row)"></div>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"
|
||||
:filters="item.filters" :filter-method="item.filterMethod" :show-overflow-tooltip="item.showTip">
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog v-if="showFile" :close-on-click-modal="false" title="查看图片" :visible.sync="showFile" destroy-on-close
|
||||
width="680px">
|
||||
<img :src="currentUrl" style="width: 100%;" alt="">
|
||||
</el-dialog>
|
||||
</div>
|
|
@ -26,46 +26,49 @@ import moment from 'moment';
|
|||
})
|
||||
export default class SafetyNotice extends BaseRecordComponent<any> {
|
||||
public tableService = new SafetyNoticeService();
|
||||
|
||||
public params = {
|
||||
type: 1,
|
||||
} as any;
|
||||
|
||||
//查询参数
|
||||
public params = { type: 1 } as any;
|
||||
//是否是查看
|
||||
public isReadonly = false;
|
||||
//班组信息
|
||||
public subIsReadonly = false;
|
||||
|
||||
public fileList = [] as any;
|
||||
|
||||
public subTableColumn = [] as any;
|
||||
|
||||
//状态数值
|
||||
public tableState = { 1: '待承诺', 2: '已承诺', 3: '未承诺' };
|
||||
|
||||
//状态颜色
|
||||
public tableStateColor = ['', '#E6A23C', "#68C23A", "#F56C6C"];
|
||||
|
||||
//承诺弹框标题
|
||||
public subTitle = '班组安全承诺';
|
||||
|
||||
//默认承诺内容
|
||||
public defaultPromise = [
|
||||
'',
|
||||
'今天我班组已根据岗位风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本岗位处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。',
|
||||
'今天我车间已根据风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本车间处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。',
|
||||
'今天我企业已根据风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本企业处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。'
|
||||
] as any;
|
||||
|
||||
//标签页
|
||||
public tabs = [{
|
||||
name: "班组风险研判",
|
||||
name: "班组安全承诺",
|
||||
value: 1
|
||||
}, {
|
||||
name: "车间风险研判",
|
||||
name: "车间安全承诺",
|
||||
value: 2
|
||||
}, {
|
||||
name: "企业风险研判",
|
||||
name: "企业安全承诺",
|
||||
value: 3
|
||||
},]
|
||||
|
||||
|
||||
//承诺弹框
|
||||
public showUpdate = false;
|
||||
|
||||
//存放图片地址
|
||||
public currentUrl = '';
|
||||
//图片弹框
|
||||
public showFile = false;
|
||||
//存放上传文件数据
|
||||
public fileList = [] as any;
|
||||
//公告情况弹框
|
||||
public showNoticeInfo = false;
|
||||
//公告情况column
|
||||
public noticeInfoColumn = [] as any;
|
||||
//公告情况数据
|
||||
public noticeInfoData = [] as any;
|
||||
|
||||
public formActions = [{
|
||||
name: "查询",
|
||||
|
@ -174,8 +177,8 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
},
|
||||
{
|
||||
name: "企业名称",
|
||||
key: "controlName",
|
||||
type: "select",
|
||||
key: "name",
|
||||
type: "text",
|
||||
require: true,
|
||||
width: "calc(50% - 20px)",
|
||||
disable: true,
|
||||
|
@ -184,7 +187,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
},
|
||||
{
|
||||
name: "企业负责人",
|
||||
key: "analName",
|
||||
key: "chargeUserName",
|
||||
type: "text",
|
||||
require: true,
|
||||
width: "calc(50% - 20px)",
|
||||
|
@ -258,7 +261,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
this.tableColumn.push({ name: '车间负责人', key: "chargeUserName", });
|
||||
this.tableColumn.push({
|
||||
name: '班组公告情况', key: "situation", render: (data) => {
|
||||
return "<span class='link noCompleteNum'>" + ((data.promised ? data.promised : 0) + '/' + (data.total ? data.total : 0)) + "</span>"
|
||||
return "<span class='link situation'>" + ((data.promised ? data.promised : 0) + '/' + (data.total ? data.total : 0)) + "</span>"
|
||||
}
|
||||
});
|
||||
this.tableColumn.push({
|
||||
|
@ -278,7 +281,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
this.tableColumn.push({ name: '车间负责人', key: "chargeUserName", });
|
||||
this.tableColumn.push({
|
||||
name: '车间公告情况', key: "situation", render: (data) => {
|
||||
return "<span class='link noCompleteNum'>" + ((data.promised ? data.promised : 0) + '/' + (data.total ? data.total : 0)) + "</span>"
|
||||
return "<span class='link situation'>" + ((data.promised ? data.promised : 0) + '/' + (data.total ? data.total : 0)) + "</span>"
|
||||
}
|
||||
});
|
||||
this.tableColumn.push({
|
||||
|
@ -290,6 +293,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public changes(data, item) {
|
||||
//
|
||||
}
|
||||
|
@ -316,9 +320,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
} else if (data.value === "delete") {
|
||||
this.deleteData(this.selectData.map((item: any) => item.id))
|
||||
} else if (data.value === 'add') {
|
||||
// this.buildUpdateForm()
|
||||
this.isReadonly = false
|
||||
this.subIsReadonly = false
|
||||
this.updateParams = {} as any;
|
||||
this.fileList = [] as any;
|
||||
this.buildUpdateForm();
|
||||
|
@ -332,14 +334,12 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
pageSize: 20,
|
||||
} as any;
|
||||
}
|
||||
|
||||
// 分页数据
|
||||
public getTableData() {
|
||||
this.tableService.selectByPage(this.params).then(res => {
|
||||
this.tableData = res.data as any;
|
||||
})
|
||||
}
|
||||
|
||||
public handleClose() {
|
||||
this.showUpdate = false;
|
||||
this.buildUpdateForm()
|
||||
|
@ -347,7 +347,6 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
|
||||
|
||||
public toggleAll() {
|
||||
|
||||
this.tableData.datas.forEach((item, index) => {
|
||||
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
||||
})
|
||||
|
@ -368,16 +367,22 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
public handleSelectionChange(data) {
|
||||
this.selectData = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件预览
|
||||
* @param file
|
||||
*/
|
||||
public onPreview(file) {
|
||||
// if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) {
|
||||
// this.currentUrl = file.url;
|
||||
// this.showFile = true;
|
||||
// } else {
|
||||
// window.open(file.url, "_blank")
|
||||
// }
|
||||
if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) {
|
||||
this.currentUrl = file.url;
|
||||
this.showFile = true;
|
||||
} else {
|
||||
window.open(file.url, "_blank")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传成功
|
||||
* @param res
|
||||
*/
|
||||
public onSuccess(res: any) {
|
||||
if (res.code === 200) {
|
||||
this.fileList = []
|
||||
|
@ -392,20 +397,24 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除file
|
||||
* @param file 数据
|
||||
*/
|
||||
public onRemove(file: any) {
|
||||
this.fileList.splice(this.fileList.findIndex((item: any) => item.id === file.uid), 1)
|
||||
this.updateParams.file = this.fileList.length || null;
|
||||
}
|
||||
|
||||
//标签页切换
|
||||
/**
|
||||
* 标签页切换
|
||||
* @param type 类型
|
||||
*/
|
||||
public tabTableChange(type) {
|
||||
this.params.pageNum = 1;
|
||||
if (type === 1) {
|
||||
this.subTitle = '班组安全承诺';
|
||||
// this.getTableData()
|
||||
} else if (type === 2) {
|
||||
this.subTitle = '车间安全承诺';
|
||||
} else if (type === 3) {
|
||||
|
@ -414,32 +423,23 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
this.buildTable()
|
||||
this.getTableData()
|
||||
}
|
||||
|
||||
public triCallback() {
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
public showUpdateModel(row: any, isReadonly: any) {
|
||||
/**
|
||||
* 点击查看 和编辑
|
||||
* @param row 当前行数据
|
||||
* @param isReadonly 是否是查看
|
||||
*/
|
||||
public showUpdateModel(row: any, isReadonly = false) {
|
||||
console.log('row', row);
|
||||
this.updateParams = {} as any;
|
||||
this.fileList = []
|
||||
// this.
|
||||
if (isReadonly) {
|
||||
this.isReadonly = true
|
||||
} else {
|
||||
this.isReadonly = false
|
||||
}
|
||||
this.isReadonly = isReadonly
|
||||
this.tableService.selectByDetail({ id: row.id, type: this.params.type }).then((res: any) => {
|
||||
console.log('res', res);
|
||||
this.updateParams = Object.assign(res.data, row);
|
||||
if (!this.updateParams.promise) {
|
||||
this.updateParams.promise = this.defaultPromise[this.params.type]
|
||||
}
|
||||
if (!isReadonly) {
|
||||
this.updateParams.researchTime = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
} else {
|
||||
this.updateParams.researchTime = this.updateParams.updateTime
|
||||
}
|
||||
// 获取url
|
||||
if (res.data.resourceId) {
|
||||
|
@ -461,14 +461,12 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
this.buildUpdateForm();
|
||||
this.showUpdate = true;
|
||||
})
|
||||
this.buildUpdateForm();
|
||||
this.showUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 承诺弹框操作
|
||||
* @param data 操作类型 保存 取消
|
||||
*/
|
||||
public promiseCallback(data: any) {
|
||||
console.log('updateParams', this.updateParams);
|
||||
console.log('data', data);
|
||||
if (data === 'save') {
|
||||
this.doSave()
|
||||
} else {
|
||||
|
@ -476,21 +474,60 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
|
|||
this.updateParams = {} as any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 承诺保存
|
||||
*/
|
||||
public doSave() {
|
||||
if ((this.$refs.basicForm as any).vaildParams()) {
|
||||
this.updateParams.resourceId = this.fileList.map((item: any) => item.id).join(",");
|
||||
this.updateParams.resourceName = this.fileList.map((item: any) => item.name).join(",");
|
||||
this.updateParams.status = 2
|
||||
this.tableService.addOrUpdate(this.updateParams, false).then((res: any) => {
|
||||
this.$message.success("研判成功!");
|
||||
this.$message.success("已完成承诺!");
|
||||
this.updateParams = {} as any
|
||||
this.showUpdate = false;
|
||||
this.getTableData();
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 列表内次级公告情况展示
|
||||
* @param el span link数据
|
||||
* @param data 当前行数据
|
||||
*/
|
||||
public showDetails(el, data) {
|
||||
if (el.target.classList.contains("situation")) {
|
||||
this.tableService.selectTaskByDetail({ id: data.id, type: this.params.type }).then((res: any) => {
|
||||
console.log('res', res);
|
||||
this.noticeInfoData = res.data
|
||||
//设置列表column
|
||||
this.buildNoticeInfoColumn()
|
||||
this.showNoticeInfo = true
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设置公告信息列表column
|
||||
*/
|
||||
public buildNoticeInfoColumn() {
|
||||
this.noticeInfoColumn = [] as any;
|
||||
if (this.params.type === 2) {
|
||||
this.noticeInfoColumn.push({ name: '班组名称', key: "riskNumber", })
|
||||
this.noticeInfoColumn.push({ name: '班组负责人', key: "chargeUserName", })
|
||||
}
|
||||
if (this.params.type === 3) {
|
||||
this.noticeInfoColumn.push({ name: '车间名称', key: "riskNumber", })
|
||||
this.noticeInfoColumn.push({ name: '车间负责人', key: "chargeUserName", })
|
||||
}
|
||||
this.noticeInfoColumn.push({ name: '风险点', key: "riskNumber", })
|
||||
this.noticeInfoColumn.push({ name: '作业数量', key: "riskNumber", })
|
||||
this.noticeInfoColumn.push({
|
||||
name: '承诺状态', key: "status", render: (data) => {
|
||||
return `<span style="color:${this.tableStateColor[data.status]}">${this.tableState[data.status]}</span>`
|
||||
}
|
||||
})
|
||||
this.noticeInfoColumn.push({ name: '签名', key: "riskNumber", })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped src="../../common.component.scss"></style>
|
||||
|
|
Loading…
Reference in New Issue