diff --git a/apps/web-tdesign/.env b/apps/web-tdesign/.env index dae0149d..8f9ac0b7 100644 --- a/apps/web-tdesign/.env +++ b/apps/web-tdesign/.env @@ -1,8 +1,8 @@ # 应用标题 -VITE_APP_TITLE=Vben Admin Tdesign +VITE_APP_TITLE=星戎物联 # 应用命名空间,用于缓存、store等功能的前缀,确保隔离 -VITE_APP_NAMESPACE=vben-web-tdesign +VITE_APP_NAMESPACE=iot # 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密 -VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key +VITE_APP_STORE_SECURE_KEY=xrit2doa1q3swe diff --git a/apps/web-tdesign/src/api/core/admin.ts b/apps/web-tdesign/src/api/core/admin.ts new file mode 100644 index 00000000..36de3a93 --- /dev/null +++ b/apps/web-tdesign/src/api/core/admin.ts @@ -0,0 +1,24 @@ +import { requestClient } from '#/api/request'; + +export async function getAdminInfoApi() { + return requestClient.post('/admin/info'); +} + +export async function getAdminListByPage(data: any) { + return requestClient.post('/admin/queryByPage', data); +} + +export async function getAdminOptions() { + return requestClient.post('/admin/options'); +} + +export async function createAdmin(data: any) { + return requestClient.post('/admin/create', data); +} +export async function updateAdmin(data: any) { + return requestClient.post('/admin/update', data); +} + +export async function changeAdminStatus(data: any) { + return requestClient.post('/admin/changeStatus', data); +} diff --git a/apps/web-tdesign/src/api/core/auth.ts b/apps/web-tdesign/src/api/core/auth.ts index 71d9f994..cb64c868 100644 --- a/apps/web-tdesign/src/api/core/auth.ts +++ b/apps/web-tdesign/src/api/core/auth.ts @@ -47,5 +47,5 @@ export async function logoutApi() { * 获取用户权限码 */ export async function getAccessCodesApi() { - return requestClient.get('/auth/codes'); + return requestClient.post('/auth/codes'); } diff --git a/apps/web-tdesign/src/api/core/card.ts b/apps/web-tdesign/src/api/core/card.ts new file mode 100644 index 00000000..b9e50278 --- /dev/null +++ b/apps/web-tdesign/src/api/core/card.ts @@ -0,0 +1,5 @@ +import { requestClient } from '#/api/request'; + +export function getCardOptions() { + return requestClient.post('/card/options'); +} diff --git a/apps/web-tdesign/src/api/core/dept.ts b/apps/web-tdesign/src/api/core/dept.ts new file mode 100644 index 00000000..f4bb770d --- /dev/null +++ b/apps/web-tdesign/src/api/core/dept.ts @@ -0,0 +1,21 @@ +import { requestClient } from '#/api/request'; + +export function getDeptList() { + return requestClient.post('/dept/queryAll'); +} + +export function getDeptOptions() { + return requestClient.post('/dept/options'); +} + +export function createDept(data: any) { + return requestClient.post('/dept/create', data); +} + +export function updateDept(data: any) { + return requestClient.post('/dept/update', data); +} + +export function changeDeptStatus(data: any) { + return requestClient.post('/dept/changeStatus', data); +} diff --git a/apps/web-tdesign/src/api/core/device.ts b/apps/web-tdesign/src/api/core/device.ts new file mode 100644 index 00000000..20a156b7 --- /dev/null +++ b/apps/web-tdesign/src/api/core/device.ts @@ -0,0 +1,17 @@ +import { requestClient } from '#/api/request'; + +export function getDeviceListByPage(data: any) { + return requestClient.post('/device/queryByPage', data); +} + +export function getDeviceOptions() { + return requestClient.post('/device/options'); +} + +export function createDevice(data: any) { + return requestClient.post('/device/create', data); +} + +export function updateDevice(data: any) { + return requestClient.post('/device/update', data); +} diff --git a/apps/web-tdesign/src/api/core/index.ts b/apps/web-tdesign/src/api/core/index.ts index 28a5aef4..3f5aec39 100644 --- a/apps/web-tdesign/src/api/core/index.ts +++ b/apps/web-tdesign/src/api/core/index.ts @@ -1,3 +1,6 @@ +export * from './admin'; export * from './auth'; +export * from './dept'; export * from './menu'; -export * from './user'; +export * from './point'; +export * from './role'; diff --git a/apps/web-tdesign/src/api/core/menu.ts b/apps/web-tdesign/src/api/core/menu.ts index 9ef60b11..a6cc8a94 100644 --- a/apps/web-tdesign/src/api/core/menu.ts +++ b/apps/web-tdesign/src/api/core/menu.ts @@ -1,10 +1,24 @@ -import type { RouteRecordStringComponent } from '@vben/types'; - import { requestClient } from '#/api/request'; -/** - * 获取用户所有菜单 - */ export async function getAllMenusApi() { - return requestClient.get('/menu/all'); + return requestClient.get('/menu/all'); +} + +export async function getMenuList() { + return requestClient.post('/menu/queryAll'); +} + +export async function getMenuTree() { + return requestClient.post('/menu/queryByTree'); +} + +export async function createMenu(data: any) { + return requestClient.post('/menu/create', data); +} +export async function updateMenu(data: any) { + return requestClient.post('/menu/update', data); +} + +export async function changeMenuStatus(data: any) { + return requestClient.post('/menu/changeStatus', data); } diff --git a/apps/web-tdesign/src/api/core/point.ts b/apps/web-tdesign/src/api/core/point.ts new file mode 100644 index 00000000..da6a625c --- /dev/null +++ b/apps/web-tdesign/src/api/core/point.ts @@ -0,0 +1,17 @@ +import { requestClient } from '#/api/request'; + +export function getPointListByPage(data: any) { + return requestClient.post('/point/queryByPage', data); +} + +export function getPointOptions() { + return requestClient.post('/point/options'); +} + +export function createPoint(data: any) { + return requestClient.post('/point/create', data); +} + +export function updatePoint(data: any) { + return requestClient.post('/point/update', data); +} diff --git a/apps/web-tdesign/src/api/core/product.ts b/apps/web-tdesign/src/api/core/product.ts new file mode 100644 index 00000000..5d81657c --- /dev/null +++ b/apps/web-tdesign/src/api/core/product.ts @@ -0,0 +1,5 @@ +import { requestClient } from '#/api/request'; + +export function getProductOptions() { + return requestClient.post('/product/options'); +} diff --git a/apps/web-tdesign/src/api/core/role.ts b/apps/web-tdesign/src/api/core/role.ts new file mode 100644 index 00000000..c90d008a --- /dev/null +++ b/apps/web-tdesign/src/api/core/role.ts @@ -0,0 +1,21 @@ +import { requestClient } from '#/api/request'; + +export function getRoleList() { + return requestClient.post('/role/list'); +} + +export function getRoleOptions() { + return requestClient.post('/role/options'); +} + +export function createRole(data: any) { + return requestClient.post('/role/create', data); +} + +export function updateRole(data: any) { + return requestClient.post('/role/update', data); +} + +export function changeRoleStatus(data: any) { + return requestClient.post('/role/changeStatus', data); +} diff --git a/apps/web-tdesign/src/enum/CommonStatus.ts b/apps/web-tdesign/src/enum/CommonStatus.ts new file mode 100644 index 00000000..60f37716 --- /dev/null +++ b/apps/web-tdesign/src/enum/CommonStatus.ts @@ -0,0 +1,10 @@ +export const CommonStatusEnum = [ + { + value: 1, + label: '启用', + }, + { + value: 0, + label: '禁用', + }, +]; diff --git a/apps/web-tdesign/src/enum/Gender.ts b/apps/web-tdesign/src/enum/Gender.ts new file mode 100644 index 00000000..7bb3c813 --- /dev/null +++ b/apps/web-tdesign/src/enum/Gender.ts @@ -0,0 +1,14 @@ +import { toObject } from '#/enum/index'; + +export const GenderEnum = [ + { + label: '男', + value: 1, + }, + { + label: '女', + value: 2, + }, +]; + +export const GenderEnumMap = toObject(GenderEnum, 'value', 'label'); diff --git a/apps/web-tdesign/src/enum/Grade.ts b/apps/web-tdesign/src/enum/Grade.ts new file mode 100644 index 00000000..67a1f29f --- /dev/null +++ b/apps/web-tdesign/src/enum/Grade.ts @@ -0,0 +1,42 @@ +import { toObject } from '#/enum/index'; + +export const GradeEnum = [ + { + value: 1, + label: '一年级', + }, + { + value: 2, + label: '二年级', + }, + { + value: 3, + label: '三年级', + }, + { + value: 4, + label: '四年级', + }, + { + value: 5, + label: '五年级', + }, + { + value: 6, + label: '六年级', + }, + { + value: 7, + label: '七年级', + }, + { + value: 8, + label: '八年级', + }, + { + value: 9, + label: '九年级', + }, +]; + +export const GradeEnumMap = toObject(GradeEnum, 'value', 'label'); diff --git a/apps/web-tdesign/src/enum/MenuType.ts b/apps/web-tdesign/src/enum/MenuType.ts new file mode 100644 index 00000000..9fcce6f2 --- /dev/null +++ b/apps/web-tdesign/src/enum/MenuType.ts @@ -0,0 +1,18 @@ +import { toObject } from '#/enum/index'; + +export const MenuTypeEnum = [ + { + label: '目录', + value: 1, + }, + { + label: '菜单', + value: 2, + }, + { + label: '按钮', + value: 3, + }, +]; + +export const MenuTypeEnumMap = toObject(MenuTypeEnum, 'value', 'label'); diff --git a/apps/web-tdesign/src/enum/RoleCode.ts b/apps/web-tdesign/src/enum/RoleCode.ts new file mode 100644 index 00000000..908488f2 --- /dev/null +++ b/apps/web-tdesign/src/enum/RoleCode.ts @@ -0,0 +1,15 @@ +import { toObject } from '#/enum/index'; + +export const RoleCodeEnum = [ + { + value: 'root', + label: '管理员', + color: { + color: '#FCE8E6', // 背景浅红 + textColor: '#D32F2F', // 文字深红 + borderColor: '#E57373', // 边框柔红 + }, + }, +]; +export const RoleCodeEnumMap = toObject(RoleCodeEnum, 'value', 'label'); +export const RoleCodeEnumColorMap = toObject(RoleCodeEnum, 'value', 'color'); diff --git a/apps/web-tdesign/src/enum/SendHandler.ts b/apps/web-tdesign/src/enum/SendHandler.ts new file mode 100644 index 00000000..9a22a5f0 --- /dev/null +++ b/apps/web-tdesign/src/enum/SendHandler.ts @@ -0,0 +1,9 @@ +import { toObject } from '#/enum/index'; + +export const SendHandlerEnum = [ + { + label: '地灾平台', + value: 'DZPTSendHandler', + }, +]; +export const SendHandlerEnumMap = toObject(SendHandlerEnum, 'value', 'label'); diff --git a/apps/web-tdesign/src/enum/Subject.ts b/apps/web-tdesign/src/enum/Subject.ts new file mode 100644 index 00000000..33214162 --- /dev/null +++ b/apps/web-tdesign/src/enum/Subject.ts @@ -0,0 +1,10 @@ +import { toObject } from '#/enum/index'; + +export const SubjectEnum = [ + { + value: 1, + label: '数学', + }, +]; + +export const SubjectEnumMap = toObject(SubjectEnum, 'value', 'label'); diff --git a/apps/web-tdesign/src/enum/index.ts b/apps/web-tdesign/src/enum/index.ts new file mode 100644 index 00000000..b0a70c3b --- /dev/null +++ b/apps/web-tdesign/src/enum/index.ts @@ -0,0 +1,13 @@ +export const toObject = >( + arr: T[], + keyField: keyof T, + valueField: keyof T, +): Record => { + const result: Record = {}; + + for (const item of arr) { + result[item[keyField] as any] = item[valueField]; + } + + return result; +}; diff --git a/apps/web-tdesign/src/router/routes/modules/system.ts b/apps/web-tdesign/src/router/routes/modules/system.ts new file mode 100644 index 00000000..13146719 --- /dev/null +++ b/apps/web-tdesign/src/router/routes/modules/system.ts @@ -0,0 +1,53 @@ +import type { RouteRecordRaw } from 'vue-router'; + +const routes: RouteRecordRaw[] = [ + { + meta: { + icon: 'lucide:layout-dashboard', + order: -1, + title: '系统管理', + }, + name: 'System', + path: '/system', + children: [ + { + name: 'User', + path: '/admin', + component: () => import('#/views/system/admin/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '用户管理', + }, + }, + { + name: 'Role', + path: '/role', + component: () => import('#/views/system/role/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '角色管理', + }, + }, + { + name: 'Menu', + path: '/menu', + component: () => import('#/views/system/menu/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '权限管理', + }, + }, + { + name: 'Dept', + path: '/dept', + component: () => import('#/views/system/dept/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '部门管理', + }, + }, + ], + }, +]; + +export default routes; diff --git a/apps/web-tdesign/src/router/routes/modules/things.ts b/apps/web-tdesign/src/router/routes/modules/things.ts new file mode 100644 index 00000000..e88d4580 --- /dev/null +++ b/apps/web-tdesign/src/router/routes/modules/things.ts @@ -0,0 +1,46 @@ +import type { RouteRecordRaw } from 'vue-router'; + +const routes: RouteRecordRaw[] = [ + { + meta: { + icon: 'lucide:layout-dashboard', + order: -1, + title: '运维管理', + }, + name: 'Things', + path: '/things', + children: [ + { + name: 'Point', + path: '/point', + component: () => import('#/views/things/point/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '监测点管理', + }, + }, + { + name: 'Device', + path: '/device', + component: () => import('#/views/things/device/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '设备管理', + fullPathKey: false, + }, + }, + { + name: 'Flow', + path: '/flow', + component: () => import('#/views/things/flow/index.vue'), + meta: { + icon: 'lucide:area-chart', + title: '同步管理', + fullPathKey: false, + }, + }, + ], + }, +]; + +export default routes; diff --git a/apps/web-tdesign/src/store/auth.ts b/apps/web-tdesign/src/store/auth.ts index b3b4b749..badd0e8a 100644 --- a/apps/web-tdesign/src/store/auth.ts +++ b/apps/web-tdesign/src/store/auth.ts @@ -10,7 +10,7 @@ import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; import { defineStore } from 'pinia'; import { notification } from '#/adapter/tdesign'; -import { getAccessCodesApi, getUserInfoApi, loginApi, logoutApi } from '#/api'; +import { getAccessCodesApi, getAdminInfoApi, loginApi, logoutApi } from '#/api'; import { $t } from '#/locales'; export const useAuthStore = defineStore('auth', () => { @@ -98,7 +98,7 @@ export const useAuthStore = defineStore('auth', () => { async function fetchUserInfo() { let userInfo: null | UserInfo = null; - userInfo = await getUserInfoApi(); + userInfo = await getAdminInfoApi(); userStore.setUserInfo(userInfo); return userInfo; } diff --git a/apps/web-tdesign/src/views/_core/authentication/login.vue b/apps/web-tdesign/src/views/_core/authentication/login.vue index 89af0c27..a266c531 100644 --- a/apps/web-tdesign/src/views/_core/authentication/login.vue +++ b/apps/web-tdesign/src/views/_core/authentication/login.vue @@ -1,10 +1,9 @@ @@ -94,6 +40,12 @@ const formSchema = computed((): VbenFormSchema[] => { diff --git a/apps/web-tdesign/src/views/system/admin/data.ts b/apps/web-tdesign/src/views/system/admin/data.ts new file mode 100644 index 00000000..489c6265 --- /dev/null +++ b/apps/web-tdesign/src/views/system/admin/data.ts @@ -0,0 +1,147 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { getDeptOptions, getRoleOptions } from '#/api'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'displayName', + label: '姓名', + rules: 'required', + }, + { + component: 'Input', + fieldName: 'account', + label: '账户', + rules: 'required', + }, + { + component: 'ApiSelect', + fieldName: 'roleIds', + componentProps: { + api: getRoleOptions, + multiple: true, + clearable: true, + labelField: 'roleName', + valueField: 'id', + }, + label: '角色', + }, + { + component: 'ApiSelect', + fieldName: 'deptId', + componentProps: { + api: getDeptOptions, + clearable: true, + labelField: 'deptName', + valueField: 'id', + }, + label: '部门', + }, + { + component: 'Input', + fieldName: 'email', + label: '邮箱', + }, + { + component: 'Input', + fieldName: 'phone', + label: '手机号', + }, + { + component: 'Input', + componentProps: { + type: 'textarea', + }, + fieldName: 'remark', + label: '备注', + }, + ]; +} + +export function useSearchFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + defaultValue: '', + componentProps: { + placeholder: '请输入姓名', + }, + fieldName: 'displayName', + label: '姓名', + }, + { + component: 'ApiSelect', + fieldName: 'roleIds', + defaultValue: [], + componentProps: { + api: getRoleOptions, + multiple: true, + clearable: true, + labelField: 'roleName', + valueField: 'id', + }, + label: '角色', + }, + { + component: 'ApiSelect', + fieldName: 'deptId', + componentProps: { + api: getDeptOptions, + clearable: true, + labelField: 'deptName', + valueField: 'id', + }, + label: '部门', + }, + ]; +} +export function useGridSchema() { + return [ + { + field: 'status', + slots: { default: 'status' }, + title: '状态', + width: 120, + fixed: 'left', + }, + { + field: 'displayName', + title: '姓名', + width: 120, + }, + { + field: 'phone', + title: '手机号', + width: 150, + }, + { + field: 'email', + title: '邮箱', + width: 150, + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'roleIds', + slots: { default: 'roleIds' }, + width: 200, + title: '角色', + }, + { + field: 'deptId', + slots: { default: 'deptId' }, + title: '部门', + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 120, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/system/admin/form.vue b/apps/web-tdesign/src/views/system/admin/form.vue new file mode 100644 index 00000000..03ef1904 --- /dev/null +++ b/apps/web-tdesign/src/views/system/admin/form.vue @@ -0,0 +1,73 @@ + + + diff --git a/apps/web-tdesign/src/views/system/admin/index.vue b/apps/web-tdesign/src/views/system/admin/index.vue new file mode 100644 index 00000000..05c58d54 --- /dev/null +++ b/apps/web-tdesign/src/views/system/admin/index.vue @@ -0,0 +1,133 @@ + + + diff --git a/apps/web-tdesign/src/views/system/dept/data.ts b/apps/web-tdesign/src/views/system/dept/data.ts new file mode 100644 index 00000000..ef61a4e0 --- /dev/null +++ b/apps/web-tdesign/src/views/system/dept/data.ts @@ -0,0 +1,80 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { getAdminOptions } from '#/api'; +import { getPointOptions } from '#/api/core/point'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'deptName', + label: '部门名称', + rules: 'required', + }, + { + component: 'ApiSelect', + fieldName: 'adminIds', + label: '用户', + defaultValue: [], + componentProps: { + api: getAdminOptions, + resultField: '', + multiple: true, + clearable: true, + labelField: 'displayName', + valueField: 'id', + optionsPropName: 'options', + }, + }, + { + component: 'ApiSelect', + fieldName: 'pointIds', + label: '观测点', + defaultValue: [], + componentProps: { + api: getPointOptions, + resultField: '', + multiple: true, + clearable: true, + labelField: 'displayName', + valueField: 'id', + optionsPropName: 'options', + }, + }, + + { + component: 'Input', + fieldName: 'remark', + label: '备注', + componentProps: { + type: 'textarea', + }, + }, + ]; +} + +export function useGridSchema() { + return [ + { + field: 'deptName', + title: '部门名称', + width: 150, + }, + { + field: 'adminIds', + title: '用户', + slots: { default: 'adminIds' }, + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 150, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/system/dept/form.vue b/apps/web-tdesign/src/views/system/dept/form.vue new file mode 100644 index 00000000..bdfac52d --- /dev/null +++ b/apps/web-tdesign/src/views/system/dept/form.vue @@ -0,0 +1,70 @@ + + + diff --git a/apps/web-tdesign/src/views/system/dept/index.vue b/apps/web-tdesign/src/views/system/dept/index.vue new file mode 100644 index 00000000..a9d97310 --- /dev/null +++ b/apps/web-tdesign/src/views/system/dept/index.vue @@ -0,0 +1,88 @@ + + + diff --git a/apps/web-tdesign/src/views/system/menu/data.ts b/apps/web-tdesign/src/views/system/menu/data.ts new file mode 100644 index 00000000..c8b5c848 --- /dev/null +++ b/apps/web-tdesign/src/views/system/menu/data.ts @@ -0,0 +1,113 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { getMenuTree, getRoleOptions } from '#/api'; +import { MenuTypeEnum } from '#/enum/MenuType'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'RadioGroup', + fieldName: 'menuType', + defaultValue: 1, + componentProps: { + options: MenuTypeEnum, + }, + label: '权限类型', + rules: 'required', + }, + { + component: 'ApiTreeSelect', + fieldName: 'parentId', + label: '上级权限', + componentProps: { + api: getMenuTree, + resultField: 'items', + childrenField: 'children', + labelField: 'menuName', + valueField: 'id', + clearable: true, + }, + defaultValue: undefined, + }, + { + component: 'Input', + fieldName: 'menuName', + label: '权限名称', + rules: 'required', + }, + { + component: 'Input', + fieldName: 'menuCode', + label: '权限编码', + rules: 'required', + }, + { + component: 'ApiSelect', + fieldName: 'roleIds', + componentProps: { + api: getRoleOptions, + multiple: true, + clearable: true, + labelField: 'roleName', + valueField: 'id', + }, + label: '角色', + }, + { + component: 'Input', + componentProps: { + type: 'textarea', + }, + fieldName: 'remark', + label: '备注', + }, + ]; +} + +export function useSearchFormSchema(): VbenFormSchema[] { + return []; +} +export function useGridSchema() { + return [ + { + field: 'status', + slots: { default: 'status' }, + title: '状态', + width: 120, + fixed: 'left', + }, + { + field: 'menuName', + title: '权限名称', + width: 200, + treeNode: true, + }, + { + field: 'menuCode', + title: '权限编码', + width: 150, + }, + { + field: 'menuType', + title: '权限类型', + slots: { default: 'menuType' }, + width: 150, + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'roleIds', + slots: { default: 'roleIds' }, + title: '角色', + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 200, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/system/menu/form.vue b/apps/web-tdesign/src/views/system/menu/form.vue new file mode 100644 index 00000000..d861769d --- /dev/null +++ b/apps/web-tdesign/src/views/system/menu/form.vue @@ -0,0 +1,73 @@ + + + diff --git a/apps/web-tdesign/src/views/system/menu/index.vue b/apps/web-tdesign/src/views/system/menu/index.vue new file mode 100644 index 00000000..f43cdf99 --- /dev/null +++ b/apps/web-tdesign/src/views/system/menu/index.vue @@ -0,0 +1,157 @@ + + + diff --git a/apps/web-tdesign/src/views/system/role/data.ts b/apps/web-tdesign/src/views/system/role/data.ts new file mode 100644 index 00000000..546e8c94 --- /dev/null +++ b/apps/web-tdesign/src/views/system/role/data.ts @@ -0,0 +1,99 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { getAdminOptions, getMenuTree } from '#/api'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'roleName', + label: '角色名称', + rules: 'required', + }, + { + component: 'Input', + fieldName: 'roleCode', + label: '角色编码', + rules: 'required', + }, + { + component: 'ApiSelect', + fieldName: 'adminIds', + label: '用户', + componentProps: { + api: getAdminOptions, + resultField: '', + multiple: true, + clearable: true, + labelField: 'displayName', + valueField: 'id', + optionsPropName: 'options', + }, + }, + { + component: 'ApiTreeSelect', + // 对应组件的参数 + componentProps: { + // 菜单接口 + api: getMenuTree, + resultField: 'items', + childrenField: 'children', + labelField: 'menuName', + valueField: 'id', + maxTagCount: 'responsive', + clearable: true, + multiple: true, + cascade: true, + checkable: true, + }, + fieldName: 'menuIds', + label: '权限', + }, + { + component: 'Input', + fieldName: 'remark', + label: '备注', + componentProps: { + type: 'textarea', + }, + }, + ]; +} + +export function useGridSchema() { + return [ + { + field: 'status', + title: '状态', + slots: { default: 'status' }, + width: 120, + fixed: 'left', + }, + { + field: 'roleName', + title: '角色名称', + width: 150, + }, + { + field: 'roleCode', + title: '角色编码', + width: 150, + }, + { + field: 'adminIds', + title: '用户', + slots: { default: 'adminIds' }, + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 150, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/system/role/form.vue b/apps/web-tdesign/src/views/system/role/form.vue new file mode 100644 index 00000000..de0304f9 --- /dev/null +++ b/apps/web-tdesign/src/views/system/role/form.vue @@ -0,0 +1,78 @@ + + + diff --git a/apps/web-tdesign/src/views/system/role/index.vue b/apps/web-tdesign/src/views/system/role/index.vue new file mode 100644 index 00000000..7a6641f7 --- /dev/null +++ b/apps/web-tdesign/src/views/system/role/index.vue @@ -0,0 +1,110 @@ + + + diff --git a/apps/web-tdesign/src/views/things/device/data.ts b/apps/web-tdesign/src/views/things/device/data.ts new file mode 100644 index 00000000..97d5eb09 --- /dev/null +++ b/apps/web-tdesign/src/views/things/device/data.ts @@ -0,0 +1,193 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { getPointOptions } from '#/api'; +import { getCardOptions } from '#/api/core/card'; +import { getProductOptions } from '#/api/core/product'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'ApiSelect', + fieldName: 'pointId', + componentProps: { + api: getPointOptions, + clearable: true, + labelField: 'displayName', + valueField: 'id', + }, + label: '监测点', + rules: 'required', + }, + { + component: 'Select', + fieldName: 'parentId', + dependencies: { + show: false, + triggerFields: ['productIdSwitch'], + }, + label: '父级设备', + }, + { + component: 'ApiSelect', + fieldName: 'productId', + componentProps: { + api: getProductOptions, + clearable: true, + }, + label: '设备型号', + rules: 'required', + }, + { + component: 'Input', + fieldName: 'displayName', + componentProps: { + clearable: true, + }, + label: '设备名称', + rules: 'required', + }, + { + component: 'Select', + fieldName: 'msgType', + componentProps: { + clearable: true, + placeholder: '请选择设备消息类型', + options: [ + { + label: 'rs485ValueRpt', + value: 'rs485ValueRpt', + }, + { + label: 'diValueRpt', + value: 'diValueRpt', + }, + { + label: 'aiValueRpt', + value: 'aiValueRpt', + }, + ], + }, + label: '设备消息类型', + }, + { + component: 'Input', + fieldName: 'sn', + componentProps: { + clearable: true, + }, + label: '设备编码', + }, + { + component: 'Input', + fieldName: 'card', + componentProps: { + clearable: true, + }, + label: '设备卡号', + }, + { + component: 'Input', + fieldName: 'longitude', + componentProps: { + clearable: true, + }, + label: '经度', + }, + { + component: 'Input', + fieldName: 'latitude', + componentProps: { + clearable: true, + }, + label: '纬度', + }, + ]; +} + +export function useSearchFormSchema(): VbenFormSchema[] { + return [ + { + component: 'ApiSelect', + fieldName: 'pointId', + componentProps: { + api: getPointOptions, + clearable: true, + labelField: 'displayName', + valueField: 'id', + }, + label: '监测点', + }, + { + component: 'ApiSelect', + fieldName: 'productId', + componentProps: { + api: getProductOptions, + clearable: true, + multiple: true, + }, + label: '监测点', + }, + { + component: 'ApiSelect', + fieldName: 'cardId', + componentProps: { + api: getCardOptions, + clearable: true, + labelField: 'cardNumber', + valueField: 'id', + }, + label: '卡号', + }, + ]; +} +export function useGridSchema() { + return [ + { + field: 'id', + title: '序号', + width: 120, + fixed: 'left', + }, + { + field: 'pointId', + title: '点位名称', + slots: { default: 'pointId' }, + width: 300, + treeNode: true, + }, + { + field: 'displayName', + title: '设备名称', + width: 150, + }, + { + field: 'productId', + title: '设备型号', + slots: { default: 'productId' }, + width: 150, + }, + { + field: 'cardId', + title: '设备卡号', + slots: { default: 'cardId' }, + width: 150, + }, + { + field: 'longitude', + title: '经度', + width: 150, + }, + { + field: 'latitude', + title: '纬度', + width: 150, + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 200, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/things/device/form.vue b/apps/web-tdesign/src/views/things/device/form.vue new file mode 100644 index 00000000..b3dda6c1 --- /dev/null +++ b/apps/web-tdesign/src/views/things/device/form.vue @@ -0,0 +1,75 @@ + + + diff --git a/apps/web-tdesign/src/views/things/device/index.vue b/apps/web-tdesign/src/views/things/device/index.vue new file mode 100644 index 00000000..9a3063c8 --- /dev/null +++ b/apps/web-tdesign/src/views/things/device/index.vue @@ -0,0 +1,149 @@ + + + diff --git a/apps/web-tdesign/src/views/things/flow/data.ts b/apps/web-tdesign/src/views/things/flow/data.ts new file mode 100644 index 00000000..db3bd421 --- /dev/null +++ b/apps/web-tdesign/src/views/things/flow/data.ts @@ -0,0 +1,103 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { getDeptOptions } from '#/api'; +import { SendHandlerEnum } from '#/enum/SendHandler'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'deviceId', + label: '设备id', + rules: 'required', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入同步key', + }, + fieldName: 'syncKey', + label: '同步key', + }, + { + component: 'Input', + componentProps: { + placeholder: '请输入同步密钥', + }, + fieldName: 'syncSecret', + label: '同步密钥', + }, + { + component: 'Input', + componentProps: { + placeholder: '请选择同步平台', + options: SendHandlerEnum, + clearable: true, + }, + fieldName: 'sendHandlerClass', + label: '同步平台', + }, + ]; +} + +export function useSearchFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + placeholder: '请输入观测点名称', + }, + fieldName: 'displayName', + label: '观测点名称', + }, + { + component: 'ApiSelect', + fieldName: 'deptId', + componentProps: { + api: getDeptOptions, + clearable: true, + labelField: 'deptName', + valueField: 'id', + }, + label: '部门', + }, + ]; +} +export function useGridSchema() { + return [ + { + field: 'id', + title: '序号', + width: 120, + fixed: 'left', + }, + { + field: 'displayName', + title: '点位名称', + slots: { default: 'displayName' }, + width: 120, + }, + { + field: 'locationName', + title: '行政区划', + width: 150, + }, + { + field: 'deptIds', + title: '部门', + slots: { default: 'deptIds' }, + width: 150, + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 120, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/things/flow/form.vue b/apps/web-tdesign/src/views/things/flow/form.vue new file mode 100644 index 00000000..702db856 --- /dev/null +++ b/apps/web-tdesign/src/views/things/flow/form.vue @@ -0,0 +1,101 @@ + + + diff --git a/apps/web-tdesign/src/views/things/flow/index.vue b/apps/web-tdesign/src/views/things/flow/index.vue new file mode 100644 index 00000000..bbf32dcd --- /dev/null +++ b/apps/web-tdesign/src/views/things/flow/index.vue @@ -0,0 +1,113 @@ + + + diff --git a/apps/web-tdesign/src/views/things/point/data.ts b/apps/web-tdesign/src/views/things/point/data.ts new file mode 100644 index 00000000..ce279d1f --- /dev/null +++ b/apps/web-tdesign/src/views/things/point/data.ts @@ -0,0 +1,113 @@ +import type { VbenFormSchema } from '#/adapter/form'; + +import { useCascaderAreaData } from '@vant/area-data'; + +import { getDeptOptions } from '#/api'; + +export function useSubmitFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Cascader', + componentProps: { + options: useCascaderAreaData(), + labelField: 'text', + valueField: 'value', + filterable: true, + clearable: true, + placeholder: '请选择行政区划', + }, + defaultValue: [], + fieldName: 'locationCode', + label: '行政区划', + }, + { + component: 'Input', + fieldName: 'displayName', + label: '观测点名称', + rules: 'required', + }, + { + component: 'ApiSelect', + fieldName: 'deptIds', + defaultValue: [], + componentProps: { + api: getDeptOptions, + clearable: true, + multiple: true, + labelField: 'deptName', + valueField: 'id', + }, + label: '部门', + }, + { + component: 'Input', + componentProps: { + type: 'textarea', + }, + fieldName: 'remark', + label: '备注', + }, + ]; +} + +export function useSearchFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + placeholder: '请输入观测点名称', + }, + fieldName: 'displayName', + label: '观测点名称', + }, + { + component: 'ApiSelect', + fieldName: 'deptId', + componentProps: { + api: getDeptOptions, + clearable: true, + labelField: 'deptName', + valueField: 'id', + }, + label: '部门', + }, + ]; +} +export function useGridSchema() { + return [ + { + field: 'id', + title: '序号', + width: 120, + fixed: 'left', + }, + { + field: 'displayName', + title: '点位名称', + slots: { default: 'displayName' }, + width: 120, + }, + { + field: 'locationName', + title: '行政区划', + width: 150, + }, + { + field: 'deptIds', + title: '部门', + slots: { default: 'deptIds' }, + width: 150, + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'actions', + title: '操作', + fixed: 'right', + width: 120, + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-tdesign/src/views/things/point/form.vue b/apps/web-tdesign/src/views/things/point/form.vue new file mode 100644 index 00000000..702db856 --- /dev/null +++ b/apps/web-tdesign/src/views/things/point/form.vue @@ -0,0 +1,101 @@ + + + diff --git a/apps/web-tdesign/src/views/things/point/index.vue b/apps/web-tdesign/src/views/things/point/index.vue new file mode 100644 index 00000000..bbf32dcd --- /dev/null +++ b/apps/web-tdesign/src/views/things/point/index.vue @@ -0,0 +1,113 @@ + + + diff --git a/apps/web-tdesign/vite.config.mts b/apps/web-tdesign/vite.config.mts index b6360f1d..10fc4d2c 100644 --- a/apps/web-tdesign/vite.config.mts +++ b/apps/web-tdesign/vite.config.mts @@ -10,7 +10,7 @@ export default defineConfig(async () => { changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), // mock代理目标地址 - target: 'http://localhost:5320/api', + target: 'http://localhost:7901/api', ws: true, }, },