|
@@ -228,6 +228,7 @@ export class sysGraphController {
|
|
|
loadResultObj.message = '加载模板数据失败:' + loadResultObj.message;
|
|
|
return loadResultObj;
|
|
|
}
|
|
|
+ loadResultObj.data = await this.parseSystemGraphInfo(loadResultObj.data, _paramObj.groupCode, _paramObj.projectId);
|
|
|
|
|
|
// //加载数据成功后保存数据
|
|
|
// var saveResultObj = await this.saveSysGraph(loadResultObj.data, _paramObj.projectId, _paramObj.groupCode);
|
|
@@ -243,19 +244,74 @@ export class sysGraphController {
|
|
|
* 加载数据
|
|
|
* @param _paramObj {projectId:'项目id',groupCode:'集团编码',id:'系统图ID'}
|
|
|
*/
|
|
|
- static async loadData(_paramObj: any) {
|
|
|
+ static async loadData(_paramObj: any) {
|
|
|
var loadDataUrl = '/diagram/loadData?groupCode=' + _paramObj.groupCode + '&projectId=' + _paramObj.projectId;
|
|
|
var loadResultObj = await this.sysGraphHttpUtilsInstance.postRequest(loadDataUrl, { id: _paramObj.id });
|
|
|
return loadResultObj;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 解析系统图数据
|
|
|
+ * @param dataObj
|
|
|
+ */
|
|
|
+ static async parseSystemGraphInfo(dataObj: any, groupCode: string, projectId: string) {
|
|
|
+ //取得专业>系统类型>系统实例 以和系统图列表中的系统类型编码 对应以获取系统实例名称
|
|
|
+ if (this.zhuanyeArr.length == 0) {
|
|
|
+ var url2 = '/diagram/major/system/instance?groupCode=' + groupCode + '&projectId=' + projectId;
|
|
|
+ var zhuanyeObj = await this.sysGraphHttpUtilsInstance.postRequest(url2, {});
|
|
|
+ this.zhuanyeArr = zhuanyeObj.data || [];
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取系统实例名称
|
|
|
+ var _systemInstance = getSystemInstanceByCode(dataObj.systemId);
|
|
|
+ dataObj.systemInstanceName = _systemInstance.name || '';
|
|
|
+
|
|
|
+
|
|
|
+ //获取系统图类型和系统图模版
|
|
|
+ var _temoObj = await this.getTemplateGraphTypeBySysTypeCode(dataObj.system, dataObj.templateId);
|
|
|
+ dataObj.graphTypeName = ((_temoObj || {}).graphType || {}).name;
|
|
|
+ dataObj.templateName = ((_temoObj || {}).template || {}).name;
|
|
|
+
|
|
|
+ //状态名称
|
|
|
+ dataObj.stateName = this.getStateNameByCode((dataObj.extraProps || {}).state);
|
|
|
+
|
|
|
+
|
|
|
+ return dataObj;
|
|
|
+
|
|
|
+ //获取系统实例信息
|
|
|
+ function getSystemInstanceByCode(systemInstanceId: string) {
|
|
|
+ for (let i = 0; i < sysGraphController.zhuanyeArr.length; i++) {
|
|
|
+ //专业
|
|
|
+ let zhuanye = sysGraphController.zhuanyeArr[i];
|
|
|
+ //系统类型数组
|
|
|
+ let systemTypeArr = zhuanye.children || [];
|
|
|
+ let isFind = false;
|
|
|
+ for (let j = 0; j < systemTypeArr.length; j++) {
|
|
|
+ //系统类型
|
|
|
+ let systemType = systemTypeArr[j];
|
|
|
+ //系统实例数组
|
|
|
+ let systemInstanceArr = systemType.children || [];
|
|
|
+ for (let k = 0; k < systemInstanceArr.length; k++) {
|
|
|
+ //系统实例
|
|
|
+ let systemInstance = systemInstanceArr[k];
|
|
|
+ if (systemInstance.id == systemInstanceId)
|
|
|
+ return systemInstance;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isFind)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
* 重置数据
|
|
|
* @param _paramObj {projectId:'项目id',groupCode:'集团编码',id:'系统图ID'}
|
|
|
*/
|
|
|
- static async resetData(_paramObj: any) {
|
|
|
+ static async resetData(_paramObj: any) {
|
|
|
var loadDataUrl = '/diagram/reset?groupCode=' + _paramObj.groupCode + '&projectId=' + _paramObj.projectId;
|
|
|
var loadResultObj = await this.sysGraphHttpUtilsInstance.postRequest(loadDataUrl, { id: _paramObj.id });
|
|
|
+ loadResultObj.data = await this.parseSystemGraphInfo(loadResultObj.data, _paramObj.groupCode, _paramObj.projectId);
|
|
|
return loadResultObj;
|
|
|
}
|
|
|
|
|
@@ -292,61 +348,10 @@ export class sysGraphController {
|
|
|
// resultObj.data.lines=tempData.lines;
|
|
|
// resultObj.data.template=tempData.template;
|
|
|
|
|
|
-//#regionend -------------------------------------------------------------------------------测试结束
|
|
|
-
|
|
|
-
|
|
|
- var dataObj = resultObj.data || {};
|
|
|
- if (!dataObj.id)
|
|
|
- return { result: logicConfig.resultObj.failure, message: '缺少系统图ID' };
|
|
|
-
|
|
|
-
|
|
|
- //取得专业>系统类型>系统实例 以和系统图列表中的系统类型编码 对应以获取系统实例名称
|
|
|
- if (this.zhuanyeArr.length == 0) {
|
|
|
- var url2 = '/diagram/major/system/instance?groupCode=' + groupCode + '&projectId=' + projectId;
|
|
|
- var zhuanyeObj = await this.sysGraphHttpUtilsInstance.postRequest(url2, {});
|
|
|
- this.zhuanyeArr = zhuanyeObj.data || [];
|
|
|
- }
|
|
|
-
|
|
|
- //获取系统实例名称
|
|
|
- var _systemInstance = getSystemInstanceByCode(resultObj.data.systemId);
|
|
|
- resultObj.data.systemInstanceName = _systemInstance.name || '';
|
|
|
-
|
|
|
-
|
|
|
- //获取系统图类型和系统图模版
|
|
|
- var _temoObj = await this.getTemplateGraphTypeBySysTypeCode(resultObj.data.system, resultObj.data.templateId);
|
|
|
- resultObj.data.graphTypeName = ((_temoObj || {}).graphType || {}).name;
|
|
|
- resultObj.data.templateName = ((_temoObj || {}).template || {}).name;
|
|
|
-
|
|
|
- //状态名称
|
|
|
- resultObj.data.stateName = this.getStateNameByCode((resultObj.data.extraProps || {}).state);
|
|
|
-
|
|
|
+ //#regionend -------------------------------------------------------------------------------测试结束
|
|
|
|
|
|
+ resultObj.data = await this.parseSystemGraphInfo(resultObj.data, groupCode, projectId);
|
|
|
return resultObj;
|
|
|
-
|
|
|
- //获取系统实例信息
|
|
|
- function getSystemInstanceByCode(systemInstanceId: string) {
|
|
|
- for (let i = 0; i < sysGraphController.zhuanyeArr.length; i++) {
|
|
|
- //专业
|
|
|
- let zhuanye = sysGraphController.zhuanyeArr[i];
|
|
|
- //系统类型数组
|
|
|
- let systemTypeArr = zhuanye.children || [];
|
|
|
- let isFind = false;
|
|
|
- for (let j = 0; j < systemTypeArr.length; j++) {
|
|
|
- //系统类型
|
|
|
- let systemType = systemTypeArr[j];
|
|
|
- //系统实例数组
|
|
|
- let systemInstanceArr = systemType.children || [];
|
|
|
- for (let k = 0; k < systemInstanceArr.length; k++) {
|
|
|
- //系统实例
|
|
|
- let systemInstance = systemInstanceArr[k];
|
|
|
- if (systemInstance.id == systemInstanceId)
|
|
|
- return systemInstance;
|
|
|
- }
|
|
|
- }
|
|
|
- if (isFind)
|
|
|
- break;
|
|
|
- }
|
|
|
- };
|
|
|
}
|
|
|
|
|
|
|
|
@@ -415,8 +420,8 @@ export class sysGraphController {
|
|
|
* 保存系统图名称
|
|
|
* @_paramObj {id:'系统图ID',name:'系统图名称'}
|
|
|
*/
|
|
|
- static async saveGraphName(_paramObj: any) {
|
|
|
- var url = '/diagram/update/name';
|
|
|
+ static async saveGraphName(_paramObj: any) {
|
|
|
+ var url = '/diagram/update/name';
|
|
|
var resultObj = await this.sysGraphHttpUtilsInstance.postRequest(url, _paramObj);
|
|
|
return resultObj;
|
|
|
}
|