diff --git a/src/service/api/change.ts b/src/service/api/change.ts index 34321a4..bc9dcf0 100644 --- a/src/service/api/change.ts +++ b/src/service/api/change.ts @@ -35,12 +35,3 @@ export function getChangeDetailApi(id: number) { method: 'get', }); } - -// 使用ai分析-步骤确认/取消 -export function useAiAnalysisApi(id: number, stepId: number, params: {action: string}) { - return request({ - url: `/api/changes/${id}/steps/${stepId}/confirm`, - method: 'post', - data: params - }); -} diff --git a/src/service/api/plugin.ts b/src/service/api/plugin.ts index c2f9b0c..e791726 100644 --- a/src/service/api/plugin.ts +++ b/src/service/api/plugin.ts @@ -33,3 +33,36 @@ export function jsaSaveApi(change_id: number, data: any) { data, }); } + +// 获取风险预分析详情 +export function riskPreDetailApi(change_id: number) { + return request({ + url: `/api/changes/${change_id}/risk-summary`, + method: 'get', + }); +} + +// 风险预分析保存 +export function riskPreSaveApi(change_id: number, data: any) { + return request({ + url: `/api/changes/${change_id}/risk-summary`, + method: 'put', + data, + }); +} + +// 获取风险检查表详情 +export function riskCheckDetailApi(change_id: number) { + return request({ + url: `/api/changes/${change_id}/questionnaire`, + method: 'get', + }); +} +// 风险检查表保存 +export function riskCheckSaveApi(change_id: number, data: any) { + return request({ + url: `/api/changes/${change_id}/questionnaire`, + method: 'put', + data, + }); +} diff --git a/src/views/my/initiateChange/index.vue b/src/views/my/initiateChange/index.vue index df0fbce..33e485f 100644 --- a/src/views/my/initiateChange/index.vue +++ b/src/views/my/initiateChange/index.vue @@ -2,9 +2,10 @@ import { computed, nextTick, onMounted, provide, ref } from 'vue'; import { Icon } from '@iconify/vue' import { useThemeStore } from '@/store/modules/theme'; +import { useRoute } from 'vue-router'; import { getColorWithOpacity } from "@/utils/common"; import { localStg } from '@/utils/storage'; -import { queryUnsavedApi, saveChangeApi, submitChangeApi } from '@/service/api/change'; +import { queryUnsavedApi, saveChangeApi, submitChangeApi, getChangeDetailApi } from '@/service/api/change'; import { systemConfigApi, templateListApi, } from '@/service/api/system'; import { orgListApi } from '@/service/api/user'; import ChangePre from "./modules/changePre.vue"; @@ -16,6 +17,7 @@ import Evaluation from "./modules/evaluation.vue"; import CloseConfirm from "./modules/closeConfirm.vue"; const themeStore = useThemeStore(); +const route = useRoute(); const saveLoading = ref(false) const btnDisabled = ref(false); @@ -124,54 +126,6 @@ const confirmTab = (tab: string, val: boolean) => { confirmed.value[tab] = val; } -// 查询变更未保存数据 -const getId = async () => { - const {data,error} = await queryUnsavedApi(); - if(!error){ - currentId.value = data.id; - changeNo.value = data.change_no; - } -} -// 获取配置 -const getConfig = async () => { - const {data,error} = await systemConfigApi(); - if(!error){ - // 解析 变更类型设置 - const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); - if (changeTypeGroup) { - typeList.value = changeTypeGroup.items.map((item:any) => ({ - label: item.label, - value: Number(item.value), // 或者 parseInt(item.value, 10) - color: item.color - })); - } - // 解析 变更等级设置 - const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); - if (changeLevelGroup) { - levelList.value = changeLevelGroup.items.map((item:any) => ({ - label: item.label, - value: Number(item.value), // 或者 parseInt(item.value, 10) - color: item.color - })); - } - } -} -// 获取模板配置 -const getTemplateConfig = async () => { - const {data,error} = await templateListApi(); - if(!error){ - templateList.value = data; - } -} -// 获取组织列表 -const getOrgList = async () => { - const {data,error} = await orgListApi(); - if(!error){ - orgTree.value = data; - } -} - - // 获取所有表单数据 const getAllFormData = () => { let changePreForm = changePreRef.value?.form; @@ -259,7 +213,7 @@ const submitConfirm = async (type: string) => { } // 变更培训内容 if(type==='train'){ - if(form.content.trim() === ''){ + if(form.train.content.trim() === ''){ return window.$message?.warning('请填写培训内容'); } } @@ -269,11 +223,72 @@ const submitConfirm = async (type: string) => { } } +// 获取变更详情 +const getChangeDetail = async () => { + const {data,error} = await getChangeDetailApi(currentId.value); + if(!error){ + + } +} +// 查询变更未保存数据 +const getId = async () => { + const {data,error} = await queryUnsavedApi(); + if(!error){ + currentId.value = data.id; + changeNo.value = data.change_no; + } +} +// 获取配置 +const getConfig = async () => { + const {data,error} = await systemConfigApi(); + if(!error){ + // 解析 变更类型设置 + const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); + if (changeTypeGroup) { + typeList.value = changeTypeGroup.items.map((item:any) => ({ + label: item.label, + value: Number(item.value), // 或者 parseInt(item.value, 10) + color: item.color + })); + } + // 解析 变更等级设置 + const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); + if (changeLevelGroup) { + levelList.value = changeLevelGroup.items.map((item:any) => ({ + label: item.label, + value: Number(item.value), // 或者 parseInt(item.value, 10) + color: item.color + })); + } + } +} +// 获取模板配置 +const getTemplateConfig = async () => { + const {data,error} = await templateListApi(); + if(!error){ + templateList.value = data; + } +} +// 获取组织列表 +const getOrgList = async () => { + const {data,error} = await orgListApi(); + if(!error){ + orgTree.value = data; + } +} + onMounted(() => { getOrgList(); getConfig(); getTemplateConfig(); - getId(); + if(route.query && route.query.id){ + currentId.value = Number(route.query.id); + } + if(currentId.value){ + getChangeDetail(); + }else{ + getId(); + } }); diff --git a/src/views/my/initiateChange/modules/evaluation.vue b/src/views/my/initiateChange/modules/evaluation.vue index b9837a3..a26395a 100644 --- a/src/views/my/initiateChange/modules/evaluation.vue +++ b/src/views/my/initiateChange/modules/evaluation.vue @@ -11,6 +11,8 @@ const themeStore = useThemeStore(); const props = defineProps(['type','orgTree','isAiOpen','title','currentId','formInfo']) const emit = defineEmits(['save','submit','confirmTab']); +// 是否是ai生成 +const isAiGenerated = ref(false); const footerRef = ref(null); const editing = ref(null); const list = ref<{id:number,item:string,basis:string,standard:string,method:string,org_id:number}[]>([]); @@ -43,6 +45,7 @@ const onRegenerate = async () => { // 建议责任方文本 → 组织树节点(按名称模糊匹配,匹配不到留空人工选择) org_id: matchOrgId(r.owner_suggest), })); + isAiGenerated.value = true; window.$message?.success("验收量化标准已由 AI 生成,均可手动修改"); } catch (e: any) { aiFail(e); @@ -125,7 +128,7 @@ defineExpose({list, onRegenerate}) 验收评价(依据预期效果设定可量化验收标准) - + ✨ AI 生成 · 需人工确认 申请阶段由 AI 依据「预期效果」生成量化标准与验收方式,可手动修改;投用运行后由车间和各专业按标准验收并给出评估结论 diff --git a/src/views/my/initiateChange/modules/jsa.vue b/src/views/my/initiateChange/modules/jsa.vue index 90e268f..cef046a 100644 --- a/src/views/my/initiateChange/modules/jsa.vue +++ b/src/views/my/initiateChange/modules/jsa.vue @@ -423,7 +423,7 @@ onMounted(() => {

