From 467952583ba2b6486c5469beda659a234db26462 Mon Sep 17 00:00:00 2001 From: bestlee Date: Wed, 23 Sep 2026 15:24:49 +0800 Subject: [PATCH] =?UTF-8?q?pssr=E7=9B=91=E7=9D=A3=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/api/pssr.ts | 10 ++ src/utils/common.ts | 7 + src/views/my/pssr/index.vue | 314 +++++++++++++++++------------------- 3 files changed, 165 insertions(+), 166 deletions(-) create mode 100644 src/service/api/pssr.ts diff --git a/src/service/api/pssr.ts b/src/service/api/pssr.ts new file mode 100644 index 0000000..98d3e8b --- /dev/null +++ b/src/service/api/pssr.ts @@ -0,0 +1,10 @@ +import { request } from '../request'; + +// 列表 +export function pssrListApi(params: {page_num: number, page_size: number,kw: string,is_close: number,from: string | null,to: string | null}) { + return request({ + url: `/api/pssr/supervise`, + method: 'get', + params + }); +} \ No newline at end of file diff --git a/src/utils/common.ts b/src/utils/common.ts index aab50f4..97ad5fd 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -204,6 +204,13 @@ export function getTimeRangeStamp(timeRange: string){ if(!endTime) { return null; } + // 近7天 + if(timeRange === 'week'){ + return { + from: endTime - (7 * 24 * 60 * 60 * 1000), + to: endTime + } + } // 近一个月 if(timeRange === 'month'){ return { diff --git a/src/views/my/pssr/index.vue b/src/views/my/pssr/index.vue index c040fbe..cdb4dcd 100644 --- a/src/views/my/pssr/index.vue +++ b/src/views/my/pssr/index.vue @@ -4,144 +4,112 @@ import { ref, onMounted } from 'vue'; import { Icon } from '@iconify/vue' import { useThemeStore } from '@/store/modules/theme'; import { useRouterPush } from '@/hooks/common/router'; +import { formatTimestamp, getTimeRangeStamp, downloadFileFun } from '@/utils/common'; +import { pssrListApi } from '@/service/api/pssr'; const themeStore = useThemeStore(); const { routerPushByKey } = useRouterPush(); const loading = ref(false); -const keyword = ref(""); -const openCount = ref(4); -const closedCount = ref(2); -const currentTab = ref("open"); -const range = ref("全部时间"); +// 附件在线预览弹窗 +const previewModal = ref(false); +// 附件在线预览文件 +const previewFile = ref(null); +// 未关闭数量 +const openCount = ref(0); +// 已关闭数量 +const closedCount = ref(0); +const formInfo = ref<{from: number | null,to: number | null,kw: string,is_close: number }>({ + from: null, + to: null, + kw: "", + is_close: 0, +}); +const pagination = ref<{page: number, pageSize: number, itemCount: number}>({ + page: 1, + pageSize: 20, + itemCount: 0, +}) +const range = ref(''); +const timeRange = ref<{label: string,value: string}[]>([ + {label: '全部时间', value: ''}, + {label: '最近7天', value: 'week'}, + {label: '最近30天', value: 'month'}, + {label: '最近90天', value: 'quarter'}, +]); const list = ref([]); -const openList = [ - { - id: "MOC-2026-R02-0038",statusDetail: "培训 / PSSR 资料已传 · 待确认投用", - dept: "一车间", planUse: "2026-07-31", applicant: "吴强", - title: 'DCS 罐区液位报警值 LIA-301 调整', status: '待PSSR', - pssr: "PSSR 检查确认表-签字版.pdf",hasChange: true, - }, - { - id: "MOC-2026-R01-0039",statusDetail: "待关闭确认(资料更新核查中)", - dept: "一车间", planUse: "2026-07-16(已投用)", applicant: "张工艺", - title: 'V-102 安全阀起跳压力临时调整(紧急补办)', status: '待关闭', - pssr: "",hasChange: true, - }, - { - id: "MOC-2026-R03-0040",statusDetail: "实施准备中 · 培训 / PSSR 资料待上传", - dept: "供应部", planUse: "2026-08-01", applicant: "刘芳", - title: '原料环己烷供应商变更(新增 B 供应商)', status: '实施中', - pssr: "",hasChange: true, - }, - { - id: "MOC-2026-R02-0031",statusDetail: "变更验收(72h 运行验证)", - dept: "二车间", planUse: "2026-07-15", applicant: "周涛", - title: '冷冻盐水泵 P-103 叶轮材质变更', status: '待验收', - pssr: "PSSR 检查确认表-签字版.pdf",hasChange: false, - }, - { - id: "MOC-2026-R02-0038",statusDetail: "培训 / PSSR 资料已传 · 待确认投用", - dept: "一车间", planUse: "2026-07-31", applicant: "吴强", - title: 'DCS 罐区液位报警值 LIA-301 调整', status: '待PSSR', - pssr: "PSSR 检查确认表-签字版.pdf",hasChange: true, - }, - { - id: "MOC-2026-R01-0039",statusDetail: "待关闭确认(资料更新核查中)", - dept: "一车间", planUse: "2026-07-16(已投用)", applicant: "张工艺", - title: 'V-102 安全阀起跳压力临时调整(紧急补办)', status: '待关闭', - pssr: "",hasChange: true, - }, - { - id: "MOC-2026-R03-0040",statusDetail: "实施准备中 · 培训 / PSSR 资料待上传", - dept: "供应部", planUse: "2026-08-01", applicant: "刘芳", - title: '原料环己烷供应商变更(新增 B 供应商)', status: '实施中', - pssr: "",hasChange: true, - }, - { - id: "MOC-2026-R02-0031",statusDetail: "变更验收(72h 运行验证)", - dept: "二车间", planUse: "2026-07-15", applicant: "周涛", - title: '冷冻盐水泵 P-103 叶轮材质变更', status: '待验收', - pssr: "PSSR 检查确认表-签字版.pdf",hasChange: false, - }, - { - id: "MOC-2026-R02-0038",statusDetail: "培训 / PSSR 资料已传 · 待确认投用", - dept: "一车间", planUse: "2026-07-31", applicant: "吴强", - title: 'DCS 罐区液位报警值 LIA-301 调整', status: '待PSSR', - pssr: "PSSR 检查确认表-签字版.pdf",hasChange: true, - }, - { - id: "MOC-2026-R01-0039",statusDetail: "待关闭确认(资料更新核查中)", - dept: "一车间", planUse: "2026-07-16(已投用)", applicant: "张工艺", - title: 'V-102 安全阀起跳压力临时调整(紧急补办)', status: '待关闭', - pssr: "",hasChange: true, - }, - { - id: "MOC-2026-R03-0040",statusDetail: "实施准备中 · 培训 / PSSR 资料待上传", - dept: "供应部", planUse: "2026-08-01", applicant: "刘芳", - title: '原料环己烷供应商变更(新增 B 供应商)', status: '实施中', - pssr: "",hasChange: true, - }, - { - id: "MOC-2026-R02-0031",statusDetail: "变更验收(72h 运行验证)", - dept: "二车间", planUse: "2026-07-15", applicant: "周涛", - title: '冷冻盐水泵 P-103 叶轮材质变更', status: '待验收', - pssr: "PSSR 检查确认表-签字版.pdf",hasChange: false, - }, -]; -const closedList = [ - { - id: "MOC-2026-R03-0027",statusDetail: "关闭确认完成,已归档", - dept: "质量部", planUse: "2026-06-25", applicant: "陈静", - title: '化验室通风橱整体更换', status: '已关闭', - pssr: "PSSR 检查确认表-归档版.pdf" - }, - { - id: "MOC-2026-R01-0024",statusDetail: "关闭确认完成,已归档", - dept: "一车间", planUse: "2026-06-20", applicant: "孙丽", - title: '氮气管网压力分级调整', status: '已关闭', - pssr: "PSSR 检查确认表-归档版.pdf" - }, -]; +// 搜索 +const searchHandle = () => { + pagination.value.page = 1; + getList(); +} // 切换tab -const tabChange = (k: string) => { +const tabChange = (k: number) => { list.value = [] - currentTab.value = k; - loading.value = true; - if(k === 'open'){ - setTimeout(() => { - list.value = openList; - loading.value = false; - }, 1000); - } - if(k === 'closed'){ - setTimeout(() => { - list.value = closedList; - loading.value = false; - }, 1000); + formInfo.value.is_close = k; + searchHandle(); +} +// 切换时间范围 +const timeRangeChange = (timeRange: string) => { + range.value = timeRange; + if(timeRange === ''){ + formInfo.value.from = null; + formInfo.value.to = null; + }else{ + formInfo.value.from = getTimeRangeStamp(timeRange)?.from || null; + formInfo.value.to = getTimeRangeStamp(timeRange)?.to || null; } + searchHandle(); } // 查看 -const viewFile = (record: any) => { - window.$message?.info(`预览「${record.pssr}」(上传件不做内容识别,原件已随单归档)`) +const viewFile = (file: any) => { + previewFile.value = file; + previewModal.value = true; }; // 下载 -const downloadFile = (record: any) => { - window.$message?.success(`下载「${record.pssr}」`) +const downloadFile = (file: any) => { + downloadFileFun(file.file_url, file.file_name); }; // 下载模板 const downloadTemplate = (record: any) => { - window.$message?.success(`下载 PSSR 确认表空白模板(打印后线下签署)`) + window.$message?.info('还差接口') }; // 打开变更单 -const openChange = (record: any) => { - routerPushByKey('details_index', { query: { params: JSON.stringify(record) } }) +const openChange = (r: any) => { + routerPushByKey("details_index",{ query: { id: r?.id?.toString(),status:r?.status?.toString() || '',key:'my_pssr' } }); }; +// 分页改变 +const pageChange = (page: number) => { + pagination.value.page = page; + getList(); +} + +// 获取列表 +const getList = async () => { + if(loading.value) return; + loading.value = true; + const {data,error} = await pssrListApi({ + page_num: pagination.value.page, + page_size: pagination.value.pageSize, + kw: formInfo.value.kw, + is_close: formInfo.value.is_close, + from: formatTimestamp(formInfo.value.from, 'yyyy-MM-dd'), + to: formatTimestamp(formInfo.value.to, 'yyyy-MM-dd'), + }); + if(!error){ + list.value = data?.list || []; + openCount.value = data?.unclosed_count || 0; + closedCount.value = data?.closed_count || 0; + pagination.value.itemCount = data?.total || 0; + } + loading.value = false; +} + onMounted(() => { - tabChange('open'); + getList(); }) @@ -154,31 +122,31 @@ onMounted(() => { :style="{ '--theme-color': themeStore.themeColor}" >
-
+
未关闭的变更 {{ openCount }}
-
+
已关闭的变更 {{ closedCount }}
- +
- {{ t }} + {{ t.label }}
培训 / PSSR 为线下确认 + 资料上传制 · PSSR 检查表同行查看 / 下载 @@ -186,9 +154,10 @@ onMounted(() => {
培训 / PSSR 为线下组织并签字,拍照或扫描上传即视为完成确认并随单归档;系统不做内容识别,本页为 PSSR 检查表的查看 / 下载入口。
- -
-
+
+
- {{ s.status }} - {{ s.status }} - {{ s.status }} - {{ s.status }} + + 审批中 + 已通过 + 待验收 + 待关闭 + 已关闭 + 已撤回 + 已驳回

{{ s.title }}

- {{ s.id }} · {{ s.dept }} · {{ s.applicant }} · {{ s.statusDetail }} · 计划投用 {{ s.planUse }} + {{ s.change_no }} · {{ s.org_name }} · {{ s.applicant_name }} · 计划投用 {{ s.plan_use_date }}
PSSR 检查确认表 -