FEMA矩阵配置完成,FEMA插件静态页面完成
This commit is contained in:
@@ -6,7 +6,7 @@ import { useThemeStore } from '@/store/modules/theme';
|
||||
import RiskPre from "./riskPre.vue";
|
||||
import Hazop from "./hazop.vue";
|
||||
import Jsa from "./jsa.vue";
|
||||
import Scl from "./scl.vue";
|
||||
import Fmea from "./fmea.vue";
|
||||
import RiskCheck from "./riskCheck.vue";
|
||||
import Footer from './footer.vue'
|
||||
import { matrixConfigApi } from "@/service/api/system";
|
||||
@@ -19,12 +19,13 @@ const emit = defineEmits(['save','submit','confirmTab']);
|
||||
watch(() => props.currentForm, (newVal:any) => {
|
||||
const omit = (obj:any, fields: string[]) => Object.fromEntries(Object.entries(obj).filter(([k]) => !fields.includes(k)));
|
||||
const result = newVal?.records.map((item:any) => omit(item, [
|
||||
'id', 'created_at', 'updated_at', 'change_id', 'source_row_id'
|
||||
'created_at', 'updated_at', 'change_id', 'source_row_id'
|
||||
]));
|
||||
riskRecords.value = result || [];
|
||||
})
|
||||
|
||||
const hazopRiskMatrixConfig = ref<any>(null);
|
||||
const fmeaRiskMatrixConfig = ref<any>(null);
|
||||
const jsaRiskMatrixConfig = ref<any>(null);
|
||||
const pluginDone = computed(() =>
|
||||
riskRecords.value.reduce((acc:any, item:any) => {
|
||||
@@ -33,7 +34,7 @@ const pluginDone = computed(() =>
|
||||
return acc;
|
||||
}, {} as Record<string, number>)
|
||||
);
|
||||
const tools = ref<string[]>(["RISK","HAZOP","JSA", "RISK_CHECK"]);
|
||||
const tools = ref<string[]>(["RISK","HAZOP","FMEA", "RISK_CHECK"]);
|
||||
const riskRecords = ref<any>([]);
|
||||
const pluginDrawer = ref<boolean>(false);
|
||||
const currentPlugin = ref<string>('');
|
||||
@@ -42,7 +43,7 @@ const currentPlugin = ref<string>('');
|
||||
const TOOL_CARDS = [
|
||||
{ key: "RISK", name: "风险预分析" },
|
||||
{ key: "HAZOP", name: "HAZOP 分析" },
|
||||
{ key: "JSA", name: "JSA 分析" },
|
||||
{ key: "FMEA", name: "FMEA 分析" },
|
||||
{ key: "RISK_CHECK", name: "风险检查表" },
|
||||
];
|
||||
|
||||
@@ -157,6 +158,10 @@ return result;
|
||||
}
|
||||
// 整理入表
|
||||
const exportAll = (type: string, items: any[]) => {
|
||||
// console.log(items)
|
||||
// console.log(riskRecords.value)
|
||||
// console.log([...riskRecords.value, ...items])
|
||||
// 如果有id且id!=0,就用id去重,否则根据对象内容去重
|
||||
riskRecords.value = uniqueById([...riskRecords.value, ...items]);
|
||||
if (type === "all") {
|
||||
pluginDrawer.value = false;
|
||||
@@ -173,10 +178,7 @@ const usePlugin = (key: string) => {
|
||||
pluginDrawer.value = true;
|
||||
}
|
||||
// 关闭插件弹框
|
||||
const closePlugin = (type: string = "", count: any = undefined) => {
|
||||
if(type){
|
||||
pluginDone.value[type] = count;
|
||||
}
|
||||
const closePlugin = () => {
|
||||
pluginDrawer.value = false;
|
||||
}
|
||||
|
||||
@@ -193,26 +195,20 @@ const confirmTab = (tab:string, val:boolean) => {
|
||||
emit('confirmTab', tab, val);
|
||||
}
|
||||
|
||||
// 获取HAZOP风险矩阵配置
|
||||
const getHazopRiskMatrixConfig = async () => {
|
||||
const {data,error} = await matrixConfigApi("HAZOP");
|
||||
if(!error){
|
||||
hazopRiskMatrixConfig.value = data;
|
||||
}
|
||||
}
|
||||
// 获取JSA风险矩阵配置
|
||||
const getJsaRiskMatrixConfig = async () => {
|
||||
const {data,error} = await matrixConfigApi("JSA");
|
||||
const getRiskMatrixConfig = async () => {
|
||||
const {data,error} = await matrixConfigApi();
|
||||
if(!error){
|
||||
jsaRiskMatrixConfig.value = data;
|
||||
hazopRiskMatrixConfig.value = data?.hazop || null;
|
||||
jsaRiskMatrixConfig.value = data?.jsa || null;
|
||||
fmeaRiskMatrixConfig.value = data?.fmea || null;
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({riskRecords})
|
||||
|
||||
onMounted(() => {
|
||||
getHazopRiskMatrixConfig();
|
||||
getJsaRiskMatrixConfig();
|
||||
getRiskMatrixConfig();
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -229,7 +225,7 @@ onMounted(() => {
|
||||
{{ formInfo?.change_level === 2 ? '重要变更' : '一般变更' }}
|
||||
</NTag>
|
||||
<span class="text-xs text-slate-400">
|
||||
{{ formInfo?.change_level === 2 ? '规则:HAZOP 必做,同时开展 JSA' : '规则:JSA,涉及工艺安全边界的应升级 HAZOP' }}
|
||||
{{ formInfo?.change_level === 2 ? '规则:HAZOP 必做' : '规则:涉及工艺安全边界的应升级 HAZOP' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="grid gap-2 grid-cols-4 mt-3">
|
||||
@@ -355,6 +351,16 @@ onMounted(() => {
|
||||
{{jsaRiskLevel(rec.l_value, rec.s_value)?.name}}
|
||||
</NTag>
|
||||
</div>
|
||||
<div v-if="rec.source==='RISK_CHECK'">
|
||||
<NTag
|
||||
class="text-[11px]"
|
||||
size="small"
|
||||
>
|
||||
<span>
|
||||
{{rec.inherent_level?rec.inherent_level:'-'}}
|
||||
</span>
|
||||
</NTag>
|
||||
</div>
|
||||
</td>
|
||||
<td class="border px-1.5 py-1">
|
||||
<NInput type="textarea" size="small" v-model:value="rec.safeguards" :autosize="{minRows:1}" class="text-xs" />
|
||||
@@ -421,9 +427,19 @@ onMounted(() => {
|
||||
</span>
|
||||
</NTag>
|
||||
</div>
|
||||
<div v-if="rec.source==='RISK_CHECK'">
|
||||
<NTag
|
||||
class="text-[11px]"
|
||||
size="small"
|
||||
>
|
||||
<span>
|
||||
{{rec.residual_level?rec.residual_level:'-'}}
|
||||
</span>
|
||||
</NTag>
|
||||
</div>
|
||||
</td>
|
||||
<td class="border px-1.5 py-1 text-center align-top">
|
||||
<NTag size="small" type="info" class="text-11px">{{ rec.source==='RISK'?'风险预分析':rec.source }}</NTag>
|
||||
<NTag size="small" type="info" class="text-11px">{{ rec.source==='RISK'?'风险预分析':rec.source==='RISK_CHECK'?'风险检查': rec.source }}</NTag>
|
||||
</td>
|
||||
<td class="border px-1.5 py-1 text-center align-top">
|
||||
<NTag v-if="rec.to_pssr" size="small" :color="{ color: '#f5f3ff', textColor: '#7c3aed', borderColor: '#f5f3ff' }">已转 PSSR</NTag>
|
||||
@@ -470,14 +486,11 @@ onMounted(() => {
|
||||
<template v-if="currentPlugin === 'HAZOP'">
|
||||
<Hazop :isAiOpen="props.isAiOpen" :currentId="props.currentId" :hazopRiskMatrixConfig="hazopRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" />
|
||||
</template>
|
||||
<template v-if="currentPlugin === 'JSA'">
|
||||
<Jsa :isAiOpen="props.isAiOpen" :currentId="props.currentId" :jsaRiskMatrixConfig="jsaRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" />
|
||||
</template>
|
||||
<template v-if="currentPlugin === 'SCL'">
|
||||
<Scl @close="closePlugin" @toTable="exportAll" />
|
||||
<template v-if="currentPlugin === 'FMEA'">
|
||||
<Fmea :isAiOpen="props.isAiOpen" :currentId="props.currentId" :fmeaRiskMatrixConfig="fmeaRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" />
|
||||
</template>
|
||||
<template v-if="currentPlugin === 'RISK_CHECK'">
|
||||
<RiskCheck :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" />
|
||||
<RiskCheck :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" @toTable="exportAll" />
|
||||
</template>
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
|
||||
Reference in New Issue
Block a user