Compare commits
50 Commits
5de539f61c
...
2025-10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7c93d03aa | ||
|
|
a4b016ef0d | ||
|
|
d329b68592 | ||
|
|
e12a1baf99 | ||
|
|
8aae184a8b | ||
|
|
7f2275bad9 | ||
|
|
aab884e524 | ||
|
|
0215dbc875 | ||
|
|
b09a2bab10 | ||
|
|
4dbcdd20df | ||
|
|
6fde670f96 | ||
|
|
ba1748830a | ||
|
|
0054f989c0 | ||
|
|
97b5262926 | ||
|
|
6ea566aad5 | ||
|
|
33d7587944 | ||
|
|
7c42ffcbdd | ||
|
|
9268cd755b | ||
|
|
a69b7a17a4 | ||
|
|
7abcec7a2e | ||
|
|
425b54bc44 | ||
|
|
9376d702f3 | ||
|
|
04be2c8a16 | ||
|
|
1c90c46806 | ||
|
|
fd2c11cf90 | ||
|
|
9fef439e59 | ||
|
|
ce5dfd6963 | ||
|
|
972555451b | ||
|
|
53079c5a1c | ||
|
|
32808ce622 | ||
|
|
f0c0288174 | ||
|
|
baccbe6f33 | ||
|
|
cedf1b6c5e | ||
|
|
5f4b647bed | ||
|
|
a1f241bbfe | ||
|
|
211b367db7 | ||
|
|
e3649a4933 | ||
|
|
f772568400 | ||
|
|
1cc2ab79cd | ||
|
|
d5a2db5cd0 | ||
|
|
5ec688a659 | ||
|
|
91b2a939b9 | ||
|
|
ac11af35df | ||
|
|
be84092cfe | ||
|
|
b2db5622bc | ||
|
|
f1b76376c6 | ||
| af84524512 | |||
|
|
cddbbf0c69 | ||
|
|
d7bd804df4 | ||
|
|
8a83bc5867 |
@@ -4,7 +4,7 @@ const path = require('path');
|
||||
const { logger } = require('ee-core/log');
|
||||
const { getConfig } = require('ee-core/config');
|
||||
const { getMainWindow } = require('ee-core/electron');
|
||||
const { getBaseDir } = require('ee-core/ps');
|
||||
const ps = require('ee-core/ps');
|
||||
const { app } = require('electron');
|
||||
|
||||
// 动态获取 scripts 目录路径
|
||||
@@ -74,9 +74,12 @@ class Lifecycle {
|
||||
async ready() {
|
||||
logger.info('[lifecycle] ready');
|
||||
// 延迟加载 scripts
|
||||
if (ps.isProd()) {
|
||||
loadScripts();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整的应用启动流程
|
||||
*/
|
||||
@@ -493,7 +496,7 @@ class Lifecycle {
|
||||
*/
|
||||
async windowReady() {
|
||||
logger.info('[lifecycle] window-ready');
|
||||
|
||||
if (ps.isProd()) {
|
||||
// 创建日志窗口
|
||||
this.logWindowManager = new LogWindowManager();
|
||||
this.logWindowManager.createLogWindow();
|
||||
@@ -532,6 +535,17 @@ class Lifecycle {
|
||||
this.logWindowManager.addLog('warn', '应用已启动,但部分服务可能未正常运行');
|
||||
}, 5000);
|
||||
}
|
||||
} else {
|
||||
const win = getMainWindow();
|
||||
const {windowsOption} = getConfig();
|
||||
if (windowsOption.show == false) {
|
||||
win.once('ready-to-show', () => {
|
||||
win.show();
|
||||
win.focus();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 主窗口初始化但不显示,等待启动流程完成后再显示
|
||||
// 在 startApplication() 中会调用 win.show()
|
||||
@@ -542,8 +556,11 @@ class Lifecycle {
|
||||
*/
|
||||
async beforeClose() {
|
||||
logger.info('[lifecycle] before-close hook triggered');
|
||||
if (ps.isProd()) {
|
||||
await this.cleanup();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Lifecycle.toString = () => '[class Lifecycle]';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ VITE_API_URL=/api
|
||||
# 开发环境跨域代理,支持配置多个
|
||||
|
||||
#VITE_PROXY=[["/api","http://127.0.0.1:18092/"]]
|
||||
VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]]
|
||||
#VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
||||
# 开启激活验证
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import http from '@/api'
|
||||
import type { Activate } from '@/api/activate/interface'
|
||||
|
||||
export const generateApplicationCode = (params: Activate.ApplicationCodePlaintext) => {
|
||||
return http.post(`/activate/generateApplicationCode`, params)
|
||||
export const generateApplicationCode = () => {
|
||||
return http.post(`/activate/generateApplicationCode`)
|
||||
}
|
||||
|
||||
export const verifyActivationCode = (activationCode: string) => {
|
||||
|
||||
@@ -1,37 +1,14 @@
|
||||
//激活模块
|
||||
export namespace Activate {
|
||||
|
||||
export interface ApplicationModule {
|
||||
/**
|
||||
* 是否申请 1是 0否
|
||||
*/
|
||||
apply: number;
|
||||
}
|
||||
|
||||
export interface ActivateModule extends ApplicationModule {
|
||||
export interface ActivateModule {
|
||||
/**
|
||||
* 是否永久 1是 0否
|
||||
*/
|
||||
permanently: number;
|
||||
}
|
||||
|
||||
export interface ApplicationCodePlaintext {
|
||||
|
||||
/**
|
||||
* 模拟式模块
|
||||
*/
|
||||
simulate: ApplicationModule;
|
||||
|
||||
/**
|
||||
* 数字式模块
|
||||
*/
|
||||
digital: ApplicationModule;
|
||||
|
||||
/**
|
||||
* 比对式模块
|
||||
*/
|
||||
contrast: ApplicationModule;
|
||||
}
|
||||
export interface ActivationCodePlaintext {
|
||||
|
||||
/**
|
||||
|
||||
@@ -142,6 +142,7 @@ export namespace CheckData {
|
||||
id: string
|
||||
code: string
|
||||
scriptName: string
|
||||
resultFlag: number
|
||||
}
|
||||
|
||||
// 用来描述 检测数据-左侧树结构
|
||||
|
||||
@@ -13,7 +13,8 @@ export const getBigTestItem = (params: {
|
||||
export const getScriptList = (params: {
|
||||
devId:string,
|
||||
chnNum:number,
|
||||
num:number
|
||||
num:number,
|
||||
planId:string
|
||||
}) => {
|
||||
return http.post('/result/getCheckItem', params, {loading: false})
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ export namespace Device {
|
||||
boundPlanName?: string | null
|
||||
assign?: number ////是否分配给检测人员 0否 1是
|
||||
monitorList: Monitor.ResPqMon[]
|
||||
checked: boolean // 是否已选择
|
||||
disabled: boolean // 是否禁用
|
||||
checked?: boolean // 是否已选择
|
||||
disabled?: boolean // 是否禁用
|
||||
}
|
||||
|
||||
export interface SelectOption {
|
||||
|
||||
@@ -27,6 +27,7 @@ export namespace Monitor {
|
||||
statInterval: number; //统计间隔
|
||||
harmSysId: string; //默认与谐波系统监测点ID相同
|
||||
checkFlag: number;//是否参与检测0否1是
|
||||
resultType:string|null; //检测结果类型
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,7 @@ export const getPqErrSysList = () => {
|
||||
}
|
||||
|
||||
//获取指定模式下所有未绑定的设备
|
||||
export const getUnboundPqDevList = (params: { pattern: string}) => {
|
||||
export const getUnboundPqDevList = (params: { pattern: string }) => {
|
||||
return http.get(`/pqDev/listUnbound?pattern=${params.pattern}`)
|
||||
}
|
||||
|
||||
@@ -141,22 +141,22 @@ export const importSubPlan = (params: Plan.ResPlan) => {
|
||||
|
||||
// 导出计划检测结果数据
|
||||
export const exportPlanCheckData = (params: any) => {
|
||||
return http.post(
|
||||
`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`
|
||||
)
|
||||
return http.post(`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`)
|
||||
}
|
||||
|
||||
//根据误差体系id获取测试项
|
||||
export const getPqErrSysTestItemList = (params: {errorSysId : string}) => {
|
||||
export const getPqErrSysTestItemList = (params: { errorSysId: string }) => {
|
||||
return http.get(`/pqErrSys/getTestItems?id=${params.errorSysId}`)
|
||||
}
|
||||
|
||||
// 获取计划项目成员
|
||||
export const getMemberList = (params: {id : string}) => {
|
||||
export const getMemberList = (params: { id: string }) => {
|
||||
return http.get(`/adPlan/getMemberList?planId=${params.id}`)
|
||||
}
|
||||
|
||||
// 导入并合并子检测计划检测结果数据
|
||||
export const importAndMergePlanCheckData = (params: Plan.ResPlan) => {
|
||||
return http.upload(`/adPlan/importAndMergePlanCheckData`, params)
|
||||
return http.upload(`/adPlan/importAndMergePlanCheckData`, params, {
|
||||
timeout: 60000 * 20
|
||||
})
|
||||
}
|
||||
@@ -41,9 +41,6 @@
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="parameter.showCover" label="数据覆盖 :">
|
||||
<el-switch v-model="isCover" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -52,7 +49,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import { Download } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElNotification, UploadRawFile, UploadRequestOptions } from 'element-plus'
|
||||
import { ElMessage, ElNotification, type UploadRawFile, type UploadRequestOptions } from 'element-plus'
|
||||
|
||||
export interface ExcelParameterProps {
|
||||
title: string // 标题
|
||||
@@ -67,7 +64,7 @@ export interface ExcelParameterProps {
|
||||
}
|
||||
|
||||
// 是否覆盖数据
|
||||
const isCover = ref(false)
|
||||
const isCover = ref(0)
|
||||
// 最大文件上传数
|
||||
const excelLimit = ref(1)
|
||||
// dialog状态
|
||||
@@ -85,6 +82,7 @@ const emit = defineEmits<{
|
||||
const acceptParams = (params: ExcelParameterProps) => {
|
||||
parameter.value = { ...parameter.value, ...params }
|
||||
dialogVisible.value = true
|
||||
isCover.value = 0
|
||||
}
|
||||
|
||||
// Excel 导入模板下载
|
||||
@@ -92,9 +90,10 @@ const downloadTemp = () => {
|
||||
if (!parameter.value.tempApi) return
|
||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`, { pattern: parameter.value.patternId }, false)
|
||||
}
|
||||
|
||||
const currentFile = ref<UploadRequestOptions>(null)
|
||||
// 文件上传
|
||||
const uploadExcel = async (param: UploadRequestOptions) => {
|
||||
currentFile.value = param
|
||||
let excelFormData = new FormData()
|
||||
excelFormData.append('file', param.file)
|
||||
if (parameter.value.patternId) {
|
||||
@@ -103,26 +102,43 @@ const uploadExcel = async (param: UploadRequestOptions) => {
|
||||
|
||||
excelFormData.append('planId', parameter.value.planId)
|
||||
|
||||
isCover.value && excelFormData.append('isCover', isCover.value as unknown as Blob)
|
||||
excelFormData.append('cover', isCover.value as unknown as Blob)
|
||||
//await parameter.value.importApi!(excelFormData);
|
||||
await parameter.value.importApi!(excelFormData).then(res => handleImportResponse(res))
|
||||
const res = await parameter.value.importApi!(excelFormData)
|
||||
await handleImportResponse(res)
|
||||
|
||||
parameter.value.getTableList && parameter.value.getTableList()
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
async function handleImportResponse(res: any) {
|
||||
|
||||
|
||||
if (res.type === 'application/json') {
|
||||
const fileReader = new FileReader()
|
||||
fileReader.onloadend = () => {
|
||||
try {
|
||||
const jsonData = JSON.parse(fileReader.result)
|
||||
if (jsonData.code === 'A0000') {
|
||||
isCover.value = 0
|
||||
ElMessage.success('导入成功')
|
||||
} else {
|
||||
if (jsonData.code === 'A02099') {
|
||||
const dev = jsonData.data.join('<br>')
|
||||
ElMessageBox.confirm(`<p>以下被检设备已存在,${jsonData.message}</p><p>${dev}</p>`, {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
dangerouslyUseHTMLString: true,
|
||||
title: '提示',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
isCover.value = 1
|
||||
if (currentFile.value) {
|
||||
uploadExcel(currentFile.value)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
ElMessageBox.alert(jsonData.message, {
|
||||
confirmButtonText: '确定',
|
||||
title: '导入结果',
|
||||
type: 'error'
|
||||
})
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
action="#"
|
||||
class="upload"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:http-request="uploadZip"
|
||||
accept=".zip"
|
||||
:auto-upload="!parameter.confirmMessage"
|
||||
@@ -56,7 +57,15 @@
|
||||
|
||||
<script setup lang="ts" name="ImportZip">
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type UploadInstance, type UploadProps, type UploadRequestOptions } from 'element-plus'
|
||||
import {
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
genFileId,
|
||||
type UploadInstance,
|
||||
type UploadProps,
|
||||
type UploadRawFile,
|
||||
type UploadRequestOptions
|
||||
} from 'element-plus'
|
||||
import http from '@/api'
|
||||
|
||||
export interface ZipParameterProps {
|
||||
@@ -170,7 +179,12 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
message: ''
|
||||
}
|
||||
}
|
||||
|
||||
const handleExceed: UploadProps['onExceed'] = files => {
|
||||
uploadRef.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
uploadRef.value!.handleStart(file)
|
||||
}
|
||||
const progressData = ref({
|
||||
percentage: 0,
|
||||
status: '',
|
||||
|
||||
@@ -61,9 +61,12 @@ const menuList = computed(() => authStore.showMenuListGet)
|
||||
const showMenuFlag = computed(() => authStore.showMenuFlagGet)
|
||||
const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string)
|
||||
|
||||
const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, '_blank')
|
||||
router.push(subItem.path)
|
||||
const handleClickMenu = async (subItem: Menu.MenuOptions) => {
|
||||
if (subItem.meta?.isLink) {
|
||||
window.open(subItem.meta.isLink, '_blank')
|
||||
return
|
||||
}
|
||||
await router.push(subItem.path)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -28,8 +28,14 @@
|
||||
import { computed } from 'vue'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import { useTabsStore } from '@/stores/modules/tabs'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
const modeStore = useModeStore()
|
||||
const tabsStore = useTabsStore()
|
||||
|
||||
const title = computed(() => {
|
||||
return modeStore.currentMode === '' ? '选择模块' : modeStore.currentMode + '模块'
|
||||
@@ -41,39 +47,32 @@ const modeList = [
|
||||
name: '模拟式模块',
|
||||
code: '模拟式',
|
||||
key: 'simulate',
|
||||
activated:
|
||||
isActivateOpen === 'true'
|
||||
? activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1
|
||||
: true
|
||||
activated: isActivateOpen === 'true' ? activateInfo.simulate.permanently === 1 : true
|
||||
},
|
||||
{
|
||||
name: '数字式模块',
|
||||
code: '数字式',
|
||||
key: 'digital',
|
||||
activated:
|
||||
isActivateOpen === 'true'
|
||||
? activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1
|
||||
: true
|
||||
activated: isActivateOpen === 'true' ? activateInfo.digital.permanently === 1 : true
|
||||
},
|
||||
{
|
||||
name: '比对式模块',
|
||||
code: '比对式',
|
||||
key: 'contrast',
|
||||
activated:
|
||||
isActivateOpen === 'true'
|
||||
? activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1
|
||||
: true
|
||||
activated: isActivateOpen === 'true' ? activateInfo.contrast.permanently === 1 : true
|
||||
}
|
||||
]
|
||||
const handelOpen = async (item: string, key: string) => {
|
||||
if (isActivateOpen === 'true' && (activateInfo[key].apply !== 1 || activateInfo[key].permanently !== 1)) {
|
||||
if (isActivateOpen === 'true' && activateInfo[key].permanently !== 1) {
|
||||
ElMessage.warning(`${item}模块未激活`)
|
||||
return
|
||||
}
|
||||
await authStore.setShowMenu()
|
||||
modeStore.setCurrentMode(item) // 将模式code存入 store
|
||||
// 强制刷新页面
|
||||
window.location.reload()
|
||||
await tabsStore.closeMultipleTab()
|
||||
await initDynamicRouter()
|
||||
await router.push({ path: '/home/index' })
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
<template>
|
||||
<!-- <div class="userInfo">-->
|
||||
<!-- <div class="icon">-->
|
||||
<!-- <Avatar/>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="username">-->
|
||||
<!-- {{ username }}-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<el-dropdown trigger="click">
|
||||
<div class="userInfo">
|
||||
<div class="icon">
|
||||
@@ -22,10 +14,10 @@
|
||||
<el-icon><Sunny /></el-icon>
|
||||
{{ t('header.changeTheme') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="openDialog('infoRef')">
|
||||
<!-- <el-dropdown-item @click="openDialog('infoRef')">
|
||||
<el-icon><User /></el-icon>
|
||||
{{ t('header.personalData') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-item>-->
|
||||
<el-dropdown-item @click="openDialog('passwordRef')">
|
||||
<el-icon><Edit /></el-icon>
|
||||
{{ t('header.changePassword') }}
|
||||
@@ -80,7 +72,6 @@
|
||||
import { computed, ref } from 'vue'
|
||||
import { LOGIN_URL } from '@/config'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { logoutApi } from '@/api/user/login'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import InfoDialog from './InfoDialog.vue'
|
||||
@@ -90,10 +81,9 @@ import VersionDialog from '@/views/system/versionRegister/index.vue'
|
||||
import { Avatar, Sunny, Switch, Tools } from '@element-plus/icons-vue'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
|
||||
import { useTheme } from '@/hooks/useTheme'
|
||||
import { useAppSceneStore } from '@/stores/modules/mode'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { updateScene } from '@/api/system/base/index'
|
||||
import { updateScene } from '@/api/system/base'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const dictStore = useDictStore()
|
||||
@@ -101,10 +91,6 @@ const username = computed(() => userStore.userInfo.name)
|
||||
|
||||
const router = useRouter()
|
||||
const authStore = useAuthStore()
|
||||
const modeStore = useModeStore()
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
|
||||
const { changePrimary } = useTheme()
|
||||
|
||||
// 初始化 i18n
|
||||
const { t } = useI18n() // 使用 t 方法替代 $t
|
||||
@@ -116,21 +102,8 @@ const logout = () => {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
// 1.执行退出登录接口
|
||||
await logoutApi()
|
||||
// 2.清除 Token
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setExp(0)
|
||||
userStore.setUserInfo({ id: '', name: '' })
|
||||
userStore.setIsRefreshToken(false)
|
||||
dictStore.setDictData([])
|
||||
modeStore.setCurrentMode('')
|
||||
AppSceneStore.setCurrentMode('')
|
||||
// 3.重定向到登陆页
|
||||
ElMessage.success('退出登录成功!')
|
||||
//重置菜单/导航栏权限
|
||||
await authStore.resetAuthStore()
|
||||
await userStore.logout()
|
||||
await router.push(LOGIN_URL)
|
||||
})
|
||||
}
|
||||
@@ -157,8 +130,9 @@ const changeScene = async (value: string) => {
|
||||
}
|
||||
|
||||
//模式切换
|
||||
const changeMode = () => {
|
||||
const changeMode = async () => {
|
||||
authStore.changeModel()
|
||||
await router.push('/home/index')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,22 +1,150 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="修改密码" width="500px" draggable>
|
||||
<span>This is Password</span>
|
||||
<div>
|
||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules">
|
||||
<el-form-item label="原密码" prop="oldPassword" :label-width="100">
|
||||
<el-input
|
||||
type="oldPassword"
|
||||
v-model="formContent.oldPassword"
|
||||
show-password
|
||||
placeholder="请输入原密码"
|
||||
autocomplete="off"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPassword" :label-width="100">
|
||||
<el-input
|
||||
type="newPassword"
|
||||
v-model="formContent.newPassword"
|
||||
show-password
|
||||
placeholder="请输入新密码"
|
||||
autocomplete="off"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="surePassword" :label-width="100">
|
||||
<el-input
|
||||
type="surePassword"
|
||||
v-model="formContent.surePassword"
|
||||
show-password
|
||||
placeholder="请再次输入确认密码"
|
||||
autocomplete="off"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dialogVisible = false">确认</el-button>
|
||||
</span>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close()">取消</el-button>
|
||||
<el-button type="primary" @click="save()">保存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
<script lang="ts" setup>
|
||||
import { ref, type Ref } from 'vue'
|
||||
import { ElMessage, type FormItemRule } from 'element-plus'
|
||||
import { updatePassWord } from '@/api/user/user'
|
||||
import { type User } from '@/api/user/interface/user'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { LOGIN_URL } from '@/config'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const openDialog = () => {
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
function useMetaInfo() {
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = ref<User.ResPassWordUser>({
|
||||
id: '', //用户ID,作为唯一标识
|
||||
oldPassword: '', //密码
|
||||
newPassword: '', //
|
||||
surePassword: ''
|
||||
})
|
||||
return { dialogVisible, formContent }
|
||||
}
|
||||
|
||||
defineExpose({ openDialog });
|
||||
const { dialogVisible, formContent } = useMetaInfo()
|
||||
// 清空formContent
|
||||
const resetFormContent = () => {
|
||||
formContent.value = {
|
||||
id: '', //用户ID,作为唯一标识
|
||||
oldPassword: '', //密码
|
||||
newPassword: '', //
|
||||
surePassword: ''
|
||||
}
|
||||
}
|
||||
|
||||
// 定义规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
oldPassword: [{ required: true, message: '原密码必填!', trigger: 'blur' }],
|
||||
newPassword: [
|
||||
{ required: true, message: '新密码必填!', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]).{8,16}$/,
|
||||
message: '密码长度为8-16,需包含特殊字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
surePassword: [
|
||||
{ required: true, message: '确认密码必填!', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: FormItemRule, value: string, callback: Function) => {
|
||||
if (value !== formContent.value.newPassword) {
|
||||
callback(new Error('两次输入的密码不一致!'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (formContent.value.id) {
|
||||
await updatePassWord(formContent.value)
|
||||
ElMessage.success('修改密码成功,请重新登录!')
|
||||
setTimeout(async () => {
|
||||
await userStore.logout()
|
||||
await router.push(LOGIN_URL)
|
||||
}, 2000)
|
||||
}
|
||||
close()
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('验证过程中出现错误', err)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗是编辑
|
||||
const openDialog = async () => {
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
dialogVisible.value = true
|
||||
formContent.value.id = userStore.userInfo.id
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
|
||||
@@ -20,27 +20,26 @@
|
||||
</template>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onBeforeMount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
defineProps<{ menuList: Menu.MenuOptions[] }>();
|
||||
const router = useRouter();
|
||||
const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
//console.log('1456----------------',subItem);
|
||||
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
|
||||
router.push(subItem.path);
|
||||
};
|
||||
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
defineProps<{ menuList: Menu.MenuOptions[] }>()
|
||||
const router = useRouter()
|
||||
const handleClickMenu = async (subItem: Menu.MenuOptions) => {
|
||||
if (subItem.meta?.isLink) {
|
||||
window.open(subItem.meta.isLink, '_blank')
|
||||
return
|
||||
}
|
||||
await router.push(subItem.path)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.el-sub-menu .el-sub-menu__title:hover {
|
||||
// color: var(--el-menu-hover-text-color) !important;
|
||||
// background-color: transparent !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
color: #fff !important; //一级导航文字选中颜色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
}
|
||||
.el-menu--collapse {
|
||||
.is-active {
|
||||
@@ -61,7 +60,7 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
&.is-active {
|
||||
// color: var(--el-menu-active-color) !important;
|
||||
// background-color: var(--el-menu-active-bg-color) !important;
|
||||
color: #fff !important;//一级导航文字选中颜色
|
||||
color: #fff !important; //一级导航文字选中颜色
|
||||
//background-color: #5274a5 !important; //一级导航选中背景色
|
||||
background-color: var(--el-color-primary-light-3) !important;
|
||||
|
||||
@@ -70,7 +69,7 @@ const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
content: "";
|
||||
content: '';
|
||||
background-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
import { staticRouter } from '@/routers/modules/staticRouter'
|
||||
import NProgress from '@/config/nprogress'
|
||||
|
||||
// 白名单转换为 Set 提高性能
|
||||
const WHITE_LIST_SET = new Set(ROUTER_WHITE_LIST)
|
||||
|
||||
const mode = import.meta.env.VITE_ROUTER_MODE
|
||||
|
||||
const routerMode = {
|
||||
@@ -30,11 +33,9 @@ const routerMode = {
|
||||
* @param meta.isKeepAlive ==> 当前路由是否缓存
|
||||
* */
|
||||
const router = createRouter({
|
||||
history: routerMode[mode](),
|
||||
history: routerMode[mode]?.() || createWebHashHistory(), // 默认 fallback 到 hash 模式
|
||||
routes: [...staticRouter],
|
||||
// 不区分路由大小写,非严格模式下提供了更宽松的路径匹配
|
||||
strict: false,
|
||||
// 页面刷新时,滚动条位置还原
|
||||
scrollBehavior: () => ({ left: 0, top: 0 })
|
||||
})
|
||||
|
||||
@@ -44,38 +45,52 @@ const router = createRouter({
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const userStore = useUserStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
// 1.NProgress 开始
|
||||
NProgress.start()
|
||||
|
||||
// 2.动态设置标题
|
||||
const title = import.meta.env.VITE_GLOB_APP_TITLE
|
||||
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title
|
||||
|
||||
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
||||
// 3.判断是访问登陆页,有 Token 就留在当前页,没有 Token 重置路由到登陆页
|
||||
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
||||
if (userStore.accessToken) return next(from.fullPath)
|
||||
if (userStore.accessToken) {
|
||||
// 已登录则不再回到登录页,直接跳过
|
||||
return next('/')
|
||||
}
|
||||
resetRouter()
|
||||
return next()
|
||||
}
|
||||
|
||||
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
||||
if (ROUTER_WHITE_LIST.includes(to.path)) return next()
|
||||
if (WHITE_LIST_SET.has(to.path)) return next()
|
||||
|
||||
// 5.判断是否有 Token,没有重定向到 login 页面
|
||||
if (!userStore.accessToken) return next({ path: LOGIN_URL, replace: true })
|
||||
|
||||
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
||||
if (!authStore.authMenuListGet.length) {
|
||||
try {
|
||||
await initDynamicRouter()
|
||||
return next({ ...to, replace: true })
|
||||
} catch (error) {
|
||||
console.error('动态路由加载失败:', error)
|
||||
// 清除 token 并跳转登录页
|
||||
await userStore.logout()
|
||||
return next({ path: LOGIN_URL, replace: true })
|
||||
}
|
||||
}
|
||||
|
||||
// 7.存储 routerName 做按钮权限筛选
|
||||
await authStore.setRouteName(to.name as string)
|
||||
|
||||
// 8. 当前页面是否有激活信息,没有就刷新
|
||||
const activateInfo = authStore.activateInfo
|
||||
if (!Object.keys(activateInfo).length) {
|
||||
await authStore.setActivateInfo()
|
||||
}
|
||||
|
||||
// 9.正常访问页面
|
||||
next()
|
||||
})
|
||||
@@ -96,7 +111,7 @@ export const resetRouter = () => {
|
||||
* */
|
||||
router.onError(error => {
|
||||
NProgress.done()
|
||||
//console.warn('路由错误', error.message)
|
||||
console.warn('路由错误', error.message)
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,60 +1,117 @@
|
||||
import router from "@/routers/index";
|
||||
import { LOGIN_URL } from "@/config";
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
import { ElNotification } from "element-plus";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import { useAuthStore } from "@/stores/modules/auth";
|
||||
import router from '@/routers'
|
||||
import { LOGIN_URL } from '@/config'
|
||||
import { type RouteRecordRaw } from 'vue-router'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
|
||||
// 引入 views 文件夹下所有 vue 文件
|
||||
const modules = import.meta.glob("@/views/**/*.vue");
|
||||
const modules = import.meta.glob('@/views/**/*.vue')
|
||||
|
||||
let isInitializing = false
|
||||
|
||||
/**
|
||||
* 清除已有的动态路由
|
||||
*/
|
||||
const clearDynamicRoutes = () => {
|
||||
const routes = router.getRoutes()
|
||||
routes.forEach(route => {
|
||||
if (route.name && route.name !== 'layout' && route.name !== 'login' && route.name !== 'testScriptAdd') {
|
||||
router.removeRoute(route.name)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 component 路径查找对应的模块
|
||||
* @param path 组件路径
|
||||
*/
|
||||
const resolveComponentModule = async (path: string) => {
|
||||
// 规范化路径,去除首尾斜杠
|
||||
let normalizedPath = path.trim()
|
||||
if (!normalizedPath.startsWith('/')) {
|
||||
normalizedPath = '/' + normalizedPath
|
||||
}
|
||||
if (normalizedPath.endsWith('.vue')) {
|
||||
normalizedPath = normalizedPath.slice(0, -4)
|
||||
}
|
||||
|
||||
const fullPath = `/src/views${normalizedPath}.vue`
|
||||
return modules[fullPath]
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化动态路由
|
||||
*/
|
||||
export const initDynamicRouter = async () => {
|
||||
const userStore = useUserStore();
|
||||
const authStore = useAuthStore();
|
||||
if (isInitializing) return Promise.reject(new Error('Dynamic router initialization in progress'))
|
||||
|
||||
isInitializing = true
|
||||
const userStore = useUserStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
try {
|
||||
// 1.获取菜单列表 && 按钮权限列表
|
||||
await authStore.getAuthMenuList();
|
||||
await authStore.getAuthButtonList();
|
||||
// 1. 获取菜单列表 && 按钮权限列表
|
||||
await authStore.getAuthMenuList()
|
||||
await authStore.getAuthButtonList()
|
||||
|
||||
// 2.判断当前用户有没有菜单权限
|
||||
// 2. 判断当前用户有没有菜单权限
|
||||
if (!authStore.authMenuListGet.length) {
|
||||
ElNotification({
|
||||
title: "无权限访问",
|
||||
message: "当前账号无任何菜单权限,请联系系统管理员!",
|
||||
type: "warning",
|
||||
title: '无权限访问',
|
||||
message: '当前账号无任何菜单权限,请联系系统管理员!',
|
||||
type: 'warning',
|
||||
duration: 3000
|
||||
});
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
})
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setExp(0)
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject("No permission");
|
||||
await router.replace(LOGIN_URL)
|
||||
return Promise.reject('No permission')
|
||||
}
|
||||
|
||||
// 3.添加动态路由
|
||||
authStore.flatMenuListGet.forEach(item => {
|
||||
item.children && delete item.children;
|
||||
// 3. 清理之前的动态路由
|
||||
clearDynamicRoutes()
|
||||
|
||||
if (item.component && typeof item.component == "string") {
|
||||
item.component = modules["/src/views" + item.component + ".vue"];
|
||||
}
|
||||
// 4. 添加动态路由
|
||||
for (const item of authStore.flatMenuListGet) {
|
||||
// 删除 children 避免冗余嵌套
|
||||
if (item.children) delete item.children
|
||||
|
||||
if (item.meta.isFull) {
|
||||
router.addRoute(item as unknown as RouteRecordRaw);
|
||||
// 处理组件映射
|
||||
if (item.component && typeof item.component === 'string') {
|
||||
const moduleLoader = await resolveComponentModule(item.component)
|
||||
if (moduleLoader) {
|
||||
item.component = moduleLoader
|
||||
} else {
|
||||
router.addRoute("layout", item as unknown as RouteRecordRaw);
|
||||
console.warn(`未能找到组件: ${item.component}`)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// 类型守卫:确保满足 RouteRecordRaw 接口要求
|
||||
if (
|
||||
typeof item.path === 'string' &&
|
||||
(typeof item.component === 'function' || typeof item.redirect === 'string')
|
||||
) {
|
||||
const routeItem = item as unknown as RouteRecordRaw
|
||||
if (item.meta.isFull) {
|
||||
router.addRoute(routeItem)
|
||||
} else {
|
||||
router.addRoute('layout', routeItem)
|
||||
}
|
||||
} else {
|
||||
console.warn('Invalid route item:', item)
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||
userStore.setAccessToken("");
|
||||
userStore.setRefreshToken("");
|
||||
userStore.setAccessToken('')
|
||||
userStore.setRefreshToken('')
|
||||
userStore.setExp(0)
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject(error);
|
||||
await router.replace(LOGIN_URL)
|
||||
return Promise.reject(error)
|
||||
} finally {
|
||||
isInitializing = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,65 +1,69 @@
|
||||
export type LayoutType = 'vertical' | 'classic' | 'transverse' | 'columns';
|
||||
import { type Activate } from '@/api/activate/interface'
|
||||
|
||||
export type AssemblySizeType = 'large' | 'default' | 'small';
|
||||
export type LayoutType = 'vertical' | 'classic' | 'transverse' | 'columns'
|
||||
|
||||
export type LanguageType = 'zh' | 'en' | null;
|
||||
export type AssemblySizeType = 'large' | 'default' | 'small'
|
||||
|
||||
export type LanguageType = 'zh' | 'en' | null
|
||||
|
||||
/* GlobalState */
|
||||
export interface GlobalState {
|
||||
layout: LayoutType;
|
||||
assemblySize: AssemblySizeType;
|
||||
language: LanguageType;
|
||||
maximize: boolean;
|
||||
primary: string;
|
||||
isDark: boolean;
|
||||
isGrey: boolean;
|
||||
isWeak: boolean;
|
||||
asideInverted: boolean;
|
||||
headerInverted: boolean;
|
||||
isCollapse: boolean;
|
||||
accordion: boolean;
|
||||
breadcrumb: boolean;
|
||||
breadcrumbIcon: boolean;
|
||||
tabs: boolean;
|
||||
tabsIcon: boolean;
|
||||
footer: boolean;
|
||||
layout: LayoutType
|
||||
assemblySize: AssemblySizeType
|
||||
language: LanguageType
|
||||
maximize: boolean
|
||||
primary: string
|
||||
isDark: boolean
|
||||
isGrey: boolean
|
||||
isWeak: boolean
|
||||
asideInverted: boolean
|
||||
headerInverted: boolean
|
||||
isCollapse: boolean
|
||||
accordion: boolean
|
||||
breadcrumb: boolean
|
||||
breadcrumbIcon: boolean
|
||||
tabs: boolean
|
||||
tabsIcon: boolean
|
||||
footer: boolean
|
||||
}
|
||||
|
||||
/* UserState */
|
||||
export interface UserState {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
isRefreshToken: boolean;
|
||||
userInfo: { id: string, name: string,loginName:string };
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
isRefreshToken: boolean
|
||||
exp: number
|
||||
userInfo: { id: string; name: string; loginName: string }
|
||||
}
|
||||
|
||||
/* tabsMenuProps */
|
||||
export interface TabsMenuProps {
|
||||
icon: string;
|
||||
title: string;
|
||||
path: string;
|
||||
name: string;
|
||||
close: boolean;
|
||||
isKeepAlive: boolean;
|
||||
unshift?: boolean;
|
||||
icon: string
|
||||
title: string
|
||||
path: string
|
||||
name: string
|
||||
close: boolean
|
||||
isKeepAlive: boolean
|
||||
unshift?: boolean
|
||||
}
|
||||
|
||||
/* TabsState */
|
||||
export interface TabsState {
|
||||
tabsMenuList: TabsMenuProps[];
|
||||
tabsMenuList: TabsMenuProps[]
|
||||
}
|
||||
|
||||
/* AuthState */
|
||||
export interface AuthState {
|
||||
routeName: string;
|
||||
routeName: string
|
||||
authButtonList: {
|
||||
[key: string]: string[];
|
||||
};
|
||||
authMenuList: Menu.MenuOptions[];
|
||||
showMenuFlag: boolean;
|
||||
[key: string]: string[]
|
||||
}
|
||||
authMenuList: Menu.MenuOptions[]
|
||||
showMenuFlag: boolean
|
||||
activateInfo: Activate.ActivationCodePlaintext
|
||||
}
|
||||
|
||||
/* KeepAliveState */
|
||||
export interface KeepAliveState {
|
||||
keepAliveName: string[];
|
||||
keepAliveName: string[]
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { AuthState } from '@/stores/interface'
|
||||
import { type AuthState } from '@/stores/interface'
|
||||
import { getAuthButtonListApi, getAuthMenuListApi } from '@/api/user/login'
|
||||
import { getAllBreadcrumbList, getFlatMenuList, getShowMenuList } from '@/utils'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { AUTH_STORE_KEY } from '@/stores/constant'
|
||||
import { useModeStore } from '@/stores/modules/mode'
|
||||
import { getLicense } from '@/api/activate'
|
||||
import type { Activate } from '@/api/activate/interface'
|
||||
|
||||
export const useAuthStore = defineStore({
|
||||
id: AUTH_STORE_KEY,
|
||||
export const useAuthStore = defineStore(AUTH_STORE_KEY, {
|
||||
state: (): AuthState => ({
|
||||
// 按钮权限列表
|
||||
authButtonList: {},
|
||||
@@ -19,8 +17,7 @@ export const useAuthStore = defineStore({
|
||||
routeName: '',
|
||||
//登录不显示菜单栏和导航栏,点击进入测试的时候显示
|
||||
showMenuFlag: JSON.parse(localStorage.getItem('showMenuFlag') as string),
|
||||
router: useRouter(),
|
||||
activateInfo: {}
|
||||
activateInfo: {} as Activate.ActivationCodePlaintext
|
||||
}),
|
||||
getters: {
|
||||
// 按钮权限列表
|
||||
@@ -72,14 +69,28 @@ export const useAuthStore = defineStore({
|
||||
localStorage.setItem('showMenuFlag', 'true')
|
||||
},
|
||||
//更改模式
|
||||
async changeModel() {
|
||||
changeModel() {
|
||||
this.showMenuFlag = false
|
||||
localStorage.removeItem('showMenuFlag')
|
||||
this.router.push({ path: '/home/index' })
|
||||
},
|
||||
async setActivateInfo() {
|
||||
const license_result = await getLicense()
|
||||
const licenseData = license_result.data as unknown as Activate.ActivationCodePlaintext
|
||||
const licenseData = license_result.data as Activate.ActivationCodePlaintext
|
||||
if (!licenseData.simulate) {
|
||||
licenseData.simulate = {
|
||||
permanently: 0
|
||||
}
|
||||
}
|
||||
if (!licenseData.digital) {
|
||||
licenseData.digital = {
|
||||
permanently: 0
|
||||
}
|
||||
}
|
||||
if (!licenseData.contrast) {
|
||||
licenseData.contrast = {
|
||||
permanently: 0
|
||||
}
|
||||
}
|
||||
this.activateInfo = licenseData
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,37 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import type {Plan} from '@/api/plan/interface'
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
import { defineStore } from 'pinia'
|
||||
import { CHECK_STORE_KEY } from '@/stores/constant'
|
||||
import type { CheckData } from '@/api/check/interface'
|
||||
import type { Plan } from '@/api/plan/interface'
|
||||
import { useAppSceneStore } from '@/stores/modules/mode'
|
||||
|
||||
export const useCheckStore = defineStore(CHECK_STORE_KEY, {
|
||||
state: () => ({
|
||||
devices: [] as CheckData.Device[],
|
||||
plan: {} as Plan.ResPlan,
|
||||
selectTestItems: {preTest: true, timeTest: false, channelsTest: false, test: true} as CheckData.SelectTestItem,
|
||||
selectTestItems: {
|
||||
preTest: true,
|
||||
timeTest: false,
|
||||
channelsTest: false,
|
||||
test: true
|
||||
} as CheckData.SelectTestItem,
|
||||
checkType: 1, // 0:手动检测 1:自动检测
|
||||
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||
showDetailType: 0, // 0:数据查询 1:误差体系跟换 2:正式检测
|
||||
temperature: 0,
|
||||
humidity: 0,
|
||||
chnNumList: [],//连线数据
|
||||
nodesConnectable: true,//设置是能可以连线
|
||||
chnNumList: [] as string[], //连线数据
|
||||
nodesConnectable: true //设置是能可以连线
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
addDevices(device: CheckData.Device[]) {
|
||||
this.devices.push(...device);
|
||||
this.devices.push(...device)
|
||||
},
|
||||
setPlan(plan: Plan.ResPlan) {
|
||||
this.plan = plan
|
||||
},
|
||||
clearDevices() {
|
||||
this.devices = [];
|
||||
this.devices = []
|
||||
},
|
||||
initSelectTestItems() {
|
||||
const appSceneStore = useAppSceneStore()
|
||||
@@ -61,7 +66,6 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
|
||||
},
|
||||
setNodesConnectable(nodesConnectable: boolean) {
|
||||
this.nodesConnectable = nodesConnectable
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -5,11 +5,9 @@ import { DICT_STORE_KEY } from '@/stores/constant'
|
||||
// 模拟数据
|
||||
//import dictData from '@/api/system/dictData'
|
||||
|
||||
|
||||
export const useDictStore = defineStore({
|
||||
id: DICT_STORE_KEY,
|
||||
export const useDictStore = defineStore(DICT_STORE_KEY, {
|
||||
state: () => ({
|
||||
dictData: [] as Dict[],
|
||||
dictData: [] as Dict[]
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@@ -27,7 +25,7 @@ export const useDictStore = defineStore({
|
||||
// 初始化获取全部字典数据并缓存
|
||||
async initDictData(initData: Dict[]) {
|
||||
this.dictData = initData
|
||||
}
|
||||
},
|
||||
},
|
||||
persist: piniaPersistConfig(DICT_STORE_KEY),
|
||||
persist: piniaPersistConfig(DICT_STORE_KEY)
|
||||
})
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { type GlobalState } from "@/stores/interface";
|
||||
import { DEFAULT_PRIMARY} from "@/config";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
||||
import { defineStore } from 'pinia'
|
||||
import { type GlobalState } from '@/stores/interface'
|
||||
import { DEFAULT_PRIMARY } from '@/config'
|
||||
import piniaPersistConfig from '@/stores/helper/persist'
|
||||
import { GLOBAL_STORE_KEY } from '@/stores/constant'
|
||||
|
||||
export const useGlobalStore = defineStore({
|
||||
id: GLOBAL_STORE_KEY,
|
||||
export const useGlobalStore = defineStore(GLOBAL_STORE_KEY, {
|
||||
// 修改默认值之后,需清除 localStorage 数据
|
||||
state: (): GlobalState => ({
|
||||
// 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns)
|
||||
layout: "transverse",
|
||||
layout: 'transverse',
|
||||
// element 组件大小
|
||||
assemblySize: "default",
|
||||
assemblySize: 'default',
|
||||
// 当前系统语言
|
||||
language: null,
|
||||
// 当前页面是否全屏
|
||||
@@ -42,14 +41,13 @@ export const useGlobalStore = defineStore({
|
||||
tabsIcon: true,
|
||||
// 页脚
|
||||
footer: false
|
||||
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// Set GlobalState
|
||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||
this.$patch({ [args[0]]: args[1] });
|
||||
this.$patch({ [args[0]]: args[1] })
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {KeepAliveState} from "@/stores/interface";
|
||||
import {KEEP_ALIVE_STORE_KEY} from '@/stores/constant'
|
||||
import { defineStore } from 'pinia'
|
||||
import { type KeepAliveState } from '@/stores/interface'
|
||||
import { KEEP_ALIVE_STORE_KEY } from '@/stores/constant'
|
||||
|
||||
export const useKeepAliveStore = defineStore({
|
||||
id: KEEP_ALIVE_STORE_KEY,
|
||||
export const useKeepAliveStore = defineStore(KEEP_ALIVE_STORE_KEY, {
|
||||
state: (): KeepAliveState => ({
|
||||
keepAliveName: []
|
||||
}),
|
||||
actions: {
|
||||
// Add KeepAliveName
|
||||
async addKeepAliveName(name: string) {
|
||||
!this.keepAliveName.includes(name) && this.keepAliveName.push(name);
|
||||
!this.keepAliveName.includes(name) && this.keepAliveName.push(name)
|
||||
},
|
||||
// Remove KeepAliveName
|
||||
async removeKeepAliveName(name: string) {
|
||||
this.keepAliveName = this.keepAliveName.filter(item => item !== name);
|
||||
this.keepAliveName = this.keepAliveName.filter(item => item !== name)
|
||||
},
|
||||
// Set KeepAliveName
|
||||
async setKeepAliveName(keepAliveName: string[] = []) {
|
||||
this.keepAliveName = keepAliveName;
|
||||
this.keepAliveName = keepAliveName
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
// src/stores/modules/mode.ts
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
// export const useModeStore = defineStore('mode', {
|
||||
// state: () => ({
|
||||
// currentMode: '' as string,
|
||||
// }),
|
||||
// actions: {
|
||||
// setCurrentMode(modeName: string) {
|
||||
// this.currentMode = modeName;
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useModeStore = defineStore('mode', {
|
||||
state: () => ({
|
||||
currentMode: localStorage.getItem('currentMode') || '' as string,
|
||||
currentMode: localStorage.getItem('currentMode') || ('' as string)
|
||||
}),
|
||||
actions: {
|
||||
setCurrentMode(modeName: string) {
|
||||
this.currentMode = modeName;
|
||||
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
|
||||
},
|
||||
},
|
||||
});
|
||||
this.currentMode = modeName
|
||||
localStorage.setItem('currentMode', modeName) // 保存到 localStorage
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export const useAppSceneStore = defineStore('scene', {
|
||||
state: () => ({
|
||||
|
||||
@@ -1,81 +1,77 @@
|
||||
import router from "@/routers";
|
||||
import { defineStore } from "pinia";
|
||||
import { getUrlWithParams } from "@/utils";
|
||||
import { useKeepAliveStore } from "./keepAlive";
|
||||
import { TabsState, TabsMenuProps } from "@/stores/interface";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {TABS_STORE_KEY} from "@/stores/constant";
|
||||
import router from '@/routers'
|
||||
import { defineStore } from 'pinia'
|
||||
import { getUrlWithParams } from '@/utils'
|
||||
import { useKeepAliveStore } from './keepAlive'
|
||||
import type { TabsMenuProps, TabsState } from '@/stores/interface'
|
||||
import { TABS_STORE_KEY } from '@/stores/constant'
|
||||
|
||||
const keepAliveStore = useKeepAliveStore();
|
||||
const keepAliveStore = useKeepAliveStore()
|
||||
|
||||
export const useTabsStore = defineStore({
|
||||
id: TABS_STORE_KEY,
|
||||
export const useTabsStore = defineStore(TABS_STORE_KEY, {
|
||||
state: (): TabsState => ({
|
||||
tabsMenuList: []
|
||||
}),
|
||||
actions: {
|
||||
// Add Tabs
|
||||
async addTabs(tabItem: TabsMenuProps) {
|
||||
|
||||
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
||||
if (tabItem?.unshift) {
|
||||
this.tabsMenuList.unshift(tabItem);
|
||||
}else{
|
||||
this.tabsMenuList.push(tabItem);
|
||||
|
||||
this.tabsMenuList.unshift(tabItem)
|
||||
} else {
|
||||
this.tabsMenuList.push(tabItem)
|
||||
}
|
||||
}
|
||||
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
||||
keepAliveStore.addKeepAliveName(tabItem.name);
|
||||
await keepAliveStore.addKeepAliveName(tabItem.name)
|
||||
}
|
||||
},
|
||||
// Remove Tabs
|
||||
async removeTabs(tabPath: string, isCurrent: boolean = true) {
|
||||
if (isCurrent) {
|
||||
this.tabsMenuList.forEach((item, index) => {
|
||||
if (item.path !== tabPath) return;
|
||||
const nextTab = this.tabsMenuList[index + 1] || this.tabsMenuList[index - 1];
|
||||
if (!nextTab) return;
|
||||
router.push(nextTab.path);
|
||||
});
|
||||
if (item.path !== tabPath) return
|
||||
const nextTab = this.tabsMenuList[index + 1] || this.tabsMenuList[index - 1]
|
||||
if (!nextTab) return
|
||||
router.push(nextTab.path)
|
||||
})
|
||||
}
|
||||
this.tabsMenuList = this.tabsMenuList.filter(item => item.path !== tabPath);
|
||||
this.tabsMenuList = this.tabsMenuList.filter(item => item.path !== tabPath)
|
||||
// remove keepalive
|
||||
const tabItem = this.tabsMenuList.find(item => item.path === tabPath);
|
||||
tabItem?.isKeepAlive && keepAliveStore.removeKeepAliveName(tabItem.name);
|
||||
const tabItem = this.tabsMenuList.find(item => item.path === tabPath)
|
||||
tabItem?.isKeepAlive && (await keepAliveStore.removeKeepAliveName(tabItem.name))
|
||||
},
|
||||
// Close Tabs On Side
|
||||
async closeTabsOnSide(path: string, type: "left" | "right") {
|
||||
const currentIndex = this.tabsMenuList.findIndex(item => item.path === path);
|
||||
async closeTabsOnSide(path: string, type: 'left' | 'right') {
|
||||
const currentIndex = this.tabsMenuList.findIndex(item => item.path === path)
|
||||
if (currentIndex !== -1) {
|
||||
const range = type === "left" ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length];
|
||||
const range = type === 'left' ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length]
|
||||
this.tabsMenuList = this.tabsMenuList.filter((item, index) => {
|
||||
return index < range[0] || index >= range[1] || !item.close;
|
||||
});
|
||||
return index < range[0] || index >= range[1] || !item.close
|
||||
})
|
||||
}
|
||||
// set keepalive
|
||||
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
|
||||
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name));
|
||||
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive)
|
||||
await keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name))
|
||||
},
|
||||
// Close MultipleTab
|
||||
async closeMultipleTab(tabsMenuValue?: string) {
|
||||
this.tabsMenuList = this.tabsMenuList.filter(item => {
|
||||
return item.path === tabsMenuValue || !item.close;
|
||||
});
|
||||
return item.path === tabsMenuValue || !item.close
|
||||
})
|
||||
// set keepalive
|
||||
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
|
||||
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name));
|
||||
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive)
|
||||
await keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.name))
|
||||
},
|
||||
// Set Tabs
|
||||
async setTabs(tabsMenuList: TabsMenuProps[]) {
|
||||
this.tabsMenuList = tabsMenuList;
|
||||
this.tabsMenuList = tabsMenuList
|
||||
},
|
||||
// Set Tabs Title
|
||||
async setTabsTitle(title: string) {
|
||||
this.tabsMenuList.forEach(item => {
|
||||
if (item.path == getUrlWithParams()) item.title = title;
|
||||
});
|
||||
if (item.path == getUrlWithParams()) item.title = title
|
||||
})
|
||||
}
|
||||
}
|
||||
// persist: piniaPersistConfig(TABS_STORE_KEY)
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,36 +1,57 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {UserState} from "@/stores/interface";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {USER_STORE_KEY} from "@/stores/constant";
|
||||
import { defineStore } from 'pinia'
|
||||
import { type UserState } from '@/stores/interface'
|
||||
import piniaPersistConfig from '@/stores/helper/persist'
|
||||
import { USER_STORE_KEY } from '@/stores/constant'
|
||||
import { logoutApi } from '@/api/user/login'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
|
||||
export const useUserStore = defineStore({
|
||||
id: USER_STORE_KEY,
|
||||
export const useUserStore = defineStore(USER_STORE_KEY, {
|
||||
state: (): UserState => ({
|
||||
accessToken: "",
|
||||
refreshToken: "",
|
||||
isRefreshToken:false,
|
||||
accessToken: '',
|
||||
refreshToken: '',
|
||||
isRefreshToken: false,
|
||||
exp: Number(0),
|
||||
userInfo: {id:"", name: "" ,loginName:""},
|
||||
userInfo: { id: '', name: '', loginName: '' }
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// Set Token
|
||||
setAccessToken(accessToken: string) {
|
||||
this.accessToken = accessToken;
|
||||
this.accessToken = accessToken
|
||||
},
|
||||
setRefreshToken(refreshToken: string) {
|
||||
this.refreshToken = refreshToken;
|
||||
this.refreshToken = refreshToken
|
||||
},
|
||||
setIsRefreshToken(isRefreshToken: boolean) {
|
||||
this.isRefreshToken = isRefreshToken;
|
||||
this.isRefreshToken = isRefreshToken
|
||||
},
|
||||
// Set setUserInfo
|
||||
setUserInfo(userInfo: UserState["userInfo"]) {
|
||||
this.userInfo = userInfo;
|
||||
setUserInfo(userInfo: UserState['userInfo']) {
|
||||
this.userInfo = userInfo
|
||||
},
|
||||
setExp(exp: number) {
|
||||
this.exp = exp;
|
||||
this.exp = exp
|
||||
},
|
||||
async logout() {
|
||||
const authStore = useAuthStore()
|
||||
const modeStore = useModeStore()
|
||||
const appSceneStore = useAppSceneStore()
|
||||
const dictStore = useDictStore()
|
||||
// 1.执行退出登录接口
|
||||
await logoutApi()
|
||||
// 2.清除 Token
|
||||
this.setAccessToken('')
|
||||
this.setRefreshToken('')
|
||||
this.setExp(0)
|
||||
this.setUserInfo({ id: '', name: '', loginName: '' })
|
||||
this.setIsRefreshToken(false)
|
||||
dictStore.setDictData([])
|
||||
modeStore.setCurrentMode('')
|
||||
appSceneStore.setCurrentMode('')
|
||||
await authStore.resetAuthStore()
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(USER_STORE_KEY),
|
||||
});
|
||||
persist: piniaPersistConfig(USER_STORE_KEY)
|
||||
})
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
:default-checked-keys="checkedKeysRef"
|
||||
ref="treeRef"
|
||||
>
|
||||
|
||||
</el-tree>
|
||||
|
||||
</el-form>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:prevent-scrolling="true" :fit-view="true" :min-zoom="1" :max-zoom="1"
|
||||
:nodesConnectable="checkStore.nodesConnectable" :elements-selectable="false" auto-connect
|
||||
@connect="handleConnect" @connect-start="handleConnectStart" @connect-end="handleConnectEnd"
|
||||
@pane-ready="onPaneReady" v-on:pane-mouse-move="false"></VueFlow>
|
||||
@pane-ready="onPaneReady" @node-double-click="handleNodeDoubleClick" v-on:pane-mouse-move="false"></VueFlow>
|
||||
</div>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
@@ -35,6 +35,8 @@ import { ElMessage, stepProps } from 'element-plus'
|
||||
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
|
||||
import { jwtUtil } from '@/utils/jwtUtil'
|
||||
import { useCheckStore } from '@/stores/modules/check'
|
||||
import { ipc } from '@/utils/ipcRenderer'
|
||||
import { fa, tr } from 'element-plus/es/locale'
|
||||
const vueFlowElement = ref(442)
|
||||
const checkStore = useCheckStore()
|
||||
const dialogVisible = ref(false)
|
||||
@@ -67,19 +69,151 @@ const prop = defineProps({
|
||||
const dialogHeight = ref(600)
|
||||
|
||||
// 初始化 VueFlow,注册自定义连线类型
|
||||
const { edges, setViewport } = useVueFlow({
|
||||
const { edges, setViewport,removeEdges } = useVueFlow({
|
||||
edgeTypes: {
|
||||
default: CustomEdge
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const handleNodeDoubleClick = (event: any) => {
|
||||
const { node } = event
|
||||
|
||||
// 判断节点类型
|
||||
if (node.type === 'input') {
|
||||
// 被检通道节点,检查是否已经连接
|
||||
const isConnected = edges.value.some(edge => edge.source === node.id)
|
||||
|
||||
if (isConnected) {
|
||||
ElMessage.warning('该被检通道已经连接,不能重复连接')
|
||||
return
|
||||
}
|
||||
|
||||
// 寻找未连接的标准通道节点(优先寻找未被连接的标准通道)
|
||||
const targetNodes = nodes.value.filter(n => n.type === 'output')
|
||||
|
||||
// 首先尝试连接尚未被连接的标准通道
|
||||
for (const targetNode of targetNodes) {
|
||||
const isTargetConnected = edges.value.some(edge => edge.target === targetNode.id)
|
||||
|
||||
if (!isTargetConnected) {
|
||||
// 检查是否已存在连接(虽然这里应该不会存在)
|
||||
const isAlreadyConnected = edges.value.some(edge =>
|
||||
edge.source === node.id && edge.target === targetNode.id
|
||||
)
|
||||
|
||||
if (!isAlreadyConnected) {
|
||||
const newEdge = {
|
||||
id: `edge-${node.id}-${targetNode.id}`,
|
||||
source: node.id,
|
||||
target: targetNode.id,
|
||||
type: 'default'
|
||||
}
|
||||
edges.value.push(newEdge)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果所有标准通道都已被连接,尝试连接已被连接但连接的是其他被检通道的标准通道
|
||||
for (const targetNode of targetNodes) {
|
||||
// 检查是否已存在连接
|
||||
const isAlreadyConnected = edges.value.some(edge =>
|
||||
edge.source === node.id && edge.target === targetNode.id
|
||||
)
|
||||
|
||||
if (!isAlreadyConnected) {
|
||||
const isTargetConnected = edges.value.some(edge => edge.target === targetNode.id)
|
||||
|
||||
// 如果标准通道已被连接,但不是连接到当前被检通道,则不能连接
|
||||
if (isTargetConnected) {
|
||||
continue
|
||||
}
|
||||
|
||||
const newEdge = {
|
||||
id: `edge-${node.id}-${targetNode.id}`,
|
||||
source: node.id,
|
||||
target: targetNode.id,
|
||||
type: 'default'
|
||||
}
|
||||
edges.value.push(newEdge)
|
||||
ElMessage.success(`已自动连接到 ${targetNode.data.label.children[1].children[0].children[0].replace('设备名称:', '')} 的标准通道`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ElMessage.warning('没有可用的标准通道进行连接')
|
||||
} else if (node.type === 'output') {
|
||||
// 标准通道节点,检查是否已经连接
|
||||
const isConnected = edges.value.some(edge => edge.target === node.id)
|
||||
|
||||
if (isConnected) {
|
||||
ElMessage.warning('该标准通道已经连接,不能重复连接')
|
||||
return
|
||||
}
|
||||
|
||||
// 寻找未连接的被检通道节点(优先寻找未被连接的被检通道)
|
||||
const sourceNodes = nodes.value.filter(n => n.type === 'input')
|
||||
|
||||
// 首先尝试连接尚未被连接的被检通道
|
||||
for (const sourceNode of sourceNodes) {
|
||||
const isSourceConnected = edges.value.some(edge => edge.source === sourceNode.id)
|
||||
|
||||
if (!isSourceConnected) {
|
||||
// 检查是否已存在连接(虽然这里应该不会存在)
|
||||
const isAlreadyConnected = edges.value.some(edge =>
|
||||
edge.source === sourceNode.id && edge.target === node.id
|
||||
)
|
||||
|
||||
if (!isAlreadyConnected) {
|
||||
const newEdge = {
|
||||
id: `edge-${sourceNode.id}-${node.id}`,
|
||||
source: sourceNode.id,
|
||||
target: node.id,
|
||||
type: 'default'
|
||||
}
|
||||
edges.value.push(newEdge)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果所有被检通道都已被连接,尝试连接已被连接但连接的是其他标准通道的被检通道
|
||||
for (const sourceNode of sourceNodes) {
|
||||
// 检查是否已存在连接
|
||||
const isAlreadyConnected = edges.value.some(edge =>
|
||||
edge.source === sourceNode.id && edge.target === node.id
|
||||
)
|
||||
|
||||
if (!isAlreadyConnected) {
|
||||
const isSourceConnected = edges.value.some(edge => edge.source === sourceNode.id)
|
||||
|
||||
// 如果被检通道已被连接,但不是连接到当前标准通道,则不能连接
|
||||
if (isSourceConnected) {
|
||||
continue
|
||||
}
|
||||
|
||||
const newEdge = {
|
||||
id: `edge-${sourceNode.id}-${node.id}`,
|
||||
source: sourceNode.id,
|
||||
target: node.id,
|
||||
type: 'default'
|
||||
}
|
||||
edges.value.push(newEdge)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ElMessage.warning('没有可用的被检通道进行连接')
|
||||
}
|
||||
}
|
||||
// 初始化时锁定画布位置
|
||||
const onPaneReady = () => {
|
||||
setViewport({ x: 0, y: 0, zoom: 1 })
|
||||
}
|
||||
|
||||
// 提取公共的label渲染函数
|
||||
const createLabel = (text: string, type: string, Key: number) => {
|
||||
const createLabel = (device:any, Key: number) => {
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
@@ -117,7 +251,13 @@ const createLabel = (text: string, type: string, Key: number) => {
|
||||
// filter: 'invert(35%) sepia(65%) saturate(300%) hue-rotate(210deg)'
|
||||
}
|
||||
}),
|
||||
h('div', { style: { textAlign: 'left' } }, ['设备名称:' + text, h('br'), '设备类型:' + type])
|
||||
h('div', { style: { textAlign: 'left' } }, ['设备名称:' + device.name,
|
||||
h('br'),
|
||||
'设备类型:' + device.deviceType,
|
||||
h('br'),
|
||||
'Ip地址:' + device.ip,
|
||||
|
||||
])
|
||||
// h('div', null, '设备名称:' + text),
|
||||
// h('div', null, '设备类型:' + type)
|
||||
]
|
||||
@@ -155,50 +295,125 @@ const createLabel3 = (text: string) => {
|
||||
|
||||
const handleConnectStart = (params: any) => {
|
||||
onPaneReady()
|
||||
|
||||
}
|
||||
|
||||
// const handleConnectEnd = (params: any) => {
|
||||
// console.log('handleConnectEnd',edges.value,edges.value.length)
|
||||
// onPaneReady()
|
||||
// }
|
||||
|
||||
// const handleConnect = (params: any) => {
|
||||
// const sourceNode = nodes.value.find(node => node.id === params.source)
|
||||
// const targetNode = nodes.value.find(node => node.id === params.target)
|
||||
// const isValidConnection = sourceNode?.type === 'input' && targetNode?.type === 'output'
|
||||
// if (!isValidConnection) {
|
||||
// removeEdge(params)
|
||||
// ElMessage.warning('只能从被检通道连接到标准通道')
|
||||
// return
|
||||
// }
|
||||
|
||||
|
||||
// // 过滤掉当前连接,检查是否还有重复的
|
||||
// const existingEdges = edges.value.filter(edge => edge.source === params.source || edge.target === params.target)
|
||||
|
||||
// // 如果同源或同目标的连接超过1个,说明有重复
|
||||
// if (existingEdges.length > 1) {
|
||||
// const duplicateSource = existingEdges.filter(edge => edge.source === params.source).length > 1
|
||||
// const duplicateTarget = existingEdges.filter(edge => edge.target === params.target).length > 1
|
||||
|
||||
// if (duplicateSource) {
|
||||
// removeEdge(params)
|
||||
// ElMessage.warning('该被检通道已经连接,不能重复连接')
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (duplicateTarget) {
|
||||
// removeEdge(params)
|
||||
// ElMessage.warning('该标准通道已经连接,不能重复连接')
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 删除不合法连接
|
||||
// const removeEdge = (params: any) => {
|
||||
// // console.log('删除不合法连接:', params);
|
||||
// // console.log('删除连接信息:', edges.value);
|
||||
// // console.log('11111===', edges.value.length);
|
||||
// const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
|
||||
// console.log('删除连接索引:', edgeIndex);
|
||||
// if (edgeIndex !== -1) {
|
||||
// edges.value.splice(edgeIndex , 1)
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// 添加一个响应式变量来存储需要删除的连接信息
|
||||
const pendingRemoveEdge = ref<any>(null)
|
||||
|
||||
const handleConnectEnd = (params: any) => {
|
||||
// 在连接结束时检查是否有待删除的连接
|
||||
if (pendingRemoveEdge.value) {
|
||||
removeEdge(pendingRemoveEdge.value)
|
||||
pendingRemoveEdge.value = null // 清空待删除连接
|
||||
}
|
||||
|
||||
onPaneReady()
|
||||
}
|
||||
|
||||
const handleConnect = (params: any) => {
|
||||
const sourceNode = nodes.value.find(node => node.id === params.source)
|
||||
const targetNode = nodes.value.find(node => node.id === params.target)
|
||||
|
||||
// 连接规则验证
|
||||
const isValidConnection = sourceNode?.type === 'input' && targetNode?.type === 'output'
|
||||
|
||||
if (!isValidConnection) {
|
||||
removeEdge(params)
|
||||
// 设置待删除连接而不是立即删除
|
||||
pendingRemoveEdge.value = params
|
||||
ElMessage.warning('只能从被检通道连接到标准通道')
|
||||
return
|
||||
}
|
||||
|
||||
// 过滤掉当前连接,检查是否还有重复的
|
||||
const existingEdges = edges.value.filter(edge => edge.source === params.source || edge.target === params.target)
|
||||
// 检查是否已经存在完全相同的连接(精确匹配源和目标)
|
||||
const isAlreadyConnected = edges.value.some(edge =>
|
||||
edge.source === params.source && edge.target === params.target
|
||||
)
|
||||
|
||||
// 如果同源或同目标的连接超过1个,说明有重复
|
||||
if (existingEdges.length > 1) {
|
||||
const duplicateSource = existingEdges.filter(edge => edge.source === params.source).length > 1
|
||||
const duplicateTarget = existingEdges.filter(edge => edge.target === params.target).length > 1
|
||||
if (isAlreadyConnected) {
|
||||
// 设置待删除连接而不是立即删除
|
||||
pendingRemoveEdge.value = params
|
||||
ElMessage.warning('这两个通道已经连接,不能重复连接')
|
||||
return
|
||||
}
|
||||
|
||||
if (duplicateSource) {
|
||||
removeEdge(params)
|
||||
// 检查源节点是否已经被连接(一个被检通道只能连接一个标准通道)
|
||||
const isSourceConnected = edges.value.some(edge => edge.source === params.source)
|
||||
if (isSourceConnected) {
|
||||
// 设置待删除连接而不是立即删除
|
||||
pendingRemoveEdge.value = params
|
||||
ElMessage.warning('该被检通道已经连接,不能重复连接')
|
||||
return
|
||||
}
|
||||
|
||||
if (duplicateTarget) {
|
||||
removeEdge(params)
|
||||
// 检查目标节点是否已经被连接(一个标准通道只能连接一个被检通道)
|
||||
const isTargetConnected = edges.value.some(edge => edge.target === params.target)
|
||||
if (isTargetConnected) {
|
||||
// 设置待删除连接而不是立即删除
|
||||
pendingRemoveEdge.value = params
|
||||
ElMessage.warning('该标准通道已经连接,不能重复连接')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有问题,清空待删除连接
|
||||
pendingRemoveEdge.value = null
|
||||
}
|
||||
|
||||
// 删除不合法连接
|
||||
const removeEdge = (params: any) => {
|
||||
const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
|
||||
|
||||
if (edgeIndex !== -1) {
|
||||
edges.value.splice(edgeIndex, 1)
|
||||
}
|
||||
@@ -211,10 +426,10 @@ const standardDevIds = ref<string[]>()
|
||||
|
||||
const open = async () => {
|
||||
edges.value = []
|
||||
|
||||
devIds.value = prop.devIdList.map(d => d.id)
|
||||
standardDevIds.value = prop.pqStandardDevList.map(d => d.id)
|
||||
planId.value = prop.planIdKey
|
||||
|
||||
nodes.value = createNodes(prop.devIdList, prop.pqStandardDevList, prop.deviceMonitor)
|
||||
dialogVisible.value = true
|
||||
onPaneReady()
|
||||
@@ -342,21 +557,21 @@ const generateChannelMapping = () => {
|
||||
|
||||
|
||||
// 计算基于 dialogWidth 的位置参数 - 确保最小距离
|
||||
const deviceWidthVal = computed(() => {
|
||||
const standardWidthVal = computed(() => {
|
||||
return Math.max(0, 50)
|
||||
})
|
||||
})
|
||||
|
||||
const inputChannelXVal = computed(() => {
|
||||
return Math.max(300, deviceWidthVal.value + 300)
|
||||
})
|
||||
const inputChannelXVal = computed(() => {
|
||||
return Math.max(300, standardWidthVal.value + 300)
|
||||
})
|
||||
|
||||
const outputChannelXVal = computed(() => {
|
||||
return Math.max(650, prop.dialogWidth - 470)
|
||||
})
|
||||
const outputChannelXVal = computed(() => {
|
||||
return Math.max(600, prop.dialogWidth - 500)
|
||||
})
|
||||
|
||||
const standardWidthVal = computed(() => {
|
||||
const deviceWidthVal = computed(() => {
|
||||
return Math.max(800, prop.dialogWidth - 350)
|
||||
})
|
||||
})
|
||||
|
||||
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[], deviceMonitor: Map<string, any[]>) => {
|
||||
const channelCounts: Record<string, number> = {}
|
||||
@@ -368,9 +583,12 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
type: 'normal',
|
||||
deviceType: d.devType
|
||||
deviceType: d.devType,
|
||||
ip: d.ip,
|
||||
monitorResults:d.monitorResults
|
||||
}))
|
||||
|
||||
|
||||
const channelCounts2: Record<string, number> = {}
|
||||
standardDev.forEach(dev => {
|
||||
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
|
||||
@@ -381,7 +599,8 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
type: 'normal',
|
||||
deviceType: d.devType
|
||||
deviceType: d.devType,
|
||||
ip: d.ip
|
||||
}))
|
||||
|
||||
const newNodes: any[] = []
|
||||
@@ -392,10 +611,10 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
// const inputChannelX = 350
|
||||
// const outputChannelX = 1050
|
||||
// const standardWidth = 1170
|
||||
const deviceWidth = deviceWidthVal.value
|
||||
const inputChannelX = inputChannelXVal.value
|
||||
const outputChannelX = outputChannelXVal.value
|
||||
const standardWidth = standardWidthVal.value
|
||||
const outputChannelX = inputChannelXVal.value
|
||||
const inputChannelX = outputChannelXVal.value
|
||||
const deviceWidth = deviceWidthVal.value
|
||||
|
||||
// 添加被检通道
|
||||
// let currentYPosition = 50; // 初始Y位置
|
||||
@@ -413,6 +632,12 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
Object.entries(channelCounts).forEach(([deviceId, count]) => {
|
||||
// 从deviceMonitor中获取实际通道信息
|
||||
let actualChannels = []; // 存储实际的通道号
|
||||
let deviceMonitorResults: number[] = []; // 存储该设备的监控结果
|
||||
// 获取该设备的monitorResults
|
||||
const deviceInfo = inspectionDevices.find(d => d.id === deviceId);
|
||||
if (deviceInfo && deviceInfo.monitorResults) {
|
||||
deviceMonitorResults = deviceInfo.monitorResults;
|
||||
}
|
||||
|
||||
// 如果deviceMonitor中有该设备的数据,则使用实际监测点信息
|
||||
if (deviceMonitor.has(deviceId)) {
|
||||
@@ -429,13 +654,24 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
// 遍历实际通道号而不是连续的数字
|
||||
actualChannels.forEach((channelNum, index) => {
|
||||
const channelId = `被检通道-${deviceId}-${channelNum}`;
|
||||
const channelResult = deviceMonitorResults[index]
|
||||
|
||||
let statusText = '';
|
||||
if (channelResult === 0) {
|
||||
statusText = '(不符合)';
|
||||
} else if (channelResult === 1) {
|
||||
statusText = '(符合)';
|
||||
} else if (channelResult === 2) {
|
||||
statusText = '(未检)';
|
||||
}
|
||||
|
||||
newNodes.push({
|
||||
id: channelId,
|
||||
type: 'input',
|
||||
data: { label: createLabel3(`被检通道${channelNum}`) },
|
||||
data: { label: createLabel3(`被检通道${channelNum}`+ statusText) },
|
||||
position: { x: inputChannelX, y: yPosition + index * 50 },
|
||||
sourcePosition: 'right',
|
||||
style: { width: '120px', border: 'none', boxShadow: 'none' }
|
||||
sourcePosition: 'left',
|
||||
style: { width: '160px', border: 'none', boxShadow: 'none' }
|
||||
});
|
||||
|
||||
deviceChannelGroups.push({
|
||||
@@ -470,7 +706,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
type: 'output',
|
||||
data: { label: createLabel3(`标准通道${i}`) },
|
||||
position: { x: outputChannelX, y: yPosition2 + (i - 1) * 50 },
|
||||
targetPosition: 'left',
|
||||
targetPosition: 'right',
|
||||
style: { width: '120px', border: 'none', boxShadow: 'none' }
|
||||
});
|
||||
|
||||
@@ -508,7 +744,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
const deviceCenterY = deviceCurrentYPosition + (actualChannelCount * 50) / 2 - 50
|
||||
newNodes.push({
|
||||
id: device.id,
|
||||
data: { label: createLabel(device.name, device.deviceType, 1) },
|
||||
data: { label: createLabel(device, 1) },
|
||||
position: { x: deviceWidth, y: deviceCenterY },
|
||||
class: 'no-handle-node',
|
||||
style: { width: '300px', border: 'none', boxShadow: 'none' }
|
||||
@@ -539,7 +775,7 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
|
||||
const deviceCenterY = standardDeviceCurrentYPosition + (channelCount * 50) / 2 - 50
|
||||
newNodes.push({
|
||||
id: device.id,
|
||||
data: { label: createLabel(device.name, device.deviceType, 2) },
|
||||
data: { label: createLabel(device, 2) },
|
||||
position: { x: standardWidth, y: deviceCenterY },
|
||||
class: 'no-handle-node',
|
||||
style: { width: '300px', border: 'none', boxShadow: 'none' }
|
||||
|
||||
@@ -11,13 +11,7 @@
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
||||
|
||||
<el-table-column prop="dataA" :label="'被检设备'">
|
||||
<el-table-column prop="timeDev" label="数据时间" width="200"/>
|
||||
<el-table-column prop="uaDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaDev != null"/>
|
||||
<el-table-column prop="ubDev" :label="setB+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ubDev != null"/>
|
||||
<el-table-column prop="ucDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucDev != null"/>
|
||||
<el-table-column prop="utDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utDev != null"/>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="dataA" :label="'标准设备'">
|
||||
<el-table-column prop="timeStdDev" label="数据时间" width="200"/>
|
||||
<el-table-column prop="uaStdDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaStdDev != null"/>
|
||||
@@ -25,6 +19,13 @@
|
||||
<el-table-column prop="ucStdDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucStdDev != null"/>
|
||||
<el-table-column prop="utStdDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utStdDev != null"/>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dataA" :label="'被检设备'">
|
||||
<el-table-column prop="timeDev" label="数据时间" width="200"/>
|
||||
<el-table-column prop="uaDev" :label="'A相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.uaDev != null"/>
|
||||
<el-table-column prop="ubDev" :label="setB+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ubDev != null"/>
|
||||
<el-table-column prop="ucDev" :label="'C相'+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData.length==0||prop.tableData[0]?.ucDev != null"/>
|
||||
<el-table-column prop="utDev" :label="setT+(outerUnit==''?'':'('+outerUnit+')')" v-if="prop.tableData[0]?.utDev != null"/>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -8,16 +8,17 @@
|
||||
>
|
||||
<!-- <el-table-column type="index" label="序号" width="70" fixed="left" />-->
|
||||
<el-table-column label="A相" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataA">
|
||||
<el-table-column prop="stdA" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataA.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="dataA" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataA.resultData }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stdA" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataA.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isDataA" label="检测结果">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
@@ -35,16 +36,17 @@
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column :label="setB" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataB">
|
||||
<el-table-column prop="stdB" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataB.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="dataB" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataB.resultData }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stdB" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataB.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isDataB" label="检测结果">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
@@ -62,16 +64,17 @@
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="C相" v-if="prop.tableData.length==0|| prop.tableData[0]?.dataC">
|
||||
<el-table-column prop="stdC" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataC.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="dataC" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataC.resultData }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stdC" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataC.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isDataC" label="检测结果">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
@@ -89,15 +92,16 @@
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column :label="setT" v-if="prop.tableData[0].dataT">
|
||||
<el-table-column prop="stdT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataT.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="dataT" :label="'标准值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataT.resultData }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stdT" :label="'被检值'+(outerUnit==''?'':'('+outerUnit+')')">
|
||||
<template #default="{ row }">
|
||||
{{ row.dataT.data }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isDataT" label="检测结果">
|
||||
<template #default="{ row }">
|
||||
|
||||
@@ -72,7 +72,17 @@
|
||||
node-key="id"
|
||||
ref="treeRef"
|
||||
@node-click="handleNodeClick"
|
||||
></el-tree>
|
||||
class="custom-tree"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<span v-if="data.resultFlag === 1">{{ node.label }}</span>
|
||||
<span v-else-if="data.resultFlag === 2" style="color: #ee6666;">{{ node.label }}</span>
|
||||
<span v-else-if="data.resultFlag === 4" style="color: #fac858;">{{ node.label }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</el-tree>
|
||||
</div>
|
||||
<div class="content-right">
|
||||
<div class="content-right-title">
|
||||
@@ -90,7 +100,13 @@
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
>
|
||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||
<span v-if="item.resultFlag === 1" >{{ item.label }}</span>
|
||||
<span v-else-if="item.resultFlag === 2" style="color: #ee6666;">{{ item.label }}</span>
|
||||
<span v-else-if="item.resultFlag === 4" style="color: #fac858;">{{ item.label }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!-- 否则显示原来的文本 -->
|
||||
<span v-else style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
|
||||
@@ -122,6 +138,7 @@
|
||||
:label="item.replace(/\.0$/, '')"
|
||||
:value="item"
|
||||
/>
|
||||
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@@ -200,7 +217,7 @@ const selectedScriptName = ref('')
|
||||
const pattern = ref('')
|
||||
// 添加以下内容
|
||||
const isWaveData = ref(false)
|
||||
const scriptNameOptions = ref<{ label: string; value: string }[]>([])
|
||||
const scriptNameOptions = ref<{ label: string; value: string;resultFlag:number }[]>([])
|
||||
|
||||
// 表单数据
|
||||
const formContent = reactive<CheckData.DataCheck>({
|
||||
@@ -280,7 +297,8 @@ const initGetResult = async () => {
|
||||
// 设置录波数据相关的选项
|
||||
scriptNameOptions.value = selectScript.value.map(item => ({
|
||||
label: item.scriptName,
|
||||
value: item.scriptName
|
||||
value: item.scriptName,
|
||||
resultFlag: item.resultFlag?? 0
|
||||
}))
|
||||
|
||||
// 默认选中第一个选项
|
||||
@@ -304,7 +322,8 @@ const initScriptData = async () => {
|
||||
let response: any = await getScriptList({
|
||||
devId: formContent.deviceId,
|
||||
chnNum: formContent.chnNum,
|
||||
num: formContent.num
|
||||
num: formContent.num,
|
||||
planId: checkStore.plan.id
|
||||
})
|
||||
|
||||
// 格式化脚本数据
|
||||
@@ -327,7 +346,8 @@ const initScriptData = async () => {
|
||||
temp2 = luoboItem.subItems.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
scriptName: item.scriptName
|
||||
scriptName: item.scriptName,
|
||||
resultFlag: item.resultFlag ?? 0 // 假设默认值为 0
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -458,7 +478,8 @@ const handleNodeClick = (data: any) => {
|
||||
//.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
|
||||
.map(item => ({
|
||||
label: item.scriptName,
|
||||
value: item.scriptName
|
||||
value: item.scriptName,
|
||||
resultFlag: item.resultFlag ?? 0
|
||||
}))
|
||||
|
||||
// 每次选中录波数据时都重置为第一个选项并触发getResults
|
||||
@@ -573,6 +594,27 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.custom-tree {
|
||||
:deep(.el-tree-node__content) {
|
||||
.custom-tree-node {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// 根据 resultFlag 设置不同颜色
|
||||
|
||||
&[data-result-flag="2"] {
|
||||
color: #ee6666; // 红色 - 不符合
|
||||
}
|
||||
|
||||
&[data-result-flag="4"] {
|
||||
color: #fac858; // 橙色 - 警告
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
finish-status="success">
|
||||
<el-step :status="step1" title="设备通讯校验"/>
|
||||
<el-step :status="step2" title="模型一致性校验"/>
|
||||
<el-step :status="step3" title="实时数据对齐验证" v-if="!props.onlyWave"/>
|
||||
<el-step :status="step3" title="数据对齐验证" v-if="!props.onlyWave"/>
|
||||
<el-step :status="step4" title="相序校验"/>
|
||||
<!-- <el-step :status="step6" title="遥控录波功能验证"/> -->
|
||||
<el-step :status="step5" :title="ts === 'error'? '检测失败':ts === 'process'? '检测中':ts === 'success'? '检测成功':'待检测'"/>
|
||||
@@ -41,7 +41,7 @@
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="3" v-if="!props.onlyWave">
|
||||
<template #title>
|
||||
实时数据对齐验证
|
||||
数据对齐验证
|
||||
<el-icon class="title-icon" @click="openDialog" v-if="isShowDialog"><InfoFilled/></el-icon>
|
||||
</template>
|
||||
<div class="div-log">
|
||||
@@ -124,7 +124,7 @@ const activeIndex = ref(0)
|
||||
const activeTotalNum = computed(() => {
|
||||
let count = 4; // 基础步骤数:设备通讯校验、模型一致性校验、相序校验、最终状态
|
||||
if (props.onlyWave) {
|
||||
count++; // 添加实时数据对齐验证步骤
|
||||
count++; // 添加数据对齐验证步骤
|
||||
}
|
||||
return count;
|
||||
});
|
||||
@@ -149,7 +149,7 @@ const detectionOptions = ref([
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "实时数据对齐验证",
|
||||
name: "数据对齐验证",
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
@@ -282,6 +282,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
type: 'error',
|
||||
log: '录波校验时,设备连接异常!',
|
||||
});
|
||||
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
@@ -291,10 +292,12 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
type: 'error',
|
||||
log: newValue.data,
|
||||
})
|
||||
|
||||
} else if (newValue.code == 25003) { //最终失败
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step5.value = 'error'
|
||||
|
||||
}
|
||||
break;
|
||||
case 'yjc_mxyzxjy':
|
||||
@@ -354,7 +357,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
if(newValue.code == 10550){
|
||||
step3InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '实时数据对齐时,设备连接异常!',
|
||||
log: '数据对齐时,设备连接异常!',
|
||||
});
|
||||
step3.value = 'error'
|
||||
ts.value = 'error'
|
||||
@@ -560,6 +563,7 @@ watch(ts, function (newValue, oldValue) {
|
||||
|
||||
// 定义一个初始化参数的方法
|
||||
function initializeParameters() {
|
||||
collapseActiveName.value = '1'
|
||||
activeIndex.value = 0
|
||||
step1.value = 'wait'
|
||||
step2.value = 'wait'
|
||||
@@ -592,7 +596,7 @@ function initializeParameters() {
|
||||
},
|
||||
]
|
||||
|
||||
// 清空实时数据对齐验证的数据
|
||||
// 清空数据对齐验证的数据
|
||||
|
||||
testDataStructure.value = {}
|
||||
isShowDialog.value = false
|
||||
|
||||
@@ -285,7 +285,7 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
startData.value = new Date()
|
||||
timeDifference.value = 0
|
||||
} else if (newValue == 'error') {
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -300,13 +300,14 @@ watch(
|
||||
break
|
||||
case 25002:
|
||||
setLogList('error', newValue.data)
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 25003:
|
||||
ElMessageBox.alert('录波数据异常!', {
|
||||
ElMessageBox.alert('录波数据异常!','检测失败',{
|
||||
confirmButtonText: '确定',
|
||||
type: 'error'
|
||||
})
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 25001: {
|
||||
// 当录波校验完成时,更新录波项目的按钮状态
|
||||
@@ -345,7 +346,7 @@ watch(
|
||||
}
|
||||
// 触发响应式更新
|
||||
checkResult.splice(0, 0)
|
||||
stopTimeCount()
|
||||
stopTimeCount(1)
|
||||
updatePercentage()
|
||||
break
|
||||
}
|
||||
@@ -355,13 +356,14 @@ watch(
|
||||
switch (newValue.code) {
|
||||
case 25002:
|
||||
setLogList('error', newValue.data)
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 25003:
|
||||
ElMessageBox.alert('闪变收集失败!', {
|
||||
ElMessageBox.alert('闪变收集失败!','检测失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error'
|
||||
})
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 25001: {
|
||||
// 当录波校验完成时,更新录波项目的按钮状态
|
||||
@@ -394,7 +396,7 @@ watch(
|
||||
}
|
||||
// 触发响应式更新
|
||||
checkResult.splice(0, 0)
|
||||
stopTimeCount()
|
||||
stopTimeCount(1)
|
||||
updatePercentage()
|
||||
break
|
||||
}
|
||||
@@ -412,18 +414,19 @@ watch(
|
||||
device.chnResult.fill(CheckData.ChnCheckResultEnum.UNKNOWN)
|
||||
})
|
||||
}
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
}
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case 'Contrast_Dev':
|
||||
setLogList('error', '设备服务端连接失败!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
}
|
||||
break
|
||||
case 'unknown_operate':
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 'error_flow_end':
|
||||
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
||||
@@ -431,7 +434,7 @@ watch(
|
||||
type: 'error'
|
||||
})
|
||||
setLogList('error', '当前流程存在异常结束!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 'socket_timeout':
|
||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||
@@ -439,7 +442,7 @@ watch(
|
||||
type: 'error'
|
||||
})
|
||||
setLogList('error', '设备连接异常,请检查设备连接情况!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 'server_error':
|
||||
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
||||
@@ -447,7 +450,7 @@ watch(
|
||||
type: 'error'
|
||||
})
|
||||
setLogList('error', '服务端主动关闭连接!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 'device_error':
|
||||
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
||||
@@ -455,12 +458,12 @@ watch(
|
||||
type: 'error'
|
||||
})
|
||||
setLogList('error', '设备主动关闭连接!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
case 'yjc_xyjy' :
|
||||
if(newValue.code == 10550){
|
||||
setLogList('error', '协议校验时,设备连接异常!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
}
|
||||
if (newValue.code == 10552) {
|
||||
ElMessageBox.alert('重复的初始化操作!', '检测失败', {
|
||||
@@ -468,7 +471,7 @@ watch(
|
||||
type: 'error',
|
||||
})
|
||||
setLogList('error', '重复的初始化操作!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
}
|
||||
break;
|
||||
case 'yjc_sbtxjy' :
|
||||
@@ -478,7 +481,7 @@ watch(
|
||||
type: 'error',
|
||||
})
|
||||
setLogList('error', '重复的初始化操作!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -509,15 +512,12 @@ watch(
|
||||
// 失败
|
||||
if (newValue.data != undefined) return
|
||||
setLogList('error', str + '失败!')
|
||||
emit('update:testStatus', 'error')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
||||
break
|
||||
case 10550:
|
||||
setLogList('error', str +'时,设备连接异常!')
|
||||
|
||||
emit('update:testStatus', 'error')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
break
|
||||
|
||||
}
|
||||
@@ -621,7 +621,7 @@ watch(
|
||||
|
||||
if (newValue.code == 25001) {
|
||||
setLogList('info', '检测完成!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(1)
|
||||
updatePercentage()
|
||||
}
|
||||
if(newValue.code == 25005){
|
||||
@@ -634,12 +634,12 @@ watch(
|
||||
}
|
||||
case 25003:
|
||||
setLogList('error', '检测失败!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
updatePercentage()
|
||||
break
|
||||
case 10550:
|
||||
setLogList('error', '设备连接异常!')
|
||||
stopTimeCount()
|
||||
stopTimeCount(0)
|
||||
updatePercentage()
|
||||
break
|
||||
default:
|
||||
@@ -682,7 +682,7 @@ const updatePercentage = async () => {
|
||||
// planCode: checkStore.plan.code + ''
|
||||
// })
|
||||
}
|
||||
stopTimeCount()
|
||||
stopTimeCount(1)
|
||||
ElMessageBox.alert(
|
||||
'检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作',
|
||||
'检测完成',
|
||||
@@ -712,10 +712,14 @@ const startTimeCount = () => {
|
||||
}
|
||||
|
||||
// 停止计时
|
||||
const stopTimeCount = () => {
|
||||
const stopTimeCount = (type: number) => {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
if(type === 0){
|
||||
emit('update:testStatus', 'error')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,9 +981,7 @@ defineExpose({
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-button--small) {
|
||||
height: 20px !important;
|
||||
width: 20px !important;
|
||||
|
||||
@@ -323,7 +323,8 @@ const handleSubmitAgain = async () => {
|
||||
}
|
||||
stepsTotalNum.value = count + 1
|
||||
|
||||
// 通知子组件清空并重新初始化
|
||||
// 等待组件渲染完成
|
||||
await nextTick()
|
||||
if (preTestRef.value) {
|
||||
preTestRef.value.initializeParameters()
|
||||
}
|
||||
@@ -342,7 +343,6 @@ const handleSubmitAgain = async () => {
|
||||
standardDevIds: standardDevIds.value,
|
||||
pairs: pairs.value,
|
||||
testItemList: [checkStore.selectTestItems.preTest, false, checkStore.selectTestItems.test],
|
||||
|
||||
userId: userStore.userInfo.id
|
||||
})
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
:draggable="false"
|
||||
width="1400px"
|
||||
>
|
||||
|
||||
<div class="data-check-dialog">
|
||||
<div class="data-check-head">
|
||||
<el-form :model="formContent" label-width="auto" class="form-three">
|
||||
@@ -73,6 +74,7 @@
|
||||
class="custom-tree"
|
||||
ref="treeRef"
|
||||
>
|
||||
|
||||
<template #default="{ node, data }">
|
||||
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
|
||||
<span
|
||||
@@ -137,6 +139,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
@@ -161,7 +166,7 @@ import { ResultEnum } from '@/enums/httpEnum'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { useModeStore } from '@/stores/modules/mode'
|
||||
|
||||
import { CircleClose, Warning, SuccessFilled } from '@element-plus/icons-vue'
|
||||
const dictStore = useDictStore()
|
||||
const modeStore = useModeStore()
|
||||
|
||||
@@ -183,6 +188,8 @@ watch(searchValue, val => {
|
||||
treeRef.value!.filter(val)
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 格式化数字
|
||||
const fixed = 4
|
||||
|
||||
@@ -816,6 +823,10 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
|
||||
|
||||
|
||||
.dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -856,11 +867,11 @@ defineExpose({
|
||||
height: 100%;
|
||||
margin-top: 10px;
|
||||
|
||||
.custom-tree-node {
|
||||
overflow-x: hidden !important;
|
||||
white-space: nowrap !important;
|
||||
text-overflow: ellipsis !important;
|
||||
}
|
||||
// .custom-tree-node {
|
||||
// overflow-x: hidden !important;
|
||||
// white-space: nowrap !important;
|
||||
// text-overflow: ellipsis !important;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,6 +915,8 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<!--<style lang="scss">-->
|
||||
<!--.el-popover.popover-class {-->
|
||||
|
||||
@@ -226,6 +226,7 @@ const open = async (
|
||||
planIsOnlyWave.value = isOnlyWave
|
||||
CompareTestVisible.value = false
|
||||
devIdList.value = device
|
||||
devIdList.value = device
|
||||
pqStandardDevList.value = standardDev
|
||||
planIdKey.value = fatherPlanId
|
||||
deviceMonitor.value = DeviceMonitoringMap
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-tabs v-if="dialogVisible" v-model="activeName" @tab-click="handleTabClick">
|
||||
<el-tabs v-if="dialogVisible" v-model="activeName" @tab-change="handleTabChange">
|
||||
<el-tab-pane
|
||||
v-for="(result, index) in resultData"
|
||||
:key="result.monitorId"
|
||||
@@ -76,7 +76,7 @@
|
||||
<el-text type="info">检测结论:</el-text>
|
||||
</template>
|
||||
<el-tag disable-transitions v-if="result.checkResult === 1" type="success">符合</el-tag>
|
||||
<el-tag disable-transitions v-else-if="result.checkResult === 2" type="danger">不符合</el-tag>
|
||||
<el-tag disable-transitions v-else-if="result.checkResult === 0" type="danger">不符合</el-tag>
|
||||
<el-tag disable-transitions v-else-if="result.checkResult === 4" type="danger">无法比较</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="right">
|
||||
@@ -114,9 +114,12 @@
|
||||
>
|
||||
符合
|
||||
</el-tag>
|
||||
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 2" type="danger">
|
||||
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 0" type="danger">
|
||||
不符合
|
||||
</el-tag>
|
||||
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 4" type="danger">
|
||||
无法比较
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<el-option
|
||||
@@ -128,7 +131,8 @@
|
||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||
<el-text>{{ '第' + item.time + '次' }}</el-text>
|
||||
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
|
||||
<el-tag v-if="item.checkResult === 2" type="danger">不符合</el-tag>
|
||||
<el-tag v-if="item.checkResult === 0" type="danger">不符合</el-tag>
|
||||
<el-tag v-if="item.checkResult === 4" type="danger">无法比较</el-tag>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -146,7 +150,7 @@
|
||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 1" type="success">
|
||||
符合
|
||||
</el-tag>
|
||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 2" type="danger">
|
||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 0" type="danger">
|
||||
不符合
|
||||
</el-tag>
|
||||
<el-tag disable-transitions v-if="submitSourceData.checkResult === 4" type="info">
|
||||
@@ -163,7 +167,8 @@
|
||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||
<el-text>{{ item.dataSourceName }}</el-text>
|
||||
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
|
||||
<el-tag v-if="item.checkResult === 2" type="danger">不符合</el-tag>
|
||||
<el-tag v-if="item.checkResult === 0" type="danger">不符合</el-tag>
|
||||
<el-tag v-if="item.checkResult === 4" type="danger">无法比较</el-tag>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -182,13 +187,17 @@ import { type MonitorResult } from '@/api/result/interface'
|
||||
import { generateDevReport } from '@/api/plan/plan'
|
||||
import { useCheckStore } from '@/stores/modules/check'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogSourceVisible = ref(false)
|
||||
const devData = ref<any>()
|
||||
const activeName = ref<number>(0)
|
||||
const checkStore = useCheckStore()
|
||||
const currentWhichTimeData = ref<any>({})
|
||||
const currentWhichTimeData = ref({
|
||||
time: '',
|
||||
checkResult: -1
|
||||
})
|
||||
// 定义 emit 事件
|
||||
const emit = defineEmits<{
|
||||
(e: 'reportGenerated'): void
|
||||
@@ -224,8 +233,8 @@ const getResultData = async () => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleTabClick = (tab: any) => {
|
||||
activeName.value = tab.name
|
||||
const handleTabChange = (name: any) => {
|
||||
activeName.value = name
|
||||
}
|
||||
const handleChooseClick = async () => {
|
||||
const currentResult = resultData.value[activeName.value]
|
||||
@@ -241,9 +250,9 @@ const handleChooseClick = async () => {
|
||||
whichTimeData.value = Object.keys(resultSourceData.value).map(time => {
|
||||
// 检测结果只要有一个合格就算合格
|
||||
const checkResult = resultSourceData.value[time].find((item: any) => item.checkResult === 1)
|
||||
return { time, checkResult: checkResult ? 1 : 2 }
|
||||
return { time, checkResult: checkResult ? 1 : 0 }
|
||||
})
|
||||
currentWhichTimeData.value = whichTimeData.value[currentResult.whichTime]
|
||||
currentWhichTimeData.value = whichTimeData.value.find((item: any) => item.time == currentResult.whichTime)
|
||||
sourceData.value = resultSourceData.value[currentResult.whichTime]
|
||||
}
|
||||
}
|
||||
@@ -251,7 +260,7 @@ const handleChooseClick = async () => {
|
||||
}
|
||||
const handleTimeChange = (value: any) => {
|
||||
sourceData.value = resultSourceData.value[value]
|
||||
currentWhichTimeData.value = whichTimeData.value[value]
|
||||
currentWhichTimeData.value = whichTimeData.value.find((item: any) => item.time == value)
|
||||
submitSourceData.resultType = ''
|
||||
submitSourceData.checkResult = -1
|
||||
}
|
||||
@@ -283,7 +292,7 @@ const handleConfirmGenerate = async () => {
|
||||
dialogVisible.value = false
|
||||
emit('reportGenerated') // 触发事件通知父组件
|
||||
} catch (error) {
|
||||
ElMessage.error('报告生成失败')
|
||||
// 错误已经在全局拦截器中处理并显示,这里只记录日志
|
||||
console.error('报告生成错误:', error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
<!-- 表格行操作列:根据不同模式显示不同的操作按钮 -->
|
||||
<template #operation="scope">
|
||||
<div v-if="form.activeTabs === 3"
|
||||
style="overflow-x: auto; display: flex;justify-content: center; align-items: center"
|
||||
style=" display: flex;justify-content: center; align-items: center"
|
||||
>
|
||||
<!-- 报告下载(仅在报告已生成或已上传时显示) -->
|
||||
<el-button
|
||||
@@ -958,7 +958,7 @@ const handleTest = async (val: string) => {
|
||||
checkStore.setCheckType(1)
|
||||
checkStore.initSelectTestItems()
|
||||
// 一键检测
|
||||
if (testType === 'reTest') {
|
||||
if (testType === 'reTest' && modeStore.currentMode != '比对式') {
|
||||
ElMessageBox.confirm('请选择复检检测方式', '设备复检', {
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '不合格项复检',
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<span class="custom-tree-node" style="display: flex; align-items: center">
|
||||
<span class="custom-tree-node" style="display: flex; align-items: center;">
|
||||
<!-- 父节点图标 -->
|
||||
<Platform
|
||||
v-if="!data.pid"
|
||||
|
||||
@@ -30,43 +30,36 @@
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import { getCurrentScene } from '@/api/user/login'
|
||||
import { initDynamicRouter } from '@/routers/modules/dynamicRouter'
|
||||
import { useTabsStore } from '@/stores/modules/tabs'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const modeStore = useModeStore() // 使用模式 store
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
const activateInfo = authStore.activateInfo
|
||||
const isActivateOpen = import.meta.env.VITE_ACTIVATE_OPEN
|
||||
|
||||
const tabsStore = useTabsStore()
|
||||
const modeList = [
|
||||
{
|
||||
name: '模拟式模块',
|
||||
code: '模拟式',
|
||||
subName: '未启用模拟式检测计划',
|
||||
img: new URL('/src/assets/images/dashboard/1.svg', import.meta.url).href,
|
||||
activated:
|
||||
isActivateOpen === 'true'
|
||||
? activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1
|
||||
: true
|
||||
activated: isActivateOpen === 'true' ? activateInfo.simulate.permanently === 1 : true
|
||||
},
|
||||
{
|
||||
name: '数字式模块',
|
||||
code: '数字式',
|
||||
subName: '启用数字检测计划',
|
||||
img: new URL('/src/assets/images/dashboard/2.svg', import.meta.url).href,
|
||||
activated:
|
||||
isActivateOpen === 'true'
|
||||
? activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1
|
||||
: true
|
||||
activated: isActivateOpen === 'true' ? activateInfo.digital.permanently === 1 : true
|
||||
},
|
||||
{
|
||||
name: '比对式模块',
|
||||
code: '比对式',
|
||||
subName: '启用比对式检测计划',
|
||||
img: new URL('/src/assets/images/dashboard/3.svg', import.meta.url).href,
|
||||
activated:
|
||||
isActivateOpen === 'true'
|
||||
? activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1
|
||||
: true
|
||||
activated: isActivateOpen === 'true' ? activateInfo.contrast.permanently === 1 : true
|
||||
}
|
||||
]
|
||||
const handelOpen = async (item: any) => {
|
||||
@@ -78,15 +71,11 @@ const handelOpen = async (item: any) => {
|
||||
const { data: scene } = await getCurrentScene() // 获取当前场景
|
||||
AppSceneStore.setCurrentMode(scene + '') //0:省级平台,1:设备出厂,2:研发自测
|
||||
await authStore.setShowMenu()
|
||||
await authStore.getAuthMenuList()
|
||||
await tabsStore.closeMultipleTab()
|
||||
await initDynamicRouter()
|
||||
return
|
||||
}
|
||||
const handleSelect = (key: string, keyPath: string[]) => {
|
||||
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
onMounted(() => {})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<ProTable ref="proTable" :columns="columns" :request-api="getTableList">
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader>
|
||||
<el-button type="primary" :icon="DataAnalysis">分析</el-button>
|
||||
<el-button type="primary" :icon="Upload" @click="handleExport">导出csv</el-button>
|
||||
<!-- <el-button type="primary" :icon="DataAnalysis">分析</el-button>-->
|
||||
<el-button type="primary" icon="Download" @click="handleExport">导出csv</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
</div>
|
||||
@@ -13,7 +13,6 @@
|
||||
// 根据实际路径调整
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import { DataAnalysis, Upload } from '@element-plus/icons-vue'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { exportCsv, getAuditLog } from '@/api/system/log'
|
||||
|
||||
@@ -82,36 +82,10 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="固件版本" prop="hardwareVersion" v-if="scene === '0'">
|
||||
<el-select
|
||||
v-model="formContent.hardwareVersion"
|
||||
clearable
|
||||
placeholder="请选择固件版本"
|
||||
filterable
|
||||
allow-create
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions['hardwareVersion']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input v-model="formContent.hardwareVersion" clearable placeholder="请输入固件版本" />
|
||||
</el-form-item>
|
||||
<el-form-item label="软件版本" prop="softwareVersion" v-if="scene === '0'">
|
||||
<el-select
|
||||
v-model="formContent.softwareVersion"
|
||||
clearable
|
||||
placeholder="请选择软件版本"
|
||||
filterable
|
||||
allow-create
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions['softwareVersion']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input v-model="formContent.softwareVersion" clearable placeholder="请输入软件版本" />
|
||||
</el-form-item>
|
||||
<el-form-item label="定检日期" prop="inspectDate" v-if="MonIsShow">
|
||||
<el-date-picker
|
||||
@@ -218,55 +192,28 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属地市" prop="cityName" v-if="MonIsShow">
|
||||
<el-select
|
||||
<el-input
|
||||
v-model="formContent.cityName"
|
||||
clearable
|
||||
placeholder="请选择所属地市"
|
||||
placeholder="请输入所属地市"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
filterable
|
||||
allow-create
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions['cityName']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属供电公司" prop="gdName" v-if="MonIsShow">
|
||||
<el-select
|
||||
<el-input
|
||||
v-model="formContent.gdName"
|
||||
clearable
|
||||
placeholder="请选择所属供电公司"
|
||||
placeholder="请输入所属供电公司"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
filterable
|
||||
allow-create
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions['gdName']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属电站" prop="subName" v-if="MonIsShow">
|
||||
<el-select
|
||||
<el-input
|
||||
v-model="formContent.subName"
|
||||
clearable
|
||||
placeholder="请选择所属电站"
|
||||
placeholder="请输入所属电站"
|
||||
:disabled="formContent.importFlag == 1"
|
||||
filterable
|
||||
allow-create
|
||||
>
|
||||
<el-option
|
||||
v-for="item in selectOptions['subName']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-auth.device="'factorFlag'"
|
||||
@@ -279,6 +226,14 @@
|
||||
<el-radio :value="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="scene === '1'"
|
||||
label="谐波系统设备id"
|
||||
prop="harmSysId"
|
||||
placeholder="请输入谐波系统设备id"
|
||||
>
|
||||
<el-input v-model="formContent.harmSysId" :disabled="formContent.importFlag == 1" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
@@ -312,7 +267,7 @@ import dayjs from 'dayjs'
|
||||
import MonitorTable from '@/views/machine/device/components/monitorTab.vue'
|
||||
import { useAppSceneStore } from '@/stores/modules/mode'
|
||||
import { generateUUID } from '@/utils'
|
||||
import { Monitor } from '@/api/device/interface/monitor'
|
||||
import { type Monitor } from '@/api/device/interface/monitor'
|
||||
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
const MonIsShow = ref(false)
|
||||
@@ -382,6 +337,7 @@ function useMetaInfo() {
|
||||
gdName: '',
|
||||
subName: '',
|
||||
importFlag: 0,
|
||||
harmSysId: '',
|
||||
inspectChannel: [],
|
||||
monitorList: []
|
||||
})
|
||||
@@ -421,6 +377,7 @@ const resetFormContent = () => {
|
||||
subName: '',
|
||||
importFlag: 0,
|
||||
inspectChannel: [],
|
||||
harmSysId: '',
|
||||
monitorList: []
|
||||
})
|
||||
}
|
||||
@@ -486,8 +443,10 @@ const rules = computed(() => {
|
||||
}
|
||||
if (scene.value !== '0') {
|
||||
dynamicRules.name = [{ required: true, message: '设备名称必填!', trigger: 'blur' }]
|
||||
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必选!', trigger: 'change' }]
|
||||
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必选!', trigger: 'change' }]
|
||||
// dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必选!', trigger: 'change' }]
|
||||
// dynamicRules.softwareVersion = [{ required: true, message: '软件版本必选!', trigger: 'change' }]
|
||||
dynamicRules.hardwareVersion = [{ required: true, message: '固件版本必填!', trigger: 'blur' }]
|
||||
dynamicRules.softwareVersion = [{ required: true, message: '软件版本必填!', trigger: 'blur' }]
|
||||
dynamicRules.manufacturer = [{ required: true, message: '生产厂家必选!', trigger: 'change' }]
|
||||
}
|
||||
|
||||
@@ -498,9 +457,12 @@ const rules = computed(() => {
|
||||
|
||||
if (mode.value === '比对式') {
|
||||
dynamicRules.inspectDate = [{ required: true, message: '定检日期必填!', trigger: 'blur' }]
|
||||
dynamicRules.cityName = [{ required: true, message: '所属地市必选!', trigger: 'change' }]
|
||||
dynamicRules.gdName = [{ required: true, message: '所属供电公司必选!', trigger: 'change' }]
|
||||
dynamicRules.subName = [{ required: true, message: '所属电站必选!', trigger: 'change' }]
|
||||
// dynamicRules.cityName = [{ required: true, message: '所属地市必选!', trigger: 'change' }]
|
||||
// dynamicRules.gdName = [{ required: true, message: '所属供电公司必选!', trigger: 'change' }]
|
||||
// dynamicRules.subName = [{ required: true, message: '所属电站必选!', trigger: 'change' }]
|
||||
dynamicRules.cityName = [{ required: true, message: '所属地市必填!', trigger: 'blur' }]
|
||||
dynamicRules.gdName = [{ required: true, message: '所属供电公司必填!', trigger: 'blur' }]
|
||||
dynamicRules.subName = [{ required: true, message: '所属电站必填!', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
return dynamicRules
|
||||
@@ -656,6 +618,7 @@ const open = async (
|
||||
}
|
||||
monitor.value = data.monitorList
|
||||
} else {
|
||||
monitor.value = []
|
||||
resetFormContent()
|
||||
//只有比对式设备ID由前端传
|
||||
if (currentMode === '比对式') formContent.id = generateUUID().replaceAll('-', '')
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
<template>
|
||||
<!-- 基础信息弹出框 -->
|
||||
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" align-center>
|
||||
<el-dialog
|
||||
:model-value="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
v-bind="dialogMiddle"
|
||||
width="50%"
|
||||
@close="close"
|
||||
align-center
|
||||
>
|
||||
<div>
|
||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules" class="form-two">
|
||||
<el-form :model="formContent" ref="dialogFormRef" :rules="rules" label-width="140" class="form-two">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formContent.name" placeholder="请输入监测点名称" />
|
||||
<el-input clearable v-model="formContent.name" placeholder="请输入监测点名称" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="线路号" prop="num">
|
||||
<el-select
|
||||
v-model="formContent.num"
|
||||
clearable
|
||||
placeholder="请选择线路号"
|
||||
@change="handleMonNumChange"
|
||||
>
|
||||
<el-select v-model="formContent.num" placeholder="请选择线路号" @change="handleMonNumChange" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||
<el-option v-for="item in lineNum" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属母线" prop="busbar">
|
||||
<el-input v-model="formContent.busbar" clearable placeholder="请输入所属母线" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="所属母线" prop="busbar">
|
||||
<el-select
|
||||
v-model="formContent.busbar"
|
||||
clearable
|
||||
@@ -31,29 +36,9 @@
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="PT变比" prop="pt">
|
||||
<el-select v-model="formContent.pt" clearable placeholder="请选择PT变比" filterable allow-create>
|
||||
<el-option
|
||||
v-for="item in selectOptions['pt']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="CT变比" prop="ct">
|
||||
<el-select v-model="formContent.ct" clearable placeholder="请选择CT变比" filterable allow-create>
|
||||
<el-option
|
||||
v-for="item in selectOptions['ct']"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="接线方式" prop="connection">
|
||||
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式">
|
||||
<el-select v-model="formContent.connection" clearable placeholder="请选择接线方式" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Connect')"
|
||||
:key="item.id"
|
||||
@@ -62,8 +47,45 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item required>
|
||||
<template #label>
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-icon style="color: var(--el-color-error)"><WarningFilled /></el-icon>
|
||||
<span>PT变比</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="ratio-input-group">
|
||||
<el-form-item prop="ptPrimary" class="ratio-form-item">
|
||||
<el-input v-model="ptPrimary" placeholder="一次侧" @input="handlePtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<div class="colon">:</div>
|
||||
<el-form-item prop="ptSecondary" style="margin-left: 10px" class="ratio-form-item">
|
||||
<el-input v-model="ptSecondary" placeholder="二次侧" @input="handlePtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 修改CT变比部分 -->
|
||||
<el-form-item required>
|
||||
<template #label>
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-icon style="color: var(--el-color-error)"><WarningFilled /></el-icon>
|
||||
<span>CT变比</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="ratio-input-group">
|
||||
<el-form-item prop="ctPrimary" class="ratio-form-item">
|
||||
<el-input v-model="ctPrimary" placeholder="一次侧" @input="handleCtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<div class="colon">:</div>
|
||||
<el-form-item prop="ctSecondary" style="margin-left: 10px" class="ratio-form-item">
|
||||
<el-input v-model="ctSecondary" placeholder="二次侧" @input="handleCtInput" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="统计间隔" prop="statInterval">
|
||||
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔">
|
||||
<el-select v-model="formContent.statInterval" clearable placeholder="请选择统计间隔" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||
:key="item.id"
|
||||
@@ -73,16 +95,21 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="谐波系统检测点id" prop="harmSysId" placeholder="请输入谐波系统检测点id">
|
||||
<el-input v-model="formContent.harmSysId" />
|
||||
<el-input v-model="formContent.harmSysId" :disabled="props.DevFormContent.importFlag == 1 || formContent.resultType!=null"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否参与检测" prop="checkFlag" placeholder="请输入CT编号">
|
||||
<el-select v-model="formContent.checkFlag" clearable placeholder="请选择是否加密">
|
||||
<el-select v-model="formContent.checkFlag" :disabled="formContent.resultType!=null">
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="0"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-alert
|
||||
title="注意:PT和CT变比请输入正常值,不可以缩小相同的倍数!"
|
||||
type="error"
|
||||
:closable="false"
|
||||
></el-alert>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close()">取消</el-button>
|
||||
@@ -93,19 +120,31 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElMessage, type FormItemRule } from 'element-plus'
|
||||
import { computed, ref, Ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormItemRule } from 'element-plus'
|
||||
import { computed, ref, type Ref } from 'vue'
|
||||
import { type Monitor } from '@/api/device/interface/monitor'
|
||||
import { dialogMiddle } from '@/utils/elementBind'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { generateUUID } from '@/utils'
|
||||
import { Device } from '@/api/device/interface/device'
|
||||
import { type Device } from '@/api/device/interface/device'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const lineNum = ref<{ id: number; name: string }[]>([])
|
||||
const originalNum = ref<number | null>(null) // 存储编辑前的 num 值
|
||||
const monitorTable = ref<any[]>()
|
||||
const selectOptions = ref<Record<string, Device.SelectOption[]>>({})
|
||||
|
||||
// 新增用于PT/CT变比的临时字段
|
||||
const ptPrimary = ref<string>('')
|
||||
const ptSecondary = ref<string>('')
|
||||
const ctPrimary = ref<string>('')
|
||||
const ctSecondary = ref<string>('')
|
||||
|
||||
// 定义 props
|
||||
const props = defineProps<{
|
||||
DevFormContent: Device.ResPqDev
|
||||
}>()
|
||||
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
function useMetaInfo() {
|
||||
@@ -143,7 +182,8 @@ const resetFormContent = () => {
|
||||
connection: '',
|
||||
statInterval: 1,
|
||||
harmSysId: '',
|
||||
checkFlag: 1
|
||||
checkFlag: 1,
|
||||
resultType: null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,51 +200,185 @@ const close = () => {
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name: [{ required: true, message: '监测点名称必填!', trigger: 'blur' }],
|
||||
num: [{ required: true, message: '线路号必选', trigger: 'change' }],
|
||||
pt: [
|
||||
{ required: true, message: 'PT变比必选!', trigger: 'blur' },
|
||||
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'PT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
||||
],
|
||||
ct: [
|
||||
{ required: true, message: 'CT变比必选!', trigger: 'blur' },
|
||||
{ pattern: /^[1-9]\d*:[1-9]\d*$/, message: 'CT变比格式应为 n:n 形式,例如 1:1', trigger: 'change' }
|
||||
],
|
||||
connection: [{ required: true, message: '接线方式必选!', trigger: 'change' }],
|
||||
busbar: [{ required: true, message: '所属母线必选!', trigger: 'change' }],
|
||||
//busbar: [{ required: true, message: '所属母线必选!', trigger: 'change' }],
|
||||
busbar: [{ required: true, message: '所属母线必填!', trigger: 'blur' }],
|
||||
// harmSysId : [{ required: true, message: '谐波系统检测点id必填!', trigger: 'blur' }],
|
||||
checkFlag: [{ required: true, message: '是否参与检测必选!', trigger: 'change' }]
|
||||
})
|
||||
|
||||
// 处理PT输入变化并更新formContent中的值
|
||||
const handlePtInput = () => {
|
||||
if (ptPrimary.value && ptSecondary.value) {
|
||||
formContent.value.pt = `${ptPrimary.value}:${ptSecondary.value}`
|
||||
} else {
|
||||
formContent.value.pt = ''
|
||||
}
|
||||
}
|
||||
|
||||
// 处理CT输入变化并更新formContent中的值
|
||||
const handleCtInput = () => {
|
||||
if (ctPrimary.value && ctSecondary.value) {
|
||||
formContent.value.ct = `${ctPrimary.value}:${ctSecondary.value}`
|
||||
} else {
|
||||
formContent.value.ct = ''
|
||||
}
|
||||
}
|
||||
|
||||
// 添加一个用于手动验证的引用
|
||||
const extraFormRules = ref({
|
||||
ptPrimary: [
|
||||
{ required: true, message: 'PT变比一次侧必填!', trigger: 'blur' },
|
||||
{ pattern: /^[1-9]\d*$/, message: '请输入正整数', trigger: 'blur' }
|
||||
],
|
||||
ptSecondary: [
|
||||
{ required: true, message: 'PT变比二次侧必填!', trigger: 'blur' },
|
||||
{ pattern: /^\d+(\.\d+)?$/, message: '请输入数字', trigger: 'blur' }
|
||||
],
|
||||
ctPrimary: [
|
||||
{ required: true, message: 'CT变比一次侧必填!', trigger: 'blur' },
|
||||
{ pattern: /^[1-9]\d*$/, message: '请输入正整数', trigger: 'blur' }
|
||||
],
|
||||
ctSecondary: [
|
||||
{ required: true, message: 'CT变比二次侧必填!', trigger: 'blur' },
|
||||
{ pattern: /^[1-9]\d*$/, message: '请输入正整数', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 保存数据
|
||||
const save = () => {
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
// 手动验证额外的字段
|
||||
let extraValid = true
|
||||
const fieldsToValidate = ['ptPrimary', 'ptSecondary', 'ctPrimary', 'ctSecondary']
|
||||
|
||||
for (const field of fieldsToValidate) {
|
||||
const value = eval(field) // 获取对应字段的值
|
||||
const rules = extraFormRules.value[field]
|
||||
|
||||
for (const rule of rules) {
|
||||
if (rule.required && !value.value) {
|
||||
ElMessage.error({ message: rule.message as string })
|
||||
extraValid = false
|
||||
break
|
||||
}
|
||||
|
||||
if (rule.pattern && value.value && !rule.pattern.test(value.value)) {
|
||||
ElMessage.error({ message: rule.message as string })
|
||||
extraValid = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!extraValid) break
|
||||
}
|
||||
|
||||
if (!extraValid) {
|
||||
return
|
||||
}
|
||||
|
||||
// 校验名称是否重复
|
||||
const isNameDuplicate = monitorTable.value.some(
|
||||
const isNameDuplicate = monitorTable.value?.some(
|
||||
item => item.name === formContent.value.name && item.id !== formContent.value.id
|
||||
)
|
||||
if (isNameDuplicate) {
|
||||
ElMessage.error({ message: '监测点名称已存在,请重新输入!' })
|
||||
return
|
||||
}
|
||||
// 添加PT CT逻辑
|
||||
// PT 逻辑
|
||||
let ptPrimaryValue = ptPrimary.value
|
||||
let ptSecondaryValue = ptSecondary.value
|
||||
let ptErrorTips = false
|
||||
let ctErrorTips = false
|
||||
const ptFinalValue = ['100', '380']
|
||||
const ptFinalChangeValue = ['57.74', '220']
|
||||
const ctFinalValue = ['1', '5']
|
||||
|
||||
if (titleType.value != 'edit') {
|
||||
formContent.value.id = generateUUID().replaceAll('-', '')
|
||||
// 若值都为 1, 则改值为 380
|
||||
if (ptPrimaryValue === '1' && ptSecondaryValue === '1') {
|
||||
formContent.value.pt = `${ptFinalValue[1]}:${ptFinalValue[1]}`
|
||||
} else {
|
||||
// 若PT分母值不为 ['100', '380']
|
||||
if (!ptFinalValue.includes(ptSecondaryValue)) {
|
||||
// 若PT分母值不为 ['57.74', '220'],提示
|
||||
if (ptFinalChangeValue.includes(ptSecondaryValue)) {
|
||||
// 判断值为 57.74,则 57.74 => 100
|
||||
if (ptSecondaryValue === ptFinalChangeValue[0]) {
|
||||
ptSecondaryValue = ptFinalValue[0]
|
||||
}
|
||||
// 判断值为 220,则 220 => 380
|
||||
if (ptSecondaryValue === ptFinalChangeValue[1]) {
|
||||
ptSecondaryValue = ptFinalValue[1]
|
||||
}
|
||||
} else {
|
||||
ptErrorTips = true
|
||||
}
|
||||
}
|
||||
}
|
||||
formContent.value.pt = `${ptPrimaryValue}:${ptSecondaryValue}`
|
||||
// CT 逻辑, CT 分母是否为 ['1', '5']
|
||||
if (!ctFinalValue.includes(ctSecondary.value)) {
|
||||
ctErrorTips = true
|
||||
}
|
||||
if (ptErrorTips && ctErrorTips) {
|
||||
await ElMessageBox.confirm('请确认PT和CT无误!', '提示', {
|
||||
confirmButtonText: '继续保存',
|
||||
cancelButtonText: '取消保存'
|
||||
})
|
||||
.then(() => {
|
||||
sendParameter()
|
||||
})
|
||||
.catch(() => {
|
||||
return
|
||||
})
|
||||
} else {
|
||||
if (ptErrorTips) {
|
||||
await ElMessageBox.confirm('请确认PT无误!', '提示', {
|
||||
confirmButtonText: '继续保存',
|
||||
cancelButtonText: '取消保存'
|
||||
})
|
||||
.then(() => {
|
||||
sendParameter()
|
||||
})
|
||||
.catch(() => {
|
||||
return
|
||||
})
|
||||
}
|
||||
if (ctErrorTips) {
|
||||
await ElMessageBox.confirm('请确认CT无误!', '提示', {
|
||||
confirmButtonText: '确认保存',
|
||||
cancelButtonText: '取消保存'
|
||||
})
|
||||
.then(() => {
|
||||
sendParameter()
|
||||
})
|
||||
.catch(() => {
|
||||
return
|
||||
})
|
||||
}
|
||||
}
|
||||
if (!ptErrorTips && !ctErrorTips) {
|
||||
sendParameter()
|
||||
}
|
||||
emit('get-parameter', formContent.value)
|
||||
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||
close()
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('验证过程中出现错误', err)
|
||||
}
|
||||
}
|
||||
|
||||
const sendParameter = () => {
|
||||
if (titleType.value != 'edit') {
|
||||
formContent.value.id = generateUUID().replaceAll('-', '')
|
||||
}
|
||||
emit('get-parameter', formContent.value)
|
||||
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||
close()
|
||||
}
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: Monitor.ResPqMon, device: Device.ResPqDev, table: any[], options: any) => {
|
||||
// 重置表单
|
||||
//dialogFormRef.value?.resetFields()
|
||||
selectOptions.value = options
|
||||
titleType.value = sign
|
||||
dialogVisible.value = true
|
||||
@@ -226,13 +400,40 @@ const open = async (sign: string, data: Monitor.ResPqMon, device: Device.ResPqDe
|
||||
name: id.toString()
|
||||
}
|
||||
}).filter(item => !usedNums.has(item.id)) // 过滤掉已被使用的线路号
|
||||
|
||||
if (sign == 'edit') {
|
||||
formContent.value = { ...data }
|
||||
originalNum.value = data.num // 记录原始线路号
|
||||
|
||||
// 解析PT变比
|
||||
if (data.pt) {
|
||||
const [primary, secondary] = data.pt.split(':')
|
||||
ptPrimary.value = primary
|
||||
ptSecondary.value = secondary
|
||||
}
|
||||
|
||||
// 解析CT变比
|
||||
if (data.ct) {
|
||||
const [primary, secondary] = data.ct.split(':')
|
||||
ctPrimary.value = primary
|
||||
ctSecondary.value = secondary
|
||||
}
|
||||
} else {
|
||||
// 清空PT和CT的临时变量
|
||||
ptPrimary.value = ''
|
||||
ptSecondary.value = ''
|
||||
ctPrimary.value = ''
|
||||
ctSecondary.value = ''
|
||||
|
||||
// 重置表单内容,但保留devId
|
||||
const devId = formContent.value.devId
|
||||
resetFormContent()
|
||||
formContent.value.devId = devId
|
||||
originalNum.value = null
|
||||
|
||||
// 使用nextTick确保DOM更新后再清除验证
|
||||
setTimeout(() => {
|
||||
dialogFormRef.value?.clearValidate()
|
||||
}, 0)
|
||||
// 设置默认选中第一个线路号
|
||||
if (lineNum.value.length > 0) {
|
||||
formContent.value.num = lineNum.value[0].id
|
||||
@@ -261,4 +462,24 @@ const handleMonNumChange = (value: string) => {
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.ratio-input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ratio-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.colon {
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.el-alert {
|
||||
--el-alert-padding: 0px 12px !important;
|
||||
--el-alert-title-font-size: 12px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
type="primary"
|
||||
:icon="CirclePlus"
|
||||
@click="openDialog('add')"
|
||||
:disabled="props.DevFormContent.importFlag == 1"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
@@ -38,7 +37,6 @@
|
||||
link
|
||||
:icon="EditPen"
|
||||
:model-value="false"
|
||||
:disabled="props.DevFormContent.importFlag == 1"
|
||||
@click="openDialog('edit', scope.row)"
|
||||
>
|
||||
编辑
|
||||
@@ -49,13 +47,14 @@
|
||||
link
|
||||
:icon="Delete"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
:disabled="scope.row.resultType!=null"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
</div>
|
||||
<MonitorPopup @getParameter="getParameter" ref="monitorPopup" />
|
||||
<MonitorPopup @getParameter="getParameter" ref="monitorPopup" :DevFormContent="props.DevFormContent"/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
:style="{ height: '400px', maxHeight: '400px', overflow: 'hidden' }"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="sort" label="序号" width="60" />
|
||||
<el-table-column type="selection" width="40" fixed="left" />
|
||||
<el-table-column prop="sort" label="序号" width="55" fixed="left" />
|
||||
<el-table-column prop="type" label="误差类型" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<el-cascader
|
||||
style="min-width: 180px"
|
||||
style="min-width: 170px"
|
||||
:options="errorOptions"
|
||||
v-model="row.errorType"
|
||||
:props="{ checkStrictly: false, emitPath: false }"
|
||||
@@ -28,10 +28,10 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="脚本类型" min-width="230">
|
||||
<el-table-column prop="type" label="脚本类型" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<el-cascader
|
||||
style="min-width: 230px"
|
||||
style="min-width: 220px"
|
||||
:options="scriptOptions"
|
||||
v-model="row.scriptType"
|
||||
:props="{ checkStrictly: false, emitPath: false }"
|
||||
@@ -48,7 +48,7 @@
|
||||
<el-select
|
||||
v-model="row.startFlag"
|
||||
placeholder="选择起始值"
|
||||
style="width: 70px"
|
||||
style="width: 60px"
|
||||
@change="value => handleStartFlagChange(row, value)"
|
||||
>
|
||||
<el-option label="无" :value="2"></el-option>
|
||||
@@ -57,7 +57,8 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input
|
||||
<el-input-number
|
||||
:controls="false"
|
||||
v-model="row.startValue"
|
||||
style="width: 60px"
|
||||
:disabled="isStartValueDisabled[row.sort]"
|
||||
@@ -73,7 +74,7 @@
|
||||
<el-select
|
||||
v-model="row.endFlag"
|
||||
placeholder="选择结束值"
|
||||
style="width: 70px"
|
||||
style="width: 60px"
|
||||
@change="value => handleEndFlagChange(row, value)"
|
||||
>
|
||||
<el-option label="无" :value="2"></el-option>
|
||||
@@ -82,7 +83,8 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-input
|
||||
<el-input-number
|
||||
:controls="false"
|
||||
v-model="row.endValue"
|
||||
style="width: 60px"
|
||||
:disabled="isEndValueDisabled[row.sort]"
|
||||
@@ -91,7 +93,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="130">
|
||||
<el-table-column label="单位" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.conditionType" placeholder="选择单位">
|
||||
<el-option
|
||||
@@ -107,7 +109,7 @@
|
||||
<el-table-column label="最大误差">
|
||||
<el-table-column prop="maxErrorValue" label="最大误差值" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.maxErrorValue" style="width: 70px" />
|
||||
<el-input-number :controls="false" v-model="row.maxErrorValue" style="width: 70px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="误差类型" width="170">
|
||||
@@ -119,13 +121,13 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="误差单位" width="100" prop="errorUnit">
|
||||
<el-table-column label="误差单位" width="90" prop="errorUnit">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.errorUnit }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="150">
|
||||
<el-table-column label="操作" min-width="150" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link :icon="CopyDocument" @click="copyRow(row)">复制</el-button>
|
||||
<el-button type="primary" link :icon="Delete" @click="deleteRow(row)">删除</el-button>
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="dialogTitle"
|
||||
v-model="dialogVisible"
|
||||
@close="close"
|
||||
v-bind="dialogBig"
|
||||
width="1660px"
|
||||
align-center
|
||||
>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="100%" align-center>
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="基础信息">
|
||||
<div>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
type="number"
|
||||
placeholder="含有率"
|
||||
style="width: 80px"
|
||||
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
||||
onkeypress="return (/[\d.-]/.test(String.fromCharCode(event.keyCode)))"
|
||||
@input="validateInput('famp',1)"
|
||||
clearable
|
||||
/>
|
||||
|
||||
@@ -184,10 +184,9 @@
|
||||
v-if="progressData.status === 'success'"
|
||||
type="primary"
|
||||
title="点击打开目录"
|
||||
:href="progressData.message"
|
||||
@click="openDownloadLocation"
|
||||
>
|
||||
{{ progressData.message }}
|
||||
{{ filePath }}
|
||||
</el-link>
|
||||
</el-row>
|
||||
<el-progress
|
||||
@@ -369,9 +368,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
fixed: 'right',
|
||||
render: (scope: { row: { checkState: number } }) => {
|
||||
return scope.row.checkState === 0 ? (
|
||||
<el-tag type="primary" effect="dark">
|
||||
未检
|
||||
</el-tag>
|
||||
<el-tag type="info">未检</el-tag>
|
||||
) : scope.row.checkState === 1 ? (
|
||||
<el-tag type="warning" effect="dark">
|
||||
检测中
|
||||
@@ -531,7 +528,6 @@ const removeTab = async (targetName: TabPaneName) => {
|
||||
}
|
||||
// 弹窗打开方法
|
||||
const open = async (textTitle: string, data: Plan.ReqPlan, pattern: string) => {
|
||||
|
||||
dialogVisible.value = true
|
||||
title.value = textTitle
|
||||
planTitle.value = data.name
|
||||
@@ -687,16 +683,15 @@ const exportPlan = async () => {
|
||||
const params = {
|
||||
id: subPlanFormContent.id
|
||||
}
|
||||
ElMessageBox.confirm(`确认导出${subPlanFormContent.name}子计划元信息?`, '温馨提示', { type: 'warning' }).then(() =>
|
||||
useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip')
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
ElMessageBox.confirm(`确认导出${subPlanFormContent.name}子计划元信息?`, '温馨提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(() => useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip'))
|
||||
}
|
||||
|
||||
const exportPlanCheckResultData = async (selectedListIds: string[]) => {
|
||||
filePath.value = ''
|
||||
const params = {
|
||||
id: planFormContent.value.id,
|
||||
report: downloadReport.value,
|
||||
@@ -743,7 +738,6 @@ const initSSE = () => {
|
||||
eventSource.value = http.sse('/sse/createSse')
|
||||
|
||||
eventSource.value.onmessage = event => {
|
||||
|
||||
const res = JSON.parse(event.data)
|
||||
progressData.value.percentage = res.data
|
||||
progressData.value.message = res.message
|
||||
@@ -779,10 +773,6 @@ const openDownloadLocation = () => {
|
||||
if (filePath.value) {
|
||||
// 打开指定文件所在的目录,并选中该文件
|
||||
Renderer.shell.showItemInFolder(filePath.value)
|
||||
} else {
|
||||
// 使用默认下载路径
|
||||
const downloadPath = Renderer.app.getPath('downloads')
|
||||
Renderer.shell.openPath(downloadPath)
|
||||
}
|
||||
} else {
|
||||
ElMessage.warning('当前运行环境不支持,请复制路径自行打开')
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
align-center
|
||||
v-bind="dialogBig"
|
||||
@close="close"
|
||||
|
||||
>
|
||||
<el-form ref="dialogFormRef" :model="formContent" :rules="rules">
|
||||
<el-row :gutter="24">
|
||||
@@ -294,7 +293,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="8" v-if="waveRecordSetting">
|
||||
<el-form-item
|
||||
:label-width="140"
|
||||
label="录波数据有效组数"
|
||||
@@ -312,7 +311,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="8" v-if="realTimeSetting">
|
||||
<el-form-item
|
||||
:label-width="140"
|
||||
label="实时数据有效组数"
|
||||
@@ -330,7 +329,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="8" v-if="statisticsSetting">
|
||||
<el-form-item
|
||||
:label-width="140"
|
||||
label="统计数据有效组数"
|
||||
@@ -348,7 +347,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="8" v-if="flickerSetting">
|
||||
<el-form-item
|
||||
:label-width="140"
|
||||
label="闪变数据有效组数"
|
||||
@@ -366,7 +365,6 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
@@ -380,12 +378,45 @@
|
||||
</div>
|
||||
</template>
|
||||
<ImportExcel ref="deviceImportExcel" @result="importResult" />
|
||||
<transition name="fade">
|
||||
<div
|
||||
v-if="shanBianDialogVisible"
|
||||
style="
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
z-index: 999999999;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
padding: 10px;
|
||||
border: 1px solid var(--el-color-warning);
|
||||
border-radius: 5px;
|
||||
user-select: none;
|
||||
background-color: var(--el-color-danger-light-9);
|
||||
"
|
||||
>
|
||||
<el-text style="font-weight: bold" type="warning" size="large">
|
||||
<el-icon><WarningFilled /></el-icon>
|
||||
闪变耗时较长,不推荐批量被检设备在检测过程中采集该指标
|
||||
<el-icon @click="() => (shanBianDialogVisible = false)"><Close /></el-icon>
|
||||
</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { type CascaderOption, ElMessage, type FormItemRule } from 'element-plus'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
import { type Plan } from '@/api/plan/interface'
|
||||
import {
|
||||
@@ -416,6 +447,7 @@ import { downloadTemplate, importPqDev } from '@/api/device/device'
|
||||
import { getTestConfig } from '@/api/system/base'
|
||||
import { getRegRes } from '@/api/system/versionRegister'
|
||||
import DevSelect from '@/views/plan/planList/components/devSelect.vue'
|
||||
import { WarningFilled } from '@element-plus/icons-vue'
|
||||
|
||||
const modeStore = useModeStore()
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
@@ -446,8 +478,13 @@ const planType = ref<number>(0)
|
||||
const subPlanBindStandardDev = ref<any>([]) //哪些标准设备已经被子计划绑定
|
||||
const activeNames = ref(['1'])
|
||||
const allDisabled = ref(false)
|
||||
const shanBianDialogVisible = ref(false)
|
||||
const leaderData = ref<any[]>([])
|
||||
const memberData = ref<any[]>([])
|
||||
const waveRecordSetting = ref(false)
|
||||
const realTimeSetting = ref(false)
|
||||
const statisticsSetting = ref(false)
|
||||
const flickerSetting = ref(false)
|
||||
const generateData = () => {
|
||||
const manufacturerDict = dictStore.getDictData('Dev_Manufacturers')
|
||||
|
||||
@@ -672,15 +709,24 @@ const save = () => {
|
||||
if (planType.value == 1) {
|
||||
formContent.fatherPlanId = formContent.id
|
||||
formContent.id = ''
|
||||
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
|
||||
formContent.memberIds =
|
||||
formContent.memberIds && formContent.memberIds.length > 0
|
||||
? typeof formContent.memberIds === 'string'
|
||||
? [formContent.memberIds]
|
||||
: formContent.memberIds.map(id => id.toString())
|
||||
: []
|
||||
await addPlan(formContent)
|
||||
emit('update:tab')
|
||||
// 编辑子计划
|
||||
} else if (planType.value == 2) {
|
||||
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
|
||||
formContent.memberIds =
|
||||
formContent.memberIds && formContent.memberIds.length > 0
|
||||
? typeof formContent.memberIds === 'string'
|
||||
? [formContent.memberIds]
|
||||
: formContent.memberIds.map(id => id.toString())
|
||||
: []
|
||||
await updatePlan(formContent)
|
||||
emit('update:tab')
|
||||
|
||||
} else {
|
||||
formContent.sourceIds = null
|
||||
await updatePlan(formContent)
|
||||
@@ -740,6 +786,10 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
titleType.value = sign
|
||||
isSelectDisabled.value = false
|
||||
planType.value = plan
|
||||
waveRecordSetting.value = false
|
||||
statisticsSetting.value = false
|
||||
realTimeSetting.value = false
|
||||
flickerSetting.value = false
|
||||
if (sign == 'add') {
|
||||
resetFormContent()
|
||||
allDisabled.value = false
|
||||
@@ -754,7 +804,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
user_Result: any
|
||||
|
||||
if (mode.value === '比对式') {
|
||||
[
|
||||
;[
|
||||
PqErrSys_Result,
|
||||
pqDevList_Result,
|
||||
pqReportName_Result,
|
||||
@@ -793,8 +843,13 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
.map((user: any) => ({ ...user, disabled: false }))
|
||||
}
|
||||
}
|
||||
|
||||
// 默认选择 cp95值 作为数据处理原则
|
||||
const dataRuleDict = dictStore.getDictData('Data_Rule')
|
||||
const rule = dataRuleDict.find(item => item.code === 'Cp95_Value')
|
||||
formContent.dataRule = rule ? rule.id : ''
|
||||
} else {
|
||||
[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
|
||||
;[pqSource_Result, PqScript_Result, PqErrSys_Result, pqDevList_Result, pqReportName_Result] =
|
||||
await Promise.all([
|
||||
getTestSourceList(data),
|
||||
getPqScriptList(data),
|
||||
@@ -831,6 +886,8 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.datasourceIds = datasourceDicts
|
||||
.filter(item => ['real', 'wave_data'].includes(item.code))
|
||||
.map(item => item.code)
|
||||
realTimeSetting.value = true
|
||||
waveRecordSetting.value = true
|
||||
} else {
|
||||
//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
||||
|
||||
@@ -907,7 +964,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[
|
||||
;[
|
||||
pqSource_Result,
|
||||
PqScript_Result,
|
||||
PqErrSys_Result,
|
||||
@@ -982,6 +1039,8 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
}
|
||||
formContent.devIds = boundData.map((i: any) => i.id) // 已绑定设备id集合
|
||||
}
|
||||
handleDataSourceChange()
|
||||
handleTestItemChange(false)
|
||||
}
|
||||
|
||||
pqToArray() //将对象转为数组
|
||||
@@ -1004,9 +1063,9 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
formContent.sourceIds = formContent.sourceIds.join(',')
|
||||
}
|
||||
// 将 formContent.sourceIds 从数组转换为字符串
|
||||
/*if (Array.isArray(formContent.datasourceIds)) {
|
||||
if (Array.isArray(formContent.datasourceIds)) {
|
||||
formContent.datasourceIds = formContent.datasourceIds.join(',')
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
if (AppSceneStore.currentScene == '1') {
|
||||
@@ -1029,13 +1088,21 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
||||
}
|
||||
|
||||
// 检测项选择变化时的处理函数
|
||||
const handleTestItemChange = () => {
|
||||
const handleTestItemChange = (showTip: boolean = true) => {
|
||||
if (formContent.testItems.length > 0) {
|
||||
const hasShanBian = secondLevelOptions
|
||||
.filter(option => formContent.testItems.includes(option.value))
|
||||
.find(option => option.label === '闪变')
|
||||
if (hasShanBian) {
|
||||
ElMessage.warning('闪变耗时较长,不推荐批量被检设备在检测过程中采集该指标')
|
||||
flickerSetting.value = true
|
||||
if (showTip) {
|
||||
shanBianDialogVisible.value = true
|
||||
setTimeout(() => {
|
||||
shanBianDialogVisible.value = false
|
||||
}, 5000)
|
||||
}
|
||||
} else {
|
||||
flickerSetting.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1188,16 +1255,49 @@ const handleDataSourceChange = () => {
|
||||
// 判断是否同时包含 '3s' 和 '分钟'
|
||||
const hasThreeSeconds = selectedLabels.some(label => label.includes('3s'))
|
||||
const hasMinuteStats = selectedLabels.some(label => label.includes('分钟'))
|
||||
const hasLuBo = selectedLabels.some(label => label.includes('录波'))
|
||||
|
||||
if (hasThreeSeconds && hasMinuteStats) {
|
||||
ElMessage.warning('3s实时数据与分钟统计数据不能同时选择')
|
||||
formContent.datasourceIds = []
|
||||
realTimeSetting.value = false
|
||||
statisticsSetting.value = false
|
||||
waveRecordSetting.value = false
|
||||
return
|
||||
}
|
||||
|
||||
if (hasLuBo && hasMinuteStats) {
|
||||
ElMessage.warning('录波数据与分钟统计数据不能同时选择')
|
||||
formContent.datasourceIds = []
|
||||
realTimeSetting.value = false
|
||||
statisticsSetting.value = false
|
||||
waveRecordSetting.value = false
|
||||
return
|
||||
}
|
||||
// 判断是否选择了多个“分钟统计数据”项
|
||||
const minuteStatLabels = selectedLabels.filter(label => label.includes('分钟'))
|
||||
if (minuteStatLabels.length > 1) {
|
||||
ElMessage.warning('分钟统计数据不能多选')
|
||||
formContent.datasourceIds = []
|
||||
realTimeSetting.value = false
|
||||
statisticsSetting.value = false
|
||||
waveRecordSetting.value = false
|
||||
return
|
||||
}
|
||||
if (hasThreeSeconds) {
|
||||
realTimeSetting.value = true
|
||||
} else {
|
||||
realTimeSetting.value = false
|
||||
}
|
||||
if (hasMinuteStats) {
|
||||
statisticsSetting.value = true
|
||||
} else {
|
||||
statisticsSetting.value = false
|
||||
}
|
||||
if (hasLuBo) {
|
||||
waveRecordSetting.value = true
|
||||
} else {
|
||||
waveRecordSetting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1235,7 +1335,6 @@ const props = defineProps<{
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
// :deep(.dialog-small .el-dialog__body){
|
||||
// max-height: 330px !important;
|
||||
// }
|
||||
@@ -1254,6 +1353,12 @@ const props = defineProps<{
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
.fade-enter-from,
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -338,9 +338,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
fieldNames: { label: 'label', value: 'id' },
|
||||
render: scope => {
|
||||
return scope.row.testState === 0 ? (
|
||||
<el-tag type="primary" effect="dark">
|
||||
未检
|
||||
</el-tag>
|
||||
<el-tag type="info">未检</el-tag>
|
||||
) : scope.row.testState === 1 ? (
|
||||
<el-tag type="warning" effect="dark">
|
||||
检测中
|
||||
@@ -579,7 +577,11 @@ const importClick = () => {
|
||||
|
||||
// 点击导出按钮
|
||||
const exportClick = () => {
|
||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() => {
|
||||
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(() => {
|
||||
useDownload(
|
||||
exportPlan,
|
||||
'检测计划导出数据',
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<el-button type="primary" @click="submitForm()">保存配置</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="日志配置">
|
||||
<!-- <el-tab-pane label="日志配置">
|
||||
<div>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
@@ -181,20 +181,20 @@
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary">保存配置</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tab-pane>-->
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx'>
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import {computed, onMounted, Ref, ref} from 'vue'
|
||||
import {type Base} from '@/api/system/base/interface'
|
||||
import {type VersionRegister} from '@/api/system/versionRegister/interface'
|
||||
import {getTestConfig, updateTestConfig} from '@/api/system/base/index'
|
||||
import {getRegRes, updateRegRes} from '@/api/system/versionRegister/index'
|
||||
import {ElMessage, FormItemRule} from 'element-plus'
|
||||
import {useModeStore} from '@/stores/modules/mode'; // 引入模式 store
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { computed, onMounted, Ref, ref } from 'vue'
|
||||
import { type Base } from '@/api/system/base/interface'
|
||||
import { type VersionRegister } from '@/api/system/versionRegister/interface'
|
||||
import { getTestConfig, updateTestConfig } from '@/api/system/base/index'
|
||||
import { getRegRes, updateRegRes } from '@/api/system/versionRegister/index'
|
||||
import { ElMessage, FormItemRule } from 'element-plus'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
defineOptions({
|
||||
name: 'base'
|
||||
})
|
||||
|
||||
@@ -1,67 +1,98 @@
|
||||
<template>
|
||||
<el-dialog class='table-box' v-model='dialogVisible' top='114px'
|
||||
:style="{ height: height+'px', maxHeight: height+'px', overflow: 'hidden' }"
|
||||
title='字典数据'
|
||||
:width='width'
|
||||
:modal='false'>
|
||||
<div class='table-box' :style="{height:(height-64)+'px',maxHeight:(height-64)+'px',overflow:'hidden'}">
|
||||
<ProTable ref='proTable' :columns="columns" :request-api='getDictDataListByTypeId' :initParam="initParam">
|
||||
<el-dialog
|
||||
class="table-box"
|
||||
v-model="dialogVisible"
|
||||
top="114px"
|
||||
:style="{ height: height + 'px', maxHeight: height + 'px', overflow: 'hidden' }"
|
||||
title="字典数据"
|
||||
:width="width"
|
||||
:modal="false"
|
||||
>
|
||||
<div
|
||||
class="table-box"
|
||||
:style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }"
|
||||
>
|
||||
<ProTable ref="proTable" :columns="columns" :request-api="getDictDataListByTypeId" :initParam="initParam">
|
||||
<template #tableHeader="scope">
|
||||
<el-button v-auth.dict="'show_add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">新增</el-button>
|
||||
<el-button v-auth.dict="'show_export'" type='primary' :icon='Download' plain @click="downloadFile">导出</el-button>
|
||||
<el-button v-auth.dict="'show_delete'" type="danger" :icon="Delete" plain :disabled="!scope.isSelected"
|
||||
@click="batchDelete(scope.selectedListIds)">
|
||||
<el-button v-auth.dict="'show_add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button v-auth.dict="'show_export'" type="primary" :icon="Download" plain @click="downloadFile">
|
||||
导出
|
||||
</el-button>
|
||||
<el-button
|
||||
v-auth.dict="'show_delete'"
|
||||
type="danger"
|
||||
:icon="Delete"
|
||||
plain
|
||||
:disabled="!scope.isSelected"
|
||||
@click="batchDelete(scope.selectedListIds)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #operation="scope">
|
||||
<el-button v-auth.dict="'show_edit'" type="primary" link :icon="EditPen" @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.dict="'show_delete'" type="primary" link :icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button
|
||||
v-auth.dict="'show_edit'"
|
||||
type="primary"
|
||||
link
|
||||
:icon="EditPen"
|
||||
@click="openDialog('edit', scope.row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-auth.dict="'show_delete'"
|
||||
type="primary"
|
||||
link
|
||||
:icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<DataPopup :refresh-table='proTable?.getTableList' ref='dataPopup'/>
|
||||
<DataPopup :refresh-table="proTable?.getTableList" ref="dataPopup" />
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx" name="dictData">
|
||||
import {CirclePlus, Delete, Download, EditPen} from '@element-plus/icons-vue'
|
||||
import {type Dict} from '@/api/system/dictionary/interface'
|
||||
import {ColumnProps, ProTableInstance} from '@/components/ProTable/interface'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {deleteDictData, getDictDataListByTypeId, exportDictData} from "@/api/system/dictionary/dictData/index";
|
||||
import {useDownload} from "@/hooks/useDownload";
|
||||
import {exportDictType} from "@/api/system/dictionary/dictType";
|
||||
import { isShallow } from 'vue';
|
||||
import { CirclePlus, Delete, Download, EditPen } from '@element-plus/icons-vue'
|
||||
import { type Dict } from '@/api/system/dictionary/interface'
|
||||
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { deleteDictData, exportDictData, getDictDataListByTypeId } from '@/api/system/dictionary/dictData/index'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
|
||||
defineOptions({
|
||||
name: 'dict'
|
||||
})
|
||||
})
|
||||
const proTable = ref<ProTableInstance>()
|
||||
const dialogVisible = ref(false)
|
||||
//字典数据所属的字典类型Id
|
||||
const dictTypeId = ref('')
|
||||
const dictTypeName = ref('')
|
||||
|
||||
|
||||
const initParam = reactive({typeId: ''})
|
||||
const initParam = reactive({ typeId: '' })
|
||||
|
||||
const dataPopup = ref()
|
||||
|
||||
const props = defineProps({
|
||||
width: {
|
||||
type: Number,
|
||||
default: 800,
|
||||
default: 800
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 744,
|
||||
},
|
||||
default: 744
|
||||
}
|
||||
})
|
||||
|
||||
const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
{type: 'selection', fixed: 'left', width: 70},
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
@@ -82,25 +113,25 @@ const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
prop: 'value',
|
||||
label: '值',
|
||||
minWidth: 180,
|
||||
render: (scope) => {
|
||||
render: scope => {
|
||||
if (scope.row.openValue === 0 || scope.row.value === null || scope.row.value === '') {
|
||||
return <span>/</span>; // 使用 JSX 返回 VNode
|
||||
return <span>/</span> // 使用 JSX 返回 VNode
|
||||
}
|
||||
return <span>{scope.row.value}</span>; // 使用 JSX 返回 VNode
|
||||
return <span>{scope.row.value}</span> // 使用 JSX 返回 VNode
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'level',
|
||||
label: '事件等级',
|
||||
minWidth: 180,
|
||||
isShow:false,
|
||||
isShow: false,
|
||||
render: scope => {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
(<el-tag type={scope.row.level === 0 ? 'info' : scope.row.level === 1 ? 'warning' : 'danger'}>
|
||||
<el-tag type={scope.row.level === 0 ? 'info' : scope.row.level === 1 ? 'warning' : 'danger'}>
|
||||
{scope.row.level === 0 ? '普通' : scope.row.level === 1 ? '中等' : '严重'}
|
||||
</el-tag>)
|
||||
</el-tag>
|
||||
}
|
||||
</>
|
||||
)
|
||||
@@ -116,7 +147,7 @@ const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
width: 200
|
||||
},
|
||||
}
|
||||
])
|
||||
|
||||
const open = (row: Dict.ResDictType) => {
|
||||
@@ -126,7 +157,7 @@ const open = (row: Dict.ResDictType) => {
|
||||
initParam.typeId = row.id
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
defineExpose({ open })
|
||||
|
||||
// 打开 dialog(新增、查看、编辑)
|
||||
const openDialog = (titleType: string, row: Partial<Dict.ResDictData> = {}) => {
|
||||
@@ -147,8 +178,17 @@ const handleDelete = async (params: Dict.ResDictData) => {
|
||||
}
|
||||
|
||||
const downloadFile = async () => {
|
||||
ElMessageBox.confirm('确认导出字典数据?', '温馨提示', {type: 'warning'}).then(() =>
|
||||
useDownload(exportDictData, '字典数据导出数据', {typeId: dictTypeId.value, ...(proTable.value?.searchParam)}, false),
|
||||
ElMessageBox.confirm('确认导出字典数据?', '温馨提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(() =>
|
||||
useDownload(
|
||||
exportDictData,
|
||||
'字典数据导出数据',
|
||||
{ typeId: dictTypeId.value, ...proTable.value?.searchParam },
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,31 +1,49 @@
|
||||
<template>
|
||||
<div class='table-box' ref='popupBaseView'>
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getDictTypeList'
|
||||
<div class="table-box" ref="popupBaseView">
|
||||
<ProTable ref="proTable" :columns="columns" :request-api="getDictTypeList">
|
||||
<template #tableHeader="scope">
|
||||
<el-button v-auth.dict="'add'" type="primary" :icon="CirclePlus" @click="openDialog('add')">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button v-auth.dict="'export'" type="primary" :icon="Download" plain @click="downloadFile()">
|
||||
导出
|
||||
</el-button>
|
||||
<el-button
|
||||
v-auth.dict="'delete'"
|
||||
type="danger"
|
||||
:icon="Delete"
|
||||
plain
|
||||
:disabled="!scope.isSelected"
|
||||
@click="batchDelete(scope.selectedListIds)"
|
||||
>
|
||||
<template #tableHeader='scope'>
|
||||
<el-button v-auth.dict="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||
<el-button v-auth.dict="'export'" type='primary' :icon='Download' plain @click='downloadFile()'>导出</el-button>
|
||||
<el-button v-auth.dict="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||
@click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #operation='scope'>
|
||||
<el-button v-auth.dict="'show'" type='primary' link :icon='View' @click='toDictData(scope.row)'>查看</el-button>
|
||||
<el-button v-auth.dict="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button v-auth.dict="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||
<template #operation="scope">
|
||||
<el-button v-auth.dict="'show'" type="primary" link :icon="View" @click="toDictData(scope.row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-auth.dict="'edit'"
|
||||
type="primary"
|
||||
link
|
||||
:icon="EditPen"
|
||||
@click="openDialog('edit', scope.row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-auth.dict="'delete'" type="primary" link :icon="Delete" @click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
</div>
|
||||
<DictData :width='viewWidth' :height='viewHeight' ref='openView' />
|
||||
<TypePopup :refresh-table='proTable?.getTableList' ref='typePopup' />
|
||||
<DictData :width="viewWidth" :height="viewHeight" ref="openView" />
|
||||
<TypePopup :refresh-table="proTable?.getTableList" ref="typePopup" />
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='dict'>
|
||||
<script setup lang="tsx" name="dict">
|
||||
import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons-vue'
|
||||
import { type Dict } from '@/api/system/dictionary/interface'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
@@ -33,11 +51,12 @@ import DictData from '@/views/system/dictionary/dictData/index.vue'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { useViewSize } from '@/hooks/useViewSize'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
|
||||
import { deleteDictType, exportDictType, getDictTypeList } from '@/api/system/dictionary/dictType'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'dict'
|
||||
})
|
||||
})
|
||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||
|
||||
const proTable = ref<ProTableInstance>()
|
||||
@@ -52,47 +71,45 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
||||
label: '类型名称',
|
||||
minWidth: 180,
|
||||
search: {
|
||||
el: 'input',
|
||||
},
|
||||
el: 'input'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '类型编码',
|
||||
minWidth: 220,
|
||||
search: {
|
||||
el: 'input',
|
||||
},
|
||||
el: 'input'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '描述',
|
||||
minWidth: 250,
|
||||
minWidth: 250
|
||||
},
|
||||
{
|
||||
prop: 'sort',
|
||||
label: '排序',
|
||||
minWidth: 70,
|
||||
minWidth: 70
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
minWidth: 180,
|
||||
minWidth: 180
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
width: 250,
|
||||
},
|
||||
width: 250
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
// 打开 drawer(新增、编辑)
|
||||
const openDialog = (titleType: string, row: Partial<Dict.ResDictType> = {}) => {
|
||||
typePopup.value?.open(titleType, row)
|
||||
}
|
||||
|
||||
|
||||
// 批量删除字典类型
|
||||
const batchDelete = async (id: string[]) => {
|
||||
await useHandleData(deleteDictType, id, '删除所选字典类型')
|
||||
@@ -113,8 +130,10 @@ const toDictData = (row: Dict.ResDictType) => {
|
||||
|
||||
// 导出字典类型列表
|
||||
const downloadFile = async () => {
|
||||
ElMessageBox.confirm('确认导出字典类型数据?', '温馨提示', { type: 'warning' }).then(() =>
|
||||
useDownload(exportDictType, '字典类型导出数据', proTable.value?.searchParam, false),
|
||||
)
|
||||
ElMessageBox.confirm('确认导出字典类型数据?', '温馨提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}).then(() => useDownload(exportDictType, '字典类型导出数据', proTable.value?.searchParam, false))
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -13,84 +13,61 @@
|
||||
<el-text style="margin-left: 82%">{{ 'v' + versionNumber }}</el-text>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-descriptions
|
||||
class="mode-descriptions"
|
||||
v-if="!hadActivationCode"
|
||||
title="模块激活状态"
|
||||
size="small"
|
||||
></el-descriptions>
|
||||
<el-form
|
||||
ref="applicationFormRef"
|
||||
v-if="!hadActivationCode"
|
||||
:model="applicationForm"
|
||||
label-position="left"
|
||||
:label-width="100"
|
||||
<el-descriptions class="mode-descriptions" title="模块激活状态" size="small"></el-descriptions>
|
||||
<el-form label-position="left" :label-width="100">
|
||||
<el-form-item class="mode-item" label="模拟式模块">
|
||||
<el-tag
|
||||
v-if="activateInfo.simulate.permanently !== 1"
|
||||
class="activated-state"
|
||||
disable-transitions
|
||||
type="danger"
|
||||
>
|
||||
<el-form-item
|
||||
class="mode-item"
|
||||
v-if="activateInfo.simulate.apply !== 1 || activateInfo.simulate.permanently !== 1"
|
||||
label="模拟式模块"
|
||||
prop="simulate.apply"
|
||||
未激活
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-if="activateInfo.simulate.permanently === 1"
|
||||
class="activated-state"
|
||||
disable-transitions
|
||||
type="success"
|
||||
>
|
||||
<el-tag disable-transitions type="danger">未激活</el-tag>
|
||||
<el-checkbox
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
class="apply-checkbox"
|
||||
v-model="applicationForm.simulate.apply"
|
||||
label="激活"
|
||||
/>
|
||||
已激活
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="mode-item"
|
||||
v-if="activateInfo.simulate.apply === 1 && activateInfo.simulate.permanently === 1"
|
||||
label="模拟式模块"
|
||||
<el-form-item class="mode-item" label="数字式模块">
|
||||
<el-tag
|
||||
v-if="activateInfo.digital.permanently !== 1"
|
||||
class="activated-state"
|
||||
disable-transitions
|
||||
type="danger"
|
||||
>
|
||||
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
|
||||
未激活
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-if="activateInfo.digital.permanently === 1"
|
||||
class="activated-state"
|
||||
disable-transitions
|
||||
type="success"
|
||||
>
|
||||
已激活
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="mode-item"
|
||||
v-if="activateInfo.digital.apply !== 1 || activateInfo.digital.permanently !== 1"
|
||||
label="数字式模块"
|
||||
prop="digital.apply"
|
||||
<el-form-item class="mode-item" label="比对式模块">
|
||||
<el-tag
|
||||
v-if="activateInfo.contrast.permanently !== 1"
|
||||
class="activated-state"
|
||||
disable-transitions
|
||||
type="danger"
|
||||
>
|
||||
<el-tag disable-transitions type="danger">未激活</el-tag>
|
||||
<el-checkbox
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
class="apply-checkbox"
|
||||
v-model="applicationForm.digital.apply"
|
||||
label="激活"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="mode-item"
|
||||
v-if="activateInfo.digital.apply === 1 && activateInfo.digital.permanently === 1"
|
||||
label="数字式模块"
|
||||
未激活
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-if="activateInfo.contrast.permanently === 1"
|
||||
class="activated-state"
|
||||
disable-transitions
|
||||
type="success"
|
||||
>
|
||||
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="mode-item"
|
||||
v-if="activateInfo.contrast.apply !== 1 || activateInfo.contrast.permanently !== 1"
|
||||
label="比对式模块"
|
||||
prop="contrast.apply"
|
||||
>
|
||||
<el-tag disable-transitions type="danger">未激活</el-tag>
|
||||
<el-checkbox
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
class="apply-checkbox"
|
||||
v-model="applicationForm.contrast.apply"
|
||||
label="激活"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="mode-item"
|
||||
v-if="activateInfo.contrast.apply === 1 && activateInfo.contrast.permanently === 1"
|
||||
label="比对式模块"
|
||||
>
|
||||
<el-tag class="activated-tag" disable-transitions type="success">已激活</el-tag>
|
||||
已激活
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row v-if="applicationCode">
|
||||
@@ -137,25 +114,16 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { version } from '../../../../package.json'
|
||||
import type { Activate } from '@/api/activate/interface'
|
||||
import { generateApplicationCode, verifyActivationCode } from '@/api/activate'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const activateInfo = authStore.activateInfo
|
||||
const versionNumber = ref(version)
|
||||
const applicationForm = reactive<Activate.ApplicationCodePlaintext>({
|
||||
simulate: { apply: 0 },
|
||||
digital: { apply: 0 },
|
||||
contrast: { apply: 0 }
|
||||
})
|
||||
const activatedAll = computed(() => {
|
||||
return (
|
||||
activateInfo.simulate.apply === 1 &&
|
||||
activateInfo.simulate.permanently === 1 &&
|
||||
activateInfo.digital.apply === 1 &&
|
||||
activateInfo.digital.permanently === 1 &&
|
||||
activateInfo.contrast.apply === 1 &&
|
||||
activateInfo.contrast.permanently === 1
|
||||
)
|
||||
})
|
||||
@@ -166,25 +134,7 @@ const activationCode = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
// 获取申请码
|
||||
const getApplicationCode = async () => {
|
||||
if (
|
||||
applicationForm.simulate.apply == 0 &&
|
||||
applicationForm.digital.apply == 0 &&
|
||||
applicationForm.contrast.apply == 0
|
||||
) {
|
||||
ElMessage.warning('请选择需要激活的模块')
|
||||
return
|
||||
}
|
||||
if (activateInfo.simulate.apply === 1) {
|
||||
applicationForm.simulate.apply = 1
|
||||
}
|
||||
if (activateInfo.digital.apply === 1) {
|
||||
applicationForm.digital.apply = 1
|
||||
}
|
||||
if (activateInfo.contrast.apply === 1) {
|
||||
applicationForm.contrast.apply = 1
|
||||
}
|
||||
|
||||
const res = await generateApplicationCode(applicationForm)
|
||||
const res = await generateApplicationCode()
|
||||
if (res.code == 'A0000') {
|
||||
applicationCode.value = res.data as string
|
||||
}
|
||||
@@ -202,9 +152,6 @@ const openDialog = () => {
|
||||
hadActivationCode.value = false
|
||||
activationCode.value = ''
|
||||
applicationCode.value = ''
|
||||
applicationForm.simulate.apply = 0
|
||||
applicationForm.digital.apply = 0
|
||||
applicationForm.contrast.apply = 0
|
||||
dialogVisible.value = true
|
||||
}
|
||||
const beforeClose = (done: Function) => {
|
||||
@@ -228,15 +175,12 @@ const submitActivation = async () => {
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
<style scoped>
|
||||
.apply-checkbox {
|
||||
margin-left: 62%;
|
||||
}
|
||||
.activated-tag {
|
||||
.activated-state {
|
||||
margin-left: 80%;
|
||||
}
|
||||
.code-display,
|
||||
.code-input {
|
||||
font-family: consolas;
|
||||
font-family: consolas, sans-serif;
|
||||
}
|
||||
:deep(.el-tag) {
|
||||
user-select: none;
|
||||
|
||||
@@ -37,15 +37,13 @@
|
||||
"electron-builder": "^25.1.8"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
"autofit.js": "^3.2.8",
|
||||
"dayjs": "^1.10.7",
|
||||
"ee-core": "2.10.0",
|
||||
"ee-core": "4.1.5",
|
||||
"electron-updater": "^5.3.0",
|
||||
"event-source-polyfill": "^1.0.31",
|
||||
"lodash": "^4.17.21",
|
||||
"mqtt": "^5.10.1",
|
||||
"sass": "^1.80.4"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user