diff --git a/apps/web-antd/src/views/iot/rule/data/data.ts b/apps/web-antd/src/views/iot/rule/data/data.ts deleted file mode 100644 index efebb92d0..000000000 --- a/apps/web-antd/src/views/iot/rule/data/data.ts +++ /dev/null @@ -1,103 +0,0 @@ -import type { VbenFormSchema } from '#/adapter/form'; -import type { VxeTableGridOptions } from '#/adapter/vxe-table'; - -import { DICT_TYPE } from '@vben/constants'; -import { getDictOptions } from '@vben/hooks'; - -import { getSimpleProductList } from '#/api/iot/product/product'; -import { getRangePickerDefaultProps } from '#/utils'; - -/** 列表的搜索表单 */ -export function useGridFormSchema(): VbenFormSchema[] { - return [ - { - fieldName: 'name', - label: '规则名称', - component: 'Input', - componentProps: { - placeholder: '请输入规则名称', - allowClear: true, - }, - }, - { - fieldName: 'productId', - label: '产品', - component: 'ApiSelect', - componentProps: { - api: getSimpleProductList, - labelField: 'name', - valueField: 'id', - placeholder: '请选择产品', - allowClear: true, - }, - }, - { - fieldName: 'status', - label: '规则状态', - component: 'Select', - componentProps: { - options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), - placeholder: '请选择状态', - allowClear: true, - }, - }, - { - fieldName: 'createTime', - label: '创建时间', - component: 'RangePicker', - componentProps: { - ...getRangePickerDefaultProps(), - allowClear: true, - }, - }, - ]; -} - -/** 列表的字段 */ -export function useGridColumns(): VxeTableGridOptions['columns'] { - return [ - { type: 'checkbox', width: 40 }, - { - field: 'id', - title: '规则编号', - minWidth: 80, - }, - { - field: 'name', - title: '规则名称', - minWidth: 150, - }, - { - field: 'description', - title: '规则描述', - minWidth: 200, - }, - { - field: 'status', - title: '规则状态', - minWidth: 100, - cellRender: { - name: 'CellDict', - props: { type: DICT_TYPE.COMMON_STATUS }, - }, - }, - // TODO @haohao:这里是【数据源】【数据目的】 - { - field: 'sinkCount', - title: '数据流转数', - minWidth: 100, - }, - { - field: 'createTime', - title: '创建时间', - minWidth: 180, - formatter: 'formatDateTime', - }, - { - title: '操作', - width: 240, - fixed: 'right', - slots: { default: 'actions' }, - }, - ]; -} diff --git a/apps/web-antd/src/views/iot/rule/data/index.vue b/apps/web-antd/src/views/iot/rule/data/index.vue index f6eb38168..34f902df9 100644 --- a/apps/web-antd/src/views/iot/rule/data/index.vue +++ b/apps/web-antd/src/views/iot/rule/data/index.vue @@ -1,128 +1,26 @@ - - - - - - - - - + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/rule/data.ts b/apps/web-antd/src/views/iot/rule/data/rule/data.ts index d4e453b4b..9e07c8573 100644 --- a/apps/web-antd/src/views/iot/rule/data/rule/data.ts +++ b/apps/web-antd/src/views/iot/rule/data/rule/data.ts @@ -1,9 +1,11 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { DataRuleApi } from '#/api/iot/rule/data/rule'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; +import { getDataSinkSimpleList } from '#/api/iot/rule/data/sink'; import { getRangePickerDefaultProps } from '#/utils'; /** 列表的搜索表单 */ @@ -44,11 +46,11 @@ export function useGridFormSchema(): VbenFormSchema[] { export function useRuleFormSchema(): VbenFormSchema[] { return [ { - fieldName: 'id', component: 'Input', + fieldName: 'id', dependencies: { - show: false, - triggerFields: ['id'], + triggerFields: [''], + show: () => false, }, }, { @@ -82,12 +84,14 @@ export function useRuleFormSchema(): VbenFormSchema[] { { fieldName: 'sinkIds', label: '数据目的', - component: 'Select', + component: 'ApiSelect', componentProps: { - placeholder: '请选择数据目的', + api: getDataSinkSimpleList, + labelField: 'name', + valueField: 'id', mode: 'multiple', allowClear: true, - options: [], + placeholder: '请选择数据目的', }, rules: 'required', }, @@ -95,7 +99,7 @@ export function useRuleFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns(): VxeTableGridOptions['columns'] { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { type: 'checkbox', width: 40 }, { @@ -126,13 +130,13 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { field: 'sourceConfigs', title: '数据源', minWidth: 100, - formatter: ({ cellValue }: any) => `${cellValue?.length || 0} 个`, + formatter: ({ cellValue }) => `${cellValue?.length || 0} 个`, }, { field: 'sinkIds', title: '数据目的', minWidth: 100, - formatter: ({ cellValue }: any) => `${cellValue?.length || 0} 个`, + formatter: ({ cellValue }) => `${cellValue?.length || 0} 个`, }, { field: 'createTime', diff --git a/apps/web-antd/src/views/iot/rule/data/rule/index.vue b/apps/web-antd/src/views/iot/rule/data/rule/index.vue index 95128ae03..6f6d87a0c 100644 --- a/apps/web-antd/src/views/iot/rule/data/rule/index.vue +++ b/apps/web-antd/src/views/iot/rule/data/rule/index.vue @@ -1,5 +1,6 @@ diff --git a/apps/web-antd/src/views/iot/rule/data/rule/data-rule-form.vue b/apps/web-antd/src/views/iot/rule/data/rule/modules/form.vue similarity index 74% rename from apps/web-antd/src/views/iot/rule/data/rule/data-rule-form.vue rename to apps/web-antd/src/views/iot/rule/data/rule/modules/form.vue index c0e939d53..0fbc31114 100644 --- a/apps/web-antd/src/views/iot/rule/data/rule/data-rule-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/rule/modules/form.vue @@ -1,4 +1,6 @@ + + + + + + + + + + + + + + + + + {{ showSqlTip ? '收起表结构提示' : '查看表结构提示' }} + + + + + + + 目标数据库需包含以下结构的表,才能正常接收数据流转的消息 + + + + {{ copied ? '已复制' : '复制 SQL' }} + + + {{ TABLE_SQL }} + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/http-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/http-config-form.vue index bec6e969d..a064a3694 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/http-config-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/http-config-form.vue @@ -1,53 +1,46 @@ + - - - - - - - - - - - - - - - - - - - - - + + + + + http:// + https:// + + + + + + + GET + POST + PUT + DELETE + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/index.ts b/apps/web-antd/src/views/iot/rule/data/sink/config/index.ts index 6fb57388c..d2967eafe 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/index.ts +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/index.ts @@ -1,6 +1,9 @@ +export { default as DatabaseConfigForm } from './database-config-form.vue'; export { default as HttpConfigForm } from './http-config-form.vue'; export { default as KafkaMqConfigForm } from './kafka-mq-config-form.vue'; export { default as MqttConfigForm } from './mqtt-config-form.vue'; export { default as RabbitMqConfigForm } from './rabbit-mq-config-form.vue'; export { default as RedisStreamConfigForm } from './redis-stream-config-form.vue'; export { default as RocketMqConfigForm } from './rocket-mq-config-form.vue'; +export { default as TcpConfigForm } from './tcp-config-form.vue'; +export { default as WebSocketConfigForm } from './websocket-config-form.vue'; diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/kafka-mq-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/kafka-mq-config-form.vue index 8a3616513..3810c9685 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/kafka-mq-config-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/kafka-mq-config-form.vue @@ -1,25 +1,24 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/mqtt-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/mqtt-config-form.vue index e903bc8f5..3ccf4fad6 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/mqtt-config-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/mqtt-config-form.vue @@ -1,25 +1,24 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/rabbit-mq-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/rabbit-mq-config-form.vue index 7a3a3d50c..00cdf46c6 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/rabbit-mq-config-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/rabbit-mq-config-form.vue @@ -1,30 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/redis-stream-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/redis-stream-config-form.vue index 75f4e4c5d..4c840a45f 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/redis-stream-config-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/redis-stream-config-form.vue @@ -1,58 +1,92 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/rocket-mq-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/rocket-mq-config-form.vue index 384e7e0b4..862cfdf74 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/config/rocket-mq-config-form.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/rocket-mq-config-form.vue @@ -1,25 +1,24 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/tcp-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/tcp-config-form.vue new file mode 100644 index 000000000..b04eaab3f --- /dev/null +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/tcp-config-form.vue @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + JSON + BINARY + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/config/websocket-config-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/config/websocket-config-form.vue new file mode 100644 index 000000000..802e449da --- /dev/null +++ b/apps/web-antd/src/views/iot/rule/data/sink/config/websocket-config-form.vue @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JSON + TEXT + + + + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/views/iot/rule/data/sink/data-sink-form.vue b/apps/web-antd/src/views/iot/rule/data/sink/data-sink-form.vue deleted file mode 100644 index 98ce5faf7..000000000 --- a/apps/web-antd/src/views/iot/rule/data/sink/data-sink-form.vue +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - 配置信息 - - - - - - - - - - diff --git a/apps/web-antd/src/views/iot/rule/data/sink/data.ts b/apps/web-antd/src/views/iot/rule/data/sink/data.ts index 9af434569..4d70695f2 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/data.ts +++ b/apps/web-antd/src/views/iot/rule/data/sink/data.ts @@ -1,5 +1,6 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { DataSinkApi } from '#/api/iot/rule/data/sink'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; @@ -50,60 +51,8 @@ export function useGridFormSchema(): VbenFormSchema[] { ]; } -/** 目的表单 Schema */ -export function useSinkFormSchema(): VbenFormSchema[] { - return [ - { - fieldName: 'id', - component: 'Input', - dependencies: { - show: false, - triggerFields: ['id'], - }, - }, - { - fieldName: 'name', - label: '目的名称', - component: 'Input', - componentProps: { - placeholder: '请输入目的名称', - }, - rules: 'required', - }, - { - fieldName: 'description', - label: '目的描述', - component: 'Textarea', - componentProps: { - placeholder: '请输入目的描述', - rows: 3, - }, - }, - { - fieldName: 'type', - label: '目的类型', - component: 'Select', - componentProps: { - options: getDictOptions(DICT_TYPE.IOT_DATA_SINK_TYPE_ENUM, 'number'), - placeholder: '请选择目的类型', - }, - rules: 'required', - }, - { - fieldName: 'status', - label: '目的状态', - component: 'RadioGroup', - componentProps: { - options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), - }, - defaultValue: 0, - rules: 'required', - }, - ]; -} - /** 列表的字段 */ -export function useGridColumns(): VxeTableGridOptions['columns'] { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { type: 'checkbox', width: 40 }, { diff --git a/apps/web-antd/src/views/iot/rule/data/sink/index.vue b/apps/web-antd/src/views/iot/rule/data/sink/index.vue index 8d81805c5..96dad2d3e 100644 --- a/apps/web-antd/src/views/iot/rule/data/sink/index.vue +++ b/apps/web-antd/src/views/iot/rule/data/sink/index.vue @@ -1,5 +1,6 @@ diff --git a/apps/web-antd/src/views/iot/rule/data/sink/modules/form.vue b/apps/web-antd/src/views/iot/rule/data/sink/modules/form.vue new file mode 100644 index 000000000..1e994a979 --- /dev/null +++ b/apps/web-antd/src/views/iot/rule/data/sink/modules/form.vue @@ -0,0 +1,185 @@ + + + + + + + + + + + + + handleTypeChange(value as number)" + /> + + + + + + + + + + + + + + + {{ dict.label }} + + + + + + diff --git a/apps/web-antd/src/views/mes/utils/constants.ts b/apps/web-antd/src/views/mes/utils/constants.ts index 1e28f3d91..32f282f22 100644 --- a/apps/web-antd/src/views/mes/utils/constants.ts +++ b/apps/web-antd/src/views/mes/utils/constants.ts @@ -13,4 +13,43 @@ export const MesItemOrProductEnum = { /** MES 自动编码规则 Code 枚举 */ export const MesAutoCodeRuleCode = { MD_ITEM_TYPE_CODE: 'MD_ITEM_TYPE_CODE', + MD_ITEM_CODE: 'MD_ITEM_CODE', } as const; + +/** MES 条码格式枚举 */ +export enum BarcodeFormatEnum { + QR_CODE = 1, + EAN13 = 2, + CODE39 = 3, + UPC_A = 4, +} + +/** 条码格式映射表(枚举值 -> JsBarcode 格式名) */ +export const BARCODE_FORMAT_MAP: Record = { + [BarcodeFormatEnum.QR_CODE]: 'QR_CODE', + [BarcodeFormatEnum.EAN13]: 'EAN13', + [BarcodeFormatEnum.CODE39]: 'CODE39', + [BarcodeFormatEnum.UPC_A]: 'UPC_A', +}; + +/** MES 条码业务类型枚举 */ +export enum BarcodeBizTypeEnum { + WAREHOUSE = 102, + LOCATION = 103, + AREA = 104, + PACKAGE = 105, + STOCK = 106, + BATCH = 107, + PROCARD = 300, + WORKORDER = 301, + TRANSORDER = 302, + TASK = 303, + MACHINERY = 400, + TOOL = 500, + ITEM = 600, + VENDOR = 601, + WORKSTATION = 602, + WORKSHOP = 603, + USER = 604, + CLIENT = 605, +}
{{ TABLE_SQL }}