历史分析记录检索列表完成
This commit is contained in:
@@ -15,3 +15,12 @@ export function analysisRecordListApi(id:number) {
|
||||
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 { useThemeStore } from '@/store/modules/theme';
|
||||
import { useRouterPush } from '@/hooks/common/router';
|
||||
import { systemConfigApi } from '@/service/api/system';
|
||||
import { orgListApi } from '@/service/api/user';
|
||||
import { highRiskListApi } from '@/service/api/highRisk';
|
||||
import { historyAnalysisListApi } from '@/service/api/highRisk';
|
||||
|
||||
const themeStore = useThemeStore();
|
||||
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) => {
|
||||
window.$message?.info(`演示:在线查看 ${id} 完整分析记录`)
|
||||
@@ -32,58 +18,48 @@ const copyHistory = (id: string) => {
|
||||
}
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
// 组织树
|
||||
const orgTree = ref<any[]>([]);
|
||||
// 筛选条件
|
||||
const formInfo = ref<any>({
|
||||
kw: '',
|
||||
org_id: 1,
|
||||
from: null,
|
||||
to: null,
|
||||
});
|
||||
const pagination = ref<{page: number, pageSize: number, itemCount: number}>({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
itemCount: 0,
|
||||
})
|
||||
// 变更类型列表
|
||||
const typeList = ref<any[]>([{ label: "全部", value: null }]);
|
||||
// 变更等级列表
|
||||
const levelList = ref<any[]>([{ label: "全部", value: null }]);
|
||||
// 搜索关键词
|
||||
const keyword = ref<string>("");
|
||||
// 插件筛选
|
||||
const plugin = ref<string>("");
|
||||
// 插件列表
|
||||
const pluginList = ref<any[]>([
|
||||
{ label: "全部", value: '' },
|
||||
{ label: "风险预分析", value: 'RISK' },
|
||||
{ label: "HAZOP", value: 'HAZOP' },
|
||||
{ label: "FMEA", value: 'FMEA' },
|
||||
{ label: "风险检查表", value: 'RISK_CHECK' },
|
||||
]);
|
||||
const list = ref<any[]>([]);
|
||||
|
||||
// 插件筛选
|
||||
const pluginChange = (v: string) => {
|
||||
plugin.value = v;
|
||||
getList();
|
||||
}
|
||||
// 重置
|
||||
const reset = () => {
|
||||
keyword.value = '';
|
||||
plugin.value = '';
|
||||
getList();
|
||||
};
|
||||
|
||||
// 获取列表
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const {data,error} = await highRiskListApi({
|
||||
kw: formInfo.value.kw,
|
||||
org_id: formInfo.value.org_id,
|
||||
from: formInfo.value.from,
|
||||
to: formInfo.value.to,
|
||||
page_num: pagination.value.page,
|
||||
page_size: pagination.value.pageSize,
|
||||
const {data,error} = await historyAnalysisListApi({
|
||||
kw: keyword.value,
|
||||
method: plugin.value,
|
||||
});
|
||||
if(!error){
|
||||
list.value = data?.list ?? [];
|
||||
pagination.value.itemCount = data?.total ?? 0;
|
||||
console.log(data);
|
||||
list.value = data ?? [];
|
||||
}
|
||||
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(() => {
|
||||
tabChange('history');
|
||||
getList();
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -97,23 +73,26 @@ onMounted(() => {
|
||||
<p class="text-base font-semibold">历史分析记录检索(企业风险知识资产)</p>
|
||||
</div>
|
||||
<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>
|
||||
<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>
|
||||
</NInput>
|
||||
<NButton size="small" class="text-sm" @click="reset">
|
||||
<Icon icon="system-uicons:reset" class="size-12px" />重置
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4 mb-3 flex flex-wrap items-center gap-1.5">
|
||||
<NButton
|
||||
size="tiny"
|
||||
round
|
||||
v-for="m in ['全部', 'HAZOP', 'JSA', '检查表', 'AI 预分析']"
|
||||
:key="m"
|
||||
:type="method === m ? 'primary' : 'default'"
|
||||
@click="method = m"
|
||||
v-for="p in pluginList"
|
||||
:key="p.value"
|
||||
:type="plugin === p.value ? 'primary' : 'default'"
|
||||
@click="pluginChange(p.value)"
|
||||
>
|
||||
{{ m }}
|
||||
{{ p.label }}
|
||||
</NButton>
|
||||
<span class="ml-auto self-center text-[11px] text-slate-400">{{ list.length }} 条记录</span>
|
||||
</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 class="min-w-0 flex-1">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="font-mono text-[11px] text-slate-400">{{ h.id }}</span>
|
||||
<NTag type="info" size="small">{{ h.method }}</NTag>
|
||||
<span class="text-sm text-slate-800">{{ h.change }}</span>
|
||||
<span class="font-mono text-[11px] text-slate-400">{{ h.change_no }}</span>
|
||||
<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.title }}</span>
|
||||
</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>
|
||||
<NButton text type="primary" @click="viewHistory(h.id)">
|
||||
<Icon icon="lucide:eye" class="size-16px" />
|
||||
@@ -142,7 +121,7 @@ onMounted(() => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.scroll {
|
||||
height: calc(100vh - 303px);
|
||||
height: calc(100vh - 305px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Icon } from '@iconify/vue'
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { useRouterPush } from '@/hooks/common/router';
|
||||
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 { highRiskListApi } from '@/service/api/highRisk';
|
||||
|
||||
@@ -59,10 +59,6 @@ const pagination = ref<{page: number, pageSize: number, itemCount: number}>({
|
||||
pageSize: 20,
|
||||
itemCount: 0,
|
||||
})
|
||||
// 变更类型列表
|
||||
const typeList = ref<any[]>([{ label: "全部", value: null }]);
|
||||
// 变更等级列表
|
||||
const levelList = ref<any[]>([{ label: "全部", value: null }]);
|
||||
|
||||
// 自定义渲染展开图标
|
||||
const renderSwitcherIcon = (node:any) => {
|
||||
@@ -129,30 +125,12 @@ const getList = async () => {
|
||||
});
|
||||
if(!error){
|
||||
list.value = data?.list ?? [];
|
||||
console.log(list.value);
|
||||
pagination.value.itemCount = data?.total ?? 0;
|
||||
}
|
||||
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 () => {
|
||||
loading.value = true;
|
||||
const {data,error} = await orgListApi();
|
||||
@@ -185,7 +163,6 @@ const matchRiskLevel = (configList:any,name: string) => {
|
||||
|
||||
onMounted(async () => {
|
||||
matrixConfig();
|
||||
await getConfig();
|
||||
getOrgList();
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user