diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index ab50cf8c..4d97fdc9 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -28,7 +28,12 @@ const iconKeys = [ 'ExclamationCircleOutlined', 'UploadOutlined', 'PlusCircleOutlined', - 'QuestionCircleOutlined' + 'QuestionCircleOutlined', + 'BugOutlined', + 'BarsOutlined', + 'ArrowDownOutlined', + 'SmallDashOutlined', + 'TeamOutlined', ] const Icon = (props: {type: string}) => { diff --git a/src/views/notice/Config/index.vue b/src/views/notice/Config/index.vue index 691b1c42..0408912d 100644 --- a/src/views/notice/Config/index.vue +++ b/src/views/notice/Config/index.vue @@ -1,22 +1,364 @@ - - 通知配置 + + + + + + + + + + 新增 + + + 导入 + + 导出 + + + + + + + + + + + + {{ slotProps.name }} + + + + + 通知方式 + + + {{ getMethodTxt(slotProps.type) }} + + + + + 说明 + + {{ slotProps.description }} + + + + + + + + + + + {{ item.text }} + + + + + + + + + {{ item.text }} + + + + + + + + + + + + + + + + + + + + + + - +/** + * 根据通知方式展示对应logo + */ +const getLogo = (type: string, provider: string) => { + return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo; +}; +/** + * 通知方式字段展示对应文字 + */ +const getMethodTxt = (type: string) => { + return NOTICE_METHOD.find((f) => f.value === type)?.label; +}; + +/** + * 新增 + */ +const handleAdd = () => { + router.push(`/notice/Config/detail/:id`); +}; + +/** + * 导入 + */ +const beforeUpload = () => {}; + +/** + * 导出 + */ +const handleExport = () => {}; + +/** + * 查看 + */ +const handleView = (id: string) => { + message.warn(id + '暂未开发'); +}; + +const getActions = ( + data: Partial>, + type: 'card' | 'table', +): ActionsType[] => { + if (!data) return []; + const actions = [ + { + key: 'edit', + text: '编辑', + tooltip: { + title: '编辑', + }, + icon: 'EditOutlined', + onClick: () => { + // visible.value = true; + // current.value = data; + router.push(`/notice/Config/detail/${data.id}`); + }, + }, + { + key: 'debug', + text: '调试', + tooltip: { + title: '调试', + }, + icon: 'BugOutlined', + onClick: () => { + // debugVis.value = true; + }, + }, + { + key: 'debug', + text: '通知记录', + tooltip: { + title: '通知记录', + }, + icon: 'BarsOutlined', + onClick: () => { + // debugVis.value = true; + }, + }, + { + key: 'debug', + text: '导出', + tooltip: { + title: '导出', + }, + icon: 'ArrowDownOutlined', + onClick: () => { + // debugVis.value = true; + }, + }, + { + key: 'delete', + text: '删除', + // disabled: data.state.value !== 'notActive', + // tooltip: { + // title: + // data.state.value !== 'notActive' + // ? '已启用的设备不能删除' + // : '删除', + // }, + popConfirm: { + title: '确认删除?', + onConfirm: async () => { + const resp = await configApi.del(data.id); + if (resp.status === 200) { + message.success('操作成功!'); + // instanceRef.value?.reload(); + } else { + message.error('操作失败!'); + } + }, + }, + icon: 'DeleteOutlined', + }, + ]; + if (type === 'card') + return actions.filter((i: ActionsType) => i.key !== 'view'); + return actions; +}; + + diff --git a/src/views/notice/Template/Detail/index.vue b/src/views/notice/Template/Detail/index.vue index abf7e47a..82ce27eb 100644 --- a/src/views/notice/Template/Detail/index.vue +++ b/src/views/notice/Template/Detail/index.vue @@ -458,7 +458,7 @@ import { getImage } from '@/utils/comm'; import { Form } from 'ant-design-vue'; import { message } from 'ant-design-vue'; -import { TemplateFormData } from '../types'; +import { IVariableDefinitions, TemplateFormData } from '../types'; import { NOTICE_METHOD, TEMPLATE_FIELD_MAP, @@ -588,7 +588,7 @@ watch( format: '%s', }, ); - formData.value.variableDefinitions = result; + formData.value.variableDefinitions = result as IVariableDefinitions[]; }, { deep: true }, );