diff --git a/src/axios/handlers/device-center/helpContent.ts b/src/axios/handlers/device-center/helpContent.ts index 6363a75..66cba3d 100644 --- a/src/axios/handlers/device-center/helpContent.ts +++ b/src/axios/handlers/device-center/helpContent.ts @@ -10,12 +10,14 @@ type HelpCategory = '操作说明' | '常见问题' | '新手指引' | '系统 type ApplicableScope = 'general' | 'specified' +type ClientTag = '体重跟踪工具小程序' | '设备运维小程序' + interface HelpContentRecord { id: string code: string category: HelpCategory title: string - clientTag: string + clientTag: ClientTag scope: ApplicableScope deviceTypes: string[] content: string @@ -54,7 +56,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP001', category: '操作说明', title: '智能货柜操作说明', - clientTag: 'APP-001', + clientTag: '设备运维小程序', scope: 'specified', deviceTypes: ['智能货柜', '档口机'], content: '智能货柜操作说明:\n1. 开机前检查电源连接是否正常;\n2. 按照屏幕提示完成初始化配置;\n3. 放置菜品后确认称重数据;\n4. 定期清理货柜内部卫生。', @@ -65,7 +67,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP002', category: '常见问题', title: '设备离线如何处理', - clientTag: 'APP-003', + clientTag: '设备运维小程序', scope: 'specified', deviceTypes: ['智能货柜'], content: '设备离线常见问题及处理方法:\n1. 检查设备网络连接是否正常;\n2. 确认路由器工作状态;\n3. 重启设备后观察是否恢复在线;\n4. 如仍离线,请联系运维人员上门处理。', @@ -76,7 +78,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP003', category: '系统版本', title: '系统升级通知(2026年7月)', - clientTag: 'APP-001', + clientTag: '体重跟踪工具小程序', scope: 'general', deviceTypes: [], content: '各位用户:\n系统将于2026年7月20日凌晨2:00-6:00进行例行升级维护,期间部分服务可能短暂中断,请提前做好业务安排。\n升级内容:\n1. 优化设备心跳检测机制;\n2. 修复数据分发异常问题;\n3. 提升系统整体稳定性。', @@ -87,7 +89,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP004', category: '操作说明', title: '入库秤使用指南', - clientTag: 'APP-003', + clientTag: '设备运维小程序', scope: 'specified', deviceTypes: ['入库秤'], content: '入库秤使用指南:\n1. 确认秤面平稳放置;\n2. 开机后等待归零提示;\n3. 将待称物品轻放秤面中央;\n4. 待读数稳定后记录数据;\n5. 称量完毕后清理秤面。', @@ -98,7 +100,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP005', category: '常见问题', title: '客户端登录异常通用排查', - clientTag: 'APP-001', + clientTag: '体重跟踪工具小程序', scope: 'general', deviceTypes: [], content: '客户端登录异常通用排查步骤:\n1. 确认账号密码输入是否正确;\n2. 检查客户端版本是否需要升级;\n3. 切换网络环境(WiFi/4G)后重试;\n4. 清理客户端本地缓存;\n5. 如仍无法登录,请联系管理员重置账号。', @@ -109,7 +111,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP006', category: '其他', title: '炒菜机器人维护保养注意事项', - clientTag: 'APP-003', + clientTag: '设备运维小程序', scope: 'specified', deviceTypes: ['炒菜机器人'], content: '炒菜机器人维护保养注意事项:\n1. 每日使用后清洁锅体表面油污;\n2. 每周检查搅拌臂转动是否顺畅;\n3. 每月对传动部件进行润滑保养;\n4. 定期检查电源线路绝缘状况;\n5. 发现异常噪音或异味立即停机报修。', @@ -120,7 +122,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP007', category: '新手指引', title: '营养秤校准流程', - clientTag: 'APP-001', + clientTag: '设备运维小程序', scope: 'specified', deviceTypes: ['营养秤'], content: '营养秤校准流程:\n1. 确认秤面无物品且干净;\n2. 进入设备设置菜单;\n3. 选择"校准"功能;\n4. 按照提示放置标准砝码;\n5. 等待校准完成提示;\n6. 校准完成后进行验证称量。', @@ -131,7 +133,7 @@ const helpContentList: HelpContentRecord[] = [ code: 'HLP008', category: '常见问题', title: '统计大屏数据显示异常', - clientTag: 'APP-001', + clientTag: '设备运维小程序', scope: 'specified', deviceTypes: ['统计大屏'], content: '统计大屏数据显示异常排查:\n1. 检查大屏与数据服务器的网络连接;\n2. 确认数据分发配置是否正确;\n3. 查看大屏本地缓存是否需要刷新;\n4. 重启大屏设备;\n5. 联系技术支持人员协助排查。', @@ -178,7 +180,7 @@ const addHelpContent = (ctx: MockContext): ApiResponse => { code: String(params.code ?? ''), category: (params.category as HelpCategory) ?? '其他', title: String(params.title ?? ''), - clientTag: String(params.clientTag ?? ''), + clientTag: (params.clientTag as ClientTag | undefined) ?? '设备运维小程序', scope: (params.scope as ApplicableScope) ?? 'general', deviceTypes: Array.isArray(params.deviceTypes) ? (params.deviceTypes as string[]) : [], content: String(params.content ?? ''), @@ -196,7 +198,7 @@ const updateHelpContent = (ctx: MockContext): ApiResponse => { if (params.code !== undefined) target.code = String(params.code) if (params.category !== undefined) target.category = params.category as HelpCategory if (params.title !== undefined) target.title = String(params.title) - if (params.clientTag !== undefined) target.clientTag = String(params.clientTag) + if (params.clientTag !== undefined) target.clientTag = params.clientTag as ClientTag if (params.scope !== undefined) target.scope = (params.scope as ApplicableScope) ?? 'general' if (params.deviceTypes !== undefined) target.deviceTypes = Array.isArray(params.deviceTypes) ? (params.deviceTypes as string[]) : [] if (params.content !== undefined) target.content = String(params.content) diff --git a/src/pages/admin-portal/device-center/help/content/component/drawer/detail/detail.vue b/src/pages/admin-portal/device-center/help/content/component/drawer/detail/detail.vue index dbc1a0c..4bff4f7 100644 --- a/src/pages/admin-portal/device-center/help/content/component/drawer/detail/detail.vue +++ b/src/pages/admin-portal/device-center/help/content/component/drawer/detail/detail.vue @@ -14,7 +14,9 @@ {{ detail.category }} {{ detail.title ?? '—' }} - {{ detail.clientTag ?? '—' }} + + {{ detail.clientTag }} + {{ detail.createTime ?? '—' }} @@ -43,7 +45,8 @@ import { ref } from 'vue' import { postRequest } from '@axios' import type { ApiResponse } from '@axios' -import type { ApplicableScope, HelpCategory } from '../../../../types' +import type { ApplicableScope, ClientTag, HelpCategory } from '../../../types' +import { clientTagColorMap } from '../../../types' /** 帮助内容列表项 */ interface HelpContentItem { @@ -51,7 +54,7 @@ interface HelpContentItem { code: string category: HelpCategory title: string - clientTag: string + clientTag: ClientTag scope: ApplicableScope deviceTypes: string[] content: string diff --git a/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/addOrEdit.vue b/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/addOrEdit.vue index bc19214..22e2605 100644 --- a/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/addOrEdit.vue +++ b/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/addOrEdit.vue @@ -46,11 +46,11 @@ - @@ -116,6 +116,7 @@ import { usePage } from './init/usePage' import { CATEGORY_OPTIONS, + CLIENT_TAG_OPTIONS, DEVICE_TYPE_OPTIONS, SCOPE_OPTIONS, } from '@pages/admin-portal/device-center/help/content/types' diff --git a/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/init/usePage.ts b/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/init/usePage.ts index 0023ebf..3197ee9 100644 --- a/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/init/usePage.ts +++ b/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/init/usePage.ts @@ -14,13 +14,13 @@ import { useAntdStaticMethods } from '@utils/antDesign/popUp' import { add, edit, info } from '../api' import type { Form, ModalType, OpenContext, PageInfo } from '../types' -/** 初始表单工厂:适用范围默认通用 */ +/** 初始表单工厂:适用范围默认通用,客户端标识不默认勾选 */ const createInitForm = (): Form => ({ id: undefined, code: '', category: '操作说明', title: '', - clientTag: '', + clientTag: undefined, scope: 'general', deviceTypes: [], content: '', @@ -59,7 +59,7 @@ export const usePage = (emit: (e: 'load') => void) => { const rules: Record = { category: [{ required: true, message: '请选择所属类别', trigger: 'change' }], title: [{ required: true, message: '请输入标题', trigger: 'blur' }], - clientTag: [{ required: true, message: '请输入客户端标识', trigger: 'blur' }], + clientTag: [{ required: true, message: '请选择客户端标识', trigger: 'change' }], scope: [{ required: true, message: '请选择适用范围', trigger: 'change' }], deviceTypes: [{ required: true, validator: validateDeviceTypes, trigger: 'change' }], content: [{ required: true, message: '请输入内容描述', trigger: 'blur' }], diff --git a/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/types/index.ts b/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/types/index.ts index 15d9fea..198f08c 100644 --- a/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/types/index.ts +++ b/src/pages/admin-portal/device-center/help/content/component/modal/addOrEdit/types/index.ts @@ -1,5 +1,5 @@ import type { FormInstance } from 'ant-design-vue/es/form' -import type { ApplicableScope, HelpCategory } from '../../../../types' +import type { ApplicableScope, ClientTag, HelpCategory } from '../../../../types' /** 弹框类型 */ export type ModalType = 'add' | 'edit' @@ -29,7 +29,7 @@ export interface Form { /** 标题 */ title: string /** 客户端标识 */ - clientTag: string + clientTag: ClientTag | undefined /** 适用范围 */ scope: ApplicableScope /** 适用设备分类(scope='specified' 时使用) */ diff --git a/src/pages/admin-portal/device-center/help/content/init/useTable.ts b/src/pages/admin-portal/device-center/help/content/init/useTable.ts index 97a3d38..7b8c448 100644 --- a/src/pages/admin-portal/device-center/help/content/init/useTable.ts +++ b/src/pages/admin-portal/device-center/help/content/init/useTable.ts @@ -17,7 +17,7 @@ export const tableColumns: TableColumnsType = [ h(Tag, { color: categoryColorMap[value] ?? 'default' }, () => value), }, { title: '标题', dataIndex: 'title', align: 'left', width: 240, resizable: true, ellipsis: true }, - { title: '客户端标识', dataIndex: 'clientTag', align: 'center', width: 130, resizable: true, ellipsis: true }, + { title: '客户端标识', dataIndex: 'clientTag', align: 'center', width: 160, resizable: true, ellipsis: true }, { title: '适用范围', dataIndex: 'scope', diff --git a/src/pages/admin-portal/device-center/help/content/types/index.ts b/src/pages/admin-portal/device-center/help/content/types/index.ts index 243e285..137302e 100644 --- a/src/pages/admin-portal/device-center/help/content/types/index.ts +++ b/src/pages/admin-portal/device-center/help/content/types/index.ts @@ -3,6 +3,9 @@ import type { BaseRecord, BaseSearchForm } from '@pages/admin-portal/shared/type /** 所属类别 */ export type HelpCategory = '操作说明' | '常见问题' | '新手指引' | '系统版本' | '其他' +/** 客户端标识 */ +export type ClientTag = '体重跟踪工具小程序' | '设备运维小程序' + /** 适用范围:通用 / 指定设备 */ export type ApplicableScope = 'general' | 'specified' @@ -15,7 +18,7 @@ export interface HelpContentItem extends BaseRecord { /** 标题 */ title: string /** 客户端标识 */ - clientTag: string + clientTag: ClientTag /** 适用范围 */ scope: ApplicableScope /** 适用设备分类(scope='specified' 时生效) */ @@ -38,7 +41,7 @@ export interface HelpContentPayload { code: string category: HelpCategory title: string - clientTag: string + clientTag: ClientTag scope: ApplicableScope deviceTypes: string[] content: string @@ -55,12 +58,16 @@ export const CATEGORY_OPTIONS = [ /** 客户端标识下拉选项 */ export const CLIENT_TAG_OPTIONS = [ - { label: '综合管理后台', value: '综合管理后台' }, - { label: '租户运营后台', value: '租户运营后台' }, - { label: '微信小程序', value: '微信小程序' }, - { label: '硬件终端', value: '硬件终端' }, + { label: '体重跟踪工具小程序', value: '体重跟踪工具小程序' }, + { label: '设备运维小程序', value: '设备运维小程序' }, ] +/** 客户端标识 → Tag 颜色 */ +export const clientTagColorMap: Record = { + '体重跟踪工具小程序': 'cyan', + '设备运维小程序': 'volcano', +} + /** 适用范围下拉/Radio 选项 */ export const SCOPE_OPTIONS = [ { label: '通用', value: 'general' as ApplicableScope },