diff --git a/src/api/system/webhook/index.ts b/src/api/system/webhook/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..0402638c05ec607d02ee64234c2332f7b8165e42 --- /dev/null +++ b/src/api/system/webhook/index.ts @@ -0,0 +1,50 @@ +import request from '@/config/axios' +import type { Dayjs } from 'dayjs'; + +/** webhook信息 */ +export interface Webhook { + id: number; // ID + bizName?: string; // 群名称 + accessToken?: string; // 通证 + secret?: string; // 加签密钥 + type?: number; // 类型(0:钉钉,1:企微,2:飞书) + status?: number; // 状态(0正常 1关闭) + } + +// webhook API +export const WebhookApi = { + // 查询webhook分页 + getWebhookPage: async (params: any) => { + return await request.get({ url: `/system/webhook/page`, params }) + }, + + // 查询webhook详情 + getWebhook: async (id: number) => { + return await request.get({ url: `/system/webhook/get?id=` + id }) + }, + + // 新增webhook + createWebhook: async (data: Webhook) => { + return await request.post({ url: `/system/webhook/create`, data }) + }, + + // 修改webhook + updateWebhook: async (data: Webhook) => { + return await request.put({ url: `/system/webhook/update`, data }) + }, + + // 删除webhook + deleteWebhook: async (id: number) => { + return await request.delete({ url: `/system/webhook/delete?id=` + id }) + }, + + /** 批量删除webhook */ + deleteWebhookList: async (ids: number[]) => { + return await request.delete({ url: `/system/webhook/delete-list?ids=${ids.join(',')}` }) + }, + + // 导出webhook Excel + exportWebhook: async (params) => { + return await request.download({ url: `/system/webhook/export-excel`, params }) + } +} \ No newline at end of file diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 947f9f31a23497b1da6ee108dcd980084ab9c8e5..a705404e5761c02b53498cb9811065df04bfd2de 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -44,6 +44,7 @@ export const getIntDictOptions = (dictType: string): NumberDictDataType[] => { value: parseInt(dict.value + '') }) }) + console.log( 'dictOption', dictOption) return dictOption } @@ -244,5 +245,7 @@ export enum DICT_TYPE { IOT_PLUGIN_STATUS = 'iot_plugin_status', // IOT 插件状态 IOT_PLUGIN_TYPE = 'iot_plugin_type', // IOT 插件类型 IOT_DATA_BRIDGE_DIRECTION_ENUM = 'iot_data_bridge_direction_enum', // 桥梁方向 - IOT_DATA_BRIDGE_TYPE_ENUM = 'iot_data_bridge_type_enum' // 桥梁类型 + IOT_DATA_BRIDGE_TYPE_ENUM = 'iot_data_bridge_type_enum', // 桥梁类型 + WEBHOOK_TYPE = 'webhook_type', + ON_OFF = 'on_off' } diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 99eb428c3c60528d1c5d3d87fa86fd8b108cbb67..3b54e15ec31706667f0da7ce2f94be680c2212fe 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -198,6 +198,10 @@ export function formatPast2(ms: number): string { * @param cellValue 字段值 */ export function dateFormatter(_row: any, _column: TableColumnCtx, cellValue: any): string { + if (!cellValue) { + console.warn('dateFormatter received falsy value:', cellValue) + return 'N/A' // 或者返回 '--' + } return cellValue ? formatDate(cellValue) : '' } diff --git a/src/views/system/webhook/WebhookForm.vue b/src/views/system/webhook/WebhookForm.vue new file mode 100644 index 0000000000000000000000000000000000000000..db027370aed96ee2c2fa72c13dbb71966192294b --- /dev/null +++ b/src/views/system/webhook/WebhookForm.vue @@ -0,0 +1,148 @@ + + diff --git a/src/views/system/webhook/index.vue b/src/views/system/webhook/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..20337a6b1cd24436738cced52b6a92f28c5a0a19 --- /dev/null +++ b/src/views/system/webhook/index.vue @@ -0,0 +1,275 @@ + + +