| | |
| | | </div> |
| | | |
| | | <script> |
| | | // API配置数据 |
| | | let apiConfigs = []; |
| | | |
| | | // 动态加载API配置并渲染接口内容 |
| | | function loadApiConfigs() { |
| | | try { |
| | | // 直接定义API配置数据,避免CORS错误 |
| | | const apiConfigs = [ |
| | | apiConfigs = [ |
| | | { |
| | | "apiId": "api-task-create", |
| | | "name": "生成任务单", |
| | |
| | | "code": 200, |
| | | "message": "优先级调整成功", |
| | | "timestamp": 1671526800000 |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "apiId": "api-cv-getError", |
| | | "name": "输送线异常信息接口", |
| | | "description": "输送线异常信息接口", |
| | | "isCommon": false, |
| | | "method": "POST", |
| | | "url": "/station/getError", |
| | | "menu": { |
| | | "category": "输送线异常信息接口", |
| | | "order": 6 |
| | | }, |
| | | "request": { |
| | | "parameters": [ |
| | | { |
| | | "name": "staNo", |
| | | "type": "string", |
| | | "required": true, |
| | | "description": "站点编号", |
| | | "default": "1001" |
| | | } |
| | | ], |
| | | "example": { |
| | | "staNo": "1001" |
| | | } |
| | | }, |
| | | "response": { |
| | | "parameters": [ |
| | | { |
| | | "name": "code", |
| | | "type": "integer", |
| | | "description": "返回编号,200表示成功,1~N表示失败" |
| | | }, |
| | | { |
| | | "name": "message", |
| | | "type": "string", |
| | | "description": "返回消息,请求成功表示成功,内容为详细的错误描述" |
| | | }, |
| | | { |
| | | "name": "data", |
| | | "type": "object", |
| | | "description": "返回的数据结构" |
| | | }, |
| | | { |
| | | "name": "timestamp", |
| | | "type": "integer", |
| | | "description": "时间戳" |
| | | } |
| | | ], |
| | | "example": { |
| | | "code": 200, |
| | | "message": "请求成功", |
| | | "timestamp": 1671526800000, |
| | | "data": [ |
| | | { |
| | | "staNo": "1001", |
| | | "plcDesc": "有任务无货故障", |
| | | "error": "有任务无货故障" |
| | | }, |
| | | { |
| | | "staNo": "1001", |
| | | "plcDesc": "占位超时", |
| | | "error": "占位超时" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "apiId": "api-cv-getTaskNo", |
| | | "name": "输送线的任务号查询接口", |
| | | "description": "输送线的任务号查询接口", |
| | | "isCommon": false, |
| | | "method": "POST", |
| | | "url": "/station/getTaskNo", |
| | | "menu": { |
| | | "category": "输送线的任务号查询接口", |
| | | "order": 7 |
| | | }, |
| | | "request": { |
| | | "parameters": [ |
| | | { |
| | | "name": "staNo", |
| | | "type": "string", |
| | | "required": true, |
| | | "description": "站点编号", |
| | | "default": "1001" |
| | | } |
| | | ], |
| | | "example": { |
| | | "staNo": "1001" |
| | | } |
| | | }, |
| | | "response": { |
| | | "parameters": [ |
| | | { |
| | | "name": "code", |
| | | "type": "integer", |
| | | "description": "返回编号,200表示成功,1~N表示失败" |
| | | }, |
| | | { |
| | | "name": "message", |
| | | "type": "string", |
| | | "description": "返回消息,请求成功表示成功,内容为详细的错误描述" |
| | | }, |
| | | { |
| | | "name": "data", |
| | | "type": "object", |
| | | "description": "返回的数据结构" |
| | | }, |
| | | { |
| | | "name": "timestamp", |
| | | "type": "integer", |
| | | "description": "时间戳" |
| | | } |
| | | ], |
| | | "example": { |
| | | "code": 200, |
| | | "message": "请求成功", |
| | | "timestamp": 1671526800000, |
| | | "data": { |
| | | "taskNo": "2121swasasas" |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | if (section) { |
| | | section.scrollIntoView({ behavior: 'smooth' }); |
| | | } |
| | | } else if (event.data.type === 'getApiConfigs') { |
| | | event.source.postMessage({ |
| | | type: 'apiConfigs', |
| | | data: apiConfigs |
| | | }, '*'); |
| | | } |
| | | }); |
| | | </script> |