更新swagger
This commit is contained in:
@@ -22,9 +22,24 @@
|
|||||||
"summary": "获取设备列表",
|
"summary": "获取设备列表",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "业务失败,具体错误码和信息见响应体",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/controller.Response"
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,9 +69,21 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "业务失败,具体错误码和信息见响应体",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/controller.Response"
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,9 +110,21 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "业务失败,具体错误码和信息见响应体",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/controller.Response"
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,9 +161,21 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "业务失败,具体错误码和信息见响应体",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/controller.Response"
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +200,7 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "业务失败,具体错误码和信息见响应体",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/controller.Response"
|
"$ref": "#/definitions/controller.Response"
|
||||||
}
|
}
|
||||||
@@ -452,7 +503,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"device.CreateDeviceRequest": {
|
"device.CreateDeviceRequest": {
|
||||||
"type": "object"
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"parent_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"$ref": "#/definitions/controller.Properties"
|
||||||
|
},
|
||||||
|
"sub_type": {
|
||||||
|
"$ref": "#/definitions/models.DeviceSubType"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"$ref": "#/definitions/models.DeviceType"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"device.UpdateDeviceRequest": {
|
"device.UpdateDeviceRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default {
|
|||||||
...device,
|
...device,
|
||||||
// 格式化数据显示
|
// 格式化数据显示
|
||||||
type: this.formatDeviceType(device.type),
|
type: this.formatDeviceType(device.type),
|
||||||
lastUpdate: device.lastUpdate || '-'
|
lastUpdate: device.updated_at || '-'
|
||||||
}));
|
}));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.error = err.message || '未知错误';
|
this.error = err.message || '未知错误';
|
||||||
|
|||||||
@@ -30,9 +30,24 @@ class DeviceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备详情
|
||||||
|
* @param {number} deviceId 设备ID
|
||||||
|
* @returns {Promise<Object>} 设备详情
|
||||||
|
*/
|
||||||
|
async getDevice(deviceId) {
|
||||||
|
try {
|
||||||
|
const response = await apiClient.devices.get(deviceId);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取设备详情失败:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新设备信息
|
* 更新设备信息
|
||||||
* @param {string} deviceId 设备ID
|
* @param {number} deviceId 设备ID
|
||||||
* @param {Object} device 更新的设备信息
|
* @param {Object} device 更新的设备信息
|
||||||
* @returns {Promise<Object>} 更新后的设备信息
|
* @returns {Promise<Object>} 更新后的设备信息
|
||||||
*/
|
*/
|
||||||
@@ -48,7 +63,7 @@ class DeviceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备
|
* 删除设备
|
||||||
* @param {string} deviceId 设备ID
|
* @param {number} deviceId 设备ID
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async deleteDevice(deviceId) {
|
async deleteDevice(deviceId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user