diff --git a/apps/web-antd/src/api/application/appDevice/index.ts b/apps/web-antd/src/api/application/appDevice/index.ts new file mode 100644 index 0000000..fbc9080 --- /dev/null +++ b/apps/web-antd/src/api/application/appDevice/index.ts @@ -0,0 +1,87 @@ +import type { AppDeviceForm, AppDeviceQuery, AppDeviceVO } from './model'; + +import type { ID, IDS, PageResult } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +/** + * 查询平台设备分配列表 + * @param params + * @returns 平台设备分配列表 + */ +export function appDeviceList(params?: AppDeviceQuery) { + return requestClient.get>( + '/application/appDevice/list', + { params }, + ); +} + +/** + * 导出平台设备分配列表 + * @param params + * @returns 平台设备分配列表 + */ +export function appDeviceExport(params?: AppDeviceQuery) { + return commonExport('/application/appDevice/export', params ?? {}); +} + +/** + * 查询平台设备分配详情 + * @param id id + * @returns 平台设备分配详情 + */ +export function appDeviceInfo(id: ID) { + return requestClient.get(`/application/appDevice/${id}`); +} + +/** + * 新增平台设备分配 + * @param data + * @returns void + */ +export function appDeviceAdd(data: AppDeviceForm) { + return requestClient.postWithMsg('/application/appDevice', data); +} + +/** + * 更新平台设备分配 + * @param data + * @returns void + */ +export function appDeviceUpdate(data: AppDeviceForm) { + return requestClient.putWithMsg('/application/appDevice', data); +} + +/** + * 删除平台设备分配 + * @param id id + * @returns void + */ +export function appDeviceRemove(id: ID | IDS) { + return requestClient.deleteWithMsg(`/application/appDevice/${id}`); +} + +/** + * 查询未绑定设备列表 + * @param params + * @returns 未绑定设备列表 + */ +export function queryUnBindDevice(params?: AppDeviceQuery) { + return requestClient.get>( + '/application/appDevice/queryUnBindDevice', + { params }, + ); +} + +/** + * 查询已绑定设备列表 + * @param params + * @returns 已绑定设备列表 + */ +export function queryBindDevice(params?: AppDeviceQuery) { + return requestClient.get>( + '/application/appDevice/queryBindDevice', + { params }, + ); +} diff --git a/apps/web-antd/src/api/application/appDevice/model.d.ts b/apps/web-antd/src/api/application/appDevice/model.d.ts new file mode 100644 index 0000000..19a1d9e --- /dev/null +++ b/apps/web-antd/src/api/application/appDevice/model.d.ts @@ -0,0 +1,82 @@ +import type { BaseEntity, PageQuery } from '#/api/common'; + +export interface AppDeviceVO { + /** + * 编号 + */ + id: number | string; + + /** + * 设备唯一码 + */ + deviceKey: string; + + /** + * 产品码 + */ + productKey: string; + + /** + * 平台码 + */ + applicationCode: string; + + /** + * 分配时间 + */ + allotTime: string; +} + +export interface AppDeviceForm extends BaseEntity { + /** + * 编号 + */ + id?: number | string; + + /** + * 设备唯一码 + */ + deviceKey?: string; + + /** + * 产品码 + */ + productKey?: string; + + /** + * 平台码 + */ + applicationCode?: string; + + /** + * 分配时间 + */ + allotTime?: string; +} + +export interface AppDeviceQuery extends PageQuery { + /** + * 设备唯一码 + */ + deviceKey?: string; + + /** + * 产品码 + */ + productKey?: string; + + /** + * 平台码 + */ + applicationCode?: string; + + /** + * 分配时间 + */ + allotTime?: string; + + /** + * 日期范围参数 + */ + params?: any; +} diff --git a/apps/web-antd/src/api/application/platform/index.ts b/apps/web-antd/src/api/application/platform/index.ts new file mode 100644 index 0000000..b0e586b --- /dev/null +++ b/apps/web-antd/src/api/application/platform/index.ts @@ -0,0 +1,63 @@ +import type { PlatformForm, PlatformQuery, PlatformVO } from './model'; + +import type { ID, IDS, PageResult } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +/** + * 查询平台管理列表 + * @param params + * @returns 平台管理列表 + */ +export function platformList(params?: PlatformQuery) { + return requestClient.get>( + '/application/platform/list', + { params }, + ); +} + +/** + * 导出平台管理列表 + * @param params + * @returns 平台管理列表 + */ +export function platformExport(params?: PlatformQuery) { + return commonExport('/application/platform/export', params ?? {}); +} + +/** + * 查询平台管理详情 + * @param id id + * @returns 平台管理详情 + */ +export function platformInfo(id: ID) { + return requestClient.get(`/application/platform/${id}`); +} + +/** + * 新增平台管理 + * @param data + * @returns void + */ +export function platformAdd(data: PlatformForm) { + return requestClient.postWithMsg('/application/platform', data); +} + +/** + * 更新平台管理 + * @param data + * @returns void + */ +export function platformUpdate(data: PlatformForm) { + return requestClient.putWithMsg('/application/platform', data); +} + +/** + * 删除平台管理 + * @param id id + * @returns void + */ +export function platformRemove(id: ID | IDS) { + return requestClient.deleteWithMsg(`/application/platform/${id}`); +} diff --git a/apps/web-antd/src/api/application/platform/model.d.ts b/apps/web-antd/src/api/application/platform/model.d.ts new file mode 100644 index 0000000..59bb1bb --- /dev/null +++ b/apps/web-antd/src/api/application/platform/model.d.ts @@ -0,0 +1,122 @@ +import type { BaseEntity, PageQuery } from '#/api/common'; + +export interface PlatformVO { + /** + * 编号 + */ + id: number | string; + + /** + * 平台名称 + */ + applicationName: string; + + /** + * 平台代码 + */ + applicationCode: string; + + /** + * 联系人 + */ + contactUser: string; + + /** + * 手机号 + */ + contactPhone: string; + + /** + * 平台管理员 + */ + applicationAdmin: string; + + /** + * 平台管理员密码 + */ + applicationPassword: string; + + /** + * 备注 + */ + remark: string; +} + +export interface PlatformForm extends BaseEntity { + /** + * 编号 + */ + id?: number | string; + + /** + * 平台名称 + */ + applicationName?: string; + + /** + * 平台代码 + */ + applicationCode?: string; + + /** + * 联系人 + */ + contactUser?: string; + + /** + * 手机号 + */ + contactPhone?: string; + + /** + * 平台管理员 + */ + applicationAdmin?: string; + + /** + * 平台管理员密码 + */ + applicationPassword?: string; + + /** + * 备注 + */ + remark?: string; +} + +export interface PlatformQuery extends PageQuery { + /** + * 平台名称 + */ + applicationName?: string; + + /** + * 平台代码 + */ + applicationCode?: string; + + /** + * 联系人 + */ + contactUser?: string; + + /** + * 手机号 + */ + contactPhone?: string; + + /** + * 平台管理员 + */ + applicationAdmin?: string; + + /** + * 平台管理员密码 + */ + applicationPassword?: string; + + /** + * 日期范围参数 + */ + params?: any; +} diff --git a/apps/web-antd/src/components/CronPickerModal/index.vue b/apps/web-antd/src/components/CronPickerModal/index.vue index 68b30e1..7157614 100644 --- a/apps/web-antd/src/components/CronPickerModal/index.vue +++ b/apps/web-antd/src/components/CronPickerModal/index.vue @@ -1,7 +1,6 @@ diff --git a/apps/web-antd/src/components/product-select/data.ts b/apps/web-antd/src/components/product-select/data.ts new file mode 100644 index 0000000..920c545 --- /dev/null +++ b/apps/web-antd/src/components/product-select/data.ts @@ -0,0 +1,77 @@ +import type { FormSchemaGetter } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { deviceTypeOptions, enabledOptions } from '#/constants/dicts'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'productKey', + label: '产品KEY', + }, + { + component: 'Input', + fieldName: 'productName', + label: '产品名称', + }, + { + component: 'TreeSelect', + fieldName: 'categoryId', + componentProps: { + fieldNames: { children: 'children', label: 'label', value: 'id' }, + }, + label: '产品分类', + }, + { + component: 'Select', + componentProps: { + options: deviceTypeOptions, + }, + fieldName: 'deviceType', + label: '设备类型', + }, + { + component: 'Select', + componentProps: { + options: enabledOptions, + }, + fieldName: 'enabled', + label: '启用状态', + }, +]; + +// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 +// export const columns: () => VxeGridProps['columns'] = () => [ +export const columns: VxeGridProps['columns'] = [ + { type: 'radio', width: 60 }, + // { + // title: '编号', + // field: 'id', + // }, + { + title: '产品KEY', + field: 'productKey', + }, + { + title: '产品名称', + field: 'productName', + }, + { + title: '产品分类', + field: 'categoryName', + }, + { + title: '设备类型', + field: 'deviceType', + slots: { default: 'deviceType' }, + }, + { + title: '启用状态', + field: 'enabled', + slots: { default: 'enabled' }, + }, + { + title: '描述', + field: 'description', + }, +]; diff --git a/apps/web-antd/src/components/product-select/product-select-table.vue b/apps/web-antd/src/components/product-select/product-select-table.vue new file mode 100644 index 0000000..89dbdb9 --- /dev/null +++ b/apps/web-antd/src/components/product-select/product-select-table.vue @@ -0,0 +1,236 @@ + + + diff --git a/apps/web-antd/src/views/_core/profile/setting-panel.vue b/apps/web-antd/src/views/_core/profile/setting-panel.vue index 10408ae..5a83578 100644 --- a/apps/web-antd/src/views/_core/profile/setting-panel.vue +++ b/apps/web-antd/src/views/_core/profile/setting-panel.vue @@ -1,7 +1,6 @@ + + diff --git a/apps/web-antd/src/views/application/appDevice/components/data.ts b/apps/web-antd/src/views/application/appDevice/components/data.ts new file mode 100644 index 0000000..ded22ee --- /dev/null +++ b/apps/web-antd/src/views/application/appDevice/components/data.ts @@ -0,0 +1,125 @@ +import type { FormSchemaGetter } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'deviceKey', + label: '设备KEY', + }, + { + component: 'Input', + fieldName: 'deviceName', + label: '设备名称', + }, + { + component: 'Select', + fieldName: 'productKey', + label: '所属产品', + }, + // { + // component: 'Select', + // componentProps: { + // options: deviceStateOptions, + // }, + // fieldName: 'deviceState', + // label: '设备状态', + // }, + // { + // component: 'Select', + // componentProps: { + // options: deviceTypeOptions, + // }, + // fieldName: 'deviceType', + // label: '设备类型', + // }, +]; + +// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 +// export const columns: () => VxeGridProps['columns'] = () => [ +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + // { + // title: '编号', + // field: 'id', + // }, + { + title: '设备KEY', + field: 'deviceKey', + }, + { + title: '设备名称', + field: 'deviceName', + }, + { + title: '所属产品', + field: 'productKey', + slots: { default: 'productKey' }, + }, + { + title: '设备类型', + field: 'deviceType', + slots: { default: 'deviceType' }, + }, + { + title: '设备状态', + field: 'deviceState', + slots: { default: 'deviceState' }, + }, + { + title: '描述', + field: 'description', + }, + // { + // field: 'action', + // fixed: 'right', + // slots: { default: 'action' }, + // title: '操作', + // width: 180, + // }, +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + label: '编号', + fieldName: 'id', + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''], + }, + }, + { + label: '设备KEY', + fieldName: 'deviceKey', + component: 'Input', + rules: 'required', + }, + { + label: '设备名称', + fieldName: 'deviceName', + component: 'Input', + rules: 'required', + }, + { + label: '所属产品', + fieldName: 'productId', + component: 'Select', + componentProps: {}, + rules: 'selectRequired', + }, + { + label: '设备图片', + fieldName: 'imgId', + component: 'ImageUpload', + componentProps: { + // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 + // maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型 + }, + }, + { + label: '描述', + fieldName: 'description', + component: 'Textarea', + }, +]; diff --git a/apps/web-antd/src/views/application/appDevice/components/device-select-modal.vue b/apps/web-antd/src/views/application/appDevice/components/device-select-modal.vue new file mode 100644 index 0000000..49b5a38 --- /dev/null +++ b/apps/web-antd/src/views/application/appDevice/components/device-select-modal.vue @@ -0,0 +1,230 @@ + + + + + diff --git a/apps/web-antd/src/views/application/appDevice/data.ts b/apps/web-antd/src/views/application/appDevice/data.ts new file mode 100644 index 0000000..8a66f4f --- /dev/null +++ b/apps/web-antd/src/views/application/appDevice/data.ts @@ -0,0 +1,99 @@ +import type { FormSchemaGetter } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Select', + componentProps: { + allowClear: true, + filterOption: true, + placeholder: '请选择所属平台', + showSearch: true, + }, + fieldName: 'applicationCode', + label: '所属平台', + }, + { + component: 'Input', + fieldName: 'deviceKey', + label: '设备码', + }, + { + component: 'Input', + fieldName: 'deviceName', + label: '设备名称', + }, + { + component: 'Select', + fieldName: 'productKey', + label: '所属产品', + }, +]; + +// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 +// export const columns: () => VxeGridProps['columns'] = () => [ +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + // { + // title: '编号', + // field: 'id', + // }, + { + title: '所属平台', + field: 'applicationName', + }, + { + title: '设备码', + field: 'deviceKey', + }, + { + title: '设备名称', + field: 'deviceName', + }, + { + title: '所属产品', + field: 'productKey', + slots: { default: 'productKey' }, + }, + { + title: '分配时间', + field: 'allotTime', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 180, + }, +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + label: '编号', + fieldName: 'id', + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''], + }, + }, + { + label: '设备唯一码', + fieldName: 'deviceKey', + component: 'Input', + rules: 'required', + }, + { + label: '产品码', + fieldName: 'productKey', + component: 'Input', + rules: 'required', + }, + { + label: '所属平台码', + fieldName: 'applicationCode', + component: 'Input', + rules: 'required', + }, +]; diff --git a/apps/web-antd/src/views/application/appDevice/index.vue b/apps/web-antd/src/views/application/appDevice/index.vue new file mode 100644 index 0000000..213147a --- /dev/null +++ b/apps/web-antd/src/views/application/appDevice/index.vue @@ -0,0 +1,332 @@ + + + diff --git a/apps/web-antd/src/views/application/platform/data.ts b/apps/web-antd/src/views/application/platform/data.ts new file mode 100644 index 0000000..2db5ca7 --- /dev/null +++ b/apps/web-antd/src/views/application/platform/data.ts @@ -0,0 +1,146 @@ +import type { FormSchemaGetter } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { z } from '#/adapter/form'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'applicationCode', + label: '平台代码', + }, + { + component: 'Input', + fieldName: 'applicationName', + label: '平台名称', + }, + { + component: 'Input', + fieldName: 'applicationAdmin', + label: '平台账号', + }, + { + component: 'Input', + fieldName: 'contactPhone', + label: '手机号', + }, +]; + +// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 +// export const columns: () => VxeGridProps['columns'] = () => [ +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + // { + // title: '编号', + // field: 'id', + // }, + { + title: '平台代码', + field: 'applicationCode', + }, + { + title: '平台名称', + field: 'applicationName', + }, + { + title: '联系人', + field: 'contactUser', + }, + { + title: '手机号', + field: 'contactPhone', + }, + { + title: '平台账号', + field: 'applicationAdmin', + }, + { + title: '备注', + field: 'remark', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 240, + }, +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + label: '编号', + fieldName: 'id', + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''], + }, + }, + { + component: 'Divider', + componentProps: { + orientation: 'center', + }, + fieldName: 'divider1', + hideLabel: true, + renderComponentContent: () => ({ + default: () => '平台信息', + }), + }, + { + label: '平台代码', + fieldName: 'applicationCode', + component: 'Input', + rules: z + .string() + .regex(/^[a-z]\w*$/i, '平台代码需字母开头,且仅包含字母、数字、下划线'), + }, + { + label: '平台名称', + fieldName: 'applicationName', + component: 'Input', + rules: 'required', + }, + { + label: '平台账号', + fieldName: 'applicationAdmin', + component: 'Input', + rules: 'required', + }, + { + label: '平台密码', + fieldName: 'applicationPassword', + component: 'InputPassword', + rules: 'required', + }, + { + component: 'Divider', + componentProps: { + orientation: 'center', + }, + fieldName: 'divider2', + hideLabel: true, + renderComponentContent: () => ({ + default: () => '平台联系人', + }), + }, + { + label: '联系人', + fieldName: 'contactUser', + component: 'Input', + rules: 'required', + }, + { + label: '手机号', + fieldName: 'contactPhone', + component: 'Input', + rules: z.string().regex(/^1[3-9]\d{9}$/, '请输入正确的手机号码'), + }, + + { + label: '备注', + fieldName: 'remark', + component: 'Textarea', + }, +]; diff --git a/apps/web-antd/src/views/application/platform/index.vue b/apps/web-antd/src/views/application/platform/index.vue new file mode 100644 index 0000000..d856299 --- /dev/null +++ b/apps/web-antd/src/views/application/platform/index.vue @@ -0,0 +1,218 @@ + + + diff --git a/apps/web-antd/src/views/application/platform/platform-drawer.vue b/apps/web-antd/src/views/application/platform/platform-drawer.vue new file mode 100644 index 0000000..ccc620f --- /dev/null +++ b/apps/web-antd/src/views/application/platform/platform-drawer.vue @@ -0,0 +1,221 @@ + + + diff --git a/apps/web-antd/src/views/demo/test/detail.vue b/apps/web-antd/src/views/demo/test/detail.vue index a124a00..c3d93c3 100644 --- a/apps/web-antd/src/views/demo/test/detail.vue +++ b/apps/web-antd/src/views/demo/test/detail.vue @@ -1,15 +1,27 @@