历史分析记录检索列表完成
This commit is contained in:
@@ -15,3 +15,12 @@ export function analysisRecordListApi(id:number) {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 历史分析检索
|
||||||
|
export function historyAnalysisListApi(params:{kw:string,method:string}) {
|
||||||
|
return request({
|
||||||
|
url: `/api/analysis-records/search`,
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,25 +3,11 @@ import { ref, computed, onMounted } from 'vue';
|
|||||||
import { Icon } from '@iconify/vue'
|
import { Icon } from '@iconify/vue'
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { useRouterPush } from '@/hooks/common/router';
|
import { useRouterPush } from '@/hooks/common/router';
|
||||||
import { systemConfigApi } from '@/service/api/system';
|
import { historyAnalysisListApi } from '@/service/api/highRisk';
|
||||||
import { orgListApi } from '@/service/api/user';
|
|
||||||
import { highRiskListApi } from '@/service/api/highRisk';
|
|
||||||
|
|
||||||
const themeStore = useThemeStore();
|
const themeStore = useThemeStore();
|
||||||
const { routerPushByKey } = useRouterPush();
|
const { routerPushByKey } = useRouterPush();
|
||||||
|
|
||||||
const keyword = ref<string>("");
|
|
||||||
const currentTab = ref<string>("history");
|
|
||||||
const method = ref<string>("全部");
|
|
||||||
const list = ref<any[]>([]);
|
|
||||||
const historyList = [
|
|
||||||
{ id: "HAZOP-2025-018", change: "MOC-2025-R01-0023 常压炉燃料气切断阀改造", method: "HAZOP", unit: "01-常减压装置", scope: "燃料气系统节点", rows: 12, date: "2025-10-20" },
|
|
||||||
{ id: "HAZOP-2024-006", change: "MOC-2024-R01-0003 减一线换热器 E-108 芯子更换", method: "HAZOP", unit: "01-常减压装置", scope: "换热系统节点", rows: 8, date: "2024-03-15" },
|
|
||||||
{ id: "JSA-2025-041", change: "MOC-2025-R02-0014 再生器旋风分离器更换", method: "JSA", unit: "02-催化裂化装置", scope: "受限空间作业", rows: 6, date: "2025-05-08" },
|
|
||||||
{ id: "JSA-2026-012", change: "MOC-2026-R01-0035 搅拌电机更换", method: "JSA", unit: "01-常减压装置", scope: "检维修作业", rows: 5, date: "2026-07-29" },
|
|
||||||
{ id: "SCL-2025-033", change: "MOC-2025-R02-0021 气压机出口压力联锁逻辑修改", method: "检查表", unit: "02-催化裂化装置", scope: "联锁系统", rows: 14, date: "2025-09-18" },
|
|
||||||
{ id: "AI-2026-008", change: "MOC-2026-R03-0008 聚合釜搅拌器密封形式变更", method: "AI 预分析", unit: "03-聚合装置", scope: "—", rows: 4, date: "2026-05-06" },
|
|
||||||
];
|
|
||||||
// 查看历史分析检索
|
// 查看历史分析检索
|
||||||
const viewHistory = (id: string) => {
|
const viewHistory = (id: string) => {
|
||||||
window.$message?.info(`演示:在线查看 ${id} 完整分析记录`)
|
window.$message?.info(`演示:在线查看 ${id} 完整分析记录`)
|
||||||
@@ -32,58 +18,48 @@ const copyHistory = (id: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
// 组织树
|
// 搜索关键词
|
||||||
const orgTree = ref<any[]>([]);
|
const keyword = ref<string>("");
|
||||||
// 筛选条件
|
// 插件筛选
|
||||||
const formInfo = ref<any>({
|
const plugin = ref<string>("");
|
||||||
kw: '',
|
// 插件列表
|
||||||
org_id: 1,
|
const pluginList = ref<any[]>([
|
||||||
from: null,
|
{ label: "全部", value: '' },
|
||||||
to: null,
|
{ label: "风险预分析", value: 'RISK' },
|
||||||
});
|
{ label: "HAZOP", value: 'HAZOP' },
|
||||||
const pagination = ref<{page: number, pageSize: number, itemCount: number}>({
|
{ label: "FMEA", value: 'FMEA' },
|
||||||
page: 1,
|
{ label: "风险检查表", value: 'RISK_CHECK' },
|
||||||
pageSize: 20,
|
]);
|
||||||
itemCount: 0,
|
const list = ref<any[]>([]);
|
||||||
})
|
|
||||||
// 变更类型列表
|
// 插件筛选
|
||||||
const typeList = ref<any[]>([{ label: "全部", value: null }]);
|
const pluginChange = (v: string) => {
|
||||||
// 变更等级列表
|
plugin.value = v;
|
||||||
const levelList = ref<any[]>([{ label: "全部", value: null }]);
|
getList();
|
||||||
|
}
|
||||||
|
// 重置
|
||||||
|
const reset = () => {
|
||||||
|
keyword.value = '';
|
||||||
|
plugin.value = '';
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
// 获取列表
|
// 获取列表
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const {data,error} = await highRiskListApi({
|
const {data,error} = await historyAnalysisListApi({
|
||||||
kw: formInfo.value.kw,
|
kw: keyword.value,
|
||||||
org_id: formInfo.value.org_id,
|
method: plugin.value,
|
||||||
from: formInfo.value.from,
|
|
||||||
to: formInfo.value.to,
|
|
||||||
page_num: pagination.value.page,
|
|
||||||
page_size: pagination.value.pageSize,
|
|
||||||
});
|
});
|
||||||
if(!error){
|
if(!error){
|
||||||
list.value = data?.list ?? [];
|
console.log(data);
|
||||||
pagination.value.itemCount = data?.total ?? 0;
|
list.value = data ?? [];
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换tab
|
|
||||||
const tabChange = async (k: string) => {
|
|
||||||
list.value = []
|
|
||||||
currentTab.value = k;
|
|
||||||
loading.value = true;
|
|
||||||
if(k === 'history'){
|
|
||||||
setTimeout(() => {
|
|
||||||
list.value = historyList;
|
|
||||||
loading.value = false;
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tabChange('history');
|
getList();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -97,23 +73,26 @@ onMounted(() => {
|
|||||||
<p class="text-base font-semibold">历史分析记录检索(企业风险知识资产)</p>
|
<p class="text-base font-semibold">历史分析记录检索(企业风险知识资产)</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2 min-h-28px">
|
<div class="flex items-center gap-2 min-h-28px">
|
||||||
<NInput v-model:value="keyword" size="small" class="text-xs !w-200px" placeholder="按单号 / 装置 / 关键词检索…">
|
<NInput v-model:value="keyword" size="small" class="text-xs !w-200px" clearable placeholder="按单号 / 装置 / 关键词检索…" @clear="keyword = ''; getList()">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<Icon icon="akar-icons:search" class="size-14px text-slate-400 cursor-pointer" />
|
<Icon icon="akar-icons:search" class="size-14px text-slate-400 cursor-pointer" @click="getList" />
|
||||||
</template>
|
</template>
|
||||||
</NInput>
|
</NInput>
|
||||||
|
<NButton size="small" class="text-sm" @click="reset">
|
||||||
|
<Icon icon="system-uicons:reset" class="size-12px" />重置
|
||||||
|
</NButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 mb-3 flex flex-wrap items-center gap-1.5">
|
<div class="px-4 mb-3 flex flex-wrap items-center gap-1.5">
|
||||||
<NButton
|
<NButton
|
||||||
size="tiny"
|
size="tiny"
|
||||||
round
|
round
|
||||||
v-for="m in ['全部', 'HAZOP', 'JSA', '检查表', 'AI 预分析']"
|
v-for="p in pluginList"
|
||||||
:key="m"
|
:key="p.value"
|
||||||
:type="method === m ? 'primary' : 'default'"
|
:type="plugin === p.value ? 'primary' : 'default'"
|
||||||
@click="method = m"
|
@click="pluginChange(p.value)"
|
||||||
>
|
>
|
||||||
{{ m }}
|
{{ p.label }}
|
||||||
</NButton>
|
</NButton>
|
||||||
<span class="ml-auto self-center text-[11px] text-slate-400">{{ list.length }} 条记录</span>
|
<span class="ml-auto self-center text-[11px] text-slate-400">{{ list.length }} 条记录</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -122,11 +101,11 @@ onMounted(() => {
|
|||||||
<div v-for="h in list" :key="h.id" class="flex flex-wrap items-center gap-3 rounded-lg border px-4 py-2.5">
|
<div v-for="h in list" :key="h.id" class="flex flex-wrap items-center gap-3 rounded-lg border px-4 py-2.5">
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<span class="font-mono text-[11px] text-slate-400">{{ h.id }}</span>
|
<span class="font-mono text-[11px] text-slate-400">{{ h.change_no }}</span>
|
||||||
<NTag type="info" size="small">{{ h.method }}</NTag>
|
<NTag size="small" type="info" class="text-11px">{{ h.method==='RISK'?'风险预分析':h.method==='RISK_CHECK'?'风险检查': h.method }}</NTag>
|
||||||
<span class="text-sm text-slate-800">{{ h.change }}</span>
|
<span class="text-sm text-slate-800">{{ h.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-0.5 text-xs text-slate-500">{{ h.unit }} · 范围:{{ h.scope }} · {{ h.rows }} 行分析记录 · {{ h.date }}</div>
|
<div class="mt-1 text-xs text-slate-500">{{ h.org_name }} · {{ h.rows }} 行分析记录 · {{ h?.analysis_time?.slice(0,10) || '' }}</div>
|
||||||
</div>
|
</div>
|
||||||
<NButton text type="primary" @click="viewHistory(h.id)">
|
<NButton text type="primary" @click="viewHistory(h.id)">
|
||||||
<Icon icon="lucide:eye" class="size-16px" />
|
<Icon icon="lucide:eye" class="size-16px" />
|
||||||
@@ -142,7 +121,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.scroll {
|
.scroll {
|
||||||
height: calc(100vh - 303px);
|
height: calc(100vh - 305px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Icon } from '@iconify/vue'
|
|||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { useRouterPush } from '@/hooks/common/router';
|
import { useRouterPush } from '@/hooks/common/router';
|
||||||
import { getTimeRangeStamp, formatTimestamp } from '@/utils/common';
|
import { getTimeRangeStamp, formatTimestamp } from '@/utils/common';
|
||||||
import { systemConfigApi, matrixConfigApi } from '@/service/api/system';
|
import { matrixConfigApi } from '@/service/api/system';
|
||||||
import { orgListApi } from '@/service/api/user';
|
import { orgListApi } from '@/service/api/user';
|
||||||
import { highRiskListApi } from '@/service/api/highRisk';
|
import { highRiskListApi } from '@/service/api/highRisk';
|
||||||
|
|
||||||
@@ -59,10 +59,6 @@ const pagination = ref<{page: number, pageSize: number, itemCount: number}>({
|
|||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
itemCount: 0,
|
itemCount: 0,
|
||||||
})
|
})
|
||||||
// 变更类型列表
|
|
||||||
const typeList = ref<any[]>([{ label: "全部", value: null }]);
|
|
||||||
// 变更等级列表
|
|
||||||
const levelList = ref<any[]>([{ label: "全部", value: null }]);
|
|
||||||
|
|
||||||
// 自定义渲染展开图标
|
// 自定义渲染展开图标
|
||||||
const renderSwitcherIcon = (node:any) => {
|
const renderSwitcherIcon = (node:any) => {
|
||||||
@@ -129,30 +125,12 @@ const getList = async () => {
|
|||||||
});
|
});
|
||||||
if(!error){
|
if(!error){
|
||||||
list.value = data?.list ?? [];
|
list.value = data?.list ?? [];
|
||||||
console.log(list.value);
|
|
||||||
pagination.value.itemCount = data?.total ?? 0;
|
pagination.value.itemCount = data?.total ?? 0;
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取配置
|
// 获取组织列表
|
||||||
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 = typeList.value.concat(changeTypeGroup.items);
|
|
||||||
}
|
|
||||||
// 解析 变更等级设置
|
|
||||||
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
|
|
||||||
if (changeLevelGroup) {
|
|
||||||
levelList.value = levelList.value.concat(changeLevelGroup.items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// // 获取组织列表
|
|
||||||
const getOrgList = async () => {
|
const getOrgList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const {data,error} = await orgListApi();
|
const {data,error} = await orgListApi();
|
||||||
@@ -185,7 +163,6 @@ const matchRiskLevel = (configList:any,name: string) => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
matrixConfig();
|
matrixConfig();
|
||||||
await getConfig();
|
|
||||||
getOrgList();
|
getOrgList();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user