186 lines
4.6 KiB
TypeScript
186 lines
4.6 KiB
TypeScript
import { delay, http, HttpResponse } from '@lingshu/vite-plugin-msw/msw';
|
|
|
|
function uuid(index: number) {
|
|
return `id_${index}`;
|
|
}
|
|
const handlers = [
|
|
http.get('/api/lcdp/v1/queryFieldInfo', async () => {
|
|
await delay(300);
|
|
const list = [
|
|
{
|
|
type: 'person',
|
|
caption: {
|
|
'zh-CN': '创建人',
|
|
},
|
|
fieldName: 'created_by',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: false,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293572431470594',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: false,
|
|
},
|
|
{
|
|
type: 'datetime',
|
|
caption: {
|
|
'zh-CN': '创建时间',
|
|
},
|
|
fieldName: 'created_at',
|
|
datetimeAttribute: '',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: false,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293572368556033',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: false,
|
|
},
|
|
{
|
|
type: 'person',
|
|
caption: {
|
|
'zh-CN': '修改人',
|
|
},
|
|
fieldName: 'updated_by',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: false,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293572188200961',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: false,
|
|
},
|
|
{
|
|
type: 'datetime',
|
|
caption: {
|
|
'zh-CN': '修改时间',
|
|
},
|
|
fieldName: 'updated_at',
|
|
datetimeAttribute: '',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: false,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293572146257921',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: false,
|
|
},
|
|
{
|
|
type: 'billstatus',
|
|
caption: {
|
|
'zh-CN': '状态',
|
|
},
|
|
fieldName: 'status',
|
|
billstatusAttribute: '',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: false,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293572100120577',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: true,
|
|
},
|
|
{
|
|
type: 'multilangtext',
|
|
caption: {
|
|
'zh-CN': '名称',
|
|
},
|
|
fieldName: 'name',
|
|
textAttribute: '',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: true,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293572028817410',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: true,
|
|
},
|
|
{
|
|
type: 'integer',
|
|
caption: {
|
|
'zh-CN': '编码',
|
|
},
|
|
fieldName: 'number',
|
|
numberAttribute: '',
|
|
operationControl: {
|
|
canCopy: false,
|
|
canImport: false,
|
|
canExport: false,
|
|
},
|
|
required: true,
|
|
defaultValue: null,
|
|
max: null,
|
|
maxInclusive: true,
|
|
min: null,
|
|
minInclusive: true,
|
|
dataModelFieldId: '1927293571995262978',
|
|
dataModelId: '715132059677931294',
|
|
fromTemplate: true,
|
|
editable: true,
|
|
},
|
|
];
|
|
return HttpResponse.json(
|
|
{ code: '0', data: { list, total: list.length }, message: null },
|
|
);
|
|
}),
|
|
http.get('/api/lcdp/v1/queryFieldList', async () => {
|
|
await delay(300);
|
|
const list = Array.from({ length: 20 }).map((el, index) => {
|
|
return { fieldName: `_${index}`, caption: { 'zh-CN': `_姓名_${index}` }, id: uuid(index) };
|
|
});
|
|
return HttpResponse.json(
|
|
{ code: '0', data: { list, total: list.length }, message: null },
|
|
);
|
|
}),
|
|
];
|
|
|
|
export default handlers;
|