123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import ParamsDictService from "../service/params-dict-service.js";
- import ApiResult from "../config/api.js";
- const ParamsDictControl = {
- list: async (req, res) => {
- try {
- ParamsDictService.list(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- page: async (req, res) => {
- try {
- ParamsDictService.page(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- info: async (req, res) => {
- try {
- ParamsDictService.info(req.params.id).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- add: async (req, res) => {
- try {
- ParamsDictService.add(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- edit: async (req, res) => {
- try {
- ParamsDictService.edit(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- del: async (req, res) => {
- try {
- ParamsDictService.del(req.params?.ids?.split(',')).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- enabled: async (req, res) => {
- try {
- ParamsDictService.enabled(req.params?.ids?.split(',')).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- disabled: async (req, res) => {
- try {
- ParamsDictService.disabled(req.params?.ids?.split(',')).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- }
- export default ParamsDictControl
|