weapon.js 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. /*
  4. 军标库请求处理
  5. */
  6. class WeaponController extends Controller {
  7. async list() {
  8. const {ctx, service} = this;
  9. await ctx.queryHandleByService( service.weapon, "list");
  10. }
  11. async delete() {
  12. const {ctx, service} = this;
  13. await ctx.queryHandleByService( service.weapon, "delete", "删除成功");
  14. }
  15. async edit() {
  16. const {ctx, service} = this;
  17. await ctx.bodyHandleByService( service.weapon, "edit", "更新成功");
  18. }
  19. async add() {
  20. const {ctx, service} = this;
  21. await ctx.bodyHandleByService( service.weapon, "add", "添加成功");
  22. }
  23. async exportXls( ) {
  24. const {ctx, service} = this;
  25. ctx.set("Content-Type", "application/vnd.openxmlformats");
  26. ctx.set("Content-Disposition","attachment;filename*=UTF-8 xx.xlsx");
  27. let ret = await service.weapon.exportXls( ctx.request.query );
  28. ctx.body = ret;
  29. }
  30. }
  31. module.exports = WeaponController;