发起变更草稿保存修改
This commit is contained in:
@@ -56,7 +56,6 @@ const form = ref<{
|
||||
materials: string,
|
||||
update_docs: string[],
|
||||
disciplines: string[],
|
||||
manage_dept: string,
|
||||
plan_use_date: number | null,
|
||||
risk_tools: string[],
|
||||
}>({
|
||||
@@ -73,7 +72,6 @@ const form = ref<{
|
||||
materials: '',
|
||||
update_docs: [],
|
||||
disciplines: [],
|
||||
manage_dept: '',
|
||||
plan_use_date: null,
|
||||
risk_tools: [],
|
||||
});
|
||||
@@ -92,9 +90,11 @@ const RISK_TOOLS_FORM = [
|
||||
{ key: "SCL", label: "设备SCL" },
|
||||
{ key: "RISK_CHECK", label: "风险检查表" },
|
||||
];
|
||||
const LEVEL_DIMS = ref([
|
||||
const questions = ref<any>([
|
||||
{
|
||||
name: "1. 设备影响", note: "不合适的材质将会导致",
|
||||
question_id: 1,
|
||||
name: "1. 设备影响",
|
||||
note: "不合适的材质将会导致",
|
||||
score: 0,
|
||||
options: [
|
||||
{ label: "对设备带来一定的损害及腐蚀", score: 1 },
|
||||
@@ -104,7 +104,9 @@ const LEVEL_DIMS = ref([
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "2. 财务影响", note: "工艺设计错误将会导致",
|
||||
question_id: 2,
|
||||
name: "2. 财务影响",
|
||||
note: "工艺设计错误将会导致",
|
||||
score: 0,
|
||||
options: [
|
||||
{ label: "一定损失,a<1万人民币", score: 1 },
|
||||
@@ -114,7 +116,9 @@ const LEVEL_DIMS = ref([
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "3. 质量影响", note: "",
|
||||
question_id: 3,
|
||||
name: "3. 质量影响",
|
||||
note: "",
|
||||
score: 0,
|
||||
options: [
|
||||
{ label: "对质量带来一定的风险(非关键工席、非关键设备设施的变更)", score: 1 },
|
||||
@@ -124,7 +128,9 @@ const LEVEL_DIMS = ref([
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "4. 设计的复杂程度", note: "工艺设计包含了",
|
||||
question_id: 4,
|
||||
name: "4. 设计的复杂程度",
|
||||
note: "工艺设计包含了",
|
||||
score: 0,
|
||||
options: [
|
||||
{ label: "少量的简单系统(单个设备或单个部件)", score: 1 },
|
||||
@@ -134,7 +140,9 @@ const LEVEL_DIMS = ref([
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "5. 工艺设计的成熟度", note: "",
|
||||
question_id: 5,
|
||||
name: "5. 工艺设计的成熟度",
|
||||
note: "",
|
||||
score: 0,
|
||||
options: [
|
||||
{ label: "被频繁使用,且被证明为专利方设计", score: 1 },
|
||||
@@ -144,7 +152,9 @@ const LEVEL_DIMS = ref([
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "6. 工艺危害", note: "物料性质和工艺条件",
|
||||
question_id: 6,
|
||||
name: "6. 工艺危害",
|
||||
note: "物料性质和工艺条件",
|
||||
score: 0,
|
||||
options: [
|
||||
{ label: "无危害(常压、-10℃≤温度<40℃、无毒、无腐蚀不燃)", score: 1 },
|
||||
@@ -250,14 +260,14 @@ const useAiLevel = async () => {
|
||||
if (levelAiLoading.value) return;
|
||||
levelAiLoading.value = true;
|
||||
try {
|
||||
const dims = LEVEL_DIMS.value.map((d:any, i:any) => ({ dim: `DIM_${i + 1}`, name: d.name, max: Math.max(...d.options.map((o:any) => o.score)) }));
|
||||
const dims = questions.value.map((d:any, i:any) => ({ dim: `DIM_${i + 1}`, name: d.name, max: Math.max(...d.options.map((o:any) => o.score)) }));
|
||||
const res = await aiLevelScore(form.description, (form.compare_rows ?? []).map((x: any) => ({ item: x.item, before_text: x.before_text, after_text: x.after_text })), dims);
|
||||
// 重新评分前清零,避免多次点击分数累加
|
||||
totalScore.value = 0;
|
||||
levelAiBasis.value = [];
|
||||
res?.dims?.forEach((d, i) => {
|
||||
totalScore.value += d.score ?? 0;
|
||||
LEVEL_DIMS.value[i].score = d.score ?? 0;
|
||||
questions.value[i].score = d.score ?? 0;
|
||||
levelAiBasis.value[i] = d.basis ?? "";
|
||||
});
|
||||
levelAiText.value = res?.analysis_text ?? "";
|
||||
@@ -316,9 +326,9 @@ const onRegenerate = async () => {
|
||||
}
|
||||
// 处理等级判定表评分变化
|
||||
const handleScoreChange = (val:number,index:number) => {
|
||||
LEVEL_DIMS.value[index].score = val;
|
||||
questions.value[index].score = val;
|
||||
let score = 0;
|
||||
LEVEL_DIMS.value.forEach((d:any) => {
|
||||
questions.value.forEach((d:any) => {
|
||||
score += d.score;
|
||||
});
|
||||
totalScore.value = score;
|
||||
@@ -398,7 +408,7 @@ const confirmTab = (tab:string, val:boolean) => {
|
||||
emit('confirmTab', tab, val);
|
||||
}
|
||||
|
||||
defineExpose({form, applyAiResult, generateLevel: useAiLevel})
|
||||
defineExpose({form, questions, applyAiResult, generateLevel: useAiLevel})
|
||||
|
||||
</script>
|
||||
|
||||
@@ -727,16 +737,16 @@ defineExpose({form, applyAiResult, generateLevel: useAiLevel})
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid gap-3 grid-cols-2">
|
||||
<div v-for="(dim, di) in LEVEL_DIMS" :key="dim.name" class="rounded-lg border p-3">
|
||||
<div v-for="(dim, di) in questions" :key="dim.name" class="rounded-lg border p-3">
|
||||
<div class="mb-2 flex items-baseline justify-between gap-2">
|
||||
<span class="text-sm font-semibold text-slate-700">
|
||||
{{ dim.name }}
|
||||
<span v-if="dim.note" class="ml-1 text-xs font-normal text-slate-400">({{ dim.note }})</span>
|
||||
</span>
|
||||
<span class="text-sm text-slate-500">得分 <b class="text-[#17407F]">{{ LEVEL_DIMS[di].score }}</b></span>
|
||||
<span class="text-sm text-slate-500">得分 <b class="text-[#17407F]">{{ questions[di].score }}</b></span>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<NRadioGroup v-model:value="LEVEL_DIMS[di].score" size="small" :disabled="levelAiLoading" name="radiogroup" :on-update:value="(v)=>handleScoreChange(v,di)">
|
||||
<NRadioGroup v-model:value="questions[di].score" size="small" :disabled="levelAiLoading" name="radiogroup" :on-update:value="(v)=>handleScoreChange(v,di)">
|
||||
<div class="flex flex-col justify-center gap-2">
|
||||
<NRadio v-for="op in dim.options" :key="op.score" :value="op.score">
|
||||
<p class="text-xs">{{ op.label }}({{ op.score }}分)</p>
|
||||
@@ -756,7 +766,7 @@ defineExpose({form, applyAiResult, generateLevel: useAiLevel})
|
||||
</div>
|
||||
<div class="mt-2 space-y-3 text-xs leading-relaxed text-slate-600">
|
||||
<p v-if="levelAiText">{{ levelAiText }}</p>
|
||||
<p v-for="(dim, di) in LEVEL_DIMS" :key="dim.name">
|
||||
<p v-for="(dim, di) in questions" :key="dim.name">
|
||||
<template v-if="levelAiBasis[di]"><b class="text-[#17407F]">{{ dim.name }}:</b>{{ levelAiBasis[di] }}</template>
|
||||
</p>
|
||||
<p class="text-slate-400">(各维度得分均可人工改判,修改留痕;改判后等级自动回填至申请表)</p>
|
||||
|
||||
Reference in New Issue
Block a user