From ea463e94c12fb068f4a2bbcb6d364e3a5ecf955b Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 17 五月 2024 10:41:57 +0800 Subject: [PATCH] ch 编译问题 --- src/api/monitor/real.ts | 85 src/api/assets/equipment.ts | 12 src/api/monitor/dataDilute.ts | 66 src/api/monitor/monthStd.ts | 11 src/api/monitor/monitorFormula.ts | 121 + src/api/assets/equipmentDirectory.ts | 67 src/api/assets/equipmentGroupStd.ts | 30 src/api/assets/equipmentManage.ts | 136 + src/api/assets/equipmentStd.ts | 181 + src/api/assets/equip/equipPhartMapping.ts | 75 src/api/assets/supplierStd.ts | 27 src/projectCom/basic/sys/alarm/level/AlarmLevelCom.vue | 234 ++ src/api/monitor/yearStd.ts | 11 src/api/assets/equip/equipPhartMappingEx.ts | 106 src/projectCom/basic/type/TypeManageCom.vue | 531 ++++ src/api/monitor/list.ts | 96 src/api/monitor/monitorOrg.ts | 11 src/projectCom/basic/types.ts | 149 + src/projectCom/basic/unit/utils.ts | 19 src/api/monitor/signalAlarm.ts | 66 src/api/point/monitor/monitor_point.ts | 336 +++ src/api/monitor/monitorlAlarm.ts | 44 src/api/assets/assetsOrg.ts | 29 src/api/monitor/monitorPointTemplateExtensions.ts | 13 src/api/monitor/vibration.ts | 85 src/projectCom/basic/constants.ts | 0 src/api/assets/assetsEuipLogic.ts | 30 src/api/monitor/monitorPointTemplateStd.ts | 29 src/api/monitor/signalStd.ts | 86 src/api/monitor/dataProcess.ts | 66 src/api/monitor/inputOnline.ts | 21 src/api/monitor/interrupt/monitorInterruptAlarm.ts | 78 src/api/run/real/record/runRealRecordStd.ts | 35 src/api/monitor/hourStd.ts | 11 src/api/run/analyse/runAnalyseConfig.ts | 90 src/api/assets/equipmentGroupManage.ts | 83 src/api/point/monitorTemplate/poinTemplate.ts | 85 src/projectCom/basic/flag/FlagManageCom.vue | 319 ++ src/api/run/runRealRecord.ts | 58 src/projectCom/basic/catalog/CatalogManageCom.vue | 802 +++++++ src/api/monitor/monitorRecord.ts | 57 src/api/monitor/dataDocking/configure/dataDockingConfigure.ts | 87 src/api/monitor/dataTransfer.ts | 66 src/api/monitor/day.ts | 11 src/api/monitor/dataDocking/configure/item/extensions/configItemExtensions.ts | 12 src/projectCom/basic/sys/paras/SysParasCom.vue | 646 +++++ src/api/monitor/signal/signalStd.ts | 29 src/api/run/real/record/runRealRecord.ts | 13 src/projectCom/basic/prop/PropManageCom.vue | 872 ++++++++ src/api/point/monitor/monitorPointStd.ts | 39 src/api/monitor/rangeHistory.ts | 22 src/api/monitor/dataDocking/interrupt/dataDockingInterrupt.ts | 78 src/api/monitor/monitorPointExtensions.ts | 45 src/api/assets/equipmentDirectoryContent.ts | 22 src/projectCom/basic/sys/alarm/types.ts | 11 src/api/monitor/dayStd.ts | 11 src/api/assets/supplierManage.ts | 77 src/api/point/signalTemplate/signal.ts | 79 58 files changed, 6,511 insertions(+), 0 deletions(-) diff --git a/src/api/assets/assetsEuipLogic.ts b/src/api/assets/assetsEuipLogic.ts new file mode 100644 index 0000000..9a7c317 --- /dev/null +++ b/src/api/assets/assetsEuipLogic.ts @@ -0,0 +1,30 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇璁惧鎶ュ憡 + */ +export const GetRunReportRelatedUrl = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Logic/GetRunReportRelatedUrl@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 鑾峰彇璁惧鎶ュ憡 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getRunReportRelatedUrl = async (params, req: any = request) => { + const res = await GetRunReportRelatedUrl(params, req); + + if (res?.Code === 0) { + const resData = res.Data as any; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧鎶ュ憡澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return null; + } +}; diff --git a/src/api/assets/assetsOrg.ts b/src/api/assets/assetsOrg.ts new file mode 100644 index 0000000..36b84fc --- /dev/null +++ b/src/api/assets/assetsOrg.ts @@ -0,0 +1,29 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇璁惧鎴栨车绔欙紙宸ヨ壓鍥惧叧鑱旓級 + */ +export const GetAssetsOrgFullLogicalTreeListStd = async (req: any = request) => { + return req({ + url: '/Assets/Org/Logic/GetFullLogicalTreeList@V1.0', + method: 'GET', + }); +}; + +/** + * 鑾峰彇璁惧鎴栨车绔欙紙宸ヨ壓鍥惧叧鑱旓級 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getAssetsOrgFullLogicalTreeListStd = async (req: any = request) => { + const res = await GetAssetsOrgFullLogicalTreeListStd(req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as any[]; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧鐩綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; diff --git a/src/api/assets/equip/equipPhartMapping.ts b/src/api/assets/equip/equipPhartMapping.ts new file mode 100644 index 0000000..671c736 --- /dev/null +++ b/src/api/assets/equip/equipPhartMapping.ts @@ -0,0 +1,75 @@ +import request from '/@/utils/request'; + +/** + * @summary GetAssetsEquipmentPhartMappingByEquipmentID + */ +export const GetAssetsEquipmentPhartMappingByEquipmentID = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/GetByEquipmentID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 鑾峰彇鎵�鏈夎澶囧浘琛ㄦ槧灏� + */ +export const GetAllAssetsEquipmentPhartMapping = async (req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/GetAll@V1.0', + method: 'get', + }); +}; + +/** + * @summary 娣诲姞涓�涓澶囧浘琛ㄦ槧灏� + */ +export const InsertAAssetsEquipmentPhartMapping = async (data, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓澶囧浘琛ㄦ槧灏� + */ +export const UpdateAAssetsEquipmentPhartMapping = async (data, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼璁惧鍥捐〃鏄犲皠鎺掑簭鐮� + */ +export const UpdateAssetsEquipmentPhartMappingSorter = async (data, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓澶囧浘琛ㄦ槧灏� + */ +export const DeleteAAssetsEquipmentPhartMapping = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; + +export type EquipmentPhartMapping = { + ID: string; + EquipmentID: string; + DiagramID: string; + OtherName: string; + Importance: number; + SortCode: number; +}; diff --git a/src/api/assets/equip/equipPhartMappingEx.ts b/src/api/assets/equip/equipPhartMappingEx.ts new file mode 100644 index 0000000..b9ea1f9 --- /dev/null +++ b/src/api/assets/equip/equipPhartMappingEx.ts @@ -0,0 +1,106 @@ +import type { AxiosInstance } from 'axios'; +import type { FeatType } from '/@/projectCom/assets/equipment/pchart/types'; +import request from '/@/utils/request'; + +/** + * @summary GetAssetsEquipmentPhartMappingExtensionsByEquipmentID + */ +export const GetAssetsEquipmentPhartMappingExtensionsByEquipmentID = (params, req: AxiosInstance = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/Extensions/GetByEquipmentID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 娣诲姞涓�涓澶囧浘琛ㄦ槧灏�(extensions) + */ +export const InsertAAssetsEquipmentPhartMappingExtensions = async (data, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/Extensions/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓澶囧浘琛ㄦ槧灏�(extensions) + */ +export const UpdateAAssetsEquipmentPhartMappingExtensions = async (data, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/Extensions/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓澶囧浘琛ㄦ槧灏�(extensions) + */ +export const DeleteAAssetsEquipmentPhartMappingExtensions = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Phart/Mapping/Extensions/DeleteByDiagramID@V1.0', + method: 'delete', + params, + }); +}; + +export interface ChartGraph { + ID: string; + DiagramID: string; + Name: string; + GraphType: number; + GraphParas: { + Hz: number; + N: number; + }; + GraphInfo: string; + GeometryStyle: number; + GeometryParas: { + FeatType: FeatType; + }; + GeometryInfo: string; + DispParas: string; + ExtraParas: string; + Paras?: Record<string, unknown>; + Flags: Record<string, unknown>[]; + SortCode: number; + Description: string; +} +export type ChartGraphInsert = Omit<PhartDiagram, 'ID' | 'SortCode'>; + +export interface PhartDiagram { + ID: string; + Name: string; + NO: string; + DiagramType: number; + DiagramParas: string; + DiagramInfo: string; + DispParas: string; + ExtraParas: string; + Paras?: Record<string, unknown>; + Flags: Record<string, unknown>[]; + TagName: string; + SortCode: number; + Description: string; + GraphList: ChartGraph[]; +} + +export type PhartDiagramInsert = Omit<PhartDiagram, 'ID' | 'SortCode'> & { + GraphList: ChartGraphInsert[]; +}; + +export type EquipPhartMapping = { + ID: string; + EquipmentID: string; + DiagramID: string; + OtherName: string; + Importance: number; + SortCode: number; + Diagram: PhartDiagram; +}; + +export type EquipPhartMappingInsert = Omit<EquipPhartMapping, 'ID' | 'SortCode'> & { + Diagram: PhartDiagramInsert; +}; diff --git a/src/api/assets/equipment.ts b/src/api/assets/equipment.ts new file mode 100644 index 0000000..4ece190 --- /dev/null +++ b/src/api/assets/equipment.ts @@ -0,0 +1,12 @@ +import request from '/@/utils/request'; + +/** + * @summary 閫氳繃ID鑾峰彇璁惧 + */ +export const GetEquipmentByID = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/GetByID@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/assets/equipmentDirectory.ts b/src/api/assets/equipmentDirectory.ts new file mode 100644 index 0000000..a7e6c20 --- /dev/null +++ b/src/api/assets/equipmentDirectory.ts @@ -0,0 +1,67 @@ +import request from '/@/utils/request'; + +/** + * @summary 閫氳繃娉电珯 ID, 鑾峰彇鎵�鏈夎澶囩洰褰� + */ +export const GetAllEquipmentDirectoryByID = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/GetByBelongTypeAndBelongID@V1.0', + method: 'GET', + data: params, + }); +}; + +/** + * @summary 娣诲姞涓�涓澶囩洰褰� + */ +export const InsertAEquipmentDirectory = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 淇敼涓�涓澶囩洰褰曡褰� + */ +export const UpdateAEquipmentDirectory = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鍒犻櫎涓�鏉¤澶囩洰褰曡褰� + */ +export const DeleteAEquipmentDirectory = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +/** + * @summary 淇敼璁惧鐩綍琛ㄦ牸鎺掑簭鐮� + */ +export const UpdateEquipmentDirectorySorter = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 妫�鏌ユ槸鍚﹀凡瀛樺湪缂栫爜 + */ +export const GetIsExistEquipmentDirectoryTagName = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/assets/equipmentDirectoryContent.ts b/src/api/assets/equipmentDirectoryContent.ts new file mode 100644 index 0000000..f832f09 --- /dev/null +++ b/src/api/assets/equipmentDirectoryContent.ts @@ -0,0 +1,22 @@ +import request from '/@/utils/request'; +/** + * @summary 閫氳繃鐩綍 ID锛岃幏鍙栫洰褰曞唴瀹� + */ +export const GetContentByDirectoryID = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/Content/GetByDirectoryID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 淇濆瓨璁剧疆鐨勭洰褰曞唴瀹� + */ +export const SaveDirectoryContent = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Directory/Content/Save@V1.0', + method: 'POST', + data: params, + }); +}; diff --git a/src/api/assets/equipmentGroupManage.ts b/src/api/assets/equipmentGroupManage.ts new file mode 100644 index 0000000..52c3a42 --- /dev/null +++ b/src/api/assets/equipmentGroupManage.ts @@ -0,0 +1,83 @@ +import request from '/@/utils/request'; + +//#region ====================== 璁惧缁勬帴鍙� ====================== +/** + * @summary 鑾峰彇鎵�鏈夎澶囩粍 + */ +export const GetAllEquipmentGroup = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/GetByBelongTypeAndBelongID@V1.0', + method: 'GET', + data: params, + }); +}; + +/** + * @summary 娣诲姞涓�涓澶囩粍 + */ +export const InsertAEquipmentGroup = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 淇敼涓�涓澶囩粍璁板綍 + */ +export const UpdateAEquipmentGroup = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鍒犻櫎涓�鏉¤澶囩粍璁板綍 + */ +export const DeleteAEquipmentGroup = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +/** + * @summary 淇敼璁惧缁勮〃鏍兼帓搴忕爜 + */ +export const UpdateEquipmentGroupSorter = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + + +/** + * @summary 鏇存柊鏍戞帓搴忕爜锛堟洿鏀圭埗绾э級 + */ +export const UpdateEquipmentGroupTreeSortCode = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/UpdateTreeSortCode@V1.0', + method: 'PUT', + data: params, + }); +}; + + + +/** + * @summary 妫�鏌ユ槸鍚﹀凡瀛樺湪鏍囪 + */ +export const GetIsExistEquipmentGroupTagName = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; +//#endregion diff --git a/src/api/assets/equipmentGroupStd.ts b/src/api/assets/equipmentGroupStd.ts new file mode 100644 index 0000000..fb3b9bb --- /dev/null +++ b/src/api/assets/equipmentGroupStd.ts @@ -0,0 +1,30 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇璁惧缁勬爲缁撴瀯鏁版嵁 + */ +export const GetEquipmentGroupTreeDataStd = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Group/Std/GetTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炶澶囩粍鏍戠粨鏋勬暟鎹� + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getEquipmentGroupTreeDataStd = async (params, req: any = request) => { + const res = await GetEquipmentGroupTreeDataStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; diff --git a/src/api/assets/equipmentManage.ts b/src/api/assets/equipmentManage.ts new file mode 100644 index 0000000..f5c1e1f --- /dev/null +++ b/src/api/assets/equipmentManage.ts @@ -0,0 +1,136 @@ +import request from '/@/utils/request'; + +//#region ====================== 璁惧鎺ュ彛 ====================== +/** + * @summary 鑾峰彇鎵�鏈夎澶� + */ +export const GetAllEquipment = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Extensions/GetByGroupID@V1.0', + method: 'GET', + data: params, + }); +}; + +/** + * @summary 娣诲姞涓�涓澶� + */ +export const InsertAEquipment = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Extensions/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 淇敼涓�涓澶囪褰� + */ +export const UpdateAEquipment = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Extensions/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鍒犻櫎涓�鏉¤澶囪褰� + */ +export const DeleteAEquipment = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Extensions/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +/** + * @summary 淇敼璁惧琛ㄦ牸鎺掑簭鐮� + */ +export const UpdateEquipmentSorter = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鏇存柊鏍戞帓搴忕爜锛堟洿鏀圭埗绾э級 + */ +export const UpdateEquipmentTreeSortCode = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/UpdateTreeSortCode@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 妫�鏌ユ槸鍚﹀凡瀛樺湪鏍囪 + */ +export const GetIsExistEquipmentTagName = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏇存柊璁惧浣跨敤鐘舵�� + */ +export const UpdateEquipmentUseStatus = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 閫氳繃 catalogID 鑾峰彇灞炴�� + */ +export const GetPropertyByCatalogID = async (params, req: any = request) => { + return req({ + url: '/Basic/Sys/Prop/Struct/GetByCatalogID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 閫氳繃鐖剁骇鍒嗙被 ID锛岃幏鍙栧綋鍓嶅彲閫夊垎绫伙紙鍓旈櫎鎺変笅灞傚垎绫伙級 + */ +export const GetAuthorityCatalogByCatalogID = async (params, req: any = request) => { + return req({ + url: '/Basic/Sys/Catalog/Authority/GetByParentID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 閫氳繃 equipmentID 鑾峰彇鏄犲皠娴嬬偣 + */ +export const GetMonitorPointByEquipmentID = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Monitor/Mapping/GetByEquipmentID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 璁剧疆璁惧鏄犲皠鐨勬祴鐐� + */ +export const SetEquipmentMapMonitorPoint = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Monitor/Mapping/Set@V1.0', + method: 'POST', + data: params, + }); +}; + +//#endregion diff --git a/src/api/assets/equipmentStd.ts b/src/api/assets/equipmentStd.ts new file mode 100644 index 0000000..f21d8da --- /dev/null +++ b/src/api/assets/equipmentStd.ts @@ -0,0 +1,181 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇鏈虹粍 + */ +export const GetByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Assets/EnginePump/Logic/GetByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * @summary 鑾峰彇Catalog 杩囨护鑾峰彇鏈虹粍 + */ +export const GetCatalogTreeListByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Std/GetCatalogTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; +/** + * @summary 鑾峰彇璁惧鏍戠粨鏋勬暟鎹� + */ +export const GetEquipmentTreeDataStd = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Std/GetTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炶澶囨爲缁撴瀯鏁版嵁 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getEquipmentTreeDataStd = async (params, req: any = request) => { + const res = await GetEquipmentTreeDataStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇鎵�鏈夎澶囷紙闈炴爲缁撴瀯锛� + */ +export const GetEquipmentListStd = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Std/GetTreeItemListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炴墍鏈夎澶囷紙闈炴爲缁撴瀯锛� + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getEquipmentListStd = async (params, req: any = request) => { + const res = await GetEquipmentListStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇鎵�鏈夎澶囧け璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇璁惧鏍戯紝閫氳繃 GroupID + */ +export const GetEquipmentTreeDataByGroupIDStd = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Std/GetTreeListByGroupID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炶澶囨爲锛岄�氳繃 GroupID + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getEquipmentTreeDataByGroupIDStd = async (params, req: any = request) => { + const res = await GetEquipmentTreeDataByGroupIDStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧鏍戝け璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇璁惧 + */ +export const GetMainTreeListByBelongTypeAndBelongIDStd = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Std/GetMainTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炶澶囷紙杩囨护鎺� CatalogID 涓� '0'锛夌殑鎯呭喌 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getMainTreeListByBelongTypeAndBelongIDStd = async (params, req: any = request) => { + const res = await GetMainTreeListByBelongTypeAndBelongIDStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 閫氳繃belongType锛宐elongID 鍜� 鍒嗙被缂栫爜鑾峰彇璁惧 + */ +export const GetCatalogTreeItemListByBelongTypeAndBelongIDStd = async (params, req: any = request) => { + return req({ + url: '/Assets/Equipment/Std/GetCatalogListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岄�氳繃belongType锛宐elongID 鍜� 鍒嗙被缂栫爜鑾峰彇璁惧 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getCatalogTreeItemListByBelongTypeAndBelongIDStd = async (params, req: any = request) => { + const res = await GetCatalogTreeItemListByBelongTypeAndBelongIDStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇璁惧澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +export interface MainEquipTree { + ID: string; + ParentID: string; + GroupID: string; + Name: string; + NO: string; + CatalogID: string; + ModelType: string; + Specification: string; + SupplierID: string; + Paras?: Record<string, unknown>; + Flags: string[]; + TagName: string; + SortCode: number; + Description: string; + Children: MainEquipTree[]; +} diff --git a/src/api/assets/supplierManage.ts b/src/api/assets/supplierManage.ts new file mode 100644 index 0000000..1b9f8f1 --- /dev/null +++ b/src/api/assets/supplierManage.ts @@ -0,0 +1,77 @@ +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇鎵�鏈夊巶鍟� + */ +export const GetAllSupplier = async (req: any = request) => { + return req({ + url: '/Assets/Supplier/GetAll@V1.0', + method: 'GET', + }); +}; + +/** + * @summary 娣诲姞涓�涓巶鍟� + */ +export const InsertASupplier = async (params, req: any = request) => { + return req({ + url: '/Assets/Supplier/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 淇敼涓�涓巶鍟嗚褰� + */ +export const UpdateASupplier = async (params, req: any = request) => { + return req({ + url: '/Assets/Supplier/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鍒犻櫎涓�鏉″巶鍟嗚褰� + */ +export const DeleteASupplier = async (params, req: any = request) => { + return req({ + url: '/Assets/Supplier/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +/** + * @summary 淇敼鍘傚晢琛ㄦ牸鎺掑簭鐮� + */ +export const UpdateSupplierSorter = async (params, req: any = request) => { + return req({ + url: '/Assets/Supplier/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 妫�鏌ユ槸鍚﹀凡瀛樺湪鏍囩鍚嶇О + */ +export const GetIsExistTagName = async (params, req: any = request) => { + return req({ + url: '/Assets/Supplier/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏇存柊鍘傚晢鐨勪娇鐢ㄧ姸鎬� + */ +export const UpdateSupplierUseStatus = async (params, req: any = request) => { + return req({ + url: '/Assets/Supplier/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +}; diff --git a/src/api/assets/supplierStd.ts b/src/api/assets/supplierStd.ts new file mode 100644 index 0000000..23c9769 --- /dev/null +++ b/src/api/assets/supplierStd.ts @@ -0,0 +1,27 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇鍘傚晢閫夋嫨鍒楄〃 + */ +export const GetSupplierSelectListStd = async (req: any = request) => { + return req({ + url: '/Assets/Supplier/Std/GetSelectList@V1.0', + method: 'GET', + }); +}; + +/** + * 杩斿洖鍘傚晢鍒楄〃 + * @returns + */ +export const getSupplierSelectList = async (req: any = request) => { + const res = await GetSupplierSelectListStd(req); + + if (res?.Code === 0) { + return res.Data || []; + } else { + ElMessage.error('鑾峰彇鍘傚晢鍒楄〃澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; diff --git a/src/api/monitor/dataDilute.ts b/src/api/monitor/dataDilute.ts new file mode 100644 index 0000000..de3f7b9 --- /dev/null +++ b/src/api/monitor/dataDilute.ts @@ -0,0 +1,66 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇鎵�鏈夌洃娴嬬█閲婃搷浣� + */ +export const GetAllMonitorDiluteOpsLevel = async (req: any = request) => { + return req({ + url: '/Monitor/Dilute/Ops/GetAll@V1.0', + method: 'get', + }); +}; + +/** + * @summary 娣诲姞涓�涓洃娴嬬█閲婃搷浣� + */ +export const InsertAMonitorDiluteOpsLevel = async (data, req: any = request) => { + return req({ + url: '/Monitor/Dilute/Ops/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓洃娴嬬█閲婃搷浣� + */ +export const UpdateAMonitorDiluteOpsLevel = async (data, req: any = request) => { + return req({ + url: '/Monitor/Dilute/Ops/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼鐩戞祴绋�閲婃搷浣滄帓搴忕爜 + */ +export const UpdateMonitorDiluteOpsLevelSorter = async (data, req: any = request) => { + return req({ + url: '/Monitor/Dilute/Ops/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓洃娴嬬█閲婃搷浣� + */ +export const DeleteAMonitorDiluteOpsLevel = async (params, req: any = request) => { + return req({ + url: '/Monitor/Dilute/Ops/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; + +/** + * + * @summary 璁剧疆 鈽呮洿鏂版柟娉曠殑鐘舵�� + */ +export async function UpdateUseStatus(params, req: any = request) { + return req({ + url: '/Monitor/Dilute/Ops/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +} diff --git a/src/api/monitor/dataDocking/configure/dataDockingConfigure.ts b/src/api/monitor/dataDocking/configure/dataDockingConfigure.ts new file mode 100644 index 0000000..a548a8d --- /dev/null +++ b/src/api/monitor/dataDocking/configure/dataDockingConfigure.ts @@ -0,0 +1,87 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇鎵�鏈夋暟鎹鎺ラ厤缃� + */ +export const GetAllMonitorDataDockingConfigure = async (req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/GetAll@V1.0', + method: 'get', + }); +}; + +/** + * @summary 娣诲姞涓�涓暟鎹鎺ラ厤缃� + */ +export const InsertAMonitorDataDockingConfigure = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓暟鎹鎺ラ厤缃� + */ +export const UpdateAMonitorDataDockingConfigure = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼鏁版嵁瀵规帴閰嶇疆鎺掑簭鐮� + */ +export const UpdateMonitorDataDockingConfigureSorter = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鏇存柊鏁版嵁瀵规帴閰嶇疆浣跨敤鐘舵�� + */ +export const UpdateMonitorDataDockingConfigureUseStatus = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/UpdateUseStatus@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 妫�鏌ユ槸鍚﹀凡瀛樺湪鏍囪 + */ +export const GetIsExistMonitorDataDockingConfigureTagName = async (params, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/IsExistTagName@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓暟鎹鎺ラ厤缃� + */ +export const DeleteAMonitorDataDockingConfigure = async (params, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; + +/** + * @summary 閫氳繃 ID 鑾峰彇鏁版嵁瀵规帴閰嶇疆 + */ +export const GetMonitorDataDockingConfigureByID = async (params, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Configure/GetByID@V1.0', + method: 'get', + params, + }); +}; diff --git a/src/api/monitor/dataDocking/configure/item/extensions/configItemExtensions.ts b/src/api/monitor/dataDocking/configure/item/extensions/configItemExtensions.ts new file mode 100644 index 0000000..b733869 --- /dev/null +++ b/src/api/monitor/dataDocking/configure/item/extensions/configItemExtensions.ts @@ -0,0 +1,12 @@ +import request from '/@/utils/request'; +/** + * @summary 閫氳繃 ConfigureID 鑾峰彇瀵规帴閰嶇疆椤� + */ + export const GetDataDockingConfigureItemExtensionsByConfigureID = async (params,req:any=request) => { + return req({ + url: '/Monitor/DataDocking/Configure/Item/Extensions/GetByConfigureID@V1.0', + method: 'GET', + params: params, + }); +}; + diff --git a/src/api/monitor/dataDocking/interrupt/dataDockingInterrupt.ts b/src/api/monitor/dataDocking/interrupt/dataDockingInterrupt.ts new file mode 100644 index 0000000..f1f1213 --- /dev/null +++ b/src/api/monitor/dataDocking/interrupt/dataDockingInterrupt.ts @@ -0,0 +1,78 @@ +import request from '/@/utils/request'; + +/** + * @summary GetMonitorDataDockingInterruptAlarmConfigureByDataDockingID + */ +export const GetMonitorDataDockingInterruptAlarmConfigureByDataDockingID = async (params, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/GetByDataDockingID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 鑾峰彇鎵�鏈夋暟鎹鎺ヤ腑鏂姤璀﹂厤缃� + */ +export const GetAllMonitorDataDockingInterruptAlarmConfigure = async (params, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/GetByDataDockingID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 娣诲姞涓�涓暟鎹鎺ヤ腑鏂姤璀﹂厤缃� + */ +export const InsertAMonitorDataDockingInterruptAlarmConfigure = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓暟鎹鎺ヤ腑鏂姤璀﹂厤缃� + */ +export const UpdateAMonitorDataDockingInterruptAlarmConfigure = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼鏁版嵁瀵规帴涓柇鎶ヨ閰嶇疆鎺掑簭鐮� + */ +export const UpdateMonitorDataDockingInterruptAlarmConfigureSorter = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鏇存柊鏁版嵁瀵规帴涓柇鎶ヨ閰嶇疆浣跨敤鐘舵�� + */ +export const UpdateMonitorDataDockingInterruptAlarmConfigureUseStatus = async (data, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/UpdateUseStatus@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓暟鎹鎺ヤ腑鏂姤璀﹂厤缃� + */ +export const DeleteAMonitorDataDockingInterruptAlarmConfigure = async (params, req: any = request) => { + return req({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Configure/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; diff --git a/src/api/monitor/dataProcess.ts b/src/api/monitor/dataProcess.ts new file mode 100644 index 0000000..6eb117f --- /dev/null +++ b/src/api/monitor/dataProcess.ts @@ -0,0 +1,66 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇鎵�鏈夌洃娴嬪垹闄ゆ搷浣� + */ +export const GetAllMonitorDeleteOpsLevel = async (req: any = request) => { + return req({ + url: '/Monitor/Delete/Ops/GetAll@V1.0', + method: 'get', + }); +}; + +/** + * @summary 娣诲姞涓�涓洃娴嬪垹闄ゆ搷浣� + */ +export const InsertAMonitorDeleteOpsLevel = async (data, req: any = request) => { + return req({ + url: '/Monitor/Delete/Ops/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓洃娴嬪垹闄ゆ搷浣� + */ +export const UpdateAMonitorDeleteOpsLevel = async (data, req: any = request) => { + return req({ + url: '/Monitor/Delete/Ops/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼鐩戞祴鍒犻櫎鎿嶄綔鎺掑簭鐮� + */ +export const UpdateMonitorDeleteOpsLevelSorter = async (data, req: any = request) => { + return req({ + url: '/Monitor/Delete/Ops/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓洃娴嬪垹闄ゆ搷浣� + */ +export const DeleteAMonitorDeleteOpsLevel = async (params, req: any = request) => { + return req({ + url: '/Monitor/Delete/Ops/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; + +/** + * + * @summary 璁剧疆 鈽呮洿鏂版柟娉曠殑鐘舵�� + */ +export async function UpdateUseStatus(params, req: any = request) { + return req({ + url: '/Monitor/Delete/Ops/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +} diff --git a/src/api/monitor/dataTransfer.ts b/src/api/monitor/dataTransfer.ts new file mode 100644 index 0000000..eaa3c0d --- /dev/null +++ b/src/api/monitor/dataTransfer.ts @@ -0,0 +1,66 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇鎵�鏈夌洃娴嬬█閲婃搷浣� + */ +export const GetAllMonitorTransferOpsLevel = async (req: any = request) => { + return req({ + url: '/Monitor/Transfer/Ops/GetAll@V1.0', + method: 'get', + }); +}; + +/** + * @summary 娣诲姞涓�涓洃娴嬬█閲婃搷浣� + */ +export const InsertAMonitorTransferOpsLevel = async (data, req: any = request) => { + return req({ + url: '/Monitor/Transfer/Ops/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓洃娴嬬█閲婃搷浣� + */ +export const UpdateAMonitorTransferOpsLevel = async (data, req: any = request) => { + return req({ + url: '/Monitor/Transfer/Ops/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼鐩戞祴绋�閲婃搷浣滄帓搴忕爜 + */ +export const UpdateMonitorTransferOpsLevelSorter = async (data, req: any = request) => { + return req({ + url: '/Monitor/Transfer/Ops/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓洃娴嬬█閲婃搷浣� + */ +export const DeleteAMonitorTransferOpsLevel = async (params, req: any = request) => { + return req({ + url: '/Monitor/Transfer/Ops/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; + +/** + * + * @summary 璁剧疆 鈽呮洿鏂版柟娉曠殑鐘舵�� + */ +export async function UpdateUseStatus(params, req: any = request) { + return req({ + url: '/Monitor/Transfer/Ops/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +} diff --git a/src/api/monitor/day.ts b/src/api/monitor/day.ts new file mode 100644 index 0000000..9fd3c7b --- /dev/null +++ b/src/api/monitor/day.ts @@ -0,0 +1,11 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇淇″彿缁� + */ +export const GetSimpleLogicalTreeListByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Std/GetSimpleLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/dayStd.ts b/src/api/monitor/dayStd.ts new file mode 100644 index 0000000..d561f4a --- /dev/null +++ b/src/api/monitor/dayStd.ts @@ -0,0 +1,11 @@ +import request from '/@/utils/request'; +/** + * @summary 閫氳繃淇″彿ID鑾峰彇鏃ユ湡鍖洪棿鐨勬暟鎹�� + */ +export const GetBySignalIDOfDayRange = async (params) => { + return request({ + url: '/Monitor/Record/Day/Std/GetBySignalIDOfDayRange@V2.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/hourStd.ts b/src/api/monitor/hourStd.ts new file mode 100644 index 0000000..c22e758 --- /dev/null +++ b/src/api/monitor/hourStd.ts @@ -0,0 +1,11 @@ +import request from '/@/utils/request'; +/** + * @summary 閫氳繃淇″彿ID鑾峰彇鏃剁殑鏁版嵁鍊� + */ +export const GetBySignalIDOfDay = async (params) => { + return request({ + url: '/Monitor/Record/Hour/Std/GetBySignalIDOfDay@V2.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/inputOnline.ts b/src/api/monitor/inputOnline.ts new file mode 100644 index 0000000..22ee580 --- /dev/null +++ b/src/api/monitor/inputOnline.ts @@ -0,0 +1,21 @@ +import request from '/@/utils/request'; +/** + * @summary 鏍规嵁娴嬬偣缁勭殑ID鑾峰彇淇″彿鍒楄〃 + */ +export const GetByGroupID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Input/Online/Logic/GetByGroupID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 澶氫釜淇″彿鐨勬墜鍔ㄨ緭鍏ュ�� + */ +export const InputsLastRecord = async (params) => { + return request({ + url: '/Monitor/Record/Real/Input/Online/Logic/InputsLastRecord@V1.0', + method: 'POST', + data: params, + }); +}; diff --git a/src/api/monitor/interrupt/monitorInterruptAlarm.ts b/src/api/monitor/interrupt/monitorInterruptAlarm.ts new file mode 100644 index 0000000..b996af6 --- /dev/null +++ b/src/api/monitor/interrupt/monitorInterruptAlarm.ts @@ -0,0 +1,78 @@ +import request from '/@/utils/request'; + +/** + * @summary GetMonitorInterruptAlarmConfigureByMonitorPointID + */ +export const GetMonitorInterruptAlarmConfigureByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/GetByMonitorPointID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 鑾峰彇鎵�鏈夋祴鐐逛腑鏂姤璀﹂厤缃� + */ +export const GetAllMonitorInterruptAlarmConfigure = async (params, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/GetByMonitorPointID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 娣诲姞涓�涓祴鐐逛腑鏂姤璀﹂厤缃� + */ +export const InsertAMonitorInterruptAlarmConfigure = async (data, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓祴鐐逛腑鏂姤璀﹂厤缃� + */ +export const UpdateAMonitorInterruptAlarmConfigure = async (data, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 淇敼娴嬬偣涓柇鎶ヨ閰嶇疆鎺掑簭鐮� + */ +export const UpdateMonitorInterruptAlarmConfigureSorter = async (data, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/UpdateSorter@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鏇存柊娴嬬偣涓柇鎶ヨ閰嶇疆浣跨敤鐘舵�� + */ +export const UpdateMonitorInterruptAlarmConfigureUseStatus = async (data, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/UpdateUseStatus@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓祴鐐逛腑鏂姤璀﹂厤缃� + */ +export const DeleteAMonitorInterruptAlarmConfigure = async (params, req: any = request) => { + return req({ + url: '/Monitor/Interrupt/Alarm/Configure/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; diff --git a/src/api/monitor/list.ts b/src/api/monitor/list.ts new file mode 100644 index 0000000..5b3b145 --- /dev/null +++ b/src/api/monitor/list.ts @@ -0,0 +1,96 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇娴嬬偣鍒楄〃 + */ +export const GetByGroupID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Last/List/Logic/GetByGroupID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鍒锋柊涓�鏉℃祴鐐瑰垪琛ㄦ暟鎹� + */ +export const GetLastRecord = async (params) => { + return request({ + url: '/Monitor/Record/Real/Last/List/Logic/GetLastRecord@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 妫掑浘鏁版嵁 + */ +export const GetByBarGroupID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Bar/GetByGroupID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鍒锋柊妫掑浘鏁版嵁 + */ +export const GetBarLastRecord = async (params) => { + return request({ + url: '/Monitor/Record/Real/Bar/GetLastRecord@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鑾峰彇format绫诲瀷 + */ +export const GetDisplayParasByID = async (params) => { + return request({ + url: '/Monitor/Signal/Std/GetDisplayParasByID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏍规嵁淇″彿ID鑾峰彇鍥捐〃鏁版嵁(鏈夋枃鏈拰鍏朵粬鍥捐〃) + */ +export const GetBySignalIDOfDay = async (params) => { + return request({ + url: '/Monitor/Record/Real/Std/GetBySignalIDOfDay@V2.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏍规嵁淇″彿ID鑾峰彇鍥捐〃鏁版嵁 (鍙湁鍥捐〃) + */ +export const GetBySignalIDOfNumberDay = async (params) => { + return request({ + url: '/Monitor/Record/Real/Std/GetBySignalIDOfDay@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鏍规嵁淇″彿ID瀹炴椂鍒锋柊鍥捐〃鏁版嵁 + */ +export const GetEChartLastRecord = async (params) => { + return request({ + url: '/Monitor/Record/Real/Std/GetLastRecord@V2.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鏍规嵁淇″彿ID鑾峰彇璁¢噺鍙傛暟 + */ +export const GetMeasureParasByID = async (params) => { + return request({ + url: '/Monitor/Signal/Std/GetMeasureParasByID@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/monitorFormula.ts b/src/api/monitor/monitorFormula.ts new file mode 100644 index 0000000..0521781 --- /dev/null +++ b/src/api/monitor/monitorFormula.ts @@ -0,0 +1,121 @@ +import request from '/@/utils/request'; +//#region ====================== 宸︿晶鏍戝垪琛� ====================== +/** + * + * @summary + */ +export async function GetAll(req: any = request) { + return req({ + url: '/Monitor/Formula/Group/GetAll@V1.0', + method: 'GET', + }); +} +//鎻掑叆涓�鏉� +export async function InsertGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Group/Insert@V1.0', + method: 'POST', + data: params, + }); +} +//鏇存柊涓�鏉� +export async function UpdateGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Group/Update@V1.0', + method: 'PUT', + data: params, + }); +} +//鍒犻櫎涓�鏉� +export async function DeleteGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Group/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +} +/** + * @summary 鏇存柊鐢ㄦ埛鎺掑簭鐮� + */ +export const UpdateUserSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Formula/Group/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + + + +/** + * @summary 鏇存柊鏍戞帓搴忕爜锛堟洿鏀圭埗绾э級 + */ +export const UpdateFormulaGroupTreeSortCode = async (params, req: any = request) => { + return req({ + url: '/Monitor/Formula/Group/UpdateTreeSortCode@V1.0', + method: 'PUT', + data: params, + }); +}; + + +//鏍规嵁缁勮幏鍙栧垪琛� +export async function GetByGroupID(params, req: any = request) { + return req({ + url: '/Monitor/Formula/GetByGroupID@V1.0', + method: 'GET', + params: params, + }); +} + +//#endregion + +//#region ====================== 鍙充晶琛ㄦ牸鍒楄〃 ====================== +//鎻掑叆涓�鏉� +export async function TableInsert(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Insert@V1.0', + method: 'POST', + data: params, + }); +} + +//鏇存柊涓�鏉� +export async function TableUpdate(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Update@V1.0', + method: 'PUT', + data: params, + }); +} +//鍒犻櫎 +export async function TableDelete(params, req: any = request) { + return req({ + url: '/Monitor/Formula/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +} +//#endregion + +/** + * @summary 鏄惁宸插瓨鍦ㄥ綋鍓嶇紪鐮� + */ +export const GetIsExistFormulaCode = async (params, req: any = request) => { + return req({ + url: '/Monitor/Formula/IsExistCode@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏇存柊鍏紡鎺掑簭鐮� + */ +export const UpdateFormulaSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Formula/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; diff --git a/src/api/monitor/monitorOrg.ts b/src/api/monitor/monitorOrg.ts new file mode 100644 index 0000000..841c782 --- /dev/null +++ b/src/api/monitor/monitorOrg.ts @@ -0,0 +1,11 @@ +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇鎵�鏈変俊鍙锋爲锛堝伐鑹哄浘缁樺埗宸︿晶鏍戯級 + */ +export const GetFullLogicalTreeList = async (req = request) => { + return req({ + url: '/Monitor/Org/Logic/GetFullLogicalTreeList@V1.0', + method: 'GET', + }); +}; diff --git a/src/api/monitor/monitorPointExtensions.ts b/src/api/monitor/monitorPointExtensions.ts new file mode 100644 index 0000000..113f4ef --- /dev/null +++ b/src/api/monitor/monitorPointExtensions.ts @@ -0,0 +1,45 @@ +import request from '/@/utils/request'; + +/** + * @summary 鎻掑叆涓�涓洃娴嬬偣锛堟墿灞曪級 + */ +export const InsertMonitorPointExtensions = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Extensions/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 鎻掑叆澶氫釜鐩戞祴鐐癸紙鎵╁睍 + */ +export const InsertBulkMonitorPointExtensions = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Extensions/Inserts@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 閫氳繃涓�缁� id 鑾峰彇娴嬬偣锛堟嫇灞曪級 + */ +export const GetPointExtensionByIds = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Extensions/GetByIds@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 閫氳繃BelongType鍜孊elongID 鑾峰彇鎵�鏈夋祴鐐� + */ +export const GetPointExtensionsByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Extensions/GetByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/monitorPointTemplateExtensions.ts b/src/api/monitor/monitorPointTemplateExtensions.ts new file mode 100644 index 0000000..34f8ed4 --- /dev/null +++ b/src/api/monitor/monitorPointTemplateExtensions.ts @@ -0,0 +1,13 @@ + +import request from '/@/utils/request'; + +/** + * @summary 鎻掑叆涓�鏉′俊鍙锋ā鏉匡紙鎵╁睍锛� + */ +export const InsertAMonitorPointTemplate = async (params) => { + return request({ + url: "/Monitor/Point/Template/Extensions/Insert@V1.0", + method: "POST", + data: params, + }); +}; diff --git a/src/api/monitor/monitorPointTemplateStd.ts b/src/api/monitor/monitorPointTemplateStd.ts new file mode 100644 index 0000000..7e65293 --- /dev/null +++ b/src/api/monitor/monitorPointTemplateStd.ts @@ -0,0 +1,29 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇鐩戞祴鐐规ā鏉� + */ +export const GetMonitorPointTemplateSelectListStd = async (req: any = request) => { + return req({ + url: '/Monitor/Point/Template/Std/GetSelectList@V1.0', + method: 'GET', + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炵洃娴嬬偣妯℃澘 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getMonitorPointTemplateSelectListStd = async (req: any = request) => { + const res = await GetMonitorPointTemplateSelectListStd(req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇鐩戞祴鐐规ā鏉垮け璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; diff --git a/src/api/monitor/monitorRecord.ts b/src/api/monitor/monitorRecord.ts new file mode 100644 index 0000000..916c731 --- /dev/null +++ b/src/api/monitor/monitorRecord.ts @@ -0,0 +1,57 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇鏈�杩戜竴鏉¤褰� + */ +export const GetLastRecord = async (params, req = request) => { + return req({ + url: '/Monitor/Record/Std/GetLastRecord@V2.0', + method: 'GET', + params: params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炴渶杩戜竴涓祴鐐圭殑璁板綍 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getLastRecordStd = async (params, req: any = request) => { + const res = await GetLastRecord(params, req); + + if (res?.Code === 0) { + const resData = res.Data as any; + return resData; + } else { + ElMessage.error('鑾峰彇娴嬬偣璁板綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇鏈�杩戠殑澶氫釜娴嬬偣鐨勮褰� + */ +export const GetLastRecordListStd = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Std/GetLastRecordList@V2.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炴渶杩戠殑澶氫釜娴嬬偣鐨勮褰� + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getLastRecordListStd = async (params, req: any = request) => { + const res = await GetLastRecordListStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as any[]; + return resData; + } else { + ElMessage.error('鑾峰彇娴嬬偣璁板綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; diff --git a/src/api/monitor/monitorlAlarm.ts b/src/api/monitor/monitorlAlarm.ts new file mode 100644 index 0000000..dc9614a --- /dev/null +++ b/src/api/monitor/monitorlAlarm.ts @@ -0,0 +1,44 @@ +import request from '/@/utils/request'; +/** + * @summary 鐩戞祴鍊兼渶杩戞姤璀﹀嚑鏉¤褰� + */ +export const GetLastList = async (params) => { + return request({ + url: '/Monitor/Value/Alarm/Record/Std/GetLastList@V1.0', + method: 'GET', + params: params, + }); +}; + + +/** + * @summary 鐩戞祴鍊兼姤璀﹁褰� + */ +export const GetPageListByGroupIDContainsChildren = async (params) => { + return request({ + url: '/Monitor/Value/Alarm/Record/Std/GetPageListByGroupIDContainsChildren@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鑾峰彇涓柇鎶ヨ鍒嗛〉鍒楄〃 + */ +export const GetAlarmPageList = async (params) => { + return request({ + url: '/Monitor/Interrupt/Alarm/Record/Std/GetPageListByGroupIDContainsChildren@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鑾峰彇瀵规帴鎶ヨ鍒楄〃 + */ +export const GetDataDockPageList = async (params) => { + return request({ + url: '/Monitor/DataDocking/Interrupt/Alarm/Record/Std/GetPageList@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/monthStd.ts b/src/api/monitor/monthStd.ts new file mode 100644 index 0000000..2a0d487 --- /dev/null +++ b/src/api/monitor/monthStd.ts @@ -0,0 +1,11 @@ +import request from '/@/utils/request'; +/** + * @summary 閫氳繃淇″彿ID鑾峰彇鏈堝尯闂寸殑鏁版嵁鍊� + */ +export const GetBySignalIDOfMonthRange = async (params) => { + return request({ + url: '/Monitor/Record/Month/Std/GetBySignalIDOfMonthRange@V2.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/rangeHistory.ts b/src/api/monitor/rangeHistory.ts new file mode 100644 index 0000000..06b8189 --- /dev/null +++ b/src/api/monitor/rangeHistory.ts @@ -0,0 +1,22 @@ +import request from '/@/utils/request'; + +/** + * @summary 鍖洪棿鏌ヨ 鏄剧ず鏍煎紡绫诲瀷 + */ +export const GetDisplayParasByID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Std/GetDisplayParasByID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鍖洪棿鏌ヨ 鏆傛椂杩樻湭鎺夋帴鍙� 闇�瑕佺敤鍦‥chartData鍥捐〃閲� + */ +export const GetLimitBySignalIDOfTimeRange = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Std/GetLimitBySignalIDOfTimeRange@V2.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/real.ts b/src/api/monitor/real.ts new file mode 100644 index 0000000..83edfb0 --- /dev/null +++ b/src/api/monitor/real.ts @@ -0,0 +1,85 @@ +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇娴嬬偣缁勫垪琛� + */ +export const GetLogicalTreeListByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鑾峰彇璁惧鍒楄〃 + */ +export const GetEquipmentLogicalTreeListByBelongTypeAndBelongID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetEquipmentLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鏍规嵁娴嬬偣鍒楄〃鎴栬�呬俊鍙蜂笅鎷夐�夋嫨 + */ +export const GetSimpleSignalListByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetSimpleSignalListByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary + */ +export const GetLastRecordList = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetSimpleLastRecordBySignalIds@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 娉㈠舰鍥� + */ +export const GetLastWaveSpectrumByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetLastWaveSpectrumByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 棰戣氨鍥� + */ +export const GetLastFrequencySpectrumByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetLastFrequencySpectrumByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 娉㈠舰棰戣氨鍥� + */ +export const GetLastWaveAndFrequencySpectrumByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetLastWaveAndFrequencySpectrumByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏁呴殰棰戠巼鍒嗘瀽 + */ +export const GetLastDegreeFrequencySpectrumByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Record/Real/Vibration/Logic/GetLastDegreeFrequencySpectrumByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/signal/signalStd.ts b/src/api/monitor/signal/signalStd.ts new file mode 100644 index 0000000..d89b84f --- /dev/null +++ b/src/api/monitor/signal/signalStd.ts @@ -0,0 +1,29 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇閰嶇疆琛ㄦ牸 + */ +export const GetMonitorSignalDockingLogicalTreeListByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Std/GetDockingLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 鑾峰彇閰嶇疆琛ㄦ牸 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getMonitorSignalDockingLogicalTreeListByBelongTypeAndBelongID = async (params, req: any = request) => { + const res = await GetMonitorSignalDockingLogicalTreeListByBelongTypeAndBelongID(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as any[]; + return resData; + } else { + ElMessage.error('鑾峰彇淇″彿澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return []; + } +}; diff --git a/src/api/monitor/signalAlarm.ts b/src/api/monitor/signalAlarm.ts new file mode 100644 index 0000000..e771834 --- /dev/null +++ b/src/api/monitor/signalAlarm.ts @@ -0,0 +1,66 @@ +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇鎵�鏈夋姤璀﹂厤缃� + */ +export const GetAllSignalAlarm = async (params, req: any = request) => { + return req({ + url: '/Monitor/Value/Alarm/Configure/GetBySignalID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * @summary 娣诲姞涓�涓姤璀﹂厤缃� + */ +export const InsertASignalAlarm = async (params, req: any = request) => { + return req({ + url: '/Monitor/Value/Alarm/Configure/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 淇敼涓�涓姤璀﹂厤缃褰� + */ +export const UpdateASignalAlarm = async (params, req: any = request) => { + return req({ + url: '/Monitor/Value/Alarm/Configure/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鍒犻櫎涓�鏉℃姤璀﹂厤缃褰� + */ +export const DeleteASignalAlarm = async (params, req: any = request) => { + return req({ + url: '/Monitor/Value/Alarm/Configure/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +/** + * @summary 淇敼鎶ヨ閰嶇疆琛ㄦ牸鎺掑簭鐮� + */ +export const UpdateSignalAlarmSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Value/Alarm/Configure/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鏇存柊鎶ヨ閰嶇疆浣跨敤鐘舵�� + */ +export const UpdateSignalAlarmUseStatus = async (params, req: any = request) => { + return req({ + url: '/Monitor/Value/Alarm/Configure/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +}; diff --git a/src/api/monitor/signalStd.ts b/src/api/monitor/signalStd.ts new file mode 100644 index 0000000..ab35ab2 --- /dev/null +++ b/src/api/monitor/signalStd.ts @@ -0,0 +1,86 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇淇″彿鏍� + */ +export const GetNumericSignalLogicalTreeStd = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Std/GetSimpleLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炴暟鍊煎瀷鐨勪俊鍙锋爲 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getNumericSignalLogicalTreeStd = async (params, req: any = request) => { + const res = await GetNumericSignalLogicalTreeStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇淇″彿鏍戝け璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇淇″彿鏍� + */ +export const GetSignalLogicalTreeStd = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Std/GetLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炰俊鍙锋爲锛堝畬鏁达級 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getSignalLogicalTreeStd = async (params, req: any = request) => { + const res = await GetSignalLogicalTreeStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇淇″彿鏍戝け璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇淇″彿鏍戯紙鍙互鎸囧畾鏍煎紡锛� + */ +export const GetFormatLogicalTreeStd = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Std/GetFormatLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炰俊鍙锋爲 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getFormatLogicalTreeStd = async (params, req: any = request) => { + const res = await GetFormatLogicalTreeStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇淇″彿鏍戝け璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; diff --git a/src/api/monitor/vibration.ts b/src/api/monitor/vibration.ts new file mode 100644 index 0000000..b90f97c --- /dev/null +++ b/src/api/monitor/vibration.ts @@ -0,0 +1,85 @@ +import request from '/@/utils/request'; + +/** + * @summary 鑾峰彇娴嬬偣缁勫垪琛� + */ +export const GetLogicalTreeListByBelongTypeAndBelongID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鑾峰彇璁惧鍒楄〃 + */ +export const GetEquipmentLogicalTreeListByBelongTypeAndBelongID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetEquipmentLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鏍规嵁娴嬬偣鍒楄〃鎴栬�呬俊鍙蜂笅鎷夐�夋嫨 + */ +export const GetSimpleSignalListByMonitorPointID = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetSimpleSignalListByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary + */ +export const GetLimitBySignalIDOfTimeRange = async (params) => { + return request({ + url: '/Monitor/Record/Real/Std/GetLimitBySignalIDOfTimeRange@V2.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 娉㈠舰鍥� + */ +export const GetWaveSpectrumByMonitorPointIDOfTime = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetWaveSpectrumByMonitorPointIDOfTime@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 棰戣氨鍥� + */ +export const GetFrequencySpectrumByMonitorPointIDOfTime = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetFrequencySpectrumByMonitorPointIDOfTime@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 娉㈠舰棰戣氨鍥� + */ +export const GetWaveAndFrequencySpectrumByMonitorPointIDOfTime = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetWaveAndFrequencySpectrumByMonitorPointIDOfTime@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏁呴殰棰戠巼鍒嗘瀽 + */ +export const GetDegreeFrequencySpectrumByMonitorPointIDOfTime = async (params) => { + return request({ + url: '/Monitor/Record/Real/Vibration/Logic/GetDegreeFrequencySpectrumByMonitorPointIDOfTime@V1.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/monitor/yearStd.ts b/src/api/monitor/yearStd.ts new file mode 100644 index 0000000..82c3d80 --- /dev/null +++ b/src/api/monitor/yearStd.ts @@ -0,0 +1,11 @@ +import request from '/@/utils/request'; +/** + * @summary 閫氳繃淇″彿ID鑾峰彇鏃ユ湡鍖洪棿鐨勬暟鎹�� + */ +export const GetBySignalIDOfYearRange = async (params) => { + return request({ + url: '/Monitor/Record/Year/Std/GetBySignalIDOfYearRange@V2.0', + method: 'GET', + params: params, + }); +}; diff --git a/src/api/point/monitor/monitorPointStd.ts b/src/api/point/monitor/monitorPointStd.ts new file mode 100644 index 0000000..cbcf2e3 --- /dev/null +++ b/src/api/point/monitor/monitorPointStd.ts @@ -0,0 +1,39 @@ +import { ElMessage } from 'element-plus'; +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇娴嬬偣锛屾祴鐐逛笌娴嬬偣缁勭粍鍚� + */ +export const GetMonitorPointStd = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Std/GetLogicalTreeListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 璋冪敤鎺ュ彛锛岃繑鍥炴祴鐐� + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getMonitorPointStd = async (params, req: any = request) => { + const res = await GetMonitorPointStd(params, req); + + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + return resData; + } else { + ElMessage.error('鑾峰彇娴嬬偣澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; +/** + * @summary 閫氳繃 BelongType and BelongID鑾峰彇娴嬬偣缁凷td (閲戝涵浣跨敤) + */ +export const GetTreeItemListByBelongTypeAndBelongID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/Std/GetTreeItemListByBelongTypeAndBelongID@V1.0', + method: 'GET', + params, + }); +}; diff --git a/src/api/point/monitor/monitor_point.ts b/src/api/point/monitor/monitor_point.ts new file mode 100644 index 0000000..b397807 --- /dev/null +++ b/src/api/point/monitor/monitor_point.ts @@ -0,0 +1,336 @@ +import request from '/@/utils/request'; + +//#region ====================== 鑾峰彇娴嬬偣缁勬爲澧炲垹鏀� ====================== +/** + * @summary 閫氳繃 BelongType and BelongID鑾峰彇 + */ +export const GetAllPointGroup = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/GetByBelongTypeAndBelongID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 閫氳繃 鎻掑叆涓�鏉℃祴鐐圭粍 + */ +export const InsertPointGroup = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/Insert@V1.0', + method: 'POST', + data: params, + }); +}; +/** + * @summary 淇敼涓�涓祴鐐圭粍璁板綍 + */ +export const UpdatePointGroup = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鍒犻櫎涓�鏉℃祴鐐圭粍璁板綍 + */ +export const DeletePointGroup = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +/** + * @summary 淇敼娴嬬偣缁勮〃鏍兼帓搴忕爜 + */ +export const UpdatePointGroupSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 妫�鏌ユ槸鍚﹀凡瀛樺湪鏍囪 + */ +export const GetIsExistPointGroupTagName = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; +//#endregion + +//#region ====================== 妯℃澘澶嶅埗鍚庢坊鍔� ====================== +/** + * @summary 鑾峰彇鐩戞祴閫夋嫨鍒楄〃 + */ +export const GetSelectList = async (req: any = request) => { + return req({ + url: '/Monitor/Point/Template/Std/GetSelectList@V1.0', + method: 'GET', + }); +}; +export const InsertExtensions = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Extensions/Insert@V1.0', + method: 'POST', + data: params, + }); +}; +/** + * @summary 鏇存柊娴嬬偣浣跨敤鐘舵�� + */ +export const UpdatePointUseStatus = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +}; +/** + * @summary 閫氳繃 ID 鑾峰彇娴嬬偣淇℃伅 + */ +export const GetByIDAllInfo = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Extensions/GetByID@V1.0', + method: 'GET', + params: params, + }); +}; + +//#endregion + +//#region ====================== 娴嬬偣娣诲姞 ====================== +/** + * @summary 閫氳繃 ID 鑾峰彇妯℃澘鍒楄〃 + */ +export const GetByIDList = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/GetByGroupID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鎻掑叆涓�鏉� + */ +export const InsertMonitorPoint = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 鏇存柊妯℃澘 + */ +export const UpdateMonitorPoint = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Update@V1.0', + method: 'PUT', + data: params, + }); +}; +/** + * @summary 鏇存柊妯℃澘TagName鏄惁瀛樺湪 + */ +export const UpdatePointTagName = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鍒犻櫎妯℃澘 + */ +export const DeleteByIDTemplate = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; + +//#endregion + +//#region ====================== 淇″彿娣诲姞====================== +/** + * @summary 閫氳繃 娴嬬偣ID 鑾峰彇淇″彿鍒楄〃 + */ + +export const GetByMonitorPointID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/GetByMonitorPointID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鎻掑叆涓�鏉′俊鍙� + */ +export const InsertSignal = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Insert@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 鎻掑叆澶氭潯淇″彿 + */ +export const InsertSignals = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Inserts@V1.0', + method: 'POST', + data: params, + }); +}; + +/** + * @summary 閫氳繃ids 鑾峰彇淇″彿 + */ +export const GetMonitorSignalByIds = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/GetByIds@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏇存柊淇″彿 + */ + +export const UpdateSignal = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Update@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 淇″彿鐨勬爣璁板悕绉版槸鍚﹀瓨鍦� + */ +export const GetIsExistSignalTagName = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/IsExistTagName@V1.0', + method: 'GET', + params: params, + }); +}; +/** + * @summary 鍒犻櫎淇″彿 + */ +export const DeleteByIDSignal = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +}; +//鑾峰彇淇″彿绫诲瀷 +export async function GetLogicalTreeList(req: any = request) { + return req({ + url: '/Monitor/Signal/Type/Std/GetLogicalTreeList@V1.0', + method: 'GET', + }); +} +//鑾峰彇妫�娴嬪叕寮� +export async function GetSupportLogicalTreeList(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Std/GetSupportLogicalTreeList@V1.0', + method: 'GET', + params: params, + }); +} +//#endregion + +/** + * @summary 鏇存柊娴嬬偣 flags + */ +export const UpdateMonitorPointFlags = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/UpdateFlags@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鏇存柊娴嬬偣鎺掑簭鐮� + */ +export const UpdateMonitorPointSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鏇存柊淇″彿鎺掑簭鐮� + */ +export const UpdateSignalSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 閫氳繃娴嬬偣 id 鑾峰彇娴嬬偣 + */ +export const GetMonitorPointByID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/GetByID@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 閫氳繃涓�缁勬祴鐐� id 鑾峰彇娴嬬偣 + */ +export const GetMonitorPointByIds = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/GetByIds@V1.0', + method: 'GET', + params: params, + }); +}; + +/** + * @summary 鏇存柊鏍戞帓搴忕爜 + */ +export const UpdatePointGroupTreeSortCode = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Group/UpdateTreeSortCode@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鏇存柊娴嬬偣鎵�灞炲垎缁� + */ +export const UpdatePointGroupID = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/UpdateGroupID@V1.0', + method: 'PUT', + data: params, + }); +}; diff --git a/src/api/point/monitorTemplate/poinTemplate.ts b/src/api/point/monitorTemplate/poinTemplate.ts new file mode 100644 index 0000000..715ea5c --- /dev/null +++ b/src/api/point/monitorTemplate/poinTemplate.ts @@ -0,0 +1,85 @@ +import request from '/@/utils/request'; +//#region ====================== 姣嶈〃鏍煎垪琛� ====================== +/** + * + * @summary + */ +export async function GetAll(req: any = request) { + return req({ + url: '/Monitor/Point/Template/GetAll@V1.0', + method: 'GET', + }); +} +//鎻掑叆涓�鏉� +export async function InsertGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Point/Template/Insert@V1.0', + method: 'POST', + data: params, + }); +} +//鏇存柊涓�鏉� +export async function UpdateGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Point/Template/Update@V1.0', + method: 'PUT', + data: params, + }); +} +//鍒犻櫎涓�鏉� +export async function DeleteGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Point/Template/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +} +/** + * @summary 鏇存柊鐢ㄦ埛鎺掑簭鐮� + */ +export const UpdateUserSorter = async (params) => { + return request({ + url: '/Monitor/Point/Template/UpdateSortCode@V1.0', + method: 'PUT', + data: params, + }); +}; +//鏍规嵁娴嬬偣ID鑾峰彇鐩稿簲鐨勫垪琛� +export async function GetByGroupID(params, req: any = request) { + return req({ + url: '/Monitor/Signal/Template/GetByTemplateID@V1.0', + method: 'GET', + params: params, + }); +} +//鑾峰彇绯荤粺鏍囩 +export async function GetBySysType(params, req: any = request) { + return req({ + url: '/Basic/Sys/Flag/Std/GetFlagListBySysType@V1.0', + method: 'GET', + params: params, + }); +} + +/** + * @summary 鏇存柊娴嬬偣妯℃澘浣跨敤鐘舵�� + */ +export const UpdateMonitorPointTemplateUseStatus = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Template/UpdateUseStatus@V1.0', + method: 'PUT', + data: params, + }); +}; + +/** + * @summary 鏇存柊娴嬬偣妯℃澘 sorter + */ +export const UpdatePointTemplateSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Point/Template/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; +//#endregion diff --git a/src/api/point/signalTemplate/signal.ts b/src/api/point/signalTemplate/signal.ts new file mode 100644 index 0000000..acd5b30 --- /dev/null +++ b/src/api/point/signalTemplate/signal.ts @@ -0,0 +1,79 @@ +import request from '/@/utils/request'; +//#region ======================淇″彿琛ㄦ牸鍒楄〃 ====================== +/** + * + * @summary + */ +export async function GetAll(params, req: any = request) { + return req({ + url: '/Monitor/Signal/Template/GetByTemplateID@V1.0', + method: 'GET', + params: params, + }); +} +//鎻掑叆涓�鏉� +export async function InsertGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Signal/Template/Insert@V1.0', + method: 'POST', + data: params, + }); +} +//鏇存柊涓�鏉� +export async function UpdateGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Signal/Template/Update@V1.0', + method: 'PUT', + data: params, + }); +} +//鍒犻櫎涓�鏉� +export async function DeleteGetByID(params, req: any = request) { + return req({ + url: '/Monitor/Signal/Template/DeleteByID@V1.0', + method: 'DELETE', + params: params, + }); +} +/** + * @summary 鏇存柊鐢ㄦ埛鎺掑簭鐮� + */ +export const UpdateUserSorter = async (params, req: any = request) => { + return req({ + url: '/Monitor/Signal/Template/UpdateSorter@V1.0', + method: 'PUT', + data: params, + }); +}; +//鑾峰彇淇″彿绫诲瀷 +export async function GetLogicalTreeList(req: any = request) { + return req({ + url: '/Monitor/Signal/Type/Std/GetLogicalTreeList@V1.0', + method: 'GET', + }); +} +//鏍规嵁娴嬬偣ID鑾峰彇鐩稿簲鐨勫垪琛� +export async function GetByGroupID(params, req: any = request) { + return req({ + url: '/Monitor/Signal/Template/GetByTemplateID@V1.0', + method: 'GET', + params: params, + }); +} +//鑾峰彇绯荤粺鏍囩 +export async function GetBySysType(params, req: any = request) { + return req({ + url: '/Basic/Sys/Flag/Std/GetFlagListBySysType@V1.0', + method: 'GET', + params: params, + }); +} +//鑾峰彇妫�娴嬪叕寮� +export async function GetSupportLogicalTreeList(params, req: any = request) { + return req({ + url: '/Monitor/Formula/Std/GetSupportLogicalTreeList@V1.0', + method: 'GET', + params: params, + }); +} +//#endregion diff --git a/src/api/run/analyse/runAnalyseConfig.ts b/src/api/run/analyse/runAnalyseConfig.ts new file mode 100644 index 0000000..a860482 --- /dev/null +++ b/src/api/run/analyse/runAnalyseConfig.ts @@ -0,0 +1,90 @@ +import type { AxiosInstance } from 'axios'; +import request from '/@/utils/request'; +export type RunAnalyConfigureGetAllResItem = { + ID: string; + ObjectType: string; + ObjectID: string; + Frequency: number; + ChangeTimes: number; + Description: string; +}; + +export type RunAnalyConfigurePostParams = { + ObjectType: string; + ObjectID: string; + Frequency: number; + ChangeTimes: number; + Description?: string; +}; + +export type RunAnalyConfigurePutParams = { + ID: string; + Frequency: number; + ChangeTimes: number; + Description?: string; +}; + +/** + * @summary 鑾峰彇鎵�鏈夎繍琛屽垎鏋愰厤缃� + */ +export const GetAllRunAnalyConfigure = async (req: AxiosInstance = request) => { + return req<RunAnalyConfigureGetAllResItem[]>({ + url: '/Run/Analy/Configure/GetAll@V1.0', + method: 'get', + }); +}; + +/** + * @summary GetRunAnalyConfigureByObjectTypeAndObjectID + */ +export const GetRunAnalyConfigureByObjectTypeAndObjectID = async (params, req: AxiosInstance = request) => { + return req<RunAnalyConfigureGetAllResItem[]>({ + url: '/Run/Analy/Configure/GetByObjectTypeAndObjectID@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary 娣诲姞涓�涓繍琛屽垎鏋愰厤缃� + */ +export const InsertARunAnalyConfigure = async (data: RunAnalyConfigurePostParams, req: any = request) => { + return req({ + url: '/Run/Analy/Configure/Insert@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 淇敼涓�涓繍琛屽垎鏋愰厤缃� + */ +export const UpdateARunAnalyConfigure = async (data: RunAnalyConfigurePutParams, req: any = request) => { + return req({ + url: '/Run/Analy/Configure/Update@V1.0', + method: 'put', + data, + }); +}; + +/** + * @summary SetRunAnalyConfigure + */ +export const SetRunAnalyConfigure = async (data, req: AxiosInstance = request) => { + return req({ + url: '/Run/Analy/Configure/Set@V1.0', + method: 'post', + data, + }); +}; + +/** + * @summary 鍒犻櫎涓�涓繍琛屽垎鏋愰厤缃� + */ +export const DeleteARunAnalyConfigure = async (params, req: any = request) => { + return req({ + url: '/Run/Analy/Configure/DeleteByID@V1.0', + method: 'delete', + params, + }); +}; diff --git a/src/api/run/real/record/runRealRecord.ts b/src/api/run/real/record/runRealRecord.ts new file mode 100644 index 0000000..bf60545 --- /dev/null +++ b/src/api/run/real/record/runRealRecord.ts @@ -0,0 +1,13 @@ +import type { AxiosInstance } from 'axios'; +import request from '/@/utils/request'; + +/** + * @summary InsertRunRealRecordInsertLastRecord@V1.0LastRecord + */ +export const InsertLastRunRealRecord = (data, req: AxiosInstance = request) => { + return req({ + url: '/Run/Real/Record/InsertLastRecord@V1.0', + method: 'post', + data, + }); +}; diff --git a/src/api/run/real/record/runRealRecordStd.ts b/src/api/run/real/record/runRealRecordStd.ts new file mode 100644 index 0000000..e711af7 --- /dev/null +++ b/src/api/run/real/record/runRealRecordStd.ts @@ -0,0 +1,35 @@ +import type { AxiosInstance } from 'axios'; +import request from '/@/utils/request'; + +/** + * @summary GetRunRealRecordStdGetLimitByObjectTypeAndObjectIDOfDayRange + */ +export const GetRunRealRecordStdGetLimitByObjectTypeAndObjectIDOfDayRange = (params, req: AxiosInstance = request) => { + return req({ + url: '/Run/Real/Record/Std/GetLimitByObjectTypeAndObjectIDOfDayRange@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary GetRunRealRecordStdGetByObjectTypeAndObjectIDOfDayRange + */ +export const GetRunRealRecordStdGetByObjectTypeAndObjectIDOfDayRange = (params, req: AxiosInstance = request) => { + return req({ + url: '/Run/Real/Record/Std/GetByObjectTypeAndObjectIDOfDayRange@V1.0', + method: 'get', + params, + }); +}; + +/** + * @summary GetRunRealRecordStdGetLastRecord + */ +export const GetRunRealRecordStdGetLastRecord = (params, req: AxiosInstance = request) => { + return req({ + url: '/Run/Real/Record/Std/GetLastRecord@V1.0', + method: 'get', + params, + }); +}; diff --git a/src/api/run/runRealRecord.ts b/src/api/run/runRealRecord.ts new file mode 100644 index 0000000..f3d8708 --- /dev/null +++ b/src/api/run/runRealRecord.ts @@ -0,0 +1,58 @@ +import { ElMessage } from 'element-plus'; + +import request from '/@/utils/request'; +/** + * @summary 鑾峰彇瀹炴椂杩愯璁板綍 + */ +export const GetRunRealRecordStd = async (params, req: any = request) => { + return req({ + url: '/Run/Real/Record/Std/GetLastRecord@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 鑾峰彇瀹炴椂杩愯璁板綍 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getRunRealRecordStd = async (params, req: any = request) => { + const res = await GetRunRealRecordStd(params, req); + + if (res?.Code === 0) { + const resData = res.Data as any; + return resData; + } else { + ElMessage.error('鑾峰彇瀹炴椂杩愯璁板綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return undefined; + } +}; + +/** + * @summary 鑾峰彇瀹炴椂杩愯璁板綍鍒楄〃 + */ +export const GetRunRealRecordListStd = async (params, req: any = request) => { + return req({ + url: '/Run/Real/Record/Std/GetLastRecordList@V1.0', + method: 'GET', + params, + }); +}; + +/** + * 鑾峰彇瀹炴椂杩愯璁板綍鍒楄〃 + * 鎶ラ敊鏃惰繑鍥� undefined + * @returns + */ +export const getRunRealRecordListStd = async (params, req: any = request) => { + const res = await GetRunRealRecordListStd(params, req) + + if (res?.Code === 0) { + const resData = (res.Data || []) as any[]; + return resData; + } else { + ElMessage.error('鑾峰彇瀹炴椂杩愯璁板綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + return []; + } +}; diff --git a/src/projectCom/basic/catalog/CatalogManageCom.vue b/src/projectCom/basic/catalog/CatalogManageCom.vue new file mode 100644 index 0000000..187d61f --- /dev/null +++ b/src/projectCom/basic/catalog/CatalogManageCom.vue @@ -0,0 +1,802 @@ +<template> + <el-row :gutter="8" class="h100"> + <el-col :span="4" :xs="24" class="h100"> + <el-card shadow="hover" class="h100 left-tree-card" v-loading="treeLoading"> + <LeftTreeByMgr + :treedata="listTreeData" + title-name="绫诲瀷鍒楄〃" + :current-node-key="currentListID" + @click="handleClickNode" + :folder-icon="(node, data) => data.LogicalType === MODULE_CODE" + :default-props="{ + id: 'LogicalID', + label: 'LogicalName', + children: 'Children', + }" + > + </LeftTreeByMgr> + </el-card> + </el-col> + <el-col :span="20" :xs="24" class="flex-column h100"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <el-form :inline="true" :model="queryParams"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input v-model="queryParams.Name" style="width: 226.4px" placeholder="鍚嶇О" clearable></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input v-model="queryParams.Code" style="width: 226.4px" placeholder="缂栫爜" clearable /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="ele-Search" @click="handleQueryTable"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="resetQuery">閲嶇疆 </el-button> + <el-button icon="ele-Plus" @click="openOperateDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch + v-model="isDragStatus" + @change="handleDragStatus" + inline-prompt + active-icon="ele-Check" + inactive-icon="ele-Close" + > + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <el-table + v-loading="tableLoading" + ref="draggableTableRef" + border + row-key="ID" + :expand-row-keys="treeTableExpandKeys" + :tree-props="{ children: 'Children', hasChildren: 'hasChildren' }" + :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'" + :cell-style="tableCellCenterExceptColumn()" + :header-cell-style="{ textAlign: 'center' }" + :data="tableData" + @expand-change="tableExpandChange" + style="width: 100%" + highlight-current-row + > + <el-table-column prop="Name" label="鍚嶇О" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Code" label="缂栫爜" show-overflow-tooltip /> + <el-table-column prop="Description" width="550" label="璇存槑" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" fixed="right" show-overflow-tooltip width="250"> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateDialog(scope.row)"> 缂栬緫 </el-button> + <el-button icon="ele-Folder" size="small" text type="primary" @click="openCatalogOrgDrawer(scope.row)"> 鐩綍 </el-button> + <el-button icon="ele-Grid" size="small" text type="primary" @click="openPropertySetDialog(scope.row)"> 灞炴�� </el-button> + + <el-dropdown> + <el-button icon="ele-MoreFilled" size="small" text type="primary" style="padding-left: 12px" /> + <template #dropdown> + <el-dropdown-menu> + <el-dropdown-item icon="ele-Menu" @click="openParentDlg(scope.row)"> 鐖剁骇 </el-dropdown-item> + <el-dropdown-item icon="ele-Delete" @click="deleteCurrentRow(scope.row)" divided> 鍒犻櫎 </el-dropdown-item> + </el-dropdown-menu> + </template> + </el-dropdown> + </template> + </el-table-column> + </el-table> + </el-card> + <el-dialog :destroy-on-close="true" v-model="dialogIsShow" width="400" :close-on-click-modal="false" @closed="closeDialog"> + <template #header> + <div style="color: #fff"> + <SvgIcon :name="dialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ dialogTitle }} </span> + </div> + </template> + + <el-form :model="dialogFormValue" ref="dialogFormRef" :rules="dialogFormRules" label-width="55"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="dialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input placeholder="璇疯緭鍏ュ敮涓�缂栫爜" v-model="dialogFormValue.Code"></el-input> + </el-form-item> + <el-form-item label="鐖剁骇" prop="ParentID"> + <el-tree-select + filterable + style="width: 100%" + v-model="dialogFormValue.ParentID" + :props="{ + id: 'ID', + label: 'Name', + children: 'Children', + }" + :data="tableData" + node-key="ID" + :clearable="true" + :accordion="true" + :expandNode="false" + :check-strictly="true" + placeholder="璇烽�夋嫨鐖剁骇" + > + </el-tree-select> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="dialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + </el-col> + + <!-- 鎶藉眽琛ㄦ牸 --> + <div class="custom-drawer"> + <el-drawer v-model="catalogOrgDrawerIsShow" direction="rtl" size="18%" :with-header="false"> + <el-card shadow="hover" style="height: 100%" v-loading="catalogOrgDrawerListLoading"> + <LeftTreeByMgr + :titleName="currentCatalogOrgMapRow.Name + ' - 鍒嗙被鐩綍'" + :treedata="displayCatalogOrgData" + :search-is-show="false" + :expand-on-click-node="false" + > + <template #customTitleRight> + <div class="titleSlotRight"> + <SvgIcon + :size="20" + name="ele-Setting" + color="#528abe" + class="cursor-pointer" + @click="openOperateCatalogOrgSetDialog" + /> + </div> + </template> + </LeftTreeByMgr> + </el-card> + </el-drawer> + </div> + + <el-dialog + :destroy-on-close="true" + v-model="propertySetDialogIsShow" + width="700" + :close-on-click-modal="false" + @closed="closePropertySetDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon name="ele-Grid" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span>璁剧疆灞炴��</span> + </div> + </template> + <el-tree + v-loading="propertyCheckTreeLoading" + ref="propertyCheckTreeRef" + :data="propertyCheckTree" + node-key="LogicalID" + show-checkbox + check-strictly + :props="{ children: 'Children', label: 'LogicalName', class: treeNodeClass, disabled: 'Inherit' }" + icon="ele-Menu" + highlight-current + default-expand-all + > + <template #default="{ node, data }"> + <el-tooltip v-if="data.LogicalType === 'sys-prop-group'" content="灞炴�у垎缁�" placement="top-start"> + {{ node.label }} + </el-tooltip> + <el-tooltip v-else-if="data.Inherit" content="缁ф壙鑷绾у垎绫�" placement="top-start"> + {{ node.label }} + </el-tooltip> + <template v-else> + {{ node.label }} + </template> + </template> + </el-tree> + + <template v-slot:footer> + <div> + <el-button @click="closePropertySetDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitPropertySetForm">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + + <!-- catalogOrg 璁剧疆瀵硅瘽妗� --> + <el-dialog + :destroy-on-close="true" + v-model="catalogOrgSetDialogIsShow" + width="700" + :close-on-click-modal="false" + @closed="closeCatalogOrgSetDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon name="ele-Setting" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> 璁剧疆鐩綍 </span> + </div> + </template> + + <el-form :model="catalogOrgTableForm"> + <!-- 鏁版嵁灞曠ず琛ㄦ牸 --> + <el-table + ref="catalogOrgCheckTableRef" + v-loading="catalogOrgTableLoading" + :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" + border + row-key="ID" + :cell-style="tableCellCenterExceptColumn(1)" + :header-cell-style="{ textAlign: 'center' }" + :data="filteredTableData" + :expand-row-keys="catalogOrgExpandRowKeys" + style="width: 100%" + highlight-current-row + row-class-name="cursor-pointer" + @select="userSelectCatalogOrg" + > + <el-table-column type="selection" width="55px"> </el-table-column> + <el-table-column prop="Name" label="绯荤粺鍒嗙被" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Count" label="鏁伴噺" width="130" show-overflow-tooltip> + <template #default="scope"> + <el-form-item> + <el-input-number size="small" :min="1" v-model="catalogOrgTableForm[scope.row.ID]"></el-input-number> + </el-form-item> + </template> + </el-table-column> + </el-table> + </el-form> + + <template #footer> + <div> + <el-button @click="closeCatalogOrgSetDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitCatalogOrgSetValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + <ParentDialog + v-model="parentDlgIsShow" + :data="treeTableData" + :api="UpdateCatalogTreeSortCode" + :rowData="parentDlgMapRow" + @submitSuccess="submitParentForm" + > + </ParentDialog> + </el-row> +</template> + +<script setup lang="ts"> +import type { FormInstance, FormRules, TableInstance } from 'element-plus'; +import { ElMessage, ElMessageBox, ElTree } from 'element-plus'; +import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; +import type { PropType } from 'vue'; +import { ref, onMounted, computed, watch, nextTick } from 'vue'; +import { deepClone } from '/@/utils/other'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +import { useTableSort } from '/@/hooks/useTableSort'; +import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; +import { + DeleteACatalog, + GetTypeListTreeData, + GetAllCatalogByID, + GetIsExistCatalogCode, + InsertACatalog, + UpdateACatalog, + UpdateCatalogSorter, + GetCatalogOrgByParentID, + GetHaveLogicalTreeList, + SetCatalogMapProperty, + SetCatalogOrg, + UpdateCatalogTreeSortCode, +} from '/@/api/basic/dataManage/catalogManage'; +import { ExtendTypeEnum } from '/@/projectCom/basic/types'; +import { convertListToTree, travelTree, tableCellCenterExceptColumn, flatten } from '/@/utils/util'; +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { MODULE_CODE } from '/@/constants'; +import ParentDialog from '/@/components/dialog/parentDialog/ParentDialog.vue'; + +const props = defineProps({ + request: { + type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, + }, +}); + +//#region ====================== 宸︿晶鏍戞暟鎹紝tree init ====================== +const treeLoading = ref(false); +const listTreeData = ref([]); +const currentListID = ref(''); +const currentTreeNode = ref(null); +const handleClickNode = (data) => { + currentListID.value = data.LogicalID; + currentTreeNode.value = data; + if (data.LogicalType === MODULE_CODE) { + tableData.value = []; + return; + } + getTableData(); +}; +const getListTreeData = async () => { + treeLoading.value = true; + const res = await GetTypeListTreeData( + { + ExtendType: ExtendTypeEnum.Inherit, + }, + props.request + ).finally(() => { + treeLoading.value = false; + }); + if (res?.Code === 0) { + listTreeData.value = res.Data || []; + const firstListTreeNode = listTreeData.value[0]?.Children[0]; + if (firstListTreeNode) { + handleClickNode(firstListTreeNode); + } else { + tableData.value = []; + currentTreeNode.value = null; + currentListID.value = null; + } + } else { + ElMessage.error('鑾峰彇绫诲瀷鍒楄〃澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏁版嵁锛宼able init ====================== +const tableLoading = ref(false); +const flatTableData = ref([]); +// 鏍戝舰鎬佺殑琛ㄦ牸鏁版嵁 + +const treeTableData = ref([]); + +const isDragStatus = ref(false); +// 淇濆瓨褰撳墠 ID 鑺傜偣鐨勬牴鑺傜偣 ID; +let IDRootMap = {}; +const getTableData = async () => { + tableLoading.value = true; + const res = await GetAllCatalogByID({ TypeID: currentListID.value }, props.request).finally(() => { + tableLoading.value = false; + }); + if (res?.Code === 0) { + flatTableData.value = res.Data || []; + treeTableData.value = convertListToTree(flatTableData.value); + // 姣忎竴涓爲鑺傜偣鏈変竴涓� RootID锛屾寚鍚戝綋鍓嶈妭鐐圭殑鏈�涓婂眰鐨勬牴鑺傜偣 ID + let rootID = ''; + travelTree(treeTableData.value, (value) => { + if (value.ParentID === '0') { + rootID = value.ID; + } + value.RootID = rootID; + IDRootMap[value.ID] = rootID; + }); + } else { + ElMessage.error('鑾峰彇鍒嗙被澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const deleteCurrentRow = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎鍒嗙被锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteACatalog( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎鍒嗙被鎴愬姛'); + getTableData(); + } else { + ElMessage.error('鍒犻櫎鍒嗙被澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎鍒嗙被澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏌ヨ銆佹帓搴忥紝search form init ====================== +const queryParams = ref({ + Name: '', + Code: '', +}); +const { resetQuery, handleQueryTable, displayTableData: tableData } = useQueryTable(flatTableData, queryParams, getTableData, true); + +const { handleDragStatus, draggableTableRef } = useTableSort( + tableData, + UpdateCatalogSorter, + getTableData, + undefined, + true, + props.request +); + +//#endregion + +//#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init====================== +const isEditDialog = ref(false); +const dialogTitle = computed(() => { + return isEditDialog.value ? '淇敼鍒嗙被' : '娣诲姞鍒嗙被'; +}); +const dialogHeaderIcon = computed(() => { + return isEditDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const dialogFormValue = ref(null); +const dialogIsShow = ref(false); +const dialogFormRef = ref<FormInstance>(null); +const initialCode = ref(''); + +const { uniquenessValidator } = useValidateUniqueness( + GetIsExistCatalogCode, + initialCode, + '缂栫爜', + 'Code', + { + CorpID: currentListID, + }, + false, + props.request +); + +const dialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Code: [{ required: true, validator: uniquenessValidator as any, trigger: 'blur' }], +}); +const openOperateDialog = (row?) => { + if (!currentListID.value) { + return ElMessage.warning('璇峰厛閫夋嫨绫诲瀷锛�'); + } + if (row) { + isEditDialog.value = true; + const { ID, Name, Code, Description, ParentID } = row; + + initialCode.value = Code; + dialogFormValue.value = deepClone({ + TypeID: currentTreeNode.value.LogicalID, + ID, + Name, + Code, + Description, + ParentID: ParentID === '0' ? null : ParentID, + }); + } else { + if (currentTreeNode.value.LogicalType === MODULE_CODE) { + return ElMessage.info('璇烽�夋嫨绯荤粺绫诲瀷锛屽啀娣诲姞鏁版嵁'); + } + isEditDialog.value = false; + initialCode.value = ''; + dialogFormValue.value = { Name: '', Code: '', Description: '', ParentID: null, TypeID: currentListID.value }; + } + dialogIsShow.value = true; +}; + +const closeDialog = () => { + dialogIsShow.value = false; + dialogFormRef.value.clearValidate(); +}; + +const submitFormValue = async () => { + const valid = await dialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (!dialogFormValue.value.ParentID) { + dialogFormValue.value.ParentID = '0'; + } + + if (isEditDialog.value) { + const res = await UpdateACatalog(dialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closeDialog(); + ElMessage.success('淇敼鍒嗙被鎴愬姛'); + } else { + ElMessage.error('淇敼鍒嗙被澶辫触'); + } + } else { + ElMessage.error('淇敼鍒嗙被澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertACatalog(dialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closeDialog(); + ElMessage.success('娣诲姞鍒嗙被鎴愬姛'); + } else { + ElMessage.success('娣诲姞鍒嗙被澶辫触'); + } + } else { + ElMessage.error('娣诲姞鍒嗙被澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; + +//#endregion + +//#region ====================== 鎶藉眽鏍戞暟鎹� ====================== +const catalogOrgDrawerIsShow = ref(false); +const catalogOrgDrawerListsData = ref([]); +const catalogOrgDrawerListLoading = ref(false); +let currentCatalogOrgOrgID = ''; + +/**灞曠ず鐨勭洰褰曟暟鎹� */ +const displayCatalogOrgData = computed(() => { + return catalogOrgDrawerListsData.value.map((item) => { + let foundCatalog = { + // ID 鏄洰褰旾D + ID: '0', + Name: '-', + // CatalogID 鏄垎绫籌D + CatalogID: '0', + }; + + for (const value of flatTableData.value) { + if (value.ID === item.ChildID) { + foundCatalog = { + ID: item.ID, + Name: value.Name, + CatalogID: value.ID, + }; + break; + } + } + return foundCatalog; + }); +}); + +const getCatalogOrgDrawerListDataByID = async () => { + catalogOrgDrawerListLoading.value = true; + const res = await GetCatalogOrgByParentID({ ParentID: currentCatalogOrgOrgID }, props.request).finally(() => { + catalogOrgDrawerListLoading.value = false; + }); + if (res?.Code === 0) { + if (res.Data) { + catalogOrgDrawerListsData.value = res.Data; + } else { + catalogOrgDrawerListsData.value = []; + } + } else { + ElMessage.error('鑾峰彇鐩綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const currentCatalogOrgMapRow = ref(null); +const openCatalogOrgDrawer = (row?) => { + const { ID } = row; + currentCatalogOrgMapRow.value = row; + currentCatalogOrgOrgID = ID; + getCatalogOrgDrawerListDataByID(); + catalogOrgDrawerIsShow.value = true; +}; +//#endregion + +//#region ====================== 瑙e喅鎷栨嫿灞曞紑鐘舵�佸け鏁堥棶棰� ====================== +const treeTableExpandKeys = ref([]); + +const tableExpandChange = (row, expanded) => { + if (expanded) { + treeTableExpandKeys.value.push(row.ID); + } else { + const idx = treeTableExpandKeys.value.indexOf(row.ID); + treeTableExpandKeys.value.splice(idx, 1); + } +}; +//#endregion + +//#region ====================== 鍒嗙被灞炴�ц缃� ====================== +const propertySetDialogIsShow = ref(false); + +const propertyCheckTree = ref([]); +const propertyCheckTreeRef = ref<InstanceType<typeof ElTree>>(null); +let currentCatalog = null; + +const openPropertySetDialog = (row) => { + propertySetDialogIsShow.value = true; + currentCatalog = row; + getPropertyByCatalogID(); +}; + +const getCheckedKeys = (treeData: any) => { + const checkedKeys = []; + const getKeys = (treeData: any) => { + for (const item of treeData) { + if (item.Have) { + checkedKeys.push(item.LogicalID); + } + if (item.Children && item.Children.length !== 0) { + getKeys(item.Children); + } + } + }; + getKeys(treeData); + return checkedKeys; +}; +const propertyCheckTreeLoading = ref(false); +const getPropertyByCatalogID = async () => { + propertyCheckTreeLoading.value = true; + const res = await GetHaveLogicalTreeList({ CatalogID: currentCatalog?.ID }, props.request).finally(() => { + propertyCheckTreeLoading.value = false; + }); + if (res?.Code === 0) { + if (res.Data) { + propertyCheckTree.value = res.Data; + const checkedKeys = getCheckedKeys(propertyCheckTree.value); + + propertyCheckTreeRef.value.setCheckedKeys(checkedKeys); + } + } else { + ElMessage.error('鑾峰彇灞炴�уけ璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; + +const closePropertySetDialog = () => { + propertySetDialogIsShow.value = false; + propertyCheckTreeRef.value.setCheckedNodes([]); +}; +// 鍙跺瓙鑺傜偣鍚岃鏄剧ず鏍峰紡 +const treeNodeClass = (node) => { + let addClass = true; // 娣诲姞鍙跺瓙鑺傜偣鍚岃鏄剧ず鏍峰紡 + for (const key in node.Children) { + // 濡傛灉瀛樺湪瀛愯妭鐐归潪鍙跺瓙鑺傜偣锛屼笉娣诲姞鏍峰紡 + if (node.Children[key].Children?.length ?? 0 > 0) { + addClass = false; + break; + } + } + const checkboxClass = node.LogicalType === 'sys-prop-group' ? 'sys-prop-group' : 'sys-prop'; + const penultimateClass = addClass ? 'penultimate-node' : ''; + const treeNodeClass = checkboxClass + ' ' + penultimateClass; + return treeNodeClass; +}; + +const submitPropertySetForm = async () => { + const checkedKeys = propertyCheckTreeRef.value + .getCheckedNodes() + .filter((item) => item.LogicalType === 'sys-prop' && !item.Inherit) + .map((item) => item.LogicalID); + const res = await SetCatalogMapProperty({ CatalogID: currentCatalog?.ID, PropIds: checkedKeys }, props.request); + if (res?.Code === 0) { + if (res.Data) { + propertySetDialogIsShow.value = false; + ElMessage.success('璁剧疆鎴愬姛'); + } else { + ElMessage.info('鏈慨鏀�'); + } + } else { + ElMessage.error('璁剧疆澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion + +//#region ======================璁剧疆鐩綍鎿嶄綔, dialog init====================== + +const catalogOrgSetDialogIsShow = ref(false); +const catalogOrgTableLoading = ref(false); +const catalogOrgCheckTableRef = ref<TableInstance>(null); + +const catalogOrgTableForm = ref({}); +const filteredTableData = ref([]); + +const setCatalogOrgTableData = () => { + filteredTableData.value = deepClone( + treeTableData.value.filter((item) => item.RootID !== IDRootMap[currentCatalogOrgMapRow.value.ID]) + ) as any[]; + travelTree(filteredTableData.value, (value) => { + value.children = value.Children; + }); + const checkedKeysObj = {}; + displayCatalogOrgData.value.forEach((value) => { + if (!checkedKeysObj[value.CatalogID]) { + checkedKeysObj[value.CatalogID] = 1; + } else { + checkedKeysObj[value.CatalogID]++; + } + }); + + nextTick(() => { + nextTick(() => { + catalogOrgCheckTableRef.value?.clearSelection(); + const catalogIDCount = {}; + travelTree( + filteredTableData.value, + (value) => { + const IDMapCount = checkedKeysObj[value.ID]; + if (IDMapCount) { + catalogOrgCheckTableRef.value?.toggleRowSelection(value, true); + } else { + catalogOrgCheckTableRef.value?.toggleRowSelection(value, false); + } + + catalogIDCount[value.ID] = IDMapCount || 1; + }, + null, + false, + 'children' + ); + catalogOrgTableForm.value = catalogIDCount; + }); + }); +}; + +const userSelectCatalogOrg = (checkedRow, currentRow) => { + const isChecked = checkedRow.includes(currentRow); + if (isChecked) { + if (currentRow.children?.length > 0) { + for (const item of currentRow.children) { + catalogOrgCheckTableRef.value?.toggleRowSelection(item, false); + } + } + } +}; +const openOperateCatalogOrgSetDialog = () => { + resetCatalogOrgTable(); + setCatalogOrgTableData(); + catalogOrgSetDialogIsShow.value = true; +}; +// 灞曞紑鐨� tree +const catalogOrgExpandRowKeys = ref([]); +const resetCatalogOrgTable = () => { + catalogOrgExpandRowKeys.value = []; +}; +const closeCatalogOrgSetDialog = () => { + catalogOrgSetDialogIsShow.value = false; +}; + +const submitCatalogOrgSetValue = async () => { + const selectedRows = catalogOrgCheckTableRef.value.getSelectionRows(); + const CatalogIDs = []; + selectedRows.forEach((row) => { + const count = catalogOrgTableForm.value[row.ID]; + for (let index = 0; index < count; index++) { + CatalogIDs.push(row.ID); + } + }); + const sendParams = { + ParentID: currentCatalogOrgOrgID, + ChildIds: CatalogIDs, + }; + catalogOrgTableLoading.value = true; + const res = await SetCatalogOrg(sendParams, props.request).finally(() => { + catalogOrgTableLoading.value = false; + }); + if (res?.Code === 0) { + if (res.Data) { + closeCatalogOrgSetDialog(); + getCatalogOrgDrawerListDataByID(); + ElMessage.success('璁剧疆鐩綍鎴愬姛'); + } else { + ElMessage.error('璁剧疆鐩綍澶辫触'); + } + } else { + ElMessage.error('璁剧疆鐩綍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; + +//#endregion +//#region ====================== 鏇存敼璁惧鐖剁骇 ====================== +const parentDlgIsShow = ref(false); +const parentDlgMapRow = ref(null); +const openParentDlg = (row?) => { + parentDlgMapRow.value = row; + parentDlgIsShow.value = true; +}; +const submitParentForm = (res) => { + getTableData(); +}; +//#endregion +onMounted(() => { + getListTreeData(); +}); +</script> +<style scoped lang="scss"> +:deep(.sys-prop-group > .el-tree-node__content > .el-checkbox) { + display: none; +} +.titleSlotRight { + display: flex; + align-items: center; + justify-content: flex-end; +} +</style> diff --git a/src/projectCom/basic/constants.ts b/src/projectCom/basic/constants.ts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/projectCom/basic/constants.ts diff --git a/src/projectCom/basic/flag/FlagManageCom.vue b/src/projectCom/basic/flag/FlagManageCom.vue new file mode 100644 index 0000000..d1e60b8 --- /dev/null +++ b/src/projectCom/basic/flag/FlagManageCom.vue @@ -0,0 +1,319 @@ +<template> + <el-row :gutter="8" class="h100"> + <el-col :span="4" :xs="24" class="h100"> + <el-card shadow="hover" class="h100 left-tree-card" v-loading="treeLoading"> + <LeftTreeByMgr + title-name="绫诲瀷鍒楄〃" + :treedata="listTreeData" + :current-node-key="currentListID" + :default-props="{ + children: 'Children', + label: 'LogicalName', + id: 'LogicalID', + }" + :folder-icon="(node, data) => data.LogicalType === MODULE_CODE" + :default-expand-all="true" + @click="handleClickNode" + > + </LeftTreeByMgr> + </el-card> + </el-col> + <el-col :span="20" :xs="24" class="flex-column h100"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <el-form :inline="true" :model="queryParams"> + <el-form-item label="鏍囩鍚嶇О" prop="Name"> + <el-input v-model="queryParams.Name" style="width: 226.4px" placeholder="鍚嶇О" clearable></el-input> + </el-form-item> + + <el-form-item> + <el-button type="primary" icon="ele-Search" @click="handleQueryTable"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="resetQuery">閲嶇疆 </el-button> + <el-button icon="ele-Plus" @click="openOperateDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch + v-model="isDragStatus" + @change="handleDragStatus" + inline-prompt + active-icon="ele-Check" + inactive-icon="ele-Close" + > + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <el-table + v-loading="tableLoading" + ref="draggableTableRef" + border + row-key="ID" + :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ textAlign: 'center' }" + :data="displayTableData" + style="width: 100%" + highlight-current-row + > + <el-table-column prop="Name" label="鍚嶇О" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Description" width="550" label="璇存槑" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" fixed="right" show-overflow-tooltip> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateDialog(scope.row)"> 缂栬緫 </el-button> + <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentRow(scope.row)"> 鍒犻櫎 </el-button> + </template> + </el-table-column> + </el-table> + </el-card> + <el-dialog :destroy-on-close="true" v-model="dialogIsShow" width="400" :close-on-click-modal="false" @closed="closeDialog"> + <template #header> + <div style="color: #fff"> + <SvgIcon :name="dialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ dialogTitle }} </span> + </div> + </template> + + <el-form :model="dialogFormValue" ref="dialogFormRef" :rules="dialogFormRules" label-width="55"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="dialogFormValue.Name"></el-input> + </el-form-item> + + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="dialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + </el-col> + </el-row> +</template> + +<script setup lang="ts"> +import type { FormInstance, FormRules } from 'element-plus'; +import { ElMessage, ElMessageBox } from 'element-plus'; +import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; +import type { PropType } from 'vue'; +import { ref, onMounted, computed } from 'vue'; +import { deepClone } from '/@/utils/other'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +import { useTableSort } from '/@/hooks/useTableSort'; +import { + DeleteAFlag, + GetTypeListTreeData, + GetAllFlagByID, + GetIsExistFlagName, + InsertAFlag, + UpdateAFlag, + UpdateFlagSorter, +} from '/@/api/basic/flagInfo'; +import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { MODULE_CODE } from '/@/constants'; + +const props = defineProps({ + request: { + type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, + }, +}); +//#region ====================== 宸︿晶鏍戞暟鎹紝tree with select init ====================== +const treeLoading = ref(false); + +const currentTreeNode = ref(null); + +const listTreeData = ref([]); +const currentListID = ref(''); +const handleClickNode = (data) => { + currentTreeNode.value = data; + currentListID.value = data.LogicalID; + + if (data.LogicalType === MODULE_CODE) { + tableData.value = []; + return; + } + + getTableData(); +}; +const getListTreeData = async () => { + treeLoading.value = true; + const res = await GetTypeListTreeData(props.request).finally(() => { + treeLoading.value = false; + }); + if (res?.Code === 0) { + listTreeData.value = res.Data || []; + const firstListTreeNode = listTreeData.value[0]?.Children[0]; + if (firstListTreeNode) { + handleClickNode(firstListTreeNode); + } else { + tableData.value = []; + currentTreeNode.value = null; + currentListID.value = null; + } + } else { + ElMessage.error('鑾峰彇绫诲瀷鍒楄〃澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏁版嵁锛宼able init ====================== +const tableLoading = ref(false); +const tableData = ref([]); +const isDragStatus = ref(false); +const getTableData = async () => { + tableLoading.value = true; + const res = await GetAllFlagByID({ TypeID: currentListID.value }, props.request).finally(() => { + tableLoading.value = false; + }); + if (res?.Code === 0) { + tableData.value = res.Data || []; + } else { + ElMessage.error('鑾峰彇鏍囩澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const deleteCurrentRow = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎鏍囩锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteAFlag( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎鏍囩鎴愬姛'); + getTableData(); + } else { + ElMessage.error('鍒犻櫎鏍囩澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎鏍囩澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏌ヨ銆佹帓搴忥紝search form init ====================== +const queryParams = ref({ + Name: '', +}); +const { handleDragStatus, draggableTableRef } = useTableSort( + tableData, + UpdateFlagSorter, + getTableData, + undefined, + false, + props.request +); + +const { resetQuery, handleQueryTable, displayTableData } = useQueryTable(tableData, queryParams, getTableData); + +//#endregion + +//#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init====================== +const isEditDialog = ref(false); +const dialogTitle = computed(() => { + return isEditDialog.value ? '淇敼鏍囩' : '娣诲姞鏍囩'; +}); +const dialogHeaderIcon = computed(() => { + return isEditDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const dialogFormValue = ref({ + Name: '', + Description: '', +}) as any; +const dialogIsShow = ref(false); +const dialogFormRef = ref<FormInstance>(null); + +const initialValue = ref(''); + +const { uniquenessValidator: nameValidator } = useValidateUniqueness( + GetIsExistFlagName, + initialValue, + '鏍囩鍚嶇О', + 'Name', + { + TypeID: currentListID, + }, + false, + props.request +); + +//#endregion + +const dialogFormRules = ref<FormRules>({ + Name: [{ required: true, validator: nameValidator as any, trigger: 'blur' }], +}); +const currentRow = ref(null); +const openOperateDialog = (row?) => { + if (!currentListID.value) { + return ElMessage.warning('璇峰厛閫夋嫨绫诲瀷锛�'); + } + if (row) { + isEditDialog.value = true; + initialValue.value = row.Name; + currentRow.value = row; + const { ID, Name, Description } = row; + dialogFormValue.value = deepClone({ ID, Name, Description }); + } else { + if (currentTreeNode.value.LogicalType === MODULE_CODE) return ElMessage.warning('璇峰厛閫夋嫨绯荤粺绫诲瀷鍐嶆坊鍔狅紒'); + initialValue.value = ''; + isEditDialog.value = false; + dialogFormValue.value = { Name: '', Description: '' }; + } + dialogIsShow.value = true; +}; + +const closeDialog = () => { + dialogIsShow.value = false; + dialogFormRef.value.clearValidate(); +}; + +const submitFormValue = async () => { + const valid = await dialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditDialog.value) { + const res = await UpdateAFlag(dialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closeDialog(); + ElMessage.success('淇敼鏍囩鎴愬姛'); + } else { + ElMessage.error('淇敼鏍囩澶辫触'); + } + } else { + ElMessage.error('淇敼鏍囩澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertAFlag({ ...dialogFormValue.value, TypeID: currentListID.value }, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closeDialog(); + ElMessage.success('娣诲姞鏍囩鎴愬姛'); + } else { + ElMessage.error('娣诲姞鏍囩澶辫触'); + } + } else { + ElMessage.error('娣诲姞鏍囩澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; + +//#endregion + +onMounted(() => { + getListTreeData(); +}); +</script> +<style scoped lang="scss"></style> diff --git a/src/projectCom/basic/prop/PropManageCom.vue b/src/projectCom/basic/prop/PropManageCom.vue new file mode 100644 index 0000000..0c33969 --- /dev/null +++ b/src/projectCom/basic/prop/PropManageCom.vue @@ -0,0 +1,872 @@ +<template> + <el-row :gutter="8" class="h100"> + <el-col :span="4" :xs="24" class="h100"> + <el-card shadow="hover" class="h100 left-tree-card" v-loading="treeLoading"> + <LeftTreeByMgr + ref="leftTreeRef" + title-name="灞炴�х粍鍒楄〃" + :show-add="true" + :select-is-show="true" + :showSelectNodeIcon="true" + :selectFolderIcon="(_, data) => data.LogicalType === MODULE_CODE" + :select-data="selectTreeData" + :show-more-operate="true" + :select-props="{ + id: 'LogicalID', + label: 'LogicalName', + children: 'Children', + }" + :default-select-value="currentSelectID" + :folder-icon="() => false" + @selectchange="selectNodeChange" + :treedata="listTreeData" + :current-node-key="currentListID" + :show-sorter="true" + @click="handleClickNode" + @node-drag-end="dragNodeEnd" + @tree-edit="openOperatePropertyGroupDialog" + @tree-delete="deleteCurrentPropertyGroup" + @tree-add="openOperatePropertyGroupDialog" + > + </LeftTreeByMgr> + </el-card> + </el-col> + <el-col :span="20" :xs="24" class="flex-column h100"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <el-form :inline="true" :model="queryParams"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input v-model="queryParams.Name" style="width: 226.4px" placeholder="鍚嶇О" clearable></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input v-model="queryParams.Code" style="width: 226.4px" placeholder="缂栫爜" clearable /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="ele-Search" @click="handleQueryTable"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="resetQuery">閲嶇疆 </el-button> + <el-button icon="ele-Plus" @click="openOperatePropertyDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch + v-model="isDragStatus" + @change="handleDragStatus" + inline-prompt + active-icon="ele-Check" + inactive-icon="ele-Close" + > + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <el-table + v-loading="tableLoading" + ref="draggableTableRef" + border + row-key="ID" + :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ textAlign: 'center' }" + :data="displayTableData" + style="width: 100%" + highlight-current-row + > + <el-table-column type="index" label="搴忓彿" width="55" align="center" /> + <el-table-column prop="Name" label="鍚嶇О" show-overflow-tooltip /> + <el-table-column prop="Code" label="缂栫爜" show-overflow-tooltip /> + <el-table-column prop="Format" label="鏍煎紡" show-overflow-tooltip> + <template #default="scope"> + {{ FORMAT_MAP[scope.row.Format] }} + </template> + </el-table-column> + + <el-table-column prop="UnitName" label="鍗曚綅" show-overflow-tooltip /> + <el-table-column prop="DefaultValue" label="榛樿鍊�" align="center" show-overflow-tooltip> </el-table-column> + <el-table-column prop="IsNull" label="鍙┖" show-overflow-tooltip> + <template #default="scope"> + <el-tag type="success" v-if="scope.row.IsNull">鏄�</el-tag> + <el-tag type="danger" v-else>鍚�</el-tag> + </template> + </el-table-column> + + <el-table-column prop="Description" label="璇存槑" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" width="240" fixed="right" align="center" show-overflow-tooltip> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperatePropertyDialog(scope.row)"> + 缂栬緫 + </el-button> + <el-button icon="ele-Grid" size="small" text type="primary" @click="openDrawer(scope.row)"> 灞炴�ч�夐」 </el-button> + + <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentRow(scope.row)"> 鍒犻櫎 </el-button> + </template> + </el-table-column> + </el-table> + </el-card> + </el-col> + <!-- property 澧炲姞銆佷慨鏀规暟鎹璇濇 --> + <el-dialog + :destroy-on-close="true" + v-model="propertyDialogIsShow" + width="500" + :close-on-click-modal="false" + @closed="closePropertyDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon :name="propertyDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ propertyDialogTitle }} </span> + </div> + </template> + + <el-form :model="propertyDialogFormValue" ref="propertyDialogFormRef" :rules="propertyDialogFormRules" label-width="80"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="propertyDialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input placeholder="璇疯緭鍏ュ敮涓�缂栫爜" v-model="propertyDialogFormValue.Code"></el-input> + </el-form-item> + + <el-form-item label="灞炴�ф牸寮�" prop="Format"> + <el-select v-model="propertyDialogFormValue.Format" class="w100" filterable @change="selectFormatChange"> + <el-option + v-for="item of Object.keys(FORMAT_MAP)" + :key="item" + :label="FORMAT_MAP[item]" + :value="parseInt(item)" + ></el-option> + </el-select> + </el-form-item> + <el-form-item label="鍗曚綅鍚嶇О" prop="UnitName"> + <el-input v-model="propertyDialogFormValue.UnitName" clearable /> + </el-form-item> + <el-form-item label="榛樿鍊�" prop="DefaultValue"> + <el-radio-group + class="w100" + v-if="propertyDialogFormValue.Format === PropertyFormatEnum.Boolean" + v-model="propertyDialogFormValue.DefaultValue" + > + <el-radio label="true" value="true"></el-radio> + <el-radio label="false" value="false"></el-radio> + </el-radio-group> + <el-input v-else v-model="propertyDialogFormValue.DefaultValue"></el-input> + </el-form-item> + <el-form-item label="鏄惁鍙┖" prop="IsNull"> + <el-checkbox v-model="propertyDialogFormValue.IsNull" /> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input v-model="propertyDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closePropertyDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitPropertyFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + <!-- propertyGroup 澧炲姞銆佷慨鏀规暟鎹璇濇 --> + <el-dialog + :destroy-on-close="true" + v-model="propertyGroupDialogIsShow" + width="400" + :close-on-click-modal="false" + @closed="closePropertyGroupDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon + :name="propertyGroupDialogHeaderIcon" + :size="16" + style="margin-right: 3px; display: inline; vertical-align: middle" + /> + <span> {{ propertyGroupDialogTitle }} </span> + </div> + </template> + + <el-form + :model="propertyGroupDialogFormValue" + ref="propertyGroupDialogFormRef" + :rules="propertyGroupDialogFormRules" + label-width="55" + > + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="propertyGroupDialogFormValue.Name"></el-input> + </el-form-item> + + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="propertyGroupDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closePropertyGroupDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitPropertyGroupFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + <!-- 灞炴�ч�夐」淇敼銆佺紪杈慸ialog --> + <el-dialog + :destroy-on-close="true" + v-model="choiceDialogIsShow" + width="400" + :close-on-click-modal="false" + @closed="closeChoiceDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon :name="choiceDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ choiceDialogTitle }} </span> + </div> + </template> + + <el-form :model="choiceDialogFormValue" ref="choiceDialogFormRef" :rules="choiceDialogFormRules" label-width="55"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="choiceDialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="閫夐」" prop="Choice"> + <el-input placeholder="璇疯緭鍏ラ�夐」" v-model="choiceDialogFormValue.Choice"></el-input> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="choiceDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template v-slot:footer> + <div> + <el-button @click="closeChoiceDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitChoiceFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + <!-- 鎶藉眽琛ㄦ牸 --> + <div class="custom-drawer"> + <el-drawer v-model="drawerIsShow" direction="rtl" size="30%"> + <template #header> + <div> + <SvgIcon name="ele-Grid" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ currentProp?.Name + ' - 灞炴�ч�夐」閰嶇疆' }} </span> + </div> + </template> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <!-- 鏌ヨ銆侀噸缃�佹帓搴忋�佸鍔犺〃鍗� --> + <el-form :inline="true" :model="choiceQueryParams"> + <el-form-item> + <el-button icon="ele-Plus" @click="openOperateChoiceDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch + v-model="isChoiceTableDrag" + @change="handleChoiceTableDrag" + inline-prompt + active-icon="ele-Check" + inactive-icon="ele-Close" + > + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <!-- 鏁版嵁灞曠ず琛ㄦ牸 --> + <el-table + v-loading="choiceTableLoading" + class="h100" + ref="draggableChoiceTableRef" + border + size="small" + row-key="ID" + :row-class-name="isChoiceTableDrag ? 'cursor-move' : 'cursor-pointer'" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ textAlign: 'center' }" + :data="choiceTableData" + style="width: 100%" + highlight-current-row + > + <el-table-column prop="Name" label="鍚嶇О" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Choice" label="閫夐」" show-overflow-tooltip /> + <el-table-column prop="Description" label="璇存槑" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" fixed="right" width="180" show-overflow-tooltip> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateChoiceDialog(scope.row)"> + 缂栬緫 + </el-button> + <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentChoiceRow(scope.row)"> + 鍒犻櫎 + </el-button> + </template> + </el-table-column> + </el-table> + </el-card> + </el-drawer> + </div> + </el-row> +</template> + +<script setup lang="ts"> +import type { FormInstance, FormRules } from 'element-plus'; +import { ElMessage, ElMessageBox } from 'element-plus'; +import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; +import type { PropType } from 'vue'; +import { ref, onMounted, computed, nextTick } from 'vue'; +import { deepClone } from '/@/utils/other'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +import { updateSort, useTableSort } from '/@/hooks/useTableSort'; +import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; +import { + // 鑾峰彇绯荤粺绫诲瀷 + GetSysTypeSelectTreeData, + // 灞炴�ф帴鍙� + DeleteAProperty, + GetAllPropertyByID, + GetIsExistPropertyCode, + InsertAProperty, + UpdateAProperty, + UpdatePropertySorter, + // 灞炴�х粍鎺ュ彛 + GetPropertyGroupListTreeData, + DeleteAPropertyGroup, + InsertAPropertyGroup, + UpdateAPropertyGroup, + UpdatePropertyGroupSorter, +} from '/@/api/basic/property/propertyManage'; +import { + DeleteAPropChoice, + GetAllPropChoice, + InsertAPropChoice, + UpdateAPropChoice, + UpdatePropChoiceSorter, +} from '/@/api/basic/property/propChoice'; + +import { FORMAT_MAP, PropertyFormatEnum } from '/@/projectCom/basic/types'; + +import { booleanRegex, dateRegex, integerRegex, numberRegex } from '/@/utils/toolsValidate'; +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { MODULE_CODE } from '/@/constants'; +import { arrayIsEmpty } from '/@/utils/util'; +const props = defineProps({ + request: { + type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, + }, +}); + +//#region ====================== 宸︿晶鏍戞暟鎹紝tree with select init ====================== +const treeLoading = ref(false); + +const selectTreeData = ref([]); +const currentSelectID = ref(''); +const selectNodeChange = (data) => { + currentSelectID.value = data.LogicalID; + if (data.LogicalType === MODULE_CODE) { + listTreeData.value = []; + tableData.value = []; + return; + } + getListTreeData(true); +}; + +const getSelectTreeData = async () => { + treeLoading.value = true; + const res = await GetSysTypeSelectTreeData(props.request).finally(() => { + treeLoading.value = false; + }); + if (res?.Code === 0) { + selectTreeData.value = res.Data || []; + const firstSelectTreeNode = selectTreeData.value[0]?.Children[0]; + if (firstSelectTreeNode) { + selectNodeChange(firstSelectTreeNode); + } else { + listTreeData.value = []; + tableData.value = []; + } + } else { + ElMessage.error('鑾峰彇绯荤粺绫诲瀷鍒楄〃澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const leftTreeRef = ref(null); +const listTreeData = ref([]); +const currentListID = ref(''); +const currentTreeNode = ref(null); + +const handleClickNode = (data) => { + currentTreeNode.value = data; + nextTick(() => { + leftTreeRef.value?.treeRef.setCurrentKey(data.ID); + }); + + currentListID.value = data.ID; + getTableData(); +}; +const getListTreeData = async (selectFirst = false) => { + treeLoading.value = true; + const res = await GetPropertyGroupListTreeData( + { + TypeID: currentSelectID.value, + }, + props.request + ).finally(() => { + treeLoading.value = false; + }); + if (res?.Code === 0) { + listTreeData.value = res.Data || []; + if (selectFirst) { + const firstListTreeNode = listTreeData.value[0]; + if (firstListTreeNode) { + handleClickNode(firstListTreeNode); + } else { + tableData.value = []; + currentTreeNode.value = null; + currentListID.value = null; + } + } else { + currentTreeNode.value && handleClickNode(currentTreeNode.value); + } + } else { + ElMessage.error('鑾峰彇灞炴�х粍鍒楄〃澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion + +//#region ====================== 宸︿晶鏍戞嫋鎷� ====================== +const dragNodeEnd = async (draggingNode, dropNode, dropType, ev, originTreeData) => { + updateSort( + listTreeData, + listTreeData.value, + originTreeData, + () => { + handleClickNode(draggingNode.data); + getListTreeData(); + }, + UpdatePropertyGroupSorter, + () => { + handleClickNode(draggingNode.data); + }, + undefined, + props.request + ); +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏁版嵁锛宼able init ====================== +const tableLoading = ref(false); +const tableData = ref([]); +const isDragStatus = ref(false); +const getTableData = async () => { + tableLoading.value = true; + const res = await GetAllPropertyByID({ GroupID: currentListID.value }, props.request).finally(() => { + tableLoading.value = false; + }); + if (res?.Code === 0) { + tableData.value = res.Data || []; + } else { + ElMessage.error('鑾峰彇灞炴�уけ璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const deleteCurrentRow = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎灞炴�э細銆�${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteAProperty( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎灞炴�ф垚鍔�'); + getTableData(); + } else { + ElMessage.error('鍒犻櫎灞炴�уけ璐�'); + } + } else { + ElMessage.error('鍒犻櫎灞炴�уけ璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏌ヨ銆佹帓搴忥紝search form init ====================== +const queryParams = ref({ + Name: '', + Code: '', +}); +const { handleDragStatus, draggableTableRef } = useTableSort( + tableData, + UpdatePropertySorter, + getTableData, + undefined, + false, + props.request +); + +const { resetQuery, handleQueryTable, displayTableData } = useQueryTable(tableData, queryParams, getTableData); + +//#endregion + +const selectFormatChange = () => { + propertyDialogFormValue.value.DefaultValue = ''; + propertyDialogFormRef.value.clearValidate(['DefaultValue']); +}; + +//#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init====================== +const isEditPropertyDialog = ref(false); +const propertyDialogTitle = computed(() => { + return isEditPropertyDialog.value ? '淇敼灞炴��' : '娣诲姞灞炴��'; +}); +const propertyDialogHeaderIcon = computed(() => { + return isEditPropertyDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const propertyDialogFormValue = ref(null); +const propertyDialogIsShow = ref(false); +const propertyDialogFormRef = ref<FormInstance>(null); +const propertyInitialCode = ref(''); + +const { uniquenessValidator: propertyCodeValidator } = useValidateUniqueness( + GetIsExistPropertyCode, + propertyInitialCode, + '缂栫爜', + 'Code', + { + TypeID: currentSelectID, + }, + false, + props.request +); + +const defaultValueValidator = (rule: any, value: any, callback: any) => { + if (!value) { + callback(); + } else if (!propertyDialogFormValue.value.Format) { + callback('璇峰厛閫夋嫨灞炴�ф牸寮忥紝鍐嶅~鍐欓粯璁ゅ��'); + } else { + if (propertyDialogFormValue.value.Format === PropertyFormatEnum.Numeric && !numberRegex.test(value)) { + callback('璇疯緭鍏ユ暟瀛�'); + } else if ( + [PropertyFormatEnum.Bigint, PropertyFormatEnum.Integer].includes(propertyDialogFormValue.value.Format) && + !integerRegex.test(value) + ) { + callback('璇疯緭鍏ユ暣鏁�'); + } else if (PropertyFormatEnum.Time === propertyDialogFormValue.value.Format && !dateRegex.test(value)) { + callback('璇疯緭鍏ユ纭殑鏃ユ湡鏍煎紡锛坹yyy-MM-dd HH:mm:ss 鎴� yyyy-MM-dd锛�'); + } else if (PropertyFormatEnum.Boolean === propertyDialogFormValue.value.Format && !booleanRegex.test(value)) { + callback('璇烽�夋嫨 true 鎴� false'); + } else { + callback(); + } + } +}; + +const propertyDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Code: [{ required: true, validator: propertyCodeValidator as any, trigger: 'blur' }], + Format: [{ required: true, message: '璇烽�夋嫨鏍煎紡', trigger: 'change' }], + DefaultValue: [{ validator: defaultValueValidator as any, trigger: 'blur' }], +}); +const openOperatePropertyDialog = (row?) => { + if (!currentListID.value) { + return ElMessage.warning('璇峰厛閫夋嫨灞炴�х粍锛�'); + } + if (row) { + isEditPropertyDialog.value = true; + const { ID, Name, Format, UnitName, IsNull, DefaultValue, Code, Description } = row; + propertyInitialCode.value = Code; + propertyDialogFormValue.value = deepClone({ ID, Name, Format, UnitName, IsNull, DefaultValue, Code, Description }); + } else { + isEditPropertyDialog.value = false; + propertyInitialCode.value = ''; + propertyDialogFormValue.value = { + GroupID: currentListID.value, + Name: '', + Format: null, + UnitName: '', + IsNull: true, + DefaultValue: '', + Code: '', + Description: '', + }; + } + propertyDialogIsShow.value = true; +}; + +const closePropertyDialog = () => { + propertyDialogIsShow.value = false; + propertyDialogFormRef.value.clearValidate(); +}; + +const submitPropertyFormValue = async () => { + const valid = await propertyDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditPropertyDialog.value) { + const res = await UpdateAProperty(propertyDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closePropertyDialog(); + ElMessage.success('淇敼灞炴�ф垚鍔�'); + } else { + ElMessage.error('淇敼灞炴�уけ璐�'); + } + } else { + ElMessage.error('淇敼灞炴�уけ璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertAProperty(propertyDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closePropertyDialog(); + ElMessage.success('娣诲姞灞炴�ф垚鍔�'); + } else { + ElMessage.error('娣诲姞灞炴�уけ璐�'); + } + } else { + ElMessage.error('娣诲姞灞炴�уけ璐�' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +//#region ====================== 澧炲姞銆佸垹闄ゅ睘鎬х粍鎿嶄綔, dialog init====================== +const isEditPropertyGroupDialog = ref(false); +const propertyGroupDialogTitle = computed(() => { + return isEditPropertyGroupDialog.value ? '淇敼灞炴�х粍' : '娣诲姞灞炴�х粍'; +}); +const propertyGroupDialogHeaderIcon = computed(() => { + return isEditPropertyGroupDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const propertyGroupDialogFormValue = ref(null); +const propertyGroupDialogIsShow = ref(false); +const propertyGroupDialogFormRef = ref<FormInstance>(null); + +const propertyGroupDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], +}); +const openOperatePropertyGroupDialog = (data?) => { + if (data) { + isEditPropertyGroupDialog.value = true; + const { ID, Name, Description } = data; + propertyGroupDialogFormValue.value = deepClone({ ID, Name, Description }); + } else { + isEditPropertyGroupDialog.value = false; + propertyGroupDialogFormValue.value = { TypeID: currentSelectID.value, Name: '', Description: '' }; + } + propertyGroupDialogIsShow.value = true; +}; + +const closePropertyGroupDialog = () => { + propertyGroupDialogIsShow.value = false; + propertyGroupDialogFormRef.value.clearValidate(); +}; + +const submitPropertyGroupFormValue = async () => { + const valid = await propertyGroupDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditPropertyGroupDialog.value) { + const res = await UpdateAPropertyGroup(propertyGroupDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getListTreeData(); + closePropertyGroupDialog(); + ElMessage.success('淇敼灞炴�х粍鎴愬姛'); + } else { + ElMessage.error('淇敼灞炴�х粍澶辫触'); + } + } else { + ElMessage.error('淇敼灞炴�х粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertAPropertyGroup(propertyGroupDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getListTreeData(); + closePropertyGroupDialog(); + ElMessage.success('娣诲姞灞炴�х粍鎴愬姛'); + } else { + ElMessage.error('娣诲姞灞炴�х粍澶辫触'); + } + } else { + ElMessage.error('娣诲姞灞炴�х粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +//#region ====================== 鍒犻櫎宸︿晶鏍戝睘鎬х粍鏁版嵁 ====================== + +const deleteCurrentPropertyGroup = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎灞炴�х粍锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteAPropertyGroup( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎灞炴�х粍鎴愬姛'); + getListTreeData(true); + } else { + ElMessage.error('鍒犻櫎灞炴�х粍澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎灞炴�х粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion +//#region ====================== 灞炴�ч�夐」 drawer ====================== +const drawerIsShow = ref(false); +const currentProp = ref(null); + +const openDrawer = (row: any) => { + drawerIsShow.value = true; + currentProp.value = row; + getChoiceTableData(); +}; +//#endregion +//#region ====================== 灞炴�ч�夐」CRUD ====================== +//#region ====================== 鑾峰彇銆佸垹闄よ〃鏍兼暟鎹� ====================== +const choiceTableLoading = ref(false); +const choiceTableData = ref([]); +const isChoiceTableDrag = ref(false); +const nextChoiceValue = computed(() => { + if (arrayIsEmpty(choiceTableData.value)) { + return '0'; + } else { + const lastItem = choiceTableData.value.at(-1); + if (integerRegex.test(lastItem.Choice)) { + return Number(lastItem.Choice) + 1 + ''; + } else { + return ''; + } + } +}); +const getChoiceTableData = async () => { + choiceTableLoading.value = true; + const res = await GetAllPropChoice({ PropID: currentProp.value.ID }, props.request).finally(() => { + choiceTableLoading.value = false; + }); + if (res?.Code === 0) { + choiceTableData.value = res.Data || []; + } else { + ElMessage.error('鑾峰彇灞炴�ч�夐」澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const deleteCurrentChoiceRow = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎灞炴�ч�夐」锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteAPropChoice( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎灞炴�ч�夐」鎴愬姛'); + getChoiceTableData(); + } else { + ElMessage.error('鍒犻櫎灞炴�ч�夐」澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎灞炴�ч�夐」澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +const choiceQueryParams = ref({ + Name: '', +}); +const { handleDragStatus: handleChoiceTableDrag, draggableTableRef: draggableChoiceTableRef } = useTableSort( + choiceTableData, + UpdatePropChoiceSorter, + getChoiceTableData, + undefined, + false, + props.request +); + +//#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init====================== +const isEditChoiceDialog = ref(false); +const choiceDialogTitle = computed(() => { + return isEditChoiceDialog.value ? '淇敼灞炴�ч�夐」' : '娣诲姞灞炴�ч�夐」'; +}); +const choiceDialogHeaderIcon = computed(() => { + return isEditChoiceDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const choiceDialogFormValue = ref(null); +const choiceDialogIsShow = ref(false); +const choiceDialogFormRef = ref<FormInstance>(null); + +const choiceDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Choice: [{ required: true, message: '璇疯緭鍏ュ睘鎬ч�夐」', trigger: 'blur' }], + DefaultValue: [{ validator: defaultValueValidator, trigger: 'blur' }], +}); +const openOperateChoiceDialog = (row?) => { + if (row) { + isEditChoiceDialog.value = true; + const { ID, Name, Choice, Description } = row; + choiceDialogFormValue.value = deepClone({ ID, Name, Choice, Description }); + } else { + isEditChoiceDialog.value = false; + choiceDialogFormValue.value = { PropID: currentProp.value.ID, Name: '', Choice: nextChoiceValue.value, Description: '' }; + } + choiceDialogIsShow.value = true; +}; + +const closeChoiceDialog = () => { + choiceDialogIsShow.value = false; + choiceDialogFormRef.value.clearValidate(); +}; + +const submitChoiceFormValue = async () => { + const valid = await choiceDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditChoiceDialog.value) { + const res = await UpdateAPropChoice(choiceDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getChoiceTableData(); + closeChoiceDialog(); + ElMessage.success('淇敼灞炴�ч�夐」鎴愬姛'); + } else { + ElMessage.error('淇敼灞炴�ч�夐」澶辫触'); + } + } else { + ElMessage.error('淇敼灞炴�ч�夐」澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertAPropChoice(choiceDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getChoiceTableData(); + closeChoiceDialog(); + ElMessage.success('娣诲姞灞炴�ч�夐」鎴愬姛'); + } else { + ElMessage.error('娣诲姞灞炴�ч�夐」澶辫触'); + } + } else { + ElMessage.error('娣诲姞灞炴�ч�夐」澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +onMounted(() => { + getSelectTreeData(); +}); +</script> +<style scoped lang="scss"></style> diff --git a/src/projectCom/basic/sys/alarm/level/AlarmLevelCom.vue b/src/projectCom/basic/sys/alarm/level/AlarmLevelCom.vue new file mode 100644 index 0000000..3289896 --- /dev/null +++ b/src/projectCom/basic/sys/alarm/level/AlarmLevelCom.vue @@ -0,0 +1,234 @@ +<template> + <div class="h100 flex-column"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <el-form :inline="true" :model="queryParams"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input v-model="queryParams.Name" style="width: 226.4px" placeholder="鍚嶇О" clearable /> + </el-form-item> + + <el-form-item> + <el-button type="primary" icon="ele-Search" @click="handleQueryTable"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="resetQuery">閲嶇疆 </el-button> + <el-button icon="ele-Plus" @click="openOperateDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch v-model="isDragStatus" @change="handleDragStatus" inline-prompt active-icon="ele-Check" inactive-icon="ele-Close"> + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <el-table + v-loading="tableLoading" + ref="draggableTableRef" + border + row-key="ID" + :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ textAlign: 'center' }" + :data="displayTableData" + style="width: 100%" + highlight-current-row + > + <el-table-column prop="Name" width="220" label="鍚嶇О" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Color" label="棰滆壊" show-overflow-tooltip> + <template #default="scope"> + <div class="w100 h100 flex-center"> + <div style="width: 65px; height: 25px" :style="'background-color:' + scope.row.Color"></div> + </div> + </template> + </el-table-column> + <el-table-column prop="Grade" label="鎶ヨ绛夌骇" show-overflow-tooltip /> + <el-table-column prop="Description" width="550" label="璇存槑" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" width="150" fixed="right" show-overflow-tooltip> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateDialog(scope.row)"> 缂栬緫 </el-button> + <el-button + icon="ele-Delete" + size="small" + text + type="danger" + @click=" + deleteCurrentRow(scope.row, '鎶ヨ绛夌骇', alarmLevelApi.DeleteABasicSysAlarmLevel, () => { + getTableData(); + }) + " + > + 鍒犻櫎 + </el-button> + </template> + </el-table-column> + </el-table> + </el-card> + <el-dialog :destroy-on-close="true" v-model="dialogIsShow" width="450" :close-on-click-modal="false" @closed="closeDialog"> + <template #header> + <div style="color: #fff"> + <SvgIcon :name="dialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ dialogTitle }} </span> + </div> + </template> + <el-form :model="dialogFormValue" ref="dialogFormRef" :rules="dialogFormRules" label-width="78"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="dialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="棰滆壊" prop="Color"> + <el-color-picker v-model="dialogFormValue.Color" /> + </el-form-item> + <el-form-item label="鎶ヨ绛夌骇" prop="Grade"> + <el-input-number class="w100" placeholder="璇疯緭鍏ユ姤璀︾瓑绾�" v-model="dialogFormValue.Grade"></el-input-number> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="dialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + + <template #footer> + <div> + <el-button @click="closeDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup lang="ts"> +import { ElMessage, FormInstance, FormRules } from 'element-plus'; + +import { ref, onMounted, computed, PropType } from 'vue'; +import { deepClone } from '/@/utils/other'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +import { useTableSort } from '/@/hooks/useTableSort'; + +import * as alarmLevelApi from '/@/api/basic/alarmLevel'; +import { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { deleteCurrentRow } from '/@/utils/util'; +import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; + +const props = defineProps({ + request: { + type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, + }, +}); + +//#region ====================== 琛ㄦ牸鏁版嵁锛宼able init ====================== +const tableLoading = ref(false); +const tableData = ref([]); +const isDragStatus = ref(false); +const getTableData = async () => { + tableLoading.value = true; + const res = await alarmLevelApi.GetAllBasicSysAlarmLevel(props.request).finally(() => { + tableLoading.value = false; + }); + if (res?.Code === 0) { + const resData = (res.Data || []) as []; + tableData.value = resData; + } else { + ElMessage.error('鑾峰彇鎶ヨ绛夌骇澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏌ヨ銆佹帓搴忥紝search form init ====================== + +const queryParams = ref({ + Name: '', +}); +const { handleDragStatus, draggableTableRef } = useTableSort( + tableData, + alarmLevelApi.UpdateBasicSysAlarmLevelSorter, + getTableData, + undefined, + false, + props.request +); + +const { resetQuery, handleQueryTable, displayTableData } = useQueryTable(tableData, queryParams, getTableData); + +//#endregion + +//#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init====================== +const isEditDialog = ref(false); +const dialogTitle = computed(() => { + return isEditDialog.value ? '淇敼鎶ヨ绛夌骇' : '娣诲姞鎶ヨ绛夌骇'; +}); +const dialogHeaderIcon = computed(() => { + return isEditDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const dialogFormValue = ref(null); +const dialogIsShow = ref(false); +const dialogFormRef = ref<FormInstance>(null); +const initialGrade = ref(null); +const { uniquenessValidator } = useValidateUniqueness( + alarmLevelApi.IsExistBasicSysAlarmLevelGrade, + initialGrade, + '鎶ヨ绛夌骇', + 'Grade', + undefined, + false, + props.request +); +const dialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Color: [{ required: true, message: '璇烽�夋嫨棰滆壊', trigger: 'blur' }], + Grade: [{ required: true, validator: uniquenessValidator as any, trigger: 'blur' }], +}); +const openOperateDialog = (row?) => { + if (row) { + isEditDialog.value = true; + const { ID, Name, Color, Grade, Description } = row; + initialGrade.value = Grade; + dialogFormValue.value = deepClone({ ID, Name, Color, Grade, Description }); + } else { + isEditDialog.value = false; + initialGrade.value = null; + dialogFormValue.value = { Name: '', Color: '', Grade: null, Description: '' }; + } + dialogIsShow.value = true; +}; +const closeDialog = () => { + dialogIsShow.value = false; + dialogFormRef.value.clearValidate(); +}; + +const submitFormValue = async () => { + const valid = await dialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditDialog.value) { + const res = await alarmLevelApi.UpdateABasicSysAlarmLevel(dialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closeDialog(); + ElMessage.success('淇敼鎶ヨ绛夌骇鎴愬姛'); + } else { + ElMessage.error('淇敼鎶ヨ绛夌骇澶辫触'); + } + } else { + ElMessage.error('淇敼鎶ヨ绛夌骇澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await alarmLevelApi.InsertABasicSysAlarmLevel(dialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTableData(); + closeDialog(); + ElMessage.success('娣诲姞鎶ヨ绛夌骇鎴愬姛'); + } else { + ElMessage.error('娣诲姞鎶ヨ绛夌骇澶辫触'); + } + } else { + ElMessage.error('娣诲姞鎶ヨ绛夌骇澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; + +//#endregion + +onMounted(() => { + getTableData(); +}); +</script> +<style scoped lang="scss"></style> diff --git a/src/projectCom/basic/sys/alarm/types.ts b/src/projectCom/basic/sys/alarm/types.ts new file mode 100644 index 0000000..f676b9b --- /dev/null +++ b/src/projectCom/basic/sys/alarm/types.ts @@ -0,0 +1,11 @@ +export const enum AlarmStatusEnum { + Creation = 0, + Processing = 1, + FeedBack = 2, +} + +export const alarmStatusMap: Record<AlarmStatusEnum, string> = { + [AlarmStatusEnum.Creation]: '鍒涘缓', + [AlarmStatusEnum.Processing]: '澶勭悊', + [AlarmStatusEnum.FeedBack]: '鍙嶉', +}; diff --git a/src/projectCom/basic/sys/paras/SysParasCom.vue b/src/projectCom/basic/sys/paras/SysParasCom.vue new file mode 100644 index 0000000..63eb2d9 --- /dev/null +++ b/src/projectCom/basic/sys/paras/SysParasCom.vue @@ -0,0 +1,646 @@ +<template> + <!-- 宸︿晶鍒嗙被鐩綍鏍戯紝涓婇儴琛ㄦ牸鎿嶄綔 card锛屼笅閮� table 鏁版嵁灞曠ず --> + <div class="h100"> + <el-row :gutter="8" class="h100"> + <el-col :span="4" :xs="24" class="h100"> + <el-card shadow="hover" class="h100" v-loading="treeLoading"> + <!-- 鐩綍鏍� --> + <LeftTreeByMgr + class="h100 left-tree-card" + ref="leftTreeRef" + :treedata="listTreeData" + title-name="鍒嗙粍鍒楄〃" + :show-more-operate="true" + :show-add="true" + :folderIcon="() => false" + :current-node-key="currentListID" + :expand-on-click-node="false" + :default-expand-all="true" + :show-sorter="true" + @click="handleClickNode" + :customDropdown="true" + @tree-add="openOperateGroupDialog" + @node-drag-end="dragNodeEnd" + > + <template #customDropdown="{ data, node }"> + <el-dropdown-menu> + <el-dropdown-item> + <el-button + @click.stop="() => openOperateGroupDialog(data)" + link + type="primary" + icon="ele-Edit" + style="cursor: pointer" + > + 缂栬緫 + </el-button> + </el-dropdown-item> + <el-dropdown-item> + <el-button link type="danger" @click.stop="() => deleteCurrentGroup(data)" icon="ele-Delete" style="cursor: pointer"> + 鍒犻櫎 + </el-button> + </el-dropdown-item> + <el-dropdown-item> + <el-button @click.stop="() => openParentDlg(data)" link type="primary" icon="ele-Menu" style="cursor: pointer"> + 鐖剁骇 + </el-button> + </el-dropdown-item> + </el-dropdown-menu> + </template> + </LeftTreeByMgr> + </el-card> + </el-col> + + <el-col :span="20" :xs="24" class="flex-column h100"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <!-- 鏌ヨ銆侀噸缃�佹帓搴忋�佸鍔犺〃鍗� --> + <el-form :inline="true" :model="parasQueryParams"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input v-model="parasQueryParams.Name" style="width: 226.4px" placeholder="鍚嶇О" clearable></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input v-model="parasQueryParams.Code" style="width: 226.4px" placeholder="缂栫爜" clearable /> + </el-form-item> + + <el-form-item> + <el-button type="primary" icon="ele-Search" @click="handleQueryParasTable"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="resetParasQuery">閲嶇疆 </el-button> + <el-button icon="ele-Plus" @click="openOperateParasDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch + :disabled="displayParasTableData !== parasTableData" + v-model="isParasTableDrag" + @change="handleParasTableDrag" + inline-prompt + active-icon="ele-Check" + inactive-icon="ele-Close" + > + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <!-- 鏁版嵁灞曠ず琛ㄦ牸 --> + <el-table + v-loading="parasTableLoading" + ref="draggableTypeTableRef" + border + row-key="ID" + :row-class-name="isParasTableDrag ? 'cursor-move' : 'cursor-pointer'" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ textAlign: 'center' }" + :data="displayParasTableData" + style="width: 100%" + highlight-current-row + > + <el-table-column prop="Name" width="240" label="鍚嶇О" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Code" width="300" label="缂栫爜" show-overflow-tooltip /> + <el-table-column prop="Format" label="鏍煎紡" show-overflow-tooltip> + <template #default="scope"> + {{ FORMAT_MAP[scope.row.Format] }} + </template> + </el-table-column> + <el-table-column prop="PValue" label="鍙傛暟鍊�" show-overflow-tooltip /> + <el-table-column prop="Description" label="璇存槑" width="550" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" width="160" fixed="right" show-overflow-tooltip> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateParasDialog(scope.row)"> + 缂栬緫 + </el-button> + <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentTypeRow(scope.row)"> + 鍒犻櫎 + </el-button> + </template> + </el-table-column> + </el-table> + </el-card> + </el-col> + </el-row> + <el-dialog + :destroy-on-close="true" + v-model="groupDialogIsShow" + width="400" + :close-on-click-modal="false" + @closed="closeGroupDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon :name="groupDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ groupDialogTitle }} </span> + </div> + </template> + + <el-form :model="groupDialogFormValue" ref="groupDialogFormRef" :rules="groupDialogFormRules" label-width="55"> + <el-form-item label="鐖剁骇" v-if="!isEditGroupDialog" prop="ParentID"> + <el-tree-select + default-expand-all + filterable + style="width: 100%" + v-model="groupDialogFormValue.ParentID" + :props="{ + id: 'ID', + label: 'Name', + children: 'Children', + }" + :data="listTreeData" + node-key="ID" + :clearable="true" + :accordion="true" + :expandNode="false" + :check-strictly="true" + placeholder="璇烽�夋嫨鐖剁骇" + > + </el-tree-select> + </el-form-item> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="groupDialogFormValue.Name"></el-input> + </el-form-item> + + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="groupDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closeGroupDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitGroupFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + + <!-- 澧炲姞銆佷慨鏀规暟鎹璇濇 --> + <el-dialog + :destroy-on-close="true" + v-model="parasDialogIsShow" + width="400" + :close-on-click-modal="false" + @closed="closeParasDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon :name="parasDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ parasDialogTitle }} </span> + </div> + </template> + + <el-form :model="parasDialogFormValue" ref="parasDialogFormRef" :rules="parasDialogFormRules" label-width="78"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="parasDialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input placeholder="璇疯緭鍏ュ敮涓�缂栫爜" v-model="parasDialogFormValue.Code"></el-input> + </el-form-item> + <el-form-item label="鏍煎紡" prop="Format"> + <el-select v-model="parasDialogFormValue.Format" class="w100" filterable @change="parasFormatChange"> + <el-option + v-for="item of Object.keys(FORMAT_MAP)" + :key="item" + :label="FORMAT_MAP[item]" + :value="parseInt(item)" + ></el-option> + </el-select> + </el-form-item> + <el-form-item label="鍙傛暟鍊�" prop="PValue"> + <!-- 鏂囨湰銆佸鏂囨湰銆佹暟鍊笺�佹暣鏁般�侀暱鏁存暟 --> + <el-input + v-if="INPUT_FORMAT.includes(parasDialogFormValue.Format)" + v-model="parasDialogFormValue.PValue" + v-bind="getInputProps(parasDialogFormValue.Format)" + ></el-input> + <!-- 鏃堕棿杈撳叆锛堝寘鎷湁 choice锛� --> + <el-date-picker + class="w100" + v-else-if="parasDialogFormValue.Format === PropertyFormatEnum.Time" + value-format="YYYY-MM-DD" + v-model="parasDialogFormValue.PValue" + > + </el-date-picker> + <!-- 甯冨皵鍊艰緭鍏� --> + <el-radio-group + class="w100" + v-else-if="parasDialogFormValue.Format === PropertyFormatEnum.Boolean" + v-model="parasDialogFormValue.PValue" + > + <el-radio label="true" :value="true">鏄�</el-radio> + <el-radio label="false" :value="false">鍚�</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="parasDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closeParasDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitParasFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + <ParentDialog + v-model="parentDlgIsShow" + :data="listTreeData" + :api="parasGroupApi.UpdateBasicSysParasGroupTreeSortCode" + :rowData="parentDlgMapRow" + @submitSuccess="submitParentForm" + > + </ParentDialog> + </div> +</template> + +<script setup lang="ts"> +import type { PropType } from 'vue'; +import { ref, computed, onMounted, nextTick } from 'vue'; +import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; + +import * as parasApi from '/@/api/basic/sys/sysParas'; +import * as parasGroupApi from '/@/api/basic/sys/sysParasGroup'; +import { FORMAT_MAP, PropertyFormatEnum, INPUT_FORMAT } from '/@/projectCom/basic/types'; + +import type { FormInstance, FormRules } from 'element-plus'; +import { ElMessage, ElMessageBox } from 'element-plus'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +import { updateSort, useTableSort } from '/@/hooks/useTableSort'; +import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; +import { deepClone } from '/@/utils/other'; +import { EXTEND_TYPE_MAP } from '/@/projectCom/basic/types'; +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import ParentDialog from '/@/components/dialog/parentDialog/ParentDialog.vue'; +import { arrayIsEmpty, convertListToTree, flatten } from '/@/utils/util'; +import { booleanRegex, dateRegex, integerRegex, numberRegex } from '/@/utils/toolsValidate'; + +const props = defineProps({ + request: { + type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, + }, +}); +//#region ====================== 宸︿晶鏍戞暟鎹紝tree init ====================== +const leftTreeRef = ref(null); +const treeLoading = ref(false); +const listTreeData = ref([]); +const currentListID = ref(''); +const currentNode = ref(null); +const handleClickNode = (data) => { + nextTick(() => { + leftTreeRef.value?.treeRef.setCurrentKey(data.ID); + }); + currentListID.value = data.ID; + currentNode.value = data; + getTypeTableData(); +}; +const getListTreeData = async (selectFirst = false) => { + treeLoading.value = true; + const res = await parasGroupApi.GetAllBasicSysParasGroup(props.request).finally(() => { + treeLoading.value = false; + }); + if (res?.Code === 0) { + listTreeData.value = convertListToTree(res.Data) || []; + if (selectFirst) { + const firstListTreeNode = listTreeData.value[0]; + if (firstListTreeNode) { + handleClickNode(firstListTreeNode); + } else { + parasTableData.value = []; + currentNode.value = null; + currentListID.value = null; + } + } else { + currentNode.value && handleClickNode(currentNode.value); + } + } else { + ElMessage.error('鑾峰彇鍒嗙粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion +//#region ====================== 鑾峰彇銆佸垹闄よ〃鏍兼暟鎹� ====================== +const parasTableLoading = ref(false); +const parasTableData = ref([]); +const isParasTableDrag = ref(false); +const getTypeTableData = async () => { + parasTableLoading.value = true; + const res = await parasApi.GetBasicSysParasByGroupID({ GroupID: currentListID.value }, props.request).finally(() => { + parasTableLoading.value = false; + }); + if (res?.Code === 0) { + parasTableData.value = res.Data || []; + } else { + ElMessage.error('鑾峰彇绯荤粺鍙傛暟澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const deleteCurrentTypeRow = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎绯荤粺鍙傛暟锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await parasApi.DeleteABasicSysParas( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎绯荤粺鍙傛暟鎴愬姛'); + getTypeTableData(); + } else { + ElMessage.error('鍒犻櫎绯荤粺鍙傛暟澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎绯荤粺鍙傛暟澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 鎼滅储琛ㄦ牸锛屽琛ㄦ牸鎺掑簭 ====================== +const parasQueryParams = ref({ + Name: '', + Code: '', +}); +const { handleDragStatus: handleParasTableDrag, draggableTableRef: draggableTypeTableRef } = useTableSort( + parasTableData, + parasApi.UpdateBasicSysParasSorter, + getTypeTableData, + undefined, + false, + props.request +); + +const { + resetQuery: resetParasQuery, + handleQueryTable: handleQueryParasTable, + displayTableData: displayParasTableData, +} = useQueryTable(parasTableData, parasQueryParams, getTypeTableData); +//#endregion + +//#region ====================== 澧炲姞銆佷慨鏀硅〃鏍艰褰曟搷浣�, dialog init====================== +const isEditTypeDialog = ref(false); +const parasDialogTitle = computed(() => { + return isEditTypeDialog.value ? '淇敼绯荤粺鍙傛暟' : '娣诲姞绯荤粺鍙傛暟'; +}); +const parasDialogHeaderIcon = computed(() => { + return isEditTypeDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const parasDialogFormValue = ref({ + Name: '', + Code: '', +}) as any; +const parasDialogIsShow = ref(false); +const parasDialogFormRef = ref<FormInstance>(null); +const parasInitialCode = ref(''); +const { uniquenessValidator: parasCodeValidator } = useValidateUniqueness( + parasApi.GetIsExistBasicSysParasCode, + parasInitialCode, + '缂栫爜', + 'Code', + undefined, + false, + props.request +); + +const pValueValidator = (rule, value, callback) => { + if (!value) { + callback('蹇呭~椤癸紒'); + } else if (value && parasDialogFormValue.value.Format === PropertyFormatEnum.Numeric && !numberRegex.test(value)) { + callback('璇疯緭鍏ユ暟瀛楋紒'); + } else if ( + value && + [PropertyFormatEnum.Bigint, PropertyFormatEnum.Integer].includes(parasDialogFormValue.value.Format) && + !integerRegex.test(value) + ) { + callback('璇疯緭鍏ユ暣鏁�!'); + } else if (value && PropertyFormatEnum.Time === parasDialogFormValue.value.Format && !dateRegex.test(value)) { + callback('璇疯緭鍏ユ纭殑鏃ユ湡鏍煎紡锛坹yyy-MM-dd HH:mm:ss 鎴� yyyy-MM-dd锛�'); + } else if (value && PropertyFormatEnum.Boolean === parasDialogFormValue.value.Format && !booleanRegex.test(value)) { + callback('璇疯緭鍏� true 鎴� false'); + } else { + callback(); + } +}; + +const parasDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Code: [{ required: true, validator: parasCodeValidator as any, trigger: 'blur' }], + Format: [{ required: true, message: '璇烽�夋嫨鏍煎紡', trigger: 'change' }], + PValue: [{ required: true, validator: pValueValidator as any, trigger: 'blur' }], +}); +const openOperateParasDialog = (row?) => { + if (!currentListID.value) { + return ElMessage.warning('璇峰厛閫夋嫨鍒嗙粍锛�'); + } + if (row) { + isEditTypeDialog.value = true; + const { ID, Name, Code, Description, Format, PValue } = row; + parasInitialCode.value = Code; + parasDialogFormValue.value = deepClone({ ID, Name, Code, Description, Format, PValue }); + } else { + isEditTypeDialog.value = false; + parasInitialCode.value = ''; + + parasDialogFormValue.value = { + GroupID: currentListID.value, + Name: '', + Code: '', + Description: '', + Format: PropertyFormatEnum.Integer, + PValue: '', + }; + } + parasDialogIsShow.value = true; +}; + +const closeParasDialog = () => { + parasDialogIsShow.value = false; + parasDialogFormRef.value.clearValidate(); +}; + +const submitParasFormValue = async () => { + const valid = await parasDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditTypeDialog.value) { + const res = await parasApi.UpdateABasicSysParas(parasDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTypeTableData(); + parasDialogIsShow.value = false; + ElMessage.success('淇敼绯荤粺鍙傛暟鎴愬姛'); + } else { + ElMessage.error('淇敼绯荤粺鍙傛暟澶辫触'); + } + } else { + ElMessage.error('淇敼绯荤粺鍙傛暟澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await parasApi.InsertABasicSysParas(parasDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTypeTableData(); + parasDialogIsShow.value = false; + ElMessage.success('娣诲姞绯荤粺鍙傛暟鎴愬姛'); + } else { + ElMessage.error('娣诲姞绯荤粺鍙傛暟澶辫触'); + } + } else { + ElMessage.error('娣诲姞绯荤粺鍙傛暟澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +//#region ====================== 鍒犻櫎宸︿晶鏍戠郴缁熷垎缁勬暟鎹� ====================== + +const deleteCurrentGroup = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎绯荤粺鍒嗙粍锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await parasGroupApi.DeleteABasicSysParasGroup( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎绯荤粺鍒嗙粍鎴愬姛'); + getListTreeData(true); + } else { + ElMessage.error('鍒犻櫎绯荤粺鍒嗙粍澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎绯荤粺鍒嗙粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 澧炲姞銆佸垹闄ょ郴缁熷垎缁勬搷浣�, dialog init====================== +const isEditGroupDialog = ref(false); +const groupDialogTitle = computed(() => { + return isEditGroupDialog.value ? '淇敼绯荤粺鍒嗙粍' : '娣诲姞绯荤粺鍒嗙粍'; +}); +const groupDialogHeaderIcon = computed(() => { + return isEditGroupDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const groupDialogFormValue = ref({ + Name: '', + Code: '', + Description: '', +}) as any; +const groupDialogIsShow = ref(false); +const groupDialogFormRef = ref<FormInstance>(null); + +const groupDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], +}); +const openOperateGroupDialog = (data?) => { + if (data) { + isEditGroupDialog.value = true; + const { ID, Name, Code, Description } = data; + groupDialogFormValue.value = deepClone({ ID, Name, Code, Description }); + } else { + isEditGroupDialog.value = false; + groupDialogFormValue.value = { Name: '', Code: '', Description: '' }; + } + groupDialogIsShow.value = true; +}; + +const closeGroupDialog = () => { + groupDialogIsShow.value = false; + groupDialogFormRef.value.clearValidate(); +}; + +const submitGroupFormValue = async () => { + const valid = await groupDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditGroupDialog.value) { + const res = await parasGroupApi.UpdateABasicSysParasGroup(groupDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getListTreeData(); + groupDialogIsShow.value = false; + ElMessage.success('淇敼绯荤粺鍒嗙粍鎴愬姛'); + } else { + ElMessage.error('淇敼绯荤粺鍒嗙粍澶辫触'); + } + } else { + ElMessage.error('淇敼绯荤粺鍒嗙粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await parasGroupApi.InsertABasicSysParasGroup(groupDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getListTreeData(arrayIsEmpty(listTreeData.value)); + groupDialogIsShow.value = false; + ElMessage.success('娣诲姞绯荤粺鍒嗙粍鎴愬姛'); + } else { + ElMessage.error('娣诲姞绯荤粺鍒嗙粍澶辫触'); + } + } else { + ElMessage.error('娣诲姞绯荤粺鍒嗙粍澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +//#region ====================== 宸︿晶鏍戞嫋鎷� ====================== +const dragNodeEnd = async (draggingNode, dropNode, dropType, ev, originTreeData) => { + updateSort( + listTreeData, + flatten(listTreeData.value), + originTreeData, + () => { + handleClickNode(draggingNode.data); + getListTreeData(); + }, + parasGroupApi.UpdateBasicSysParasGroupSorter, + () => { + handleClickNode(draggingNode.data); + }, + undefined, + props.request + ); +}; +//#endregion + +//#region ====================== 鎸傝浇鏃惰幏鍙栧垵濮嬫暟鎹� ====================== +onMounted(() => { + getListTreeData(true); +}); +//#endregion + +//#region ====================== 淇敼鐖剁骇 ====================== +const parentDlgIsShow = ref(false); +const parentDlgMapRow = ref(null); +const openParentDlg = (row?) => { + parentDlgMapRow.value = row; + parentDlgIsShow.value = true; +}; +const submitParentForm = (res) => { + getListTreeData(); +}; +//#endregion +const getInputProps = (format: PropertyFormatEnum) => { + let inputProps = {}; + switch (format) { + case PropertyFormatEnum.MultiText: + inputProps = { + type: 'textarea', + row: 3, + }; + } + return { + ...inputProps, + } as any; +}; + +const parasFormatChange = () => { + parasDialogFormValue.value.PValue = ''; +}; +</script> +<style scoped lang="scss"></style> diff --git a/src/projectCom/basic/type/TypeManageCom.vue b/src/projectCom/basic/type/TypeManageCom.vue new file mode 100644 index 0000000..5df69f2 --- /dev/null +++ b/src/projectCom/basic/type/TypeManageCom.vue @@ -0,0 +1,531 @@ +<template> + <!-- 宸︿晶鍒嗙被鐩綍鏍戯紝涓婇儴琛ㄦ牸鎿嶄綔 card锛屼笅閮� table 鏁版嵁灞曠ず --> + <div class="h100"> + <el-row :gutter="8" class="h100"> + <el-col :span="4" :xs="24" class="h100"> + <el-card shadow="hover" class="h100" v-loading="treeLoading"> + <!-- 鐩綍鏍� --> + <LeftTreeByMgr + class="h100 left-tree-card" + ref="leftTreeRef" + :treedata="listTreeData" + title-name="妯″潡鍒楄〃" + :show-more-operate="true" + :show-add="true" + :show-sorter="true" + :current-node-key="currentListID" + :node-icon="() => 'ele-Document'" + :tooltip="(_, data) => data.Code" + @click="handleClickNode" + @tree-edit="openOperateModuleDialog" + @tree-delete="deleteCurrentModule" + @tree-add="openOperateModuleDialog" + @node-drag-end="dragNodeEnd" + > + </LeftTreeByMgr> + </el-card> + </el-col> + + <el-col :span="20" :xs="24" class="flex-column h100"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <!-- 鏌ヨ銆侀噸缃�佹帓搴忋�佸鍔犺〃鍗� --> + <el-form :inline="true" :model="typeQueryParams"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input v-model="typeQueryParams.Name" style="width: 226.4px" placeholder="鍚嶇О" clearable></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input v-model="typeQueryParams.Code" style="width: 226.4px" placeholder="缂栫爜" clearable /> + </el-form-item> + + <el-form-item> + <el-button type="primary" icon="ele-Search" @click="handleQueryTypeTable"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="resetTypeQuery">閲嶇疆 </el-button> + <el-button icon="ele-Plus" @click="openOperateTypeDialog()"> 澧炲姞 </el-button> + </el-form-item> + <el-form-item label="鎺掑簭"> + <el-switch + :disabled="displayTypeTableData !== typeTableData" + v-model="isTypeTableDrag" + @change="handleTypeTableDrag" + inline-prompt + active-icon="ele-Check" + inactive-icon="ele-Close" + > + </el-switch> + </el-form-item> + </el-form> + </el-card> + + <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px"> + <!-- 鏁版嵁灞曠ず琛ㄦ牸 --> + <el-table + v-loading="typeTableLoading" + ref="draggableTypeTableRef" + border + row-key="ID" + :row-class-name="isTypeTableDrag ? 'cursor-move' : 'cursor-pointer'" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ textAlign: 'center' }" + :data="displayTypeTableData" + style="width: 100%" + highlight-current-row + > + <el-table-column prop="Name" label="鍚嶇О" fixed="left" show-overflow-tooltip /> + <el-table-column prop="Code" label="缂栫爜" show-overflow-tooltip /> + + <el-table-column prop="ExtendType" label="鎷撳睍绫诲瀷" align="center" show-overflow-tooltip> + <template #default="scope"> + <el-tag> + {{ EXTEND_TYPE_MAP[scope.row.ExtendType] }} + </el-tag> + </template> + </el-table-column> + <el-table-column prop="Description" label="璇存槑" width="550" show-overflow-tooltip /> + <el-table-column label="鎿嶄綔" fixed="right" show-overflow-tooltip> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateTypeDialog(scope.row)"> + 缂栬緫 + </el-button> + <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentTypeRow(scope.row)"> + 鍒犻櫎 + </el-button> + </template> + </el-table-column> + </el-table> + </el-card> + </el-col> + </el-row> + + <!-- 澧炲姞銆佷慨鏀规暟鎹璇濇 --> + <el-dialog + :destroy-on-close="true" + v-model="moduleDialogIsShow" + width="400" + :close-on-click-modal="false" + @closed="closeModuleDialog" + > + <template #header> + <div style="color: #fff"> + <SvgIcon :name="moduleDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ moduleDialogTitle }} </span> + </div> + </template> + + <el-form :model="moduleDialogFormValue" ref="moduleDialogFormRef" :rules="moduleDialogFormRules" label-width="55"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="moduleDialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input placeholder="璇疯緭鍏ュ敮涓�缂栫爜" v-model="moduleDialogFormValue.Code"></el-input> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="moduleDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closeModuleDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitModuleFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + + <!-- 澧炲姞銆佷慨鏀规暟鎹璇濇 --> + <el-dialog :destroy-on-close="true" v-model="typeDialogIsShow" width="400" :close-on-click-modal="false" @closed="closeTypeDialog"> + <template #header> + <div style="color: #fff"> + <SvgIcon :name="typeDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> + <span> {{ typeDialogTitle }} </span> + </div> + </template> + + <el-form :model="typeDialogFormValue" ref="typeDialogFormRef" :rules="typeDialogFormRules" label-width="78"> + <el-form-item label="鍚嶇О" prop="Name"> + <el-input placeholder="璇疯緭鍏ュ悕绉�" v-model="typeDialogFormValue.Name"></el-input> + </el-form-item> + <el-form-item label="缂栫爜" prop="Code"> + <el-input placeholder="璇疯緭鍏ュ敮涓�缂栫爜" v-model="typeDialogFormValue.Code"></el-input> + </el-form-item> + <el-form-item label="鎷撳睍绫诲瀷" prop="ExtendType"> + <el-select placeholder="璇烽�夋嫨鎷撳睍绫诲瀷" v-model="typeDialogFormValue.ExtendType" class="w100" filterable> + <el-option + v-for="item of Object.keys(EXTEND_TYPE_MAP)" + :key="item" + :value="parseInt(item)" + :label="EXTEND_TYPE_MAP[item]" + ></el-option> + </el-select> + </el-form-item> + <el-form-item label="璇存槑" prop="Description"> + <el-input placeholder="璇疯緭鍏ヨ鏄�" v-model="typeDialogFormValue.Description" type="textarea" :rows="3" /> + </el-form-item> + </el-form> + <template #footer> + <div> + <el-button @click="closeTypeDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitTypeFormValue">纭� 瀹�</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup lang="ts"> +import type { PropType } from 'vue'; +import { computed, nextTick, onMounted, ref } from 'vue'; +import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; + +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import type { FormInstance, FormRules } from 'element-plus'; +import { ElMessage, ElMessageBox } from 'element-plus'; +import { + // 绯荤粺妯″潡 + DeleteAModule, + // 绯荤粺绫诲瀷 + DeleteAType, + GetAllModule, + GetAllTypeByID, + GetIsExistModuleCode, + GetIsExistTypeCode, + InsertAModule, + InsertAType, + UpdateAModule, + UpdateAType, + UpdateModuleSorter, + UpdateTypeSorter, +} from '/@/api/basic/dataManage/typeManage'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +import { updateSort, useTableSort } from '/@/hooks/useTableSort'; +import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; +import { EXTEND_TYPE_MAP } from '/@/projectCom/basic/types'; +import { deepClone } from '/@/utils/other'; +const props = defineProps({ + request: { + type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, + }, +}); +//#region ====================== 宸︿晶鏍戞暟鎹紝tree init ====================== +const leftTreeRef = ref(null); +const treeLoading = ref(false); +const listTreeData = ref([]); +const currentListID = ref(''); +const currentNode = ref(null); +const handleClickNode = (data) => { + nextTick(() => { + leftTreeRef.value?.treeRef.setCurrentKey(data.ID); + }); + currentListID.value = data.ID; + currentNode.value = data; + getTypeTableData(); +}; +const getListTreeData = async (selectFirst = false) => { + treeLoading.value = true; + const res = await GetAllModule(props.request).finally(() => { + treeLoading.value = false; + }); + if (res?.Code === 0) { + listTreeData.value = res.Data || []; + if (selectFirst) { + const firstListTreeNode = listTreeData.value[0]; + if (firstListTreeNode) { + handleClickNode(firstListTreeNode); + } else { + typeTableData.value = []; + currentNode.value = null; + currentListID.value = null; + } + } else { + currentNode.value && handleClickNode(currentNode.value); + } + } else { + ElMessage.error('鑾峰彇妯″潡澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +//#endregion +//#region ====================== 鑾峰彇銆佸垹闄よ〃鏍兼暟鎹� ====================== +const typeTableLoading = ref(false); +const typeTableData = ref([]); +const isTypeTableDrag = ref(false); +const getTypeTableData = async () => { + typeTableLoading.value = true; + const res = await GetAllTypeByID({ ModuleID: currentListID.value }, props.request).finally(() => { + typeTableLoading.value = false; + }); + if (res?.Code === 0) { + typeTableData.value = res.Data || []; + } else { + ElMessage.error('鑾峰彇绯荤粺绫诲瀷澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } +}; +const deleteCurrentTypeRow = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎绯荤粺绫诲瀷锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteAType( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎绯荤粺绫诲瀷鎴愬姛'); + getTypeTableData(); + } else { + ElMessage.error('鍒犻櫎绯荤粺绫诲瀷澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎绯荤粺绫诲瀷澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 鎼滅储琛ㄦ牸锛屽琛ㄦ牸鎺掑簭 ====================== +const typeQueryParams = ref({ + Name: '', + Code: '', +}); +const { handleDragStatus: handleTypeTableDrag, draggableTableRef: draggableTypeTableRef } = useTableSort( + typeTableData, + UpdateTypeSorter, + getTypeTableData, + undefined, + false, + props.request +); + +const { + resetQuery: resetTypeQuery, + handleQueryTable: handleQueryTypeTable, + displayTableData: displayTypeTableData, +} = useQueryTable(typeTableData, typeQueryParams, getTypeTableData); +//#endregion + +//#region ====================== 澧炲姞銆佷慨鏀硅〃鏍艰褰曟搷浣�, dialog init====================== +const isEditTypeDialog = ref(false); +const typeDialogTitle = computed(() => { + return isEditTypeDialog.value ? '淇敼绯荤粺绫诲瀷' : '娣诲姞绯荤粺绫诲瀷'; +}); +const typeDialogHeaderIcon = computed(() => { + return isEditTypeDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const typeDialogFormValue = ref({ + Name: '', + Code: '', +}) as any; +const typeDialogIsShow = ref(false); +const typeDialogFormRef = ref<FormInstance>(null); +const typeInitialCode = ref(''); +const { uniquenessValidator: typeCodeValidator } = useValidateUniqueness( + GetIsExistTypeCode, + typeInitialCode, + '缂栫爜', + 'Code', + undefined, + false, + props.request +); + +const typeDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Code: [{ required: true, validator: typeCodeValidator as any, trigger: 'blur' }], + ExtendType: [{ required: true, message: '璇烽�夋嫨鎷撳睍绫诲瀷', trigger: 'blur' }], +}); +const openOperateTypeDialog = (row?) => { + if (!currentListID.value) { + return ElMessage.warning('璇峰厛閫夋嫨妯″潡锛�'); + } + if (row) { + isEditTypeDialog.value = true; + const { ID, Name, Code, Description, ExtendType } = row; + typeInitialCode.value = Code; + typeDialogFormValue.value = deepClone({ ID, Name, Code, Description, ExtendType }); + } else { + isEditTypeDialog.value = false; + typeInitialCode.value = ''; + + typeDialogFormValue.value = { ModuleID: currentListID.value, Name: '', Code: '', Description: '', ExtendType: null }; + } + typeDialogIsShow.value = true; +}; + +const closeTypeDialog = () => { + typeDialogIsShow.value = false; + typeDialogFormRef.value.clearValidate(); +}; + +const submitTypeFormValue = async () => { + const valid = await typeDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditTypeDialog.value) { + const res = await UpdateAType(typeDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTypeTableData(); + typeDialogIsShow.value = false; + ElMessage.success('淇敼绯荤粺绫诲瀷鎴愬姛'); + } else { + ElMessage.error('淇敼绯荤粺绫诲瀷澶辫触'); + } + } else { + ElMessage.error('淇敼绯荤粺绫诲瀷澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertAType(typeDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getTypeTableData(); + typeDialogIsShow.value = false; + ElMessage.success('娣诲姞绯荤粺绫诲瀷鎴愬姛'); + } else { + ElMessage.error('娣诲姞绯荤粺绫诲瀷澶辫触'); + } + } else { + ElMessage.error('娣诲姞绯荤粺绫诲瀷澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +//#region ====================== 鍒犻櫎宸︿晶鏍戠郴缁熸ā鍧楁暟鎹� ====================== + +const deleteCurrentModule = (row: any) => { + ElMessageBox.confirm(`纭畾鍒犻櫎绯荤粺妯″潡锛氥��${row.Name}銆�?`, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(async () => { + const res = await DeleteAModule( + { + ID: row.ID, + }, + props.request + ); + if (res?.Code === 0) { + if (res.Data) { + ElMessage.success('鍒犻櫎绯荤粺妯″潡鎴愬姛'); + getListTreeData(true); + } else { + ElMessage.error('鍒犻櫎绯荤粺妯″潡澶辫触'); + } + } else { + ElMessage.error('鍒犻櫎绯荤粺妯″潡澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + }); +}; +//#endregion + +//#region ====================== 澧炲姞銆佸垹闄ょ郴缁熸ā鍧楁搷浣�, dialog init====================== +const isEditModuleDialog = ref(false); +const moduleDialogTitle = computed(() => { + return isEditModuleDialog.value ? '淇敼绯荤粺妯″潡' : '娣诲姞绯荤粺妯″潡'; +}); +const moduleDialogHeaderIcon = computed(() => { + return isEditModuleDialog.value ? 'ele-Edit' : 'ele-Plus'; +}); +const moduleDialogFormValue = ref({ + Name: '', + Code: '', + Description: '', +}) as any; +const moduleDialogIsShow = ref(false); +const moduleDialogFormRef = ref<FormInstance>(null); +const moduleInitialCode = ref(''); +const { uniquenessValidator: moduleCodeValidator } = useValidateUniqueness( + GetIsExistModuleCode, + moduleInitialCode, + '缂栫爜', + 'Code', + undefined, + false, + props.request +); + +const moduleDialogFormRules = ref<FormRules>({ + Name: [{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur' }], + Code: [{ required: true, validator: moduleCodeValidator as any, trigger: 'blur' }], +}); +const openOperateModuleDialog = (data?) => { + if (data) { + isEditModuleDialog.value = true; + const { ID, Name, Code, Description } = data; + moduleInitialCode.value = Code; + moduleDialogFormValue.value = deepClone({ ID, Name, Code, Description }); + } else { + isEditModuleDialog.value = false; + moduleInitialCode.value = ''; + moduleDialogFormValue.value = { Name: '', Code: '', Description: '' }; + } + moduleDialogIsShow.value = true; +}; + +const closeModuleDialog = () => { + moduleDialogIsShow.value = false; + moduleDialogFormRef.value.clearValidate(); +}; + +const submitModuleFormValue = async () => { + const valid = await moduleDialogFormRef.value.validate().catch(() => {}); + if (!valid) return; + + if (isEditModuleDialog.value) { + const res = await UpdateAModule(moduleDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getListTreeData(); + moduleDialogIsShow.value = false; + ElMessage.success('淇敼绯荤粺妯″潡鎴愬姛'); + } else { + ElMessage.error('淇敼绯荤粺妯″潡澶辫触'); + } + } else { + ElMessage.error('淇敼绯荤粺妯″潡澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } else { + const res = await InsertAModule(moduleDialogFormValue.value, props.request); + if (res?.Code === 0) { + if (res.Data) { + getListTreeData(); + moduleDialogIsShow.value = false; + ElMessage.success('娣诲姞绯荤粺妯″潡鎴愬姛'); + } else { + ElMessage.error('娣诲姞绯荤粺妯″潡澶辫触'); + } + } else { + ElMessage.error('娣诲姞绯荤粺妯″潡澶辫触' + (res?.Message ? `锛�${JSON.stringify(res.Message)}` : '')); + } + } +}; +//#endregion + +//#region ====================== 宸︿晶鏍戞嫋鎷� ====================== +const dragNodeEnd = async (draggingNode, dropNode, dropType, ev, originTreeData) => { + updateSort( + listTreeData, + listTreeData.value, + originTreeData, + () => { + handleClickNode(draggingNode.data); + getListTreeData(); + }, + UpdateModuleSorter, + () => { + handleClickNode(draggingNode.data); + }, + undefined, + props.request + ); +}; +//#endregion + +//#region ====================== 鎸傝浇鏃惰幏鍙栧垵濮嬫暟鎹� ====================== +onMounted(() => { + getListTreeData(true); +}); +//#endregion +</script> +<style scoped lang="scss"></style> diff --git a/src/projectCom/basic/types.ts b/src/projectCom/basic/types.ts new file mode 100644 index 0000000..16b02cc --- /dev/null +++ b/src/projectCom/basic/types.ts @@ -0,0 +1,149 @@ +export enum PropertyFormatEnum { + // 鏁存暟 + Integer = 1, + + // 闀挎暣鏁� + Bigint = 2, + + // 鏁板�� + Numeric = 3, + + // 鏂囨湰 + Text = 4, + + // 澶氭枃鏈� + MultiText = 5, + + // 鏃堕棿 + Time = 6, + + // 甯冨皵鍊� + Boolean = 7, +} +export const FORMAT_MAP = { + [PropertyFormatEnum.Integer]: '鏁存暟', + [PropertyFormatEnum.Bigint]: '闀挎暣鏁�', + [PropertyFormatEnum.Numeric]: '鏁板��', + [PropertyFormatEnum.Text]: '鏂囨湰', + [PropertyFormatEnum.MultiText]: '澶氭枃鏈�', + [PropertyFormatEnum.Time]: '鏃堕棿', + [PropertyFormatEnum.Boolean]: '甯冨皵鍊�', +} as const; + +// 浣跨敤 input 缁勪欢鐨� format +export const INPUT_FORMAT = [ + PropertyFormatEnum.Integer, + PropertyFormatEnum.Bigint, + PropertyFormatEnum.Numeric, + PropertyFormatEnum.Text, + PropertyFormatEnum.MultiText, +]; + +export enum ExtendTypeEnum { + // 鏃� + None = 0, + // 鍥烘湁 + Innate = 1, + // 缁ф壙 + Inherit = 2, +} + +export const EXTEND_TYPE_MAP = { + [ExtendTypeEnum.None]: '鏃�', + [ExtendTypeEnum.Innate]: '鍥烘湁', + [ExtendTypeEnum.Inherit]: '缁ф壙', +}; + +export const enum CronTypeEnum { + RealTime = 0, + Hourly = 1, + Daily = 2, + Monthly = 3, + Yearly = 4, +} + +export const CRON_TYPE_MAP = { + [CronTypeEnum.RealTime]: '瀹炴椂', + [CronTypeEnum.Hourly]: '姣忔椂', + [CronTypeEnum.Daily]: '姣忔棩', + [CronTypeEnum.Monthly]: '姣忔湀', + [CronTypeEnum.Yearly]: '姣忓勾', +}; + +// 鏉ユ簮绫诲瀷 +export enum SourceTypeEnum { + Docking = 0, + Analyse = 1, + Input = 2, + Custom = 3, +} +export const SOURCE_TYPE_MAP = { + [SourceTypeEnum.Docking]: '瀵规帴', + [SourceTypeEnum.Analyse]: '鍒嗘瀽', + [SourceTypeEnum.Input]: '褰曞叆', + [SourceTypeEnum.Custom]: '瀹氬埗', +}; +// 璁¢噺绫诲瀷 +export enum MeasureTypeEnum { + Instant = 1, + Accumulate = 2, +} +export const MEASURE_TYPE_MAP = { + [MeasureTypeEnum.Instant]: '鐬椂', + [MeasureTypeEnum.Accumulate]: '绱Н', +}; + +export enum SignalTypeFormatEnum { + // 鏁板�� + Numeric = 1, + + // 鏋氫妇 + Enumeration = 2, + + // 闆嗗悎 + Collection = 3, + + // 闆嗘垚 + Integration = 4, + + // 鏂囨湰 + Text = 5, + + // 鍥捐氨 + Graph = 6, +} +// 鏍煎紡绫诲瀷 +export const formatTypeEnum = { + [SignalTypeFormatEnum.Numeric]: '鏁板��', + [SignalTypeFormatEnum.Enumeration]: '鏋氫妇', + [SignalTypeFormatEnum.Collection]: ' 闆嗗悎', + [SignalTypeFormatEnum.Integration]: '闆嗘垚', + [SignalTypeFormatEnum.Text]: ' 鏂囨湰', + [SignalTypeFormatEnum.Graph]: ' 鍥捐氨', +}; + +export type TreeProps = { + id: string; + label: string; + children?: string; +}; + +export const enum TimeEnum { + Second = 1, + Minute = 2, + Hour = 3, + Day = 4, +} +export const timeEnumMap = { + [TimeEnum.Day]: '澶�', + [TimeEnum.Hour]: '灏忔椂', + [TimeEnum.Minute]: '鍒嗛挓', + [TimeEnum.Second]: '绉�', +}; + +export const timeEnumMapCount = { + [TimeEnum.Day]: 3600 * 24, + [TimeEnum.Hour]: 3600, + [TimeEnum.Minute]: 60, + [TimeEnum.Second]: 1, +}; diff --git a/src/projectCom/basic/unit/utils.ts b/src/projectCom/basic/unit/utils.ts new file mode 100644 index 0000000..02c6cf5 --- /dev/null +++ b/src/projectCom/basic/unit/utils.ts @@ -0,0 +1,19 @@ +import type { Ref } from 'vue'; +import { computed } from 'vue'; +import type { TimeEnum } from '../types'; +import { timeEnumMapCount } from '../types'; + +export const getComputedTime = (formValue: Ref<any>, timeProp: string, toType: Ref<TimeEnum>) => { + const displayTimeData = computed({ + get: () => { + return formValue.value?.[timeProp] && Number((formValue.value[timeProp] / timeEnumMapCount[toType.value]).toFixed(4)); + }, + set: (value) => { + formValue.value[timeProp] = value && Number((value * timeEnumMapCount[toType.value]).toFixed(4)); + }, + }); + + return displayTimeData +}; + + -- Gitblit v1.9.3