暂无作业步骤

- +
@@ -513,7 +513,7 @@ onMounted(() => { - -
操作 + { 增加 + (false); const uploadFileRef = ref(null); const isUploaded = ref(false); const editing = ref(null); +// 是否是ai生成 +const isAiGenerated = ref(false); const aiFail = (e: any) => { if (e instanceof AiError) window.$message?.warning(`AI 分析失败:${e.message},可手动填写`); @@ -65,6 +67,7 @@ const onRegenerate = async () => { })), }; }); + isAiGenerated.value = true; window.$message?.success("PSSR 检查清单已由 AI 生成,点击条目可直接编辑"); } catch (e: any) { aiFail(e); @@ -118,7 +121,7 @@ defineExpose({list, onRegenerate}) PSSR 投用前安全检查内容 - + ✨ AI 生成 · 需人工确认 diff --git a/src/views/my/initiateChange/modules/riskAnalysis.vue b/src/views/my/initiateChange/modules/riskAnalysis.vue index 329a3c3..f6ef21a 100644 --- a/src/views/my/initiateChange/modules/riskAnalysis.vue +++ b/src/views/my/initiateChange/modules/riskAnalysis.vue @@ -3,6 +3,7 @@ import { computed, onMounted, ref } from 'vue'; import { Icon } from '@iconify/vue' 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"; @@ -24,16 +25,16 @@ const pluginDone = computed(() => return acc; }, {} as Record) ); -const tools = ref(["HAZOP","JSA", "SCL", "RISK_CHECK"]); +const tools = ref(["RISK","HAZOP","JSA", "RISK_CHECK"]); const riskRecords = ref([]); const pluginDrawer = ref(false); const currentPlugin = ref(''); // 风险识别分析记录表 const TOOL_CARDS = [ + { key: "RISK", name: "风险预分析" }, { key: "HAZOP", name: "HAZOP 分析" }, { key: "JSA", name: "JSA 分析" }, - { key: "SCL", name: "设备 SCL" }, { key: "RISK_CHECK", name: "风险检查表" }, ]; @@ -160,12 +161,14 @@ const exportAll = (type: string, items: any[]) => { // 使用插件弹框 const usePlugin = (key: string) => { - console.log(riskRecords.value) currentPlugin.value = key; pluginDrawer.value = true; } // 关闭插件弹框 -const closePlugin = () => { +const closePlugin = (type: string = "", count: any = undefined) => { + if(type){ + pluginDone.value[type] = count; + } pluginDrawer.value = false; } @@ -218,7 +221,7 @@ onMounted(() => { {{ formInfo?.change_level === 2 ? '重要变更' : '一般变更' }} - {{ formInfo?.change_level === 2 ? '规则:HAZOP 必做,同时开展 JSA 与检查表法(SCL)' : '规则:JSA + 检查表法(SCL),涉及工艺安全边界的应升级 HAZOP' }} + {{ formInfo?.change_level === 2 ? '规则:HAZOP 必做,同时开展 JSA' : '规则:JSA,涉及工艺安全边界的应升级 HAZOP' }}
@@ -268,7 +271,7 @@ onMounted(() => { 尚无风险记录:调用上方插件完成分析后逐条「入表」,或点击「AI 自动整理」形成记录表
- +
@@ -283,13 +286,39 @@ onMounted(() => { - - - -
风险项
+ + +
+ + {{rec.risk_value}} + + + {{rec.risk_value}} + + + {{rec.risk_value}} + +
{
+ - + + +
+ + {{rec.residual_risk_value}} + + + {{rec.residual_risk_value}} + + + {{rec.residual_risk_value}} + +
{
- {{ rec.source }} + {{ rec.source==='RISK'?'风险预分析':rec.source }} 已转 PSSR @@ -400,17 +455,20 @@ onMounted(() => { + -