Commit 2541060b authored by frank.xa.zhang's avatar frank.xa.zhang

add demo for orgChart -- frank

parent 7ad4a9a6
......@@ -173,4 +173,10 @@ public class OrganizationHKController {
return organizationHKService.deleteAttachment(attachmentId);
}
// @RequestMapping(value = "getShareholders",method = RequestMethod.GET)
// public @ResponseBody OperationResultDto<OrgShareholdersDto> getShareholders(@RequestParam Long orgId){
// logger.info("GET /api/v1/orgHK/getShareholders");
// return organizationHKService.getShareholders(orgId);
// }
}
......@@ -27,10 +27,8 @@ import pwc.taxtech.atms.organization.dao.OrganizationAttachmentMapper;
import pwc.taxtech.atms.organization.dao.OrganizationDirectorMapper;
import pwc.taxtech.atms.organization.dao.OrganizationHKMapper;
import pwc.taxtech.atms.organization.dao.OrganizationShareholderMapper;
import pwc.taxtech.atms.organization.dpo.OrganizationAttachmentDto;
import pwc.taxtech.atms.organization.dpo.OrganizationDirectorDto;
import pwc.taxtech.atms.organization.dpo.OrganizationHKDto;
import pwc.taxtech.atms.organization.dpo.OrganizationShareholderDto;
import pwc.taxtech.atms.organization.dao.extension.OrganizationShareholderExtMapper;
import pwc.taxtech.atms.organization.dpo.*;
import pwc.taxtech.atms.organization.entity.*;
import pwc.taxtech.atms.organization.mapper.OrganizationAttachmentTMapper;
import pwc.taxtech.atms.organization.mapper.OrganizationDirectorTMapper;
......@@ -94,6 +92,9 @@ public class OrganizationHKServiceImpl {
@Autowired
private OrganizationHKTMapper organizationHKTMapper;
@Resource
private OrganizationShareholderExtMapper organizationShareholderExtMapper;
@Value("${orgaization.file.location}")
private String fileDirectory;
......@@ -105,12 +106,26 @@ public class OrganizationHKServiceImpl {
List<OrganizationAttachment> organizationAttachments = organizationAttachmentMapper.selectByExample(null);
organizationHKS.forEach(a -> {
OrganizationHKDto organizationHKDto = organizationHKTMapper.toOrganizationHKDto(a);
List<OrganizationShareholderDto> tempShareholders = organizationShareholders.stream().filter(b -> b.getEntityId().equals(a.getId())).map(organizationShareholderTMapper::toOrgShareholder).collect(Collectors.toList());
List<OrganizationDirectorDto> tempDirectors = organizationDirectors.stream().filter(c -> c.getEntityId().equals(a.getId())).map(organizationDirectorTMapper::toOrganizationDirectorDto).collect(Collectors.toList());
List<OrganizationAttachmentDto> tempAttachments = organizationAttachments.stream().filter(d -> d.getEntityId().equals(a.getId())).map(organizationAttachmentTMapper::toOrganizationAttachmentDto).collect(Collectors.toList());
List<OrganizationShareholderDto> tempShareholders = organizationShareholders.stream().filter(b -> b.getEntityId().equals(a.getId()))
.map(organizationShareholderTMapper::toOrgShareholder).collect(Collectors.toList());
List<OrganizationDirectorDto> tempDirectors = organizationDirectors.stream().filter(c -> c.getEntityId().equals(a.getId()))
.map(organizationDirectorTMapper::toOrganizationDirectorDto).collect(Collectors.toList());
List<OrganizationAttachmentDto> tempAttachments = organizationAttachments.stream().filter(d -> d.getEntityId().equals(a.getId()))
.map(organizationAttachmentTMapper::toOrganizationAttachmentDto).collect(Collectors.toList());
organizationHKDto.setShareholders(tempShareholders);
organizationHKDto.setDirectors(tempDirectors);
organizationHKDto.setAttachments(tempAttachments);
List<ShareholderDto> shareholderDtos = organizationShareholderExtMapper.selectShareholder(a.getId());
List<SubsidaryDto> subsidaryDtos = organizationShareholderExtMapper.selectSubsidary(a.getId());
List<OrgShareholderDto> orgShareholderDtos = shareholderDtos.stream()
.map(organizationShareholderTMapper::toOrgShareholderDto).collect(Collectors.toList());
List<OrgSubsidaryDto> orgSubsidaryDtos = subsidaryDtos.stream()
.map(organizationShareholderTMapper::toOrgSubsidaryDto).collect(Collectors.toList());
List<OrgDirectorDto> orgDirectorDtos = organizationDirectors.stream()
.map(organizationDirectorTMapper::toOrgDirectorDto).collect(Collectors.toList());
organizationHKDto.setOrgShareholderDtos(orgShareholderDtos);
organizationHKDto.setOrgSubsidaryDtos(orgSubsidaryDtos);
organizationHKDto.setOrgDirectorDtos(orgDirectorDtos);
organizationHKDtos.add(organizationHKDto);
});
return organizationHKDtos;
......@@ -288,25 +303,33 @@ public class OrganizationHKServiceImpl {
OrganizationHK organizationHK = organizationHKMapper.selectByPrimaryKey(orgId);
OrganizationHKDto result = new OrganizationHKDto();
CommonUtils.copyProperties(organizationHK, result);
Assert.notNull(result,
"result is null");
Assert.notNull(result, "result is null");
result.setLevel(result.getLevel() == null ? 0 : result.getLevel());
// if (result.getParentId() == 0) {
result.setParentName("");
// } else {
// OrganizationHK tParent = organizationHKMapper.selectByExample(null).stream()
// .filter(sa -> Objects.equals(sa.getId(), result.getParentId())).findFirst().orElse(null);
// Assert.notNull(tParent, "tParent is null");
// result.setParentName(tParent.getName());
// }
OrganizationShareholderExample shareholderExample = new OrganizationShareholderExample();
shareholderExample.createCriteria().andEntityIdEqualTo(orgId);
List<OrganizationShareholderDto> organizationShareholderDtos = organizationShareholderMapper.selectByExample(shareholderExample).stream().map(a -> CommonUtils.copyProperties(a, new OrganizationShareholderDto())).collect(Collectors.toList());
List<OrganizationShareholderDto> organizationShareholderDtos = organizationShareholderMapper.selectByExample(shareholderExample).stream()
.map(a -> organizationShareholderTMapper.toOrgShareholder(a)).collect(Collectors.toList());
OrganizationDirectorExample directorExample = new OrganizationDirectorExample();
directorExample.createCriteria().andEntityIdEqualTo(orgId);
List<OrganizationDirectorDto> organizationDirectorDtos = organizationDirectorMapper.selectByExample(directorExample).stream().map(a -> CommonUtils.copyProperties(a, new OrganizationDirectorDto())).collect(Collectors.toList());
List<OrganizationDirectorDto> organizationDirectorDtos = organizationDirectorMapper.selectByExample(directorExample).stream()
.map(a -> organizationDirectorTMapper.toOrganizationDirectorDto(a)).collect(Collectors.toList());
result.setDirectors(organizationDirectorDtos);
result.setShareholders(organizationShareholderDtos);
OrganizationAttachmentExample organizationAttachmentExample = new OrganizationAttachmentExample();
organizationAttachmentExample.createCriteria().andEntityIdEqualTo(orgId);
List<OrganizationAttachmentDto> organizationAttachmentDtos = organizationAttachmentMapper.selectByExample(organizationAttachmentExample).stream()
.map(organizationAttachmentTMapper::toOrganizationAttachmentDto).collect(Collectors.toList());
result.setAttachments(organizationAttachmentDtos);
List<OrgShareholderDto> orgShareholderDtos = organizationShareholderExtMapper.selectShareholder(orgId).stream()
.map(organizationShareholderTMapper::toOrgShareholderDto).collect(Collectors.toList());
List<OrgSubsidaryDto> orgSubsidaryDtos = organizationShareholderExtMapper.selectSubsidary(orgId).stream()
.map(organizationShareholderTMapper::toOrgSubsidaryDto).collect(Collectors.toList());
List<OrgDirectorDto> orgDirectorDtos = organizationDirectorMapper.selectByExample(directorExample).stream()
.map(organizationDirectorTMapper::toOrgDirectorDto).collect(Collectors.toList());
result.setOrgShareholderDtos(orgShareholderDtos);
result.setOrgSubsidaryDtos(orgSubsidaryDtos);
result.setOrgDirectorDtos(orgDirectorDtos);
return result;
}
......@@ -610,7 +633,7 @@ public class OrganizationHKServiceImpl {
OrganizationAttachment attachment = organizationAttachmentMapper.selectByPrimaryKey(attachmentId);
Assert.notNull(attachment, "attachment is null");
String fileName = attachment.getDocumentName();
String filePath = fileDirectory +"/"+ attachment.getDocumentPath();
String filePath = fileDirectory + "/" + attachment.getDocumentPath();
FileExcelUtil.downloadFile(request, response, fileName, filePath);
}
......
package pwc.taxtech.atms.organization.dao.extension;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.organization.dpo.ShareholderDto;
import pwc.taxtech.atms.organization.dpo.SubsidaryDto;
import java.util.List;
@Mapper
public interface OrganizationShareholderExtMapper extends MyMapper {
@Select("select a.id, a.investment_entity_id as entityId,b.name,a.voting_percentage as votingPercentage from organization_shareholder a left join organization b on a.investment_entity_id=b.id where entity_id=#{id}")
List<ShareholderDto> selectShareholder(Long entityId);
@Select("select a.id, a.entity_id as entityId,b.name,a.voting_percentage as votingPercentage from organization_shareholder a left join organization b on a.entity_id=b.id where investment_entity_id=#{id}")
List<SubsidaryDto> selectSubsidary(Long entityId);
}
package pwc.taxtech.atms.organization.dpo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class OrgDirectorDto {
String directorName;
String residency;
}
package pwc.taxtech.atms.organization.dpo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class OrgShareholderDto {
String entityName;
String percentage;
}
package pwc.taxtech.atms.organization.dpo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class OrgSubsidaryDto {
String entityName;
String percentage;
}
......@@ -55,4 +55,7 @@ public class OrganizationHKDto {
private List<OrganizationShareholderDto> shareholders;
@JsonProperty("attachments")
private List<OrganizationAttachmentDto> attachments;
private List<OrgShareholderDto> orgShareholderDtos;
private List<OrgSubsidaryDto> orgSubsidaryDtos;
private List<OrgDirectorDto> orgDirectorDtos;
}
package pwc.taxtech.atms.organization.dpo;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ShareholderDto {
Long id;
Long entityId;
String entityName;
String votingPercentage;
}
package pwc.taxtech.atms.organization.dpo;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SubsidaryDto {
Long id;
Long entityId;
String entityName;
String votingPercentage;
}
package pwc.taxtech.atms.organization.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import pwc.taxtech.atms.organization.dpo.OrgDirectorDto;
import pwc.taxtech.atms.organization.dpo.OrganizationDirectorDto;
import pwc.taxtech.atms.organization.entity.OrganizationDirector;
......@@ -10,6 +10,7 @@ import pwc.taxtech.atms.organization.entity.OrganizationDirector;
public interface OrganizationDirectorTMapper {
OrganizationDirectorTMapper ORGANIZATION_DIRECTOR_T_MAPPER = Mappers.getMapper(OrganizationDirectorTMapper.class);
@Mapping(source = "id", target = "id")
OrganizationDirectorDto toOrganizationDirectorDto(OrganizationDirector organizationDirector);
OrgDirectorDto toOrgDirectorDto(OrganizationDirector organizationDirector);
}
......@@ -3,13 +3,19 @@ package pwc.taxtech.atms.organization.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import pwc.taxtech.atms.organization.dpo.OrganizationShareholderDto;
import pwc.taxtech.atms.organization.dpo.*;
import pwc.taxtech.atms.organization.entity.OrganizationShareholder;
@Mapper(componentModel = "spring")
public interface OrganizationShareholderTMapper {
OrganizationShareholderTMapper ORGANIZATION_SHAREHOLDER_T_MAPPER = Mappers.getMapper(OrganizationShareholderTMapper.class);
@Mapping(source = "id",target = "id")
@Mapping(source = "id", target = "id")
OrganizationShareholderDto toOrgShareholder(OrganizationShareholder organizationShareholder);
@Mapping(source = "votingPercentage", target = "percentage")
OrgShareholderDto toOrgShareholderDto(ShareholderDto shareholderDto);
@Mapping(source = "votingPercentage", target = "percentage")
OrgSubsidaryDto toOrgSubsidaryDto(SubsidaryDto subsidaryDto);
}
infrastructureModule
.controller('OrganizationManageController', ['$scope', '$location', '$log', 'orgHKService', '$interval', 'uiGridTreeViewConstants', 'uiGridConstants', 'SweetAlert', '$translate', '$timeout', 'apiInterceptor', '$q', 'loginContext', '$cookies', 'Upload','FileSaver',
function ($scope, $location, $log, orgHKService, $interval, uiGridTreeViewConstants, uiGridConstants, SweetAlert, $translate, $timeout, apiInterceptor, $q, loginContext, $cookies, Upload,FileSaver) {
.controller('OrganizationManageController', ['$scope', '$location', '$log', 'orgHKService', '$interval', 'uiGridTreeViewConstants', 'uiGridConstants', 'SweetAlert', '$translate', '$timeout', 'apiInterceptor', '$q', 'loginContext', '$cookies', 'Upload', 'FileSaver',
function ($scope, $location, $log, orgHKService, $interval, uiGridTreeViewConstants, uiGridConstants, SweetAlert, $translate, $timeout, apiInterceptor, $q, loginContext, $cookies, Upload, FileSaver) {
'use strict';
$scope.expanded = false;
......@@ -125,10 +125,6 @@
if (data) {
initPagingControl(data.length);
$scope.DataGridSource = data;
// $scope.shareholderDatasource = data.shareholders;
// $scope.directorDatasource = data.directors;
$scope.oldData = angular.copy(data);
$scope.setGridHeight();
}
......@@ -249,51 +245,6 @@
cancelWebChange();
};
// 提交修改的机构其他信息
// $scope.updateOrgExtraSubmit = function () {
// SweetAlert.swal({
// title: $translate.instant('ComfirmUpdate'),
// text: $translate.instant('UpdateOrgExtraInfoTips'),
// type: "warning",
// showCancelButton: true,
// confirmButtonColor: "#DD6B55",
// confirmButtonText: $translate.instant('Confirm'),
// cancelButtonText: $translate.instant('Cancel'),
// closeOnConfirm: false,
// closeOnCancel: true
// },
// function (isConfirm) {
// if (isConfirm) {
// // 选中
// updateOrgExtraInfo($scope.selectCompany.id);
// }
// });
// };
//
// var updateOrgExtraInfo = function (id) {
// var editData = $scope.editOrgExtraModel;
// editData.organizationId = id;
// orgHKService.updateOrgExtraInfoByOrgId(editData).success(function (res) {
// if (res && !res.result) {
// SweetAlert.warning($translate.instant(res.resultMsg));
// return;
// }
// if (res) {
// orgHKService.getSingleOrgExtra(id).success(function (data) {
// if (data == null) {
// SweetAlert.warning($translate.instant(data.resultMsg));
// return;
// }
// $scope.editOrgExtraModel = angular.copy(data);
// $scope.selectCompanyExtra = data;
// generalSelectCompanyExtraText();
// cancelWebChange();
// SweetAlert.success($translate.instant('OrganizationExtraInfoEditSuccess'));
// });
// }
// });
// };
// 添加或者编辑机构成功之后,刷新当前页面的数据
$scope.$watch('isOrgUpdate', function (newValue, oldValue) {
if (newValue) {
......@@ -327,11 +278,10 @@
$scope.directorDatasource = data.directors;
$scope.shareholderDatasource = data.shareholders;
$scope.attachmentDatasource = data.attachments;
$scope.orgShareholdersDatasource = data.orgShareholderDtos;
$scope.orgSubsidariesDatasource = data.orgSubsidaryDtos;
$scope.orgDirectorsDatasource = data.orgDirectorDtos;
$scope.selectCompany.suborgList = suborgList;
$scope.backups = {};
$scope.backups.enterpriseAccountSetOrgList = angular.copy($scope.selectCompany.enterpriseAccountSetOrgList);
$scope.backups.organizationServiceTemplateGroupList = angular.copy($scope.selectCompany.organizationServiceTemplateGroupList);
});
};
......@@ -692,6 +642,9 @@
$scope.shareholderDatasource = org.shareholders;
$scope.directorDatasource = org.directors;
$scope.attachmentDatasource = org.attachments;
$scope.orgShareholdersDatasource = org.orgShareholderDtos;
$scope.orgSubsidariesDatasource = org.orgSubsidaryDtos;
$scope.orgDirectorsDatasource = org.orgDirectorDtos;
$scope.showSingle = true;
};
......@@ -808,12 +761,12 @@
$scope.addDirector = function () {
$scope.isShowDirectorModal2 = true;
};
var secondGridHeight = 230;
$scope.directorGridOptions = {
bindingOptions: {
dataSource: 'directorDatasource'
},
height: 160,
height: secondGridHeight,
showBorders: true,
paging: {
pageSize: constant.page.logPageSize
......@@ -916,7 +869,7 @@
bindingOptions: {
dataSource: 'shareholderDatasource'
},
height: 150,
height: secondGridHeight,
showBorders: true,
paging: {
pageSize: constant.page.logPageSize
......@@ -1226,6 +1179,102 @@
});
};
var gridHeight =180;
$scope.orgShareholdersGridOptions = {
bindingOptions: {
dataSource: 'orgShareholdersDatasource'
},
height: gridHeight,
showBorders: true,
keyExpr: "shareholderName",
columns: [
{
dataField: "shareholderName",
allowHeaderFiltering: false,
caption: $translate.instant('shareholderName')
},
{
dataField: "percentage",
allowHeaderFiltering: false,
caption: $translate.instant('percentage')
}
],
selection: {
mode: "single"
},
allowColumnResizing: true,
columnAutoWidth: true,
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll')
};
$scope.orgSubsidariesGridOptions = {
bindingOptions: {
dataSource: 'orgSubsidariesDatasource'
},
height: gridHeight,
showBorders: true,
keyExpr: "subsidaryName",
columns: [
{
dataField: "subsidaryName",
allowHeaderFiltering: false,
caption: $translate.instant('subsidaryName')
},
{
dataField: "percentage",
allowHeaderFiltering: false,
caption: $translate.instant('percentage')
}
],
selection: {
mode: "single"
},
allowColumnResizing: true,
columnAutoWidth: true,
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll')
};
$scope.orgDirectorsGridOptions = {
bindingOptions: {
dataSource: 'orgDirectorsDatasource'
},
height: gridHeight,
showBorders: true,
keyExpr: "directorName",
columns: [
{
dataField: "directorName",
allowHeaderFiltering: false,
caption: $translate.instant('directorName')
},
{
dataField: "residency",
allowHeaderFiltering: false,
caption: $translate.instant('residency')
}
],
selection: {
mode: "single"
},
allowColumnResizing: true,
columnAutoWidth: true,
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll')
};
(function initialize() {
$log.debug('organizationManageController.ctor()...');
......
......@@ -83,10 +83,10 @@
{{selectCompany.name | limitString:50}}</p>
</div>
<div class="right-option">
<button type="button" id="organizationIsActiveBtn" class="btn" ng-class="{true:'btn-secondary', false:'btn-in-grid'}[!selectCompany.isActive]"
ng-click="updateIsActive()" ng-disabled="!isCanOrganizationIsActiveBtn"><i ng-show="selectCompany.isActive" class="material-icons stop">block</i>{{selectCompany.isActiveStr}}
</button>
<span class="right-operate"></span>
<!--<button type="button" id="organizationIsActiveBtn" class="btn" ng-class="{true:'btn-secondary', false:'btn-in-grid'}[!selectCompany.isActive]"-->
<!--ng-click="updateIsActive()" ng-disabled="!isCanOrganizationIsActiveBtn"><i ng-show="selectCompany.isActive" class="material-icons stop">block</i>{{selectCompany.isActiveStr}}-->
<!--</button>-->
<!--<span class="right-operate"></span>-->
</div>
</div>
</div>
......@@ -106,7 +106,7 @@
{{'ChartInfo' | translate}}
</md-nav-item>
</md-nav-bar>
<div class="ext-content" style="height:535px;margin-top: 10px">
<div class="ext-content" style="height:740px;margin-top: 10px">
<div ng-show="currentNavItem==='page1'" class="org-basic-data-table">
<div class="basic-org-info-wrapper">
<div class="right-option">
......@@ -288,10 +288,8 @@
<hr style="margin-top: 0px;"/>
<!--attachment-->
<div class="attachment-container">
<div class="attachment-header">
<div class="attachment-header" style="margin-bottom: 10px">
<span style="font-size: large;font-weight: bold">Attachment</span>
</div>
<div class="attachment-option">
<button id="uploadAttachBtn" class="btn" style="float:right;background: transparent;" type="file"
multiple="" ngf-select="uploadFiles($files, $invalidFiles)" accept="*" ngf-max-height="1000" ngf-max-size="20MB">
<i class="fa fa-upload" aria-hidden="true" style="font-size: large"></i>{{'upload'|translate}}
......@@ -363,15 +361,15 @@
<div class="org-chart-container"></div>
</div>
<div class="org-chart-info-bottom col-sm-12">
<div class="org-chart-info-shareholders col-sm-3 data-grid-border">
<div class="org-chart-info-shareholders col-sm-3 data-grid-border" style="height:255px">
<div class="org-chart-info-shareholders-header"><span class="lable-text">{{'Shareholders'|translate}}</span></div>
<div id="orgShareholdersGridContainer" dx-data-grid="orgShareholdersGridOptions" style="margin-top: 10px;"></div>
</div>
<div class="org-chart-info-subsidaries col-sm-3 data-grid-border" style="margin-left: 25px">
<div class="org-chart-info-subsidaries col-sm-3 data-grid-border" style="margin-left: 25px;height:255px">
<div class="org-chart-info-shareholders-header"><span class="lable-text">{{'Subsidaries'|translate}}</span></div>
<div id="orgSubsidariesGridContainer" dx-data-grid="orgSubsidariesGridOptions" style="margin-top: 10px;"></div>
</div>
<div class="org-chart-info-directors col-sm-3 data-grid-border" style="margin-left: 25px">
<div class="org-chart-info-directors col-sm-3 data-grid-border" style="margin-left: 25px;height:255px">
<div class="org-chart-info-shareholders-header"><span class="lable-text">{{'Directors'|translate}}</span></div>
<div id="orgDirectorsGridContainer" dx-data-grid="orgDirectorsGridOptions" style="margin-top: 10px;"></div>
</div>
......
......@@ -46,6 +46,15 @@ webservices.factory('orgHKService', ['$http', 'apiConfig', function ($http, apiC
},
attachmentDelete: function (attachmentId) {
return $http.delete('/orgHK/downloadAttachment?attachmentId=' + attachmentId, apiConfig.create());
},
getShareholders: function (orgId) {
return $http.get('/orgHk/getShareholders?orgId=' + orgId, apiConfig.create());
},
getSubsidaries: function (orgId) {
return $http.get('/orgHK/getSubsidaries?orgId=' + orgId, apiConfig.create());
},
getDirectors: function (orgId) {
return $http.get('/orgHK/getDirectors?orgId=' + orgId, apiConfig.create());
}
}
}]);
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://fonts.googleapis.com/css?family=Gochi+Hand" rel="stylesheet">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div id="tree"></div>
<script src="https://balkangraph.com/js/latest/OrgChart.js"></script>
<script src="./script.js"></script>
</body>
</html>
\ No newline at end of file
window.onload = function () {
var chart = new OrgChart(document.getElementById("tree"), {
template: "olivia",
enableDragDrop: true,
nodeMouseClick: OrgChart.action.edit,
nodeMenu: {
details: { text: "Details" },
edit: { text: "Edit" },
add: { text: "Add" },
remove: { text: "Remove" }
},
dragDropMenu: {
addInGroup: { text: "Add in group" },
addAsChild: { text: "Add as child" }
},
nodeBinding: {
field_0: "name",
field_1: "title",
img_0: "img"
},
tags: {
Directors: {
group: true,
groupName: "Directors",
groupState: OrgChart.EXPAND,
template: "group_grey"
},
HRs: {
group: true,
groupName: "HR Team",
groupState: OrgChart.COLLAPSE,
template: "group_grey"
},
Sales: {
group: true,
groupName: "Sales Team",
groupState: OrgChart.EXPAND,
template: "group_grey"
},
Devs: {
group: true,
groupName: "Dev Team",
groupState: OrgChart.EXPAND,
template: "group_grey"
}
},
nodes: [
{ id: 1, tags: ["Directors"], name: "Billy Moore", title: "CEO", img: "https://balkangraph.com/js/img/2.jpg" },
{ id: 2, tags: ["Directors"], name: "Marley Wilson", title: "Director", img: "https://balkangraph.com/js/img/3.jpg" },
{ id: 3, tags: ["Directors"], name: "Bennie Shelton", title: "Shareholder", img: "https://balkangraph.com/js/img/4.jpg" },
{ id: 4, pid: 1, name: "Billie Rose", title: "Dev Team Lead", img: "https://balkangraph.com/js/img/5.jpg" },
{ id: 5, pid: 1, tags: ["HRs"], name: "Glenn Bell", title: "HR", img: "https://balkangraph.com/js/img/10.jpg" },
{ id: 6, pid: 1, tags: ["HRs"], name: "Blair Francis", title: "HR", img: "https://balkangraph.com/js/img/11.jpg" },
{ id: 7, pid: 1, name: "Skye Terrell", title: "Manager", img: "https://balkangraph.com/js/img/12.jpg" },
{ id: 8, pid: 4, tags: ["Devs"], name: "Jordan Harris", title: "JS Developer", img: "https://balkangraph.com/js/img/6.jpg" },
{ id: 9, pid: 4, tags: ["Devs"], name: "Will Woods", title: "JS Developer", img: "https://balkangraph.com/js/img/7.jpg" },
{ id: 10, pid: 4, tags: ["Devs"], name: "Skylar Parrish", title: "node.js Developer", img: "https://balkangraph.com/js/img/8.jpg" },
{ id: 11, pid: 4, tags: ["Devs"], name: "Ashton Koch", title: "C# Developer", img: "https://balkangraph.com/js/img/9.jpg" },
{ id: 12, pid: 7, tags: ["Sales"], name: "Bret Fraser", title: "Sales", img: "https://balkangraph.com/js/img/13.jpg" },
{ id: 13, pid: 7, tags: ["Sales"], name: "Steff Haley", title: "Sales", img: "https://balkangraph.com/js/img/14.jpg" }
]
});
};
html, body {
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
overflow: hidden;
font-family: Helvetica;
}
#tree {
width: 100%;
height: 100%;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment