modelPage.js 734 B

1234567891011121314151617181920212223
  1. module.exports = function(compoenntName) {
  2. return `import asyncService from "@/apis/service/${compoenntName}/index";
  3. const asyncFn = async (name, data) => {
  4. let res = await asyncService[name](data);
  5. return res;
  6. };
  7. export default {
  8. // 添加
  9. add: async data => await asyncFn("add", data),
  10. // 删除
  11. delete: async data => await asyncFn("delete", data),
  12. // 分页查询
  13. list: async data => await asyncFn("list", data),
  14. // 详情
  15. detail: async data => await asyncFn("detail", data),
  16. // 更新
  17. update: async data => await asyncFn("update", data),
  18. //修改状态
  19. status: async data => await asyncFn("accountstatus", data),
  20. };
  21. `;
  22. };