diff --git a/apps/web-antd/src/api/license/license/index.ts b/apps/web-antd/src/api/license/license/index.ts new file mode 100644 index 0000000..8200b42 --- /dev/null +++ b/apps/web-antd/src/api/license/license/index.ts @@ -0,0 +1,58 @@ +import type { Dayjs } from 'dayjs'; + +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace LicenseApi { + /** License信息 */ + export interface License { + id: number; // 主键 + customerId?: number; // 客户ID + projectId?: number; // 项目ID + sn?: string; // sn + expirationTime: Dayjs | string; // 到期时间 + neSwitch: string; // 网元开关 + userNum: number; // 用户数 + baseStationNum: number; // 基站数 + activationCode: string; // 激活码 + licenseContent: string; // License内容 + applicant: number; // 申请人 + approver: number; // 审批人 + status: number; // 状态 + remark: string; // 备注 + } +} + +/** 查询License分页 */ +export function getLicensePage(params: PageParam) { + return requestClient.get>( + '/license/license/page', + { params }, + ); +} + +/** 查询License详情 */ +export function getLicense(id: number) { + return requestClient.get(`/license/license/get?id=${id}`); +} + +/** 新增License */ +export function createLicense(data: LicenseApi.License) { + return requestClient.post('/license/license/create', data); +} + +/** 修改License */ +export function updateLicense(data: LicenseApi.License) { + return requestClient.put('/license/license/update', data); +} + +/** 删除License */ +export function deleteLicense(id: number) { + return requestClient.delete(`/license/license/delete?id=${id}`); +} + +/** 导出License */ +export function exportLicense(params: any) { + return requestClient.download('/license/license/export-excel', params); +} diff --git a/apps/web-antd/src/locales/langs/en-US/menu.json b/apps/web-antd/src/locales/langs/en-US/menu.json index 39c45aa..7fb32a7 100644 --- a/apps/web-antd/src/locales/langs/en-US/menu.json +++ b/apps/web-antd/src/locales/langs/en-US/menu.json @@ -83,5 +83,6 @@ } }, "customer": "Customer Management", - "project": "Project Management" + "project": "Project Management", + "license": "License Management" } diff --git a/apps/web-antd/src/locales/langs/zh-CN/menu.json b/apps/web-antd/src/locales/langs/zh-CN/menu.json index fddacba..4a34e28 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/menu.json +++ b/apps/web-antd/src/locales/langs/zh-CN/menu.json @@ -83,5 +83,6 @@ } }, "customer": "客户管理", - "project": "项目管理" + "project": "项目管理", + "license": "License管理" } diff --git a/apps/web-antd/src/utils/dict.ts b/apps/web-antd/src/utils/dict.ts index 0cfa7e0..fd2c68d 100644 --- a/apps/web-antd/src/utils/dict.ts +++ b/apps/web-antd/src/utils/dict.ts @@ -222,6 +222,8 @@ enum DICT_TYPE { // ========== LICENSE 模块 ========== LIC_BUSINESS_STATUS = 'lic_business_status', // 商务状态 LIC_CUSTOMER_TYPE = 'lic_customer_type', // 客户类型 + LIC_LICENSE_STATUS = 'lic_license_status', // License 状态 + LIC_NE_SWITCH = 'lic_ne_switch', // NE 开关 LIC_PROJECT_STATUS = 'lic_project_status', // 项目状态 MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型 // ========== Member 会员模块 ========== diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts new file mode 100644 index 0000000..6bc95ea --- /dev/null +++ b/apps/web-antd/src/views/license/license/data.ts @@ -0,0 +1,381 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { LicenseApi } from '#/api/license/license'; + +import { useAccess } from '@vben/access'; + +import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; + +const { hasAccessByCodes } = useAccess(); + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'customerId', + label: '客户ID', + rules: 'required', + component: 'Input', + componentProps: { + placeholder: '请输入客户ID', + }, + }, + { + fieldName: 'projectId', + label: '项目ID', + rules: 'required', + component: 'Input', + componentProps: { + placeholder: '请输入项目ID', + }, + }, + { + fieldName: 'sn', + label: 'sn', + rules: 'required', + component: 'Input', + componentProps: { + placeholder: '请输入sn', + }, + }, + { + fieldName: 'expirationTime', + label: '到期时间', + component: 'DatePicker', + componentProps: { + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + }, + }, + { + fieldName: 'neSwitch', + label: '网元开关', + component: 'CheckboxGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.LIC_NE_SWITCH, 'string'), + }, + }, + { + fieldName: 'userNum', + label: '用户数', + component: 'Input', + componentProps: { + placeholder: '请输入用户数', + }, + }, + { + fieldName: 'baseStationNum', + label: '基站数', + component: 'Input', + componentProps: { + placeholder: '请输入基站数', + }, + }, + { + fieldName: 'activationCode', + label: '激活码', + component: 'Textarea', + componentProps: { + placeholder: '请输入激活码', + }, + }, + { + fieldName: 'licenseContent', + label: 'License内容', + component: 'Textarea', + componentProps: { + placeholder: '请输入License内容', + }, + }, + { + fieldName: 'applicant', + label: '申请人', + component: 'Select', + componentProps: { + options: [], + placeholder: '请选择申请人', + }, + }, + { + fieldName: 'approver', + label: '审批人', + component: 'Select', + componentProps: { + options: [], + placeholder: '请选择审批人', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.LIC_LICENSE_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'customerId', + label: '客户ID', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入客户ID', + }, + }, + { + fieldName: 'projectId', + label: '项目ID', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入项目ID', + }, + }, + { + fieldName: 'sn', + label: 'sn', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入sn', + }, + }, + { + fieldName: 'expirationTime', + label: '到期时间', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), + allowClear: true, + }, + }, + { + fieldName: 'neSwitch', + label: '网元开关', + }, + { + fieldName: 'userNum', + label: '用户数', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入用户数', + }, + }, + { + fieldName: 'baseStationNum', + label: '基站数', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入基站数', + }, + }, + { + fieldName: 'activationCode', + label: '激活码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入激活码', + }, + }, + { + fieldName: 'licenseContent', + label: 'License内容', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入License内容', + }, + }, + { + fieldName: 'applicant', + label: '申请人', + component: 'Select', + componentProps: { + allowClear: true, + options: [], + placeholder: '请选择申请人', + }, + }, + { + fieldName: 'approver', + label: '审批人', + component: 'Select', + componentProps: { + allowClear: true, + options: [], + placeholder: '请选择审批人', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.LIC_LICENSE_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入备注', + }, + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns( + onActionClick?: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'customerId', + title: '客户ID', + minWidth: 120, + }, + { + field: 'projectId', + title: '项目ID', + minWidth: 120, + }, + { + field: 'sn', + title: 'sn', + minWidth: 120, + }, + { + field: 'expirationTime', + title: '到期时间', + minWidth: 120, + formatter: 'formatDateTime', + }, + { + field: 'neSwitch', + title: '网元开关', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.LIC_NE_SWITCH }, + }, + }, + { + field: 'userNum', + title: '用户数', + minWidth: 120, + }, + { + field: 'baseStationNum', + title: '基站数', + minWidth: 120, + }, + { + field: 'activationCode', + title: '激活码', + minWidth: 120, + }, + { + field: 'licenseContent', + title: 'License内容', + minWidth: 120, + }, + { + field: 'applicant', + title: '申请人', + minWidth: 120, + }, + { + field: 'approver', + title: '审批人', + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.LIC_LICENSE_STATUS }, + }, + }, + { + field: 'remark', + title: '备注', + minWidth: 120, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 120, + formatter: 'formatDateTime', + }, + { + field: 'operation', + title: '操作', + minWidth: 200, + align: 'center', + fixed: 'right', + headerAlign: 'center', + showOverflow: false, + cellRender: { + attrs: { + nameField: 'id', + nameTitle: 'License', + onClick: onActionClick, + }, + name: 'CellOperation', + options: [ + { + code: 'edit', + show: hasAccessByCodes(['license:license:update']), + }, + { + code: 'delete', + show: hasAccessByCodes(['license:license:delete']), + }, + ], + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue new file mode 100644 index 0000000..19132e7 --- /dev/null +++ b/apps/web-antd/src/views/license/license/index.vue @@ -0,0 +1,142 @@ + + + diff --git a/apps/web-antd/src/views/license/license/modules/form.vue b/apps/web-antd/src/views/license/license/modules/form.vue new file mode 100644 index 0000000..61bcb59 --- /dev/null +++ b/apps/web-antd/src/views/license/license/modules/form.vue @@ -0,0 +1,89 @@ + + +