1
0
mirror of https://github.com/chillzhuang/Sword synced 2024-12-23 01:19:24 +08:00
Sword/mock/dept.js

88 lines
1.9 KiB
JavaScript
Raw Normal View History

2019-02-13 17:16:39 +08:00
import { delay } from 'roadhog-api-doc';
function getFakeList(req, res) {
const json = { code: 200, success: true, msg: '操作成功' };
const data = [];
data.push({
id: '1',
deptName: '刀锋科技',
2019-11-19 17:34:16 +08:00
tenantId: '000000',
2019-02-13 17:16:39 +08:00
fullName: '江苏刀锋科技有限公司',
sort: '1',
children: [
{
id: '2',
deptName: '常州刀锋',
2019-11-19 17:34:16 +08:00
tenantId: '000000',
2019-02-13 17:16:39 +08:00
fullName: '常州刀锋科技有限公司',
sort: '1',
},
{
id: '3',
deptName: '南京刀锋',
2019-11-19 17:34:16 +08:00
tenantId: '000000',
2019-02-13 17:16:39 +08:00
fullName: '南京刀锋科技有限公司',
sort: '2',
},
],
});
json.data = data;
return res.json(json);
}
function getFakeDetail(req, res) {
const json = { code: 200, success: true, msg: '操作成功' };
const detail = {
id: 2,
parentId: 1,
parentName: '江苏刀锋',
2019-11-19 17:34:16 +08:00
tenantId: '000000',
2019-02-13 17:16:39 +08:00
deptName: '常州刀锋',
fullName: '常州刀锋科技有限公司',
sort: 1,
nextSort: 4,
remark: '测试备注',
};
json.data = detail;
return res.json(json);
}
function getFakeTree(req, res) {
const json = { code: 200, success: true, msg: '操作成功' };
const list = [];
list.push({
title: '江苏刀锋',
value: '1',
key: '1',
children: [
{
title: '常州刀锋',
value: '2',
key: '2',
},
{
title: '南京刀锋',
value: '3',
key: '3',
},
],
});
json.data = list;
return res.json(json);
}
function fakeSuccess(req, res) {
const json = { code: 200, success: true, msg: '操作成功' };
return res.json(json);
}
const proxy = {
'GET /api/blade-system/dept/list': getFakeList,
'GET /api/blade-system/dept/detail': getFakeDetail,
'GET /api/blade-system/dept/tree': getFakeTree,
'POST /api/blade-system/dept/submit': fakeSuccess,
'POST /api/blade-system/dept/remove': fakeSuccess,
};
export default delay(proxy, 500);