Merge branch 'feature1.2' of https://git.hanbangtang.com/xxhjsb/hbt-prevention-ui into feature1.2

dev
zhushengzhe 2023-09-05 14:46:40 +08:00
commit e6946df36d
10 changed files with 398 additions and 209 deletions

View File

@ -3,7 +3,7 @@
<!-- 安全状态 --> <!-- 安全状态 -->
<div class="status"> <div class="status">
<div class="title">{{ noticeDataList.state.description }}</div> <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 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 }"> <div class="content-items" v-if="!items.children" :style="{ width: items.width }">
<span class="content-children-item-title"> <span class="content-children-item-title">
@ -13,8 +13,7 @@
{{ basicForm[items.key] }} {{ basicForm[items.key] }}
</span> </span>
<span class="isreadonly" v-if="isReadonly && items.type === 'radio'"> <span class="isreadonly" v-if="isReadonly && items.type === 'radio'">
{{ basicForm[items.key] === 1 ? {{ radioTransformName(basicForm[items.key]) }}
'是' : '否' }}
</span> </span>
<el-form-item v-if="!isReadonly && items.type === 'number'" :prop="items.key" <el-form-item v-if="!isReadonly && items.type === 'number'" :prop="items.key"
:rules="{ required: items.required, message: `${items.name}不能为空`, trigger: 'blur' }"> :rules="{ required: items.required, message: `${items.name}不能为空`, trigger: 'blur' }">
@ -47,7 +46,7 @@
{{ basicForm[item.key] }} {{ basicForm[item.key] }}
</span> </span>
<span class="isreadonly" v-if="isReadonly && item.type === 'radio'"> <span class="isreadonly" v-if="isReadonly && item.type === 'radio'">
{{ basicForm[item.key] === 1 ? '是' : '否' }} {{ radioTransformName(basicForm[item.key]) }}
</span> </span>
<el-form-item v-if="!isReadonly && item.type === 'number'" :prop="item.key" <el-form-item v-if="!isReadonly && item.type === 'number'" :prop="item.key"
:rules="{ required: item.required, message: `${item.name}不能为空`, trigger: 'blur' }"> :rules="{ required: item.required, message: `${item.name}不能为空`, trigger: 'blur' }">
@ -84,7 +83,7 @@
{{ judgmentForm[items.key] }} {{ judgmentForm[items.key] }}
</span> </span>
<span class="isreadonly" v-if="isReadonly && items.type === 'radio'"> <span class="isreadonly" v-if="isReadonly && items.type === 'radio'">
{{ judgmentForm[items.key] === 1 ? '是' : '否' }} {{ radioTransformName(judgmentForm[items.key]) }}
</span> </span>
<el-form-item :rules="{ required: items.required, message: `${items.name}不能为空`, trigger: 'blur' }"> <el-form-item :rules="{ required: items.required, message: `${items.name}不能为空`, trigger: 'blur' }">
<!-- 数字框-number --> <!-- 数字框-number -->
@ -114,7 +113,7 @@
{{ judgmentForm[item.key] }} {{ judgmentForm[item.key] }}
</span> </span>
<span class="isreadonly" v-if="isReadonly && item.type === 'radio'"> <span class="isreadonly" v-if="isReadonly && item.type === 'radio'">
{{ judgmentForm[item.key] === 1 ? '是' : '否' }} {{ radioTransformName(judgmentForm[item.key]) }}
</span> </span>
<el-form-item <el-form-item
:rules="{ required: item.required, message: `${items.name}不能为空`, trigger: 'blur' }"> :rules="{ required: item.required, message: `${items.name}不能为空`, trigger: 'blur' }">
@ -177,7 +176,7 @@ export default class NoticeComponent extends Vue {
handleData() { handleData() {
// //
this.basicForm = this.updateParams; 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({ @Prop({
@ -196,24 +195,28 @@ export default class NoticeComponent extends Vue {
@Prop() @Prop()
public isReadonly: boolean; public isReadonly: boolean;
// /**
public rules = { * 表单默认值
riskNumber: [ */
{ required: true, message: '请输入活动名称', trigger: 'blur' }, public formDefaultValues() {
], let tmpJudementForm = {}
measureFlag: [ this.noticeDataList.situation.content.forEach((item: any) => {
{ required: true, message: '请选择活动区域', trigger: 'change' } item.children.forEach((children: any) => {
], if (children.defaultValue !== undefined || children.defaultValue !== null) {
basicwork: [ tmpJudementForm[children.key] = children.defaultValue
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' } }
], })
}; })
return tmpJudementForm
}
created() { created() {
// //
} }
// /**
* 保存
*/
public onSubmit() { public onSubmit() {
(this.$refs.basicForm as any).validate((valid: any) => { (this.$refs.basicForm as any).validate((valid: any) => {
if (valid) { if (valid) {
@ -226,10 +229,22 @@ export default class NoticeComponent extends Vue {
}); });
} }
// /**
* 取消
*/
public cancel() { public cancel() {
this.actionCallback('cancel') this.actionCallback('cancel')
} }
/**
* 单选 转换name显示
* @param value
*/
public radioTransformName(value: any) {
if (value === 1) return '是'
if (value === 0) return '否'
return
}
} }
</script> </script>

View File

@ -294,6 +294,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -312,6 +313,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -330,6 +332,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -348,6 +351,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -372,6 +376,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -390,6 +395,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:0,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -408,6 +414,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -426,6 +433,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -444,6 +452,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -462,6 +471,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:0,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -486,6 +496,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -504,6 +515,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",
@ -522,6 +534,7 @@ export default {
required: false, required: false,
width: "100%", width: "100%",
labelWidth: "600px", labelWidth: "600px",
defaultValue:1,
datas: [ datas: [
{ {
name: "是", name: "是",

View File

@ -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)
}
}

View File

@ -15,6 +15,11 @@ export default class SafetyNoticeService extends BaseService<any>{
const url = this.prefix.prevention+'/safety/promise/task'; const url = this.prefix.prevention+'/safety/promise/task';
return this.get(url,params,true) 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>>>{ public deleteByIds(params,showLoading?):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/safety/promise/task'; const url = this.prefix.prevention+'/safety/promise/task';

View File

@ -1,24 +1,26 @@
<div class="home-box dis-flex flex-col"> <div class="home-box dis-flex flex-col">
<div class="overview-box"> <div class="overview-box">
<div class="inner-echarts-box custom-box dis-flex flex-col"> <div class="inner-echarts-box custom-box dis-flex flex-col">
<div class="title">安全承诺公告</div> <div class="title">安全承诺公告</div>
<div class="static-box full dis-flex"> <div class="static-box full dis-flex">
<div class="static dis-flex"> <div class="static dis-flex">
<span>进入受限空间作业 (处)</span> <span>进入受限空间作业 处)</span>
<span class="count">13</span> <span class="count">{{promiseData.confinedSpaceWork ? promiseData.confinedSpaceWork:0}}</span>
</div> </div>
<div class="static dis-flex"> <div class="static dis-flex">
<span>是否处于试生产</span> <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>
<div class="static dis-flex"> <div class="static dis-flex">
<span>开停车状态</span> <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>
<div class="static dis-flex"> <div class="static dis-flex">
<span>罐装、仓库等重大危险源<br>是否处于安全状态</span> <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> </div>
<div class="charts-box"> <div class="charts-box">
@ -29,14 +31,17 @@
<div class="custom-box info-box"> <div class="custom-box info-box">
<div class="title">企业承诺</div> <div class="title">企业承诺</div>
<div class="text"> <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>
<div class="text-r">吴延福</div>
<div class="text-r">2023-05-29 15:03:22</div> <div class="text-r">2023-05-29 15:03:22</div>
</div> </div>
</div> </div>
<div class="custom-box echarts-box dis-flex flex-col"> <div class="custom-box echarts-box dis-flex flex-col">
<div class="title">企业风险辨识</div> <div class="title">企业风险辨识</div>
<hbt-echarts class="echarts" :options="buildBarOption()" @onChartInit="getChart($event,true)"></hbt-echarts> <hbt-echarts class="echarts" :options="buildBarOption()" @onChartInit="getChart($event,true)"></hbt-echarts>
</div> </div>
</div> </div>

View File

@ -98,6 +98,10 @@
margin-top: 10px; margin-top: 10px;
text-align: right; text-align: right;
} }
.text-i{
width: 80px;
margin-left: auto;
}
} }
} }
.echarts-box{ .echarts-box{

View File

@ -1,96 +1,154 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator'; 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({ @Component({
template, template,
components:{ components: {
}, },
}) })
export default class HomeComponent extends Vue { export default class HomeComponent extends Vue {
public tableService = new HomeService();
// //
// //
public datas = [ public datas = [
//////////////////////////////////////// ////////////////////////////////////////
[ [
{ name: '运行', value: 11 }, { name: '运行', value: 0, key: "equipmentRunNum" },
{ name: '停产', value: 13 }, { name: '停产', value: 0, key: "equipmentStopNum" },
{ name: '检修', value: 8 }, { name: '检修', value: 0, key: "equipmentOverhaulNum" },
], ],
// //////////////////////////////////////// // ////////////////////////////////////////
[ [
{ name: '特殊', value: 13 }, { name: '特殊', value: 0, key: "specialHotWork" },
{ name: '一级', value: 11 }, { name: '一级', value: 0, key: "twoHotWork" },
{ name: '二级', value: 8 }, { name: '二级', value: 0, key: "oneHotWork" },
]]; ]];
// //
public pieChart:any; public pieChart: any;
// //
public barChart:any public barChart: any;
//
// public promiseData = {} as any;
mounted(){ //
window.addEventListener("resize",this.resize) public riskData = {
} deptName: [],
beforeDestory(){ low: [],
window.removeEventListener("resize",this.resize) general: [],
greater: [],
significant: []
} as any;
created() {
//
this.getPromiseDataMethod();
//
this.getRiskDataMethod();
} }
public buildPieOption(){ /**
* 获取风险数据
*/
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)
}
beforeDestory() {
window.removeEventListener("resize", this.resize)
}
public buildPieOption() {
return { return {
title:[{ title: [{
show:true, show: true,
text:this.datas[0].reduce((total,cur)=>{ text: this.datas[0].reduce((total, cur) => {
return total+cur.value return total + cur.value
},0), }, 0),
textAlign:"center", textAlign: "center",
textStyle:{ textStyle: {
fontSize:24 fontSize: 24
}, },
subtextStyle:{ subtextStyle: {
fontSize:14 fontSize: 14
}, },
subtext:"生产装备(套)", subtext: "生产装备(套)",
left:"20%", left: "20%",
top:"40%" top: "40%"
},{ }, {
show:true, show: true,
text:this.datas[1].reduce((total,cur)=>{ text: this.datas[1].reduce((total, cur) => {
return total+cur.value return total + cur.value
},0), }, 0),
textAlign:"center", textAlign: "center",
subtext:"动火作业(处)", subtext: "动火作业(处)",
textStyle:{ textStyle: {
fontSize:24 fontSize: 24
}, },
subtextStyle:{ subtextStyle: {
fontSize:14 fontSize: 14
}, },
left:"70%", left: "70%",
top:"40%" top: "40%"
}], }],
color:["#409EFF","#BFCBD9","#E6A23C","#A67AFF","#409EFF","#F56C6C"], color: ["#409EFF", "#BFCBD9", "#E6A23C", "#A67AFF", "#409EFF", "#F56C6C"],
legend:[{ legend: [{
right:"53%", right: "53%",
itemWidth:14, itemWidth: 14,
top:"center", top: "center",
data:this.datas[0], data: this.datas[0],
orient:"vertical" orient: "vertical"
},{ }, {
right:"0%", right: "0%",
top:"center", top: "center",
itemWidth:14, itemWidth: 14,
data:this.datas[1], data: this.datas[1],
orient:"vertical" orient: "vertical"
}], }],
series:this.datas.map((data,idx)=>{ series: this.datas.map((data, idx) => {
const left = idx * (100 / this.datas.length); const left = idx * (100 / this.datas.length);
return { return {
type: 'pie', type: 'pie',
radius: ["45%", "60%"], radius: ["45%", "60%"],
center:["40%","50%"], center: ["40%", "50%"],
top: 'center', top: 'center',
height: '100%', height: '100%',
left: left+'%', left: left + '%',
width: "50%", width: "50%",
itemStyle: { itemStyle: {
borderColor: '#fff', borderColor: '#fff',
@ -112,29 +170,29 @@ export default class HomeComponent extends Vue {
} }
} }
public buildBarOption(){ public buildBarOption() {
return { return {
tooltip:{ tooltip: {
}, },
color:["#68C23A","#409EFF","#E6A23C","#F56C6C"], color: ["#116FF5", "#FFC019", "#FF7802", "#E31C21"],
grid:{ grid: {
left:24, left: 24,
right:24, right: 24,
bottom:24, bottom: 24,
containLabel:true containLabel: true
}, },
legend:{ legend: {
top:25, top: 25,
left:"center", left: "center",
}, },
yAxis: [ yAxis: [
{ {
type: 'value', type: 'value',
name:"单位:个", name: "单位:个",
splitLine:{ splitLine: {
lineStyle:{ lineStyle: {
type:"dashed" type: "dashed"
} }
} }
} }
@ -143,52 +201,52 @@ export default class HomeComponent extends Vue {
{ {
type: 'category', type: 'category',
axisTick: { show: false }, axisTick: { show: false },
data: ['部门1', '部门2', '部门3', '部门4', '部门5'] data: this.riskData.deptName,
} }
], ],
series:[{ series: [{
name:"低风险", name: "低风险",
type: 'bar', type: 'bar',
barWidth:40, barWidth: 12,
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100)) data: this.riskData.low,
},{ }, {
name:"一般风险", name: "一般风险",
type: 'bar', type: 'bar',
barWidth:40, barWidth: 12,
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100)) data: this.riskData.general,
},{ }, {
name:"较高风险", name: "较大风险",
type: 'bar', type: 'bar',
barWidth:40, barWidth: 12,
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100)) data: this.riskData.greater,
},{ }, {
name:"高风险", name: "重大风险",
type: 'bar', type: 'bar',
barWidth:40, barWidth: 12,
data:new Array(5).fill(0).map(item=>Math.floor(Math.random()*100)) data: this.riskData.significant,
}] }]
} }
} }
public getChart(charts,isBar?){ public getChart(charts, isBar?) {
if(!isBar){ if (!isBar) {
this.pieChart = charts this.pieChart = charts
}else{ } else {
this.barChart = charts this.barChart = charts
} }
} }
public resize(){ public resize() {
if(this.pieChart){ if (this.pieChart) {
this.pieChart.resize() this.pieChart.resize()
} }
if(this.barChart){ if (this.barChart) {
this.barChart.resize() this.barChart.resize()
} }
} }
// === computed // === computed
get ValueA(){ get ValueA() {
return 1 return 1
} }
} }

View File

@ -405,8 +405,8 @@ export default class RiskJudgment extends BaseRecordComponent<any> {
return "<span class='link total'>" + (data.total ? data.total : 0) + "</span>" 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: "general" });
this.subTableColumn.push({ name: "低风险", key: "low" }); this.subTableColumn.push({ name: "低风险", key: "low" });
this.subTableColumn.push({ this.subTableColumn.push({

View File

@ -28,19 +28,19 @@
:width="item.width" :key="item.key"> :width="item.width" :key="item.key">
<div :class="item.showTip ?'column-cell-render' :''" slot-scope="scope" <div :class="item.showTip ?'column-cell-render' :''" slot-scope="scope"
v-html="item.render(scope.row)" :filters="item.filters" v-html="item.render(scope.row)" :filters="item.filters"
:filter-method="item.filterMethod"> :filter-method="item.filterMethod" @click="showDetails($event,scope.row)">
</div> </div>
</el-table-column> </el-table-column>
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key" <el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"
:filters="item.filters" :filter-method="item.filterMethod" :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> </el-table-column>
</template> </template>
<el-table-column label="操作" fixed="right" width="100"> <el-table-column label="操作" fixed="right" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button> <el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
<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> type="text" @click="showUpdateModel(scope.row)">编辑</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -60,4 +60,33 @@
</NoticeComponent> </NoticeComponent>
</FormComponent> </FormComponent>
</el-dialog> </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> </div>

View File

@ -26,46 +26,49 @@ import moment from 'moment';
}) })
export default class SafetyNotice extends BaseRecordComponent<any> { export default class SafetyNotice extends BaseRecordComponent<any> {
public tableService = new SafetyNoticeService(); public tableService = new SafetyNoticeService();
//
public params = { public params = { type: 1 } as any;
type: 1, //
} as any;
public isReadonly = false; public isReadonly = false;
// //
public subIsReadonly = false;
public fileList = [] as any;
public subTableColumn = [] as any;
public tableState = { 1: '待承诺', 2: '已承诺', 3: '未承诺' }; public tableState = { 1: '待承诺', 2: '已承诺', 3: '未承诺' };
//
public tableStateColor = ['', '#E6A23C', "#68C23A", "#F56C6C"]; public tableStateColor = ['', '#E6A23C', "#68C23A", "#F56C6C"];
//
public subTitle = '班组安全承诺'; public subTitle = '班组安全承诺';
//
public defaultPromise = [ public defaultPromise = [
'', '',
'今天我班组已根据岗位风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本岗位处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。', '今天我班组已根据岗位风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本岗位处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。',
'今天我车间已根据风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本车间处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。', '今天我车间已根据风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本车间处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。',
'今天我企业已根据风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本企业处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。' '今天我企业已根据风险辨识管控相关内容以及安全风险评估表进行安全风险研判,各项安全风险防控措施已落实到位,我承诺本企业处于安全运行状态,涉及罐区、仓库等重大危险源安全风险的到有效管控。'
] as any; ] as any;
//
public tabs = [{ public tabs = [{
name: "班组风险研判", name: "班组安全承诺",
value: 1 value: 1
}, { }, {
name: "车间风险研判", name: "车间安全承诺",
value: 2 value: 2
}, { }, {
name: "企业风险研判", name: "企业安全承诺",
value: 3 value: 3
},] },]
//
public showUpdate = false; 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 = [{ public formActions = [{
name: "查询", name: "查询",
@ -174,8 +177,8 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
}, },
{ {
name: "企业名称", name: "企业名称",
key: "controlName", key: "name",
type: "select", type: "text",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
@ -184,7 +187,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
}, },
{ {
name: "企业负责人", name: "企业负责人",
key: "analName", key: "chargeUserName",
type: "text", type: "text",
require: true, require: true,
width: "calc(50% - 20px)", 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: "chargeUserName", });
this.tableColumn.push({ this.tableColumn.push({
name: '班组公告情况', key: "situation", render: (data) => { 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({ 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: "chargeUserName", });
this.tableColumn.push({ this.tableColumn.push({
name: '车间公告情况', key: "situation", render: (data) => { 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({ this.tableColumn.push({
@ -290,6 +293,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
} }
} }
public changes(data, item) { public changes(data, item) {
// //
} }
@ -316,9 +320,7 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
} else if (data.value === "delete") { } else if (data.value === "delete") {
this.deleteData(this.selectData.map((item: any) => item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} else if (data.value === 'add') { } else if (data.value === 'add') {
// this.buildUpdateForm()
this.isReadonly = false this.isReadonly = false
this.subIsReadonly = false
this.updateParams = {} as any; this.updateParams = {} as any;
this.fileList = [] as any; this.fileList = [] as any;
this.buildUpdateForm(); this.buildUpdateForm();
@ -332,14 +334,12 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
pageSize: 20, pageSize: 20,
} as any; } as any;
} }
// //
public getTableData() { public getTableData() {
this.tableService.selectByPage(this.params).then(res => { this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any; this.tableData = res.data as any;
}) })
} }
public handleClose() { public handleClose() {
this.showUpdate = false; this.showUpdate = false;
this.buildUpdateForm() this.buildUpdateForm()
@ -347,7 +347,6 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
public toggleAll() { public toggleAll() {
this.tableData.datas.forEach((item, index) => { this.tableData.datas.forEach((item, index) => {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
}) })
@ -368,16 +367,22 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
public handleSelectionChange(data) { public handleSelectionChange(data) {
this.selectData = data; this.selectData = data;
} }
/**
* 文件预览
* @param file
*/
public onPreview(file) { public onPreview(file) {
// if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) { if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) {
// this.currentUrl = file.url; this.currentUrl = file.url;
// this.showFile = true; this.showFile = true;
// } else { } else {
// window.open(file.url, "_blank") window.open(file.url, "_blank")
// } }
} }
/**
* 文件上传成功
* @param res
*/
public onSuccess(res: any) { public onSuccess(res: any) {
if (res.code === 200) { if (res.code === 200) {
this.fileList = [] this.fileList = []
@ -392,20 +397,24 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
} }
/**
* 删除file
* @param file 数据
*/
public onRemove(file: any) { public onRemove(file: any) {
this.fileList.splice(this.fileList.findIndex((item: any) => item.id === file.uid), 1) this.fileList.splice(this.fileList.findIndex((item: any) => item.id === file.uid), 1)
this.updateParams.file = this.fileList.length || null; this.updateParams.file = this.fileList.length || null;
} }
// /**
* 标签页切换
* @param type 类型
*/
public tabTableChange(type) { public tabTableChange(type) {
this.params.pageNum = 1; this.params.pageNum = 1;
if (type === 1) { if (type === 1) {
this.subTitle = '班组安全承诺'; this.subTitle = '班组安全承诺';
// this.getTableData()
} else if (type === 2) { } else if (type === 2) {
this.subTitle = '车间安全承诺'; this.subTitle = '车间安全承诺';
} else if (type === 3) { } else if (type === 3) {
@ -414,32 +423,23 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
this.buildTable() this.buildTable()
this.getTableData() this.getTableData()
} }
/**
public triCallback() { * 点击查看 和编辑
// * @param row 当前行数据
} * @param isReadonly 是否是查看
*/
public showUpdateModel(row: any, isReadonly = false) {
public showUpdateModel(row: any, isReadonly: any) {
console.log('row', row); console.log('row', row);
this.updateParams = {} as any; this.updateParams = {} as any;
this.fileList = [] this.fileList = []
// this. this.isReadonly = isReadonly
if (isReadonly) {
this.isReadonly = true
} else {
this.isReadonly = false
}
this.tableService.selectByDetail({ id: row.id, type: this.params.type }).then((res: any) => { this.tableService.selectByDetail({ id: row.id, type: this.params.type }).then((res: any) => {
console.log('res', res);
this.updateParams = Object.assign(res.data, row); this.updateParams = Object.assign(res.data, row);
if (!this.updateParams.promise) { if (!this.updateParams.promise) {
this.updateParams.promise = this.defaultPromise[this.params.type] this.updateParams.promise = this.defaultPromise[this.params.type]
} }
if (!isReadonly) { if (!isReadonly) {
this.updateParams.researchTime = moment().format('YYYY-MM-DD HH:mm:ss'); this.updateParams.researchTime = moment().format('YYYY-MM-DD HH:mm:ss');
} else {
this.updateParams.researchTime = this.updateParams.updateTime
} }
// url // url
if (res.data.resourceId) { if (res.data.resourceId) {
@ -461,14 +461,12 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
this.buildUpdateForm(); this.buildUpdateForm();
this.showUpdate = true; this.showUpdate = true;
}) })
this.buildUpdateForm();
this.showUpdate = true;
} }
/**
* 承诺弹框操作
* @param data 操作类型 保存 取消
*/
public promiseCallback(data: any) { public promiseCallback(data: any) {
console.log('updateParams', this.updateParams);
console.log('data', data);
if (data === 'save') { if (data === 'save') {
this.doSave() this.doSave()
} else { } else {
@ -476,21 +474,60 @@ export default class SafetyNotice extends BaseRecordComponent<any> {
this.updateParams = {} as any; this.updateParams = {} as any;
} }
} }
/**
* 承诺保存
*/
public doSave() { public doSave() {
if ((this.$refs.basicForm as any).vaildParams()) { if ((this.$refs.basicForm as any).vaildParams()) {
this.updateParams.resourceId = this.fileList.map((item: any) => item.id).join(","); this.updateParams.resourceId = this.fileList.map((item: any) => item.id).join(",");
this.updateParams.resourceName = this.fileList.map((item: any) => item.name).join(","); this.updateParams.resourceName = this.fileList.map((item: any) => item.name).join(",");
this.updateParams.status = 2 this.updateParams.status = 2
this.tableService.addOrUpdate(this.updateParams, false).then((res: any) => { this.tableService.addOrUpdate(this.updateParams, false).then((res: any) => {
this.$message.success("研判成功"); this.$message.success("已完成承诺");
this.updateParams = {} as any this.updateParams = {} as any
this.showUpdate = false; this.showUpdate = false;
this.getTableData(); 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> </script>
<style lang="scss" scoped src="../../common.component.scss"></style> <style lang="scss" scoped src="../../common.component.scss"></style>