新增前端vue

This commit is contained in:
2025-12-09 18:02:25 +08:00
parent 3aa11787dc
commit ec2622743a
8 changed files with 825 additions and 107 deletions

View File

@@ -1,6 +1,7 @@
package com.jeesite.modules.erp.web;
import java.util.List;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@@ -26,6 +27,7 @@ import com.jeesite.modules.erp.service.ErpAccountService;
/**
* 账户信息Controller
*
* @author gaoxq
* @version 2025-11-29
*/
@@ -33,114 +35,120 @@ import com.jeesite.modules.erp.service.ErpAccountService;
@RequestMapping(value = "${adminPath}/erp/account")
public class ErpAccountController extends BaseController {
private final ErpAccountService erpAccountService;
private final ErpAccountService erpAccountService;
public ErpAccountController(ErpAccountService erpAccountService) {
this.erpAccountService = erpAccountService;
}
/**
* 获取数据
*/
@ModelAttribute
public ErpAccount get(String accountId, boolean isNewRecord) {
return erpAccountService.get(accountId, isNewRecord);
}
/**
* 查询列表
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = {"list", ""})
public String list(ErpAccount erpAccount, Model model) {
model.addAttribute("erpAccount", erpAccount);
return "modules/erp/erpAccountList";
}
/**
* 查询列表数据
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "listData")
@ResponseBody
public Page<ErpAccount> listData(ErpAccount erpAccount, HttpServletRequest request, HttpServletResponse response) {
erpAccount.setPage(new Page<>(request, response));
Page<ErpAccount> page = erpAccountService.findPage(erpAccount);
return page;
}
public ErpAccountController(ErpAccountService erpAccountService) {
this.erpAccountService = erpAccountService;
}
/**
* 查看编辑表单
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "form")
public String form(ErpAccount erpAccount, Model model) {
model.addAttribute("erpAccount", erpAccount);
return "modules/erp/erpAccountForm";
}
/**
* 获取数据
*/
@ModelAttribute
public ErpAccount get(String accountId, boolean isNewRecord) {
return erpAccountService.get(accountId, isNewRecord);
}
/**
* 保存数据
*/
@RequiresPermissions("erp:account:edit")
@PostMapping(value = "save")
@ResponseBody
public String save(@Validated ErpAccount erpAccount) {
erpAccountService.save(erpAccount);
return renderResult(Global.TRUE, text("保存账户信息成功!"));
}
/**
* 查询列表
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = {"list", ""})
public String list(ErpAccount erpAccount, Model model) {
model.addAttribute("erpAccount", erpAccount);
return "modules/erp/erpAccountList";
}
/**
* 导出数据
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "exportData")
public void exportData(ErpAccount erpAccount, HttpServletResponse response) {
List<ErpAccount> list = erpAccountService.findList(erpAccount);
String fileName = "账户信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
try(ExcelExport ee = new ExcelExport("账户信息", ErpAccount.class)){
ee.setDataList(list).write(response, fileName);
}
}
/**
* 查询列表数据
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "listData")
@ResponseBody
public Page<ErpAccount> listData(ErpAccount erpAccount, HttpServletRequest request, HttpServletResponse response) {
erpAccount.setPage(new Page<>(request, response));
Page<ErpAccount> page = erpAccountService.findPage(erpAccount);
return page;
}
/**
* 下载模板
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "importTemplate")
public void importTemplate(HttpServletResponse response) {
ErpAccount erpAccount = new ErpAccount();
List<ErpAccount> list = ListUtils.newArrayList(erpAccount);
String fileName = "账户信息模板.xlsx";
try(ExcelExport ee = new ExcelExport("账户信息", ErpAccount.class, Type.IMPORT)){
ee.setDataList(list).write(response, fileName);
}
}
/**
* 查看编辑表单
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "form")
public String form(ErpAccount erpAccount, Model model) {
model.addAttribute("erpAccount", erpAccount);
return "modules/erp/erpAccountForm";
}
/**
* 保存数据
*/
@RequiresPermissions("erp:account:edit")
@PostMapping(value = "save")
@ResponseBody
public String save(@Validated ErpAccount erpAccount) {
erpAccountService.save(erpAccount);
return renderResult(Global.TRUE, text("保存账户信息成功!"));
}
/**
* 导出数据
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "exportData")
public void exportData(ErpAccount erpAccount, HttpServletResponse response) {
List<ErpAccount> list = erpAccountService.findList(erpAccount);
String fileName = "账户信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
try (ExcelExport ee = new ExcelExport("账户信息", ErpAccount.class)) {
ee.setDataList(list).write(response, fileName);
}
}
/**
* 下载模板
*/
@RequiresPermissions("erp:account:view")
@RequestMapping(value = "importTemplate")
public void importTemplate(HttpServletResponse response) {
ErpAccount erpAccount = new ErpAccount();
List<ErpAccount> list = ListUtils.newArrayList(erpAccount);
String fileName = "账户信息模板.xlsx";
try (ExcelExport ee = new ExcelExport("账户信息", ErpAccount.class, Type.IMPORT)) {
ee.setDataList(list).write(response, fileName);
}
}
/**
* 导入数据
*/
@ResponseBody
@RequiresPermissions("erp:account:edit")
@PostMapping(value = "importData")
public String importData(MultipartFile file) {
try {
String message = erpAccountService.importData(file);
return renderResult(Global.TRUE, "posfull:" + message);
} catch (Exception ex) {
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
}
}
/**
* 删除数据
*/
@RequiresPermissions("erp:account:edit")
@RequestMapping(value = "delete")
@ResponseBody
public String delete(ErpAccount erpAccount) {
erpAccountService.delete(erpAccount);
return renderResult(Global.TRUE, text("删除账户信息成功!"));
}
@RequestMapping(value = "listAll")
@ResponseBody
public List<ErpAccount> listAll(ErpAccount erpAccount) {
return erpAccountService.findList(erpAccount);
}
/**
* 导入数据
*/
@ResponseBody
@RequiresPermissions("erp:account:edit")
@PostMapping(value = "importData")
public String importData(MultipartFile file) {
try {
String message = erpAccountService.importData(file);
return renderResult(Global.TRUE, "posfull:"+message);
} catch (Exception ex) {
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
}
}
/**
* 删除数据
*/
@RequiresPermissions("erp:account:edit")
@RequestMapping(value = "delete")
@ResponseBody
public String delete(ErpAccount erpAccount) {
erpAccountService.delete(erpAccount);
return renderResult(Global.TRUE, text("删除账户信息成功!"));
}
}