From f22b4e7fb87f6638e5f5606babae93cd42276ee1 Mon Sep 17 00:00:00 2001
From: sjl <1716605279@qq.com>
Date: Wed, 22 Jan 2025 12:09:32 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/api/index.ts | 6 ++++
frontend/src/utils/webSocketClient.ts | 2 +-
frontend/src/views/machine/device/index.vue | 30 +++++++++++--------
.../testScript/components/testScriptPopup.vue | 2 +-
frontend/src/views/plan/planList/index.vue | 13 ++++++++
5 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts
index 7ea5370..ac7ea6f 100644
--- a/frontend/src/api/index.ts
+++ b/frontend/src/api/index.ts
@@ -1,3 +1,4 @@
+import { ElMessage, ElTreeSelect } from 'element-plus';
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
import { showFullScreenLoading, tryHideFullScreenLoading } from '@/components/Loading/fullScreen'
import { LOGIN_URL } from '@/config'
@@ -70,6 +71,11 @@ class RequestHttp {
}
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
if (data.code && data.code !== ResultEnum.SUCCESS) {
+ if(data.message.includes('&')){
+ const formattedMessage = data.message.split('&').join('
');
+ ElMessage.error({ message: formattedMessage, dangerouslyUseHTMLString: true });
+ return Promise.reject(data)
+ }
ElMessage.error(data.message)
return Promise.reject(data)
}
diff --git a/frontend/src/utils/webSocketClient.ts b/frontend/src/utils/webSocketClient.ts
index c613c8f..293b086 100644
--- a/frontend/src/utils/webSocketClient.ts
+++ b/frontend/src/utils/webSocketClient.ts
@@ -40,7 +40,7 @@ export default class SocketService {
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
- const url = 'ws://192.168.1.127:7777/hello?name=cdf'
+ const url = 'ws://localhost:7777/hello?name=cdf'
this.ws = new WebSocket(url);
// 连接成功的事件
this.ws.onopen = () => {
diff --git a/frontend/src/views/machine/device/index.vue b/frontend/src/views/machine/device/index.vue
index b7516cb..1023158 100644
--- a/frontend/src/views/machine/device/index.vue
+++ b/frontend/src/views/machine/device/index.vue
@@ -172,6 +172,19 @@ const columns = reactive[]>([
prop: 'createTime',
label: '创建时间',
width: 200,
+ render: scope => {
+ if (scope.row.createTime) {
+ const date = new Date(scope.row.createTime);
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0');
+ const day = String(date.getDate()).padStart(2, '0');
+ const hours = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ const seconds = String(date.getSeconds()).padStart(2, '0');
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ }
+ return '';
+ }
},
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 },
])
@@ -193,20 +206,10 @@ const openDialog = (titleType: string, row: Partial = {}) => {
// 批量删除设备
const batchDelete = async (id: string[]) => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
- const result = await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备')
- console.log(result)
- if(result.code != 'A0000'){
- proTable.value?.clearSelection()
- ElMessage.error('1')
- console.log('1')
- }else{
- ElMessage.error('12')
- console.log('12')
- proTable.value?.clearSelection()
- proTable.value?.getTableList()
- }
-
+ await useHandleData(deletePqDev, { 'ids': id, 'pattern': patternId }, '删除所选设备')
+ proTable.value?.clearSelection()
+ proTable.value?.getTableList()
}
// 删除设备
@@ -214,6 +217,7 @@ const handleDelete = async (params: Device.ResPqDev) => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
await useHandleData(deletePqDev, { 'ids': [params.id], 'pattern': patternId }, `删除【${params.name}】设备`)
proTable.value?.getTableList()
+
}
// 导出设备
diff --git a/frontend/src/views/machine/testScript/components/testScriptPopup.vue b/frontend/src/views/machine/testScript/components/testScriptPopup.vue
index a187d01..fcfd36e 100644
--- a/frontend/src/views/machine/testScript/components/testScriptPopup.vue
+++ b/frontend/src/views/machine/testScript/components/testScriptPopup.vue
@@ -122,7 +122,7 @@ const open = async (sign: string,row: any,currentMode: string,id:string) => {
}
});
- console.log('secondLevelOptions',secondLevelOptions);
+ //console.log('secondLevelOptions',secondLevelOptions);
if(id != ''){//新增的时候才会重新赋值值类型
formContent.value.valueType = id
diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue
index ece26b1..c266c66 100644
--- a/frontend/src/views/plan/planList/index.vue
+++ b/frontend/src/views/plan/planList/index.vue
@@ -159,6 +159,19 @@ const columns = reactive[]>([
prop: 'createTime',
label: '创建时间',
width: 200,
+ render: scope => {
+ if (scope.row.createTime) {
+ const date = new Date(scope.row.createTime);
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0');
+ const day = String(date.getDate()).padStart(2, '0');
+ const hours = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ const seconds = String(date.getSeconds()).padStart(2, '0');
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ }
+ return '';
+ }
},
{
prop: 'sourceName',