diff --git a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/PageTable/utils/FieldBuilder.java b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/PageTable/utils/FieldBuilder.java index ab434d7..eb28058 100644 --- a/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/PageTable/utils/FieldBuilder.java +++ b/backend/microservice-common/src/main/java/com/cxyxiaomo/epp/PageTable/utils/FieldBuilder.java @@ -35,7 +35,7 @@ public class FieldBuilder { * @param addType 新增弹窗中该字段显示为什么类型
* @param editType 修改弹窗中该字段显示为什么类型
* @param fieldRuleListBuilder 提交时的表单验证
- * @param mockDataPattern mock数据正则
+ * @param mockDataPattern mock数据正则 文档
* @return FieldBuilder */ public FieldBuilder add(String field, String prop, String fieldName, Object defaultValue, diff --git a/backend/microservice-provider-user-8001/src/main/java/com/cxyxiaomo/epp/user/controller/UserController.java b/backend/microservice-provider-user-8001/src/main/java/com/cxyxiaomo/epp/user/controller/UserController.java index 2ba7083..e8e24df 100644 --- a/backend/microservice-provider-user-8001/src/main/java/com/cxyxiaomo/epp/user/controller/UserController.java +++ b/backend/microservice-provider-user-8001/src/main/java/com/cxyxiaomo/epp/user/controller/UserController.java @@ -23,6 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -92,6 +95,9 @@ public class UserController { // 新增、修改弹窗时,使用该列作为主键列进行操作 String idFieldName = "id"; + // 当前管理页面 + String pageName = "用户管理"; + // 指定前端表格显示列 JSONArray columns = FieldBuilder.create() .add("username", "username", "账号", "", @@ -185,6 +191,7 @@ public class UserController { map.put("columns", columns); map.put("fieldMapper", fieldMapper); map.put("idFieldName", idFieldName); + map.put("pageName", pageName); // 返回结果 return Res.success(map); @@ -213,6 +220,7 @@ public class UserController { } String passwordHash = DigestUtils.sha512Hex(password); user.setPassword(passwordHash); + user.setId(null); userService.addUser(user); } else { // 修改用户 @@ -250,4 +258,28 @@ public class UserController { boolean b = userService.deleteUser(existUser.getId()); return Res.success(b); } + + /** + * 导出用户列表 + * + * @return + */ + @GetMapping("/manage/exportUserList") + @ResponseBody + public Res exportUserList(UserVO userVO) { + List userList = userService.getUserList(userVO); + List userVOList = UserVO.convertFrom(userList); + + // 当前时间 + Date now = Calendar.getInstance().getTime(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String dateTime = format.format(now); + + HashMap map = new HashMap<>(); + map.put("list", userVOList); + map.put("sheetName", "用户表-" + System.currentTimeMillis()); + map.put("fileName", "用户表_导出时间_" + dateTime); + + return Res.success(map); + } } diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 858af70..b21c22c 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -9,16 +9,10 @@ declare module '@vue/runtime-core' { export interface GlobalComponents { Calender: typeof import('./src/components/calender.vue')['default'] ContextMenu: typeof import('./src/components/context-menu.vue')['default'] - ElAffix: typeof import('element-plus/es')['ElAffix'] + ElAlert: typeof import('element-plus/es')['ElAlert'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElButton: typeof import('element-plus/es')['ElButton'] - ElCard: typeof import('element-plus/es')['ElCard'] - ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] - ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] - ElCol: typeof import('element-plus/es')['ElCol'] - ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] - ElDivider: typeof import('element-plus/es')['ElDivider'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] @@ -26,33 +20,20 @@ declare module '@vue/runtime-core' { ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] - ElImage: typeof import('element-plus/es')['ElImage'] ElInput: typeof import('element-plus/es')['ElInput'] - ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] - ElProgress: typeof import('element-plus/es')['ElProgress'] ElRadio: typeof import('element-plus/es')['ElRadio'] - ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] - ElRow: typeof import('element-plus/es')['ElRow'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] - ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] - ElTabPane: typeof import('element-plus/es')['ElTabPane'] - ElTabs: typeof import('element-plus/es')['ElTabs'] - ElTag: typeof import('element-plus/es')['ElTag'] - ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] - ElTree: typeof import('element-plus/es')['ElTree'] - ElUpload: typeof import('element-plus/es')['ElUpload'] Header: typeof import('./src/components/header.vue')['default'] ManageList: typeof import('./src/components/manage-list.vue')['default'] - Popover: typeof import('./src/components/popover.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] Sidebar: typeof import('./src/components/sidebar.vue')['default'] diff --git a/frontend/src/api/user.js b/frontend/src/api/user.js index f862d6f..5b93289 100644 --- a/frontend/src/api/user.js +++ b/frontend/src/api/user.js @@ -61,3 +61,15 @@ export function deleteUser(params) { params: params, }); }; + +/** + * 导出用户列表 + * @returns + */ +export function exportUserList(params) { + return send_request({ + url: '/user/manage/exportUserList', + method: 'GET', + params: params, + }); +}; diff --git a/frontend/src/components/manage-list.vue b/frontend/src/components/manage-list.vue index 2ef3f9e..3335e4e 100644 --- a/frontend/src/components/manage-list.vue +++ b/frontend/src/components/manage-list.vue @@ -6,17 +6,24 @@
- 搜索 - 新增 + 查询 + 新增记录 + 导出到文件
@@ -72,14 +79,38 @@ + + + + + + + 全部数据 + 满足筛选条件的数据 + + + + + {{ ext }} + + + + + + - - diff --git a/frontend/src/views/demo/editor.vue b/frontend/src/views/demo/editor.vue deleted file mode 100644 index c08d55b..0000000 --- a/frontend/src/views/demo/editor.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/frontend/src/views/demo/export.vue b/frontend/src/views/demo/export.vue deleted file mode 100644 index 21ecf6b..0000000 --- a/frontend/src/views/demo/export.vue +++ /dev/null @@ -1,98 +0,0 @@ - - - - - diff --git a/frontend/src/views/demo/form.vue b/frontend/src/views/demo/form.vue deleted file mode 100644 index 75609ae..0000000 --- a/frontend/src/views/demo/form.vue +++ /dev/null @@ -1,156 +0,0 @@ - - - diff --git a/frontend/src/views/demo/icon.vue b/frontend/src/views/demo/icon.vue deleted file mode 100644 index 0b01ff3..0000000 --- a/frontend/src/views/demo/icon.vue +++ /dev/null @@ -1,212 +0,0 @@ - - - - - diff --git a/frontend/src/views/demo/import.vue b/frontend/src/views/demo/import.vue deleted file mode 100644 index e0ca8c3..0000000 --- a/frontend/src/views/demo/import.vue +++ /dev/null @@ -1,118 +0,0 @@ - - - - - diff --git a/frontend/src/views/demo/markdown.vue b/frontend/src/views/demo/markdown.vue deleted file mode 100644 index d435f9c..0000000 --- a/frontend/src/views/demo/markdown.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/frontend/src/views/demo/table.vue b/frontend/src/views/demo/table.vue deleted file mode 100644 index a51be82..0000000 --- a/frontend/src/views/demo/table.vue +++ /dev/null @@ -1,191 +0,0 @@ - - - - - diff --git a/frontend/src/views/demo/tabs.vue b/frontend/src/views/demo/tabs.vue deleted file mode 100644 index 849a131..0000000 --- a/frontend/src/views/demo/tabs.vue +++ /dev/null @@ -1,116 +0,0 @@ - - - - - diff --git a/frontend/src/views/demo/user.vue b/frontend/src/views/demo/user.vue deleted file mode 100644 index 1d281a2..0000000 --- a/frontend/src/views/demo/user.vue +++ /dev/null @@ -1,174 +0,0 @@ - - - - - diff --git a/frontend/src/views/equipment-setting.vue b/frontend/src/views/equipment-setting.vue deleted file mode 100644 index 49359c0..0000000 --- a/frontend/src/views/equipment-setting.vue +++ /dev/null @@ -1,389 +0,0 @@ - - - - - diff --git a/frontend/src/views/monitor-data-view.vue b/frontend/src/views/monitor-data-view.vue deleted file mode 100644 index 75ef051..0000000 --- a/frontend/src/views/monitor-data-view.vue +++ /dev/null @@ -1,182 +0,0 @@ - - - - - diff --git a/frontend/src/views/privilege-role-setting.vue b/frontend/src/views/privilege-role-setting.vue deleted file mode 100644 index 3ba9c46..0000000 --- a/frontend/src/views/privilege-role-setting.vue +++ /dev/null @@ -1,286 +0,0 @@ - - - - - diff --git a/frontend/src/views/privilege-user-setting.vue b/frontend/src/views/privilege-user-setting.vue index c5dac64..0861e4d 100644 --- a/frontend/src/views/privilege-user-setting.vue +++ b/frontend/src/views/privilege-user-setting.vue @@ -1,12 +1,11 @@ diff --git a/frontend/src/views/shop-good-setting.vue b/frontend/src/views/shop-good-setting.vue new file mode 100644 index 0000000..0861e4d --- /dev/null +++ b/frontend/src/views/shop-good-setting.vue @@ -0,0 +1,11 @@ + + + diff --git a/frontend/src/views/warning-setting.vue b/frontend/src/views/warning-setting.vue deleted file mode 100644 index 7d518fd..0000000 --- a/frontend/src/views/warning-setting.vue +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/frontend/src/views/warning-view.vue b/frontend/src/views/warning-view.vue deleted file mode 100644 index c91bc52..0000000 --- a/frontend/src/views/warning-view.vue +++ /dev/null @@ -1,396 +0,0 @@ - - - - -