| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import Mock from 'mockjs'
- import { MockMethod } from 'vite-plugin-mock'
- const mockMethodElevent: MockMethod[] = [
- {
- url: '/mock/api/eleven',
- method: 'get',
- timeout: 1000,
- response: () => {
- return {
- code: '0',
- ...Mock.mock({
- 'data|20': [
- {
- id: '@id',
- name: '@ctitle(4,6)',
- reason: '@reason',
- email: '@integer(10000000, 99999999)',
- taxInvoice: '@string(upper, 8, 8)',
- source: '@taxInvoiceSource',
- payer: '@cname',
- total: '@natural(100, 100000)',
- dutiable: '@natural(10, 100)',
- date: '@datetime("2024-MM-dd hh:mm:ss")',
- printing: '@cname',
- printDate: function () {
- let date = Mock.Random.datetime('2024-MM-dd hh:mm:ss')
- while (date < this.date) {
- date = Mock.Random.datetime('2024-MM-dd hh:mm:ss')
- }
- return date
- }
- }
- ]
- })
- }
- }
- },
- {
- url: '/mock/api/eleven/get/child',
- method: 'get',
- timeout: 1000,
- response: () => {
- return {
- code: '0',
- ...Mock.mock({
- 'data|2-5': [
- {
- id: '@id',
- name: '@goods("name")',
- date: '@datetime',
- total: '@natural(100, 100000)',
- code: '@natural(100000, 200000)',
- type: '@cword(1, 1)',
- price: '@natural(100000, 200000)',
- unit: '@unit',
- taxRate: '@natural(0, 50)',
- tax: '@natural(100000, 200000)',
- thingName: function () {
- return this.name
- },
- thingTotal: '@natural(100, 100000)',
- thingPrice: '@natural(100000, 200000)',
- thingCode: function () {
- return this.code
- }
- }
- ]
- })
- }
- }
- }
- ]
- export default mockMethodElevent
|