hazop插件部分接口完成
This commit is contained in:
@@ -12,7 +12,7 @@ import Footer from './footer.vue'
|
||||
|
||||
const themeStore = useThemeStore();
|
||||
|
||||
const props = defineProps(['type','isAiOpen','title','currentId'])
|
||||
const props = defineProps(['type','isAiOpen','title','currentId','formInfo'])
|
||||
const emit = defineEmits(['save','submit','confirmTab']);
|
||||
|
||||
const form = ref<{ content: string }>({
|
||||
@@ -105,9 +105,7 @@ const toPssr = (i: number) => {
|
||||
const updRec = (i: number, patch: Partial<any>) => {
|
||||
riskRecords.value = riskRecords.value.map((x, j) => (j === i ? { ...x, ...patch } : x));
|
||||
};
|
||||
const onBack = () => {
|
||||
pluginDrawer.value = false;
|
||||
}
|
||||
|
||||
const exportAll = (items: any[], mode: "manual" | "ai") => {
|
||||
riskRecords.value = [...riskRecords.value, ...items];
|
||||
if (mode === "ai") {
|
||||
@@ -119,6 +117,16 @@ const exportAll = (items: any[], mode: "manual" | "ai") => {
|
||||
}
|
||||
}
|
||||
|
||||
// 使用插件弹框
|
||||
const usePlugin = (key: string) => {
|
||||
currentPlugin.value = key;
|
||||
pluginDrawer.value = true;
|
||||
}
|
||||
// 关闭插件弹框
|
||||
const closePlugin = () => {
|
||||
pluginDrawer.value = false;
|
||||
}
|
||||
|
||||
// 保存草稿
|
||||
const saveDraft = () => {
|
||||
emit('save');
|
||||
@@ -144,12 +152,12 @@ defineExpose({form})
|
||||
<Icon icon="lucide:shield-alert" class="size-16px" />
|
||||
风险识别工具(按变更等级匹配)
|
||||
</span>
|
||||
<!-- <NTag size="small" :type="form?.level === '重要' ? 'error' : 'default'">
|
||||
{{ form?.level === '重要' ? '重要变更' : '一般变更' }}
|
||||
<NTag size="small" :type="formInfo?.change_level === 2 ? 'error' : 'default'">
|
||||
{{ formInfo?.change_level === 2 ? '重要变更' : '一般变更' }}
|
||||
</NTag>
|
||||
<span class="text-xs text-slate-400">
|
||||
{{ form?.level === '重要' ? '规则:HAZOP 必做,同时开展 JSA 与检查表法(SCL)' : '规则:JSA + 检查表法(SCL),涉及工艺安全边界的应升级 HAZOP' }};可在申请表「风险分析」栏手动重选
|
||||
</span> -->
|
||||
{{ formInfo?.change_level === 2 ? '规则:HAZOP 必做,同时开展 JSA 与检查表法(SCL)' : '规则:JSA + 检查表法(SCL),涉及工艺安全边界的应升级 HAZOP' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="grid gap-2 grid-cols-4 mt-3">
|
||||
<div v-for="t in TOOL_CARDS" :key="t.key" :title="t.desc"
|
||||
@@ -170,8 +178,7 @@ defineExpose({form})
|
||||
{{ pluginDone[t.key] !== undefined ? `已使用并分析了 ${pluginDone[t.key]} 条内容` : '未使用此工具分析' }}
|
||||
</div>
|
||||
</div>
|
||||
<NButton size="small" class="text-xs" :type="pluginDone[t.key] !== undefined ? 'default' : tools.includes(t.key) ? 'primary' : 'default'"
|
||||
>
|
||||
<NButton size="small" class="text-xs" type="primary" @click="usePlugin(t.key)">
|
||||
使用
|
||||
</NButton>
|
||||
</div>
|
||||
@@ -190,7 +197,7 @@ defineExpose({form})
|
||||
<Icon icon="tabler:clipboard-check" class="size-14px" />
|
||||
全部转 PSSR 行动项
|
||||
</NButton>
|
||||
<NButton ghost size="small" type="primary" class="text-xs" @click="aiOrganize">
|
||||
<NButton v-if="isAiOpen" ghost size="small" type="primary" class="text-xs" @click="aiOrganize">
|
||||
<Icon icon="lucide:sparkles" class="size-12px" />
|
||||
AI 自动整理
|
||||
</NButton>
|
||||
@@ -266,16 +273,16 @@ defineExpose({form})
|
||||
<NDrawer v-model:show="pluginDrawer" :width="1200" placement="right">
|
||||
<NDrawerContent>
|
||||
<template v-if="currentPlugin === 'HAZOP'">
|
||||
<Hazop @back="onBack" @export="exportAll" />
|
||||
<Hazop :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" @export="exportAll" />
|
||||
</template>
|
||||
<template v-else-if="currentPlugin === 'JSA'">
|
||||
<Jsa @back="onBack" @export="exportAll" />
|
||||
<Jsa @close="closePlugin" @export="exportAll" />
|
||||
</template>
|
||||
<template v-else-if="currentPlugin === 'SCL'">
|
||||
<Scl @back="onBack" @export="exportAll" />
|
||||
<Scl @close="closePlugin" @export="exportAll" />
|
||||
</template>
|
||||
<template v-else-if="currentPlugin === 'RISK_CHECK'">
|
||||
<RiskCheck @back="onBack" />
|
||||
<RiskCheck @close="closePlugin" />
|
||||
</template>
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
|
||||
Reference in New Issue
Block a user