1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012 |
- import { getUrlParams } from "./utils";
- const titles = [
- "Alipay",
- "Angular",
- "Ant Design",
- "Ant Design Pro",
- "Bootstrap",
- "React",
- "Vue",
- "Webpack"
- ];
- const avatars = [
- "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png", // Alipay
- "https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png", // Angular
- "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png", // Ant Design
- "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png", // Ant Design Pro
- "https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png", // Bootstrap
- "https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png", // React
- "https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png", // Vue
- "https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png" // Webpack
- ];
- const covers = [
- "https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png",
- "https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png",
- "https://gw.alipayobjects.com/zos/rmsportal/uVZonEtjWwmUZPBQfycs.png",
- "https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png"
- ];
- const desc = [
- "那是一种内在的东西, 他们到达不了,也无法触及的",
- "希望是一个好东西,也许是最好的,好东西是不会消亡的",
- "生命就像一盒巧克力,结果往往出人意料",
- "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
- "那时候我只会想自己想要什么,从不想自己拥有什么"
- ];
- const user = [
- "付小小",
- "曲丽丽",
- "林东东",
- "周星星",
- "吴加好",
- "朱偏右",
- "鱼酱",
- "乐哥",
- "谭小仪",
- "仲尼"
- ];
- export function fakeList(count) {
- const list = [];
- for (let i = 0; i < count; i += 1) {
- list.push({
- id: `fake-list-${i}`,
- owner: user[i % 10],
- title: titles[i % 8],
- avatar: avatars[i % 8],
- cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4],
- status: ["active", "exception", "normal"][i % 3],
- percent: Math.ceil(Math.random() * 50) + 50,
- logo: avatars[i % 8],
- href: "https://ant.design",
- updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
- createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
- subDescription: desc[i % 5],
- description:
- "在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。",
- activeUser: Math.ceil(Math.random() * 100000) + 100000,
- newUser: Math.ceil(Math.random() * 1000) + 1000,
- star: Math.ceil(Math.random() * 100) + 100,
- like: Math.ceil(Math.random() * 100) + 100,
- message: Math.ceil(Math.random() * 10) + 10,
- content:
- "段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。",
- members: [
- {
- avatar:
- "https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png",
- name: "曲丽丽"
- },
- {
- avatar:
- "https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png",
- name: "王昭君"
- },
- {
- avatar:
- "https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png",
- name: "董娜娜"
- }
- ]
- });
- }
- return list;
- }
- export function getFakeList(req, res, u) {
- let url = u;
- if (!url || Object.prototype.toString.call(url) !== "[object String]") {
- url = req.url; // eslint-disable-line
- }
- const params = getUrlParams(url);
- const count = params.count * 1 || 20;
- const result = fakeList(count);
- if (res && res.json) {
- res.json(result);
- } else {
- return result;
- }
- }
- export const getNotice = [
- {
- id: "xxx1",
- title: titles[0],
- logo: avatars[0],
- description: "那是一种内在的东西,他们到达不了,也无法触及的",
- updatedAt: new Date(),
- member: "科学搬砖组",
- href: "",
- memberLink: ""
- },
- {
- id: "xxx2",
- title: titles[1],
- logo: avatars[1],
- description: "希望是一个好东西,也许是最好的,好东西是不会消亡的",
- updatedAt: new Date("2017-07-24"),
- member: "全组都是吴彦祖",
- href: "",
- memberLink: ""
- },
- {
- id: "xxx3",
- title: titles[2],
- logo: avatars[2],
- description: "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
- updatedAt: new Date(),
- member: "中二少女团",
- href: "",
- memberLink: ""
- },
- {
- id: "xxx4",
- title: titles[3],
- logo: avatars[3],
- description: "那时候我只会想自己想要什么,从不想自己拥有什么",
- updatedAt: new Date("2017-07-23"),
- member: "程序员日常",
- href: "",
- memberLink: ""
- },
- {
- id: "xxx5",
- title: titles[4],
- logo: avatars[4],
- description: "凛冬将至",
- updatedAt: new Date("2017-07-23"),
- member: "高逼格设计天团",
- href: "",
- memberLink: ""
- },
- {
- id: "xxx6",
- title: titles[5],
- logo: avatars[5],
- description: "生命就像一盒巧克力,结果往往出人意料",
- updatedAt: new Date("2017-07-23"),
- member: "骗你来学计算机",
- href: "",
- memberLink: ""
- }
- ];
- export const getActivities = [
- {
- id: "trend-1",
- updatedAt: new Date(),
- user: {
- name: "林东东",
- avatar: avatars[0]
- },
- group: {
- name: "高逼格设计天团",
- link: "http://github.com/"
- },
- project: {
- name: "六月迭代",
- link: "http://github.com/"
- },
- template: "在 @{group} 新建项目 @{project}"
- },
- {
- id: "trend-2",
- updatedAt: new Date(),
- user: {
- name: "付小小",
- avatar: avatars[1]
- },
- group: {
- name: "高逼格设计天团",
- link: "http://github.com/"
- },
- project: {
- name: "六月迭代",
- link: "http://github.com/"
- },
- template: "在 @{group} 新建项目 @{project}"
- },
- {
- id: "trend-3",
- updatedAt: new Date(),
- user: {
- name: "曲丽丽",
- avatar: avatars[2]
- },
- group: {
- name: "中二少女团",
- link: "http://github.com/"
- },
- project: {
- name: "六月迭代",
- link: "http://github.com/"
- },
- template: "在 @{group} 新建项目 @{project}"
- },
- {
- id: "trend-4",
- updatedAt: new Date(),
- user: {
- name: "周星星",
- avatar: avatars[3]
- },
- project: {
- name: "5 月日常迭代",
- link: "http://github.com/"
- },
- template: "将 @{project} 更新至已发布状态"
- },
- {
- id: "trend-5",
- updatedAt: new Date(),
- user: {
- name: "朱偏右",
- avatar: avatars[4]
- },
- project: {
- name: "工程效能",
- link: "http://github.com/"
- },
- comment: {
- name: "留言",
- link: "http://github.com/"
- },
- template: "在 @{project} 发布了 @{comment}"
- },
- {
- id: "trend-6",
- updatedAt: new Date(),
- user: {
- name: "乐哥",
- avatar: avatars[5]
- },
- group: {
- name: "程序员日常",
- link: "http://github.com/"
- },
- project: {
- name: "品牌迭代",
- link: "http://github.com/"
- },
- template: "在 @{group} 新建项目 @{project}"
- }
- ];
- const orderData = {
- result: 1,
- msg: "查询成功",
- errorCode: null,
- data: [
- {
- id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111008",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "04",
- poTypeName: "资源采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-11 16:48:23",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 2,
- totalAmount: 5,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "f5a4e11b-c728-4b3f-a449-3fd405ba54a7",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111007",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "05",
- poTypeName: "饰品采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: "饰品直送",
- orderDate: "2018-01-11 16:15:26",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 2,
- totalAmount: 11,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "59679ed9-f0cb-461c-aad2-b7b5ae8a7e52",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111006",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "04",
- poTypeName: "资源采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-11 16:03:55",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 3,
- totalAmount: 11,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "2dadc763-5faf-429e-a116-e3b567e98f26",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111005",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "04",
- poTypeName: "资源采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-11 16:03:07",
- billStatusCode: "03",
- billStatusName: "已审核",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 3,
- totalAmount: 11,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "b9f8ad0d-87bc-40f7-b5c5-803057947b71",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111004",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "04",
- poTypeName: "资源采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-11 16:00:58",
- billStatusCode: "03",
- billStatusName: "已审核",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 3,
- totalAmount: 11,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "df0f6e82-5564-4e9b-976d-de22eced0e1e",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111002",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "05",
- poTypeName: "饰品采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-11 15:52:00",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 7,
- totalAmount: 37,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "dadbe2cc-d0e6-4e98-a5e1-e11b8b4aeeb1",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180111001",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "01",
- poTypeName: "常规采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-11 15:51:25",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 2,
- totalAmount: 1120,
- totalVolume: 8.9,
- totalWeight: 444,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "cb10c21c-15c0-44e9-9a6a-082fe23e6a06",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180110001",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "05",
- poTypeName: "饰品采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-10 09:40:04",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 5,
- totalAmount: 27,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "da10e220-99b4-4eab-a1bb-539768082564",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180109016",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "05",
- poTypeName: "饰品采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-09 16:49:06",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 5,
- totalAmount: 27,
- totalVolume: 0,
- totalWeight: 0,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- },
- {
- id: "5eca085b-58b4-4c7f-a0ad-e75b5f9cb079",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- orderCode: "PO1001346180109014",
- businessAccountId: null,
- businessAccountCode: null,
- businessAccountName: null,
- poTypeCode: "01",
- poTypeName: "常规采购订单",
- receiveAddressId: null,
- receiveAddressName: null,
- demandDeliveryDate: null,
- billMakerId: null,
- billMakerName: null,
- remark: null,
- orderDate: "2018-01-09 15:55:44",
- billStatusCode: "05",
- billStatusName: "已完成",
- orderDateStart: null,
- orderDateEnd: null,
- reqDeliveryDate: null,
- defaultDelyDate: null,
- totalQuantity: 1,
- totalAmount: 560,
- totalVolume: 4.45,
- totalWeight: 222,
- distributorId: null,
- distributorCode: null,
- distributorName: null,
- transportModeCode: null,
- transportModeName: "整车",
- purchaseOrderItems: null
- }
- ],
- total: 15,
- pageIndex: 1,
- pageSize: 10
- };
- export const orderList = (req, res, u) => {
- let url = u;
- if (!url || Object.prototype.toString.call(url) !== "[object String]") {
- url = req.url; // eslint-disable-line
- }
- const params = getUrlParams(url);
- let dataSource = [...orderData.data];
- if (params.sorter) {
- const s = params.sorter.split("_");
- dataSource = dataSource.sort((prev, next) => {
- if (s[1] === "descend") {
- return next[s[0]] - prev[s[0]];
- }
- return prev[s[0]] - next[s[0]];
- });
- }
- if (params.page) {
- dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
- }
- const result = {
- list: dataSource,
- pagination: {
- total: orderData.total,
- pageSize: orderData.pageSize,
- pageIndex: parseInt(orderData.pageIndex, 10) || 1
- }
- };
- if (res && res.json) {
- res.json(result);
- } else {
- return result;
- }
- };
- /* 商品 */
- const goodsData = {
- result: 1,
- msg: "查询成功",
- errorCode: null,
- data: [
- {
- id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- productCode: "PO1001346180111001",
- name: "女装",
- specName: "90",
- shortName: "女装",
- productGroupCode: "008",
- productGroupCode: "服装",
- remark: "备注"
- },
- {
- id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- productCode: "PO1001346180111002",
- name: "女装",
- specName: "90",
- shortName: "女装",
- productGroupCode: "008",
- productGroupCode: "服装",
- remark: "备注"
- },
- {
- id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- productCode: "PO1001346180111003",
- name: "男装",
- specName: "90",
- shortName: "男装",
- productGroupCode: "008",
- productGroupCode: "服装",
- remark: "备注"
- },
- {
- id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
- persistStatus: null,
- accountTypeId: null,
- transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
- productCode: "PO1001346180111004",
- name: "女装",
- specName: "90",
- shortName: "女装",
- productGroupCode: "008",
- productGroupCode: "服装",
- remark: "备注"
- }
- ],
- total: 15,
- pageIndex: 1,
- pageSize: 10
- };
- export const goodsList = (req, res, u) => {
- let url = u;
- if (!url || Object.prototype.toString.call(url) !== "[object String]") {
- url = req.url; // eslint-disable-line
- }
- const params = getUrlParams(url);
- let dataSource = [...goodsData.data];
- if (params.sorter) {
- const s = params.sorter.split("_");
- dataSource = dataSource.sort((prev, next) => {
- if (s[1] === "descend") {
- return next[s[0]] - prev[s[0]];
- }
- return prev[s[0]] - next[s[0]];
- });
- }
- if (params.page) {
- dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
- }
- const result = {
- list: dataSource,
- pagination: {
- total: goodsData.total,
- pageSize: goodsData.pageSize,
- pageIndex: parseInt(goodsData.pageIndex, 10) || 1
- }
- };
- if (res && res.json) {
- res.json(result);
- } else {
- return result;
- }
- };
- /* 退货入库 */
- const returnTreasuryData = {
- result: 1,
- msg: "查询成功",
- errorCode: null,
- data: [
- {
- id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
- persistStatus: null,
- accountTypeId: null,
- billNo: "001",
- sourceNo: "0001",
- sourceType: "采购订单",
- stockinType: "退货入库",
- carrier: "甲",
- shipmentDate: "1992-11-11",
- exDeliveryDate: "1992-11-11",
- warehouseId: "仓库id",
- distributorId: "经销商ID",
- status: "未完成",
- comments: "备注",
- stockinCargos: "货品清单明细"
- }
- ],
- total: 15,
- pageIndex: 1,
- pageSize: 10
- };
- export const returnTreasuryList = (req, res, u) => {
- let url = u;
- if (!url || Object.prototype.toString.call(url) !== "[object String]") {
- url = req.url; // eslint-disable-line
- }
- const params = getUrlParams(url);
- let dataSource = [...returnTreasuryData.data];
- if (params.sorter) {
- const s = params.sorter.split("_");
- dataSource = dataSource.sort((prev, next) => {
- if (s[1] === "descend") {
- return next[s[0]] - prev[s[0]];
- }
- return prev[s[0]] - next[s[0]];
- });
- }
- if (params.page) {
- dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
- }
- const result = {
- list: dataSource,
- pagination: {
- total: returnTreasuryData.total,
- pageSize: returnTreasuryData.pageSize,
- pageIndex: parseInt(returnTreasuryData.pageIndex, 10) || 1
- }
- };
- if (res && res.json) {
- res.json(result);
- } else {
- return result;
- }
- };
- // 调拨入库
- export const allocatingStorageList = (req, res, u) => {
- let url = u;
- if (!url || Object.prototype.toString.call(url) !== "[object String]") {
- url = req.url; // eslint-disable-line
- }
- const params = getUrlParams(url);
- let dataSource = [...returnTreasuryData.data];
- if (params.sorter) {
- const s = params.sorter.split("_");
- dataSource = dataSource.sort((prev, next) => {
- if (s[1] === "descend") {
- return next[s[0]] - prev[s[0]];
- }
- return prev[s[0]] - next[s[0]];
- });
- }
- if (params.page) {
- dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
- }
- const result = {
- list: dataSource,
- pagination: {
- total: returnTreasuryData.total,
- pageSize: returnTreasuryData.pageSize,
- pageIndex: parseInt(returnTreasuryData.pageIndex, 10) || 1
- }
- };
- if (res && res.json) {
- res.json(result);
- } else {
- return result;
- }
- };
- /* 调拨 */
- const allocatingData = {
- result: 1,
- msg: "查询成功",
- errorCode: null,
- data: [
- {
- allotDate: null,
- allotDetails: [
- {
- actualQuantity: "5",
- allotCode: "33",
- allotId: "111",
- allotName: "法国",
- communityCode: "55",
- communityId: "66",
- communityName: "刚刚",
- creationTime: null,
- creator: "zz",
- dr: 0,
- id: "6hthth",
- modifiedTime: null,
- modifier: "a",
- quantity: "34343",
- ts: 0
- }
- ],
- billNo: "1232323",
- billStatus: 0,
- creationTime: "string",
- creator: "string",
- dr: 0,
- finishDate: "string",
- id: "34343",
- modifiedTime: "string",
- modifier: "string",
- ts: 0,
- warehouseCode: "string",
- warehouseId: "string",
- warehouseName: "string"
- },
- {
- allotDate: null,
- allotDetails: [
- {
- actualQuantity: "5",
- allotCode: "33",
- allotId: "111",
- allotName: "法国",
- communityCode: "55",
- communityId: "66",
- communityName: "刚刚",
- creationTime: null,
- creator: "zz",
- dr: 0,
- id: "6hthth",
- modifiedTime: null,
- modifier: "a",
- quantity: "34343",
- ts: 0
- }
- ],
- billNo: "4444444",
- billStatus: 0,
- creationTime: "string",
- creator: "string",
- dr: 0,
- finishDate: "string",
- id: "ddd",
- modifiedTime: "string",
- modifier: "string",
- ts: 0,
- warehouseCode: "string",
- warehouseId: "string",
- warehouseName: "string"
- }
- ],
- total: 2,
- pageIndex: 1,
- pageSize: 10
- };
- // 调拨
- export const allocatingList = (req, res, u) => {
- let url = u;
- if (!url || Object.prototype.toString.call(url) !== "[object String]") {
- url = req.url; // eslint-disable-line
- }
- const params = getUrlParams(url);
- let dataSource = [...allocatingData.data];
- if (params.sorter) {
- const s = params.sorter.split("_");
- dataSource = dataSource.sort((prev, next) => {
- if (s[1] === "descend") {
- return next[s[0]] - prev[s[0]];
- }
- return prev[s[0]] - next[s[0]];
- });
- }
- if (params.page) {
- dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
- }
- const result = {
- list: dataSource,
- pagination: {
- total: allocatingData.total,
- pageSize: allocatingData.pageSize,
- pageIndex: parseInt(allocatingData.pageIndex, 10) || 1
- }
- };
- if (res && res.json) {
- res.json(result);
- } else {
- return result;
- }
- };
- export default {
- getNotice,
- getActivities,
- getFakeList,
- orderList,
- goodsList,
- returnTreasuryList,
- allocatingStorageList,
- allocatingList
- };
|