Files
ZERO_CODE/ZeroCodeProject/main/client/node_modules/.cache/babel-loader/50525f7e39be32aa5cd3836a639dc64de19cf8c57062a7b0aea4ae2e41eaafd4.json

1 line
11 KiB
JSON
Raw Normal View History

2026-01-11 00:11:34 +08:00
{"ast":null,"code":"import { ZeroCodeAxios } from \"@/request/request.js\";\nimport WebSocketClient from '@/utils/websocket';\nconst components = {};\nconst data = function () {\n return {\n api_data: [],\n api_info: {},\n messageList: {},\n loading: true\n };\n};\nasync function mounted() {\n await this.fetch_data();\n await this.create_ws();\n}\nconst methods = {\n create_ws() {\n // this.ws = new WebSocketClient('ws://47.116.15.186:8308/ws/file-monitor/'); // 后端提供 websocket 地址或者自己搭建 websocket 服务器\n this.ws = new WebSocketClient('ws://localhost:8308/ws/file-monitor/'); // 后端提供 websocket 地址或者自己搭建 websocket 服务器\n // 注册消息类型回调函数\n this.ws.registerCallback('message', data => {\n // 存放消息列表\n this.messageList = data;\n });\n },\n async fetch_data() {\n await ZeroCodeAxios({\n method: \"POST\",\n url: \":10004/ApiClass/base_api_control/api_url/\",\n data: {\n submit_data: {\n data: {\n model_name: \"api_table\",\n relations: [],\n return_type: \"True\",\n filter_context: {}\n }\n }\n }\n }).then(res => {\n this.api_data = res.data.return_data.data.data.table_data;\n this.loading = false;\n });\n },\n check_info(row) {\n this.api_info = row;\n this.sendMsg(row.api_name);\n },\n start_api(row) {\n ZeroCodeAxios({\n method: \"POST\",\n url: \":10099/ApiClass/base_api_control/api_url/\",\n data: {\n submit_data: {\n data: row\n }\n }\n }).then(res => {\n if (res.data.return_data.data.status === 200) {\n this.$notify({\n title: '启动成功',\n message: res\n });\n this.loading = true;\n this.fetch_data();\n } else {\n this.$notify({\n title: '启动失败',\n message: res\n });\n }\n }).catch(error => {\n this.$notify({\n title: '启动失败',\n message: error\n });\n });\n },\n stop_api(row) {\n ZeroCodeAxios({\n method: \"POST\",\n url: \":10100/ApiClass/base_api_control/api_url/\",\n data: {\n submit_data: {\n data: row\n }\n }\n }).then(res => {\n if (res.data.return_data.data.status === 200) {\n this.$notify({\n title: '停止成功',\n message: res\n });\n this.loading = true;\n this.fetch_data();\n } else {\n this.$notify({\n title: '停止失败',\n message: res\n });\n }\n }).catch(error => {\n this.$notify({\n title: '停止失败',\n message: error\n });\n });\n },\n restart_api(row) {},\n update_api(row) {},\n // 发送消息\n sendMsg(data) {\n this.ws.send(data);\n },\n // 断开连接并销毁实例\n disconnect() {\n this.ws.close();\n this.ws = null;\n }\n};\nexport default {\n data: data,\n methods: methods,\n mounted: mounted,\n components: components\n};","map":{"version":3,"names":["ZeroCodeAxios","WebSocketClient","components","data","api_data","api_info","messageList","loading","mounted","fetch_data","create_ws","methods","ws","registerCallback","method","url","submit_data","model_name","relations","return_type","filter_context","then","res","return_data","table_data","check_info","row","sendMsg","api_name","start_api","status","$notify","title","message","catch","error","stop_api","restart_api","update_api","send","disconnect","close"],"sources":["/Users/xubincheng/Desktop/job/零代码/zero_project/Project1/main/client/src/components/data_manage/api_project_management/api_project_management.js"],"sourcesContent":["import {ZeroCodeAxios} from \"@/request/request.js\"\r\nimport WebSocketClient from '@/utils/websocket';\r\n\r\nconst components = {}\r\n\r\nconst data = function () {\r\n return {\r\n api_data: [],\r\n api_info: {},\r\n messageList: {},\r\n loa