From c0cc3c021b2e19ad8abcd3a3b992d6ef602c3cbd Mon Sep 17 00:00:00 2001 From: hwj Date: Fri, 6 Feb 2026 11:47:51 +0800 Subject: [PATCH 1/7] =?UTF-8?q?style=EF=BC=9A=E6=A8=A1=E5=85=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E7=AD=9B=E9=80=89=E6=A1=86=E5=85=A5=E5=8F=82?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/erp/moldlist/index.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/views/erp/moldlist/index.vue b/src/views/erp/moldlist/index.vue index ba600ea7..2b0213f0 100644 --- a/src/views/erp/moldlist/index.vue +++ b/src/views/erp/moldlist/index.vue @@ -9,11 +9,11 @@ v-loading="typeTreeLoading" :data="brandTreeData" node-key="id" highlight-curren
- - + - + { const data = await MoldBrandApi.getMoldPage({ pageNo: queryParams.pageNo, pageSize: queryParams.pageSize, - deviceCode: queryParams.code, - deviceName: queryParams.name, + code: queryParams.code, + name: queryParams.name, brandId: queryParams.brand }) list.value = data.list From b1d91ffc19b95acc8069d1830ff46a607031f39b Mon Sep 17 00:00:00 2001 From: hwj Date: Fri, 6 Feb 2026 14:49:39 +0800 Subject: [PATCH 2/7] =?UTF-8?q?style=EF=BC=9A=E9=87=87=E9=9B=86=E8=AE=BE?= =?UTF-8?q?=E5=A4=87-=E6=98=AF=E6=88=96=E5=90=A6=E5=88=97=E6=94=B9?= =?UTF-8?q?=E6=88=90switch=E7=BB=84=E4=BB=B6=E5=88=87=E6=8D=A2/=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E8=AE=BE=E7=BD=AE=E5=BC=B9=E6=A1=86=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E4=B8=BB=E9=A2=98=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/index.ts | 5 +++++ src/locales/en.ts | 4 +++- src/locales/zh-CN.ts | 4 +++- src/views/iot/device/DeviceForm.vue | 26 +++++++------------------- src/views/iot/device/index.vue | 27 ++++++++++++++++++++++++++- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index 339a517e..c9efd899 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -145,6 +145,11 @@ export const DeviceApi = { return await request.get({ url: `/iot/device/devicePointList` }) }, + updateDeviceEnabled: async (id: number | string, enabled: string) => { + const data = { id, enabled } + return await request.put({ url: `/iot/device/update-enabled`, data }) + }, + // ==================== 子表(设备属性) ==================== // 获得设备属性分页 diff --git a/src/locales/en.ts b/src/locales/en.ts index e8e580aa..96e4f225 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -3574,7 +3574,7 @@ export default { protocol: 'Protocol', status: 'Connection Status', sampleCycle: 'Sample Cycle(s)', - isEnable: 'Enabled', + isEnable: 'Yes or No', collectionTime: 'Collection Time', operate: 'Operation', @@ -3591,11 +3591,13 @@ export default { placeholderUrl: 'Please enter endpoint URL', placeholderUsername: 'Please enter username', placeholderPassword: 'Please enter password', + placeholderTopic: 'Please enter subscription topic', model: 'Device Model', url: 'Endpoint URL', username: 'Username', password: 'Password', + topic: 'Subscription Topic', settingDialogTitle: 'Device Settings', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 2bb971b6..060387bc 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -3415,7 +3415,7 @@ export default { protocol: '采集协议', status: '连接状态', sampleCycle: '采集周期(s)', - isEnable: '是否启用', + isEnable: '是或否', collectionTime: '采集时间', operate: '操作', @@ -3432,11 +3432,13 @@ export default { placeholderUrl: '请输入端点URL', placeholderUsername: '请输入用户名', placeholderPassword: '请输入密码', + placeholderTopic: '请输入订阅主题', model: '设备模型', url: '端点URL', username: '用户名', password: '密码', + topic: '订阅主题', settingDialogTitle: '设备设置', diff --git a/src/views/iot/device/DeviceForm.vue b/src/views/iot/device/DeviceForm.vue index 8565fd7d..86e9e2fd 100644 --- a/src/views/iot/device/DeviceForm.vue +++ b/src/views/iot/device/DeviceForm.vue @@ -122,23 +122,10 @@ @@ -187,6 +174,7 @@ const formData = ref({ url: undefined, username: undefined, password: undefined, + topic: undefined, }) const formRules = reactive({ create: { @@ -200,7 +188,7 @@ const formRules = reactive({ isEnable: [{ required: true, message: '是否启用不能为空', trigger: 'blur' }] }, setting: { - url: [{ required: true, message: '端点URL不能为空', trigger: 'blur' }] + topic: [{ required: true, message: '订阅主题不能为空', trigger: 'blur' }] } }) @@ -236,7 +224,7 @@ const submitForm = async () => { // 提交请求 formLoading.value = true try { - const { id, deviceCode, deviceName, deviceModelId, sampleCycle, remark, isEnable, url, username, password } = formData.value as any + const { id, deviceCode, deviceName, deviceModelId, sampleCycle, remark, isEnable, topic } = formData.value as any if (formType.value === 'create') { const data: Partial = { deviceCode, deviceName, deviceModelId, sampleCycle, remark, isEnable } @@ -247,7 +235,7 @@ const submitForm = async () => { await DeviceApi.updateDevice(data) message.success(t('common.updateSuccess')) } else { - const data: any = { id, deviceCode, deviceName, deviceModelId, isEnable, url, username, password } + const data: any = { id, deviceCode, deviceName, deviceModelId, isEnable, topic } await DeviceApi.updateDevice(data) message.success(t('common.updateSuccess')) } diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 5b90b359..3f79b0ff 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -125,7 +125,10 @@ /> --> { return 'info' } +const isDeviceEnabled = (row: DeviceVO) => { + const value = (row as any)?.isEnable + if (typeof value === 'boolean') return value + const text = String(value ?? '').toLowerCase().trim() + if (!text) return false + if (text === 'true' || text === '1' || text === 'yes') return true + return false +} + +const handleDeviceEnableChange = async (row: DeviceVO, value: boolean) => { + if (!row.id) return + const oldValue = (row as any).isEnable + ;(row as any).isEnable = value + try { + await DeviceApi.updateDeviceEnabled(row.id, value ? 'true' : 'false') + message.success(t('common.updateSuccess')) + } catch { + ;(row as any).isEnable = oldValue + message.error(t('common.updateFail')) + } +} + const selectedIds = ref([]) const handleSelectionChange = (rows: any[]) => { selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? [] From 755978994f5824b6fd8c473682292d6be2abe188 Mon Sep 17 00:00:00 2001 From: hwj Date: Fri, 6 Feb 2026 16:04:04 +0800 Subject: [PATCH 3/7] =?UTF-8?q?style=EF=BC=9A=E9=85=8D=E6=96=B9=E5=BA=93-?= =?UTF-8?q?=E8=8B=A5=E5=BD=93=E5=89=8D=E5=AD=90=E5=88=97=E8=A1=A8=E6=9C=89?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=88=99=E8=AF=BB=E5=8F=96=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E6=B7=BB=E5=8A=A0=E8=A6=86=E7=9B=96=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/recipeConfig/index.ts | 2 +- src/locales/en.ts | 1 + src/locales/zh-CN.ts | 1 + .../components/FormulaLibraryReadDialog.vue | 13 ++++++- src/views/formula/formulaLibrary/index.vue | 37 ++++++++++++++++++- 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/api/iot/recipeConfig/index.ts b/src/api/iot/recipeConfig/index.ts index 06931a2d..6ab87269 100644 --- a/src/api/iot/recipeConfig/index.ts +++ b/src/api/iot/recipeConfig/index.ts @@ -176,7 +176,7 @@ export const RecipeConfigApi = { }, getRecipePointDetailPage: async (params: any) => { - return await request.get({ url: `/iot/recipe-device-attribute/page`, params }) + return await request.get({ url: `/iot/recipe-device-attribute/getList`, params }) }, updateRecipeDeviceAttribute: async (data: { recipeId: string | number; ids: number[] }) => { return await request.put({ url: `/iot/recipe-device-attribute/update`, data }) diff --git a/src/locales/en.ts b/src/locales/en.ts index 96e4f225..2d4e749a 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -2657,6 +2657,7 @@ export default { readDialogSubmitButtonText: 'Read', readDialogCancelButton: 'Cancel', readDeviceConfirmMessage: 'Do you want to read device data?', + readDialogOverwriteTip: 'Reading again will overwrite existing device data and manual parameters', detailTabDeviceDataLabel: 'Device Data', detailTabManualLabel: 'Manual Parameters', detailDevicePointNameColumn: 'Point Name', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 060387bc..2eab0318 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -2240,6 +2240,7 @@ export default { readDialogSubmitButtonText: '读 取', readDialogCancelButton: '取 消', readDeviceConfirmMessage: '是否读取设备数据?', + readDialogOverwriteTip: '再次读取会覆盖已有设备数据和手动录入参数', detailTabDeviceDataLabel: '设备数据', detailTabManualLabel: '手动录入参数', detailDevicePointNameColumn: '点位名称', diff --git a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue index 4eb9bbb5..855edfcc 100644 --- a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue +++ b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue @@ -1,6 +1,14 @@ - - @@ -165,11 +163,6 @@ > {{ t('action.edit') }} - - {{ isRowConnected(scope.row) ? t('DataCollection.Device.disconnect') : t('DataCollection.Device.connect') }} - { ;(row as any).isEnable = value try { await DeviceApi.updateDeviceEnabled(row.id, value ? 'true' : 'false') - message.success(t('common.updateSuccess')) + const name = (row as any).deviceName ?? (row as any).deviceCode ?? '' + const suffix = value ? '已启用' : '已停用' + if (name) { + message.success(`${name}${suffix}`) + } else { + message.success(suffix) + } } catch { ;(row as any).isEnable = oldValue message.error(t('common.updateFail')) From 6a7e6e63bd27f420f837a786d3a226938d40ddf0 Mon Sep 17 00:00:00 2001 From: hwj Date: Fri, 6 Feb 2026 16:16:19 +0800 Subject: [PATCH 5/7] =?UTF-8?q?style=EF=BC=9A=E9=85=8D=E6=96=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE-=E9=85=8D=E7=BD=AE=E5=BC=B9=E6=A1=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/formula/formulaConfig/index.vue | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/views/formula/formulaConfig/index.vue b/src/views/formula/formulaConfig/index.vue index a5a96ec3..61970a60 100644 --- a/src/views/formula/formulaConfig/index.vue +++ b/src/views/formula/formulaConfig/index.vue @@ -663,7 +663,7 @@ const buildTransferLabel = (item: any) => { const loadConfigCandidatesByDevice = async (deviceId: number) => { const data = await DeviceApi.getDeviceAttributeList(deviceId) - const list = (data?.list ?? data?.data ?? []) as any[] + const list = (data ?? []) as any[] const deviceItems = (list ?? []) .map((item: any) => { const key = normalizeKey(item?.attributeId ?? item?.id) @@ -674,12 +674,7 @@ const loadConfigCandidatesByDevice = async (deviceId: number) => { } as TransferItem }) .filter((it: any) => it && typeof it.key === 'number') as TransferItem[] - const merged = new Map() - for (const it of deviceItems) merged.set(it.key, it) - for (const it of configSelectedItems.value) { - if (!merged.has(it.key)) merged.set(it.key, it) - } - configCandidates.value = Array.from(merged.values()) + configCandidates.value = deviceItems } const openConfigDialog = async (recipeId: number | string) => { From a6cce6b03749e8f4f7589c3246cd6c9d57d8deeb Mon Sep 17 00:00:00 2001 From: hwj Date: Fri, 6 Feb 2026 16:22:28 +0800 Subject: [PATCH 6/7] =?UTF-8?q?style=EF=BC=9A=E9=85=8D=E6=96=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE-=E8=AF=A6=E6=83=85=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=8F=82=E6=A0=BC=E5=BC=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/formula/formulaConfig/components/RecipeDetailList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/formula/formulaConfig/components/RecipeDetailList.vue b/src/views/formula/formulaConfig/components/RecipeDetailList.vue index 7b44f74c..9d073d32 100644 --- a/src/views/formula/formulaConfig/components/RecipeDetailList.vue +++ b/src/views/formula/formulaConfig/components/RecipeDetailList.vue @@ -323,7 +323,7 @@ const getList = async () => { pageSize, recipeId: props.recipeId }) - list.value = (data.list ?? []).map(normalizeDetail) + list.value = (data ?? []).map(normalizeDetail) total.value = data.total // 产品单位 unitList.value = await ProductUnitApi.getProductUnitSimpleList() From fffba0cb13236ee09aa6c63c3a27dcb71e994aad Mon Sep 17 00:00:00 2001 From: hwj Date: Fri, 6 Feb 2026 16:31:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?style=EF=BC=9A=E9=85=8D=E6=96=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE-=E8=AF=A6=E6=83=85=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=8F=82=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formulaConfig/components/RecipeDetailList.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/views/formula/formulaConfig/components/RecipeDetailList.vue b/src/views/formula/formulaConfig/components/RecipeDetailList.vue index 9d073d32..57512efd 100644 --- a/src/views/formula/formulaConfig/components/RecipeDetailList.vue +++ b/src/views/formula/formulaConfig/components/RecipeDetailList.vue @@ -323,10 +323,16 @@ const getList = async () => { pageSize, recipeId: props.recipeId }) - list.value = (data ?? []).map(normalizeDetail) - total.value = data.total - // 产品单位 - unitList.value = await ProductUnitApi.getProductUnitSimpleList() + const rawList = Array.isArray((data as any)?.list) + ? (data as any).list + : Array.isArray((data as any)?.data) + ? (data as any).data + : Array.isArray(data) + ? data + : [] + list.value = rawList.map(normalizeDetail) + total.value = (data as any)?.total ?? rawList.length + unitList.value = await ProductUnitApi.getProductUnitSimpleList() } finally { loading.value = false }