12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { api } from '@/utils/api'
- import QsUtil from '@/utils/QsUtil'
- export default class CurdApi {
- basePath
- api = api
- getList = (query) => api({
- url: `${this.basePath}/list`,
- method: 'POST',
- data: query
- })
- getPagination = (query, pagination) => api({
- url: `${this.basePath}/page${QsUtil.stringify({
- offset: (pagination.pageNo - 1) * pagination.pageSize,
- limit: pagination.pageSize
- })}`,
- method: 'POST',
- data: query
- })
- getDetail = (data, Target) => api({
- url: `${this.basePath}/${data[Target.$$idProp]}`,
- method: 'GET'
- })
- save = (data, saveType, Target) => api({
- url: `${this.basePath}`,
- method: saveType,
- data
- })
- delete = (data, Target) => api({
- url: `${this.basePath}/${data[Target.$$idProp]}`,
- method: 'DELETE'
- })
- constructor (basePath) {
- this.basePath = basePath
- }
- }
|