This commit is contained in:
2026-10-12 13:30:14 +08:00
37 changed files with 12551 additions and 12551 deletions
+69 -69
View File
@@ -1,69 +1,69 @@
<script setup lang="ts"> <script setup lang="ts">
import PDF from 'pdf-vue3' import PDF from 'pdf-vue3'
import { VueOfficeDocx, VueOfficeExcel, VueOfficePptx } from 'vue3-office-preview' import { VueOfficeDocx, VueOfficeExcel, VueOfficePptx } from 'vue3-office-preview'
import 'vue3-office-preview/lib/style.css' import 'vue3-office-preview/lib/style.css'
const props = defineProps(['previewFile',]) const props = defineProps(['previewFile',])
// 判断文件类型 // 判断文件类型
const handleFileType = (type:string) => { const handleFileType = (type:string) => {
if(type){ if(type){
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'] const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']
const wordExtensions = ['docx'] const wordExtensions = ['docx']
const excelExtensions = ['xlsx'] const excelExtensions = ['xlsx']
const pptExtensions = ['pptx'] const pptExtensions = ['pptx']
if(imageExtensions.includes(type)){ if(imageExtensions.includes(type)){
return 'image' return 'image'
} }
if(wordExtensions.includes(type)){ if(wordExtensions.includes(type)){
return 'word' return 'word'
} }
if(excelExtensions.includes(type)){ if(excelExtensions.includes(type)){
return 'excel' return 'excel'
} }
if(pptExtensions.includes(type)){ if(pptExtensions.includes(type)){
return 'ppt' return 'ppt'
} }
if(type==='pdf'){ if(type==='pdf'){
return 'pdf' return 'pdf'
} }
} }
return '' return ''
} }
</script> </script>
<template> <template>
<div class="max-h-[70vh] overflow-x-auto rounded-lg border"> <div class="max-h-[70vh] overflow-x-auto rounded-lg border">
<!-- 图片预览 --> <!-- 图片预览 -->
<template v-if="handleFileType(previewFile?.file_type) === 'image'"> <template v-if="handleFileType(previewFile?.file_type) === 'image'">
<div class="flex items-center justify-center py-2"> <div class="flex items-center justify-center py-2">
<NImage :src="previewFile?.file_url" /> <NImage :src="previewFile?.file_url" />
</div> </div>
</template> </template>
<!-- Word 预览 --> <!-- Word 预览 -->
<template v-else-if="handleFileType(previewFile?.file_type) === 'word'"> <template v-else-if="handleFileType(previewFile?.file_type) === 'word'">
<VueOfficeDocx :src="previewFile?.file_url" class="w-full items-center" /> <VueOfficeDocx :src="previewFile?.file_url" class="w-full items-center" />
</template> </template>
<!-- Excel 预览 --> <!-- Excel 预览 -->
<template v-else-if="handleFileType(previewFile?.file_type) === 'excel'"> <template v-else-if="handleFileType(previewFile?.file_type) === 'excel'">
<VueOfficeExcel :src="previewFile?.file_url" class="w-full items-center" /> <VueOfficeExcel :src="previewFile?.file_url" class="w-full items-center" />
</template> </template>
<!-- Ppt 预览 --> <!-- Ppt 预览 -->
<template v-else-if="handleFileType(previewFile?.file_type) === 'ppt'"> <template v-else-if="handleFileType(previewFile?.file_type) === 'ppt'">
<VueOfficePptx :src="previewFile?.file_url" class="w-full items-center" /> <VueOfficePptx :src="previewFile?.file_url" class="w-full items-center" />
</template> </template>
<!-- PDF 预览 --> <!-- PDF 预览 -->
<template v-else-if="handleFileType(previewFile?.file_type) === 'pdf'"> <template v-else-if="handleFileType(previewFile?.file_type) === 'pdf'">
<div class="h-[68vh]"> <div class="h-[68vh]">
<PDF :src="previewFile?.file_url" class="w-full h-full items-center" /> <PDF :src="previewFile?.file_url" class="w-full h-full items-center" />
</div> </div>
</template> </template>
<!-- 其他类型文件预览 --> <!-- 其他类型文件预览 -->
<template v-else> <template v-else>
<div class="flex items-center justify-center py-2"> <div class="flex items-center justify-center py-2">
<p>暂不支持预览该文件类型</p> <p>暂不支持预览该文件类型</p>
</div> </div>
</template> </template>
</div> </div>
</template> </template>
+31 -31
View File
@@ -1,31 +1,31 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
defineOptions({ name: 'GlobalMessage' }); defineOptions({ name: 'GlobalMessage' });
const value = ref('') const value = ref('')
</script> </script>
<template> <template>
<NPopover trigger="hover"> <NPopover trigger="hover">
<template #trigger> <template #trigger>
<NButton quaternary><icon-bi:bell class="size-4.5" /></NButton> <NButton quaternary><icon-bi:bell class="size-4.5" /></NButton>
</template> </template>
<div class="w-300px"> <div class="w-300px">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<span>消息</span> <span>消息</span>
<NButton text type="primary" size="small" class="text-xs">查看全部</NButton> <NButton text type="primary" size="small" class="text-xs">查看全部</NButton>
</div> </div>
<div class="border-t border-b my-1.5 px-2 py-2 space-y-2"> <div class="border-t border-b my-1.5 px-2 py-2 space-y-2">
<div class="max-h-200px overflow-y-auto"> <div class="max-h-200px overflow-y-auto">
<div>联锁绑定导入成功</div> <div>联锁绑定导入成功</div>
<div>联锁绑定导入成功</div> <div>联锁绑定导入成功</div>
</div> </div>
</div> </div>
<div class="flex justify-end"> <div class="flex justify-end">
<NButton text type="primary" size="small" class="text-xs">全部已读</NButton> <NButton text type="primary" size="small" class="text-xs">全部已读</NButton>
</div> </div>
</div> </div>
</NPopover> </NPopover>
</template> </template>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
+21 -21
View File
@@ -1,21 +1,21 @@
import { request } from '../request'; import { request } from '../request';
// 列表查询 // 列表查询
export function changeLedgerListApi(params:any) { export function changeLedgerListApi(params:any) {
return request({ return request({
url: `/api/changes`, url: `/api/changes`,
method: 'get', method: 'get',
params, params,
}); });
} }
// 导出 // 导出
export function exportChangeLedgerApi(params:any) { export function exportChangeLedgerApi(params:any) {
return request({ return request({
url: `/api/reports/changes/export`, url: `/api/reports/changes/export`,
method: 'get', method: 'get',
params, params,
responseType: 'blob', // 重点,responseType设置为 blob responseType: 'blob', // 重点,responseType设置为 blob
}); });
} }
+84 -84
View File
@@ -1,84 +1,84 @@
import { request } from '../request'; import { request } from '../request';
// 资料库树状列表 // 资料库树状列表
export function docTreeListApi() { export function docTreeListApi() {
return request({ return request({
url: `/api/knowledge/tree`, url: `/api/knowledge/tree`,
method: 'get', method: 'get',
}); });
} }
// 新增文件夹 // 新增文件夹
export function addFolderApi(data: {name: string, parent_id: number, org_id: number}) { export function addFolderApi(data: {name: string, parent_id: number, org_id: number}) {
return request({ return request({
url: `/api/knowledge/folder`, url: `/api/knowledge/folder`,
method: 'post', method: 'post',
data, data,
}); });
} }
// 编辑文件夹 // 编辑文件夹
export function editFolderApi(id: number, data: {name: string}) { export function editFolderApi(id: number, data: {name: string}) {
return request({ return request({
url: `/api/knowledge/folder/${id}`, url: `/api/knowledge/folder/${id}`,
method: 'put', method: 'put',
data, data,
}); });
} }
// 删除文件夹 // 删除文件夹
export function deleteFolderApi(id: number) { export function deleteFolderApi(id: number) {
return request({ return request({
url: `/api/knowledge/folder/${id}`, url: `/api/knowledge/folder/${id}`,
method: 'delete', method: 'delete',
}); });
} }
// 资料列表 // 资料列表
export function docListApi(params:{folder_id:number,name?:string}) { export function docListApi(params:{folder_id:number,name?:string}) {
return request({ return request({
url: `/api/knowledge/files`, url: `/api/knowledge/files`,
method: 'get', method: 'get',
params, params,
}); });
} }
// 上传资料 // 上传资料
export function uploadDocApi(params: any) { export function uploadDocApi(params: any) {
return request({ return request({
url: `/api/knowledge/upload`, url: `/api/knowledge/upload`,
method: 'post', method: 'post',
data: params data: params
}); });
} }
// 更新资料 // 更新资料
export function updateDocApi(id: number, params: any) { export function updateDocApi(id: number, params: any) {
return request({ return request({
url: `/api/knowledge/${id}/update`, url: `/api/knowledge/${id}/update`,
method: 'post', method: 'post',
data: params data: params
}); });
} }
// 历史版本列表 // 历史版本列表
export function docHistoryListApi(doc_id:number) { export function docHistoryListApi(doc_id:number) {
return request({ return request({
url: `/api/knowledge/${doc_id}/history`, url: `/api/knowledge/${doc_id}/history`,
method: 'get', method: 'get',
}); });
} }
// 归档目录树 // 归档目录树
export function docArchiveTreeListApi(params: {from:string | number | null,to:string | number | null,org_id: number,type: number | string,change_no?:string}) { export function docArchiveTreeListApi(params: {from:string | number | null,to:string | number | null,org_id: number,type: number | string,change_no?:string}) {
return request({ return request({
url: `/api/changes/archived/tree`, url: `/api/changes/archived/tree`,
method: 'get', method: 'get',
params, params,
}); });
} }
// 归档详情 // 归档详情
export function docArchiveDetailsApi(id: number) { export function docArchiveDetailsApi(id: number) {
return request({ return request({
url: `/api/changes/archived/${id}/attachments`, url: `/api/changes/archived/${id}/attachments`,
method: 'get', method: 'get',
}); });
} }
+19 -19
View File
@@ -1,19 +1,19 @@
import { request } from '../request'; import { request } from '../request';
/** 草稿列表 /** 草稿列表
* *
*/ */
export function draftListApi(params: {page_num: number, page_size: number}) { export function draftListApi(params: {page_num: number, page_size: number}) {
return request({ return request({
url: `/api/changes/my-drafts`, url: `/api/changes/my-drafts`,
method: 'get', method: 'get',
params params
}); });
} }
// 删除草稿 // 删除草稿
export function deleteDraftApi(id: number) { export function deleteDraftApi(id: number) {
return request({ return request({
url: `/api/changes/${id}`, url: `/api/changes/${id}`,
method: 'delete', method: 'delete',
}); });
} }
+25 -25
View File
@@ -1,26 +1,26 @@
import { request } from '../request'; import { request } from '../request';
// 上传文件 // 上传文件
export function uploadFileApi(id: number, params: any) { export function uploadFileApi(id: number, params: any) {
return request({ return request({
url: `/api/changes/${id}/attachments`, url: `/api/changes/${id}/attachments`,
method: 'post', method: 'post',
data: params data: params
}); });
} }
// 删除文件 // 删除文件
export function deleteFileApi(id: number, fileId: number) { export function deleteFileApi(id: number, fileId: number) {
return request({ return request({
url: `/api/changes/${id}/attachments/${fileId}`, url: `/api/changes/${id}/attachments/${fileId}`,
method: 'delete', method: 'delete',
}); });
} }
// 文件列表 // 文件列表
export function fileListApi(change_id: number) { export function fileListApi(change_id: number) {
return request({ return request({
url: `/api/changes/${change_id}/attachments`, url: `/api/changes/${change_id}/attachments`,
method: 'get', method: 'get',
}); });
} }
+26 -26
View File
@@ -1,26 +1,26 @@
import { request } from '../request'; import { request } from '../request';
// 列表查询 // 列表查询
export function highRiskListApi(params:any) { export function highRiskListApi(params:any) {
return request({ return request({
url: `/api/risk-records/high`, url: `/api/risk-records/high`,
method: 'get', method: 'get',
params, params,
}); });
} }
// 变更分析记录列表 // 变更分析记录列表
export function analysisRecordListApi(id:number) { export function analysisRecordListApi(id:number) {
return request({ return request({
url: `/api/changes/${id}/analysis-records`, url: `/api/changes/${id}/analysis-records`,
method: 'get', method: 'get',
}); });
} }
// 历史分析检索 // 历史分析检索
export function historyAnalysisListApi(params:{kw:string,method:string}) { export function historyAnalysisListApi(params:{kw:string,method:string}) {
return request({ return request({
url: `/api/analysis-records/search`, url: `/api/analysis-records/search`,
method: 'get', method: 'get',
params, params,
}); });
} }
+66 -66
View File
@@ -1,66 +1,66 @@
import { request } from '../request'; import { request } from '../request';
// 获取列表 // 获取列表
export function myTasksListApi() { export function myTasksListApi() {
return request({ return request({
url: `/api/my-tasks`, url: `/api/my-tasks`,
method: 'get', method: 'get',
}); });
} }
// 撤回 // 撤回
export function myTasksWithdrawApi(id:number,data: {reason:string}) { export function myTasksWithdrawApi(id:number,data: {reason:string}) {
return request({ return request({
url: `/api/changes/${id}/withdraw`, url: `/api/changes/${id}/withdraw`,
method: 'post', method: 'post',
data, data,
}); });
} }
// 关闭变更 // 关闭变更
export function myTasksCloseApi(change_id:number) { export function myTasksCloseApi(change_id:number) {
return request({ return request({
url: `/api/changes/${change_id}/close`, url: `/api/changes/${change_id}/close`,
method: 'post', method: 'post',
}); });
} }
// 资料关闭 // 资料关闭
export function myTasksCloseMaterialApi(change_id:number,data: any) { export function myTasksCloseMaterialApi(change_id:number,data: any) {
return request({ return request({
url: `/api/changes/${change_id}/material-close`, url: `/api/changes/${change_id}/material-close`,
method: 'post', method: 'post',
data, data,
}); });
} }
// 处置申请保存提交 // 处置申请保存提交
export function myTasksDisposalSubmitApi(change_id:number,data: any) { export function myTasksDisposalSubmitApi(change_id:number,data: any) {
return request({ return request({
url: `/api/changes/${change_id}/disposal`, url: `/api/changes/${change_id}/disposal`,
method: 'post', method: 'post',
data, data,
}); });
} }
// 新增检查项 // 新增检查项
export function myTasksAddItemApi(change_id:number,data: any) { export function myTasksAddItemApi(change_id:number,data: any) {
return request({ return request({
url: `/api/changes/${change_id}/pssr/item`, url: `/api/changes/${change_id}/pssr/item`,
method: 'post', method: 'post',
data, data,
}); });
} }
// 驳回变更 // 驳回变更
export function rejectApi(data: {change_id:number,opinion:string}) { export function rejectApi(data: {change_id:number,opinion:string}) {
return request({ return request({
url: `/api/approvals/reject`, url: `/api/approvals/reject`,
method: 'post', method: 'post',
data, data,
}); });
} }
// 同意变更 // 同意变更
export function agreeApi(data: {change_id:number,opinion:string}) { export function agreeApi(data: {change_id:number,opinion:string}) {
return request({ return request({
url: `/api/approvals/agree`, url: `/api/approvals/agree`,
method: 'post', method: 'post',
data, data,
}); });
} }
+28 -28
View File
@@ -1,28 +1,28 @@
import { request } from '../request'; import { request } from '../request';
// 待投用变更列表查询 // 待投用变更列表查询
export function pendingChangeListApi(params:{page_num:number,page_size:number}) { export function pendingChangeListApi(params:{page_num:number,page_size:number}) {
return request({ return request({
url: `/api/pssr/pending-use`, url: `/api/pssr/pending-use`,
method: 'get', method: 'get',
params, params,
}); });
} }
// 变更投入和效果列表查询 // 变更投入和效果列表查询
export function effectListApi(params:{page_num:number,page_size:number}) { export function effectListApi(params:{page_num:number,page_size:number}) {
return request({ return request({
url: `/api/reports/invest-effect`, url: `/api/reports/invest-effect`,
method: 'get', method: 'get',
params, params,
}); });
} }
// 变更投入和效果导出 // 变更投入和效果导出
export function exportEffectApi() { export function exportEffectApi() {
return request({ return request({
url: `/api/reports/invest-effect/export`, url: `/api/reports/invest-effect/export`,
method: 'get', method: 'get',
responseType: 'blob', // 重点,responseType设置为 blob responseType: 'blob', // 重点,responseType设置为 blob
}); });
} }
+82 -82
View File
@@ -1,82 +1,82 @@
import { request } from '../request'; import { request } from '../request';
// 获取风险预分析详情 // 获取风险预分析详情
export function riskPreDetailApi(change_id: number) { export function riskPreDetailApi(change_id: number) {
return request({ return request({
url: `/api/changes/${change_id}/risk-summary`, url: `/api/changes/${change_id}/risk-summary`,
method: 'get', method: 'get',
}); });
} }
// 风险预分析保存 // 风险预分析保存
export function riskPreSaveApi(change_id: number, data: any) { export function riskPreSaveApi(change_id: number, data: any) {
return request({ return request({
url: `/api/changes/${change_id}/risk-summary`, url: `/api/changes/${change_id}/risk-summary`,
method: 'put', method: 'put',
data, data,
}); });
} }
// 获取HAZOP节点列表 // 获取HAZOP节点列表
export function hazopNodesApi(id: number) { export function hazopNodesApi(id: number) {
return request({ return request({
url: `/api/changes/${id}/hazop/nodes`, url: `/api/changes/${id}/hazop/nodes`,
method: 'get', method: 'get',
}); });
} }
// HAZOP保存 // HAZOP保存
export function hazopSaveApi(change_id: number, data: any) { export function hazopSaveApi(change_id: number, data: any) {
return request({ return request({
url: `/api/changes/${change_id}/hazop`, url: `/api/changes/${change_id}/hazop`,
method: 'put', method: 'put',
data, data,
}); });
} }
// 获取FMEA节点列表 // 获取FMEA节点列表
export function fmeaNodesApi(change_id: number) { export function fmeaNodesApi(change_id: number) {
return request({ return request({
url: `/api/changes/${change_id}/fmea/nodes`, url: `/api/changes/${change_id}/fmea/nodes`,
method: 'get', method: 'get',
}); });
} }
// FMEA保存 // FMEA保存
export function fmeaSaveApi(change_id: number, data: any) { export function fmeaSaveApi(change_id: number, data: any) {
return request({ return request({
url: `/api/changes/${change_id}/fmea`, url: `/api/changes/${change_id}/fmea`,
method: 'put', method: 'put',
data, data,
}); });
} }
// 获取JSA详情 // 获取JSA详情
export function jsaDetailApi(change_id: number) { export function jsaDetailApi(change_id: number) {
return request({ return request({
url: `/api/changes/${change_id}/jsa`, url: `/api/changes/${change_id}/jsa`,
method: 'get', method: 'get',
}); });
} }
// JSA保存 // JSA保存
export function jsaSaveApi(change_id: number, data: any) { export function jsaSaveApi(change_id: number, data: any) {
return request({ return request({
url: `/api/changes/${change_id}/jsa`, url: `/api/changes/${change_id}/jsa`,
method: 'put', method: 'put',
data, data,
}); });
} }
// 获取风险检查表详情 // 获取风险检查表详情
export function riskCheckDetailApi(change_id: number) { export function riskCheckDetailApi(change_id: number) {
return request({ return request({
url: `/api/changes/${change_id}/questionnaire`, url: `/api/changes/${change_id}/questionnaire`,
method: 'get', method: 'get',
}); });
} }
// 风险检查表保存 // 风险检查表保存
export function riskCheckSaveApi(change_id: number, data: any) { export function riskCheckSaveApi(change_id: number, data: any) {
return request({ return request({
url: `/api/changes/${change_id}/questionnaire`, url: `/api/changes/${change_id}/questionnaire`,
method: 'put', method: 'put',
data, data,
}); });
} }
+9 -9
View File
@@ -1,10 +1,10 @@
import { request } from '../request'; 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}) { export function pssrListApi(params: {page_num: number, page_size: number,kw: string,is_close: number,from: string | null,to: string | null}) {
return request({ return request({
url: `/api/pssr/supervise`, url: `/api/pssr/supervise`,
method: 'get', method: 'get',
params params
}); });
} }
+133 -133
View File
@@ -1,133 +1,133 @@
// 数据统计 // 数据统计
import { request } from '../request'; import { request } from '../request';
// 首页(申请人) // 首页(申请人)
export function homeApi() { export function homeApi() {
return request({ return request({
url: `/api/workbench`, url: `/api/workbench`,
method: 'get', method: 'get',
}); });
} }
// 首页(专业会签) // 首页(专业会签)
export function homeProfessionalApi() { export function homeProfessionalApi() {
return request({ return request({
url: `/api/workbench/specialty-sign`, url: `/api/workbench/specialty-sign`,
method: 'get', method: 'get',
}); });
} }
// 首页(安全工程师) // 首页(安全工程师)
export function homeSafeApi() { export function homeSafeApi() {
return request({ return request({
url: `/api/workbench/safety`, url: `/api/workbench/safety`,
method: 'get', method: 'get',
}); });
} }
// 首页(车间主任) // 首页(车间主任)
export function homeManagerApi(params: {from: string | null, to: string | null}) { export function homeManagerApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/workbench/dept`, url: `/api/workbench/dept`,
method: 'get', method: 'get',
params params
}); });
} }
// 首页(分管领导) // 首页(分管领导)
export function homeLeaderApi() { export function homeLeaderApi() {
return request({ return request({
url: `/api/workbench/vp`, url: `/api/workbench/vp`,
method: 'get', method: 'get',
}); });
} }
// 首页(系统管理员) // 首页(系统管理员)
export function homeAdminApi() { export function homeAdminApi() {
return request({ return request({
url: `/api/workbench/admin`, url: `/api/workbench/admin`,
method: 'get', method: 'get',
}); });
} }
// 首页(质量工程师) // 首页(质量工程师)
export function homeQualityApi() { export function homeQualityApi() {
return request({ return request({
url: `/api/workbench/quality`, url: `/api/workbench/quality`,
method: 'get', method: 'get',
}); });
} }
// 首页(非审批人员) // 首页(非审批人员)
export function homeNonApproverApi() { export function homeNonApproverApi() {
return request({ return request({
url: `/api/workbench/viewer`, url: `/api/workbench/viewer`,
method: 'get', method: 'get',
}); });
} }
// 变更数据中心 // 变更数据中心
export function changeDataCenterApi(params: {from: string | null, to: string | null}) { export function changeDataCenterApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/data-center`, url: `/api/reports/data-center`,
method: 'get', method: 'get',
params params
}); });
} }
// 变更数据中心导出 // 变更数据中心导出
export function exportChangeDataCenterApi(params: {from: string | null, to: string | null}) { export function exportChangeDataCenterApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/data-center/export`, url: `/api/reports/data-center/export`,
method: 'get', method: 'get',
params, params,
responseType: 'blob', // 重点,responseType设置为 blob responseType: 'blob', // 重点,responseType设置为 blob
}); });
} }
// 安全与风险统计 // 安全与风险统计
export function safeRiskStatisticsApi(params: {from: string | null, to: string | null}) { export function safeRiskStatisticsApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/safety-risk`, url: `/api/reports/safety-risk`,
method: 'get', method: 'get',
params params
}); });
} }
// 本部门变更统计 // 本部门变更统计
export function departmentStatisticsApi(params: {from: string | null, to: string | null}) { export function departmentStatisticsApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/dept-stats`, url: `/api/reports/dept-stats`,
method: 'get', method: 'get',
params params
}); });
} }
// 本专业变更统计(质量会签统计) // 本专业变更统计(质量会签统计)
export function specialtyStatisticsApi(params: {from: string | null, to: string | null}) { export function specialtyStatisticsApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/dept-stats/specialty-sign`, url: `/api/reports/dept-stats/specialty-sign`,
method: 'get', method: 'get',
params params
}); });
} }
// 本车间变更统计 // 本车间变更统计
export function deptStatisticsApi(params: {from: string | null, to: string | null}) { export function deptStatisticsApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/dept-stats/dept`, url: `/api/reports/dept-stats/dept`,
method: 'get', method: 'get',
params params
}); });
} }
// 全工厂统计概览 // 全工厂统计概览
export function factoryStatisticsApi(params: {from: string | null, to: string | null}) { export function factoryStatisticsApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/plant-overview`, url: `/api/reports/plant-overview`,
method: 'get', method: 'get',
params params
}); });
} }
// 统计报表 // 统计报表
export function reportStatisticsApi(params: {from: string | null, to: string | null}) { export function reportStatisticsApi(params: {from: string | null, to: string | null}) {
return request({ return request({
url: `/api/reports/admin-center`, url: `/api/reports/admin-center`,
method: 'get', method: 'get',
params params
}); });
} }
+39 -39
View File
@@ -1,40 +1,40 @@
declare namespace Api { declare namespace Api {
/** /**
* namespace Change * namespace Change
* *
* backend api module: "change" * backend api module: "change"
*/ */
namespace Change { namespace Change {
interface MemberInfo { interface MemberInfo {
id?: number; id?: number;
is_sign?: number; is_sign?: number;
org_id: number; org_id: number;
org_name: string; org_name: string;
specialty?: string; specialty?: string;
user_id: number; user_id: number;
user_name: string; user_name: string;
} }
interface StepInfo { interface StepInfo {
id: number; id: number;
countersign: boolean; countersign: boolean;
name: string; name: string;
step_order: number; step_order: number;
members: MemberInfo[]; members: MemberInfo[];
} }
interface TemplateInfo { interface TemplateInfo {
id: number; id: number;
category: number; category: number;
created_at?: string; created_at?: string;
duration: number; duration: number;
level: number; level: number;
steps: StepInfo[]; steps: StepInfo[];
updated_at?: string; updated_at?: string;
} }
interface FlowInfo { interface FlowInfo {
stepId: number; stepId: number;
countersign: boolean; countersign: boolean;
name: string; name: string;
selectedMember: MemberInfo[]; selectedMember: MemberInfo[];
} }
} }
} }
+9 -9
View File
@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import List from "./modules/list.vue"; import List from "./modules/list.vue";
</script> </script>
<template> <template>
<div> <div>
<List self="" keyValue="changeledger" /> <List self="" keyValue="changeledger" />
</div> </div>
</template> </template>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+332 -332
View File
@@ -1,332 +1,332 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } 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 { getColorWithOpacity } from '@/utils/common'; import { getColorWithOpacity } from '@/utils/common';
import { homeAdminApi } from "@/service/api/statistics"; import { homeAdminApi } from "@/service/api/statistics";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 跳转变更申请页面、变更台账、我的任务、发起变更 // 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => { const jumpTo = (key: string,qid:number = 0) => {
if(key==='details_approval' && qid){ if(key==='details_approval' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_index' && qid){ }else if(key==='details_index' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{ }else{
routerPushByKey(key as any); routerPushByKey(key as any);
} }
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeAdminApi(); const {data,error} = await homeAdminApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:16"> <NGi span="24 s:24 m:16">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:8" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:8" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton ghost size="small" @click="jumpTo('systemmanage_setting')"> <NButton ghost size="small" @click="jumpTo('systemmanage_setting')">
系统设置 系统设置
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:2 l:2" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:2 l:2" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555]" class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555]"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
<p class="text-12px font-600">待关闭确认</p> <p class="text-12px font-600">待关闭确认</p>
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.close_pending?.total || 0" :end-value="homeData?.close_pending?.total || 0"
class="text-26px font-600" class="text-26px font-600"
/> />
</div> </div>
<p class="text-12px">验收完成 · 资料齐备 · 专责确认</p> <p class="text-12px">验收完成 · 资料齐备 · 专责确认</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8] cursor-pointer" class="flex-1 bg-white px-16px py-12px text-[#94a3b8] cursor-pointer"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<p class="text-12px font-600">在途变更</p> <p class="text-12px font-600">在途变更</p>
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.open_changes?.total || 0" :end-value="homeData?.open_changes?.total || 0"
class="text-26px font-600 text-[#333]" class="text-26px font-600 text-[#333]"
/> />
</div> </div>
<p class="text-12px">全流程跟踪</p> <p class="text-12px">全流程跟踪</p>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 待关闭确认 --> <!-- 待关闭确认 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="ix:success" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="ix:success" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">待关闭确认</p> <p class="text-13px font-700 text-#64749a">待关闭确认</p>
<p class="text-11px text-#94a3b8 mt-2px">变更主管部门(归口部门)专责确认 · 系统记录关闭时间</p> <p class="text-11px text-#94a3b8 mt-2px">变更主管部门(归口部门)专责确认 · 系统记录关闭时间</p>
</div> </div>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.close_pending?.total > 0"> <template v-if="homeData?.close_pending?.total > 0">
<div v-for="row in homeData?.close_pending?.items || []" :key="row.change_id" <div v-for="row in homeData?.close_pending?.items || []" :key="row.change_id"
class="flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition" class="flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition"
:style="{borderRadius: themeStore.themeRadius + 'px'}" :style="{borderRadius: themeStore.themeRadius + 'px'}"
> >
<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">
<!-- 状态标签 --> <!-- 状态标签 -->
<NTag size="small" type="error">待关闭</NTag> <NTag size="small" type="error">待关闭</NTag>
<p class="flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</p> <p class="flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</p>
<span v-if="row.status==='CLOSED'" class="text-[11px]" :style="{color: themeStore.otherColor.success}">关闭时间 2026/9/28 14:29:57</span> <span v-if="row.status==='CLOSED'" class="text-[11px]" :style="{color: themeStore.otherColor.success}">关闭时间 2026/9/28 14:29:57</span>
<NButton size="small" type="success" class="text-xs" @click="jumpTo('details_approval', row.change_id)">确认关闭</NButton> <NButton size="small" type="success" class="text-xs" @click="jumpTo('details_approval', row.change_id)">确认关闭</NButton>
<NButton size="small" ghost class="text-xs" @click="jumpTo('details_index', row.change_id)">打开变更单</NButton> <NButton size="small" ghost class="text-xs" @click="jumpTo('details_index', row.change_id)">打开变更单</NButton>
</div> </div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2"> <div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<span>{{ row.change_no }}</span> <span>{{ row.change_no }}</span>
<span>{{row.org_name}}</span> <span>{{row.org_name}}</span>
<span>{{row.applicant_name}}</span> <span>{{row.applicant_name}}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<!-- 在途变更跟踪 --> <!-- 在途变更跟踪 -->
<NCard :bordered="false" size="small" class="mt-16px" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" class="mt-16px" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">在途变更跟踪</p> <p class="text-13px font-700 text-#64749a">在途变更跟踪</p>
<p class="text-11px text-#94a3b8 mt-2px">全流程在途 · 点击打开变更单</p> <p class="text-11px text-#94a3b8 mt-2px">全流程在途 · 点击打开变更单</p>
</div> </div>
<NButton v-if="homeData?.open_changes?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')"> <NButton v-if="homeData?.open_changes?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')">
变更台账 变更台账
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<NTag v-for="item in homeData?.open_changes?.items || []" :key="item.status" size="small" type="primary">{{item.label}}{{item.count}}</NTag> <NTag v-for="item in homeData?.open_changes?.items || []" :key="item.status" size="small" type="primary">{{item.label}}{{item.count}}</NTag>
</div> </div>
<template v-if="homeData?.open_changes?.total > 0"> <template v-if="homeData?.open_changes?.total > 0">
<div v-for="row in homeData?.open_changes?.rows || []" :key="row.change_id" @click="jumpTo('details_index', row.change_id)" <div v-for="row in homeData?.open_changes?.rows || []" :key="row.change_id" @click="jumpTo('details_index', row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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">
<!-- 状态标签 --> <!-- 状态标签 -->
<NTag v-if="row.status==='APPROVING'" size="small" type="warning">审批中</NTag> <NTag v-if="row.status==='APPROVING'" size="small" type="warning">审批中</NTag>
<NTag v-if="row.status==='APPROVED'" size="small" type="success">已通过</NTag> <NTag v-if="row.status==='APPROVED'" size="small" type="success">已通过</NTag>
<NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag> <NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag>
<NTag v-if="row.status==='ACCEPTED'" size="small" type="error">待关闭</NTag> <NTag v-if="row.status==='ACCEPTED'" size="small" type="error">待关闭</NTag>
<NTag v-if="row.status==='CLOSED'" size="small" type="success">已关闭</NTag> <NTag v-if="row.status==='CLOSED'" size="small" type="success">已关闭</NTag>
<NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag> <NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag>
<NTag v-if="row.status==='REJECTED'" size="small" type="error">已驳回</NTag> <NTag v-if="row.status==='REJECTED'" size="small" type="error">已驳回</NTag>
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<NTag v-if="row.overdue_days" size="small" type="error">超期{{row.overdue_days}}天</NTag> <NTag v-if="row.overdue_days" size="small" type="error">超期{{row.overdue_days}}天</NTag>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="mt-1 truncate flex items-center gap-2 text-[11px] text-slate-400"> <div class="mt-1 truncate flex items-center gap-2 text-[11px] text-slate-400">
<span>{{ row.change_no }}</span> <span>{{ row.change_no }}</span>
<span>{{row.org_name}}</span> <span>{{row.org_name}}</span>
<span>{{row.applicant_name}}</span> <span>{{row.applicant_name}}</span>
<span v-if="row.pending_handlers">当前待办:{{row.pending_handlers}}</span> <span v-if="row.pending_handlers">当前待办:{{row.pending_handlers}}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 系统设置 --> <!-- 系统设置 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center flex-wrap gap-2"> <div class="flex items-center flex-wrap gap-2">
<Icon icon="keyline-icons:sliders-horizontal" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="keyline-icons:sliders-horizontal" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">系统设置</p> <p class="text-13px font-700 text-#64749a">系统设置</p>
<p class="text-11px text-#94a3b8">点击进入对应设置项</p> <p class="text-11px text-#94a3b8">点击进入对应设置项</p>
</div> </div>
<div class="space-y-2.5 mt-3"> <div class="space-y-2.5 mt-3">
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_template')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_template')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">审批流程设置</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">审批流程设置</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">按等级路由 · 会签 · 最终批准</div> <div class="mt-1 text-[11px] text-slate-400">按等级路由 · 会签 · 最终批准</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">变更类型管理</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">变更类型管理</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">工艺 / 设备 / 管理 · 支持自定义</div> <div class="mt-1 text-[11px] text-slate-400">工艺 / 设备 / 管理 · 支持自定义</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">变更等级规则</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">变更等级规则</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">等级评分表 · 重要 / 一般判定</div> <div class="mt-1 text-[11px] text-slate-400">等级评分表 · 重要 / 一般判定</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_user')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_user')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">账号设定</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">账号设定</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">用户账号 · 组织 · 启停用</div> <div class="mt-1 text-[11px] text-slate-400">用户账号 · 组织 · 启停用</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_role')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_role')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">角色和权限分配</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">角色和权限分配</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">角色 · 菜单 · 数据权限</div> <div class="mt-1 text-[11px] text-slate-400">角色 · 菜单 · 数据权限</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">通知提醒设置</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">通知提醒设置</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">超期 · 临期 · 关闭提醒</div> <div class="mt-1 text-[11px] text-slate-400">超期 · 临期 · 关闭提醒</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('systemmanage_setting')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">AI 开关与维护</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">AI 开关与维护</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">AI 辅助开关 · 模型与提示词</div> <div class="mt-1 text-[11px] text-slate-400">AI 辅助开关 · 模型与提示词</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
</div> </div>
<div <div
:style="{ :style="{
'--warning-bg': getColorWithOpacity(themeStore.otherColor.warning, 0.1), '--warning-bg': getColorWithOpacity(themeStore.otherColor.warning, 0.1),
'--warning-color': themeStore.otherColor.warning, '--warning-color': themeStore.otherColor.warning,
'--success-color': themeStore.otherColor.success, '--success-color': themeStore.otherColor.success,
'--success-bg': getColorWithOpacity(themeStore.otherColor.success, 0.1), '--success-bg': getColorWithOpacity(themeStore.otherColor.success, 0.1),
}" }"
> >
<div v-if="homeData?.ai_assist_enabled" class="mt-3 flex items-center gap-2 rounded-lg bg-[var(--success-bg)] px-3 py-2 text-[11px] text-[var(--success-color)]"> <div v-if="homeData?.ai_assist_enabled" class="mt-3 flex items-center gap-2 rounded-lg bg-[var(--success-bg)] px-3 py-2 text-[11px] text-[var(--success-color)]">
<Icon icon="lucide:sparkles" class="size-12px" /> <Icon icon="lucide:sparkles" class="size-12px" />
AI 辅助当前已启用 · 可在「AI 开关与维护」调整 AI 辅助当前已启用 · 可在「AI 开关与维护」调整
</div> </div>
<div v-else class="mt-3 flex items-center gap-2 rounded-lg bg-[var(--warning-bg)] px-3 py-2 text-[11px] text-[var(--warning-color)]"> <div v-else class="mt-3 flex items-center gap-2 rounded-lg bg-[var(--warning-bg)] px-3 py-2 text-[11px] text-[var(--warning-color)]">
<Icon icon="lucide:sparkles" class="size-12px" /> <Icon icon="lucide:sparkles" class="size-12px" />
AI 辅助当前未启用 · 可在「AI 开关与维护」调整 AI 辅助当前未启用 · 可在「AI 开关与维护」调整
</div> </div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
+347 -347
View File
@@ -1,347 +1,347 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } 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 { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { homeNonApproverApi } from "@/service/api/statistics"; import { homeNonApproverApi } from "@/service/api/statistics";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
// 变更类型列表 // 变更类型列表
const typeList = ref<any>([]); const typeList = ref<any>([]);
// 变更等级列表 // 变更等级列表
const levelList = ref<any>([]); const levelList = ref<any>([]);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 跳转页面 // 跳转页面
const jumpTo = (key: string) => { const jumpTo = (key: string) => {
routerPushByKey(key as any); routerPushByKey(key as any);
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeNonApproverApi(); const {data,error} = await homeNonApproverApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
// 解析 变更类型设置 // 解析 变更类型设置
const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type');
if (changeTypeGroup) { if (changeTypeGroup) {
typeList.value = changeTypeGroup.items; typeList.value = changeTypeGroup.items;
} }
// 解析 变更等级设置 // 解析 变更等级设置
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
if (changeLevelGroup) { if (changeLevelGroup) {
levelList.value = changeLevelGroup.items; levelList.value = changeLevelGroup.items;
} }
} }
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getConfig(); getConfig();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:12"> <NGi span="24 s:24 m:12">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:12" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:12" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton ghost size="small" @click="jumpTo('changeledger')"> <NButton ghost size="small" @click="jumpTo('changeledger')">
变更台账查询 变更台账查询
</NButton> </NButton>
<NButton ghost size="small" @click="jumpTo('docs_archives')"> <NButton ghost size="small" @click="jumpTo('docs_archives')">
资料库查阅 资料库查阅
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:3 l:3" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:3 l:3" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.summary?.open_total || 0" :end-value="homeData?.summary?.open_total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">在办变更</p> <p class="text-12px font-600">在办变更</p>
<p class="text-12px text-slate-400">全厂 · 实时台账口径</p> <p class="text-12px text-slate-400">全厂 · 实时台账口径</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.summary?.important_open_total || 0" :end-value="homeData?.summary?.important_open_total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">其中重要变更</p> <p class="text-12px font-600">其中重要变更</p>
<p class="text-12px text-slate-400">重点关注对象</p> <p class="text-12px text-slate-400">重点关注对象</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.summary?.month_closed || 0" :end-value="homeData?.summary?.month_closed || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">本月已关闭</p> <p class="text-12px font-600">本月已关闭</p>
<p class="text-12px text-slate-400">验收闭环完成</p> <p class="text-12px text-slate-400">验收闭环完成</p>
</div> </div>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 变更动态 --> <!-- 变更动态 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">变更动态</p> <p class="text-13px font-700 text-#64749a">变更动态</p>
<p class="text-11px text-#94a3b8 mt-2px">全厂 · 按状态更新时间倒序 · 只读</p> <p class="text-11px text-#94a3b8 mt-2px">全厂 · 按状态更新时间倒序 · 只读</p>
</div> </div>
<NButton v-if="homeData?.recent?.items?.length > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')"> <NButton v-if="homeData?.recent?.items?.length > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')">
变更台账 变更台账
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.recent?.items?.length > 0"> <template v-if="homeData?.recent?.items?.length > 0">
<div v-for="row in homeData?.recent?.items || []" :key="row.change_id" @click="jumpTo('changeledger')" <div v-for="row in homeData?.recent?.items || []" :key="row.change_id" @click="jumpTo('changeledger')"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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">
<!-- 状态标签 --> <!-- 状态标签 -->
<NTag v-if="row.status==='APPROVING'" size="small" type="warning">{{row.status_label}}</NTag> <NTag v-if="row.status==='APPROVING'" size="small" type="warning">{{row.status_label}}</NTag>
<NTag v-if="row.status==='APPROVED'" size="small" type="success">{{row.status_label}}</NTag> <NTag v-if="row.status==='APPROVED'" size="small" type="success">{{row.status_label}}</NTag>
<NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">{{row.status_label}}</NTag> <NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">{{row.status_label}}</NTag>
<NTag v-if="row.status==='ACCEPTED'" size="small" type="error">{{row.status_label}}</NTag> <NTag v-if="row.status==='ACCEPTED'" size="small" type="error">{{row.status_label}}</NTag>
<NTag v-if="row.status==='CLOSED'" size="small" type="success">{{row.status_label}}</NTag> <NTag v-if="row.status==='CLOSED'" size="small" type="success">{{row.status_label}}</NTag>
<NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">{{row.status_label}}</NTag> <NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">{{row.status_label}}</NTag>
<NTag v-if="row.status==='REJECTED'" size="small" type="error">{{row.status_label}}</NTag> <NTag v-if="row.status==='REJECTED'" size="small" type="error">{{row.status_label}}</NTag>
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<span v-if="row.status_changed_at" class="ml-auto text-[11px] text-slate-400">{{row.status_changed_at?.slice(0, 16)}}</span> <span v-if="row.status_changed_at" class="ml-auto text-[11px] text-slate-400">{{row.status_changed_at?.slice(0, 16)}}</span>
</div> </div>
<div class="mt-1 flex items-center gap-2 font-mono text-[11px] text-slate-400"> <div class="mt-1 flex items-center gap-2 font-mono text-[11px] text-slate-400">
<span>{{ row.change_no }}</span> <span>{{ row.change_no }}</span>
<span>{{row.org_name}}</span> <span>{{row.org_name}}</span>
<span>{{row.applicant_name}}</span> <span>{{row.applicant_name}}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]"> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]">
<!-- 全厂变更阶段分布 --> <!-- 全厂变更阶段分布 -->
<NGi span="24 s:24 m:24 l:24"> <NGi span="24 s:24 m:24 l:24">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">全厂变更阶段分布</p> <p class="text-13px font-700 text-#64749a">全厂变更阶段分布</p>
<p class="text-11px text-#94a3b8 mt-2px">点击进入台账按阶段查看</p> <p class="text-11px text-#94a3b8 mt-2px">点击进入台账按阶段查看</p>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<NButton v-for="item in homeData?.stage_dist || []" :key="item.key" size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">{{item.label}} {{item.count}}</NButton> <NButton v-for="item in homeData?.stage_dist || []" :key="item.key" size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">{{item.label}} {{item.count}}</NButton>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 资料快捷查阅 --> <!-- 资料快捷查阅 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">资料快捷查阅</p> <p class="text-13px font-700 text-#64749a">资料快捷查阅</p>
<p class="text-11px text-#94a3b8">现行有效文件 · 只读</p> <p class="text-11px text-#94a3b8">现行有效文件 · 只读</p>
</div> </div>
<div class="space-y-2.5"> <div class="space-y-2.5">
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_archives')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_archives')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">操作规程查阅</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">操作规程查阅</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">现行有效版本 · 只读</div> <div class="mt-1 text-[11px] text-slate-400">现行有效版本 · 只读</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_archives')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_archives')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">PID 图纸查阅</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">PID 图纸查阅</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">现行图纸 · 只读</div> <div class="mt-1 text-[11px] text-slate-400">现行图纸 · 只读</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_query')"> <div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_query')">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">变更档案查阅</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">变更档案查阅</span>
</div> </div>
<div class="mt-1 text-[11px] text-slate-400">已关闭变更归档包 · 只读</div> <div class="mt-1 text-[11px] text-slate-400">已关闭变更归档包 · 只读</div>
</div> </div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton> <NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div> </div>
</div> </div>
</NCard> </NCard>
<!-- 全厂统计概览 --> <!-- 全厂统计概览 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">全厂统计概览</p> <p class="text-13px font-700 text-#64749a">全厂统计概览</p>
<p class="text-11px text-#94a3b8">变更趋势与分布 · 只读</p> <p class="text-11px text-#94a3b8">变更趋势与分布 · 只读</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">本月新增</span> <span class="text-xs text-slate-500 w-16">本月新增</span>
<NProgress <NProgress
type="line" type="line"
status="info" status="info"
:percentage="((homeData?.stats?.month_created || 0) / 3) * 100" :percentage="((homeData?.stats?.month_created || 0) / 3) * 100"
:height="10" :height="10"
border-radius="6px" border-radius="6px"
> >
<span class="text-xs text-slate-700 font-semibold">{{homeData?.stats?.month_created || 0}}天</span> <span class="text-xs text-slate-700 font-semibold">{{homeData?.stats?.month_created || 0}}天</span>
</NProgress> </NProgress>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">本月关闭</span> <span class="text-xs text-slate-500 w-16">本月关闭</span>
<NProgress <NProgress
type="line" type="line"
status="info" status="info"
:percentage="((homeData?.stats?.month_closed || 0) / 3) * 100" :percentage="((homeData?.stats?.month_closed || 0) / 3) * 100"
:height="10" :height="10"
border-radius="6px" border-radius="6px"
> >
<span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.stats?.month_closed || 0}}天</span> <span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.stats?.month_closed || 0}}天</span>
</NProgress> </NProgress>
</div> </div>
<div class="flex items-center justify-between text-[11px] text-slate-400"> <div class="flex items-center justify-between text-[11px] text-slate-400">
<span>验收完全达到率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.stats?.accept_full_rate || 0}}%</b></span> <span>验收完全达到率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.stats?.accept_full_rate || 0}}%</b></span>
<span>近一年口径</span> <span>近一年口径</span>
</div> </div>
<NButton size="small" ghost block class="text-xs" @click="jumpTo('factoryoverview')">查看统计报表<Icon icon="formkit:right" class="size-12px" /></NButton> <NButton size="small" ghost block class="text-xs" @click="jumpTo('factoryoverview')">查看统计报表<Icon icon="formkit:right" class="size-12px" /></NButton>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
+447 -447
View File
@@ -1,447 +1,447 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } 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 { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { homeApi } from "@/service/api/statistics"; import { homeApi } from "@/service/api/statistics";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
// 变更类型列表 // 变更类型列表
const typeList = ref<any>([]); const typeList = ref<any>([]);
// 变更等级列表 // 变更等级列表
const levelList = ref<any>([]); const levelList = ref<any>([]);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 尚未关闭总数 // 尚未关闭总数
const openTotal = computed(() => { const openTotal = computed(() => {
return homeData.value?.unclosed_status?.items?.reduce((sum:number, item:any) => sum + item.count, 0) || 0; return homeData.value?.unclosed_status?.items?.reduce((sum:number, item:any) => sum + item.count, 0) || 0;
}); });
// 临时变更到期提醒情况 // 临时变更到期提醒情况
const tempTotal = computed(() => { const tempTotal = computed(() => {
return (homeData.value?.dept_stats?.unclosed_total || 0) + (homeData.value?.dept_stats?.near_overdue_total || 0) + (homeData.value?.dept_stats?.overdue_total || 0); return (homeData.value?.dept_stats?.unclosed_total || 0) + (homeData.value?.dept_stats?.near_overdue_total || 0) + (homeData.value?.dept_stats?.overdue_total || 0);
}); });
// 跳转变更申请页面、变更台账、我的任务、发起变更 // 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => { const jumpTo = (key: string,qid:number = 0) => {
if(key==='my_initiatechange' && qid){ if(key==='my_initiatechange' && qid){
routerPushByKey(key,{ query: { id: qid.toString() } }); routerPushByKey(key,{ query: { id: qid.toString() } });
}else if(key==='details_closedoc' && qid){ }else if(key==='details_closedoc' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_index' && qid){ }else if(key==='details_index' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{ }else{
routerPushByKey(key as any); routerPushByKey(key as any);
} }
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 匹配对象 // 匹配对象
const matchObj = (list:any,val:number) => { const matchObj = (list:any,val:number) => {
const obj = list.find((item:any) => item.value == val); const obj = list.find((item:any) => item.value == val);
return obj || null; return obj || null;
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeApi(); const {data,error} = await homeApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
// 解析 变更类型设置 // 解析 变更类型设置
const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type');
if (changeTypeGroup) { if (changeTypeGroup) {
typeList.value = changeTypeGroup.items; typeList.value = changeTypeGroup.items;
} }
// 解析 变更等级设置 // 解析 变更等级设置
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
if (changeLevelGroup) { if (changeLevelGroup) {
levelList.value = changeLevelGroup.items; levelList.value = changeLevelGroup.items;
} }
} }
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getConfig(); getConfig();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:16"> <NGi span="24 s:24 m:16">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:8" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:8" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton type="primary" size="small" @click="jumpTo('my_initiatechange')"> <NButton type="primary" size="small" @click="jumpTo('my_initiatechange')">
<Icon icon="ic:round-plus" class="size-18px" /> <Icon icon="ic:round-plus" class="size-18px" />
发起变更 发起变更
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555] cursor-pointer" class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555] cursor-pointer"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<p class="text-12px font-600">待修改驳回</p> <p class="text-12px font-600">待修改驳回</p>
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.dept_stats?.reject_count || 0" :end-value="homeData?.dept_stats?.reject_count || 0"
class="text-26px font-600" class="text-26px font-600"
/> />
</div> </div>
<p class="text-12px">修改后重新提交</p> <p class="text-12px">修改后重新提交</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8] cursor-pointer" class="flex-1 bg-white px-16px py-12px text-[#94a3b8] cursor-pointer"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<p class="text-12px font-600">待上传资料</p> <p class="text-12px font-600">待上传资料</p>
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.archive_todo?.total || 0" :end-value="homeData?.archive_todo?.total || 0"
class="text-26px font-600 text-[#333]" class="text-26px font-600 text-[#333]"
/> />
</div> </div>
<p class="text-12px">培训 / PSSR / 验收材料补交</p> <p class="text-12px">培训 / PSSR / 验收材料补交</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8] cursor-pointer" class="flex-1 bg-white px-16px py-12px text-[#94a3b8] cursor-pointer"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<p class="text-12px font-600">临时变更到期</p> <p class="text-12px font-600">临时变更到期</p>
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.dept_stats?.near_overdue_total || 0" :end-value="homeData?.dept_stats?.near_overdue_total || 0"
class="text-26px font-600 text-[#333]" class="text-26px font-600 text-[#333]"
/> />
</div> </div>
<p class="text-12px">到期 ≤ {{remindDays}} 天 · 及时处置</p> <p class="text-12px">到期 ≤ {{remindDays}} 天 · 及时处置</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555] cursor-pointer" class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555] cursor-pointer"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<p class="text-12px font-600">超期未处置</p> <p class="text-12px font-600">超期未处置</p>
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.dept_stats?.overdue_total || 0" :end-value="homeData?.dept_stats?.overdue_total || 0"
class="text-26px font-600" class="text-26px font-600"
/> />
</div> </div>
<p class="text-12px">超期临时变更 · 需恢复 / 延期 / 转永久</p> <p class="text-12px">超期临时变更 · 需恢复 / 延期 / 转永久</p>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 我的变更进度 --> <!-- 我的变更进度 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">我的变更进度</p> <p class="text-13px font-700 text-#64749a">我的变更进度</p>
<p class="text-11px text-#94a3b8 mt-2px">阶段进度与台账实时联动</p> <p class="text-11px text-#94a3b8 mt-2px">阶段进度与台账实时联动</p>
</div> </div>
<NButton v-if="homeData?.my_changes_progress?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')"> <NButton v-if="homeData?.my_changes_progress?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')">
全部台账 全部台账
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.my_changes_progress?.total > 0"> <template v-if="homeData?.my_changes_progress?.total > 0">
<div v-for="row in homeData?.my_changes_progress?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_index',row.change_id)" <div v-for="row in homeData?.my_changes_progress?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_index',row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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">{{ row.change_no }}</span> <span class="font-mono text-[11px] text-slate-400">{{ row.change_no }}</span>
<NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag> <NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag>
<!-- 变更等级 --> <!-- 变更等级 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(levelList,row.change_level)?.color), color: tagBgColor(matchObj(levelList,row.change_level)?.color),
textColor: tagTextColor(matchObj(levelList,row.change_level)?.color), textColor: tagTextColor(matchObj(levelList,row.change_level)?.color),
borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color), borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color),
}" }"
>{{matchObj(levelList,row.change_level)?.label}}</NTag> >{{matchObj(levelList,row.change_level)?.label}}</NTag>
<!-- 变更类型 --> <!-- 变更类型 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(typeList,row.change_type)?.color), color: tagBgColor(matchObj(typeList,row.change_type)?.color),
textColor: tagTextColor(matchObj(typeList,row.change_type)?.color), textColor: tagTextColor(matchObj(typeList,row.change_type)?.color),
borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color), borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color),
}" }"
>{{matchObj(typeList,row.change_type)?.label}}</NTag> >{{matchObj(typeList,row.change_type)?.label}}</NTag>
<NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag> <NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag>
<NTag class="text-[11px]" v-else type="info" size="small">永久</NTag> <NTag class="text-[11px]" v-else type="info" size="small">永久</NTag>
<span v-if="row.apply_time" class="ml-auto text-[11px] text-slate-400">申请时间 {{ row.apply_time?.slice(0, 10) }}</span> <span v-if="row.apply_time" class="ml-auto text-[11px] text-slate-400">申请时间 {{ row.apply_time?.slice(0, 10) }}</span>
</div> </div>
<div class="mt-1 flex items-center gap-2"> <div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<span class="shrink-0 text-[11px] text-slate-400">当前状态</span> <span class="shrink-0 text-[11px] text-slate-400">当前状态</span>
<!-- 状态标签 --> <!-- 状态标签 -->
<NTag v-if="row.status==='APPROVING'" size="small" type="warning">审批中</NTag> <NTag v-if="row.status==='APPROVING'" size="small" type="warning">审批中</NTag>
<NTag v-if="row.status==='APPROVED'" size="small" type="success">已通过</NTag> <NTag v-if="row.status==='APPROVED'" size="small" type="success">已通过</NTag>
<NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag> <NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag>
<NTag v-if="row.status==='ACCEPTED'" size="small" type="error">待关闭</NTag> <NTag v-if="row.status==='ACCEPTED'" size="small" type="error">待关闭</NTag>
<NTag v-if="row.status==='CLOSED'" size="small" type="success">已关闭</NTag> <NTag v-if="row.status==='CLOSED'" size="small" type="success">已关闭</NTag>
<NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag> <NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag>
<NTag v-if="row.status==='REJECTED'" size="small" type="error">已驳回</NTag> <NTag v-if="row.status==='REJECTED'" size="small" type="error">已驳回</NTag>
</div> </div>
<div class="mt-0.5 truncate text-[11px] text-slate-400"> <div class="mt-0.5 truncate text-[11px] text-slate-400">
<p v-if="row.status === 'CLOSED'">阶段全部完成,流程闭环已归档</p> <p v-if="row.status === 'CLOSED'">阶段全部完成,流程闭环已归档</p>
<p v-else>当前节点:{{row.step_name}}</p> <p v-else>当前节点:{{row.step_name}}</p>
</div> </div>
</div> </div>
</div> </div>
<NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('changeledger')"> <NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('changeledger')">
还有{{(homeData?.my_changes_progress?.total - 3) > 0 ? (homeData?.my_changes_progress?.total - 3) : 0}}条,前往台账查看全部 → 还有{{(homeData?.my_changes_progress?.total - 3) > 0 ? (homeData?.my_changes_progress?.total - 3) : 0}}条,前往台账查看全部 →
</NButton> </NButton>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]"> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]">
<!-- 临时变更到期提醒情况 --> <!-- 临时变更到期提醒情况 -->
<NGi span="12 s:12 m:12 l:12"> <NGi span="12 s:12 m:12 l:12">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">临时变更到期提醒情况</p> <p class="text-13px font-700 text-#64749a">临时变更到期提醒情况</p>
<p class="text-11px text-#94a3b8">共 {{tempTotal}} 项</p> <p class="text-11px text-#94a3b8">共 {{tempTotal}} 项</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.success }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.success }"></span>
<span class="font-medium text-slate-700">正常(到期 > {{remindDays}} 天)</span> <span class="font-medium text-slate-700">正常(到期 > {{remindDays}} 天)</span>
<span class="ml-auto font-semibold text-slate-600">{{homeData?.dept_stats?.unclosed_total || 0}} 项</span> <span class="ml-auto font-semibold text-slate-600">{{homeData?.dept_stats?.unclosed_total || 0}} 项</span>
</div> </div>
</div> </div>
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.warning }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.warning }"></span>
<span class="font-medium text-slate-700">临期(到期 ≤ {{remindDays}} 天)</span> <span class="font-medium text-slate-700">临期(到期 ≤ {{remindDays}} 天)</span>
<span class="ml-auto font-semibold text-slate-600">{{homeData?.dept_stats?.near_overdue_total || 0}} 项</span> <span class="ml-auto font-semibold text-slate-600">{{homeData?.dept_stats?.near_overdue_total || 0}} 项</span>
</div> </div>
</div> </div>
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.error }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.error }"></span>
<span class="font-medium text-slate-700">已超期</span> <span class="font-medium text-slate-700">已超期</span>
<span class="ml-auto font-semibold text-slate-600">{{homeData?.dept_stats?.overdue_total || 0}} 项</span> <span class="ml-auto font-semibold text-slate-600">{{homeData?.dept_stats?.overdue_total || 0}} 项</span>
</div> </div>
</div> </div>
<div class="text-[11px] text-slate-400">提醒规则:到期前 {{remindDays}} 天触发(可在「我的任务 · 我的申请」中调整)· 临期 / 超期项请按期办理延期、恢复或转永久</div> <div class="text-[11px] text-slate-400">提醒规则:到期前 {{remindDays}} 天触发(可在「我的任务 · 我的申请」中调整)· 临期 / 超期项请按期办理延期、恢复或转永久</div>
<NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')">
前往「我的任务」办理延期 / 恢复 / 转永久 → 前往「我的任务」办理延期 / 恢复 / 转永久 →
</NButton> </NButton>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
<!-- 尚未关闭的变更所处状态 --> <!-- 尚未关闭的变更所处状态 -->
<NGi span="12 s:12 m:12 l:12"> <NGi span="12 s:12 m:12 l:12">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',height:'100%' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',height:'100%' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">尚未关闭的变更所处状态</p> <p class="text-13px font-700 text-#64749a">尚未关闭的变更所处状态</p>
<p class="text-11px text-#94a3b8">共 {{openTotal}} 项</p> <p class="text-11px text-#94a3b8">共 {{openTotal}} 项</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div v-for="s in homeData?.unclosed_status?.items" :key="s.status"> <div v-for="s in homeData?.unclosed_status?.items" :key="s.status">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="min-w-0 flex-1 text-slate-700">{{ s.label }}</span> <span class="min-w-0 flex-1 text-slate-700">{{ s.label }}</span>
<span class="shrink-0 font-semibold text-slate-600">{{ s.count }} 项</span> <span class="shrink-0 font-semibold text-slate-600">{{ s.count }} 项</span>
</div> </div>
<div class="mt-1 h-1.5 w-full overflow-hidden rounded-full bg-slate-100"> <div class="mt-1 h-1.5 w-full overflow-hidden rounded-full bg-slate-100">
<!-- 审批中 --> <!-- 审批中 -->
<div v-if="s.status === 'APPROVING'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.warning }"></div> <div v-if="s.status === 'APPROVING'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.warning }"></div>
<!-- 已驳回 --> <!-- 已驳回 -->
<div v-if="s.status === 'REJECTED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.error }"></div> <div v-if="s.status === 'REJECTED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.error }"></div>
<!-- 已批准待投用 --> <!-- 已批准待投用 -->
<div v-if="s.status === 'APPROVED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.themeColor }"></div> <div v-if="s.status === 'APPROVED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.themeColor }"></div>
<!-- 待验收 --> <!-- 待验收 -->
<div v-if="s.status === 'IMPLEMENTED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.success }"></div> <div v-if="s.status === 'IMPLEMENTED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.success }"></div>
<!-- 待关闭 --> <!-- 待关闭 -->
<div v-if="s.status === 'ACCEPTED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.error }"></div> <div v-if="s.status === 'ACCEPTED'" class="h-full rounded-full" :style="{ width: `${openTotal ? (s.count / openTotal) * 100 : 0}%`, background: themeStore.otherColor.error }"></div>
</div> </div>
</div> </div>
<div class="text-[11px] text-slate-400">阶段口径:审批中(含会签)→ 已批准待投用 → 待验收 → 待关闭 · 培训 / PSSR 线下签字后拍照上传,并入资料归档</div> <div class="text-[11px] text-slate-400">阶段口径:审批中(含会签)→ 已批准待投用 → 待验收 → 待关闭 · 培训 / PSSR 线下签字后拍照上传,并入资料归档</div>
<NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('changeledger')"> <NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('changeledger')">
明细见变更台账 → 明细见变更台账 →
</NButton> </NButton>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 被驳回信息处理 --> <!-- 被驳回信息处理 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="system-uicons:reset" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="system-uicons:reset" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">被驳回信息处理</p> <p class="text-13px font-700 text-#64749a">被驳回信息处理</p>
<p class="text-11px text-#94a3b8">修改后可重新提交</p> <p class="text-11px text-#94a3b8">修改后可重新提交</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.rejected_todo?.total > 0"> <template v-if="homeData?.rejected_todo?.total > 0">
<div <div
v-for="r in homeData?.rejected_todo?.items?.slice(0, 1)" v-for="r in homeData?.rejected_todo?.items?.slice(0, 1)"
:key="r.id" :key="r.id"
class="border border-red-100 bg-red-50/50 px-3.5 py-2.5" class="border border-red-100 bg-red-50/50 px-3.5 py-2.5"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
}" }"
> >
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<NTag type="error" size="small" class="text-11px">已驳回</NTag> <NTag type="error" size="small" class="text-11px">已驳回</NTag>
<span class="font-mono text-[11px] text-slate-400">{{ r.change_no }}</span> <span class="font-mono text-[11px] text-slate-400">{{ r.change_no }}</span>
<span class="ml-auto text-[11px] text-slate-400">{{ r.rejected_at?.slice(0, 10) }}</span> <span class="ml-auto text-[11px] text-slate-400">{{ r.rejected_at?.slice(0, 10) }}</span>
</div> </div>
<div class="mt-0.5 text-sm font-medium text-slate-800">{{ r.title }}</div> <div class="mt-0.5 text-sm font-medium text-slate-800">{{ r.title }}</div>
<div class="mt-0.5 text-[11px] leading-4 text-red-600/80">驳回原因:{{ r.reject_comment }}</div> <div class="mt-0.5 text-[11px] leading-4 text-red-600/80">驳回原因:{{ r.reject_comment }}</div>
<div class="mt-0.5 text-[11px] text-slate-400">驳回人:{{r.reject_user_name}}</div> <div class="mt-0.5 text-[11px] text-slate-400">驳回人:{{r.reject_user_name}}</div>
<NButton ghost type="error" size="small" class="text-xs mt-1.5" @click="jumpTo('my_initiatechange',r.change_id)">修改重报 →</NButton> <NButton ghost type="error" size="small" class="text-xs mt-1.5" @click="jumpTo('my_initiatechange',r.change_id)">修改重报 →</NButton>
</div> </div>
<NButton dashed type="error" size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton dashed type="error" size="small" class="text-xs" @click="jumpTo('my_mytask')">
还有 {{ (homeData?.rejected_todo?.total - 1) > 0 ? (homeData?.rejected_todo?.total - 1) : 0 }} 条驳回,前往我的任务处理 → 还有 {{ (homeData?.rejected_todo?.total - 1) > 0 ? (homeData?.rejected_todo?.total - 1) : 0 }} 条驳回,前往我的任务处理 →
</NButton> </NButton>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<!-- 资料归档待办 --> <!-- 资料归档待办 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="quill:folder-open" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="quill:folder-open" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">资料归档待办</p> <p class="text-13px font-700 text-#64749a">资料归档待办</p>
<p class="text-11px text-#94a3b8">{{homeData?.archive_todo?.total || 0}} 项待补交</p> <p class="text-11px text-#94a3b8">{{homeData?.archive_todo?.total || 0}} 项待补交</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div v-for="d in homeData?.archive_todo?.items" :key="d.change_id" class="rounded-lg border border-[#ACC6E5] bg-[#EAF0F9]/40 px-3.5 py-2.5"> <div v-for="d in homeData?.archive_todo?.items" :key="d.change_id" class="rounded-lg border border-[#ACC6E5] bg-[#EAF0F9]/40 px-3.5 py-2.5">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<NTag type="warning" size="small" class="text-11px">待归档</NTag> <NTag type="warning" size="small" class="text-11px">待归档</NTag>
<span class="font-mono text-[11px] text-slate-400">{{ d.change_no }}</span> <span class="font-mono text-[11px] text-slate-400">{{ d.change_no }}</span>
</div> </div>
<div class="mt-0.5 text-sm font-medium text-slate-800">{{ d.title }}</div> <div class="mt-0.5 text-sm font-medium text-slate-800">{{ d.title }}</div>
<div class="mt-0.5 line-clamp-1 text-[11px] leading-4 text-slate-400">缺项:{{ d.missing_names }}</div> <div class="mt-0.5 line-clamp-1 text-[11px] leading-4 text-slate-400">缺项:{{ d.missing_names }}</div>
<NButton type="primary" size="small" class="text-xs mt-1.5" @click="jumpTo('details_closedoc',d.change_id)"> <NButton type="primary" size="small" class="text-xs mt-1.5" @click="jumpTo('details_closedoc',d.change_id)">
去补交(资料关闭页上传)→ 去补交(资料关闭页上传)→
</NButton> </NButton>
</div> </div>
<div class="text-[11px] leading-4 text-slate-400">上传纸质扫描件 / 照片即视为完成确认并联动归档清单;支持传错删除重传、阶段性保存</div> <div class="text-[11px] leading-4 text-slate-400">上传纸质扫描件 / 照片即视为完成确认并联动归档清单;支持传错删除重传、阶段性保存</div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
+406 -406
View File
@@ -1,406 +1,406 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } 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 { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { homeProfessionalApi } from "@/service/api/statistics"; import { homeProfessionalApi } from "@/service/api/statistics";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
// 变更类型列表 // 变更类型列表
const typeList = ref<any>([]); const typeList = ref<any>([]);
// 变更等级列表 // 变更等级列表
const levelList = ref<any>([]); const levelList = ref<any>([]);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 跳转变更申请页面、变更台账、我的任务、发起变更 // 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => { const jumpTo = (key: string,qid:number = 0) => {
if(key==='details_index' && qid){ if(key==='details_index' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_approval' && qid){ }else if(key==='details_approval' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{ }else{
routerPushByKey(key as any); routerPushByKey(key as any);
} }
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 匹配对象 // 匹配对象
const matchObj = (list:any,val:number) => { const matchObj = (list:any,val:number) => {
const obj = list.find((item:any) => item.value == val); const obj = list.find((item:any) => item.value == val);
return obj || null; return obj || null;
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeProfessionalApi(); const {data,error} = await homeProfessionalApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
// 解析 变更类型设置 // 解析 变更类型设置
const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type');
if (changeTypeGroup) { if (changeTypeGroup) {
typeList.value = changeTypeGroup.items; typeList.value = changeTypeGroup.items;
} }
// 解析 变更等级设置 // 解析 变更等级设置
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
if (changeLevelGroup) { if (changeLevelGroup) {
levelList.value = changeLevelGroup.items; levelList.value = changeLevelGroup.items;
} }
} }
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getConfig(); getConfig();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:12"> <NGi span="24 s:24 m:12">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:12" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:12" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton ghost size="small" @click="jumpTo('changeledger')"> <NButton ghost size="small" @click="jumpTo('changeledger')">
专业变更查询 专业变更查询
</NButton> </NButton>
<NButton type="primary" size="small" @click="jumpTo('my_mytask')"> <NButton type="primary" size="small" @click="jumpTo('my_mytask')">
<Icon icon="lucide:clipboard-check" class="size-14px" /> <Icon icon="lucide:clipboard-check" class="size-14px" />
审批待办 审批待办
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.todo_sign?.total || 0" :end-value="homeData?.todo_sign?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: homeData?.todo_sign?.overdue_count > 0?themeStore.otherColor.error:themeStore.themeColor }" :style="{ color: homeData?.todo_sign?.overdue_count > 0?themeStore.otherColor.error:themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">待我会签</p> <p class="text-12px font-600">待我会签</p>
<p v-if="homeData?.todo_sign?.overdue_count > 0" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count}} 项 · 请优先处理</p> <p v-if="homeData?.todo_sign?.overdue_count > 0" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count}} 项 · 请优先处理</p>
<p v-else class="text-12px text-slate-400">无超期</p> <p v-else class="text-12px text-slate-400">无超期</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('professionalstatistics')" @click="jumpTo('professionalstatistics')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.sign_stats?.month_signed || 0" :end-value="homeData?.sign_stats?.month_signed || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">本月已会签</p> <p class="text-12px font-600">本月已会签</p>
<p class="text-12px text-slate-400">含驳回 {{homeData?.sign_stats?.month_rejected || 0}} 起 · 系统自动采集</p> <p class="text-12px text-slate-400">含驳回 {{homeData?.sign_stats?.month_rejected || 0}} 起 · 系统自动采集</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_highrisk')" @click="jumpTo('my_highrisk')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.high_risk?.total || 0" :end-value="homeData?.high_risk?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">在办高风险</p> <p class="text-12px font-600">在办高风险</p>
<p class="text-12px text-slate-400">本专业相关 · 建议关注</p> <p class="text-12px text-slate-400">本专业相关 · 建议关注</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('professionalstatistics')" @click="jumpTo('professionalstatistics')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.sign_stats?.risk_analysis_count || 0" :end-value="homeData?.sign_stats?.risk_analysis_count || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">参与风险分析</p> <p class="text-12px font-600">参与风险分析</p>
<p class="text-12px text-slate-400">作为分析组成员(选择式)· 近一年</p> <p class="text-12px text-slate-400">作为分析组成员(选择式)· 近一年</p>
</div> </div>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 待我会签 --> <!-- 待我会签 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">待我会签</p> <p class="text-13px font-700 text-#64749a">待我会签</p>
<p class="text-11px text-#94a3b8 mt-2px">超期项行内红色标记 · 审批时自动展示专业相关附件</p> <p class="text-11px text-#94a3b8 mt-2px">超期项行内红色标记 · 审批时自动展示专业相关附件</p>
</div> </div>
<NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')">
我的任务 我的任务
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.todo_sign?.total > 0"> <template v-if="homeData?.todo_sign?.total > 0">
<div v-for="row in homeData?.todo_sign?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)" <div v-for="row in homeData?.todo_sign?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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">{{ row.change_no }}</span> <span class="font-mono text-[11px] text-slate-400">{{ row.change_no }}</span>
<NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag> <NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag>
<!-- 变更等级 --> <!-- 变更等级 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(levelList,row.change_level)?.color), color: tagBgColor(matchObj(levelList,row.change_level)?.color),
textColor: tagTextColor(matchObj(levelList,row.change_level)?.color), textColor: tagTextColor(matchObj(levelList,row.change_level)?.color),
borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color), borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color),
}" }"
>{{matchObj(levelList,row.change_level)?.label}}</NTag> >{{matchObj(levelList,row.change_level)?.label}}</NTag>
<!-- 变更类型 --> <!-- 变更类型 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(typeList,row.change_type)?.color), color: tagBgColor(matchObj(typeList,row.change_type)?.color),
textColor: tagTextColor(matchObj(typeList,row.change_type)?.color), textColor: tagTextColor(matchObj(typeList,row.change_type)?.color),
borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color), borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color),
}" }"
>{{matchObj(typeList,row.change_type)?.label}}</NTag> >{{matchObj(typeList,row.change_type)?.label}}</NTag>
<NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag> <NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag>
<NTag class="text-[11px]" v-else type="info" size="small">永久</NTag> <NTag class="text-[11px]" v-else type="info" size="small">永久</NTag>
<span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days || 0}} 天</span> <span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days || 0}} 天</span>
</div> </div>
<div class="mt-1 flex items-center gap-2"> <div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<NTag v-if="row.step_name" size="small" type="warning">{{row.step_name}}</NTag> <NTag v-if="row.step_name" size="small" type="warning">{{row.step_name}}</NTag>
<NButton size="small" type="primary" class="text-xs"> <NButton size="small" type="primary" class="text-xs">
去审批 去审批
<Icon icon="akar-icons:arrow-right" class="size-13px ml-1" /> <Icon icon="akar-icons:arrow-right" class="size-13px ml-1" />
</NButton> </NButton>
</div> </div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2"> <div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<p>申请人:{{row.applicant_name}}</p> <p>申请人:{{row.applicant_name}}</p>
<span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span> <span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span>
</div> </div>
</div> </div>
</div> </div>
<NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')">
还有{{(homeData?.todo_sign?.total - 3) > 0 ? (homeData?.todo_sign?.total - 3) : 0}}条,前往我的任务查看全部 → 还有{{(homeData?.todo_sign?.total - 3) > 0 ? (homeData?.todo_sign?.total - 3) : 0}}条,前往我的任务查看全部 →
</NButton> </NButton>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]"> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]">
<!-- 最近已会签 --> <!-- 最近已会签 -->
<NGi span="24 s:24 m:24 l:24"> <NGi span="24 s:24 m:24 l:24">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="ix:success" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="ix:success" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">最近已会签</p> <p class="text-13px font-700 text-#64749a">最近已会签</p>
<p class="text-11px text-#94a3b8 mt-2px">本人签署记录 · 点击直达变更内容</p> <p class="text-11px text-#94a3b8 mt-2px">本人签署记录 · 点击直达变更内容</p>
</div> </div>
<div v-if="homeData?.signed_recent?.items.length" class="flex flex-col gap-3"> <div v-if="homeData?.signed_recent?.items.length" class="flex flex-col gap-3">
<div v-for="item in homeData?.signed_recent?.items" :key="item.change_id" class="rounded-md border px-3 py-2 flex items-center justify-between gap-2 cursor-pointer" @click="jumpTo('details_index', item.change_id)"> <div v-for="item in homeData?.signed_recent?.items" :key="item.change_id" class="rounded-md border px-3 py-2 flex items-center justify-between gap-2 cursor-pointer" @click="jumpTo('details_index', item.change_id)">
<div> <div>
<p class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ item.title }}</p> <p class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ item.title }}</p>
<p class="font-mono text-[11px] text-slate-400 flex items-center gap-3"> <p class="font-mono text-[11px] text-slate-400 flex items-center gap-3">
<span>{{ item.change_no }}</span> <span>{{ item.change_no }}</span>
<span>{{ item.finished_at?.slice(0, 16) }}</span> <span>{{ item.finished_at?.slice(0, 16) }}</span>
</p> </p>
</div> </div>
<NTag v-if="item.status==='PENDING'" size="small" type="warning" class="text-xs">待会签</NTag> <NTag v-if="item.status==='PENDING'" size="small" type="warning" class="text-xs">待会签</NTag>
<NTag v-if="item.status==='PASSED'" size="small" type="success" class="text-xs">通过</NTag> <NTag v-if="item.status==='PASSED'" size="small" type="success" class="text-xs">通过</NTag>
<NTag v-if="item.status==='REJECTED'" size="small" type="error" class="text-xs">驳回</NTag> <NTag v-if="item.status==='REJECTED'" size="small" type="error" class="text-xs">驳回</NTag>
</div> </div>
</div> </div>
<div v-else class="h-100% flex items-center justify-center py-3"> <div v-else class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 高风险变更 --> <!-- 高风险变更 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">高风险变更</p> <p class="text-13px font-700 text-#64749a">高风险变更</p>
<p class="text-11px text-#94a3b8">在办 · 建议重点关注</p> <p class="text-11px text-#94a3b8">在办 · 建议重点关注</p>
</div> </div>
<template v-if="homeData?.high_risk?.total > 0"> <template v-if="homeData?.high_risk?.total > 0">
<div class="space-y-2.5"> <div class="space-y-2.5">
<div v-for="h in homeData?.high_risk?.items || []" :key="h.record_id" class="rounded-md border border-amber-200 bg-amber-50/60 px-3.5 py-2.5"> <div v-for="h in homeData?.high_risk?.items || []" :key="h.record_id" class="rounded-md border border-amber-200 bg-amber-50/60 px-3.5 py-2.5">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ h.change_title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ h.change_title }}</span>
<NButton size="tiny" ghost type="warning" class="text-xs" @click="jumpTo('my_highrisk')">查看分析</NButton> <NButton size="tiny" ghost type="warning" class="text-xs" @click="jumpTo('my_highrisk')">查看分析</NButton>
</div> </div>
<div class="mt-1 text-[11px]" :style="{ color: themeStore.otherColor.warning }">{{ h.scene }}</div> <div class="mt-1 text-[11px]" :style="{ color: themeStore.otherColor.warning }">{{ h.scene }}</div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</NCard> </NCard>
<!-- 我的会签效率 --> <!-- 我的会签效率 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">我的会签效率</p> <p class="text-13px font-700 text-#64749a">我的会签效率</p>
<p class="text-11px text-#94a3b8">系统自动采集 · 近 30 天</p> <p class="text-11px text-#94a3b8">系统自动采集 · 近 30 天</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">平均耗时</span> <span class="text-xs text-slate-500 w-16">平均耗时</span>
<NProgress <NProgress
type="line" type="line"
status="info" status="info"
:percentage="((homeData?.sign_stats?.avg_audit_days || 0) / 2) * 100" :percentage="((homeData?.sign_stats?.avg_audit_days || 0) / 2) * 100"
:height="10" :height="10"
border-radius="6px" border-radius="6px"
> >
<span class="text-xs text-slate-700 font-semibold">{{homeData?.sign_stats?.avg_audit_days || 0}}天</span> <span class="text-xs text-slate-700 font-semibold">{{homeData?.sign_stats?.avg_audit_days || 0}}天</span>
</NProgress> </NProgress>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">最长耗时</span> <span class="text-xs text-slate-500 w-16">最长耗时</span>
<NProgress <NProgress
type="line" type="line"
status="error" status="error"
:percentage="((homeData?.sign_stats?.max_audit_days || 0) / 2) * 100" :percentage="((homeData?.sign_stats?.max_audit_days || 0) / 2) * 100"
:height="10" :height="10"
border-radius="6px" border-radius="6px"
> >
<span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.sign_stats?.max_audit_days || 0}}天</span> <span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.sign_stats?.max_audit_days || 0}}天</span>
</NProgress> </NProgress>
</div> </div>
<div class="flex items-center justify-between text-[11px] text-slate-400"> <div class="flex items-center justify-between text-[11px] text-slate-400">
<span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0}}%</b></span> <span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0}}%</b></span>
<span>目标 2 天内签署</span> <span>目标 2 天内签署</span>
</div> </div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
+439 -439
View File
@@ -1,439 +1,439 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } 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 { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor, downloadFileFun } from '@/utils/common'; import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor, downloadFileFun } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { homeSafeApi } from "@/service/api/statistics"; import { homeSafeApi } from "@/service/api/statistics";
import previewComponent from '@/components/previewFile/index.vue' import previewComponent from '@/components/previewFile/index.vue'
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 附件在线预览弹窗 // 附件在线预览弹窗
const previewModal = ref<boolean>(false); const previewModal = ref<boolean>(false);
// 附件在线预览文件 // 附件在线预览文件
const previewFile = ref<any>(null); const previewFile = ref<any>(null);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
// 变更类型列表 // 变更类型列表
const typeList = ref<any>([]); const typeList = ref<any>([]);
// 变更等级列表 // 变更等级列表
const levelList = ref<any>([]); const levelList = ref<any>([]);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 跳转页面 // 跳转页面
const jumpTo = (key: string,qid:number = 0) => { const jumpTo = (key: string,qid:number = 0) => {
if(key==='details_approval' && qid){ if(key==='details_approval' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{ }else{
routerPushByKey(key as any); routerPushByKey(key as any);
} }
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 查看 // 查看
const viewFile = (file: any) => { const viewFile = (file: any) => {
previewFile.value = file; previewFile.value = file;
previewModal.value = true; previewModal.value = true;
}; };
// 下载 // 下载
const downloadFile = (file: any) => { const downloadFile = (file: any) => {
downloadFileFun(file.file_url, file.file_name); downloadFileFun(file.file_url, file.file_name);
}; };
// 下载模板 // 下载模板
const downloadTemplate = (record: any) => { const downloadTemplate = (record: any) => {
window.$message?.info('还差接口') window.$message?.info('还差接口')
}; };
// 匹配对象 // 匹配对象
const matchObj = (list:any,val:number) => { const matchObj = (list:any,val:number) => {
const obj = list.find((item:any) => item.value == val); const obj = list.find((item:any) => item.value == val);
return obj || null; return obj || null;
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeSafeApi(); const {data,error} = await homeSafeApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
// 解析 变更类型设置 // 解析 变更类型设置
const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type');
if (changeTypeGroup) { if (changeTypeGroup) {
typeList.value = changeTypeGroup.items; typeList.value = changeTypeGroup.items;
} }
// 解析 变更等级设置 // 解析 变更等级设置
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
if (changeLevelGroup) { if (changeLevelGroup) {
levelList.value = changeLevelGroup.items; levelList.value = changeLevelGroup.items;
} }
} }
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getConfig(); getConfig();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:10"> <NGi span="24 s:24 m:10">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:14" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:14" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton ghost size="small" @click="jumpTo('my_pssr')"> <NButton ghost size="small" @click="jumpTo('my_pssr')">
投用与验收总览 投用与验收总览
</NButton> </NButton>
<NButton ghost size="small" @click="jumpTo('my_highrisk')"> <NButton ghost size="small" @click="jumpTo('my_highrisk')">
全厂风险看板 全厂风险看板
</NButton> </NButton>
<NButton type="primary" size="small" @click="jumpTo('my_mytask')"> <NButton type="primary" size="small" @click="jumpTo('my_mytask')">
<Icon icon="lucide:clipboard-check" class="size-14px" /> <Icon icon="lucide:clipboard-check" class="size-14px" />
审批待办 审批待办
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.todo_sign?.total || 0" :end-value="homeData?.todo_sign?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: homeData?.todo_sign?.overdue_count > 0?themeStore.otherColor.error:themeStore.themeColor }" :style="{ color: homeData?.todo_sign?.overdue_count > 0?themeStore.otherColor.error:themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">待我审批</p> <p class="text-12px font-600">待我审批</p>
<p v-if="homeData?.todo_sign?.overdue_count > 0" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count}} 项 · 请优先处理</p> <p v-if="homeData?.todo_sign?.overdue_count > 0" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count}} 项 · 请优先处理</p>
<p v-else class="text-12px text-slate-400">安全审查节点 · 与我的任务同源</p> <p v-else class="text-12px text-slate-400">安全审查节点 · 与我的任务同源</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_pssr')" @click="jumpTo('my_pssr')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.pssr_supervise?.total || 0" :end-value="homeData?.pssr_supervise?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">PSSR监督</p> <p class="text-12px font-600">PSSR监督</p>
<p class="text-12px text-slate-400">待PSSR / 待验收 · 按变更状态实时统计</p> <p class="text-12px text-slate-400">待PSSR / 待验收 · 按变更状态实时统计</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_highrisk')" @click="jumpTo('my_highrisk')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.high_risk?.total || 0" :end-value="homeData?.high_risk?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.otherColor.error }" :style="{ color: themeStore.otherColor.error }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">高风险在办</p> <p class="text-12px font-600">高风险在办</p>
<p class="text-12px" :style="{ color: themeStore.otherColor.error }">全厂 · 需重点跟踪</p> <p class="text-12px" :style="{ color: themeStore.otherColor.error }">全厂 · 需重点跟踪</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.temp_expiry_scope?.total || 0" :end-value="homeData?.temp_expiry_scope?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: homeData?.temp_expiry_scope?.overdue_count > 0?themeStore.otherColor.error:themeStore.themeColor }" :style="{ color: homeData?.temp_expiry_scope?.overdue_count > 0?themeStore.otherColor.error:themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">临时变更到期</p> <p class="text-12px font-600">临时变更到期</p>
<p v-if="homeData?.temp_expiry_scope?.overdue_count > 0" class="text-12px" :style="{ color: themeStore.otherColor.error }">含超期 {{homeData?.temp_expiry_scope?.overdue_count}} 项 · 红色预警</p> <p v-if="homeData?.temp_expiry_scope?.overdue_count > 0" class="text-12px" :style="{ color: themeStore.otherColor.error }">含超期 {{homeData?.temp_expiry_scope?.overdue_count}} 项 · 红色预警</p>
<p v-else class="text-12px text-slate-400">无超期</p> <p v-else class="text-12px text-slate-400">无超期</p>
</div> </div>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 审批待办 --> <!-- 审批待办 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">审批待办</p> <p class="text-13px font-700 text-#64749a">审批待办</p>
<p class="text-11px text-#94a3b8 mt-2px">安全审查 · 审批时自动展示相关附件</p> <p class="text-11px text-#94a3b8 mt-2px">安全审查 · 审批时自动展示相关附件</p>
</div> </div>
<NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')">
我的任务 我的任务
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.todo_sign?.total > 0"> <template v-if="homeData?.todo_sign?.total > 0">
<div v-for="row in homeData?.todo_sign?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)" <div v-for="row in homeData?.todo_sign?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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="text-[11px] text-slate-400">{{ row.change_no }}</span> <span class="text-[11px] text-slate-400">{{ row.change_no }}</span>
<NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag> <NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag>
<!-- 变更等级 --> <!-- 变更等级 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(levelList,row.change_level)?.color), color: tagBgColor(matchObj(levelList,row.change_level)?.color),
textColor: tagTextColor(matchObj(levelList,row.change_level)?.color), textColor: tagTextColor(matchObj(levelList,row.change_level)?.color),
borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color), borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color),
}" }"
>{{matchObj(levelList,row.change_level)?.label}}</NTag> >{{matchObj(levelList,row.change_level)?.label}}</NTag>
<!-- 变更类型 --> <!-- 变更类型 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(typeList,row.change_type)?.color), color: tagBgColor(matchObj(typeList,row.change_type)?.color),
textColor: tagTextColor(matchObj(typeList,row.change_type)?.color), textColor: tagTextColor(matchObj(typeList,row.change_type)?.color),
borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color), borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color),
}" }"
>{{matchObj(typeList,row.change_type)?.label}}</NTag> >{{matchObj(typeList,row.change_type)?.label}}</NTag>
<NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag> <NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag>
<NTag class="text-[11px]" v-else type="info" size="small">永久</NTag> <NTag class="text-[11px]" v-else type="info" size="small">永久</NTag>
<span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days || 0}} 天</span> <span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days || 0}} 天</span>
</div> </div>
<div class="mt-1 flex items-center gap-2"> <div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<NTag v-if="row.step_name" size="small" type="warning">审批:{{row.step_name}}</NTag> <NTag v-if="row.step_name" size="small" type="warning">审批:{{row.step_name}}</NTag>
<NButton size="small" type="primary" class="text-xs"> <NButton size="small" type="primary" class="text-xs">
去审批 去审批
<Icon icon="akar-icons:arrow-right" class="size-13px ml-1" /> <Icon icon="akar-icons:arrow-right" class="size-13px ml-1" />
</NButton> </NButton>
</div> </div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2"> <div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<p>申请人:{{row.applicant_name}}</p> <p>申请人:{{row.applicant_name}}</p>
<span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span> <span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span>
</div> </div>
</div> </div>
</div> </div>
<NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')">
还有{{(homeData?.my_changes_progress?.total - 3) > 0 ? (homeData?.my_changes_progress?.total - 3) : 0}}条,前往我的任务查看全部 → 还有{{(homeData?.my_changes_progress?.total - 3) > 0 ? (homeData?.my_changes_progress?.total - 3) : 0}}条,前往我的任务查看全部 →
</NButton> </NButton>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]"> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]">
<!-- 通过审批的变更(未关闭) --> <!-- 通过审批的变更(未关闭) -->
<NGi span="24 s:24 m:24 l:24"> <NGi span="24 s:24 m:24 l:24">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lucide:list-checks" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:list-checks" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">通过审批的变更(未关闭)</p> <p class="text-13px font-700 text-#64749a">通过审批的变更(未关闭)</p>
<p class="text-11px text-#94a3b8 mt-2px">PSSR 材料同行显示 · 查看 / 下载</p> <p class="text-11px text-#94a3b8 mt-2px">PSSR 材料同行显示 · 查看 / 下载</p>
<NButton ghost size="small" class="text-xs ml-auto" @click="jumpTo('my_pssr')"> <NButton ghost size="small" class="text-xs ml-auto" @click="jumpTo('my_pssr')">
进入管理 进入管理
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div v-if="homeData?.pssr_supervise?.total>0" class="flex flex-col gap-3"> <div v-if="homeData?.pssr_supervise?.total>0" class="flex flex-col gap-3">
<div v-for="item in homeData?.pssr_supervise?.items" :key="item.id" class="rounded-md border px-3 py-2 flex items-center justify-between gap-2"> <div v-for="item in homeData?.pssr_supervise?.items" :key="item.id" class="rounded-md border px-3 py-2 flex items-center justify-between gap-2">
<div> <div>
<p class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{item.title}}</p> <p class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{item.title}}</p>
<p class="mt-0.5 text-[11px] text-slate-400 flex items-center gap-2"> <p class="mt-0.5 text-[11px] text-slate-400 flex items-center gap-2">
<span>{{item.change_no}}</span> <span>{{item.change_no}}</span>
<span>{{item.org_name}}</span> <span>{{item.org_name}}</span>
<span>{{item.applicant_name}}</span> <span>{{item.applicant_name}}</span>
</p> </p>
</div> </div>
<div class="flex items-center gap-1.5 rounded-md border bg-slate-50/60 px-2 py-1"> <div class="flex items-center gap-1.5 rounded-md border bg-slate-50/60 px-2 py-1">
<Icon icon="akar-icons:file" class="size-14px" :style="{ color: themeStore.themeColor }" /> <Icon icon="akar-icons:file" class="size-14px" :style="{ color: themeStore.themeColor }" />
<span class="text-[11px] font-medium text-slate-600">PSSR 确认表</span> <span class="text-[11px] font-medium text-slate-600">PSSR 确认表</span>
<template v-if="item.pssr_attachment"> <template v-if="item.pssr_attachment">
<span class="max-w-[150px] truncate text-[11px] text-slate-400">{{ item.pssr_attachment?.file_name }}</span> <span class="max-w-[150px] truncate text-[11px] text-slate-400">{{ item.pssr_attachment?.file_name }}</span>
<NButton ghost size="tiny" class="text-11px" @click="viewFile(item.pssr_attachment)">查看</NButton> <NButton ghost size="tiny" class="text-11px" @click="viewFile(item.pssr_attachment)">查看</NButton>
<NButton ghost size="tiny" class="text-11px" @click="downloadFile(item.pssr_attachment)">下载</NButton> <NButton ghost size="tiny" class="text-11px" @click="downloadFile(item.pssr_attachment)">下载</NButton>
</template> </template>
<template v-else> <template v-else>
<span class="text-[11px]" :style="{ color: themeStore.otherColor.warning }">待传</span> <span class="text-[11px]" :style="{ color: themeStore.otherColor.warning }">待传</span>
<NButton ghost size="tiny" class="text-11px" @click="downloadTemplate(item)">下载模板</NButton> <NButton ghost size="tiny" class="text-11px" @click="downloadTemplate(item)">下载模板</NButton>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
<div v-else class="h-100% flex items-center justify-center py-3"> <div v-else class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 高风险变更跟踪 --> <!-- 高风险变更跟踪 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">高风险变更跟踪</p> <p class="text-13px font-700 text-#64749a">高风险变更跟踪</p>
<p class="text-11px text-#94a3b8">重要等级 · 未关闭 · 实时推导</p> <p class="text-11px text-#94a3b8">重要等级 · 未关闭 · 实时推导</p>
</div> </div>
<template v-if="homeData?.high_risk?.total > 0"> <template v-if="homeData?.high_risk?.total > 0">
<div class="space-y-2.5"> <div class="space-y-2.5">
<div v-for="c in homeData?.high_risk?.items || []" :key="c.record_id" class="rounded-lg border border-red-200 bg-red-50/50 px-3.5 py-2.5"> <div v-for="c in homeData?.high_risk?.items || []" :key="c.record_id" class="rounded-lg border border-red-200 bg-red-50/50 px-3.5 py-2.5">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ c.change_title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ c.change_title }}</span>
<NButton size="tiny" ghost type="error" class="text-xs" @click="jumpTo('my_highrisk')">查看分析</NButton> <NButton size="tiny" ghost type="error" class="text-xs" @click="jumpTo('my_highrisk')">查看分析</NButton>
</div> </div>
<div class="mt-1 text-[11px] flex items-center gap-2" :style="{ color: themeStore.otherColor.error }"> <div class="mt-1 text-[11px] flex items-center gap-2" :style="{ color: themeStore.otherColor.error }">
<span>{{ c.change_no }}</span> <span>{{ c.change_no }}</span>
<!-- 状态 --> <!-- 状态 -->
<span v-if="c.change_status==='APPROVING'">审批中</span> <span v-if="c.change_status==='APPROVING'">审批中</span>
<span v-if="c.change_status==='APPROVED'">已通过</span> <span v-if="c.change_status==='APPROVED'">已通过</span>
<span v-if="c.change_status==='IMPLEMENTED'">待验收</span> <span v-if="c.change_status==='IMPLEMENTED'">待验收</span>
<span v-if="c.change_status==='ACCEPTED'">待关闭</span> <span v-if="c.change_status==='ACCEPTED'">待关闭</span>
<span v-if="c.change_status==='CLOSED'">已关闭</span> <span v-if="c.change_status==='CLOSED'">已关闭</span>
<span v-if="c.change_status==='WITHDRAWN'">已撤回</span> <span v-if="c.change_status==='WITHDRAWN'">已撤回</span>
<span v-if="c.change_status==='REJECTED'">已驳回</span> <span v-if="c.change_status==='REJECTED'">已驳回</span>
<span>{{c.org_name}}</span> <span>{{c.org_name}}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
<!-- 附件在线预览弹窗 --> <!-- 附件在线预览弹窗 -->
<NModal <NModal
v-model:show="previewModal" v-model:show="previewModal"
preset="card" preset="card"
:auto-focus="false" :auto-focus="false"
:style="{ width: '80%', height: 'auto' }" :style="{ width: '80%', height: 'auto' }"
:segmented="{ content: true, footer: true }" :segmented="{ content: true, footer: true }"
> >
<template #header> <template #header>
<div class="flex items-center gap-2 text-base font-semibold text-slate-800"> <div class="flex items-center gap-2 text-base font-semibold text-slate-800">
<Icon icon="akar-icons:file" class="size-18px" /> {{ previewFile?.file_name }} <Icon icon="akar-icons:file" class="size-18px" /> {{ previewFile?.file_name }}
</div> </div>
</template> </template>
<template #default> <template #default>
<div class="space-y-3"> <div class="space-y-3">
<div class="flex flex-wrap gap-x-4 gap-y-1 text-xs text-slate-400"> <div class="flex flex-wrap gap-x-4 gap-y-1 text-xs text-slate-400">
<span>上传人:{{ previewFile?.uploader_name }}</span> <span>上传人:{{ previewFile?.uploader_name }}</span>
<span>上传时间:{{ previewFile?.created_at?.slice(0, 16) }}</span> <span>上传时间:{{ previewFile?.created_at?.slice(0, 16) }}</span>
<span v-if="previewFile?.version">{{ `版本:${previewFile?.version}(受控)` }}</span> <span v-if="previewFile?.version">{{ `版本:${previewFile?.version}(受控)` }}</span>
</div> </div>
<previewComponent v-if="previewFile" :previewFile="previewFile" /> <previewComponent v-if="previewFile" :previewFile="previewFile" />
</div> </div>
</template> </template>
</NModal> </NModal>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
File diff suppressed because it is too large Load Diff
+454 -454
View File
@@ -1,454 +1,454 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } 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 { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { homeLeaderApi } from "@/service/api/statistics"; import { homeLeaderApi } from "@/service/api/statistics";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
// 变更等级列表 // 变更等级列表
const levelList = ref<any>([]); const levelList = ref<any>([]);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 跳转变更申请页面、变更台账、我的任务、发起变更 // 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => { const jumpTo = (key: string,qid:number = 0) => {
if(key==='details_approval' && qid){ if(key==='details_approval' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_index' && qid){ }else if(key==='details_index' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{ }else{
routerPushByKey(key as any); routerPushByKey(key as any);
} }
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 获取正常、临期、超期数量 // 获取正常、临期、超期数量
const getNormalNearOverdue = (key:string) => { const getNormalNearOverdue = (key:string) => {
const targetItem = homeData.value?.temp_expiry_scope?.items?.find((item:any) => item.key === key); const targetItem = homeData.value?.temp_expiry_scope?.items?.find((item:any) => item.key === key);
return targetItem?.count || 0; return targetItem?.count || 0;
} }
// 匹配对象 // 匹配对象
const matchObj = (list:any,val:number) => { const matchObj = (list:any,val:number) => {
const obj = list.find((item:any) => item.value == val); const obj = list.find((item:any) => item.value == val);
return obj || null; return obj || null;
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeLeaderApi(); const {data,error} = await homeLeaderApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
// 解析 变更等级设置 // 解析 变更等级设置
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
if (changeLevelGroup) { if (changeLevelGroup) {
levelList.value = changeLevelGroup.items; levelList.value = changeLevelGroup.items;
} }
} }
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getConfig(); getConfig();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:8"> <NGi span="24 s:24 m:8">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:16" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:16" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton ghost size="small" @click="jumpTo('factoryoverview')"> <NButton ghost size="small" @click="jumpTo('factoryoverview')">
全厂变更看板 全厂变更看板
</NButton> </NButton>
<NButton type="primary" size="small" @click="jumpTo('my_mytask')"> <NButton type="primary" size="small" @click="jumpTo('my_mytask')">
<Icon icon="lucide:clipboard-check" class="size-14px" /> <Icon icon="lucide:clipboard-check" class="size-14px" />
重要变更审批 重要变更审批
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16" <NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16"
:style="{ :style="{
'--theme-color': themeStore.themeColor, '--theme-color': themeStore.themeColor,
'--theme-bg': getColorWithOpacity(themeStore.themeColor, 0.2), '--theme-bg': getColorWithOpacity(themeStore.themeColor, 0.2),
'--warning-bg': getColorWithOpacity(themeStore.otherColor.warning, 0.2), '--warning-bg': getColorWithOpacity(themeStore.otherColor.warning, 0.2),
'--warning-color': themeStore.otherColor.warning, '--warning-color': themeStore.otherColor.warning,
'--success-color': themeStore.otherColor.success, '--success-color': themeStore.otherColor.success,
'--success-bg': getColorWithOpacity(themeStore.otherColor.success, 0.2), '--success-bg': getColorWithOpacity(themeStore.otherColor.success, 0.2),
'--error-color': themeStore.otherColor.error, '--error-color': themeStore.otherColor.error,
'--error-bg': getColorWithOpacity(themeStore.otherColor.error, 0.2), '--error-bg': getColorWithOpacity(themeStore.otherColor.error, 0.2),
}" }"
> >
<NGi> <NGi>
<div <div
class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1" class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<span class="shrink-0 rounded-lg p-2.5 bg-[var(--theme-bg)]"> <span class="shrink-0 rounded-lg p-2.5 bg-[var(--theme-bg)]">
<Icon icon="lucide:clipboard-check" class="size-24px text-[--theme-color]" /> <Icon icon="lucide:clipboard-check" class="size-24px text-[--theme-color]" />
</span> </span>
<div class="flex flex-col"> <div class="flex flex-col">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.todo_approvals?.total || 0" :end-value="homeData?.todo_approvals?.total || 0"
class="text-26px font-600" class="text-26px font-600"
/> />
<p class="text-[11px] font-semibold text-slate-400">待我终批 · 均为重要变更</p> <p class="text-[11px] font-semibold text-slate-400">待我终批 · 均为重要变更</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1" class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<span class="shrink-0 rounded-lg p-2.5 bg-[var(--success-bg)]"> <span class="shrink-0 rounded-lg p-2.5 bg-[var(--success-bg)]">
<Icon icon="akar-icons:file" class="size-24px text-[--success-color]" /> <Icon icon="akar-icons:file" class="size-24px text-[--success-color]" />
</span> </span>
<div class="flex flex-col"> <div class="flex flex-col">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.unclosed_status?.total || 0" :end-value="homeData?.unclosed_status?.total || 0"
class="text-26px font-600" class="text-26px font-600"
/> />
<div class="text-[11px] font-semibold text-slate-400 flex items-center gap-x-2 flex-wrap"> <div class="text-[11px] font-semibold text-slate-400 flex items-center gap-x-2 flex-wrap">
当前未关闭变更 当前未关闭变更
<span v-for="item in homeData?.unclosed_status?.items || []" :key="item.status">{{item.label}} {{item.count}}</span> <span v-for="item in homeData?.unclosed_status?.items || []" :key="item.status">{{item.label}} {{item.count}}</span>
</div> </div>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1" class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<span class="shrink-0 rounded-lg p-2.5 bg-[var(--warning-bg)]"> <span class="shrink-0 rounded-lg p-2.5 bg-[var(--warning-bg)]">
<Icon icon="lets-icons:clock" class="size-24px text-[--warning-color]" /> <Icon icon="lets-icons:clock" class="size-24px text-[--warning-color]" />
</span> </span>
<div class="flex flex-col"> <div class="flex flex-col">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.temp_expiry_scope?.total || 0" :end-value="homeData?.temp_expiry_scope?.total || 0"
class="text-26px font-600 text-[var(--warning-color)]" class="text-26px font-600 text-[var(--warning-color)]"
/> />
<div class="text-[11px] font-semibold text-slate-400 flex items-center gap-x-2 flex-wrap"> <div class="text-[11px] font-semibold text-slate-400 flex items-center gap-x-2 flex-wrap">
临时变更临期或到期 临时变更临期或到期
<span v-for="item in homeData?.temp_expiry_scope?.items || []" :key="item.status">{{item.label}} {{item.count}}</span> <span v-for="item in homeData?.temp_expiry_scope?.items || []" :key="item.status">{{item.label}} {{item.count}}</span>
</div> </div>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1" class="h-100% flex-1 flex items-center gap-3 bg-white px-16px py-12px cursor-pointer transition hover:-translate-y-1"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<span class="shrink-0 rounded-lg p-2.5 bg-[var(--error-bg)]"> <span class="shrink-0 rounded-lg p-2.5 bg-[var(--error-bg)]">
<Icon icon="proicons:alert-triangle" class="size-24px text-[--error-color]" /> <Icon icon="proicons:alert-triangle" class="size-24px text-[--error-color]" />
</span> </span>
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex items-center"> <div class="flex items-center">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.overdue_unclosed?.total || 0" :end-value="homeData?.overdue_unclosed?.total || 0"
class="text-26px font-600 text-[var(--error-color)]" class="text-26px font-600 text-[var(--error-color)]"
/> />
</div> </div>
<p class="text-[11px] font-semibold text-slate-400">超期未关闭 · 已升级上报 · 明细见右侧清单</p> <p class="text-[11px] font-semibold text-slate-400">超期未关闭 · 已升级上报 · 明细见右侧清单</p>
</div> </div>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 重要变更审批 --> <!-- 重要变更审批 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">重要变更审批</p> <p class="text-13px font-700 text-#64749a">重要变更审批</p>
<p class="text-11px text-#94a3b8 mt-2px">仅重要变更到达此节点</p> <p class="text-11px text-#94a3b8 mt-2px">仅重要变更到达此节点</p>
</div> </div>
<NButton v-if="homeData?.todo_approvals?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton v-if="homeData?.todo_approvals?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')">
我的任务 我的任务
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.todo_approvals?.total > 0"> <template v-if="homeData?.todo_approvals?.total > 0">
<div v-for="row in homeData?.todo_approvals?.items || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)" <div v-for="row in homeData?.todo_approvals?.items || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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">{{ row.change_no }}</span> <span class="font-mono text-[11px] text-slate-400">{{ row.change_no }}</span>
<!-- 变更等级 --> <!-- 变更等级 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(levelList,row.change_level)?.color), color: tagBgColor(matchObj(levelList,row.change_level)?.color),
textColor: tagTextColor(matchObj(levelList,row.change_level)?.color), textColor: tagTextColor(matchObj(levelList,row.change_level)?.color),
borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color), borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color),
}" }"
>{{matchObj(levelList,row.change_level)?.label}}</NTag> >{{matchObj(levelList,row.change_level)?.label}}</NTag>
<NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag> <NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag>
</div> </div>
<div class="mt-1 flex items-center gap-2"> <div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
</div> </div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2"> <div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<p>申请人:{{row.applicant_name}}</p> <p>申请人:{{row.applicant_name}}</p>
<p>{{row.apply_time?.slice(0, 10)}}</p> <p>{{row.apply_time?.slice(0, 10)}}</p>
</div> </div>
</div> </div>
<NButton size="small" type="primary" class="text-xs"> <NButton size="small" type="primary" class="text-xs">
去审批 去审批
<Icon icon="akar-icons:arrow-right" class="size-13px ml-1" /> <Icon icon="akar-icons:arrow-right" class="size-13px ml-1" />
</NButton> </NButton>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]"> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]">
<!-- 各部门 / 人员审批时长 --> <!-- 各部门 / 人员审批时长 -->
<NGi span="24 s:24 m:24 l:24"> <NGi span="24 s:24 m:24 l:24">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',height:'100%' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',height:'100%' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">各部门 / 人员审批时长</p> <p class="text-13px font-700 text-#64749a">各部门 / 人员审批时长</p>
<p class="text-11px text-#94a3b8 mt-2px">近一年 · 平均耗时(天)</p> <p class="text-11px text-#94a3b8 mt-2px">近一年 · 平均耗时(天)</p>
</div> </div>
<NButton ghost size="small" class="text-xs" @click="jumpTo('my_datachangecenter')"> <NButton ghost size="small" class="text-xs" @click="jumpTo('my_datachangecenter')">
变更数据中心 变更数据中心
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="space-y-3"> <div class="space-y-3">
<div class="flex justify-between gap-6"> <div class="flex justify-between gap-6">
<div class="w-50%"> <div class="w-50%">
<div class="mb-2 text-[11px] font-semibold text-slate-500">按部门(全流程平均)</div> <div class="mb-2 text-[11px] font-semibold text-slate-500">按部门(全流程平均)</div>
<div class="space-y-3"> <div class="space-y-3">
<div v-for="s in homeData?.dept_efficiency?.items" :key="s.org_id" class="flex items-center"> <div v-for="s in homeData?.dept_efficiency?.items" :key="s.org_id" class="flex items-center">
<p class="text-slate-500 w-90px text-xs">{{ s.org_name }}</p> <p class="text-slate-500 w-90px text-xs">{{ s.org_name }}</p>
<div class="h-2.5 flex-1 overflow-hidden rounded-full bg-slate-100"> <div class="h-2.5 flex-1 overflow-hidden rounded-full bg-slate-100">
<div v-if="s.avg_days > homeData?.person_efficiency?.slowest?.avg_days " class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.otherColor.error }"></div> <div v-if="s.avg_days > homeData?.person_efficiency?.slowest?.avg_days " class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.otherColor.error }"></div>
<div v-else class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.themeColor }"></div> <div v-else class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.themeColor }"></div>
</div> </div>
<p class="w-45px font-semibold text-slate-600 text-xs text-right">{{ s.avg_days || 0 }} 天</p> <p class="w-45px font-semibold text-slate-600 text-xs text-right">{{ s.avg_days || 0 }} 天</p>
</div> </div>
<div v-if="homeData?.dept_efficiency?.items?.length===0" class="h-100% flex items-center justify-center py-3"> <div v-if="homeData?.dept_efficiency?.items?.length===0" class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</div> </div>
</div> </div>
<div class="w-50%"> <div class="w-50%">
<div class="mb-2 text-[11px] font-semibold text-slate-500">按人员(审批 / 会签环节平均)</div> <div class="mb-2 text-[11px] font-semibold text-slate-500">按人员(审批 / 会签环节平均)</div>
<div class="space-y-3"> <div class="space-y-3">
<div v-for="s in homeData?.person_efficiency?.items" :key="s.user_id" class="flex items-center"> <div v-for="s in homeData?.person_efficiency?.items" :key="s.user_id" class="flex items-center">
<p class="text-slate-500 w-90px text-xs">{{ s.user_name }}</p> <p class="text-slate-500 w-90px text-xs">{{ s.user_name }}</p>
<div class="h-2.5 flex-1 overflow-hidden rounded-full bg-slate-100"> <div class="h-2.5 flex-1 overflow-hidden rounded-full bg-slate-100">
<div v-if="s.avg_days > homeData?.person_efficiency?.slowest?.avg_days " class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.otherColor.error }"></div> <div v-if="s.avg_days > homeData?.person_efficiency?.slowest?.avg_days " class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.otherColor.error }"></div>
<div v-else class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.themeColor }"></div> <div v-else class="h-full rounded-full" :style="{ width: `${(s.avg_days / s.total) * 100}%`, background: themeStore.themeColor }"></div>
</div> </div>
<p class="w-45px font-semibold text-slate-600 text-xs text-right">{{ s.avg_days || 0 }} 天</p> <p class="w-45px font-semibold text-slate-600 text-xs text-right">{{ s.avg_days || 0 }} 天</p>
</div> </div>
<div v-if="homeData?.person_efficiency?.items?.length===0" class="h-100% flex items-center justify-center py-3"> <div v-if="homeData?.person_efficiency?.items?.length===0" class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div <div
class="mt-3 rounded-lg bg-[var(--warning-bg)] px-3 py-2 text-[11px] text-[var(--warning-color)]" class="mt-3 rounded-lg bg-[var(--warning-bg)] px-3 py-2 text-[11px] text-[var(--warning-color)]"
:style="{ :style="{
'--warning-bg': getColorWithOpacity(themeStore.otherColor.warning, 0.1), '--warning-bg': getColorWithOpacity(themeStore.otherColor.warning, 0.1),
'--warning-color': themeStore.otherColor.warning, '--warning-color': themeStore.otherColor.warning,
}" }"
>专业会签环节平均 {{homeData?.person_efficiency?.slowest?.avg_days || 0}} 天,为全流程最慢环节,建议优化会签并行机制</div> >专业会签环节平均 {{homeData?.person_efficiency?.slowest?.avg_days || 0}} 天,为全流程最慢环节,建议优化会签并行机制</div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 超期未关闭变更 --> <!-- 超期未关闭变更 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="proicons:alert-triangle" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="proicons:alert-triangle" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">超期未关闭变更</p> <p class="text-13px font-700 text-#64749a">超期未关闭变更</p>
<p class="text-11px text-#94a3b8">已升级上报 · 催办由属地车间主任执行</p> <p class="text-11px text-#94a3b8">已升级上报 · 催办由属地车间主任执行</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.overdue_unclosed?.total > 0"> <template v-if="homeData?.overdue_unclosed?.total > 0">
<div <div
v-for="r in homeData?.overdue_unclosed?.items" v-for="r in homeData?.overdue_unclosed?.items"
:key="r.id" :key="r.id"
class="border border-red-100 bg-red-50/50 px-3.5 py-2.5" class="border border-red-100 bg-red-50/50 px-3.5 py-2.5"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
}" }"
> >
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<!-- 状态标签 --> <!-- 状态标签 -->
<NTag v-if="r.status==='APPROVING'" size="small" type="warning">审批中</NTag> <NTag v-if="r.status==='APPROVING'" size="small" type="warning">审批中</NTag>
<NTag v-if="r.status==='APPROVED'" size="small" type="success">已通过</NTag> <NTag v-if="r.status==='APPROVED'" size="small" type="success">已通过</NTag>
<NTag v-if="r.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag> <NTag v-if="r.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag>
<NTag v-if="r.status==='ACCEPTED'" size="small" type="error">待关闭</NTag> <NTag v-if="r.status==='ACCEPTED'" size="small" type="error">待关闭</NTag>
<NTag v-if="r.status==='CLOSED'" size="small" type="success">已关闭</NTag> <NTag v-if="r.status==='CLOSED'" size="small" type="success">已关闭</NTag>
<NTag v-if="r.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag> <NTag v-if="r.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag>
<NTag v-if="r.status==='REJECTED'" size="small" type="error">已驳回</NTag> <NTag v-if="r.status==='REJECTED'" size="small" type="error">已驳回</NTag>
<NTag type="error" size="small" class="text-11px">超期{{r.overdue_days || 0}}天</NTag> <NTag type="error" size="small" class="text-11px">超期{{r.overdue_days || 0}}天</NTag>
<NButton ghost size="tiny" class="text-xs ml-auto" @click="jumpTo('details_index',r.change_id)">打开变更单</NButton> <NButton ghost size="tiny" class="text-xs ml-auto" @click="jumpTo('details_index',r.change_id)">打开变更单</NButton>
</div> </div>
<p class="mt-0.5 text-sm font-medium text-slate-800">{{ r.title }}</p> <p class="mt-0.5 text-sm font-medium text-slate-800">{{ r.title }}</p>
<div class="mt-0.5 text-[11px] text-slate-400 flex items-center gap-2"> <div class="mt-0.5 text-[11px] text-slate-400 flex items-center gap-2">
<span>{{ r.change_no }}</span> <span>{{ r.change_no }}</span>
<span>{{r.org_name}}</span> <span>{{r.org_name}}</span>
<span>{{r.applicant_name}}</span> <span>{{r.applicant_name}}</span>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<!-- 临时变更临期或到期 --> <!-- 临时变更临期或到期 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">临时变更临期或到期</p> <p class="text-13px font-700 text-#64749a">临时变更临期或到期</p>
</div> </div>
<p class="text-11px text-#94a3b8">到期前提醒 · 恢复 / 延期 / 转永久</p> <p class="text-11px text-#94a3b8">到期前提醒 · 恢复 / 延期 / 转永久</p>
</div> </div>
<NButton size="small" class="text-xs" @click="jumpTo('changeledger')"> <NButton size="small" class="text-xs" @click="jumpTo('changeledger')">
变更台账<Icon icon="formkit:right" class="size-12px" /> 变更台账<Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="space-y-3 mt-3"> <div class="space-y-3 mt-3">
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.success }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.success }"></span>
<span class="font-medium text-slate-700">正常(到期 > {{remindDays}} 天)</span> <span class="font-medium text-slate-700">正常(到期 > {{remindDays}} 天)</span>
<span class="ml-auto font-semibold text-slate-600">{{getNormalNearOverdue('normal')}} 项</span> <span class="ml-auto font-semibold text-slate-600">{{getNormalNearOverdue('normal')}} 项</span>
</div> </div>
</div> </div>
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.warning }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.warning }"></span>
<span class="font-medium text-slate-700">临期(到期 ≤ {{remindDays}} 天)</span> <span class="font-medium text-slate-700">临期(到期 ≤ {{remindDays}} 天)</span>
<span class="ml-auto font-semibold text-slate-600">{{getNormalNearOverdue('near')}} 项</span> <span class="ml-auto font-semibold text-slate-600">{{getNormalNearOverdue('near')}} 项</span>
</div> </div>
</div> </div>
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.error }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.error }"></span>
<span class="font-medium text-slate-700">已超期</span> <span class="font-medium text-slate-700">已超期</span>
<span class="ml-auto font-semibold text-slate-600">{{getNormalNearOverdue('overdue')}} 项</span> <span class="ml-auto font-semibold text-slate-600">{{getNormalNearOverdue('overdue')}} 项</span>
</div> </div>
</div> </div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
+401 -401
View File
@@ -1,401 +1,401 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } 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 { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { homeQualityApi } from "@/service/api/statistics"; import { homeQualityApi } from "@/service/api/statistics";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
// 变更类型列表 // 变更类型列表
const typeList = ref<any>([]); const typeList = ref<any>([]);
// 变更等级列表 // 变更等级列表
const levelList = ref<any>([]); const levelList = ref<any>([]);
// 时间显示 // 时间显示
const clock = ref<string>(''); const clock = ref<string>('');
let timer: any = null; let timer: any = null;
// 首页数据 // 首页数据
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 跳转变更申请页面、变更台账、我的任务、发起变更 // 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => { const jumpTo = (key: string,qid:number = 0) => {
if(key==='details_approval' && qid){ if(key==='details_approval' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_index' && qid){ }else if(key==='details_index' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } }); routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{ }else{
routerPushByKey(key as any); routerPushByKey(key as any);
} }
} }
// 获取当前时间字符串 // 获取当前时间字符串
const getCurrentTimeStr = () => { const getCurrentTimeStr = () => {
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = now.getMonth() + 1; const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]; const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()];
const hours = String(now.getHours()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0');
return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`; return `${year}年${month}月${date}日 ${week} ${hours}:${minutes}`;
} }
// 更新时间显示 // 更新时间显示
const tick = () => { const tick = () => {
clock.value = getCurrentTimeStr(); clock.value = getCurrentTimeStr();
// 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发) // 计算距离下一分钟还有多少毫秒(+50ms 容错,防止定时器提前触发)
const now = new Date(); const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50; const delay = (60 - now.getSeconds()) * 1000 - now.getMilliseconds() + 50;
timer = setTimeout(tick, delay); timer = setTimeout(tick, delay);
} }
// 匹配对象 // 匹配对象
const matchObj = (list:any,val:number) => { const matchObj = (list:any,val:number) => {
const obj = list.find((item:any) => item.value == val); const obj = list.find((item:any) => item.value == val);
return obj || null; return obj || null;
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await homeQualityApi(); const {data,error} = await homeQualityApi();
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
// 解析 变更类型设置 // 解析 变更类型设置
const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type'); const changeTypeGroup = data.find((group:{group_key:string}) => group.group_key === 'change_type');
if (changeTypeGroup) { if (changeTypeGroup) {
typeList.value = changeTypeGroup.items; typeList.value = changeTypeGroup.items;
} }
// 解析 变更等级设置 // 解析 变更等级设置
const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level'); const changeLevelGroup = data.find((group:{group_key:string}) => group.group_key === 'change_level');
if (changeLevelGroup) { if (changeLevelGroup) {
levelList.value = changeLevelGroup.items; levelList.value = changeLevelGroup.items;
} }
} }
} }
onMounted(() => { onMounted(() => {
tick(); tick();
getConfig(); getConfig();
getData(); getData();
}) })
onUnmounted(() => { onUnmounted(() => {
if(timer){ if(timer){
clearTimeout(timer); clearTimeout(timer);
timer = null; timer = null;
} }
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3.5"> <div class="space-y-3.5">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:12"> <NGi span="24 s:24 m:12">
<div class="flex-y-center"> <div class="flex-y-center">
<p <p
class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold" class="py-1.5 px-1.5 flex items-center justify-center bg-[rgb(var(--primary-color))] text-white text-xs font-bold"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
MOC MOC
</p> </p>
<p class="pl-12px text-14px font-semibold">我的工作台</p> <p class="pl-12px text-14px font-semibold">我的工作台</p>
</div> </div>
</NGi> </NGi>
<NGi span="24 s:24 m:12" class="flex items-center justify-end gap-12px"> <NGi span="24 s:24 m:12" class="flex items-center justify-end gap-12px">
<p class="text-#999 text-xs">{{clock}}</p> <p class="text-#999 text-xs">{{clock}}</p>
<NButton ghost size="small" @click="jumpTo('changeledger')"> <NButton ghost size="small" @click="jumpTo('changeledger')">
质量相关变更 质量相关变更
</NButton> </NButton>
<NButton type="primary" size="small" @click="jumpTo('my_mytask')"> <NButton type="primary" size="small" @click="jumpTo('my_mytask')">
<Icon icon="lucide:clipboard-check" class="size-14px" /> <Icon icon="lucide:clipboard-check" class="size-14px" />
审批待办 审批待办
</NButton> </NButton>
</NGi> </NGi>
</NGrid> </NGrid>
</NCard> </NCard>
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:2 l:4" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')" @click="jumpTo('my_mytask')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.todo_sign?.total || 0" :end-value="homeData?.todo_sign?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: homeData?.todo_sign?.overdue_count ? themeStore.otherColor.error : themeStore.themeColor }" :style="{ color: homeData?.todo_sign?.overdue_count ? themeStore.otherColor.error : themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">待我会签</p> <p class="text-12px font-600">待我会签</p>
<p v-if="homeData?.todo_sign?.overdue_count" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count || 0}} 项 · 请优先处理</p> <p v-if="homeData?.todo_sign?.overdue_count" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count || 0}} 项 · 请优先处理</p>
<p v-else class="text-12px text-slate-400">无超期</p> <p v-else class="text-12px text-slate-400">无超期</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('signstatistics')" @click="jumpTo('signstatistics')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.sign_stats?.month_signed || 0" :end-value="homeData?.sign_stats?.month_signed || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">本月已会签</p> <p class="text-12px font-600">本月已会签</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('changeledger')" @click="jumpTo('changeledger')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.quality_focus?.total || 0" :end-value="homeData?.quality_focus?.total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">涉及产品质量变更</p> <p class="text-12px font-600">涉及产品质量变更</p>
<p class="text-12px text-slate-400">在办 · 影响产品合格判定</p> <p class="text-12px text-slate-400">在办 · 影响产品合格判定</p>
</div> </div>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3" class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('signstatistics')" @click="jumpTo('signstatistics')"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.quality_focus?.year_fmea_count || 0" :end-value="homeData?.quality_focus?.year_fmea_count || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{ color: themeStore.themeColor }" :style="{ color: themeStore.themeColor }"
/> />
</div> </div>
<div> <div>
<p class="text-12px font-600">FMEA分析条数</p> <p class="text-12px font-600">FMEA分析条数</p>
</div> </div>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 --> <!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16"> <NGi span="24 s:24 m:24 l:16">
<!-- 待我会签 --> <!-- 待我会签 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:clipboard-check" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">待我会签</p> <p class="text-13px font-700 text-#64749a">待我会签</p>
<p class="text-11px text-#94a3b8 mt-2px">超期项行内红色标记 · 审批时自动展示专业相关附件</p> <p class="text-11px text-#94a3b8 mt-2px">超期项行内红色标记 · 审批时自动展示专业相关附件</p>
</div> </div>
<NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')"> <NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')">
我的任务 我的任务
<Icon icon="formkit:right" class="size-12px" /> <Icon icon="formkit:right" class="size-12px" />
</NButton> </NButton>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<template v-if="homeData?.todo_sign?.total > 0"> <template v-if="homeData?.todo_sign?.total > 0">
<div v-for="row in homeData?.todo_sign?.items || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)" <div v-for="row in homeData?.todo_sign?.items || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40" class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
'--hover-border': themeStore.themeColor, '--hover-border': themeStore.themeColor,
'--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05) '--hover-bg': getColorWithOpacity(themeStore.themeColor, 0.05)
}" }"
> >
<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">{{ row.change_no }}</span> <span class="font-mono text-[11px] text-slate-400">{{ row.change_no }}</span>
<NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag> <NTag class="text-[11px]" v-if="row.urgent===1" type="error" size="small">紧急</NTag>
<!-- 变更等级 --> <!-- 变更等级 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(levelList,row.change_level)?.color), color: tagBgColor(matchObj(levelList,row.change_level)?.color),
textColor: tagTextColor(matchObj(levelList,row.change_level)?.color), textColor: tagTextColor(matchObj(levelList,row.change_level)?.color),
borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color), borderColor: tagBorderColor(matchObj(levelList,row.change_level)?.color),
}" }"
>{{matchObj(levelList,row.change_level)?.label}}</NTag> >{{matchObj(levelList,row.change_level)?.label}}</NTag>
<!-- 变更类型 --> <!-- 变更类型 -->
<NTag <NTag
size="small" size="small"
:color="{ :color="{
color: tagBgColor(matchObj(typeList,row.change_type)?.color), color: tagBgColor(matchObj(typeList,row.change_type)?.color),
textColor: tagTextColor(matchObj(typeList,row.change_type)?.color), textColor: tagTextColor(matchObj(typeList,row.change_type)?.color),
borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color), borderColor: tagBorderColor(matchObj(typeList,row.change_type)?.color),
}" }"
>{{matchObj(typeList,row.change_type)?.label}}</NTag> >{{matchObj(typeList,row.change_type)?.label}}</NTag>
<NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag> <NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag>
<NTag class="text-[11px]" v-else type="info" size="small">永久</NTag> <NTag class="text-[11px]" v-else type="info" size="small">永久</NTag>
<span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days}} 天</span> <span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days}} 天</span>
</div> </div>
<div class="mt-1 flex items-center gap-2"> <div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<NTag size="small" type="warning">{{row.step_name}}</NTag> <NTag size="small" type="warning">{{row.step_name}}</NTag>
<NButton size="small" type="primary" class="text-xs"> <NButton size="small" type="primary" class="text-xs">
去审批 去审批
<Icon icon="akar-icons:arrow-right" class="size-13px ml-1" /> <Icon icon="akar-icons:arrow-right" class="size-13px ml-1" />
</NButton> </NButton>
</div> </div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2"> <div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<p>申请人:{{row.applicant_name}}</p> <p>申请人:{{row.applicant_name}}</p>
<span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span> <span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</div> </div>
</NCard> </NCard>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]"> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive class="mt-[16px]">
<!-- 最近已会签 --> <!-- 最近已会签 -->
<NGi span="24 s:24 m:24 l:24"> <NGi span="24 s:24 m:24 l:24">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="ix:success" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="ix:success" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">最近已会签</p> <p class="text-13px font-700 text-#64749a">最近已会签</p>
<p class="text-11px text-#94a3b8 mt-2px">本人签署记录 · 点击直达变更内容</p> <p class="text-11px text-#94a3b8 mt-2px">本人签署记录 · 点击直达变更内容</p>
</div> </div>
<div v-if="homeData?.signed_recent?.items.length" class="flex flex-col gap-3"> <div v-if="homeData?.signed_recent?.items.length" class="flex flex-col gap-3">
<div v-for="item in homeData?.signed_recent?.items" :key="item.change_id" class="rounded-md border px-3 py-2 flex items-center justify-between gap-2 cursor-pointer" @click="jumpTo('details_index', item.change_id)"> <div v-for="item in homeData?.signed_recent?.items" :key="item.change_id" class="rounded-md border px-3 py-2 flex items-center justify-between gap-2 cursor-pointer" @click="jumpTo('details_index', item.change_id)">
<div> <div>
<p class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ item.title }}</p> <p class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ item.title }}</p>
<p class="font-mono text-[11px] text-slate-400 flex items-center gap-3"> <p class="font-mono text-[11px] text-slate-400 flex items-center gap-3">
<span>{{ item.change_no }}</span> <span>{{ item.change_no }}</span>
<span>{{ item.finished_at?.slice(0, 16) }}</span> <span>{{ item.finished_at?.slice(0, 16) }}</span>
</p> </p>
</div> </div>
<NTag v-if="item.status==='PENDING'" size="small" type="warning" class="text-xs">待会签</NTag> <NTag v-if="item.status==='PENDING'" size="small" type="warning" class="text-xs">待会签</NTag>
<NTag v-if="item.status==='PASSED'" size="small" type="success" class="text-xs">通过</NTag> <NTag v-if="item.status==='PASSED'" size="small" type="success" class="text-xs">通过</NTag>
<NTag v-if="item.status==='REJECTED'" size="small" type="error" class="text-xs">驳回</NTag> <NTag v-if="item.status==='REJECTED'" size="small" type="error" class="text-xs">驳回</NTag>
</div> </div>
</div> </div>
<div v-else class="h-100% flex items-center justify-center py-3"> <div v-else class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NGi> </NGi>
<!-- 右侧 --> <!-- 右侧 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<!-- 质量关注变更 --> <!-- 质量关注变更 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lucide:shield-alert" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">质量关注变更</p> <p class="text-13px font-700 text-#64749a">质量关注变更</p>
<p class="text-11px text-#94a3b8">在办 · 影响产品合格判定,建议重点关注</p> <p class="text-11px text-#94a3b8">在办 · 影响产品合格判定,建议重点关注</p>
</div> </div>
<template v-if="homeData?.quality_focus?.items?.length"> <template v-if="homeData?.quality_focus?.items?.length">
<div class="space-y-2.5"> <div class="space-y-2.5">
<div v-for="h in homeData?.quality_focus?.items || []" :key="h.change_id" class="rounded-md border border-amber-200 bg-amber-50/60 px-3.5 py-2.5"> <div v-for="h in homeData?.quality_focus?.items || []" :key="h.change_id" class="rounded-md border border-amber-200 bg-amber-50/60 px-3.5 py-2.5">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ h.title }}</span> <span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ h.title }}</span>
<NButton size="tiny" ghost type="warning" class="text-xs" @click="jumpTo('changeledger')">查看</NButton> <NButton size="tiny" ghost type="warning" class="text-xs" @click="jumpTo('changeledger')">查看</NButton>
</div> </div>
<div class="mt-1 text-[11px]" :style="{ color: themeStore.otherColor.warning }">{{ h.effect }}</div> <div class="mt-1 text-[11px]" :style="{ color: themeStore.otherColor.warning }">{{ h.effect }}</div>
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</template> </template>
</NCard> </NCard>
<!-- 我的会签效率 --> <!-- 我的会签效率 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px',marginTop:'16px' }">
<div class="flex items-center mb-3 gap-2"> <div class="flex items-center mb-3 gap-2">
<Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" /> <Icon icon="lets-icons:clock" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-13px font-700 text-#64749a">我的会签效率</p> <p class="text-13px font-700 text-#64749a">我的会签效率</p>
<p class="text-11px text-#94a3b8">系统自动采集 · 近 30 天</p> <p class="text-11px text-#94a3b8">系统自动采集 · 近 30 天</p>
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">平均耗时</span> <span class="text-xs text-slate-500 w-16">平均耗时</span>
<NProgress <NProgress
type="line" type="line"
status="info" status="info"
:percentage="((homeData?.sign_stats?.avg_audit_days || 0) / 2) * 100" :percentage="((homeData?.sign_stats?.avg_audit_days || 0) / 2) * 100"
:height="10" :height="10"
border-radius="6px" border-radius="6px"
> >
<span class="text-xs text-slate-700 font-semibold">{{homeData?.sign_stats?.avg_audit_days || 0}}天</span> <span class="text-xs text-slate-700 font-semibold">{{homeData?.sign_stats?.avg_audit_days || 0}}天</span>
</NProgress> </NProgress>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">最长耗时</span> <span class="text-xs text-slate-500 w-16">最长耗时</span>
<NProgress <NProgress
type="line" type="line"
status="error" status="error"
:percentage="((homeData?.sign_stats?.max_audit_days || 0) / 2) * 100" :percentage="((homeData?.sign_stats?.max_audit_days || 0) / 2) * 100"
:height="10" :height="10"
border-radius="6px" border-radius="6px"
> >
<span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.sign_stats?.max_audit_days || 0}}天</span> <span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.sign_stats?.max_audit_days || 0}}天</span>
</NProgress> </NProgress>
</div> </div>
<div class="flex items-center justify-between text-[11px] text-slate-400"> <div class="flex items-center justify-between text-[11px] text-slate-400">
<span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0}}%</b></span> <span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0}}%</b></span>
<span>目标 2 天内签署</span> <span>目标 2 天内签署</span>
</div> </div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped></style> <style scoped></style>
+224 -224
View File
@@ -1,224 +1,224 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref } 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 { analysisRecordListApi } from "@/service/api/highRisk"; import { analysisRecordListApi } from "@/service/api/highRisk";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const props = defineProps(['currentId', 'info', 'fmeaRiskMatrixConfig']) const props = defineProps(['currentId', 'info', 'fmeaRiskMatrixConfig'])
const emit = defineEmits(['close']) const emit = defineEmits(['close'])
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 当前偏离 // 当前偏离
const currentDev = ref<any>(null); const currentDev = ref<any>(null);
// 展开收起 // 展开收起
const collapsed = ref<Record<string, boolean>>({}) const collapsed = ref<Record<string, boolean>>({})
// 节点列表 // 节点列表
const nodes = ref<any>([]); const nodes = ref<any>([]);
// 点击偏离 // 点击偏离
const clickDev = (dev:any) => { const clickDev = (dev:any) => {
currentDev.value = dev currentDev.value = dev
} }
// 根据l和s计算RR风险等级 // 根据l和s计算RR风险等级
const riskLevel = (l: number, s: number) => { const riskLevel = (l: number, s: number) => {
const num = l * s; const num = l * s;
for (let i = 0; i < props.fmeaRiskMatrixConfig?.risk_grades.length; i++) { for (let i = 0; i < props.fmeaRiskMatrixConfig?.risk_grades.length; i++) {
const item = props.fmeaRiskMatrixConfig?.risk_grades[i]; const item = props.fmeaRiskMatrixConfig?.risk_grades[i];
if (num >= item.min && num <= item.max) { if (num >= item.min && num <= item.max) {
return item; // 返回整条数据 return item; // 返回整条数据
} }
} }
return null; return null;
} }
// 计算RR1风险等级 // 计算RR1风险等级
const countRiskLevel = (row: any) => { const countRiskLevel = (row: any) => {
const l = row.l_value; const l = row.l_value;
const s = row.s_value; const s = row.s_value;
const newArr = [...row?.safeguards || [],...row?.suggestions || []]; const newArr = [...row?.safeguards || [],...row?.suggestions || []];
const result:any = { L: 0, S: 0 }; const result:any = { L: 0, S: 0 };
newArr.forEach(item => { newArr.forEach(item => {
if (!item.value) return; // 跳过空值 if (!item.value) return; // 跳过空值
const parts = item.value.split('_'); const parts = item.value.split('_');
if (parts.length === 2) { if (parts.length === 2) {
const type = parts[0].toUpperCase(); // 统一大写 const type = parts[0].toUpperCase(); // 统一大写
const num = parseInt(parts[1], 10); const num = parseInt(parts[1], 10);
if (!isNaN(num) && (type === 'L' || type === 'S')) { if (!isNaN(num) && (type === 'L' || type === 'S')) {
result[type] += num; result[type] += num;
} }
} }
}); });
const newL = (l - result.L) > 0 ? l - result.L : 1; const newL = (l - result.L) > 0 ? l - result.L : 1;
const newS = (s - result.S) > 0 ? s - result.S : 1; const newS = (s - result.S) > 0 ? s - result.S : 1;
return riskLevel(newL, newS); return riskLevel(newL, newS);
} }
// 展开收起 // 展开收起
const leftToggle = (id: string) => { const leftToggle = (id: string) => {
collapsed.value = { ...collapsed.value, [id]: !collapsed.value[id] } collapsed.value = { ...collapsed.value, [id]: !collapsed.value[id] }
} }
// 导出数据 // 导出数据
const exportData = () => { const exportData = () => {
window.$message?.info('还差接口') window.$message?.info('还差接口')
} }
// 获取记录 // 获取记录
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
const {data,error} = await analysisRecordListApi(props.currentId); const {data,error} = await analysisRecordListApi(props.currentId);
if(!error){ if(!error){
nodes.value = data?.fmea?.nodes || []; nodes.value = data?.fmea?.nodes || [];
clickDev(nodes.value[0]?.deviations[0] || null) clickDev(nodes.value[0]?.deviations[0] || null)
} }
loading.value = false; loading.value = false;
} }
onMounted(() => { onMounted(() => {
getList(); getList();
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="flex items-center gap-4 mb-3"> <div class="flex items-center gap-4 mb-3">
<p v-if="props.info?.change_title" class="text-xs text-slate-500">变更:<span class="text-slate-800">{{ props.info?.change_title }}</span></p> <p v-if="props.info?.change_title" class="text-xs text-slate-500">变更:<span class="text-slate-800">{{ props.info?.change_title }}</span></p>
<p v-if="props.info?.created_at" class="text-xs text-slate-500">分析日期:{{ props.info?.created_at?.slice(0,10) }}</p> <p v-if="props.info?.created_at" class="text-xs text-slate-500">分析日期:{{ props.info?.created_at?.slice(0,10) }}</p>
<p v-if="props.info?.applicant_name" class="text-xs text-slate-500">责任人:{{ props.info?.applicant_name }}</p> <p v-if="props.info?.applicant_name" class="text-xs text-slate-500">责任人:{{ props.info?.applicant_name }}</p>
<p class="ml-auto text-xs text-slate-500">分析编制与修改在变更上下文内完成,此处只读</p> <p class="ml-auto text-xs text-slate-500">分析编制与修改在变更上下文内完成,此处只读</p>
</div> </div>
<div <div
class="flex gap-3" class="flex gap-3"
:style="{ :style="{
'--theme-color': themeStore.themeColor, '--theme-color': themeStore.themeColor,
'--success-color': themeStore.otherColor.success '--success-color': themeStore.otherColor.success
}" }"
> >
<!-- 左:节点 / 偏离树 --> <!-- 左:节点 / 偏离树 -->
<div class="w-240px"> <div class="w-240px">
<div class="shrink-0 rounded-md border p-2 scroll"> <div class="shrink-0 rounded-md border p-2 scroll">
<p v-if="nodes.length === 0" class="text-center text-xs text-slate-400 py-10">暂无数据</p> <p v-if="nodes.length === 0" class="text-center text-xs text-slate-400 py-10">暂无数据</p>
<div v-for="(node, nodeIndex) in nodes" :key="nodeIndex"> <div v-for="(node, nodeIndex) in nodes" :key="nodeIndex">
<div <div
class="cursor-pointer flex items-center select-none" class="cursor-pointer flex items-center select-none"
@click="leftToggle(node.id)" @click="leftToggle(node.id)"
> >
<Icon v-if="collapsed[node.id]" icon="akar-icons:chevron-right" class="size-12px" /> <Icon v-if="collapsed[node.id]" icon="akar-icons:chevron-right" class="size-12px" />
<Icon v-else icon="akar-icons:chevron-down" class="size-12px" /> <Icon v-else icon="akar-icons:chevron-down" class="size-12px" />
<p class="flex-1 px-2 py-1.5 text-xs font-semibold text-slate-700">步骤{{ Number(nodeIndex) + 1 }}:{{ node.node_name }}</p> <p class="flex-1 px-2 py-1.5 text-xs font-semibold text-slate-700">步骤{{ Number(nodeIndex) + 1 }}:{{ node.node_name }}</p>
</div> </div>
<template v-if="!collapsed[node.id]"> <template v-if="!collapsed[node.id]">
<div v-for="(dev, devIndex) in node.deviations" :key="devIndex" <div v-for="(dev, devIndex) in node.deviations" :key="devIndex"
@click="clickDev(dev)" @click="clickDev(dev)"
class="cursor-pointer flex items-center ml-4 gap-1.5 rounded-md px-2 py-1.5 text-left text-xs transition" class="cursor-pointer flex items-center ml-4 gap-1.5 rounded-md px-2 py-1.5 text-left text-xs transition"
:class="currentDev?.id === dev.id ? 'bg-[var(--theme-color)] text-white' : 'text-slate-600 hover:bg-slate-100'" :class="currentDev?.id === dev.id ? 'bg-[var(--theme-color)] text-white' : 'text-slate-600 hover:bg-slate-100'"
> >
<span class="flex-1">{{ dev.deviation }}</span> <span class="flex-1">{{ dev.deviation }}</span>
<span class="rounded-full bg-emerald-100 px-1.5 text-[10px] text-emerald-600"> <span class="rounded-full bg-emerald-100 px-1.5 text-[10px] text-emerald-600">
{{ dev.rows.length }}条 {{ dev.rows.length }}条
</span> </span>
</div> </div>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
<!-- 右:FMEA 记录表 --> <!-- 右:FMEA 记录表 -->
<div class="min-w-0 flex-1 bg-white"> <div class="min-w-0 flex-1 bg-white">
<div class="scroll"> <div class="scroll">
<NTable size="small" class="w-full text-xs"> <NTable size="small" class="w-full text-xs">
<thead> <thead>
<tr> <tr>
<th class="w-60">原因</th> <th class="w-60">原因</th>
<th class="w-60">后果</th> <th class="w-60">后果</th>
<th class="w-6">L</th> <th class="w-6">L</th>
<th class="w-6">S</th> <th class="w-6">S</th>
<th class="w-20">RR</th> <th class="w-20">RR</th>
<th class="w-60">安全措施</th> <th class="w-60">安全措施</th>
<th class="w-60">建议措施</th> <th class="w-60">建议措施</th>
<th class="w-20">RR1</th> <th class="w-20">RR1</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-if="!currentDev || currentDev?.rows?.length === 0"> <tr v-if="!currentDev || currentDev?.rows?.length === 0">
<td colspan="9" class="px-3 py-8 text-center text-xs text-slate-400"> <td colspan="9" class="px-3 py-8 text-center text-xs text-slate-400">
当前暂无分析记录 当前暂无分析记录
</td> </td>
</tr> </tr>
<tr v-for="(row, ri) in currentDev?.rows" :key="ri"> <tr v-for="(row, ri) in currentDev?.rows" :key="ri">
<td class="align-top"> <td class="align-top">
<p class="text-xs">{{row.cause}}</p> <p class="text-xs">{{row.cause}}</p>
</td> </td>
<td class="align-top"> <td class="align-top">
<p class="text-xs">{{row.consequence}}</p> <p class="text-xs">{{row.consequence}}</p>
</td> </td>
<td> <td>
<p class="text-xs text-center w-10">{{row.l_value}}</p> <p class="text-xs text-center w-10">{{row.l_value}}</p>
</td> </td>
<td> <td>
<p class="text-xs text-center w-10">{{row.s_value}}</p> <p class="text-xs text-center w-10">{{row.s_value}}</p>
</td> </td>
<td class="text-center"> <td class="text-center">
<NTag <NTag
v-if="row.l_value>0 && row.s_value>0" v-if="row.l_value>0 && row.s_value>0"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: riskLevel(row.l_value, row.s_value)?.bg_color, color: riskLevel(row.l_value, row.s_value)?.bg_color,
textColor: riskLevel(row.l_value, row.s_value)?.font_color, textColor: riskLevel(row.l_value, row.s_value)?.font_color,
borderColor: riskLevel(row.l_value, row.s_value)?.bg_color, borderColor: riskLevel(row.l_value, row.s_value)?.bg_color,
}" }"
> >
{{riskLevel(row.l_value, row.s_value)?.name}}({{row.l_value * row.s_value}}) {{riskLevel(row.l_value, row.s_value)?.name}}({{row.l_value * row.s_value}})
</NTag> </NTag>
</td> </td>
<td class="align-top"> <td class="align-top">
<div v-if="row.safeguards && row.safeguards.length" class="flex flex-col gap-3"> <div v-if="row.safeguards && row.safeguards.length" class="flex flex-col gap-3">
<div v-for="(sItem, si) in row.safeguards" :key="si"> <div v-for="(sItem, si) in row.safeguards" :key="si">
<p class="text-xs">{{Number(si)+1}}、{{sItem.name}}</p> <p class="text-xs">{{Number(si)+1}}、{{sItem.name}}</p>
</div> </div>
</div> </div>
</td> </td>
<td class="align-top"> <td class="align-top">
<div v-if="row.suggestions && row.suggestions.length" class="flex flex-col gap-2"> <div v-if="row.suggestions && row.suggestions.length" class="flex flex-col gap-2">
<div v-for="(sItem2, si2) in row.suggestions" :key="si2"> <div v-for="(sItem2, si2) in row.suggestions" :key="si2">
<p class="text-xs">{{Number(si2)+1}}、{{sItem2.name}}</p> <p class="text-xs">{{Number(si2)+1}}、{{sItem2.name}}</p>
</div> </div>
</div> </div>
</td> </td>
<td class="text-center"> <td class="text-center">
<NTag <NTag
v-if="row.l_value>0 && row.s_value>0" v-if="row.l_value>0 && row.s_value>0"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: countRiskLevel(row)?.bg_color, color: countRiskLevel(row)?.bg_color,
textColor: countRiskLevel(row)?.font_color, textColor: countRiskLevel(row)?.font_color,
borderColor: countRiskLevel(row)?.bg_color, borderColor: countRiskLevel(row)?.bg_color,
}" }"
> >
{{countRiskLevel(row)?.name}} {{countRiskLevel(row)?.name}}
</NTag> </NTag>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</NTable> </NTable>
</div> </div>
</div> </div>
</div> </div>
<div class="flex items-center justify-end gap-2 pt-3"> <div class="flex items-center justify-end gap-2 pt-3">
<NButton size="small" @click="exportData"> <NButton size="small" @click="exportData">
<Icon icon="material-symbols:download" class="mr-1 size-14px" /> <Icon icon="material-symbols:download" class="mr-1 size-14px" />
导出 导出
</NButton> </NButton>
<NButton type="primary" size="small" @click="emit('close')">关闭</NButton> <NButton type="primary" size="small" @click="emit('close')">关闭</NButton>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll { .scroll {
height: calc(100vh - 155px); height: calc(100vh - 155px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
+403 -403
View File
@@ -1,403 +1,403 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, h } from 'vue'; import { ref, onMounted, h } 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 { getTimeRangeStamp, formatTimestamp } from '@/utils/common'; import { getTimeRangeStamp, formatTimestamp } from '@/utils/common';
import { 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';
import RiskPre from "./riskPre.vue"; import RiskPre from "./riskPre.vue";
import Hazop from "./hazop.vue"; import Hazop from "./hazop.vue";
import Fmea from "./fmea.vue"; import Fmea from "./fmea.vue";
import RiskCheck from "./riskCheck.vue"; import RiskCheck from "./riskCheck.vue";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 当前记录 // 当前记录
const currentRecord = ref<any>(null); const currentRecord = ref<any>(null);
const RISK_RANGES = [ const RISK_RANGES = [
{ label: "近一个月", value: "month" }, { label: "近一个月", value: "month" },
{ label: "近三个月", value: "quarter" }, { label: "近三个月", value: "quarter" },
{ label: "近半年", value: "half_year" }, { label: "近半年", value: "half_year" },
{ label: "全部", value: 'all' } { label: "全部", value: 'all' }
]; ];
// 风险矩阵配置 // 风险矩阵配置
const hazopMatrix = ref<any>(null); const hazopMatrix = ref<any>(null);
const fmeaMatrix = ref<any>(null); const fmeaMatrix = ref<any>(null);
// 插件抽屉 // 插件抽屉
const pluginDrawer = ref<boolean>(false); const pluginDrawer = ref<boolean>(false);
// 高风险场景列表 // 高风险场景列表
const list = ref<any[]>([]); const list = ref<any[]>([]);
// 查看变更 // 查看变更
const jumpTo = (r: any) => { const jumpTo = (r: any) => {
routerPushByKey("details_index",{ query: { id: r?.change_id?.toString(),key:'my_highrisk' } }); routerPushByKey("details_index",{ query: { id: r?.change_id?.toString(),key:'my_highrisk' } });
}; };
// 查看分析记录 // 查看分析记录
const viewAnalysis = (record: any) => { const viewAnalysis = (record: any) => {
currentRecord.value = record; currentRecord.value = record;
pluginDrawer.value = true; pluginDrawer.value = true;
}; };
// 时间范围 // 时间范围
const timeRange = ref<string>('month'); const timeRange = ref<string>('month');
// 组织树 // 组织树
const orgTree = ref<any[]>([]); const orgTree = ref<any[]>([]);
// 筛选条件 // 筛选条件
const formInfo = ref<any>({ const formInfo = ref<any>({
kw: '', kw: '',
org_id: 1, org_id: 1,
from: getTimeRangeStamp(timeRange.value)?.from ?? null, from: getTimeRangeStamp(timeRange.value)?.from ?? null,
to: getTimeRangeStamp(timeRange.value)?.to ?? null, to: getTimeRangeStamp(timeRange.value)?.to ?? null,
}); });
const pagination = ref<{page: number, pageSize: number, itemCount: number}>({ const pagination = ref<{page: number, pageSize: number, itemCount: number}>({
page: 1, page: 1,
pageSize: 20, pageSize: 20,
itemCount: 0, itemCount: 0,
}) })
// 自定义渲染展开图标 // 自定义渲染展开图标
const renderSwitcherIcon = (node:any) => { const renderSwitcherIcon = (node:any) => {
// 如果节点没有 children 或 children 为空数组,则不显示图标 // 如果节点没有 children 或 children 为空数组,则不显示图标
if (!node.option.children || node.option.children.length === 0) { if (!node.option.children || node.option.children.length === 0) {
return null; // 返回 null 表示不渲染任何图标 return null; // 返回 null 表示不渲染任何图标
} }
// 有子节点:返回 undefined 表示使用默认展开图标,也可自定义 // 有子节点:返回 undefined 表示使用默认展开图标,也可自定义
return h(Icon,{ return h(Icon,{
icon: node.option.expanded ? 'bi:caret-down-fill' : 'bi:caret-right-fill', icon: node.option.expanded ? 'bi:caret-down-fill' : 'bi:caret-right-fill',
class: 'size-12px', class: 'size-12px',
}); });
} }
// 搜索 // 搜索
const searchHandle = () => { const searchHandle = () => {
pagination.value.page = 1; pagination.value.page = 1;
getList(); getList();
} }
// 组织选择改变 // 组织选择改变
const orgChange = (val:any) => { const orgChange = (val:any) => {
formInfo.value.org_id = val; formInfo.value.org_id = val;
searchHandle(); searchHandle();
} }
// 时间范围改变 // 时间范围改变
const timeRangeChange = (val: string) => { const timeRangeChange = (val: string) => {
timeRange.value = val; timeRange.value = val;
if(val === 'all'){ if(val === 'all'){
formInfo.value.from = null; formInfo.value.from = null;
formInfo.value.to = null; formInfo.value.to = null;
}else{ }else{
const timeRange = getTimeRangeStamp(val); const timeRange = getTimeRangeStamp(val);
formInfo.value.from = timeRange?.from ?? null; formInfo.value.from = timeRange?.from ?? null;
formInfo.value.to = timeRange?.to ?? null; formInfo.value.to = timeRange?.to ?? null;
} }
searchHandle(); searchHandle();
} }
// 重置 // 重置
const reset = () => { const reset = () => {
timeRange.value = 'month'; timeRange.value = 'month';
formInfo.value.kw = ''; formInfo.value.kw = '';
formInfo.value.org_id = 1; formInfo.value.org_id = 1;
formInfo.value.from = getTimeRangeStamp('month')?.from ?? null; formInfo.value.from = getTimeRangeStamp('month')?.from ?? null;
formInfo.value.to = getTimeRangeStamp('month')?.to ?? null; formInfo.value.to = getTimeRangeStamp('month')?.to ?? null;
searchHandle(); searchHandle();
}; };
// 分页改变 // 分页改变
const pageChange = (page: number) => { const pageChange = (page: number) => {
pagination.value.page = page; pagination.value.page = page;
getList(); getList();
} }
// 获取列表 // 获取列表
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
const {data,error} = await highRiskListApi({ const {data,error} = await highRiskListApi({
kw: formInfo.value.kw, kw: formInfo.value.kw,
org_id: formInfo.value.org_id, org_id: formInfo.value.org_id,
from: formatTimestamp(formInfo.value.from), from: formatTimestamp(formInfo.value.from),
to: formatTimestamp(formInfo.value.to), to: formatTimestamp(formInfo.value.to),
page_num: pagination.value.page, page_num: pagination.value.page,
page_size: pagination.value.pageSize, page_size: pagination.value.pageSize,
}); });
if(!error){ if(!error){
list.value = data?.list ?? []; list.value = data?.list ?? [];
pagination.value.itemCount = data?.total ?? 0; pagination.value.itemCount = data?.total ?? 0;
} }
loading.value = false; loading.value = false;
} }
// 获取组织列表 // 获取组织列表
const getOrgList = async () => { const getOrgList = async () => {
loading.value = true; loading.value = true;
const {data,error} = await orgListApi(); const {data,error} = await orgListApi();
if(!error){ if(!error){
orgTree.value = data; orgTree.value = data;
if(orgTree.value.length > 0){ if(orgTree.value.length > 0){
getList(); getList();
} }
} }
loading.value = false; loading.value = false;
} }
// 获取风险矩阵配置 // 获取风险矩阵配置
const matrixConfig = async () => { const matrixConfig = async () => {
const {data,error} = await matrixConfigApi(); const {data,error} = await matrixConfigApi();
if(!error){ if(!error){
hazopMatrix.value = data?.hazop || null; hazopMatrix.value = data?.hazop || null;
fmeaMatrix.value = data?.fmea || null; fmeaMatrix.value = data?.fmea || null;
} }
} }
// 风险矩阵等级匹配 // 风险矩阵等级匹配
const matchRiskLevel = (configList:any,name: string) => { const matchRiskLevel = (configList:any,name: string) => {
if(!configList){ if(!configList){
return null; return null;
} }
const target = configList.find((item:any) => item.name === name); const target = configList.find((item:any) => item.name === name);
return target ?? null; return target ?? null;
} }
onMounted(async () => { onMounted(async () => {
matrixConfig(); matrixConfig();
getOrgList(); getOrgList();
}) })
</script> </script>
<template> <template>
<!-- 高风险场景 --> <!-- 高风险场景 -->
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between px-4 py-3 border-b mb-3"> <div class="flex items-center justify-between px-4 py-3 border-b mb-3">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Icon icon="lucide:shield-check" class="size-16px" :style="{color:themeStore.themeColor}" /> <Icon icon="lucide:shield-check" class="size-16px" :style="{color:themeStore.themeColor}" />
<p class="text-base font-semibold">变更新增高风险场景</p> <p class="text-base font-semibold">变更新增高风险场景</p>
<span class="text-xs text-slate-400 mt-2px">{{ list.length }} 个高风险场景</span> <span class="text-xs text-slate-400 mt-2px">{{ list.length }} 个高风险场景</span>
</div> </div>
<div class="flex items-center gap-2 min-h-28px"> <div class="flex items-center gap-2 min-h-28px">
<NTag size="small" type="primary" class="text-11px font-medium">单笔变更的分析编制在变更上下文内完成</NTag> <NTag size="small" type="primary" class="text-11px font-medium">单笔变更的分析编制在变更上下文内完成</NTag>
</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">
<NTreeSelect <NTreeSelect
class="!w-200px" class="!w-200px"
:value="formInfo.org_id" :value="formInfo.org_id"
:options="orgTree" :options="orgTree"
size="small" size="small"
default-expand-all default-expand-all
label-field="label" label-field="label"
key-field="id" key-field="id"
:render-switcher-icon="renderSwitcherIcon" :render-switcher-icon="renderSwitcherIcon"
placeholder="请选择组织层级" placeholder="请选择组织层级"
@update:value="orgChange" @update:value="orgChange"
/> />
<span class="mr-1 text-xs text-slate-400">时间</span> <span class="mr-1 text-xs text-slate-400">时间</span>
<NButton <NButton
size="tiny" size="tiny"
round round
v-for="r in RISK_RANGES" v-for="r in RISK_RANGES"
:key="r.value" :key="r.value"
:type="timeRange === r.value ? 'primary' : 'default'" :type="timeRange === r.value ? 'primary' : 'default'"
@click="timeRangeChange(r.value)" @click="timeRangeChange(r.value)"
> >
{{ r.label }} {{ r.label }}
</NButton> </NButton>
<NInput v-model:value="formInfo.kw" size="small" class="text-xs !w-200px ml-auto" clearable placeholder="关键词检索…" @clear="formInfo.kw = ''; searchHandle()"> <NInput v-model:value="formInfo.kw" size="small" class="text-xs !w-200px ml-auto" clearable placeholder="关键词检索…" @clear="formInfo.kw = ''; searchHandle()">
<template #suffix> <template #suffix>
<Icon icon="akar-icons:search" class="size-14px text-slate-400 cursor-pointer" @click="searchHandle" /> <Icon icon="akar-icons:search" class="size-14px text-slate-400 cursor-pointer" @click="searchHandle" />
</template> </template>
</NInput> </NInput>
<NButton size="small" class="text-sm" @click="reset"> <NButton size="small" class="text-sm" @click="reset">
<Icon icon="system-uicons:reset" class="size-12px" />重置 <Icon icon="system-uicons:reset" class="size-12px" />重置
</NButton> </NButton>
</div> </div>
<div class="scroll"> <div class="scroll">
<div v-if="list.length" class="space-y-3 px-4 pb-3"> <div v-if="list.length" class="space-y-3 px-4 pb-3">
<div v-for="(s, i) in list" :key="`${s.cid ?? 'x'}-${i}`" class="flex flex-wrap items-center gap-3 rounded-lg border px-4 py-3"> <div v-for="(s, i) in list" :key="`${s.cid ?? 'x'}-${i}`" class="flex flex-wrap items-center gap-3 rounded-lg border px-4 py-3">
<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">
<NTag size="small" type="info" class="text-11px">{{ s.source==='RISK'?'风险预分析':s.source==='RISK_CHECK'?'风险检查': s.source }}</NTag> <NTag size="small" type="info" class="text-11px">{{ s.source==='RISK'?'风险预分析':s.source==='RISK_CHECK'?'风险检查': s.source }}</NTag>
<span class="text-sm font-medium text-slate-800">{{ s.item }}</span> <span class="text-sm font-medium text-slate-800">{{ s.item }}</span>
<!-- 固有风险等级 --> <!-- 固有风险等级 -->
<template v-if="s.source==='RISK'"> <template v-if="s.source==='RISK'">
<NTag <NTag
v-if="s.inherent_level && s.inherent_level === '低'" v-if="s.inherent_level && s.inherent_level === '低'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="success" type="success"
> >
{{s.inherent_level}} {{s.inherent_level}}
</NTag> </NTag>
<NTag <NTag
v-if="s.inherent_level && s.inherent_level === '中'" v-if="s.inherent_level && s.inherent_level === '中'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="warning" type="warning"
> >
{{s.inherent_level}} {{s.inherent_level}}
</NTag> </NTag>
<NTag <NTag
v-if="s.inherent_level && s.inherent_level === '高'" v-if="s.inherent_level && s.inherent_level === '高'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="error" type="error"
> >
{{s.inherent_level}} {{s.inherent_level}}
</NTag> </NTag>
</template> </template>
<template v-if="s.source==='HAZOP'"> <template v-if="s.source==='HAZOP'">
<NTag <NTag
v-if="s.inherent_level" v-if="s.inherent_level"
size="small" size="small"
:color="{ :color="{
color: matchRiskLevel(hazopMatrix?.risk_grades,s.inherent_level)?.bg_color, color: matchRiskLevel(hazopMatrix?.risk_grades,s.inherent_level)?.bg_color,
textColor: matchRiskLevel(hazopMatrix?.risk_grades,s.inherent_level)?.font_color, textColor: matchRiskLevel(hazopMatrix?.risk_grades,s.inherent_level)?.font_color,
borderColor: matchRiskLevel(hazopMatrix?.risk_grades,s.inherent_level)?.bg_color, borderColor: matchRiskLevel(hazopMatrix?.risk_grades,s.inherent_level)?.bg_color,
}" }"
> >
固有风险 · {{s.inherent_level}} 固有风险 · {{s.inherent_level}}
</NTag> </NTag>
</template> </template>
<template v-if="s.source==='FMEA'"> <template v-if="s.source==='FMEA'">
<NTag <NTag
v-if="s.inherent_level" v-if="s.inherent_level"
size="small" size="small"
:color="{ :color="{
color: matchRiskLevel(fmeaMatrix?.risk_grades,s.inherent_level)?.bg_color, color: matchRiskLevel(fmeaMatrix?.risk_grades,s.inherent_level)?.bg_color,
textColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.inherent_level)?.font_color, textColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.inherent_level)?.font_color,
borderColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.inherent_level)?.bg_color, borderColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.inherent_level)?.bg_color,
}" }"
> >
固有风险 · {{s.inherent_level}} 固有风险 · {{s.inherent_level}}
</NTag> </NTag>
</template> </template>
<template v-if="s.source==='RISK_CHECK'"> <template v-if="s.source==='RISK_CHECK'">
<span> <span>
{{s.inherent_level ?? '-'}} {{s.inherent_level ?? '-'}}
</span> </span>
</template> </template>
<!-- 剩余风险等级 --> <!-- 剩余风险等级 -->
<template v-if="s.source==='RISK'"> <template v-if="s.source==='RISK'">
<NTag <NTag
v-if="s.residual_level && s.residual_level === '低'" v-if="s.residual_level && s.residual_level === '低'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="success" type="success"
> >
{{s.residual_level}} {{s.residual_level}}
</NTag> </NTag>
<NTag <NTag
v-if="s.residual_level && s.residual_level === '中'" v-if="s.residual_level && s.residual_level === '中'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="warning" type="warning"
> >
{{s.residual_level}} {{s.residual_level}}
</NTag> </NTag>
<NTag <NTag
v-if="s.residual_level && s.residual_level === '高'" v-if="s.residual_level && s.residual_level === '高'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="error" type="error"
> >
{{s.residual_level}} {{s.residual_level}}
</NTag> </NTag>
</template> </template>
<template v-if="s.source==='HAZOP'"> <template v-if="s.source==='HAZOP'">
<NTag <NTag
v-if="s.residual_level" v-if="s.residual_level"
size="small" size="small"
:color="{ :color="{
color: matchRiskLevel(hazopMatrix?.risk_grades,s.residual_level)?.bg_color, color: matchRiskLevel(hazopMatrix?.risk_grades,s.residual_level)?.bg_color,
textColor: matchRiskLevel(hazopMatrix?.risk_grades,s.residual_level)?.font_color, textColor: matchRiskLevel(hazopMatrix?.risk_grades,s.residual_level)?.font_color,
borderColor: matchRiskLevel(hazopMatrix?.risk_grades,s.residual_level)?.bg_color, borderColor: matchRiskLevel(hazopMatrix?.risk_grades,s.residual_level)?.bg_color,
}" }"
> >
剩余风险 · {{s.residual_level}} 剩余风险 · {{s.residual_level}}
</NTag> </NTag>
</template> </template>
<template v-if="s.source==='FMEA'"> <template v-if="s.source==='FMEA'">
<NTag <NTag
v-if="s.residual_level" v-if="s.residual_level"
size="small" size="small"
:color="{ :color="{
color: matchRiskLevel(fmeaMatrix?.risk_grades,s.residual_level)?.bg_color, color: matchRiskLevel(fmeaMatrix?.risk_grades,s.residual_level)?.bg_color,
textColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.residual_level)?.font_color, textColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.residual_level)?.font_color,
borderColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.residual_level)?.bg_color, borderColor: matchRiskLevel(fmeaMatrix?.risk_grades,s.residual_level)?.bg_color,
}" }"
> >
剩余风险 · {{s.residual_level}} 剩余风险 · {{s.residual_level}}
</NTag> </NTag>
</template> </template>
<template v-if="s.source==='RISK_CHECK'"> <template v-if="s.source==='RISK_CHECK'">
<span> <span>
{{s.residual_level ?? '-'}} {{s.residual_level ?? '-'}}
</span> </span>
</template> </template>
</div> </div>
<div class="mt-1 text-xs text-slate-600">{{ s.scene }}</div> <div class="mt-1 text-xs text-slate-600">{{ s.scene }}</div>
<div class="mt-0.5 text-xs text-slate-400"> <div class="mt-0.5 text-xs text-slate-400">
变更:{{ s?.change_title }} · {{ s?.org_name }} · 分析日期 {{ s?.created_at?.slice(0, 10) }} · 分析记录 {{ s?.record_count }} 行 变更:{{ s?.change_title }} · {{ s?.org_name }} · 分析日期 {{ s?.created_at?.slice(0, 10) }} · 分析记录 {{ s?.record_count }} 行
</div> </div>
</div> </div>
<NButton ghost size="small" class="text-xs" @click="jumpTo(s)">查看变更</NButton> <NButton ghost size="small" class="text-xs" @click="jumpTo(s)">查看变更</NButton>
<NButton size="small" type="primary" class="text-xs" @click="viewAnalysis(s)">查看分析记录</NButton> <NButton size="small" type="primary" class="text-xs" @click="viewAnalysis(s)">查看分析记录</NButton>
</div> </div>
</div> </div>
<div v-else class="h-100% flex items-center justify-center"> <div v-else class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据"></NEmpty> <NEmpty description="暂无数据"></NEmpty>
</div> </div>
</div> </div>
<div class="flex justify-end mt-3 px-4 py-2 border-t"> <div class="flex justify-end mt-3 px-4 py-2 border-t">
<NPagination <NPagination
v-model:page="pagination.page" v-model:page="pagination.page"
:page-size="pagination.pageSize" :page-size="pagination.pageSize"
:item-count="pagination.itemCount" :item-count="pagination.itemCount"
:on-update:page="pageChange" :on-update:page="pageChange"
> >
<template #prefix="{ itemCount }"> <template #prefix="{ itemCount }">
共 {{ itemCount }} 条 共 {{ itemCount }} 条
</template> </template>
</NPagination> </NPagination>
</div> </div>
</div> </div>
<!-- 插件抽屉 --> <!-- 插件抽屉 -->
<NDrawer v-model:show="pluginDrawer" width="80%" placement="right" :auto-focus="false"> <NDrawer v-model:show="pluginDrawer" width="80%" placement="right" :auto-focus="false">
<NDrawerContent closable> <NDrawerContent closable>
<template #header> <template #header>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span>风险分析记录表</span> <span>风险分析记录表</span>
<NTag v-if="currentRecord?.source" size="small" type="info"> <NTag v-if="currentRecord?.source" size="small" type="info">
<span v-if="currentRecord?.source === 'RISK'">风险预分析</span> <span v-if="currentRecord?.source === 'RISK'">风险预分析</span>
<span v-else-if="currentRecord?.source === 'HAZOP'">HAZOP</span> <span v-else-if="currentRecord?.source === 'HAZOP'">HAZOP</span>
<span v-else-if="currentRecord?.source === 'FMEA'">FMEA</span> <span v-else-if="currentRecord?.source === 'FMEA'">FMEA</span>
<span v-else-if="currentRecord?.source === 'RISK_CHECK'">风险检查</span> <span v-else-if="currentRecord?.source === 'RISK_CHECK'">风险检查</span>
<span v-else>未知分析记录</span> <span v-else>未知分析记录</span>
</NTag> </NTag>
</div> </div>
</template> </template>
<template v-if="currentRecord?.source === 'RISK'"> <template v-if="currentRecord?.source === 'RISK'">
<RiskPre :currentId="currentRecord?.change_id" :info="currentRecord" @close="pluginDrawer = false" /> <RiskPre :currentId="currentRecord?.change_id" :info="currentRecord" @close="pluginDrawer = false" />
</template> </template>
<template v-if="currentRecord?.source === 'HAZOP'"> <template v-if="currentRecord?.source === 'HAZOP'">
<Hazop :currentId="currentRecord?.change_id" :info="currentRecord" :hazopRiskMatrixConfig="hazopMatrix" @close="pluginDrawer = false" /> <Hazop :currentId="currentRecord?.change_id" :info="currentRecord" :hazopRiskMatrixConfig="hazopMatrix" @close="pluginDrawer = false" />
</template> </template>
<template v-if="currentRecord?.source === 'FMEA'"> <template v-if="currentRecord?.source === 'FMEA'">
<Fmea :currentId="currentRecord?.change_id" :info="currentRecord" :fmeaRiskMatrixConfig="fmeaMatrix" @close="pluginDrawer = false" /> <Fmea :currentId="currentRecord?.change_id" :info="currentRecord" :fmeaRiskMatrixConfig="fmeaMatrix" @close="pluginDrawer = false" />
</template> </template>
<template v-if="currentRecord?.source === 'RISK_CHECK'"> <template v-if="currentRecord?.source === 'RISK_CHECK'">
<RiskCheck :currentId="currentRecord?.change_id" :info="currentRecord" @close="pluginDrawer = false" /> <RiskCheck :currentId="currentRecord?.change_id" :info="currentRecord" @close="pluginDrawer = false" />
</template> </template>
</NDrawerContent> </NDrawerContent>
</NDrawer> </NDrawer>
</NSpin> </NSpin>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll { .scroll {
height: calc(100vh - 310px); height: calc(100vh - 310px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
+88 -88
View File
@@ -1,88 +1,88 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref } 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 { analysisRecordListApi } from '@/service/api/highRisk'; import { analysisRecordListApi } from '@/service/api/highRisk';
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const props = defineProps(['isAiOpen','currentId']) const props = defineProps(['isAiOpen','currentId'])
const emit = defineEmits(['close','toTable']); const emit = defineEmits(['close','toTable']);
// 表格样式 // 表格样式
const TH = "border bg-slate-100 px-2 py-1.5 text-[11px] font-medium text-slate-500"; const TH = "border bg-slate-100 px-2 py-1.5 text-[11px] font-medium text-slate-500";
const TD = "border px-1.5 py-1 align-top"; const TD = "border px-1.5 py-1 align-top";
// 加载状态 // 加载状态
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 风险分析记录 // 风险分析记录
const riskRecords = ref<any[]>([]); const riskRecords = ref<any[]>([]);
// 获取详情 // 获取详情
const getDetail = async () => { const getDetail = async () => {
loading.value = true; loading.value = true;
const {data,error} = await analysisRecordListApi(props.currentId); const {data,error} = await analysisRecordListApi(props.currentId);
if(!error){ if(!error){
riskRecords.value = data?.risk_summary?.rows || []; riskRecords.value = data?.risk_summary?.rows || [];
} }
loading.value = false; loading.value = false;
} }
onMounted(() => { onMounted(() => {
getDetail(); getDetail();
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3" :style="{'--theme-color': themeStore.themeColor}"> <div class="space-y-3" :style="{'--theme-color': themeStore.themeColor}">
<div class="bg-white"> <div class="bg-white">
<div class="flex items-center gap-2 px-3 py-2 text-xs font-semibold text-slate-600 border border-b-0 rounded-tl-lg rounded-tr-lg"> <div class="flex items-center gap-2 px-3 py-2 text-xs font-semibold text-slate-600 border border-b-0 rounded-tl-lg rounded-tr-lg">
风险分析记录表 风险分析记录表
</div> </div>
<p v-if="riskRecords.length===0" class="border py-5 text-center text-xs text-slate-400">暂无风险分析记录</p> <p v-if="riskRecords.length===0" class="border py-5 text-center text-xs text-slate-400">暂无风险分析记录</p>
<div v-else class="scroll"> <div v-else class="scroll">
<table class="w-full"> <table class="w-full">
<thead> <thead>
<tr> <tr>
<th :class="TH" class="w-30">风险项</th> <th :class="TH" class="w-30">风险项</th>
<th :class="TH" class="w-60">场景描述</th> <th :class="TH" class="w-60">场景描述</th>
<th :class="TH" class="w-20">固有风险</th> <th :class="TH" class="w-20">固有风险</th>
<th :class="TH" class="w-50">现有措施</th> <th :class="TH" class="w-50">现有措施</th>
<th :class="TH" class="w-60">建议措施</th> <th :class="TH" class="w-60">建议措施</th>
<th :class="TH" class="w-20">剩余风险</th> <th :class="TH" class="w-20">剩余风险</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(row, rowIndex) in riskRecords" :key="rowIndex"> <tr v-for="(row, rowIndex) in riskRecords" :key="rowIndex">
<td :class="TD"> <td :class="TD">
<span>{{row.risk_item}}</span> <span>{{row.risk_item}}</span>
</td> </td>
<td :class="TD"> <td :class="TD">
<span>{{row.scene_desc}}</span> <span>{{row.scene_desc}}</span>
</td> </td>
<td :class="TD" class="text-center"> <td :class="TD" class="text-center">
<span>{{row.risk_value}}</span> <span>{{row.risk_value}}</span>
</td> </td>
<td :class="TD"> <td :class="TD">
<span>{{row.safeguards}}</span> <span>{{row.safeguards}}</span>
</td> </td>
<td :class="TD"> <td :class="TD">
<span>{{row.suggestions}}</span> <span>{{row.suggestions}}</span>
</td> </td>
<td :class="TD" class="text-center"> <td :class="TD" class="text-center">
<span>{{row.residual_risk_value}}</span> <span>{{row.residual_risk_value}}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll{ .scroll{
height: calc(100vh - 135px); height: calc(100vh - 135px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
@@ -1,476 +1,476 @@
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue' import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
modelValue?: string modelValue?: string
placeholder?: string placeholder?: string
minRows?: number minRows?: number
maxRows?: number maxRows?: number
disabled?: boolean disabled?: boolean
bordered?: boolean bordered?: boolean
}>(), { }>(), {
modelValue: '', modelValue: '',
placeholder: '', placeholder: '',
minRows: 1, minRows: 1,
maxRows: 100, maxRows: 100,
disabled: false, disabled: false,
bordered: true, bordered: true,
}) })
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:modelValue', value: string): void (e: 'update:modelValue', value: string): void
}>() }>()
const editorRef = ref<HTMLDivElement | null>(null) const editorRef = ref<HTMLDivElement | null>(null)
const isFocused = ref(false) const isFocused = ref(false)
const showColorPicker = ref(false) const showColorPicker = ref(false)
const LINE_HEIGHT = 22 // 单行高度(px) const LINE_HEIGHT = 22 // 单行高度(px)
const colorOptions = [ const colorOptions = [
{ label: '红色', value: '#e8364e', bg: '#e8364e' }, { label: '红色', value: '#e8364e', bg: '#e8364e' },
{ label: '蓝色', value: '#1890ff', bg: '#1890ff' }, { label: '蓝色', value: '#1890ff', bg: '#1890ff' },
{ label: '橙色', value: '#fa8c16', bg: '#fa8c16' }, { label: '橙色', value: '#fa8c16', bg: '#fa8c16' },
{ label: '绿色', value: '#52c41a', bg: '#52c41a' }, { label: '绿色', value: '#52c41a', bg: '#52c41a' },
{ label: '紫色', value: '#722ed1', bg: '#722ed1' }, { label: '紫色', value: '#722ed1', bg: '#722ed1' },
{ label: '默认', value: '', bg: '#333333' }, { label: '默认', value: '', bg: '#333333' },
] ]
// 获取编辑器中去掉 HTML 标签后的纯文本,用于判断是否为空 // 获取编辑器中去掉 HTML 标签后的纯文本,用于判断是否为空
function getPlainText(): string { function getPlainText(): string {
if (!editorRef.value) if (!editorRef.value)
return '' return ''
return editorRef.value.innerText?.trim() || '' return editorRef.value.innerText?.trim() || ''
} }
const hasContent = ref(false) const hasContent = ref(false)
// 设置编辑器内容(仅在内容确实不同时才更新,防止光标重置) // 设置编辑器内容(仅在内容确实不同时才更新,防止光标重置)
function setEditorHtml(html: string) { function setEditorHtml(html: string) {
if (!editorRef.value) if (!editorRef.value)
return return
if (editorRef.value.innerHTML !== html) if (editorRef.value.innerHTML !== html)
editorRef.value.innerHTML = html || '' editorRef.value.innerHTML = html || ''
} }
// 输入事件:同步内容到 modelValue // 输入事件:同步内容到 modelValue
function onInput() { function onInput() {
if (!editorRef.value) if (!editorRef.value)
return return
const html = editorRef.value.innerHTML || '' const html = editorRef.value.innerHTML || ''
// 如果内容只是 <br> 或空 div 则视为空 // 如果内容只是 <br> 或空 div 则视为空
const plain = getPlainText() const plain = getPlainText()
hasContent.value = !!plain hasContent.value = !!plain
emit('update:modelValue', plain ? html : '') emit('update:modelValue', plain ? html : '')
} }
function onFocus() { function onFocus() {
isFocused.value = true isFocused.value = true
} }
function onBlur() { function onBlur() {
// 延迟关闭,让工具栏按钮的 mousedown 有时间执行 // 延迟关闭,让工具栏按钮的 mousedown 有时间执行
setTimeout(() => { setTimeout(() => {
isFocused.value = false isFocused.value = false
showColorPicker.value = false showColorPicker.value = false
}, 200) }, 200)
} }
// =============== 工具栏操作 =============== // =============== 工具栏操作 ===============
// 保存和恢复选区 // 保存和恢复选区
let savedSelection: Range | null = null let savedSelection: Range | null = null
function saveSelection() { function saveSelection() {
const sel = window.getSelection() const sel = window.getSelection()
if (sel && sel.rangeCount > 0) if (sel && sel.rangeCount > 0)
savedSelection = sel.getRangeAt(0).cloneRange() savedSelection = sel.getRangeAt(0).cloneRange()
} }
function restoreSelection() { function restoreSelection() {
if (savedSelection) { if (savedSelection) {
const sel = window.getSelection() const sel = window.getSelection()
if (sel) { if (sel) {
sel.removeAllRanges() sel.removeAllRanges()
sel.addRange(savedSelection) sel.addRange(savedSelection)
} }
} }
} }
// 执行粗体 // 执行粗体
function execBold(e: Event) { function execBold(e: Event) {
e.preventDefault() e.preventDefault()
restoreSelection() restoreSelection()
document.execCommand('bold', false) document.execCommand('bold', false)
editorRef.value?.focus() editorRef.value?.focus()
onInput() onInput()
} }
// 执行文字颜色 // 执行文字颜色
function execColor(color: string, e: Event) { function execColor(color: string, e: Event) {
e.preventDefault() e.preventDefault()
restoreSelection() restoreSelection()
if (color) { if (color) {
document.execCommand('foreColor', false, color) document.execCommand('foreColor', false, color)
} }
else { else {
// 移除颜色:先获取选区文本,删除后用无格式文本替换 // 移除颜色:先获取选区文本,删除后用无格式文本替换
document.execCommand('removeFormat', false) document.execCommand('removeFormat', false)
} }
showColorPicker.value = false showColorPicker.value = false
editorRef.value?.focus() editorRef.value?.focus()
onInput() onInput()
} }
function toggleColorPicker(e: Event) { function toggleColorPicker(e: Event) {
e.preventDefault() e.preventDefault()
saveSelection() saveSelection()
showColorPicker.value = !showColorPicker.value showColorPicker.value = !showColorPicker.value
} }
// 工具栏按钮 mousedown 时保存选区 // 工具栏按钮 mousedown 时保存选区
function onToolbarMousedown(e: Event) { function onToolbarMousedown(e: Event) {
e.preventDefault() e.preventDefault()
saveSelection() saveSelection()
} }
// 监听粘贴事件,只粘贴纯文本(保留已有的 HTML 标记,但不引入外部格式) // 监听粘贴事件,只粘贴纯文本(保留已有的 HTML 标记,但不引入外部格式)
function onPaste(e: ClipboardEvent) { function onPaste(e: ClipboardEvent) {
e.preventDefault() e.preventDefault()
// 优先粘贴 HTML(保留粗体/颜色),fallback 纯文本 // 优先粘贴 HTML(保留粗体/颜色),fallback 纯文本
const html = e.clipboardData?.getData('text/html') const html = e.clipboardData?.getData('text/html')
const text = e.clipboardData?.getData('text/plain') || '' const text = e.clipboardData?.getData('text/plain') || ''
if (html) { if (html) {
// 清理外部 HTML:只保留简单的格式标签 // 清理外部 HTML:只保留简单的格式标签
const cleanHtml = sanitizeHtml(html) const cleanHtml = sanitizeHtml(html)
document.execCommand('insertHTML', false, cleanHtml) document.execCommand('insertHTML', false, cleanHtml)
} }
else { else {
document.execCommand('insertText', false, text) document.execCommand('insertText', false, text)
} }
onInput() onInput()
} }
// 简易 HTML 清洗:只保留 b/strong/span/em/i/br 标签 // 简易 HTML 清洗:只保留 b/strong/span/em/i/br 标签
function sanitizeHtml(html: string): string { function sanitizeHtml(html: string): string {
const div = document.createElement('div') const div = document.createElement('div')
div.innerHTML = html div.innerHTML = html
// 递归清洗 // 递归清洗
function cleanNode(node: Node): string { function cleanNode(node: Node): string {
if (node.nodeType === Node.TEXT_NODE) if (node.nodeType === Node.TEXT_NODE)
return node.textContent || '' return node.textContent || ''
if (node.nodeType !== Node.ELEMENT_NODE) if (node.nodeType !== Node.ELEMENT_NODE)
return '' return ''
const el = node as HTMLElement const el = node as HTMLElement
const tag = el.tagName.toLowerCase() const tag = el.tagName.toLowerCase()
const allowedTags = ['b', 'strong', 'span', 'em', 'i', 'br', 'u'] const allowedTags = ['b', 'strong', 'span', 'em', 'i', 'br', 'u']
let inner = '' let inner = ''
el.childNodes.forEach((child) => { el.childNodes.forEach((child) => {
inner += cleanNode(child) inner += cleanNode(child)
}) })
if (tag === 'br') if (tag === 'br')
return '<br>' return '<br>'
if (allowedTags.includes(tag)) { if (allowedTags.includes(tag)) {
// 保留 span 的 style 中的 color // 保留 span 的 style 中的 color
if (tag === 'span' && el.style.color) if (tag === 'span' && el.style.color)
return `<span style="color:${el.style.color}">${inner}</span>` return `<span style="color:${el.style.color}">${inner}</span>`
if (tag === 'b' || tag === 'strong') if (tag === 'b' || tag === 'strong')
return `<b>${inner}</b>` return `<b>${inner}</b>`
if (tag === 'em' || tag === 'i') if (tag === 'em' || tag === 'i')
return `<em>${inner}</em>` return `<em>${inner}</em>`
return inner return inner
} }
// 块级元素转换为换行 // 块级元素转换为换行
const blockTags = ['div', 'p', 'li', 'tr', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'] const blockTags = ['div', 'p', 'li', 'tr', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
if (blockTags.includes(tag)) if (blockTags.includes(tag))
return `${inner}<br>` return `${inner}<br>`
return inner return inner
} }
return cleanNode(div) return cleanNode(div)
} }
// 监听外部 modelValue 变化 // 监听外部 modelValue 变化
watch( watch(
() => props.modelValue, () => props.modelValue,
(newVal:string) => { (newVal:string) => {
if (!editorRef.value) if (!editorRef.value)
return return
// 仅在编辑器不聚焦或内容确实不同时更新 // 仅在编辑器不聚焦或内容确实不同时更新
if (!isFocused.value || editorRef.value.innerHTML !== newVal) { if (!isFocused.value || editorRef.value.innerHTML !== newVal) {
setEditorHtml(newVal || '') setEditorHtml(newVal || '')
hasContent.value = !!getPlainText() hasContent.value = !!getPlainText()
} }
}, },
) )
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
setEditorHtml(props.modelValue || '') setEditorHtml(props.modelValue || '')
hasContent.value = !!getPlainText() hasContent.value = !!getPlainText()
}) })
}) })
// 点击编辑器外部关闭颜色选择器 // 点击编辑器外部关闭颜色选择器
function handleDocClick(e: MouseEvent) { function handleDocClick(e: MouseEvent) {
const target = e.target as HTMLElement const target = e.target as HTMLElement
if (!target.closest('.rich-text-input')) if (!target.closest('.rich-text-input'))
showColorPicker.value = false showColorPicker.value = false
} }
onMounted(() => { onMounted(() => {
document.addEventListener('click', handleDocClick) document.addEventListener('click', handleDocClick)
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
document.removeEventListener('click', handleDocClick) document.removeEventListener('click', handleDocClick)
}) })
</script> </script>
<template> <template>
<div <div
class="rich-text-input" class="rich-text-input"
:class="{ 'is-focused': isFocused, 'is-disabled': disabled, 'bordered': bordered }" :class="{ 'is-focused': isFocused, 'is-disabled': disabled, 'bordered': bordered }"
> >
<!-- 工具栏 --> <!-- 工具栏 -->
<div v-show="isFocused && !disabled" class="rti-toolbar"> <div v-show="isFocused && !disabled" class="rti-toolbar">
<button <button
class="rti-btn" class="rti-btn"
title="粗体 (Ctrl+B)" title="粗体 (Ctrl+B)"
@mousedown="onToolbarMousedown" @mousedown="onToolbarMousedown"
@click="execBold" @click="execBold"
> >
<b>B</b> <b>B</b>
</button> </button>
<div class="rti-color-wrap"> <div class="rti-color-wrap">
<button <button
class="rti-btn rti-btn-color" class="rti-btn rti-btn-color"
title="文字颜色" title="文字颜色"
@mousedown="toggleColorPicker" @mousedown="toggleColorPicker"
> >
<span class="rti-color-icon">A</span> <span class="rti-color-icon">A</span>
<span class="rti-color-bar" /> <span class="rti-color-bar" />
</button> </button>
<div v-show="showColorPicker" class="rti-color-dropdown"> <div v-show="showColorPicker" class="rti-color-dropdown">
<button <button
v-for="c in colorOptions" v-for="c in colorOptions"
:key="c.value" :key="c.value"
class="rti-color-option" class="rti-color-option"
:title="c.label" :title="c.label"
@mousedown="(e: Event) => execColor(c.value, e)" @mousedown="(e: Event) => execColor(c.value, e)"
> >
<span class="rti-color-dot" :style="{ background: c.bg }" /> <span class="rti-color-dot" :style="{ background: c.bg }" />
<span class="rti-color-label">{{ c.label }}</span> <span class="rti-color-label">{{ c.label }}</span>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<!-- 编辑区域 --> <!-- 编辑区域 -->
<div class="rti-editor-wrap"> <div class="rti-editor-wrap">
<div <div
ref="editorRef" ref="editorRef"
class="rti-editor" class="rti-editor"
:contenteditable="!disabled" :contenteditable="!disabled"
:style="{ :style="{
maxHeight: `${maxRows * LINE_HEIGHT}px`, maxHeight: `${maxRows * LINE_HEIGHT}px`,
}" }"
@input="onInput" @input="onInput"
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
@paste="onPaste" @paste="onPaste"
@mouseup="saveSelection" @mouseup="saveSelection"
@keyup="saveSelection" @keyup="saveSelection"
></div> ></div>
<div v-if="!hasContent && !isFocused" class="rti-placeholder"> <div v-if="!hasContent && !isFocused" class="rti-placeholder">
{{ placeholder }} {{ placeholder }}
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.rich-text-input { .rich-text-input {
position: relative; position: relative;
background: #fafbfc; background: #fafbfc;
transition: all 0.2s ease; transition: all 0.2s ease;
overflow: visible; overflow: visible;
} }
.bordered { .bordered {
border: 1px solid #e5e8ef; border: 1px solid #e5e8ef;
border-radius: 6px; border-radius: 6px;
} }
.rich-text-input:hover { .rich-text-input:hover {
border-color: #2080f0; border-color: #2080f0;
} }
.rich-text-input.is-focused { .rich-text-input.is-focused {
border-color: #2080f0; border-color: #2080f0;
background: #ffffff; background: #ffffff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1); box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
} }
.rich-text-input.is-disabled { .rich-text-input.is-disabled {
opacity: 0.8; opacity: 0.8;
background: transparent; background: transparent;
border-color: transparent; border-color: transparent;
} }
.rich-text-input.is-disabled:hover { .rich-text-input.is-disabled:hover {
border-color: transparent; border-color: transparent;
} }
/* 工具栏 */ /* 工具栏 */
.rti-toolbar { .rti-toolbar {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 2px; gap: 2px;
padding: 4px 8px; padding: 4px 8px;
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
background: #fafbfc; background: #fafbfc;
border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0;
} }
.rti-btn { .rti-btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 28px; width: 28px;
height: 26px; height: 26px;
border: none; border: none;
background: transparent; background: transparent;
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
font-size: 13px; font-size: 13px;
color: #4e5969; color: #4e5969;
transition: all 0.15s; transition: all 0.15s;
} }
.rti-btn:hover { .rti-btn:hover {
background: #e8f4ff; background: #e8f4ff;
color: #2080f0; color: #2080f0;
} }
.rti-btn b { .rti-btn b {
font-weight: 700; font-weight: 700;
font-size: 14px; font-size: 14px;
} }
/* 颜色按钮 */ /* 颜色按钮 */
.rti-color-wrap { .rti-color-wrap {
position: relative; position: relative;
} }
.rti-btn-color { .rti-btn-color {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 1px; gap: 1px;
width: 28px; width: 28px;
} }
.rti-color-icon { .rti-color-icon {
font-weight: 700; font-weight: 700;
font-size: 13px; font-size: 13px;
line-height: 1; line-height: 1;
} }
.rti-color-bar { .rti-color-bar {
width: 14px; width: 14px;
height: 3px; height: 3px;
background: linear-gradient(90deg, #e8364e, #2080f0, #fa8c16, #52c41a); background: linear-gradient(90deg, #e8364e, #2080f0, #fa8c16, #52c41a);
border-radius: 1px; border-radius: 1px;
} }
/* 颜色下拉 */ /* 颜色下拉 */
.rti-color-dropdown { .rti-color-dropdown {
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
margin-top: 4px; margin-top: 4px;
padding: 6px; padding: 6px;
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
z-index: 100; z-index: 100;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 2px; gap: 2px;
min-width: 90px; min-width: 90px;
} }
.rti-color-option { .rti-color-option {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
padding: 5px 8px; padding: 5px 8px;
border: none; border: none;
background: transparent; background: transparent;
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
color: #4e5969; color: #4e5969;
transition: background 0.15s; transition: background 0.15s;
white-space: nowrap; white-space: nowrap;
} }
.rti-color-option:hover { .rti-color-option:hover {
background: #f2f3f5; background: #f2f3f5;
} }
.rti-color-dot { .rti-color-dot {
width: 14px; width: 14px;
height: 14px; height: 14px;
border-radius: 50%; border-radius: 50%;
border: 1px solid rgba(0, 0, 0, 0.06); border: 1px solid rgba(0, 0, 0, 0.06);
flex-shrink: 0; flex-shrink: 0;
} }
.rti-color-label { .rti-color-label {
font-size: 12px; font-size: 12px;
} }
/* 编辑区域 */ /* 编辑区域 */
.rti-editor-wrap { .rti-editor-wrap {
position: relative; position: relative;
} }
.rti-editor { .rti-editor {
padding: 2px 10px; padding: 2px 10px;
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
color: #1d2129; color: #1d2129;
overflow-y: auto; overflow-y: auto;
outline: none; outline: none;
word-break: break-word; word-break: break-word;
white-space: pre-wrap; white-space: pre-wrap;
} }
.rti-editor:empty::before { .rti-editor:empty::before {
content: ''; content: '';
} }
/* 粗体和颜色在编辑器内的渲染 */ /* 粗体和颜色在编辑器内的渲染 */
.rti-editor :deep(b), .rti-editor :deep(b),
.rti-editor :deep(strong) { .rti-editor :deep(strong) {
font-weight: 700; font-weight: 700;
} }
.rti-placeholder { .rti-placeholder {
position: absolute; position: absolute;
top: 2px; top: 2px;
left: 10px; left: 10px;
color: #c9cdd4; color: #c9cdd4;
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
pointer-events: none; pointer-events: none;
user-select: none; user-select: none;
} }
</style> </style>
@@ -1,232 +1,232 @@
<!-- 变更关闭确认表 --> <!-- 变更关闭确认表 -->
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import { computed, ref } 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 Footer from './footer.vue'; import Footer from './footer.vue';
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const props = defineProps(['type','isAiOpen','title','currentId','members']) const props = defineProps(['type','isAiOpen','title','currentId','members'])
const emit = defineEmits(['save','submit','confirmTab']); const emit = defineEmits(['save','submit','confirmTab']);
const form = ref<{ content: string }>({ const form = ref<{ content: string }>({
content: '' content: ''
}); });
const closeDocs = ref([ const closeDocs = ref([
{ name: "PID 图纸(PID-R201-03,受控最新版)", cat: "图纸与规程类", scope: "是", archived: true }, { name: "PID 图纸(PID-R201-03,受控最新版)", cat: "图纸与规程类", scope: "是", archived: true },
{ name: "操作规程(含超温应急处置卡)", cat: "图纸与规程类", scope: "是", archived: false }, { name: "操作规程(含超温应急处置卡)", cat: "图纸与规程类", scope: "是", archived: false },
{ name: "应急预案修订", cat: "图纸与规程类", scope: "不涉及", archived: false }, { name: "应急预案修订", cat: "图纸与规程类", scope: "不涉及", archived: false },
{ name: "总图更新", cat: "图纸与规程类", scope: "否", archived: false }, { name: "总图更新", cat: "图纸与规程类", scope: "否", archived: false },
{ name: "DCS 联锁台账(新报警 / 联锁值)", cat: "台账与制度类", scope: "是", archived: false }, { name: "DCS 联锁台账(新报警 / 联锁值)", cat: "台账与制度类", scope: "是", archived: false },
{ name: "设备台账与备件清单", cat: "台账与制度类", scope: "是", archived: true }, { name: "设备台账与备件清单", cat: "台账与制度类", scope: "是", archived: true },
{ name: "风险分析报告(HAZOP / 检查表法)", cat: "过程与结果文件类", scope: "是", archived: true }, { name: "风险分析报告(HAZOP / 检查表法)", cat: "过程与结果文件类", scope: "是", archived: true },
{ name: "培训签到与考核记录", cat: "过程与结果文件类", scope: "是", archived: true }, { name: "培训签到与考核记录", cat: "过程与结果文件类", scope: "是", archived: true },
{ name: "PSSR 检查记录(含现场照片)", cat: "过程与结果文件类", scope: "是", archived: false }, { name: "PSSR 检查记录(含现场照片)", cat: "过程与结果文件类", scope: "是", archived: false },
{ name: "验收报告与化验数据", cat: "过程与结果文件类", scope: "是", archived: false }, { name: "验收报告与化验数据", cat: "过程与结果文件类", scope: "是", archived: false },
]); ]);
const closeFold = ref<Record<string, boolean>>({}); const closeFold = ref<Record<string, boolean>>({});
const uploadDoc = ref<string | null>(null); const uploadDoc = ref<string | null>(null);
const uploadSel = ref<string | null>(null); const uploadSel = ref<string | null>(null);
const updateDocs = ref<string[]>([]); const updateDocs = ref<string[]>([]);
const UPDATE_DOC_KW: Record<string, string> = { PID图纸: "PID", 操作规程: "操作规程", 总图: "总图", 设备台账: "设备台账", 工艺卡片: "工艺卡片", 联锁台账: "联锁台账", 应急预案: "应急预案" }; const UPDATE_DOC_KW: Record<string, string> = { PID图纸: "PID", 操作规程: "操作规程", 总图: "总图", 设备台账: "设备台账", 工艺卡片: "工艺卡片", 联锁台账: "联锁台账", 应急预案: "应急预案" };
const needUpdate = (name: string) => updateDocs.value.some((d:any) => name.includes(UPDATE_DOC_KW[d] ?? d)); const needUpdate = (name: string) => updateDocs.value.some((d:any) => name.includes(UPDATE_DOC_KW[d] ?? d));
const changeScope = (d: any, v: string) => { const changeScope = (d: any, v: string) => {
closeDocs.value = closeDocs.value.map((x:any) => (x.name === d.name ? { ...x, scope: v } : x)); closeDocs.value = closeDocs.value.map((x:any) => (x.name === d.name ? { ...x, scope: v } : x));
if (v !== d.scope) window.$message?.info(`演示:「${d.name}」改判为「${v}」,改判理由与操作人已留痕`); if (v !== d.scope) window.$message?.info(`演示:「${d.name}」改判为「${v}」,改判理由与操作人已留痕`);
} }
const uploadDocInfo = computed(() => { const uploadDocInfo = computed(() => {
if (!uploadDoc.value) return null; if (!uploadDoc.value) return null;
const doc = closeDocs.value.find((x) => x.name === uploadDoc.value); const doc = closeDocs.value.find((x) => x.name === uploadDoc.value);
const base = uploadDoc.value.replace(/[((].*$/, ""); const base = uploadDoc.value.replace(/[((].*$/, "");
return { return {
storePath: `\\\\PLANT-DMS\\变更管理\\2026\\MOC-2026-R01-0041\\${doc?.cat ?? ""}\\`, storePath: `\\\\PLANT-DMS\\变更管理\\2026\\MOC-2026-R01-0041\\${doc?.cat ?? ""}\\`,
candidates: [`${base}_RevC_受控版.pdf`, `${base}_2026-08 更新版.docx`], candidates: [`${base}_RevC_受控版.pdf`, `${base}_2026-08 更新版.docx`],
base, base,
}; };
}); });
const openDir = () => { const openDir = () => {
window.$message?.info('演示:已在文档管理系统中打开该目录') window.$message?.info('演示:已在文档管理系统中打开该目录')
} }
const uploadFiles = () => { const uploadFiles = () => {
uploadSel.value = `本地文件:${uploadDocInfo.value?.base}_最新版.pdf`; uploadSel.value = `本地文件:${uploadDocInfo.value?.base}_最新版.pdf`;
window.$message?.info('演示:已接收拖拽 / 选择的本地文件'); window.$message?.info('演示:已接收拖拽 / 选择的本地文件');
} }
const uploadConfirm = () => { const uploadConfirm = () => {
closeDocs.value = closeDocs.value.map((x) => (x.name === uploadDoc.value ? { ...x, archived: true } : x)); closeDocs.value = closeDocs.value.map((x) => (x.name === uploadDoc.value ? { ...x, archived: true } : x));
window.$message?.success(`「${uploadDoc.value}」已上传并归档(${uploadSel.value},受控版本,哈希留痕)`); window.$message?.success(`「${uploadDoc.value}」已上传并归档(${uploadSel.value},受控版本,哈希留痕)`);
uploadDoc.value = null; uploadDoc.value = null;
} }
// 保存草稿 // 保存草稿
const saveDraft = () => { const saveDraft = () => {
emit('save'); emit('save');
} }
// 提交 // 提交
const submitConfirm = () => { const submitConfirm = () => {
emit('submit', props.type); emit('submit', props.type);
} }
// // 确认标签内容 // // 确认标签内容
const confirmTab = (tab:string, val:boolean) => { const confirmTab = (tab:string, val:boolean) => {
emit('confirmTab', tab, val); emit('confirmTab', tab, val);
} }
defineExpose({form}) defineExpose({form})
</script> </script>
<template> <template>
<div class="p-4"> <div class="p-4">
<div class="space-y-4 scroll"> <div class="space-y-4 scroll">
<div class="flex flex-wrap items-center gap-3"> <div class="flex flex-wrap items-center gap-3">
<span class="flex items-center gap-1.5 text-sm font-semibold text-slate-700"> <span class="flex items-center gap-1.5 text-sm font-semibold text-slate-700">
<Icon icon="quill:folder-open" class="size-16px" /> <Icon icon="quill:folder-open" class="size-16px" />
变更关闭确认表(资料归档清单) 变更关闭确认表(资料归档清单)
</span> </span>
<span class="inline-flex items-center gap-1 rounded-full border border-violet-200 bg-violet-100 px-2 py-0.5 text-xs font-medium text-violet-700"> <span class="inline-flex items-center gap-1 rounded-full border border-violet-200 bg-violet-100 px-2 py-0.5 text-xs font-medium text-violet-700">
✨ AI 生成 · 需人工确认 ✨ AI 生成 · 需人工确认
</span> </span>
<NTag size="small" class="text-xs">AI 辅助判定一次 · 支持人工改判留痕</NTag> <NTag size="small" class="text-xs">AI 辅助判定一次 · 支持人工改判留痕</NTag>
<span class="ml-auto text-xs text-slate-400">判定为「是」的资料全部归档后,变更主管部门专责方可确认关闭</span> <span class="ml-auto text-xs text-slate-400">判定为「是」的资料全部归档后,变更主管部门专责方可确认关闭</span>
</div> </div>
<div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center gap-3 bg-slate-100 px-3 py-2 text-xs font-medium text-slate-500"> <div class="flex items-center gap-3 bg-slate-100 px-3 py-2 text-xs font-medium text-slate-500">
<span class="w-5"></span> <span class="w-5"></span>
<span class="flex-1">资料名称(与申请表「需更新的资料」勾选联动,勾选资料标记「需更新版本」)</span> <span class="flex-1">资料名称(与申请表「需更新的资料」勾选联动,勾选资料标记「需更新版本」)</span>
<span class="w-48 text-center">是否涉及(AI 判定,可改判)</span> <span class="w-48 text-center">是否涉及(AI 判定,可改判)</span>
<span class="w-32 text-center">归档状态</span> <span class="w-32 text-center">归档状态</span>
</div> </div>
<template v-for="cat in (['图纸与规程类', '台账与制度类', '过程与结果文件类'])" :key="cat"> <template v-for="cat in (['图纸与规程类', '台账与制度类', '过程与结果文件类'])" :key="cat">
<div v-if="closeDocs.filter((d) => d.cat === cat).length"> <div v-if="closeDocs.filter((d) => d.cat === cat).length">
<button @click="closeFold = { ...closeFold, [cat]: !closeFold[cat] }" <button @click="closeFold = { ...closeFold, [cat]: !closeFold[cat] }"
class="flex w-full items-center gap-2 border-t bg-slate-50 px-3 py-2 text-left text-xs font-semibold text-slate-600 transition hover:bg-[#EAF0F9]"> class="flex w-full items-center gap-2 border-t bg-slate-50 px-3 py-2 text-left text-xs font-semibold text-slate-600 transition hover:bg-[#EAF0F9]">
<Icon icon="formkit:right" class="size-14px text-slate-400 transition" :class="closeFold[cat] ? '' : 'rotate-90'" /> <Icon icon="formkit:right" class="size-14px text-slate-400 transition" :class="closeFold[cat] ? '' : 'rotate-90'" />
{{ cat }} {{ cat }}
<span class="font-normal text-slate-400"> <span class="font-normal text-slate-400">
{{ closeDocs.filter((d) => d.cat === cat).length }} 项 · 已归档 {{ closeDocs.filter((d) => d.cat === cat).length }} 项 · 已归档
{{ closeDocs.filter((d) => d.cat === cat && d.scope === '是' && d.archived).length }}/{{ closeDocs.filter((d) => d.cat === cat && d.scope === '是').length }} {{ closeDocs.filter((d) => d.cat === cat && d.scope === '是' && d.archived).length }}/{{ closeDocs.filter((d) => d.cat === cat && d.scope === '是').length }}
</span> </span>
<span class="ml-auto text-[11px] font-normal text-slate-400">{{ closeFold[cat] ? '点击展开' : '点击折叠' }}</span> <span class="ml-auto text-[11px] font-normal text-slate-400">{{ closeFold[cat] ? '点击展开' : '点击折叠' }}</span>
</button> </button>
<template v-if="!closeFold[cat]"> <template v-if="!closeFold[cat]">
<div v-for="d in closeDocs.filter((x) => x.cat === cat)" :key="d.name" class="flex flex-wrap items-center gap-3 border-t px-3 py-2.5 text-sm"> <div v-for="d in closeDocs.filter((x) => x.cat === cat)" :key="d.name" class="flex flex-wrap items-center gap-3 border-t px-3 py-2.5 text-sm">
<span class="w-5 text-slate-400">{{ closeDocs.indexOf(d) + 1 }}</span> <span class="w-5 text-slate-400">{{ closeDocs.indexOf(d) + 1 }}</span>
<span class="min-w-0 flex-1 text-slate-800"> <span class="min-w-0 flex-1 text-slate-800">
{{ d.name }} {{ d.name }}
<NTag v-if="needUpdate(d.name)" size="small" type="info" class="ml-2">需更新版本</NTag> <NTag v-if="needUpdate(d.name)" size="small" type="info" class="ml-2">需更新版本</NTag>
</span> </span>
<span class="flex w-48 shrink-0 justify-center gap-1.5"> <span class="flex w-48 shrink-0 justify-center gap-1.5">
<NButton size="tiny" round v-for="v in (['是', '否', '不涉及'])" :key="v" <NButton size="tiny" round v-for="v in (['是', '否', '不涉及'])" :key="v"
@click="changeScope(d, v)" @click="changeScope(d, v)"
class="text-[11px]" class="text-[11px]"
:type="d.scope === v ? 'primary' : 'default'"> :type="d.scope === v ? 'primary' : 'default'">
{{ v }} {{ v }}
</NButton> </NButton>
</span> </span>
<span class="flex w-32 shrink-0 items-center justify-center gap-2"> <span class="flex w-32 shrink-0 items-center justify-center gap-2">
<template v-if="d.scope === '是'"> <template v-if="d.scope === '是'">
<NTag v-if="d.archived" size="small" type="success">已归档</NTag> <NTag v-if="d.archived" size="small" type="success">已归档</NTag>
<template v-else> <template v-else>
<NTag size="small" type="warning">待上传</NTag> <NTag size="small" type="warning">待上传</NTag>
<NButton text type="primary" class="text-xs hover:underline" @click="uploadDoc = d.name; uploadSel = null;">上传</NButton> <NButton text type="primary" class="text-xs hover:underline" @click="uploadDoc = d.name; uploadSel = null;">上传</NButton>
</template> </template>
</template> </template>
<NTag v-else size="small">{{ d.scope }}</NTag> <NTag v-else size="small">{{ d.scope }}</NTag>
</span> </span>
</div> </div>
</template> </template>
</div> </div>
</template> </template>
</div> </div>
<div class="flex flex-wrap items-center gap-4 text-xs text-slate-500"> <div class="flex flex-wrap items-center gap-4 text-xs text-slate-500">
<span> <span>
统计:涉及 <b class="text-[#17407F]">{{ closeDocs.filter((d) => d.scope === '是').length }}</b> 项 · 统计:涉及 <b class="text-[#17407F]">{{ closeDocs.filter((d) => d.scope === '是').length }}</b> 项 ·
已归档 <b class="text-emerald-600">{{ closeDocs.filter((d) => d.scope === '是' && d.archived).length }}</b> 项 · 已归档 <b class="text-emerald-600">{{ closeDocs.filter((d) => d.scope === '是' && d.archived).length }}</b> 项 ·
待上传 <b class="text-amber-600">{{ closeDocs.filter((d) => d.scope === '是' && !d.archived).length }}</b> 项 · 待上传 <b class="text-amber-600">{{ closeDocs.filter((d) => d.scope === '是' && !d.archived).length }}</b> 项 ·
需更新版本 <b class="text-[#1D4E9C]">{{ closeDocs.filter((d) => needUpdate(d.name)).length }}</b> 项(联动申请表勾选) 需更新版本 <b class="text-[#1D4E9C]">{{ closeDocs.filter((d) => needUpdate(d.name)).length }}</b> 项(联动申请表勾选)
</span> </span>
<span class="text-slate-400">资料上传支持 PC / 移动端(拍照上传),版本受控</span> <span class="text-slate-400">资料上传支持 PC / 移动端(拍照上传),版本受控</span>
</div> </div>
<div class="rounded-lg bg-[#EAF0F9] px-4 py-2.5 text-xs leading-5 text-[#17407F]"> <div class="rounded-lg bg-[#EAF0F9] px-4 py-2.5 text-xs leading-5 text-[#17407F]">
关闭校验说明:判定为「是」的资料项全部归档后,系统将全部流程完毕信号推送变更主管部门专责,专责确认后点击关闭,系统记录变更关闭时间;「否 / 不涉及」由 AI 辅助判定一次,人工改判须填写理由并留痕。临时变更恢复完成后,恢复操作票与参数核对记录自动追加至本清单。 关闭校验说明:判定为「是」的资料项全部归档后,系统将全部流程完毕信号推送变更主管部门专责,专责确认后点击关闭,系统记录变更关闭时间;「否 / 不涉及」由 AI 辅助判定一次,人工改判须填写理由并留痕。临时变更恢复完成后,恢复操作票与参数核对记录自动追加至本清单。
</div> </div>
</div> </div>
</div> </div>
<Footer <Footer
ref="footerRef" ref="footerRef"
:type="props.type" :type="props.type"
:currentId="props.currentId" :currentId="props.currentId"
:title="props.title" :title="props.title"
:isAiOpen="props.isAiOpen" :isAiOpen="props.isAiOpen"
:members="props.members" :members="props.members"
@save="saveDraft" @save="saveDraft"
@submit="submitConfirm" @submit="submitConfirm"
@confirmTab="confirmTab" @confirmTab="confirmTab"
/> />
<!-- 资料上传弹窗 --> <!-- 资料上传弹窗 -->
<NModal <NModal
:show="uploadDoc !== null" :show="uploadDoc !== null"
preset="card" preset="card"
:auto-focus="false" :auto-focus="false"
:style="{ width: '550px', height: 'auto' }" :style="{ width: '550px', height: 'auto' }"
:segmented="{ content: true, footer: true }" :segmented="{ content: true, footer: true }"
@update:show="(v) => !v && (uploadDoc = null)" @update:show="(v) => !v && (uploadDoc = null)"
> >
<template #header> <template #header>
<div class="flex items-center gap-2 text-base font-semibold text-slate-800"> <div class="flex items-center gap-2 text-base font-semibold text-slate-800">
<Icon icon="material-symbols:upload" class="size-20px" /> 资料上传归档 — {{ uploadDoc }} <Icon icon="material-symbols:upload" class="size-20px" /> 资料上传归档 — {{ uploadDoc }}
</div> </div>
</template> </template>
<div class="space-y-3"> <div class="space-y-3">
<div> <div>
<div class="mb-1 text-xs font-medium text-slate-500">系统文档存储地址(受控目录)</div> <div class="mb-1 text-xs font-medium text-slate-500">系统文档存储地址(受控目录)</div>
<div class="flex items-center gap-2 rounded-lg border bg-slate-50 px-3 py-2"> <div class="flex items-center gap-2 rounded-lg border bg-slate-50 px-3 py-2">
<Icon icon="quill:folder-open" class="size-16px" /> <Icon icon="quill:folder-open" class="size-16px" />
<code class="min-w-0 flex-1 truncate text-xs text-slate-600">{{ uploadDocInfo?.storePath }}</code> <code class="min-w-0 flex-1 truncate text-xs text-slate-600">{{ uploadDocInfo?.storePath }}</code>
<NButton text type="primary" class="text-xs hover:underline" @click="openDir">打开目录</NButton> <NButton text type="primary" class="text-xs hover:underline" @click="openDir">打开目录</NButton>
</div> </div>
</div> </div>
<div> <div>
<div class="mb-1 text-xs font-medium text-slate-500">方式一:从存储地址选择资料</div> <div class="mb-1 text-xs font-medium text-slate-500">方式一:从存储地址选择资料</div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<p v-for="f in uploadDocInfo?.candidates" :key="f" @click="uploadSel = f" <p v-for="f in uploadDocInfo?.candidates" :key="f" @click="uploadSel = f"
class="flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-left text-xs transition cursor-pointer" class="flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-left text-xs transition cursor-pointer"
:class="uploadSel === f ? 'border-[var(--theme-color)] bg-[var(--theme-color)] text-[var(--theme-color)] text-white' : 'bg-white text-slate-600 hover:border-[var(--theme-color)] hover:text-[var(--theme-color)]'" :class="uploadSel === f ? 'border-[var(--theme-color)] bg-[var(--theme-color)] text-[var(--theme-color)] text-white' : 'bg-white text-slate-600 hover:border-[var(--theme-color)] hover:text-[var(--theme-color)]'"
:style="{'--theme-color': themeStore.themeColor}" :style="{'--theme-color': themeStore.themeColor}"
> >
<Icon icon="akar-icons:file" class="size-14px mr-1" /> {{ f }} <Icon icon="akar-icons:file" class="size-14px mr-1" /> {{ f }}
<Icon v-if="uploadSel === f" icon="ix:success" class="ml-auto size-16px" /> <Icon v-if="uploadSel === f" icon="ix:success" class="ml-auto size-16px" />
</p> </p>
</div> </div>
</div> </div>
<div> <div>
<div class="mb-1 text-xs font-medium text-slate-500">方式二:拖拽本地文件到区域</div> <div class="mb-1 text-xs font-medium text-slate-500">方式二:拖拽本地文件到区域</div>
<button @click="uploadFiles" <button @click="uploadFiles"
class="flex h-20 w-full flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed px-3 text-xs transition" class="flex h-20 w-full flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed px-3 text-xs transition"
:class="uploadSel?.startsWith('本地文件') ? 'border-[var(--theme-color)] bg-[#EAF0F9] text-[var(--theme-color)]' : 'border-slate-300 text-slate-400 hover:border-[var(--theme-color)] hover:text-[var(--theme-color)]'" :class="uploadSel?.startsWith('本地文件') ? 'border-[var(--theme-color)] bg-[#EAF0F9] text-[var(--theme-color)]' : 'border-slate-300 text-slate-400 hover:border-[var(--theme-color)] hover:text-[var(--theme-color)]'"
:style="{'--theme-color': themeStore.themeColor}" :style="{'--theme-color': themeStore.themeColor}"
> >
<Icon icon="material-symbols:upload" class="size-24px" /> <Icon icon="material-symbols:upload" class="size-24px" />
{{ uploadSel?.startsWith('本地文件') ? uploadSel : '将资料文件拖拽到此处,或点击选择本地文件' }} {{ uploadSel?.startsWith('本地文件') ? uploadSel : '将资料文件拖拽到此处,或点击选择本地文件' }}
</button> </button>
</div> </div>
</div> </div>
<template #footer> <template #footer>
<div class="flex justify-end gap-2"> <div class="flex justify-end gap-2">
<NButton @click="uploadDoc = null">取消</NButton> <NButton @click="uploadDoc = null">取消</NButton>
<NButton type="primary" :disabled="!uploadSel" @click="uploadConfirm"> <NButton type="primary" :disabled="!uploadSel" @click="uploadConfirm">
确认上传归档 确认上传归档
</NButton> </NButton>
</div> </div>
</template> </template>
</NModal> </NModal>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll { .scroll {
height: calc(100vh - 393px); height: calc(100vh - 393px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
File diff suppressed because it is too large Load Diff
+52 -52
View File
@@ -1,53 +1,53 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from '@/store/modules/theme';
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
import RichTextInput from './RichTextInput.vue' import RichTextInput from './RichTextInput.vue'
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const props = defineProps(['formInfo']) const props = defineProps(['formInfo'])
const emit = defineEmits(['update:data']); const emit = defineEmits(['update:data']);
const form = ref<any>(null); const form = ref<any>(null);
watch(() => props.formInfo, watch(() => props.formInfo,
(val: any) => { (val: any) => {
// 深度拷贝以避免直接修改 props,并确保响应式 // 深度拷贝以避免直接修改 props,并确保响应式
form.value = val form.value = val
}, },
{ immediate: true, deep: true }, { immediate: true, deep: true },
) )
// 编辑风险预分析 // 编辑风险预分析
const preRiskEdit = ref<boolean>(false); const preRiskEdit = ref<boolean>(false);
// 更新数据 // 更新数据
const onCellChange = (key:string,val:string) => { const onCellChange = (key:string,val:string) => {
form.value[key] = val; form.value[key] = val;
emit('update:data', key, val) emit('update:data', key, val)
} }
</script> </script>
<template> <template>
<div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between px-4 py-2 border-b"> <div class="flex items-center justify-between px-4 py-2 border-b">
<div class="flex items-center"> <div class="flex items-center">
<Icon icon="lucide:list-checks" class="size-16px text-emerald-500" /> <Icon icon="lucide:list-checks" class="size-16px text-emerald-500" />
<span class="font-semibold text-base ml-2">风险预分析报告</span> <span class="font-semibold text-base ml-2">风险预分析报告</span>
</div> </div>
<NButton text type="primary" class="ml-auto text-xs hover:underline" @click="preRiskEdit = !preRiskEdit"> <NButton text type="primary" class="ml-auto text-xs hover:underline" @click="preRiskEdit = !preRiskEdit">
{{ preRiskEdit ? "完成" : "编辑" }} {{ preRiskEdit ? "完成" : "编辑" }}
</NButton> </NButton>
</div> </div>
<div class="p-4"> <div class="p-4">
<div class="space-y-4"> <div class="space-y-4">
<div v-for="s in ([{ key: 'severity', name: '危害严重性分析' }, { key: 'probability', name: '事件概率分析' }, { key: 'protection', name: '保护措施影响分析' }])" :key="s.key" class="rounded-lg border"> <div v-for="s in ([{ key: 'severity', name: '危害严重性分析' }, { key: 'probability', name: '事件概率分析' }, { key: 'protection', name: '保护措施影响分析' }])" :key="s.key" class="rounded-lg border">
<div class="flex items-center gap-2 border-b bg-slate-50/60 px-4 py-2"> <div class="flex items-center gap-2 border-b bg-slate-50/60 px-4 py-2">
<span class="text-sm font-semibold text-slate-700">{{ s.name }}</span> <span class="text-sm font-semibold text-slate-700">{{ s.name }}</span>
</div> </div>
<RichTextInput :disabled="!preRiskEdit" :modelValue="form[s.key]" :minRows="2" :bordered="false" @update:modelValue="(v) => onCellChange(s.key,v)" /> <RichTextInput :disabled="!preRiskEdit" :modelValue="form[s.key]" :minRows="2" :bordered="false" @update:modelValue="(v) => onCellChange(s.key,v)" />
</div> </div>
<div class="rounded-lg bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-700"> <div class="rounded-lg bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-700">
AI 风险预分析仅供参考,用于申请阶段的快速研判;正式风险识别请前往「风险分析记录表」标签页,使用 HAZOP / JSA / 检查表法开展并留存记录。 AI 风险预分析仅供参考,用于申请阶段的快速研判;正式风险识别请前往「风险分析记录表」标签页,使用 HAZOP / JSA / 检查表法开展并留存记录。
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
@@ -1,492 +1,492 @@
<!-- 风险分析记录表 --> <!-- 风险分析记录表 -->
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } 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 RiskPre from "./riskPre.vue"; import RiskPre from "./riskPre.vue";
import Hazop from "./hazop.vue"; import Hazop from "./hazop.vue";
import Jsa from "./jsa.vue"; import Jsa from "./jsa.vue";
import Fmea from "./fmea.vue"; import Fmea from "./fmea.vue";
import RiskCheck from "./riskCheck.vue"; import RiskCheck from "./riskCheck.vue";
import Footer from './footer.vue' import Footer from './footer.vue'
import { matrixConfigApi } from "@/service/api/system"; import { matrixConfigApi } from "@/service/api/system";
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const props = defineProps(['type','isAiOpen','title','currentId','formInfo', 'currentForm', 'confirmed','members','steps']); const props = defineProps(['type','isAiOpen','title','currentId','formInfo', 'currentForm', 'confirmed','members','steps']);
const emit = defineEmits(['save','submit','confirmTab','update:steps']); const emit = defineEmits(['save','submit','confirmTab','update:steps']);
const hazopRiskMatrixConfig = ref<any>(null); const hazopRiskMatrixConfig = ref<any>(null);
const fmeaRiskMatrixConfig = ref<any>(null); const fmeaRiskMatrixConfig = ref<any>(null);
const jsaRiskMatrixConfig = ref<any>(null); const jsaRiskMatrixConfig = ref<any>(null);
const pluginDone = computed(() => const pluginDone = computed(() =>
riskRecords.value.reduce((acc:any, item:any) => { riskRecords.value.reduce((acc:any, item:any) => {
const s = item.source; const s = item.source;
if (s) acc[s] = (acc[s] || 0) + 1; if (s) acc[s] = (acc[s] || 0) + 1;
return acc; return acc;
}, {} as Record<string, number>) }, {} as Record<string, number>)
); );
const tools = ref<string[]>(["RISK","HAZOP","FMEA", "RISK_CHECK"]); const tools = ref<string[]>(["RISK","HAZOP","FMEA", "RISK_CHECK"]);
const riskRecords = ref<any>([]); const riskRecords = ref<any>([]);
const pluginDrawer = ref<boolean>(false); const pluginDrawer = ref<boolean>(false);
const currentPlugin = ref<string>(''); const currentPlugin = ref<string>('');
watch(() => props.currentForm, (newVal:any) => { watch(() => props.currentForm, (newVal:any) => {
const omit = (obj:any, fields: string[]) => Object.fromEntries(Object.entries(obj).filter(([k]) => !fields.includes(k))); const omit = (obj:any, fields: string[]) => Object.fromEntries(Object.entries(obj).filter(([k]) => !fields.includes(k)));
const result = newVal?.records.map((item:any) => omit(item, [ const result = newVal?.records.map((item:any) => omit(item, [
'created_at', 'updated_at', 'change_id', 'source_row_id' 'created_at', 'updated_at', 'change_id', 'source_row_id'
])); ]));
riskRecords.value = result || []; riskRecords.value = result || [];
}, { immediate: true }) }, { immediate: true })
// 风险识别分析记录表 // 风险识别分析记录表
const TOOL_CARDS = [ const TOOL_CARDS = [
{ key: "RISK", name: "风险预分析" }, { key: "RISK", name: "风险预分析" },
{ key: "HAZOP", name: "HAZOP 分析" }, { key: "HAZOP", name: "HAZOP 分析" },
{ key: "FMEA", name: "FMEA 分析" }, { key: "FMEA", name: "FMEA 分析" },
{ key: "RISK_CHECK", name: "风险检查表" }, { key: "RISK_CHECK", name: "风险检查表" },
]; ];
// 根据l和s获取风险等级 // 根据l和s获取风险等级
const hazopRiskLevel = (level: string) => { const hazopRiskLevel = (level: string) => {
for (let i = 0; i < hazopRiskMatrixConfig.value?.risk_grades.length; i++) { for (let i = 0; i < hazopRiskMatrixConfig.value?.risk_grades.length; i++) {
const item = hazopRiskMatrixConfig.value?.risk_grades[i]; const item = hazopRiskMatrixConfig.value?.risk_grades[i];
if (level === item.name) { if (level === item.name) {
return item; // 返回整条数据 return item; // 返回整条数据
} }
} }
return null; return null;
} }
const jsaRiskLevel = (level: string) => { const jsaRiskLevel = (level: string) => {
for (let i = 0; i < jsaRiskMatrixConfig.value?.risk_grades.length; i++) { for (let i = 0; i < jsaRiskMatrixConfig.value?.risk_grades.length; i++) {
const item = jsaRiskMatrixConfig.value?.risk_grades[i]; const item = jsaRiskMatrixConfig.value?.risk_grades[i];
if (level === item.name) { if (level === item.name) {
return item; // 返回整条数据 return item; // 返回整条数据
} }
} }
return null; return null;
} }
const fmeaRiskLevel = (level: string) => { const fmeaRiskLevel = (level: string) => {
for (let i = 0; i < fmeaRiskMatrixConfig.value?.risk_grades.length; i++) { for (let i = 0; i < fmeaRiskMatrixConfig.value?.risk_grades.length; i++) {
const item = fmeaRiskMatrixConfig.value?.risk_grades[i]; const item = fmeaRiskMatrixConfig.value?.risk_grades[i];
if (level === item.name) { if (level === item.name) {
return item; // 返回整条数据 return item; // 返回整条数据
} }
} }
return null; return null;
} }
// 删除记录 // 删除记录
const delRec = (i: number) => { const delRec = (i: number) => {
riskRecords.value.splice(i, 1); riskRecords.value.splice(i, 1);
}; };
// 单个转换为 PSSR 行动项 // 单个转换为 PSSR 行动项
const toPssr = (i: number) => { const toPssr = (i: number) => {
const rec = riskRecords.value[i]; const rec = riskRecords.value[i];
if (!rec || rec.to_pssr) return; if (!rec || rec.to_pssr) return;
riskRecords.value[i] = { ...rec, to_pssr: 1 }; riskRecords.value[i] = { ...rec, to_pssr: 1 };
window.$message?.success("建议措施已转为 PSSR 行动项(见「PSSR 检查内容」· 一、风险分析行动项落实)"); window.$message?.success("建议措施已转为 PSSR 行动项(见「PSSR 检查内容」· 一、风险分析行动项落实)");
}; };
// 全部转为 PSSR 行动项 // 全部转为 PSSR 行动项
const toPssrAll = () => { const toPssrAll = () => {
const result = riskRecords.value.filter((item:any) => item.to_pssr === 0); const result = riskRecords.value.filter((item:any) => item.to_pssr === 0);
if (!result.length) { if (!result.length) {
return window.$message?.info("所有建议措施均已转为 PSSR 行动项"); return window.$message?.info("所有建议措施均已转为 PSSR 行动项");
} }
riskRecords.value = riskRecords.value.map((x:any) => ({ ...x, to_pssr: 1 })); riskRecords.value = riskRecords.value.map((x:any) => ({ ...x, to_pssr: 1 }));
window.$message?.success(`已将建议措施全部转为 PSSR 行动项(见「PSSR 检查内容」)`); window.$message?.success(`已将建议措施全部转为 PSSR 行动项(见「PSSR 检查内容」)`);
}; };
// AI 自动整理 // AI 自动整理
const aiOrganize = async () => { const aiOrganize = async () => {
}; };
/** /**
* 根据 id 字段对数组去重(保留首次出现) * 根据 id 字段对数组去重(保留首次出现)
* @param {Array} arr - 包含 id 字段的对象数组 * @param {Array} arr - 包含 id 字段的对象数组
* @returns {Array} 去重后的新数组 * @returns {Array} 去重后的新数组
*/ */
function uniqueById(arr: any[]) { function uniqueById(arr: any[]) {
const seen = new Set(); const seen = new Set();
const result = []; const result = [];
for (const item of arr) { for (const item of arr) {
const key = `${item.id}_${item.source}`; const key = `${item.id}_${item.source}`;
if (!seen.has(key)) { if (!seen.has(key)) {
seen.add(key); seen.add(key);
result.push(item); result.push(item);
} }
} }
return result; return result;
} }
// 整理入表 // 整理入表
const exportAll = (type: string, items: any[]) => { const exportAll = (type: string, items: any[]) => {
riskRecords.value = uniqueById([...riskRecords.value, ...items]); riskRecords.value = uniqueById([...riskRecords.value, ...items]);
if (type === "all") { if (type === "all") {
pluginDrawer.value = false; pluginDrawer.value = false;
currentPlugin.value = ''; currentPlugin.value = '';
window.$message?.success(`AI 已自动整理形成风险分析记录表(新增 ${items.length} 项),支持手动修改`); window.$message?.success(`AI 已自动整理形成风险分析记录表(新增 ${items.length} 项),支持手动修改`);
} else { } else {
window.$message?.success(`已选入 ${items.length} 条风险记录,可继续挑选或返回查看记录表`); window.$message?.success(`已选入 ${items.length} 条风险记录,可继续挑选或返回查看记录表`);
} }
} }
// 使用插件弹框 // 使用插件弹框
const usePlugin = (key: string) => { const usePlugin = (key: string) => {
currentPlugin.value = key; currentPlugin.value = key;
pluginDrawer.value = true; pluginDrawer.value = true;
} }
// 关闭插件弹框 // 关闭插件弹框
const closePlugin = () => { const closePlugin = () => {
pluginDrawer.value = false; pluginDrawer.value = false;
} }
// 保存草稿 // 保存草稿
const saveDraft = () => { const saveDraft = () => {
emit('save'); emit('save');
} }
// 提交 // 提交
const submitConfirm = () => { const submitConfirm = () => {
emit('submit', props.type); emit('submit', props.type);
} }
// // 确认标签内容 // // 确认标签内容
const confirmTab = (tab:string, val:boolean) => { const confirmTab = (tab:string, val:boolean) => {
emit('confirmTab', tab, val); emit('confirmTab', tab, val);
} }
// 更新审批流程 // 更新审批流程
const updateSteps = (steps:any[]) => { const updateSteps = (steps:any[]) => {
emit('update:steps', steps); emit('update:steps', steps);
} }
// 获取JSA风险矩阵配置 // 获取JSA风险矩阵配置
const getRiskMatrixConfig = async () => { const getRiskMatrixConfig = async () => {
const {data,error} = await matrixConfigApi(); const {data,error} = await matrixConfigApi();
if(!error){ if(!error){
hazopRiskMatrixConfig.value = data?.hazop || null; hazopRiskMatrixConfig.value = data?.hazop || null;
jsaRiskMatrixConfig.value = data?.jsa || null; jsaRiskMatrixConfig.value = data?.jsa || null;
fmeaRiskMatrixConfig.value = data?.fmea || null; fmeaRiskMatrixConfig.value = data?.fmea || null;
} }
} }
defineExpose({riskRecords}) defineExpose({riskRecords})
onMounted(() => { onMounted(() => {
getRiskMatrixConfig(); getRiskMatrixConfig();
}) })
</script> </script>
<template> <template>
<div class="p-4"> <div class="p-4">
<div class="space-y-4 scroll"> <div class="space-y-4 scroll">
<div class="border p-3" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <div class="border p-3" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex flex-wrap items-center gap-2"> <div class="flex flex-wrap items-center gap-2">
<span class="flex items-center gap-1.5 text-sm font-semibold text-slate-700"> <span class="flex items-center gap-1.5 text-sm font-semibold text-slate-700">
<Icon icon="lucide:shield-alert" class="size-16px" /> <Icon icon="lucide:shield-alert" class="size-16px" />
风险识别工具(按变更等级匹配) 风险识别工具(按变更等级匹配)
</span> </span>
<NTag size="small" :type="formInfo?.change_level === 2 ? 'error' : 'default'"> <NTag size="small" :type="formInfo?.change_level === 2 ? 'error' : 'default'">
{{ formInfo?.change_level === 2 ? '重要变更' : '一般变更' }} {{ formInfo?.change_level === 2 ? '重要变更' : '一般变更' }}
</NTag> </NTag>
<span class="text-xs text-slate-400"> <span class="text-xs text-slate-400">
{{ formInfo?.change_level === 2 ? '规则:HAZOP 必做' : '规则:涉及工艺安全边界的应升级 HAZOP' }} {{ formInfo?.change_level === 2 ? '规则:HAZOP 必做' : '规则:涉及工艺安全边界的应升级 HAZOP' }}
</span> </span>
</div> </div>
<div class="grid gap-2 grid-cols-4 mt-3"> <div class="grid gap-2 grid-cols-4 mt-3">
<div v-for="t in TOOL_CARDS" :key="t.key" <div v-for="t in TOOL_CARDS" :key="t.key"
class="flex items-center gap-2 rounded-lg border px-3 py-2 transition" class="flex items-center gap-2 rounded-lg border px-3 py-2 transition"
:class="pluginDone[t.key] !== undefined ? 'border-[var(--theme-color)] bg-[var(--theme-color)]' : tools.includes(t.key) ? 'border-[var(--theme-color)] bg-white' : 'border-slate-200 bg-white'" :class="pluginDone[t.key] !== undefined ? 'border-[var(--theme-color)] bg-[var(--theme-color)]' : tools.includes(t.key) ? 'border-[var(--theme-color)] bg-white' : 'border-slate-200 bg-white'"
:style="{'--theme-color': themeStore.themeColor}" :style="{'--theme-color': themeStore.themeColor}"
> >
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<div <div
class="flex items-center gap-1.5 text-xs font-semibold" class="flex items-center gap-1.5 text-xs font-semibold"
:class="pluginDone[t.key] !== undefined ? 'text-white' : tools.includes(t.key) ? 'text-[var(--theme-color)]' : 'text-slate-500'" :class="pluginDone[t.key] !== undefined ? 'text-white' : tools.includes(t.key) ? 'text-[var(--theme-color)]' : 'text-slate-500'"
:style="{'--theme-color': themeStore.themeColor}" :style="{'--theme-color': themeStore.themeColor}"
> >
<Icon icon="fluent:wand-24-regular" class="size-16px" /> <Icon icon="fluent:wand-24-regular" class="size-16px" />
{{ t.name }} {{ t.name }}
</div> </div>
<div class="mt-0.5 text-[10px]" :class="pluginDone[t.key] !== undefined ? 'text-white' : 'text-slate-400'"> <div class="mt-0.5 text-[10px]" :class="pluginDone[t.key] !== undefined ? 'text-white' : 'text-slate-400'">
{{ pluginDone[t.key] !== undefined ? `已使用并分析了 ${pluginDone[t.key]} 条内容` : '未使用此工具分析' }} {{ pluginDone[t.key] !== undefined ? `已使用并分析了 ${pluginDone[t.key]} 条内容` : '未使用此工具分析' }}
</div> </div>
</div> </div>
<NButton size="small" class="text-xs !text-white" :tertiary="pluginDone[t.key] !== undefined" type="primary" @click="usePlugin(t.key)"> <NButton size="small" class="text-xs !text-white" :tertiary="pluginDone[t.key] !== undefined" type="primary" @click="usePlugin(t.key)">
使用 使用
</NButton> </NButton>
</div> </div>
</div> </div>
</div> </div>
<div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <div class="border" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex flex-wrap items-center gap-2 bg-slate-100 px-3 py-2"> <div class="flex flex-wrap items-center gap-2 bg-slate-100 px-3 py-2">
<span class="flex items-center gap-1.5 text-sm font-medium text-slate-700"> <span class="flex items-center gap-1.5 text-sm font-medium text-slate-700">
<Icon icon="proicons:alert-triangle" class="size-16px text-amber-500" /> <Icon icon="proicons:alert-triangle" class="size-16px text-amber-500" />
风险分析记录表 风险分析记录表
</span> </span>
<span class="text-[11px] text-slate-400">共 {{ riskRecords.length }} 项</span> <span class="text-[11px] text-slate-400">共 {{ riskRecords.length }} 项</span>
<span class="ml-auto hidden text-[11px] text-slate-400 lg:block">插件结果「入表」或 AI 自动整理形成;单元格点击修改,风险等级点击切换</span> <span class="ml-auto hidden text-[11px] text-slate-400 lg:block">插件结果「入表」或 AI 自动整理形成;单元格点击修改,风险等级点击切换</span>
<NButton ghost size="small" color="#7c3aed" class="text-xs" @click="toPssrAll"> <NButton ghost size="small" color="#7c3aed" class="text-xs" @click="toPssrAll">
<Icon icon="tabler:clipboard-check" class="size-14px" /> <Icon icon="tabler:clipboard-check" class="size-14px" />
全部转 PSSR 行动项 全部转 PSSR 行动项
</NButton> </NButton>
<NButton v-if="isAiOpen" ghost size="small" type="primary" class="text-xs" @click="aiOrganize"> <NButton v-if="isAiOpen" ghost size="small" type="primary" class="text-xs" @click="aiOrganize">
<Icon icon="lucide:sparkles" class="size-12px" /> <Icon icon="lucide:sparkles" class="size-12px" />
AI 自动整理 AI 自动整理
</NButton> </NButton>
</div> </div>
<div v-if="riskRecords.length === 0" class="px-3 py-6 text-center text-xs text-slate-400"> <div v-if="riskRecords.length === 0" class="px-3 py-6 text-center text-xs text-slate-400">
尚无风险记录:调用上方插件完成分析后逐条「入表」,或点击「AI 自动整理」形成记录表 尚无风险记录:调用上方插件完成分析后逐条「入表」,或点击「AI 自动整理」形成记录表
</div> </div>
<div v-else class="overflow-x-auto p-3"> <div v-else class="overflow-x-auto p-3">
<table class="w-full border-collapse text-xs"> <table class="w-full border-collapse text-xs">
<thead> <thead>
<tr> <tr>
<th class="w-40 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">风险项</th> <th class="w-40 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">风险项</th>
<th class="w-80 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">场景描述</th> <th class="w-80 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">场景描述</th>
<th class="w-16 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">固有风险</th> <th class="w-16 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">固有风险</th>
<th class="w-60 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">现有措施</th> <th class="w-60 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">现有措施</th>
<th class="w-60 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">建议措施</th> <th class="w-60 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">建议措施</th>
<th class="w-16 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">剩余风险</th> <th class="w-16 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">剩余风险</th>
<th class="w-16 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">来源</th> <th class="w-16 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">来源</th>
<th class="w-15 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">操作</th> <th class="w-15 border bg-slate-50 px-2 py-1.5 text-[11px] font-medium text-slate-500">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(rec, i) in riskRecords" :key="i"> <tr v-for="(rec, i) in riskRecords" :key="i">
<td class="border px-1.5 py-1 font-medium text-slate-700"> <td class="border px-1.5 py-1 font-medium text-slate-700">
<NInput type="textarea" size="small" v-model:value="rec.item" :autosize="{minRows:1}" class="text-xs" /> <NInput type="textarea" size="small" v-model:value="rec.item" :autosize="{minRows:1}" class="text-xs" />
</td> </td>
<td class="border px-1.5 py-1"> <td class="border px-1.5 py-1">
<NInput type="textarea" size="small" v-model:value="rec.scene" :autosize="{minRows:1}" class="text-xs" /> <NInput type="textarea" size="small" v-model:value="rec.scene" :autosize="{minRows:1}" class="text-xs" />
</td> </td>
<td class="border px-1.5 py-1 text-center align-top"> <td class="border px-1.5 py-1 text-center align-top">
<div v-if="rec.source==='RISK'"> <div v-if="rec.source==='RISK'">
<NTag <NTag
v-if="rec.inherent_level && rec.inherent_level === '低'" v-if="rec.inherent_level && rec.inherent_level === '低'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="success" type="success"
> >
{{rec.inherent_level}} {{rec.inherent_level}}
</NTag> </NTag>
<NTag <NTag
v-if="rec.inherent_level && rec.inherent_level === '中'" v-if="rec.inherent_level && rec.inherent_level === '中'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="warning" type="warning"
> >
{{rec.inherent_level}} {{rec.inherent_level}}
</NTag> </NTag>
<NTag <NTag
v-if="rec.inherent_level && rec.inherent_level === '高'" v-if="rec.inherent_level && rec.inherent_level === '高'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="error" type="error"
> >
{{rec.inherent_level}} {{rec.inherent_level}}
</NTag> </NTag>
</div> </div>
<div v-if="rec.source==='HAZOP'"> <div v-if="rec.source==='HAZOP'">
<NTag <NTag
v-if="rec.inherent_level" v-if="rec.inherent_level"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: hazopRiskLevel(rec.inherent_level)?.bg_color, color: hazopRiskLevel(rec.inherent_level)?.bg_color,
textColor: hazopRiskLevel(rec.inherent_level)?.font_color, textColor: hazopRiskLevel(rec.inherent_level)?.font_color,
borderColor: hazopRiskLevel(rec.inherent_level)?.bg_color, borderColor: hazopRiskLevel(rec.inherent_level)?.bg_color,
}" }"
> >
{{rec.inherent_level}} {{rec.inherent_level}}
</NTag> </NTag>
</div> </div>
<div v-if="rec.source==='FMEA'"> <div v-if="rec.source==='FMEA'">
<NTag <NTag
v-if="rec.inherent_level" v-if="rec.inherent_level"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: fmeaRiskLevel(rec.inherent_level)?.bg_color, color: fmeaRiskLevel(rec.inherent_level)?.bg_color,
textColor: fmeaRiskLevel(rec.inherent_level)?.font_color, textColor: fmeaRiskLevel(rec.inherent_level)?.font_color,
borderColor: fmeaRiskLevel(rec.inherent_level)?.bg_color, borderColor: fmeaRiskLevel(rec.inherent_level)?.bg_color,
}" }"
> >
{{rec.inherent_level}} {{rec.inherent_level}}
</NTag> </NTag>
<span v-else>-</span> <span v-else>-</span>
</div> </div>
<div v-if="rec.source==='JSA'"> <div v-if="rec.source==='JSA'">
<NTag <NTag
v-if="rec.inherent_level" v-if="rec.inherent_level"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: jsaRiskLevel(rec.inherent_level)?.bg_color, color: jsaRiskLevel(rec.inherent_level)?.bg_color,
textColor: jsaRiskLevel(rec.inherent_level)?.font_color, textColor: jsaRiskLevel(rec.inherent_level)?.font_color,
borderColor: jsaRiskLevel(rec.inherent_level)?.bg_color, borderColor: jsaRiskLevel(rec.inherent_level)?.bg_color,
}" }"
> >
{{rec.inherent_level}} {{rec.inherent_level}}
</NTag> </NTag>
</div> </div>
<div v-if="rec.source==='RISK_CHECK'"> <div v-if="rec.source==='RISK_CHECK'">
<span> <span>
{{rec.inherent_level?rec.inherent_level:'-'}} {{rec.inherent_level?rec.inherent_level:'-'}}
</span> </span>
</div> </div>
</td> </td>
<td class="border px-1.5 py-1"> <td class="border px-1.5 py-1">
<NInput type="textarea" size="small" v-model:value="rec.safeguards" :autosize="{minRows:1}" class="text-xs" /> <NInput type="textarea" size="small" v-model:value="rec.safeguards" :autosize="{minRows:1}" class="text-xs" />
</td> </td>
<td class="border px-1.5 py-1"> <td class="border px-1.5 py-1">
<NInput type="textarea" size="small" v-model:value="rec.suggestions" :autosize="{minRows:1}" class="text-xs" /> <NInput type="textarea" size="small" v-model:value="rec.suggestions" :autosize="{minRows:1}" class="text-xs" />
</td> </td>
<td class="border px-1.5 py-1 text-center align-top"> <td class="border px-1.5 py-1 text-center align-top">
<div v-if="rec.source==='RISK'"> <div v-if="rec.source==='RISK'">
<NTag <NTag
v-if="rec.residual_level && rec.residual_level === '低'" v-if="rec.residual_level && rec.residual_level === '低'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="success" type="success"
> >
{{rec.residual_level}} {{rec.residual_level}}
</NTag> </NTag>
<NTag <NTag
v-if="rec.residual_level && rec.residual_level === '中'" v-if="rec.residual_level && rec.residual_level === '中'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="warning" type="warning"
> >
{{rec.residual_level}} {{rec.residual_level}}
</NTag> </NTag>
<NTag <NTag
v-if="rec.residual_level && rec.residual_level === '高'" v-if="rec.residual_level && rec.residual_level === '高'"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
type="error" type="error"
> >
{{rec.residual_level}} {{rec.residual_level}}
</NTag> </NTag>
</div> </div>
<div v-if="rec.source==='HAZOP'"> <div v-if="rec.source==='HAZOP'">
<NTag <NTag
v-if="rec.residual_level" v-if="rec.residual_level"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: hazopRiskLevel(rec.residual_level)?.bg_color, color: hazopRiskLevel(rec.residual_level)?.bg_color,
textColor: hazopRiskLevel(rec.residual_level)?.font_color, textColor: hazopRiskLevel(rec.residual_level)?.font_color,
borderColor: hazopRiskLevel(rec.residual_level)?.bg_color, borderColor: hazopRiskLevel(rec.residual_level)?.bg_color,
}" }"
> >
<span> <span>
{{rec.residual_level}} {{rec.residual_level}}
</span> </span>
</NTag> </NTag>
</div> </div>
<div v-if="rec.source==='FMEA'"> <div v-if="rec.source==='FMEA'">
<NTag <NTag
v-if="rec.residual_level" v-if="rec.residual_level"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: fmeaRiskLevel(rec.residual_level)?.bg_color, color: fmeaRiskLevel(rec.residual_level)?.bg_color,
textColor: fmeaRiskLevel(rec.residual_level)?.font_color, textColor: fmeaRiskLevel(rec.residual_level)?.font_color,
borderColor: fmeaRiskLevel(rec.residual_level)?.bg_color, borderColor: fmeaRiskLevel(rec.residual_level)?.bg_color,
}" }"
> >
{{rec.residual_level}} {{rec.residual_level}}
</NTag> </NTag>
<span v-else>-</span> <span v-else>-</span>
</div> </div>
<div v-if="rec.source==='JSA'"> <div v-if="rec.source==='JSA'">
<NTag <NTag
v-if="rec.residual_level" v-if="rec.residual_level"
class="text-[11px]" class="text-[11px]"
size="small" size="small"
:color="{ :color="{
color: jsaRiskLevel(rec.residual_level)?.bg_color, color: jsaRiskLevel(rec.residual_level)?.bg_color,
textColor: jsaRiskLevel(rec.residual_level)?.font_color, textColor: jsaRiskLevel(rec.residual_level)?.font_color,
borderColor: jsaRiskLevel(rec.residual_level)?.bg_color, borderColor: jsaRiskLevel(rec.residual_level)?.bg_color,
}" }"
> >
<span> <span>
{{rec.residual_level}} {{rec.residual_level}}
</span> </span>
</NTag> </NTag>
</div> </div>
<div v-if="rec.source==='RISK_CHECK'"> <div v-if="rec.source==='RISK_CHECK'">
<span> <span>
{{rec.residual_level?rec.residual_level:'-'}} {{rec.residual_level?rec.residual_level:'-'}}
</span> </span>
</div> </div>
</td> </td>
<td class="border px-1.5 py-1 text-center align-top"> <td class="border px-1.5 py-1 text-center align-top">
<NTag size="small" type="info" class="text-11px">{{ rec.source==='RISK'?'风险预分析':rec.source==='RISK_CHECK'?'风险检查': rec.source }}</NTag> <NTag size="small" type="info" class="text-11px">{{ rec.source==='RISK'?'风险预分析':rec.source==='RISK_CHECK'?'风险检查': rec.source }}</NTag>
</td> </td>
<td class="border px-1.5 py-1 text-center align-top"> <td class="border px-1.5 py-1 text-center align-top">
<NTag v-if="rec.to_pssr" size="small" :color="{ color: '#f5f3ff', textColor: '#7c3aed', borderColor: '#f5f3ff' }">已转 PSSR</NTag> <NTag v-if="rec.to_pssr" size="small" :color="{ color: '#f5f3ff', textColor: '#7c3aed', borderColor: '#f5f3ff' }">已转 PSSR</NTag>
<NButton text size="tiny" color="#7c3aed" v-else class="hover:underline" @click="toPssr(Number(i))">转 PSSR</NButton> <NButton text size="tiny" color="#7c3aed" v-else class="hover:underline" @click="toPssr(Number(i))">转 PSSR</NButton>
<div> <div>
<NPopconfirm <NPopconfirm
positive-text="确定" positive-text="确定"
:positiveButtonProps="{ size: 'tiny' }" :positiveButtonProps="{ size: 'tiny' }"
:negativeButtonProps="{ size: 'tiny' }" :negativeButtonProps="{ size: 'tiny' }"
@positive-click="delRec(Number(i))" @positive-click="delRec(Number(i))"
> >
<template #trigger> <template #trigger>
<NButton text type="error" size="tiny" class="mt-1 hover:underline">删除</NButton> <NButton text type="error" size="tiny" class="mt-1 hover:underline">删除</NButton>
</template> </template>
确定删除吗? 确定删除吗?
</NPopconfirm> </NPopconfirm>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<Footer <Footer
ref="footerRef" ref="footerRef"
:type="props.type" :type="props.type"
:currentId="props.currentId" :currentId="props.currentId"
:title="props.title" :title="props.title"
:isAiOpen="props.isAiOpen" :isAiOpen="props.isAiOpen"
:currentForm="formInfo" :currentForm="formInfo"
:confirmed="props.confirmed" :confirmed="props.confirmed"
:members="props.members" :members="props.members"
:steps="props.steps" :steps="props.steps"
@save="saveDraft" @save="saveDraft"
@submit="submitConfirm" @submit="submitConfirm"
@confirmTab="confirmTab" @confirmTab="confirmTab"
@update:steps="updateSteps" @update:steps="updateSteps"
/> />
<!-- 插件抽屉 --> <!-- 插件抽屉 -->
<NDrawer v-model:show="pluginDrawer" width="100%" placement="right" :auto-focus="false"> <NDrawer v-model:show="pluginDrawer" width="100%" placement="right" :auto-focus="false">
<NDrawerContent> <NDrawerContent>
<template v-if="currentPlugin === 'RISK'"> <template v-if="currentPlugin === 'RISK'">
<RiskPre :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" @toTable="exportAll" /> <RiskPre :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" @toTable="exportAll" />
</template> </template>
<template v-if="currentPlugin === 'HAZOP'"> <template v-if="currentPlugin === 'HAZOP'">
<Hazop :isAiOpen="props.isAiOpen" :currentId="props.currentId" :hazopRiskMatrixConfig="hazopRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" /> <Hazop :isAiOpen="props.isAiOpen" :currentId="props.currentId" :hazopRiskMatrixConfig="hazopRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" />
</template> </template>
<template v-if="currentPlugin === 'FMEA'"> <template v-if="currentPlugin === 'FMEA'">
<Fmea :isAiOpen="props.isAiOpen" :currentId="props.currentId" :fmeaRiskMatrixConfig="fmeaRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" /> <Fmea :isAiOpen="props.isAiOpen" :currentId="props.currentId" :fmeaRiskMatrixConfig="fmeaRiskMatrixConfig" @close="closePlugin" @toTable="exportAll" />
</template> </template>
<template v-if="currentPlugin === 'RISK_CHECK'"> <template v-if="currentPlugin === 'RISK_CHECK'">
<RiskCheck :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" @toTable="exportAll" /> <RiskCheck :isAiOpen="props.isAiOpen" :currentId="props.currentId" @close="closePlugin" @toTable="exportAll" />
</template> </template>
</NDrawerContent> </NDrawerContent>
</NDrawer> </NDrawer>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll { .scroll {
height: calc(100vh - 379px); height: calc(100vh - 379px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
+304 -304
View File
@@ -1,304 +1,304 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from "vue"; import { computed, onMounted, ref } 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 { peopleListApi } from '@/service/api/system'; import { peopleListApi } from '@/service/api/system';
import { riskPreDetailApi, riskPreSaveApi } from '@/service/api/plugin'; import { riskPreDetailApi, riskPreSaveApi } from '@/service/api/plugin';
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const props = defineProps(['isAiOpen','currentId']) const props = defineProps(['isAiOpen','currentId'])
const emit = defineEmits(['close','toTable']); const emit = defineEmits(['close','toTable']);
// 表格样式 // 表格样式
const TH = "border bg-slate-100 px-2 py-1.5 text-[11px] font-medium text-slate-500"; const TH = "border bg-slate-100 px-2 py-1.5 text-[11px] font-medium text-slate-500";
const TD = "border px-1.5 py-1 align-top"; const TD = "border px-1.5 py-1 align-top";
// 加载状态 // 加载状态
const loading = ref(false); const loading = ref(false);
// 风险分析记录 // 风险分析记录
const riskRecords = ref<{id:number,risk_item:string,scene_desc:string,risk_value:string,residual_risk_value:string,safeguards:string,suggestions:string}[]>([]); const riskRecords = ref<{id:number,risk_item:string,scene_desc:string,risk_value:string,residual_risk_value:string,safeguards:string,suggestions:string}[]>([]);
// 风险等级 // 风险等级
const risk_grades = ref<{label:string,value:string}[]>([ const risk_grades = ref<{label:string,value:string}[]>([
{label:'低',value:'低'}, {label:'低',value:'低'},
{label:'中',value:'中'}, {label:'中',value:'中'},
{label:'高',value:'高'}, {label:'高',value:'高'},
]); ]);
// 人员列表源数据 // 人员列表源数据
const workers = ref<{user_id:number,user_name:string,org_name?:string}[]>([]); const workers = ref<{user_id:number,user_name:string,org_name?:string}[]>([]);
// 选中的人员 // 选中的人员
const selectedWorkers = ref<{user_id:number,user_name:string,org_name?:string}[]>([]); const selectedWorkers = ref<{user_id:number,user_name:string,org_name?:string}[]>([]);
// 选择分析人员弹窗 // 选择分析人员弹窗
const openSelectWorker = ref(false); const openSelectWorker = ref(false);
// 搜索分析人员 // 搜索分析人员
const searchWorker = ref(""); const searchWorker = ref("");
// 分析人员列表 // 分析人员列表
const workerList = computed(() => workers.value.filter((x:{user_id:number,user_name:string,org_name?:string}) => !searchWorker.value || x.user_name.includes(searchWorker.value))); const workerList = computed(() => workers.value.filter((x:{user_id:number,user_name:string,org_name?:string}) => !searchWorker.value || x.user_name.includes(searchWorker.value)));
// 选择分析人员 // 选择分析人员
const selectWorker = (n: {user_id:number,user_name:string,org_name?:string}) => { const selectWorker = (n: {user_id:number,user_name:string,org_name?:string}) => {
selectedWorkers.value = selectedWorkers.value.includes(n) ? selectedWorkers.value.filter((x:any) => x.user_id !== n.user_id) : [...selectedWorkers.value, n]; selectedWorkers.value = selectedWorkers.value.includes(n) ? selectedWorkers.value.filter((x:any) => x.user_id !== n.user_id) : [...selectedWorkers.value, n];
}; };
// 匹配是否有人员 // 匹配是否有人员
const hasWorker = (id:number) => { const hasWorker = (id:number) => {
return selectedWorkers.value.some((item:{user_id:number,user_name:string,org_name?:string}) => item.user_id === id); return selectedWorkers.value.some((item:{user_id:number,user_name:string,org_name?:string}) => item.user_id === id);
}; };
// 运行 AI 执行风险分析 // 运行 AI 执行风险分析
const runAi = async () => { const runAi = async () => {
}; };
// 导出Word // 导出Word
const generateReport = async () => { const generateReport = async () => {
window.$message?.warning("还差接口"); window.$message?.warning("还差接口");
} }
// 保存 // 保存
const save = async () => { const save = async () => {
loading.value = true; loading.value = true;
// 处理选中的人员,移除 org_name 字段 // 处理选中的人员,移除 org_name 字段
const workers = (selectedWorkers.value ?? []).map((item: { org_name?:string; user_id: number; user_name: string }) => { const workers = (selectedWorkers.value ?? []).map((item: { org_name?:string; user_id: number; user_name: string }) => {
const { org_name, ...rest } = item; const { org_name, ...rest } = item;
return rest; return rest;
}); });
const {error} = await riskPreSaveApi(props.currentId, { const {error} = await riskPreSaveApi(props.currentId, {
rows: riskRecords.value, rows: riskRecords.value,
users: workers, users: workers,
}); });
if(!error){ if(!error){
window.$message?.success("保存成功"); window.$message?.success("保存成功");
getDetail(); getDetail();
} }
loading.value = false; loading.value = false;
}; };
// AI整理如表、入表 // AI整理如表、入表
const enterToTable = (type: string, row: any) => { const enterToTable = (type: string, row: any) => {
if(type==='single'){ if(type==='single'){
if(!row?.id){ if(!row?.id){
return window.$message?.warning("请先保存再入表"); return window.$message?.warning("请先保存再入表");
} }
const enrichedRow:any[] = []; const enrichedRow:any[] = [];
enrichedRow.push({ enrichedRow.push({
id: row?.id || 0, id: row?.id || 0,
scene: row?.scene_desc || '', scene: row?.scene_desc || '',
source: 'RISK', source: 'RISK',
item: row?.risk_item || '', item: row?.risk_item || '',
inherent_level: row?.risk_value || '', inherent_level: row?.risk_value || '',
safeguards: row?.safeguards || '', safeguards: row?.safeguards || '',
suggestions: row?.suggestions || '', suggestions: row?.suggestions || '',
residual_level: row?.residual_risk_value || '', residual_level: row?.residual_risk_value || '',
to_pssr: 0, to_pssr: 0,
source_row_id: row?.id || 0, source_row_id: row?.id || 0,
}); });
emit('toTable',type,enrichedRow); emit('toTable',type,enrichedRow);
} }
if(type==='all'){ if(type==='all'){
const result = riskRecords.value.filter((item:any) => !item.id); const result = riskRecords.value.filter((item:any) => !item.id);
if(result.length){ if(result.length){
return window.$message?.warning("请先保存再入表"); return window.$message?.warning("请先保存再入表");
} }
const enrichedRows:any[] = []; const enrichedRows:any[] = [];
riskRecords.value.forEach((row:any) => { riskRecords.value.forEach((row:any) => {
enrichedRows.push({ enrichedRows.push({
id: row?.id || 0, id: row?.id || 0,
scene: row?.scene_desc || '', scene: row?.scene_desc || '',
source: 'RISK', source: 'RISK',
item: row?.risk_item || '', item: row?.risk_item || '',
inherent_level: row?.risk_value || '', inherent_level: row?.risk_value || '',
safeguards: row?.safeguards || '', safeguards: row?.safeguards || '',
suggestions: row?.suggestions || '', suggestions: row?.suggestions || '',
residual_level: row?.residual_risk_value || '', residual_level: row?.residual_risk_value || '',
to_pssr: 0, to_pssr: 0,
source_row_id: row?.id || 0, source_row_id: row?.id || 0,
}); });
}) })
emit('toTable',type,enrichedRows); emit('toTable',type,enrichedRows);
} }
} }
// 新增风险分析记录 // 新增风险分析记录
const addRisk = () => { const addRisk = () => {
riskRecords.value.push({ riskRecords.value.push({
id: 0, id: 0,
risk_item: '', risk_item: '',
scene_desc: '', scene_desc: '',
risk_value: '', risk_value: '',
residual_risk_value: '', residual_risk_value: '',
safeguards: '', safeguards: '',
suggestions: '', suggestions: '',
}) })
} }
// 删除行 // 删除行
const delRow = (rowIndex: number) => { const delRow = (rowIndex: number) => {
riskRecords.value.splice(rowIndex, 1); riskRecords.value.splice(rowIndex, 1);
} }
// 获取人员列表 // 获取人员列表
const getWorkers = async () => { const getWorkers = async () => {
const {data,error} = await peopleListApi(); const {data,error} = await peopleListApi();
if(!error){ if(!error){
const transformed = data.map((item:any) => ({ const transformed = data.map((item:any) => ({
user_id: item.id, user_id: item.id,
user_name: item.realname, user_name: item.realname,
org_name: item.user_departments.map((d:any) => d.label).join(';') org_name: item.user_departments.map((d:any) => d.label).join(';')
})); }));
workers.value = transformed; workers.value = transformed;
} }
} }
// 获取详情 // 获取详情
const getDetail = async () => { const getDetail = async () => {
loading.value = true; loading.value = true;
const {data,error} = await riskPreDetailApi(props.currentId); const {data,error} = await riskPreDetailApi(props.currentId);
if(!error){ if(!error){
riskRecords.value = data?.rows || []; riskRecords.value = data?.rows || [];
selectedWorkers.value = data?.users || []; selectedWorkers.value = data?.users || [];
} }
loading.value = false; loading.value = false;
} }
onMounted(() => { onMounted(() => {
getWorkers(); getWorkers();
getDetail(); getDetail();
}) })
</script> </script>
<template> <template>
<NSpin :show="loading" size="small"> <NSpin :show="loading" size="small">
<div class="space-y-3"> <div class="space-y-3">
<div <div
class="flex flex-wrap items-center gap-2 rounded-lg border border-[#ACC6E5] bg-[#EAF0F9] px-3 py-2" class="flex flex-wrap items-center gap-2 rounded-lg border border-[#ACC6E5] bg-[#EAF0F9] px-3 py-2"
:style="{ :style="{
'--theme-color': themeStore.themeColor '--theme-color': themeStore.themeColor
}" }"
> >
<NButton size="small" ghost type="primary" class="text-xs" @click="emit('close')"> <NButton size="small" ghost type="primary" class="text-xs" @click="emit('close')">
<Icon icon="basil:arrow-left-outline" class="size-18px" /> <Icon icon="basil:arrow-left-outline" class="size-18px" />
返回工具列表 返回工具列表
</NButton> </NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="save()">保存</NButton> <NButton size="small" ghost type="primary" class="text-xs" @click="save()">保存</NButton>
<span class="text-sm font-bold text-[var(--theme-color)]">风险预分析插件</span> <span class="text-sm font-bold text-[var(--theme-color)]">风险预分析插件</span>
<NTag size="small" type="info">插件</NTag> <NTag size="small" type="info">插件</NTag>
<span class="text-[11px] text-slate-500">{{`共${riskRecords.length} 条风险项`}}</span> <span class="text-[11px] text-slate-500">{{`共${riskRecords.length} 条风险项`}}</span>
<div class="relative"> <div class="relative">
<NButton size="small" ghost type="primary" class="text-[11px]" @click="openSelectWorker = !openSelectWorker"> <NButton size="small" ghost type="primary" class="text-[11px]" @click="openSelectWorker = !openSelectWorker">
<Icon icon="lucide:users" class="size-12px" /> 分析组成员 · 已选 {{ selectedWorkers.length }} 人 <Icon icon="lucide:users" class="size-12px" /> 分析组成员 · 已选 {{ selectedWorkers.length }} 人
</NButton> </NButton>
<template v-if="openSelectWorker"> <template v-if="openSelectWorker">
<div class="fixed inset-0 z-10" @click="openSelectWorker = false"></div> <div class="fixed inset-0 z-10" @click="openSelectWorker = false"></div>
<div class="absolute right-0 top-8 z-20 w-72 rounded-lg border bg-white p-2 shadow-xl"> <div class="absolute right-0 top-8 z-20 w-72 rounded-lg border bg-white p-2 shadow-xl">
<div class="mb-1.5 flex items-center justify-between"> <div class="mb-1.5 flex items-center justify-between">
<span class="text-xs font-semibold text-slate-700">选择分析组成员(岗位人员库)</span> <span class="text-xs font-semibold text-slate-700">选择分析组成员(岗位人员库)</span>
<span class="text-[11px] text-slate-400">已选 {{ selectedWorkers.length }} 人</span> <span class="text-[11px] text-slate-400">已选 {{ selectedWorkers.length }} 人</span>
</div> </div>
<NInput v-model:value="searchWorker" size="small" placeholder="搜索人名…" class="mb-1.5 text-xs" /> <NInput v-model:value="searchWorker" size="small" placeholder="搜索人名…" class="mb-1.5 text-xs" />
<div class="max-h-48 space-y-0.5 overflow-y-auto"> <div class="max-h-48 space-y-0.5 overflow-y-auto">
<div v-for="x in workerList" :key="x.user_id" @click="selectWorker(x)" <div v-for="x in workerList" :key="x.user_id" @click="selectWorker(x)"
class="cursor-pointer flex w-full items-center min-h-34px gap-2 rounded-md px-2 py-1.5 text-left text-xs" class="cursor-pointer flex w-full items-center min-h-34px gap-2 rounded-md px-2 py-1.5 text-left text-xs"
:class="hasWorker(x.user_id) ? 'bg-[#DFE9F6]' : 'hover:bg-slate-50'"> :class="hasWorker(x.user_id) ? 'bg-[#DFE9F6]' : 'hover:bg-slate-50'">
<span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded border text-[10px]" <span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded border text-[10px]"
:class="hasWorker(x.user_id) ? 'border-[var(--theme-color)] bg-[var(--theme-color)] text-white' : 'border-slate-300'">{{ hasWorker(x.user_id) ? "✓" : "" }}</span> :class="hasWorker(x.user_id) ? 'border-[var(--theme-color)] bg-[var(--theme-color)] text-white' : 'border-slate-300'">{{ hasWorker(x.user_id) ? "✓" : "" }}</span>
<span class="font-medium text-slate-800">{{ x.user_name }}</span> <span class="font-medium text-slate-800">{{ x.user_name }}</span>
<span class="text-[11px] text-slate-400">{{ x.org_name }}</span> <span class="text-[11px] text-slate-400">{{ x.org_name }}</span>
<NTag v-if="selectedWorkers[0]?.user_id === x.user_id" size="small" type="primary" class="ml-auto">组长</NTag> <NTag v-if="selectedWorkers[0]?.user_id === x.user_id" size="small" type="primary" class="ml-auto">组长</NTag>
</div> </div>
</div> </div>
<div class="mt-1.5 border-t pt-1.5 text-[11px] leading-4 text-slate-400"> <div class="mt-1.5 border-t pt-1.5 text-[11px] leading-4 text-slate-400">
首位选择者默认为组长;成员为选择式(非手写),参与记录自动归属到人,用于「参与风险分析次数」统计采集。 首位选择者默认为组长;成员为选择式(非手写),参与记录自动归属到人,用于「参与风险分析次数」统计采集。
</div> </div>
</div> </div>
</template> </template>
</div> </div>
<div class="ml-auto flex items-center gap-1.5"> <div class="ml-auto flex items-center gap-1.5">
<NButton size="small" ghost type="primary" class="text-xs" :disabled="riskRecords.length === 0" @click="enterToTable('all',null)"> <NButton size="small" ghost type="primary" class="text-xs" :disabled="riskRecords.length === 0" @click="enterToTable('all',null)">
<Icon icon="carbon:document-import" class="size-14px mr-1" /> 全部整理入表 <Icon icon="carbon:document-import" class="size-14px mr-1" /> 全部整理入表
</NButton> </NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="generateReport"> <NButton size="small" ghost type="primary" class="text-xs" @click="generateReport">
<Icon icon="material-symbols:download" class="size-14px" /> 导出 Word <Icon icon="material-symbols:download" class="size-14px" /> 导出 Word
</NButton> </NButton>
<NButton v-if="isAiOpen" size="small" type="primary" class="text-xs" :disabled="loading" @click="runAi"> <NButton v-if="isAiOpen" size="small" type="primary" class="text-xs" :disabled="loading" @click="runAi">
<Icon v-if="loading" icon="ri:loader-4-fill" class="size-14px animate-spin" /> <Icon v-if="loading" icon="ri:loader-4-fill" class="size-14px animate-spin" />
<Icon v-else icon="lucide:sparkles" class="size-12px" /> <Icon v-else icon="lucide:sparkles" class="size-12px" />
AI 执行风险分析 AI 执行风险分析
</NButton> </NButton>
</div> </div>
</div> </div>
<div class="space-y-3" :style="{'--theme-color': themeStore.themeColor}"> <div class="space-y-3" :style="{'--theme-color': themeStore.themeColor}">
<!-- 作业活动分析记录 --> <!-- 作业活动分析记录 -->
<div class="bg-white"> <div class="bg-white">
<div class="flex items-center gap-2 px-3 py-2 text-xs font-semibold text-slate-600 border border-b-0 rounded-tl-lg rounded-tr-lg"> <div class="flex items-center gap-2 px-3 py-2 text-xs font-semibold text-slate-600 border border-b-0 rounded-tl-lg rounded-tr-lg">
风险分析记录表 风险分析记录表
<NButton size="small" ghost type="primary" class="text-xs ml-2" @click="addRisk"> <NButton size="small" ghost type="primary" class="text-xs ml-2" @click="addRisk">
<Icon icon="ic:round-plus" class="size-14px" /> 新增风险分析记录 <Icon icon="ic:round-plus" class="size-14px" /> 新增风险分析记录
</NButton> </NButton>
<span class="ml-auto text-[11px] font-normal text-slate-400">「入表」将本条选入风险分析记录表</span> <span class="ml-auto text-[11px] font-normal text-slate-400">「入表」将本条选入风险分析记录表</span>
</div> </div>
<p v-if="riskRecords.length===0" class="border py-5 text-center text-xs text-slate-400">暂无风险分析记录</p> <p v-if="riskRecords.length===0" class="border py-5 text-center text-xs text-slate-400">暂无风险分析记录</p>
<div v-else class="scroll"> <div v-else class="scroll">
<table class="w-full"> <table class="w-full">
<thead> <thead>
<tr> <tr>
<th :class="TH" class="w-80px">操作</th> <th :class="TH" class="w-80px">操作</th>
<th :class="TH" class="w-30">风险项</th> <th :class="TH" class="w-30">风险项</th>
<th :class="TH" class="w-60">场景描述</th> <th :class="TH" class="w-60">场景描述</th>
<th :class="TH" class="w-20">固有风险</th> <th :class="TH" class="w-20">固有风险</th>
<th :class="TH" class="w-50">现有措施</th> <th :class="TH" class="w-50">现有措施</th>
<th :class="TH" class="w-60">建议措施</th> <th :class="TH" class="w-60">建议措施</th>
<th :class="TH" class="w-20">剩余风险</th> <th :class="TH" class="w-20">剩余风险</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(row, rowIndex) in riskRecords" :key="rowIndex"> <tr v-for="(row, rowIndex) in riskRecords" :key="rowIndex">
<td :class="TD"> <td :class="TD">
<div class="flex items-center justify-center gap-2 px-1 mt-2"> <div class="flex items-center justify-center gap-2 px-1 mt-2">
<NButton text type="primary" size="tiny" @click="enterToTable('single',row)"> <NButton text type="primary" size="tiny" @click="enterToTable('single',row)">
入表 入表
</NButton> </NButton>
<NPopconfirm <NPopconfirm
positive-text="确定" positive-text="确定"
:positiveButtonProps="{ size: 'tiny' }" :positiveButtonProps="{ size: 'tiny' }"
:negativeButtonProps="{ size: 'tiny' }" :negativeButtonProps="{ size: 'tiny' }"
@positive-click="delRow(Number(rowIndex))" @positive-click="delRow(Number(rowIndex))"
> >
<template #trigger> <template #trigger>
<NButton text type="error" size="tiny" title="删除行"> <NButton text type="error" size="tiny" title="删除行">
<Icon icon="ep:delete" class="size-14px" /> <Icon icon="ep:delete" class="size-14px" />
</NButton> </NButton>
</template> </template>
确定删除此行吗? 确定删除此行吗?
</NPopconfirm> </NPopconfirm>
</div> </div>
</td> </td>
<td :class="TD"> <td :class="TD">
<NInput type="textarea" size="small" v-model:value="row.risk_item" :autosize="{minRows:1}" /> <NInput type="textarea" size="small" v-model:value="row.risk_item" :autosize="{minRows:1}" />
</td> </td>
<td :class="TD"> <td :class="TD">
<NInput type="textarea" size="small" v-model:value="row.scene_desc" :autosize="{minRows:1}" /> <NInput type="textarea" size="small" v-model:value="row.scene_desc" :autosize="{minRows:1}" />
</td> </td>
<td :class="TD" class="text-center"> <td :class="TD" class="text-center">
<NSelect v-model:value="row.risk_value" :options="risk_grades" size="small" class="w-full" /> <NSelect v-model:value="row.risk_value" :options="risk_grades" size="small" class="w-full" />
</td> </td>
<td :class="TD"> <td :class="TD">
<NInput type="textarea" size="small" v-model:value="row.safeguards" :autosize="{minRows:1}" /> <NInput type="textarea" size="small" v-model:value="row.safeguards" :autosize="{minRows:1}" />
</td> </td>
<td :class="TD"> <td :class="TD">
<NInput type="textarea" size="small" v-model:value="row.suggestions" :autosize="{minRows:1}" /> <NInput type="textarea" size="small" v-model:value="row.suggestions" :autosize="{minRows:1}" />
</td> </td>
<td :class="TD" class="text-center"> <td :class="TD" class="text-center">
<NSelect v-model:value="row.residual_risk_value" :options="risk_grades" size="small" class="w-full" /> <NSelect v-model:value="row.residual_risk_value" :options="risk_grades" size="small" class="w-full" />
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</NSpin> </NSpin>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll{ .scroll{
height: calc(100vh - 135px); height: calc(100vh - 135px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
+342 -342
View File
@@ -1,342 +1,342 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from '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 RingChart from './modules/ringChart.vue'; import RingChart from './modules/ringChart.vue';
import { systemConfigApi } from "@/service/api/system"; import { systemConfigApi } from "@/service/api/system";
import { deptStatisticsApi } from '@/service/api/statistics'; import { deptStatisticsApi } from '@/service/api/statistics';
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
// 变更临期天数 // 变更临期天数
const remindDays = ref<number>(0); const remindDays = ref<number>(0);
const homeData = ref<any>(null); const homeData = ref<any>(null);
// 小时转换天 // 小时转换天
const hourToDay = (hour: number) => { const hourToDay = (hour: number) => {
return Math.trunc((hour / 24) * 100) / 100; return Math.trunc((hour / 24) * 100) / 100;
} }
// 跳转页面 // 跳转页面
const jumpTo = (key: string) => { const jumpTo = (key: string) => {
routerPushByKey(key as any); routerPushByKey(key as any);
} }
// 获取数据 // 获取数据
const getData = async () => { const getData = async () => {
loading.value = true; loading.value = true;
const {data,error} = await deptStatisticsApi({ const {data,error} = await deptStatisticsApi({
from: null, from: null,
to: null, to: null,
}); });
if(!error){ if(!error){
homeData.value = data; homeData.value = data;
} }
loading.value = false; loading.value = false;
} }
// 获取系统配置 // 获取系统配置
const getConfig = async () => { const getConfig = async () => {
const {data,error} = await systemConfigApi(); const {data,error} = await systemConfigApi();
if(!error){ if(!error){
// 解析 临时变更临期提醒 // 解析 临时变更临期提醒
const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind'); const remindDaysGroup = data.find((group:{group_key:string}) => group.group_key === 'change_remind');
if (remindDaysGroup) { if (remindDaysGroup) {
remindDaysGroup?.items.forEach((item:any) => { remindDaysGroup?.items.forEach((item:any) => {
if(item.item_key === 'temp_due_remind_days'){ if(item.item_key === 'temp_due_remind_days'){
remindDays.value = Number(item.value); remindDays.value = Number(item.value);
} }
}) })
} }
} }
} }
onMounted(() => { onMounted(() => {
getConfig(); getConfig();
getData(); getData();
}); });
</script> </script>
<template> <template>
<NSpace vertical :size="16"> <NSpace vertical :size="16">
<!-- 卡片数据 --> <!-- 卡片数据 -->
<NGrid cols="s:1 m:4 l:4" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid cols="s:1 m:4 l:4" responsive="screen" :x-gap="16" :y-gap="16">
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8]" class="flex-1 bg-white px-16px py-12px text-[#94a3b8]"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
<p class="text-12px font-600">本车间变更总数</p> <p class="text-12px font-600">本车间变更总数</p>
<div class="flex items-center"> <div class="flex items-center">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.kpis?.apply_total || 0" :end-value="homeData?.kpis?.apply_total || 0"
class="text-24px font-600 text-slate-800" class="text-24px font-600 text-slate-800"
/> />
</div> </div>
<p class="text-12px">近一年 · 汇报口径</p> <p class="text-12px">近一年 · 汇报口径</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8]" class="flex-1 bg-white px-16px py-12px text-[#94a3b8]"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
<p class="text-12px font-600">在办变更</p> <p class="text-12px font-600">在办变更</p>
<div class="flex items-center"> <div class="flex items-center">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.kpis?.unclosed_total || 0" :end-value="homeData?.kpis?.unclosed_total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{color:themeStore.themeColor}" :style="{color:themeStore.themeColor}"
/> />
</div> </div>
<p class="text-12px">实时 · 三大阶段分布见下</p> <p class="text-12px">实时 · 三大阶段分布见下</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8]" class="flex-1 bg-white px-16px py-12px text-[#94a3b8]"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
<p class="text-12px font-600">超期未关闭</p> <p class="text-12px font-600">超期未关闭</p>
<div class="flex items-center"> <div class="flex items-center">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.kpis?.overdue_total || 0" :end-value="homeData?.kpis?.overdue_total || 0"
class="text-26px font-600" class="text-26px font-600"
:style="{color:themeStore.otherColor.error}" :style="{color:themeStore.otherColor.error}"
/> />
</div> </div>
<p class="text-12px">管理考核一票指标</p> <p class="text-12px">管理考核一票指标</p>
</div> </div>
</NGi> </NGi>
<NGi> <NGi>
<div <div
class="flex-1 bg-white px-16px py-12px text-[#94a3b8]" class="flex-1 bg-white px-16px py-12px text-[#94a3b8]"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
> >
<p class="text-12px font-600">我的审批按时率</p> <p class="text-12px font-600">我的审批按时率</p>
<div class="flex items-center"> <div class="flex items-center">
<CountTo <CountTo
:start-value="0" :start-value="0"
:end-value="homeData?.kpis?.my_timely_rate || 0" :end-value="homeData?.kpis?.my_timely_rate || 0"
:decimals="1" :decimals="1"
class="text-26px font-600" class="text-26px font-600"
:style="{color:themeStore.otherColor.success}" :style="{color:themeStore.otherColor.success}"
/><p class="text-26px font-600" :style="{color:themeStore.otherColor.success}">%</p> /><p class="text-26px font-600" :style="{color:themeStore.otherColor.success}">%</p>
</div> </div>
<p class="text-12px">考核:目标 ≥90% · 达标</p> <p class="text-12px">考核:目标 ≥90% · 达标</p>
</div> </div>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 我的审批效率 --> <!-- 我的审批效率 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }"> <NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }">
<p class=" text-base font-semibold border-b border-slate-100 p-3">我的审批效率(考核口径)</p> <p class=" text-base font-semibold border-b border-slate-100 p-3">我的审批效率(考核口径)</p>
<div class="py-3 px-4"> <div class="py-3 px-4">
<div class="space-y-3"> <div class="space-y-3">
<div class="flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2.5"> <div class="flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2.5">
<span class="min-w-0 flex-1 text-sm text-slate-700">平均审批时长</span> <span class="min-w-0 flex-1 text-sm text-slate-700">平均审批时长</span>
<span class="text-base font-bold" :style="{color:themeStore.themeColor}">{{homeData?.my_eff?.avg_audit_days || 0}} 天</span> <span class="text-base font-bold" :style="{color:themeStore.themeColor}">{{homeData?.my_eff?.avg_audit_days || 0}} 天</span>
<span class="text-[11px]" :style="{color:themeStore.otherColor.success}">目标 ≤{{hourToDay(homeData?.my_eff?.sign_timely_hours || 0)}} 天</span> <span class="text-[11px]" :style="{color:themeStore.otherColor.success}">目标 ≤{{hourToDay(homeData?.my_eff?.sign_timely_hours || 0)}} 天</span>
</div> </div>
<div class="flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2.5"> <div class="flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2.5">
<span class="min-w-0 flex-1 text-sm text-slate-700">按时审批率</span> <span class="min-w-0 flex-1 text-sm text-slate-700">按时审批率</span>
<span class="text-base font-bold" :style="{color:themeStore.themeColor}">{{homeData?.my_eff?.timely_rate || 0}}%</span> <span class="text-base font-bold" :style="{color:themeStore.themeColor}">{{homeData?.my_eff?.timely_rate || 0}}%</span>
<span class="text-[11px]" :style="{color:themeStore.otherColor.success}">目标 ≥90%</span> <span class="text-[11px]" :style="{color:themeStore.otherColor.success}">目标 ≥90%</span>
</div> </div>
<div class="flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2.5"> <div class="flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2.5">
<span class="min-w-0 flex-1 text-sm text-slate-700">驳回补充说明率</span> <span class="min-w-0 flex-1 text-sm text-slate-700">驳回补充说明率</span>
<span class="text-base font-bold" :style="{color:themeStore.themeColor}">{{homeData?.my_eff?.reject_comment_rate || 0}}%</span> <span class="text-base font-bold" :style="{color:themeStore.themeColor}">{{homeData?.my_eff?.reject_comment_rate || 0}}%</span>
<span class="text-[11px]" :style="{color:themeStore.otherColor.success}">驳回必附整改指引</span> <span class="text-[11px]" :style="{color:themeStore.otherColor.success}">驳回必附整改指引</span>
</div> </div>
<p class="text-[11px] text-slate-400">考核数据来源:本人节点签收 → 签出时长,系统自动统计,不可修改</p></div> <p class="text-[11px] text-slate-400">考核数据来源:本人节点签收 → 签出时长,系统自动统计,不可修改</p></div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
<!-- 本车间变更状态构成 --> <!-- 本车间变更状态构成 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }"> <NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }">
<p class=" text-base font-semibold border-b border-slate-100 p-3">本车间变更状态构成(实时)</p> <p class=" text-base font-semibold border-b border-slate-100 p-3">本车间变更状态构成(实时)</p>
<div class="py-3 px-4"> <div class="py-3 px-4">
<div class="space-y-2.5"> <div class="space-y-2.5">
<div v-for="item in homeData?.status_dist" :key="item.status" class="flex items-center gap-2"> <div v-for="item in homeData?.status_dist" :key="item.status" class="flex items-center gap-2">
<!-- 审批中 --> <!-- 审批中 -->
<span v-if="item.status==='APPROVING'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.warning}"></span> <span v-if="item.status==='APPROVING'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.warning}"></span>
<!-- 已批准待投用 --> <!-- 已批准待投用 -->
<span v-if="item.status==='APPROVED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.themeColor}"></span> <span v-if="item.status==='APPROVED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.themeColor}"></span>
<!-- 待验收 --> <!-- 待验收 -->
<span v-if="item.status==='IMPLEMENTED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.success}"></span> <span v-if="item.status==='IMPLEMENTED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.success}"></span>
<!-- 待关闭 --> <!-- 待关闭 -->
<span v-if="item.status==='ACCEPTED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.error}"></span> <span v-if="item.status==='ACCEPTED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.error}"></span>
<!-- 已驳回 --> <!-- 已驳回 -->
<span v-if="item.status==='REJECTED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.error}"></span> <span v-if="item.status==='REJECTED'" class="h-2.5 w-2.5 shrink-0 rounded-sm" :style="{background:themeStore.otherColor.error}"></span>
<span class="min-w-0 flex-1 text-sm text-slate-600">{{item.label}}</span> <span class="min-w-0 flex-1 text-sm text-slate-600">{{item.label}}</span>
<span class="text-sm font-bold text-slate-800">{{item.count}}</span> <span class="text-sm font-bold text-slate-800">{{item.count}}</span>
</div> </div>
<p class="pt-1 text-[11px] text-slate-400">管理价值:一眼定位积压阶段,决定催办方向</p></div> <p class="pt-1 text-[11px] text-slate-400">管理价值:一眼定位积压阶段,决定催办方向</p></div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
<!-- 临时变更监控 --> <!-- 临时变更监控 -->
<NGi span="24 s:24 m:24 l:8"> <NGi span="24 s:24 m:24 l:8">
<NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }"> <NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }">
<p class=" text-base font-semibold border-b border-slate-100 p-3">临时变更监控(管理抓手)</p> <p class=" text-base font-semibold border-b border-slate-100 p-3">临时变更监控(管理抓手)</p>
<div class="py-3 px-4"> <div class="py-3 px-4">
<div class="space-y-3"> <div class="space-y-3">
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.success }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.success }"></span>
<span class="font-medium text-slate-700">正常(到期 > {{remindDays}} 天)</span> <span class="font-medium text-slate-700">正常(到期 > {{remindDays}} 天)</span>
<span class="ml-auto font-semibold text-slate-600">{{homeData?.temp_watch?.normal || 0}}</span> <span class="ml-auto font-semibold text-slate-600">{{homeData?.temp_watch?.normal || 0}}</span>
</div> </div>
</div> </div>
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.warning }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.warning }"></span>
<span class="font-medium text-slate-700">临期(到期 ≤ {{remindDays}} 天)</span> <span class="font-medium text-slate-700">临期(到期 ≤ {{remindDays}} 天)</span>
<span class="ml-auto font-semibold text-slate-600">{{homeData?.temp_watch?.near || 0}}</span> <span class="ml-auto font-semibold text-slate-600">{{homeData?.temp_watch?.near || 0}}</span>
</div> </div>
</div> </div>
<div class="rounded-lg border px-3 py-2"> <div class="rounded-lg border px-3 py-2">
<div class="flex items-center gap-2 text-xs"> <div class="flex items-center gap-2 text-xs">
<span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.error }"></span> <span class="h-2 w-2 rounded-full" :style="{ background: themeStore.otherColor.error }"></span>
<span class="font-medium text-slate-700">已超期</span> <span class="font-medium text-slate-700">已超期</span>
<span class="ml-auto font-semibold text-slate-600">{{homeData?.temp_watch?.overdue || 0}}</span> <span class="ml-auto font-semibold text-slate-600">{{homeData?.temp_watch?.overdue || 0}}</span>
</div> </div>
</div> </div>
<NButton size="small" ghost dashed block class="text-xs text-slate-400" @click="jumpTo('changeledger')">前往变更台账查看处置 →</NButton> <NButton size="small" ghost dashed block class="text-xs text-slate-400" @click="jumpTo('changeledger')">前往变更台账查看处置 →</NButton>
</div> </div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 变更类型分布 --> <!-- 变更类型分布 -->
<NGi span="24 s:24 m:24 l:10"> <NGi span="24 s:24 m:24 l:10">
<NCard :bordered="true" size="small" :content-style="{padding: 0}" <NCard :bordered="true" size="small" :content-style="{padding: 0}"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
height: '100%', height: '100%',
}" }"
> >
<p class=" text-base font-semibold border-b border-slate-100 p-3">变更类型分布(近一年)</p> <p class=" text-base font-semibold border-b border-slate-100 p-3">变更类型分布(近一年)</p>
<RingChart v-if="homeData" :data="homeData?.type_dist || []" /> <RingChart v-if="homeData" :data="homeData?.type_dist || []" />
</NCard> </NCard>
</NGi> </NGi>
<!-- 风险增量与管控 --> <!-- 风险增量与管控 -->
<NGi span="24 s:24 m:24 l:14"> <NGi span="24 s:24 m:24 l:14">
<NCard <NCard
:bordered="true" :bordered="true"
size="small" size="small"
:content-style="{padding: 0}" :content-style="{padding: 0}"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
height: '100%', height: '100%',
}" }"
> >
<p class=" text-base font-semibold border-b border-slate-100 p-3">风险增量与管控(近一年 · 本车间变更新增风险与管控落实)</p> <p class=" text-base font-semibold border-b border-slate-100 p-3">风险增量与管控(近一年 · 本车间变更新增风险与管控落实)</p>
<div class="py-3 px-4 space-y-2.5"> <div class="py-3 px-4 space-y-2.5">
<div class="grid grid-cols-2 gap-2"> <div class="grid grid-cols-2 gap-2">
<div class="rounded-lg bg-red-50 px-3 py-2"> <div class="rounded-lg bg-red-50 px-3 py-2">
<div class="text-[11px] text-slate-500">新增固有高风险项</div> <div class="text-[11px] text-slate-500">新增固有高风险项</div>
<div class="text-xl font-bold" :style="{color:themeStore.otherColor.error}">{{homeData?.risk?.new_high || 0}}</div> <div class="text-xl font-bold" :style="{color:themeStore.otherColor.error}">{{homeData?.risk?.new_high || 0}}</div>
</div> </div>
<div class="rounded-lg bg-amber-50 px-3 py-2"> <div class="rounded-lg bg-amber-50 px-3 py-2">
<div class="text-[11px] text-slate-500">新增中风险项</div> <div class="text-[11px] text-slate-500">新增中风险项</div>
<div class="text-xl font-bold" :style="{color:themeStore.otherColor.warning}">{{homeData?.risk?.new_mid || 0}}</div> <div class="text-xl font-bold" :style="{color:themeStore.otherColor.warning}">{{homeData?.risk?.new_mid || 0}}</div>
</div> </div>
<div class="rounded-lg bg-slate-50 px-3 py-2"> <div class="rounded-lg bg-slate-50 px-3 py-2">
<div class="text-[11px] text-slate-500">剩余高风险项</div> <div class="text-[11px] text-slate-500">剩余高风险项</div>
<div class="text-xl font-bold" :style="{color:themeStore.otherColor.error}">{{homeData?.risk?.residual_high || 0}}</div> <div class="text-xl font-bold" :style="{color:themeStore.otherColor.error}">{{homeData?.risk?.residual_high || 0}}</div>
</div> </div>
<div class="rounded-lg bg-slate-50 px-3 py-2"> <div class="rounded-lg bg-slate-50 px-3 py-2">
<div class="text-[11px] text-slate-500">剩余中风险项</div> <div class="text-[11px] text-slate-500">剩余中风险项</div>
<div class="text-xl font-bold" :style="{color:themeStore.otherColor.warning}">{{homeData?.risk?.residual_mid || 0}}</div> <div class="text-xl font-bold" :style="{color:themeStore.otherColor.warning}">{{homeData?.risk?.residual_mid || 0}}</div>
</div> </div>
</div> </div>
<!-- <div class="flex items-center gap-2 text-slate-500"> <!-- <div class="flex items-center gap-2 text-slate-500">
<span class="text-xs">管控措施落实率</span> <span class="text-xs">管控措施落实率</span>
<div class="h-2 flex-1 rounded-full bg-slate-100"> <div class="h-2 flex-1 rounded-full bg-slate-100">
<div class="h-2 rounded-full" :style="{ background: themeStore.otherColor.success }" style="width: 96%"></div> <div class="h-2 rounded-full" :style="{ background: themeStore.otherColor.success }" style="width: 96%"></div>
</div> </div>
<span class="font-semibold" :style="{color:themeStore.otherColor.success}">96%</span> <span class="font-semibold" :style="{color:themeStore.otherColor.success}">96%</span>
</div> --> </div> -->
<p class="mt-1.5 text-[11px] text-slate-400">高风险场景明细见「高风险」页(按部门筛选一车间)</p> <p class="mt-1.5 text-[11px] text-slate-400">高风险场景明细见「高风险」页(按部门筛选一车间)</p>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
<!-- 变更投入和效果 --> <!-- 变更投入和效果 -->
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive> <NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<NGi span="24 s:24 m:24 l:24"> <NGi span="24 s:24 m:24 l:24">
<NCard :bordered="true" size="small" :content-style="{padding: 0}" <NCard :bordered="true" size="small" :content-style="{padding: 0}"
:style="{ :style="{
borderRadius: themeStore.themeRadius + 'px', borderRadius: themeStore.themeRadius + 'px',
height: '100%', height: '100%',
'--error-color': themeStore.otherColor.error, '--error-color': themeStore.otherColor.error,
'--success-color': themeStore.otherColor.success, '--success-color': themeStore.otherColor.success,
}" }"
> >
<div class="flex items-center p-3 border-b border-slate-100"> <div class="flex items-center p-3 border-b border-slate-100">
<p class=" text-base font-semibold">变更投入和效果(近一年 · 已验收变更)</p> <p class=" text-base font-semibold">变更投入和效果(近一年 · 已验收变更)</p>
<p class="text-11px text-slate-400 mt-3px">费用取验收时填报的「变更材料和实施费」;完整明细见操作台「变更投入和效果」</p> <p class="text-11px text-slate-400 mt-3px">费用取验收时填报的「变更材料和实施费」;完整明细见操作台「变更投入和效果」</p>
<p class="text-[11px] text-slate-400 ml-auto"> <p class="text-[11px] text-slate-400 ml-auto">
已验收 <b class="text-slate-700">{{homeData?.invest?.total || 0}}</b> 起 · 已验收 <b class="text-slate-700">{{homeData?.invest?.total || 0}}</b> 起 ·
投入合计 <b :style="{color:themeStore.themeColor}">{{homeData?.invest?.total_cost || 0}}</b> 万元 · 投入合计 <b :style="{color:themeStore.themeColor}">{{homeData?.invest?.total_cost || 0}}</b> 万元 ·
完全达到率 <b :style="{color:themeStore.otherColor.success}">{{homeData?.invest?.full_rate || 0}}%</b> 完全达到率 <b :style="{color:themeStore.otherColor.success}">{{homeData?.invest?.full_rate || 0}}%</b>
</p> </p>
</div> </div>
<div class="py-3 px-4"> <div class="py-3 px-4">
<NTable size="small"> <NTable size="small">
<thead> <thead>
<tr> <tr>
<th>变更名称 / 编号</th> <th>变更名称 / 编号</th>
<th>申请日期</th> <th>申请日期</th>
<th>投用日期</th> <th>投用日期</th>
<th>验收日期</th> <th>验收日期</th>
<th>费用(万元)</th> <th>费用(万元)</th>
<th>验收结论</th> <th>验收结论</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-if="homeData?.invest?.items?.length===0"> <tr v-if="homeData?.invest?.items?.length===0">
<td colspan="6"> <td colspan="6">
<div class="h-100% flex items-center justify-center py-3"> <div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty> <NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div> </div>
</td> </td>
</tr> </tr>
<tr v-for="row in homeData?.invest?.items || []" :key="row.change_id"> <tr v-for="row in homeData?.invest?.items || []" :key="row.change_id">
<td> <td>
<p>{{row.title}}</p> <p>{{row.title}}</p>
<span class="text-11px text-slate-400">{{row.change_no}}</span> <span class="text-11px text-slate-400">{{row.change_no}}</span>
</td> </td>
<td class="text-xs">{{row?.apply_time?.slice(0,10)}}</td> <td class="text-xs">{{row?.apply_time?.slice(0,10)}}</td>
<td class="text-xs">{{row?.use_time?.slice(0,10)}}</td> <td class="text-xs">{{row?.use_time?.slice(0,10)}}</td>
<td class="text-xs">{{row?.accept_time?.slice(0,10)}}</td> <td class="text-xs">{{row?.accept_time?.slice(0,10)}}</td>
<td class="text-xs"><span class="font-600">{{row?.cost || 0}}</span></td> <td class="text-xs"><span class="font-600">{{row?.cost || 0}}</span></td>
<td> <td>
<NTag v-if="row.result_status===3" size="small" type="success">{{row.result_label}}</NTag> <NTag v-if="row.result_status===3" size="small" type="success">{{row.result_label}}</NTag>
<NTag v-if="row.result_status===2" size="small" type="warning">{{row.result_label}}</NTag> <NTag v-if="row.result_status===2" size="small" type="warning">{{row.result_label}}</NTag>
<NTag v-if="row.result_status===1" size="small" type="error">{{row.result_label}}</NTag> <NTag v-if="row.result_status===1" size="small" type="error">{{row.result_label}}</NTag>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</NTable> </NTable>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
</NGrid> </NGrid>
</NSpace> </NSpace>
</template> </template>
<style scoped></style> <style scoped></style>