diff --git a/PVDEMCSUI/src/Utils/helper.ts b/PVDEMCSUI/src/Utils/helper.ts index e3bab19..3971970 100644 --- a/PVDEMCSUI/src/Utils/helper.ts +++ b/PVDEMCSUI/src/Utils/helper.ts @@ -433,4 +433,21 @@ export default class helper { } return textStatus; }; + + static params = (obj: any) => { + let result = ''; + let item; + for (item in obj) { + if ( + (obj[item] && String(obj[item])) || + (item == 'activated' && obj[item] != undefined) + ) { + result += `&${item}=${obj[item]}`; + } + } + if (result) { + result = '?' + result.slice(1); + } + return result; + }; } diff --git a/PVDEMCSUI/src/api/device/deviceApi.ts b/PVDEMCSUI/src/api/device/deviceApi.ts new file mode 100644 index 0000000..68b2102 --- /dev/null +++ b/PVDEMCSUI/src/api/device/deviceApi.ts @@ -0,0 +1,112 @@ +import helper from 'src/Utils/helper'; +import { request } from '../../boot/axios'; +import { Pagination } from '../class'; +import { + DeivceSearchEntity, + DeivceEntity, + DeivcePointSearchEntity, + DeivcePointEntity +} from './model/deivce'; +const pathName = 'Device/'; + +class DeviceApi { + // PLC控制器 分页 + getDevicePageList = (val: Pagination) => { + let format = `?page=${val.page}&size=${val.rowsPerPage}`; + if (val.data.deviceCode) { + format += `&deviceCode=${val.data.deviceCode}`; + } + if (val.data.deviceName) { + format += `&deviceName=${val.data.deviceName}`; + } + if (val.data.activated != undefined && val.data.activated != null) { + format += `&activated=${val.data.activated}`; + } + return request.get(`${pathName}GetDevicePageList${format}`); + }; + + // 添加PLC控制器 + addDevice = (val: DeivceEntity) => { + return request.post(`${pathName}AddDevice`, val); + }; + // 修改PLC控制器 + updateDevice = (val: DeivceEntity) => { + return request.post(`${pathName}UpdateDevice`, val); + }; + // 删除PLC控制器 + deleteDevice = (val: any) => { + return request.post(`${pathName}DeleteDevice?id=${val}`); + }; + + // 获取PLC控制器列表 + getDeviceInfoList = (val: DeivceSearchEntity) => { + const format = helper.params(val); + return request.get(`${pathName}GetDeviceInfoList${format}`); + }; + + // 获取PLC控制器明细 + getDeviceDetail = (val: any) => { + return request.get(`${pathName}GetDeviceDetail?id=${val}`); + }; + + // PLC控制器点位 分页 + getDevicePointPageList = (val: Pagination) => { + let format = `?page=${val.page}&size=${val.rowsPerPage}`; + if (val.data.deviceId) { + format += `&deviceId=${val.data.deviceId}`; + } + if (val.data.deviceCode) { + format += `&deviceCode=${val.data.deviceCode}`; + } + if (val.data.deviceName) { + format += `&deviceName=${val.data.deviceName}`; + } + if (val.data.equipmentName) { + format += `&equipmentName=${val.data.equipmentName}`; + } + if (val.data.equipmentCode) { + format += `&equipmentCode=${val.data.equipmentCode}`; + } + if (val.data.equipmentType) { + format += `&equipmentType=${val.data.equipmentType}`; + } + if (val.data.pointCode) { + format += `&pointCode=${val.data.pointCode}`; + } + if (val.data.pointName) { + format += `&pointName=${val.data.pointName}`; + } + if (val.data.activated != undefined && val.data.activated != null) { + format += `&activated=${val.data.activated}`; + } + return request.get(`${pathName}GetDevicePointPageList${format}`); + }; + + // 获取PLC控制器点位列表 + getDevicePointList = (val: DeivcePointSearchEntity) => { + debugger; + const format = helper.params(val); + return request.get(`${pathName}GetDevicePointList${format}`); + }; + + // 获取PLC控制器点位明细 + getDevicePointDetail = (val: any) => { + return request.get(`${pathName}GetDevicePointDetail?id=${val}`); + }; + + // 添加PLC控制器点位 + addDevicePoint = (val: DeivcePointEntity) => { + return request.post(`${pathName}AddDevicePoint`, val); + }; + // 修改PLC控制器点位 + updateDevicePoint = (val: DeivcePointEntity) => { + return request.post(`${pathName}UpdateDevicePoint`, val); + }; + // 删除PLC控制器点位 + deleteDevicePoint = (val: any) => { + return request.post(`${pathName}DeleteDevicePoint?id=${val}`); + }; +} +const deviceApi = new DeviceApi(); + +export { deviceApi }; diff --git a/PVDEMCSUI/src/api/device/model/device.ts b/PVDEMCSUI/src/api/device/model/device.ts new file mode 100644 index 0000000..7a9104f --- /dev/null +++ b/PVDEMCSUI/src/api/device/model/device.ts @@ -0,0 +1,52 @@ +// PLC控制器 +export class DeivceSearchEntity { + deviceCode!: string; + deviceName!: string; + activated!: boolean; +} + +// PLC控制器 +export class DeivceEntity { + id!: string; + deviceCode!: string; // 控制器编号 + deviceName!: string; // 控制器名称 + activated!: boolean; // 控制器状态,1:启用,0:停用 + protocol!: string; // 控制器协议:PLC,HTTP,Socket + host!: string; // 控制器主机地址 + port!: number; // 控制器主机端口 + remark!: string; // 备注 + isConnected!: boolean; // 设备连接状态 +} + +// PLC控制器点位 +export class DeivcePointSearchEntity { + deviceId!: string; + deviceCode!: string; + deviceName!: string; + equipmentName!: string; + equipmentCode!: string; + equipmentType!: string; + pointCode!: string; + pointName!: string; + activated!: boolean; +} + +// PLC控制器点位 +export class DeivcePointEntity { + id!: string; + deviceId!: string; + deviceCode!: string; + deviceName!: string; + equipmentId!: string; + equipmentCode!: string; + equipmentName!: string; + equipmentType!: string; + actionType!: string; + pointCode!: string; + pointName!: string; + address!: string; + dataType!: string; + activated!: boolean; + remark!: string; + objectValue!: string; +} diff --git a/PVDEMCSUI/src/api/equipment/equipmentApi.ts b/PVDEMCSUI/src/api/equipment/equipmentApi.ts index 2c47db7..d2fe3f7 100644 --- a/PVDEMCSUI/src/api/equipment/equipmentApi.ts +++ b/PVDEMCSUI/src/api/equipment/equipmentApi.ts @@ -1,3 +1,4 @@ +import helper from 'src/Utils/helper'; import { request } from '../../boot/axios'; import { Pagination } from '../class'; import { EquipmentSearchEntity, EquipmentEntity } from './model/equipment'; @@ -16,11 +17,24 @@ class EquipmentApi { if (val.data.equipmentType) { format += `&equipmentType=${val.data.equipmentType}`; } - if (val.data.activated) { + if (val.data.activated != undefined && val.data.activated != null) { format += `&activated=${val.data.activated}`; } return request.get(`${pathName}GetEquipmentPageList${format}`); }; + + // 获取设备列表 + getEquipmentList = (val: EquipmentSearchEntity) => { + debugger; + const format = helper.params(val); + return request.get(`${pathName}GetEquipmentList${format}`); + }; + + // 获取设备明细 + getEquipmentDetail = (val: any) => { + return request.get(`${pathName}GetEquipmentDetail?id=${val}`); + }; + // 添加 add = (val: EquipmentEntity) => { return request.post(`${pathName}AddEquipment`, val); diff --git a/PVDEMCSUI/src/layouts/MainScreenLayout.vue b/PVDEMCSUI/src/layouts/MainScreenLayout.vue index 233564f..7acde8f 100644 --- a/PVDEMCSUI/src/layouts/MainScreenLayout.vue +++ b/PVDEMCSUI/src/layouts/MainScreenLayout.vue @@ -78,10 +78,10 @@
Hi! {{ user.userName }}
- + 设备管理 + content-style="font-size: 12px">PLC控制器管理 diff --git a/PVDEMCSUI/src/pages/device/components/addOrEditDevicePointDialog.vue b/PVDEMCSUI/src/pages/device/components/addOrEditDevicePointDialog.vue new file mode 100644 index 0000000..34f7787 --- /dev/null +++ b/PVDEMCSUI/src/pages/device/components/addOrEditDevicePointDialog.vue @@ -0,0 +1,147 @@ + + \ No newline at end of file diff --git a/PVDEMCSUI/src/pages/device/components/addOrEditDialog.vue b/PVDEMCSUI/src/pages/device/components/addOrEditDialog.vue new file mode 100644 index 0000000..94ca7d9 --- /dev/null +++ b/PVDEMCSUI/src/pages/device/components/addOrEditDialog.vue @@ -0,0 +1,120 @@ + + \ No newline at end of file diff --git a/PVDEMCSUI/src/pages/device/components/devicePointDialog.vue b/PVDEMCSUI/src/pages/device/components/devicePointDialog.vue new file mode 100644 index 0000000..3e655cd --- /dev/null +++ b/PVDEMCSUI/src/pages/device/components/devicePointDialog.vue @@ -0,0 +1,262 @@ + + + + \ No newline at end of file diff --git a/PVDEMCSUI/src/pages/device/components/equipmentDialog.vue b/PVDEMCSUI/src/pages/device/components/equipmentDialog.vue new file mode 100644 index 0000000..212dacb --- /dev/null +++ b/PVDEMCSUI/src/pages/device/components/equipmentDialog.vue @@ -0,0 +1,205 @@ + + + \ No newline at end of file diff --git a/PVDEMCSUI/src/pages/device/index.vue b/PVDEMCSUI/src/pages/device/index.vue new file mode 100644 index 0000000..4d99898 --- /dev/null +++ b/PVDEMCSUI/src/pages/device/index.vue @@ -0,0 +1,209 @@ + + + + \ No newline at end of file diff --git a/PVDEMCSUI/src/pages/screen/screenTab.vue b/PVDEMCSUI/src/pages/screen/screenTab.vue index f39e7c4..57655a5 100644 --- a/PVDEMCSUI/src/pages/screen/screenTab.vue +++ b/PVDEMCSUI/src/pages/screen/screenTab.vue @@ -1,4 +1,4 @@ -