陈鹏飞 3 years ago
parent
commit
1e098adf1f
  1. 7
      src/app/babylon/controller/info-manager.ts
  2. 15
      src/app/babylon/controller/scene-manager.ts
  3. 6
      src/app/babylon/controller/status/building-status.ts
  4. 4
      src/app/babylon/model/data/model-data/model-data-facility.ts
  5. 10
      src/app/babylon/model/info/model/model-info-building.ts
  6. 1
      src/app/babylon/model/info/model/model-info-facility.ts
  7. 6
      src/app/babylon/model/info/model/model-info.ts
  8. 153
      src/app/babylon/view/building-window/building-window.ts
  9. 35
      src/app/babylon/view/facility-window/facility-window.ts
  10. 2
      src/app/pages/criminal-records-admin/criminal-records-admin.component.html
  11. 2
      src/app/pages/criminal-records/criminal-records.component.html
  12. 1
      src/app/pages/equipment-info/addequipment/addequipment.component.html
  13. 0
      src/app/pages/equipment-info/addequipment/addequipment.component.scss
  14. 15
      src/app/pages/equipment-info/addequipment/addequipment.component.ts
  15. 1
      src/app/pages/equipment-info/editequipment/editequipment.component.html
  16. 0
      src/app/pages/equipment-info/editequipment/editequipment.component.scss
  17. 15
      src/app/pages/equipment-info/editequipment/editequipment.component.ts
  18. 82
      src/app/pages/equipment-info/equipment-info.component.html
  19. 117
      src/app/pages/equipment-info/equipment-info.component.scss
  20. 23
      src/app/pages/equipment-info/equipment-info.component.ts
  21. 6
      src/app/pages/home/home.component.html
  22. 1
      src/app/pages/oil-station-info/oil-station-info.component.html
  23. 0
      src/app/pages/oil-station-info/oil-station-info.component.scss
  24. 15
      src/app/pages/oil-station-info/oil-station-info.component.ts
  25. 7
      src/app/pages/pages-routing.module.ts
  26. 8
      src/app/pages/pages.module.ts
  27. 12
      src/app/pages/plan/plan.component.ts
  28. 2
      src/app/pages/today-warning-admin/today-warning-admin.component.html
  29. 34
      src/app/pages/today-warning-admin/today-warning-admin.component.scss
  30. 2
      src/app/pages/today-warning/today-warning.component.html
  31. 27
      src/app/pages/today-warning/today-warning.component.scss
  32. 14
      src/app/service/tree.service.ts
  33. 39
      src/app/system-management/navigation/navigation.component.html
  34. 78
      src/app/system-management/navigation/navigation.component.scss
  35. 4
      src/app/system-management/navigation/navigation.component.ts
  36. 21
      src/app/system-management/organization/addor/addor.component.html
  37. 0
      src/app/system-management/organization/addor/addor.component.scss
  38. 26
      src/app/system-management/organization/addor/addor.component.ts
  39. 21
      src/app/system-management/organization/editor/editor.component.html
  40. 0
      src/app/system-management/organization/editor/editor.component.scss
  41. 27
      src/app/system-management/organization/editor/editor.component.ts
  42. 44
      src/app/system-management/organization/organization.component.html
  43. 78
      src/app/system-management/organization/organization.component.scss
  44. 175
      src/app/system-management/organization/organization.component.ts
  45. 21
      src/app/system-management/role/addrole/addrole.component.html
  46. 0
      src/app/system-management/role/addrole/addrole.component.scss
  47. 38
      src/app/system-management/role/addrole/addrole.component.ts
  48. 18
      src/app/system-management/role/editrole/editrole.component.html
  49. 0
      src/app/system-management/role/editrole/editrole.component.scss
  50. 38
      src/app/system-management/role/editrole/editrole.component.ts
  51. 39
      src/app/system-management/role/role.component.html
  52. 54
      src/app/system-management/role/role.component.scss
  53. 127
      src/app/system-management/role/role.component.ts
  54. 13
      src/app/system-management/system-management-routing.module.ts
  55. 48
      src/app/system-management/system-management.module.ts
  56. 39
      src/app/system-management/user/adduser/adduser.component.html
  57. 0
      src/app/system-management/user/adduser/adduser.component.scss
  58. 54
      src/app/system-management/user/adduser/adduser.component.ts
  59. 39
      src/app/system-management/user/edituser/edituser.component.html
  60. 0
      src/app/system-management/user/edituser/edituser.component.scss
  61. 57
      src/app/system-management/user/edituser/edituser.component.ts
  62. 64
      src/app/system-management/user/user.component.html
  63. 87
      src/app/system-management/user/user.component.scss
  64. 186
      src/app/system-management/user/user.component.ts
  65. 4
      src/app/ui/tabbar/tabbar.component.html
  66. 7
      src/app/ui/tabbar/tabbar.component.ts
  67. BIN
      src/assets/images/icon/admin.png
  68. BIN
      src/assets/images/icon/organization.png
  69. BIN
      src/assets/images/icon/orgrey.png
  70. BIN
      src/assets/images/icon/power.png
  71. BIN
      src/assets/images/icon/role.png
  72. BIN
      src/assets/images/icon/user.png
  73. BIN
      src/assets/images/user.png
  74. BIN
      src/assets/images/userbig.png
  75. 10
      src/styles.scss
  76. 175
      src/theme.less

7
src/app/babylon/controller/info-manager.ts

@ -164,7 +164,6 @@ export class InfoManager {
modelEditData: ModelEditData,
buildingInfo: BuildingInfo = null
) {
console.trace("创建设备", buildingInfo);
let facilities = modelEditData.facilities;
@ -174,12 +173,10 @@ export class InfoManager {
let mesh: AbstractMesh = null;
let facilityData = facilities[i].facilities[j]
if (facilityData.posType == FacilityPosType.In) {
mesh = SceneManager.Instance.scene.getMeshByID(facilityData.resName);
console.log("找到内置设备", mesh.uniqueId);
if (facilityData.posType == FacilityPosType.In && buildingInfo.ModelInfo != null) {
mesh = buildingInfo.ModelInfo.getChildrenByName(facilityData.resName);
}
FacilityWindow.instance.createFacility(
modelEditData.facilities[i].facilities[j],
false,

15
src/app/babylon/controller/scene-manager.ts

@ -252,25 +252,26 @@ export class SceneManager {
*/
addToHighLight(mesh: Mesh, color: Color3) {
if (this.highLightLayer == null) {
this.highLightLayer = new HighlightLayer("highLight", this.scene);
this.highLightLayer.innerGlow = false;
}
this.highLightLayer = new HighlightLayer("highLight", this.scene,
{
mainTextureRatio: 1,
});
this.highLightLayer.innerGlow = true;
this.highLightLayer.outerGlow = true;
}
let allMesh = mesh.getChildMeshes();
this.highLightLayer.addMesh(mesh, color);
allMesh.push(mesh);
for (let i = 0; i < allMesh.length; i++) {
let childMesh = allMesh[i];
if (childMesh instanceof Mesh) {
this.highLightLayer.addMesh(childMesh, color);
this.highLightNum++;
}
}
}
highLightNum = 0;

6
src/app/babylon/controller/status/building-status.ts

@ -137,9 +137,13 @@ export class BuildingStatus extends StatusBase {
//判断已经有了就不创建了
// InfoManager.createFacilityInfos(buildingInfo.buildingData.outdoorData, buildingInfo);
//显示
this.buildingWindow.showFacilityInfosIcon(this.currentBuildingInfo, true);
//this.buildingWindow.showFacilityInfosIcon(this.currentBuildingInfo, true);
}
this.buildingWindow.changeCurrentBuildingInfo(buildingInfo.ModelInfo);
}
//模型变化

4
src/app/babylon/model/data/model-data/model-data-facility.ts

@ -246,11 +246,11 @@ export enum FacilityType {
/**
* 线
*/
XF_TSLX = "XF_TSLX",
AQSS_TSLX = "AQSS_TSLX",
/**
*
*/
XF_SSD = "XF_SSD",
AQSS_SSD = "AQSS_SSD",
/**
*

10
src/app/babylon/model/info/model/model-info-building.ts

@ -46,6 +46,16 @@ export class ModelInfo_building extends ModelInfo {
}
}
if (this.neiRoot == null) {
for (let i = 0; i < allTransformNode.length; i++) {
if (TsTool.stringContain(allTransformNode[i].name, "wai")) {
this.neiRoot = allTransformNode[i];
break;
}
}
}
if (this.neiRoot == null) {
this.neiRoot = this.modelBox;

1
src/app/babylon/model/info/model/model-info-facility.ts

@ -92,6 +92,7 @@ export class ModelInfo_facility extends ModelInfo {
});
this.uiFollowRoot.zIndex = BabylonUIStyleTool.c_zIndex_facilityIcon;
this.showFollowUI(false);
}

6
src/app/babylon/model/info/model/model-info.ts

@ -133,7 +133,6 @@ export class ModelInfo {
showFollowUI(show: boolean) {
if (this.uiFollowRoot != null) {
this.uiFollowRoot.isVisible = show;
}
}
@ -142,14 +141,13 @@ export class ModelInfo {
* @param play false表示停止
*/
playShowAnim(play: boolean) {
this.showFollowUI(play);
if (this.modelBox != null) {
if (play) {
SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Red());
SceneManager.Instance.addToHighLight(this.modelBox as Mesh, Color3.Yellow());
}
else {
SceneManager.Instance.removeFromHighLight(this.modelBox as Mesh);
}
}
}

153
src/app/babylon/view/building-window/building-window.ts

@ -1,4 +1,5 @@
import { AbstractMesh, Material, Mesh } from "@babylonjs/core";
import { PlanComponent } from "src/app/pages/plan/plan.component";
import { DataManager } from "../../controller/data-manager";
import { InfoManager } from "../../controller/info-manager";
@ -23,6 +24,11 @@ import { BuildingUIItem } from "./building-ui-item";
//建筑界面
export class BuildingWindow extends UIBase {
/**
* uv动画材质的特殊命名
*/
readonly c_MAT_UV = "MAT_UV";
static instance: BuildingWindow;
buldingStatus: BuildingStatus;
@ -302,10 +308,13 @@ export class BuildingWindow extends UIBase {
}
}
console.log("选中建筑", modelInfo);
this.showJYZModules(JYZInfoMoudleType.AQSS, false);
//this.onChangeCurrentBuildingItem(item);
// this.three.selectLeftBuilding(item);
}
/**
@ -370,6 +379,9 @@ export class BuildingWindow extends UIBase {
if (updateFacility) {
InfoManager.createFacilityInfos(buildingInfo.buildingData.outdoorData, buildingInfo);
}
if (buildingInfo instanceof BuildingInfo_Environment) {
buildingInfo.updateFuGaiCeng();
@ -581,18 +593,22 @@ export class BuildingWindow extends UIBase {
for (let i = 0; i < allNode.length; i++) {
let nodeName = allNode[i].name;
if (TsTool.stringContain(nodeName, this.c_xiaoFang)) //消防
if (TsTool.stringContain(nodeName, "primitive")) {
//复合材质被分解为多个子mesh,不看做特殊意义的对象
}
else if (TsTool.stringContain(nodeName, this.c_zheDang))//遮挡
{
this.currentBuidngItem.createFacilityByMesh(allNode[i]);
this.currentBuidngItem.createStopByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_xiaoFang))//加油站
else if (TsTool.stringContain(nodeName, this.c_xiaoFang)) //消防
{
this.currentBuidngItem.createOilingByMesh(allNode[i]);
this.currentBuidngItem.createFacilityByMesh(allNode[i]);
}
else if (TsTool.stringContain(nodeName, this.c_zheDang))//遮挡
else if (TsTool.stringContain(nodeName, this.c_jiaYou))//加油站
{
this.currentBuidngItem.createStopByMesh(allNode[i]);
this.currentBuidngItem.createOilingByMesh(allNode[i]);
}
}
}
@ -621,13 +637,17 @@ export class BuildingWindow extends UIBase {
*/
zdByMoudle: Map<JYZInfoMoudleType, FacilityInfoByType[]> = new Map();
/**
* uv动画所需材质
*/
mat_UV: Map<JYZInfoMoudleType, Material[]> = new Map();
/**
*
* @param type
* @param show
*/
showJYZModules(type: JYZInfoMoudleType, show: boolean) {
console.log("切换页签", type, show);
if (this.currentBuidngItem == null) {
return;
}
@ -643,14 +663,26 @@ export class BuildingWindow extends UIBase {
if (infos != null) {
for (let j = 0; j < infos.length; j++) {
infos[j].playShowAnim(show);
//安全疏散,特殊,要在不显示时隐藏本体
if (type == JYZInfoMoudleType.AQSS) {
infos[j].setEnable(show);
}
}
}
}
//阻挡类物体
let zdByType: FacilityInfoByType[] = [];
if (this.zdByMoudle.has(type)) {
zdByType = this.zdByMoudle.get(type);
console.log("查找阻挡物", type, zdByType);
}
else {
console.log("没找到阻挡物", type, zdByType);
}
for (let i = 0; i < zdByType.length; i++) {
let infos = zdByType[i].facilityInfo;
@ -664,7 +696,6 @@ export class BuildingWindow extends UIBase {
this.currentJYZInfoMoudleType = type;
}
else {
console.log("隐藏", this.currentJYZInfoMoudleType);
this.currentJYZInfoMoudleType = null;
// SceneManager.Instance.highLightLayer.removeAllMeshes();
@ -674,11 +705,11 @@ export class BuildingWindow extends UIBase {
/**
*
* @param moudleType
* @param moudleType
*/
initFacilityTypeByMoudleType(moudleType: JYZInfoMoudleType, buildingInfo: BuildingInfo) {
let moudleTypeKey = moudleType + "_"; //当前模块物体的特殊字段
let moudleTypeKey = moudleType; //当前模块物体的特殊字段
let zdKey = "ZD_" + moudleType; //阻挡类物体特殊字段
if (this.facilitysByMoudle.has(moudleType)) {
@ -694,24 +725,29 @@ export class BuildingWindow extends UIBase {
return; //没有设备
}
for (let i = 0; i < allFacilityByType.length; i++) {
let l_facilityByType = allFacilityByType[i];
// if (moudleType == JYZInfoMoudleType.XF) //消防-逃生
// {
// if (TsTool.stringContain(l_facilityByType.type, FacilityType.XF_TSLX)) {
// continue;
// }
// if (TsTool.stringContain(l_facilityByType.type, FacilityType.XF_SSD)) {
// continue;
// }
// }
if (TsTool.stringContain(l_facilityByType.type, zdKey)) {
if (!this.zdByMoudle.has(moudleType)) {
this.zdByMoudle.set(moudleType, []);
}
this.zdByMoudle.get(moudleType).push(l_facilityByType);
}
else if (TsTool.stringContain(l_facilityByType.type, moudleTypeKey)) {
else if (TsTool.stringContain(l_facilityByType.type, "_" + moudleTypeKey) || TsTool.stringContain(l_facilityByType.type, moudleTypeKey + "_")) {
this.facilitysByMoudle.get(moudleType).push(l_facilityByType);
}
}
// for (var l_facility in FacilityType) {
// }
}
/**
@ -720,7 +756,7 @@ export class BuildingWindow extends UIBase {
*/
showZP(show: boolean) {
this.initFacilityTypeByMoudleType(JYZInfoMoudleType.ZP, this.currentBuidngItem.buildingInfo);
let zpInfoByTypes = this.facilitysByMoudle.get(JYZInfoMoudleType.ZP);
let zpInfoByTypes = this.zdByMoudle.get(JYZInfoMoudleType.ZP);
if (zpInfoByTypes != null) {
for (let i = 0; i < zpInfoByTypes.length; i++) {
let infos = zpInfoByTypes[i].facilityInfo;
@ -731,7 +767,78 @@ export class BuildingWindow extends UIBase {
}
}
/**
* UV材质()
* @param facilityType
* @param mesh
*/
getUVMat(facilityType: FacilityType, mesh: AbstractMesh) {
let moudleType: JYZInfoMoudleType = null;
switch (facilityType) {
case FacilityType.AQSS_TSLX:
moudleType = JYZInfoMoudleType.AQSS;
break;
case FacilityType.JY_SYGX:
moudleType = JYZInfoMoudleType.SYG;
break;
case FacilityType.JY_YQHSGX:
moudleType = JYZInfoMoudleType.YQHSGX;
break;
}
if (moudleType != null) {
if (!this.mat_UV.has(moudleType)) {
this.mat_UV.set(moudleType, []);
}
let mats = this.findUVMat(mesh); //找到mesh上的uv材质
for (let i = 0; i < mats.length; i++) {
let l_mat = mats[i];
let mat_uvByType = this.mat_UV.get(moudleType);
let isRepeat = false;//是重复的
for (let j = 0; j < mat_uvByType.length; j++) {
if (isRepeat) {
continue;
}
if (l_mat == mat_uvByType[j]) {
isRepeat = true;
}
}
if (!isRepeat)//不重复,就添加进去
{
this.mat_UV.get(moudleType).push(l_mat);
}
}
}
}
/**
* mesh中uv动画所需的材质
* @param mesh
*/
private findUVMat(mesh: AbstractMesh) {
let result = [];
let childMesh = mesh.getChildMeshes();
childMesh.push(mesh);
for (let i = 0; i < childMesh.length; i++) {
let mat = childMesh[i].material;
if (TsTool.stringContain(mat.name, this.c_MAT_UV)) {
// for(let j =0;j< result.length;j++)
// {
// if(mat != result[j])
// {
result.push(mat);
// }
// }
}
}
return result;
}
//#endregion
@ -763,9 +870,9 @@ export enum JYZInfoMoudleType {
*/
YQHSGX = "YQHSGX",
/**
* 线
*
*/
TSLX = "TSLX",
AQSS = "AQSS",
/**
*

35
src/app/babylon/view/facility-window/facility-window.ts

@ -32,6 +32,7 @@ import { BabylonTool } from '../../tool/babylon-tool';
import { BabylonUIStyleTool } from '../../tool/babylon-ui-style-tool';
import { GizmoTool } from '../../tool/gizmo-tool';
import { TsTool } from '../../tool/ts-tool';
import { BuildingWindow } from '../building-window/building-window';
import { CopyFacilityInfo, FacilityInfoInSceneWindow } from '../facilityinfoinscene-window/facilityinfoinscene-window';
import { ToolbarWindow } from '../toolbar-window/toobar-window';
import { UIBase } from '../window-base/ui-base';
@ -316,10 +317,11 @@ export class FacilityWindow extends UIBase {
createNewFacilityByMesh(mesh: AbstractMesh, type: FacilityType) {
let facilityData = this.createFacilityDataFromMesh(mesh, type);
//let facilityInfo = this.createFacilityInfoFromMesh(facilityData, mesh, buildingInfo);
console.log("获取到设备" + type, mesh);
if (!this.isRepeatFacilityFromMesh(type, mesh.id)) //不重复
{
console.log("获取到设备" + type, mesh);
this.createNewFacility(facilityData, mesh);
}
@ -413,6 +415,8 @@ export class FacilityWindow extends UIBase {
onSuccess?: (modelInfo: ModelInfo_facility) => void
): ModelInfo_facility {
BuildingWindow.instance.getUVMat(facilityData.facilityType, mesh);
if (buildingInfo == null) {
buildingInfo = this.getCurrentBuildingInfo();
}
@ -583,11 +587,11 @@ export class FacilityWindow extends UIBase {
else if (TsTool.stringContain(mesh.name, FacilityType.XF_MHT)) {
this.createNewFacilityByMesh(mesh, FacilityType.XF_MHT);
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_SSD)) {
this.createNewFacilityByMesh(mesh, FacilityType.XF_SSD);
else if (TsTool.stringContain(mesh.name, FacilityType.AQSS_SSD)) {
this.createNewFacilityByMesh(mesh, FacilityType.AQSS_SSD);
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_TSLX)) {
this.createNewFacilityByMesh(mesh, FacilityType.XF_TSLX);
else if (TsTool.stringContain(mesh.name, FacilityType.AQSS_TSLX)) {
this.createNewFacilityByMesh(mesh, FacilityType.AQSS_TSLX);
}
else if (TsTool.stringContain(mesh.name, FacilityType.XF_XFCM)) {
this.createNewFacilityByMesh(mesh, FacilityType.XF_XFCM);
@ -613,15 +617,19 @@ export class FacilityWindow extends UIBase {
createOilingByMesh(mesh: AbstractMesh) {
if (TsTool.stringContain(mesh.name, FacilityType.JY_JYJ)) {
// console.log("找到加油机", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_JYJ);
}
else if (TsTool.stringContain(mesh.name, FacilityType.JY_SYGX)) {
// console.log("找到输油管线", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_SYGX);
}
else if (TsTool.stringContain(mesh.name, FacilityType.JY_YG)) {
// console.log("找到油罐", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_YG);
}
else if (TsTool.stringContain(mesh.name, FacilityType.JY_YQHSGX)) {
// console.log("找到油气回收", mesh)
this.createNewFacilityByMesh(mesh, FacilityType.JY_YQHSGX);
}
}
@ -634,21 +642,26 @@ export class FacilityWindow extends UIBase {
if (TsTool.stringContain(mesh.name, FacilityType.ZD_YG)) {
this.createNewFacilityByMesh(mesh, FacilityType.ZD_YG);
}
else if (TsTool.stringContain(mesh.name, FacilityType.ZD_SYGX)) {
if (TsTool.stringContain(mesh.name, FacilityType.ZD_SYGX)) {
this.createNewFacilityByMesh(mesh, FacilityType.ZD_SYGX);
}
else if (TsTool.stringContain(mesh.name, FacilityType.ZD_YQHSGX)) {
this.createNewFacilityByMesh(mesh, FacilityType.ZD_SYGX);
if (TsTool.stringContain(mesh.name, FacilityType.ZD_YQHSGX)) {
this.createNewFacilityByMesh(mesh, FacilityType.ZD_YQHSGX);
}
else if (TsTool.stringContain(mesh.name, FacilityType.ZD_XF)) {
if (TsTool.stringContain(mesh.name, FacilityType.ZD_XF)) {
console.log("找到消防阻挡物", mesh.name);
this.createNewFacilityByMesh(mesh, FacilityType.ZD_XF);
}
else if (TsTool.stringContain(mesh.name, FacilityType.ZD_ZP)) {
if (TsTool.stringContain(mesh.name, FacilityType.ZD_ZP)) {
this.createNewFacilityByMesh(mesh, FacilityType.ZD_ZP);
}
}
/**
* mesh创建设备
* @param mesh
* @param type
*/
createFacilityDataFromMesh(mesh: AbstractMesh, type: FacilityType) {
let name = ConfigManager.getFacilityTypeName(type);
let result = new ModelData_facility(mesh.name, type, name, mesh.id, new TransformData(), FacilityPosType.In);

2
src/app/pages/criminal-records-admin/criminal-records-admin.component.html

@ -1,4 +1,4 @@
<div class="recordsbox">
<div class="recordsboxadmin" id="recordsboxadmin">
<div class="search">
<form nz-form [formGroup]="validateForm" class="login-form" (ngSubmit)="submitForm()">
<nz-form-item class="searchParams">

2
src/app/pages/criminal-records/criminal-records.component.html

@ -1,4 +1,4 @@
<div class="recordsbox">
<div class="recordsbox" id="recordsbox">
<div class="search">
<form nz-form [formGroup]="validateForm" class="login-form" (ngSubmit)="submitForm()">
<nz-form-item class="searchParams">

1
src/app/pages/equipment-info/addequipment/addequipment.component.html

@ -0,0 +1 @@
<p>addequipment works!</p>

0
src/app/pages/equipment-info/addequipment/addequipment.component.scss

15
src/app/pages/equipment-info/addequipment/addequipment.component.ts

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-addequipment',
templateUrl: './addequipment.component.html',
styleUrls: ['./addequipment.component.scss']
})
export class AddequipmentComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

1
src/app/pages/equipment-info/editequipment/editequipment.component.html

@ -0,0 +1 @@
<p>editequipment works!</p>

0
src/app/pages/equipment-info/editequipment/editequipment.component.scss

15
src/app/pages/equipment-info/editequipment/editequipment.component.ts

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-editequipment',
templateUrl: './editequipment.component.html',
styleUrls: ['./editequipment.component.scss']
})
export class EditequipmentComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

82
src/app/pages/equipment-info/equipment-info.component.html

@ -0,0 +1,82 @@
<!-- <p>器材管理</p> -->
<div class="box" id="equipmentInfo">
<div class="content">
<div class="title">
<app-title [name]="'编辑器材信息'"></app-title>
</div>
<div class="topbox">
<div class="lefttop">
<span>消防器材列表</span>
</div>
<div class="righttop">
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入器材名称" formControlName="search" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
<button nz-button (click)="add()">新增</button>
</div>
</div>
<div class="tablebox">
<div class="table">
<div nz-row class="th">
<div nz-col nzSpan="5" style="box-sizing: border-box;padding-left: 28px;">
消防器材
</div>
<div nz-col nzSpan="4">
规格
</div>
<div nz-col nzSpan="4">
购入日期
</div>
<div nz-col nzSpan="4">
生产日期
</div>
<div nz-col nzSpan="4">
有效期至
</div>
<div nz-col nzSpan="3">
操作
</div>
</div>
<div class="tbody">
<div nz-row class="tr" *ngFor="let item of arr">
<div nz-col nzSpan="5" style="box-sizing: border-box;padding-left: 28px;">
干粉灭火器
</div>
<div nz-col nzSpan="4">
普通
</div>
<div nz-col nzSpan="4">
2021.01.05
</div>
<div nz-col nzSpan="4">
2021.01.05
</div>
<div nz-col nzSpan="4">
2021.01.05
</div>
<div nz-col nzSpan="3" class="btn">
<span>
编辑
</span>
<span>
删除
</span>
</div>
</div>
</div>
</div>
<div class="pagination">
<nz-pagination [nzPageIndex]="1" [nzTotal]="85" [nzPageSize]="20" [nzShowTotal]="totalTemplate"
nzShowQuickJumper></nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共100条 </ng-template>
</div>
</div>
</div>
</div>

117
src/app/pages/equipment-info/equipment-info.component.scss

@ -0,0 +1,117 @@
.box {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
}
.content {
width: 1000px;
height: 100%;
display: flex;
flex-direction: column;
.title {
height: 48px;
width: 100%;
margin: 16px 0;
}
.topbox {
width: 1000px;
height: 34px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
.lefttop {
span {
color: #C4E2FC;
font-size: 16px;
}
}
.righttop {
height: 34px;
display: flex;
button {
margin-left: 16px;
background: #143c61;
color: #91CCFF;
border-radius: 0px;
border: 1px solid #36A2FF;
width: 64px;
}
nz-input-group {
height: 32px;
}
}
}
.tablebox {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
.table {
color: white;
flex: 1;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
font-size: 16px;
.th {
height: 40px;
line-height: 40px;
color: #23D9FF;
background: rgba(35, 153, 255, 0.2);
border: 1px solid rgba(35, 217, 255, 0.4);
// box-shadow: 0 0 3px 1px rgba(35, 217, 255, 0.4);
}
.tbody {
flex: 1;
overflow-y: auto;
color: #C4E2FC;
font-size: 15px;
.tr {
height: 40px;
line-height: 40px;
border-bottom: 1px solid #115188;
.btn {
span {
color: #2399FF;
cursor: pointer;
}
span:nth-child(1) {
margin-right: 18px;
}
}
}
}
}
.pagination {
height: 32px;
margin: 15px 0;
display: flex;
align-items: center;
justify-content: center;
}
::-webkit-scrollbar {
width: 0px;
}
}
}

23
src/app/pages/equipment-info/equipment-info.component.ts

@ -0,0 +1,23 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-equipment-info',
templateUrl: './equipment-info.component.html',
styleUrls: ['./equipment-info.component.scss']
})
export class EquipmentInfoComponent implements OnInit {
validateForm!: FormGroup;
constructor(private fb: FormBuilder) { }
arr = [1,1,1,1,1,1,1,1,1]
ngOnInit(): void {
this.validateForm = this.fb.group({
search: [null]
});
}
submitForm(){
}
add(){
}
}

6
src/app/pages/home/home.component.html

@ -12,6 +12,12 @@
<li [routerLink]="['/home/records/admin']" routerLinkActive="router-link-active">
违规记录
</li>
<!-- <li [routerLink]="['/home/equipmentInfo']" routerLinkActive="router-link-active">
器材信息
</li>
<li [routerLink]="['/home/oliStationInfo']" routerLinkActive="router-link-active">
基本信息
</li> -->
</div>
<div class="content">
<router-outlet></router-outlet>

1
src/app/pages/oil-station-info/oil-station-info.component.html

@ -0,0 +1 @@
<p>oil-station-info works!</p>

0
src/app/pages/oil-station-info/oil-station-info.component.scss

15
src/app/pages/oil-station-info/oil-station-info.component.ts

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-oil-station-info',
templateUrl: './oil-station-info.component.html',
styleUrls: ['./oil-station-info.component.scss']
})
export class OilStationInfoComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

7
src/app/pages/pages-routing.module.ts

@ -6,13 +6,18 @@ import { CriminalRecordsComponent } from './criminal-records/criminal-records.co
import {AuthGuard} from '../auth.guard'
import { TodayWarningAdminComponent } from './today-warning-admin/today-warning-admin.component';
import { CriminalRecordsAdminComponent } from './criminal-records-admin/criminal-records-admin.component';
import { OilStationInfoComponent } from './oil-station-info/oil-station-info.component';
import { EquipmentInfoComponent } from './equipment-info/equipment-info.component';
const routes: Routes = [
{ path: 'plan', component: PlanComponent , data: { permission: 'xxxx' },canActivate: [AuthGuard]},
{ path: 'warning/petrolStation', component: TodayWarningComponent },
{ path: 'warning/admin', component: TodayWarningAdminComponent },
{ path: 'records/petrolStation', component: CriminalRecordsComponent },
{ path: 'records/admin', component: CriminalRecordsAdminComponent }
{ path: 'records/admin', component: CriminalRecordsAdminComponent },
{ path: 'equipmentInfo', component: EquipmentInfoComponent },
{ path: 'oliStationInfo', component: OilStationInfoComponent }
];
@NgModule({

8
src/app/pages/pages.module.ts

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { A11yModule } from '@angular/cdk/a11y';
import { A11yModule } from '@angular/cdk/a11y';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { PortalModule } from '@angular/cdk/portal';
import { ScrollingModule } from '@angular/cdk/scrolling';
@ -31,9 +31,13 @@ import { NzMessageModule } from 'ng-zorro-antd/message';
import { NzSpinModule } from 'ng-zorro-antd/spin';
import { TodayWarningAdminComponent } from './today-warning-admin/today-warning-admin.component';
import { CriminalRecordsAdminComponent } from './criminal-records-admin/criminal-records-admin.component';
import { EquipmentInfoComponent } from './equipment-info/equipment-info.component';
import { OilStationInfoComponent } from './oil-station-info/oil-station-info.component';
import { LeftDomainComponent } from './left-domain/left-domain.component';
import { AddequipmentComponent } from './equipment-info/addequipment/addequipment.component';
import { EditequipmentComponent } from './equipment-info/editequipment/editequipment.component';
@NgModule({
declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent,],
declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent, EquipmentInfoComponent, OilStationInfoComponent, AddequipmentComponent, EditequipmentComponent],
imports: [
PagesRoutingModule,
CommonModule,

12
src/app/pages/plan/plan.component.ts

@ -96,7 +96,7 @@ export class PlanComponent implements OnInit {
allFence: string[] = ["基本信息", "加油机", "油罐设备", "消防设施", "安全疏散", "输油管线", "油气回收", "应急处置"]; //头部 功能栏
selectFence: number = -1; //选中 头部功能栏
isShowChildComponent: boolean = false; //是否 显示左侧子组件
@ViewChild('leftDomain')leftDomain: LeftDomainComponent; //子组件引用
@ViewChild('leftDomain') leftDomain: LeftDomainComponent; //子组件引用
isOpenAwning: boolean = true; //是否 打开罩棚
selectMeasure: number = 0; //当前选择 测量工具
@ -106,14 +106,14 @@ export class PlanComponent implements OnInit {
let buildingWindow: BuildingWindow = this.beforeOneSatus.buildingWindow;
let fenceType: JYZInfoMoudleType = this.getFenceType(type)
if (this.selectFence != type) {
this.isShowChildComponent && this.leftDomain? this.leftDomain.initComponent(type) : null; //手动初始化子组件
this.isShowChildComponent && this.leftDomain ? this.leftDomain.initComponent(type) : null; //手动初始化子组件
this.selectFence = type
this.isShowChildComponent = true
type>0 && type<7? buildingWindow.showJYZInfoModel(fenceType, true) : null
type > 0 && type < 7 ? buildingWindow.showJYZInfoModel(fenceType, true) : null
} else { //取消选中
this.selectFence = -1
this.isShowChildComponent = false
type>0 && type<7? buildingWindow.showJYZInfoModel(fenceType, false) : null
type > 0 && type < 7 ? buildingWindow.showJYZInfoModel(fenceType, false) : null
}
}
@ -127,7 +127,7 @@ export class PlanComponent implements OnInit {
} else if (type === 3) {
fenceType = JYZInfoMoudleType.XF
} else if (type === 4) {
fenceType = JYZInfoMoudleType.TSLX
fenceType = JYZInfoMoudleType.AQSS
} else if (type === 5) {
fenceType = JYZInfoMoudleType.SYG
} else if (type === 6) {
@ -138,7 +138,7 @@ export class PlanComponent implements OnInit {
//切换 头部罩棚
toggleHeaderAwning(isOpen: boolean) {
this.isOpenAwning = isOpen
this.isOpenAwning = isOpen;
ToolbarWindow.instance.showZP(isOpen)
}

2
src/app/pages/today-warning-admin/today-warning-admin.component.html

@ -1,4 +1,4 @@
<div class="warningbox">
<div class="warningbox" id="warningboxadmin">
<div class="title">
<app-title [name]="'当日违规事件列表'"></app-title>
</div>

34
src/app/pages/today-warning-admin/today-warning-admin.component.scss

@ -35,14 +35,15 @@
}
nz-select {
color: rgba(145, 204, 255, 0.95);;
color: rgba(145, 204, 255, 0.95);
;
}
nz-date-picker {
background-color: rgba(0, 0, 0, 0);
width: 145%;
}
}
}
@ -91,6 +92,7 @@
text-overflow: ellipsis;
display: flex;
align-items: center;
button {
font-size: 15px;
background-color: #013064;
@ -110,9 +112,11 @@
text-align: center;
margin-left: 8px;
}
.propsm1 {
background: #2399FF;
}
.propsm2 {
background: #FF9963;
}
@ -126,32 +130,6 @@
color: #23D9FF;
}
}
}
//遮罩层
::ng-deep .vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
}
::ng-deep .ant-modal-body {
background: #072549;
height: 660px;
padding: 5px;
// border: 1px solid #8eb9e3;
box-shadow: 0 0 3px #8eb9e3;
color: #fff;
}
::ng-deep .ant-modal-close-x {
width: 36px;
height: 36px;
line-height: 36px;
color: white;
}
::ng-deep .vertical-center-modal .ant-modal {
top: 0;
}

2
src/app/pages/today-warning/today-warning.component.html

@ -1,4 +1,4 @@
<div class="warningbox">
<div class="warningbox" id="warningbox">
<div class="title">
<app-title [name]="'当日违规事件列表'"></app-title>
</div>

27
src/app/pages/today-warning/today-warning.component.scss

@ -99,30 +99,3 @@
}
}
//遮罩层
::ng-deep .vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
}
::ng-deep .ant-modal-body {
background: #072549;
height: 660px;
padding: 5px;
// border: 1px solid #8eb9e3;
box-shadow: 0 0 3px #8eb9e3;
color: #fff;
}
::ng-deep .ant-modal-close-x {
width: 36px;
height: 36px;
line-height: 36px;
color: white;
}
::ng-deep .vertical-center-modal .ant-modal {
top: 0;
}

14
src/app/service/tree.service.ts

@ -18,13 +18,13 @@ export class TreeService {
parentNode.children = []
}
if (parentNode.children.length == 0) {
item.isTop = true;
} else {
item.isTop = false;
parentNode.children[parentNode.children.length -1].isBottom = false;
}
item.isBottom = true;
// if (parentNode.children.length == 0) {
// item.isTop = true;
// } else {
// item.isTop = false;
// parentNode.children[parentNode.children.length -1].isBottom = false;
// }
// item.isBottom = true;
parentNode.children.push(item)
}else{

39
src/app/system-management/navigation/navigation.component.html

@ -1 +1,38 @@
<p>系统管理页面</p>
<!-- <p>系统管理页面</p> -->
<nz-layout>
<nz-sider [nzWidth]='300'>
<div class="logo">
<img src="../../../assets/images/logo.png" alt="">
</div>
<div class="headPortrait">
<div class="photograph">
<img src="../../../assets/images/userbig.png" alt="">
</div>
<span>Administrator</span>
<span><img src="../../../assets/images/icon/admin.png" alt=""> 管理员</span>
</div>
<div class="nav">
<ul>
<li [routerLink]="['/system/organization']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/organization.png" alt="">组织机构管理</li>
<li [routerLink]="['/system/user']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/user.png" alt="">用户管理</li>
<li [routerLink]="['/system/role']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/role.png" alt="">角色管理</li>
</ul>
</div>
</nz-sider>
<nz-layout>
<nz-header>
<span>Hey,欢迎登录中化油站可视化智能安全管理系统</span>
<a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false'>
<i nz-icon nzType="setting"></i>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item (click)="signOut()">退出</li>
</ul>
</nz-dropdown-menu>
</nz-header>
<nz-content>
<router-outlet></router-outlet>
</nz-content>
</nz-layout>
</nz-layout>

78
src/app/system-management/navigation/navigation.component.scss

@ -0,0 +1,78 @@
nz-layout {
width: 100%;
height: 100%;
color: #fff;
font-size: 16px !important;
}
nz-sider {
background: #001B3B;
display: flex;
flex-direction: column;
align-items: center;
.logo {
width: 100%;
display: flex;
justify-content: center;
margin-top: 40px;
}
.headPortrait {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 46px;
margin-bottom: 46px;
.photograph {
// width: 140px;
// height: 140px;
// border: 4px solid #FFFFFF;
// opacity: 1;
// border-radius: 32px;
}
span {
margin-top: 18px;
}
}
.nav {
ul {
li {
width: 300px;
height: 40px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: left;
margin-bottom: 16px;
box-sizing: border-box;
padding-left: 26%;
img{
margin-right: 8px;
}
}
.router-link-active {
background: linear-gradient(90deg, rgba(0, 13, 33, 0) 0%, #2399FF 52%, rgba(0, 13, 33, 0) 100%);
}
}
}
}
nz-header {
height: 56px;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
}
nz-content {
background: #F2F2F2;
box-sizing: border-box;
padding: 16px;
}

4
src/app/system-management/navigation/navigation.component.ts

@ -11,5 +11,7 @@ export class NavigationComponent implements OnInit {
ngOnInit(): void {
}
signOut() {
// history.go(-1);
}
}

21
src/app/system-management/organization/addor/addor.component.html

@ -0,0 +1,21 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-control nzErrorTip="请输入名称">
<nz-input-group>
<input nz-input type="text" formControlName="name" placeholder="请输入名称" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<!-- <nz-form-item>
<nz-form-control>
<nz-select formControlName="power" nzPlaceHolder="请选择权限" (nzScrollToBottom)="loadMore()" nzMode="multiple">
<nz-option *ngFor="let o of optionList" [nzValue]="o" [nzLabel]="o.displayName"></nz-option>
</nz-select>
<ng-template #renderTemplate>
<nz-spin *ngIf="isLoading"></nz-spin>
</ng-template>
</nz-form-control>
</nz-form-item> -->
</form>
</div>

0
src/app/system-management/organization/addor/addor.component.scss

26
src/app/system-management/organization/addor/addor.component.ts

@ -0,0 +1,26 @@
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-addor',
templateUrl: './addor.component.html',
styleUrls: ['./addor.component.scss']
})
export class AddorComponent implements OnInit {
@Input() title?: string;
@Input() subtitle?: string;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
name: [null, [Validators.required]]
});
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
}

21
src/app/system-management/organization/editor/editor.component.html

@ -0,0 +1,21 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-control nzErrorTip="请输入名称">
<nz-input-group>
<input nz-input type="text" formControlName="name" placeholder="请输入名称" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<!-- <nz-form-item>
<nz-form-control>
<nz-select formControlName="power" nzPlaceHolder="请选择权限" (nzScrollToBottom)="loadMore()" nzMode="multiple">
<nz-option *ngFor="let o of optionList" [nzValue]="o" [nzLabel]="o.displayName"></nz-option>
</nz-select>
<ng-template #renderTemplate>
<nz-spin *ngIf="isLoading"></nz-spin>
</ng-template>
</nz-form-control>
</nz-form-item> -->
</form>
</div>

0
src/app/system-management/organization/editor/editor.component.scss

27
src/app/system-management/organization/editor/editor.component.ts

@ -0,0 +1,27 @@
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-editor',
templateUrl: './editor.component.html',
styleUrls: ['./editor.component.scss']
})
export class EditorComponent implements OnInit {
@Input() data?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
power: [null, [Validators.required]]
});
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
}

44
src/app/system-management/organization/organization.component.html

@ -1 +1,43 @@
<p>organization works!</p>
<div class="orbox" id="orbox">
<div class="topbox">
<div class="lefttop">
<span>组织机构列表</span>
<span><img style="vertical-align: top;" src="../../../assets/images/icon/orgrey.png" alt=""> {{totalCount}}个单位</span>
</div>
<div class="righttop">
<!-- <form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" formControlName="search" [(ngModel)]="searchValue"/>
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form> -->
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" [(ngModel)]="searchValue"/>
</nz-input-group>
<button nz-button nzType="primary" (click)="addOr()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增</button>
</div>
</div>
<div class="treeTitle">
<span>组织机构</span>
<span>操作</span>
</div>
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandAll]="nzExpandAll" [nzExpandedKeys]="defaultExpandedKeys"
(nzClick)="nzClick($event)" (nzContextMenu)="nzClick($event)" (nzCheckBoxChange)="nzCheck($event)"
(nzExpandChange)="nzCheck($event)" [nzTreeTemplate]="nzTreeTemplate">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
<span class="operation">
<span (click)="addOr(node)">新增</span>
<span (click)="editOr(node)">编辑</span>
<span (click)="deleteOr(node)">删除</span>
</span>
</div>
</ng-template>
</div>

78
src/app/system-management/organization/organization.component.scss

@ -0,0 +1,78 @@
.orbox {
width: 100%;
height: 100%;
overflow-y: auto;
background: #fff;
box-sizing: border-box;
padding: 20px;
font-size: 15px;
}
.topbox {
width: 700px;
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
.lefttop {
span:nth-child(1) {
color: #000D21;
margin-right: 16px;
}
span:nth-child(2) {
color: rgba(36, 36, 36, 0.24);
}
}
.righttop {
height: 36px;
display: flex;
button {
margin-left: 16px;
}
nz-input-group {
height: 32px;
}
}
}
.treeTitle {
width: 700px;
height: 36px;
line-height: 36px;
display: flex;
justify-content: space-between;
color: #000D21;
box-sizing: border-box;
padding-left: 30px;
padding-right: 180px;
background: rgba(145, 204, 255, 0.2);
margin: 12px 0;
}
.nodebox {
font-size: 15px;
}
.operation {
position: absolute;
right: 0;
span {
margin-left: 40px;
}
span:nth-child(1),
span:nth-child(2) {
color: #2399FF;
}
span:nth-child(3) {
color: rgba(0, 13, 33, 0.48);
}
}

175
src/app/system-management/organization/organization.component.ts

@ -1,15 +1,182 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core';
import { TreeService } from 'src/app/service/tree.service';
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message';
import { AddorComponent } from './addor/addor.component';
import { EditorComponent } from './editor/editor.component';
@Component({
selector: 'app-organization',
templateUrl: './organization.component.html',
styleUrls: ['./organization.component.scss']
})
export class OrganizationComponent implements OnInit {
constructor() { }
validateForm!: FormGroup;
constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
search: [null]
});
this.getAllOrganization()
}
//搜索框提交
submitForm(): void {
console.log(12345)
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
}
//获取所有组织机构
searchValue = '';
nzExpandAll = false;
totalCount:string
getAllOrganization() {
this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => {
this.totalCount = data.result.totalCount
// console.log('组织机构',data.result.totalCount)
data.result.items.forEach(element => {
element.key = element.code
element.title = element.displayName
element.selectable = false
});
this.nodes = [...this.toTree.toTree(data.result.items)]
// this.nzExpandAll = true;
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
this.defaultExpandedKeys.push(item.key)
})
})
}
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent;
defaultExpandedKeys = [];
nodes: any[] = []
nzClick(event: NzFormatEmitEvent): void {
// console.log(event);
console.log('展开节点', this.nzTreeComponent.getExpandedNodeList())
}
nzCheck(event: NzFormatEmitEvent): void {
console.log(event);
}
// nzSelectedKeys change
nzSelect(keys: string[]): void {
console.log(keys, this.nzTreeComponent.getSelectedNodeList());
}
ngAfterViewInit(): void {
// get node by key: '10011'
console.log(this.nzTreeComponent.getTreeNodeByKey('10011'));
// use tree methods
console.log(
this.nzTreeComponent.getTreeNodes(),
this.nzTreeComponent.getCheckedNodeList(),
this.nzTreeComponent.getSelectedNodeList(),
this.nzTreeComponent.getExpandedNodeList()
);
}
addOr(node?: any) {
const modal = this.modal.create({
nzTitle: node ? '新增组织机构' : '新增一级组织机构',
nzContent: AddorComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzComponentParams: {
title: '',
subtitle: ''
},
nzOnOk: async () => {
console.log('hhhhhhh', instance.validateForm)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let body = {
}
this.http.post('/api/services/app/User/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
return true
}, err => {
resolve(err)
this.message.create('warning', '创建失败');
return false
})
})
} else {
this.message.create('warning', '请填写完整!');
return false
}
}
});
const instance = modal.getContentComponent();
}
editOr(node) {
console.log(node)
const modal = this.modal.create({
nzTitle: '编辑组织机构',
nzContent: EditorComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzComponentParams: {
data: node,
},
nzOnOk: async () => {
console.log('hhhhhhh', instance.validateForm)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let body = {
}
this.http.post('/api/services/app/User/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '编辑成功!');
return true
}, err => {
resolve(err)
this.message.create('warning', '创建失败');
return false
})
})
} else {
this.message.create('warning', '请填写完整!');
return false
}
}
});
const instance = modal.getContentComponent();
}
deleteOr(item) {
console.log(item)
this.modal.confirm({
nzTitle: `确定要删除${item.title}这个机构吗?`,
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
this.http.delete('/api/services/app/Role/Delete', {
params: {
Id: item.id
}
}).subscribe(data => {
this.message.create('success', '删除成功!');
})
},
nzCancelText: '取消',
nzOnCancel: () => {
}
});
}
}

21
src/app/system-management/role/addrole/addrole.component.html

@ -0,0 +1,21 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-control nzErrorTip="请输入名称">
<nz-input-group>
<input nz-input type="text" formControlName="name" placeholder="请输入名称" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-select formControlName="power" nzPlaceHolder="请选择权限" (nzScrollToBottom)="loadMore()" nzMode="multiple">
<nz-option *ngFor="let o of optionList" [nzValue]="o" [nzLabel]="o.displayName"></nz-option>
</nz-select>
<ng-template #renderTemplate>
<nz-spin *ngIf="isLoading"></nz-spin>
</ng-template>
</nz-form-control>
</nz-form-item>
</form>
</div>

0
src/app/system-management/role/addrole/addrole.component.scss

38
src/app/system-management/role/addrole/addrole.component.ts

@ -0,0 +1,38 @@
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-addrole',
templateUrl: './addrole.component.html',
styleUrls: ['./addrole.component.scss']
})
export class AddroleComponent implements OnInit {
@Input() title?: string;
@Input() subtitle?: string;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
ngOnInit(): void {
this.loadMore();
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
power: [null, [Validators.required]]
});
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
optionList = [];
isLoading = false;
//获取权限列表
loadMore() {
this.isLoading = true;
this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data:any) => {
this.isLoading = false;
this.optionList = data.result.items
console.log('所有权限',data)
})
}
}

18
src/app/system-management/role/editrole/editrole.component.html

@ -0,0 +1,18 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-control nzErrorTip="请输入名称">
<nz-input-group>
<input [(ngModel)]="data.name" nz-input type="text" formControlName="name" placeholder="请输入名称" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-select [(ngModel)]="multipleValue" formControlName="power" nzPlaceHolder="请选择权限" (nzScrollToBottom)="loadMore()" nzMode="multiple">
<nz-option *ngFor="let o of optionList" [nzValue]="o.name" [nzLabel]="o.displayName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

0
src/app/system-management/role/editrole/editrole.component.scss

38
src/app/system-management/role/editrole/editrole.component.ts

@ -0,0 +1,38 @@
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-editrole',
templateUrl: './editrole.component.html',
styleUrls: ['./editrole.component.scss']
})
export class EditroleComponent implements OnInit {
@Input() data?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
multipleValue:any
ngOnInit(): void {
this.multipleValue = this.data.grantedPermissions
this.loadMore();
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
power: [null, [Validators.required]]
});
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
optionList = [];
//获取权限列表
loadMore() {
this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data:any) => {
this.optionList = data.result.items
console.log('所有权限',data)
})
}
}

39
src/app/system-management/role/role.component.html

@ -1 +1,38 @@
<p>role works!</p>
<div class="roleBox" id="roleBox">
<div class="topbox">
<div class="lefttop">
<span>角色列表</span>
</div>
<div class="righttop">
<button nz-button nzType="primary" (click)="addRole()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增</button>
</div>
</div>
<div class="tablebox">
<nz-table #basicTable [nzData]="listOfData" [nzShowPagination]='false' [nzPageSize]='16'>
<thead>
<tr>
<th style="padding-left: 40px;">角色</th>
<th>权限</th>
<th>创建/修改时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>
<span *ngFor="let item of data.grantedFlatPermissions">{{item.displayName}}</span>
</td>
<td>
{{(data.lastModificationTime ? data.lastModificationTime : data.creationTime) | date:"yyyy-MM-dd HH:mm:ss"}}
</td>
<td class="operation">
<a (click)="edit(data)">编辑</a>
<a (click)="delete(data)">删除</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
</div>

54
src/app/system-management/role/role.component.scss

@ -0,0 +1,54 @@
.roleBox {
width: 100%;
height: 100%;
background: #FFFFFF;
box-sizing: border-box;
padding: 20px;
overflow: hidden;
display: flex;
flex-direction: column;
tbody {
tr {
td {
span {
margin-right: 18px;
}
}
td:nth-child(1){
padding-left: 40px;
}
}
.operation {
a {
color: #2399FF;
margin-right: 8px;
}
a:last-child {
color: rgba(0, 13, 33, 0.48);
}
}
}
}
.topbox {
width: 100%;
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.lefttop {
span {
color: #000D21;
}
}
}
.tablebox {
flex: 1;
overflow-y: auto;
}

127
src/app/system-management/role/role.component.ts

@ -1,5 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message';
import { HttpClient } from '@angular/common/http';
import { AddroleComponent } from './addrole/addrole.component';
import { EditroleComponent } from './editrole/editrole.component';
@Component({
selector: 'app-role',
templateUrl: './role.component.html',
@ -7,9 +13,126 @@ import { Component, OnInit } from '@angular/core';
})
export class RoleComponent implements OnInit {
constructor() { }
constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient) { }
ngOnInit(): void {
this.getAllRoles()
}
listOfData: any[] = [];
//获取角色列表
getAllRoles() {
this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => {
console.log('角色列表', data.result.items)
this.listOfData = data.result.items
})
}
addRole(): void {
const modal = this.modal.create({
nzTitle: '新增角色',
nzContent: AddroleComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzComponentParams: {},
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise(resolve => {
console.log('表单信息', instance.validateForm)
let arr = []
instance.validateForm.value.power.forEach(element => {
arr.push(element.name)
});
let body = {
name: instance.validateForm.value.name,
DisplayName: instance.validateForm.value.name,
grantedPermissions: arr
}
this.http.post('/api/services/app/Role/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getAllRoles()
return true
})
})
} else {
this.message.create('warning', '请填写完整!');
return false
}
}
});
const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
// Return a result when closed
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
}
edit(item) {
const modal = this.modal.create({
nzTitle: '编辑角色',
nzContent: EditroleComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzComponentParams: {
data: item
},
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise(resolve => {
console.log('表单信息', instance.validateForm)
let arr = []
instance.validateForm.value.power.forEach(element => {
arr.push(element.name ? element.name : element)
});
let body = {
id: item.id,
name: instance.validateForm.value.name,
DisplayName: instance.validateForm.value.name,
grantedPermissions: arr
}
this.http.put('/api/services/app/Role/Update', body).subscribe(data => {
resolve(data)
this.message.create('success', '修改成功!');
this.getAllRoles()
return true
})
})
} else {
this.message.create('warning', '请填写完整!');
return false
}
}
});
const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
// Return a result when closed
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
}
delete(item) {
console.log(item)
this.modal.confirm({
nzTitle: `确定要删除${item.name}这个角色吗?`,
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
this.http.delete('/api/services/app/Role/Delete', {
params: {
Id: item.id
}
}).subscribe(data => {
this.message.create('success', '删除成功!');
this.getAllRoles()
})
},
nzCancelText: '取消',
nzOnCancel: () => {
}
});
}
}

13
src/app/system-management/system-management-routing.module.ts

@ -1,14 +1,15 @@
import { Routes, RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import {AuthGuard} from '../auth.guard'
import { AuthGuard } from '../auth.guard'
import { RoleComponent } from './role/role.component';
import { OrganizationComponent } from './organization/organization.component';
import { UserComponent } from './user/user.component';
const routes: Routes = [
// { path: 'plan', component: PlanComponent },
// { path: 'warning/petrolStation', component: TodayWarningComponent },
// { path: 'warning/admin', component: TodayWarningAdminComponent },
// { path: 'records/petrolStation', component: CriminalRecordsComponent },
// { path: 'records/admin', component: CriminalRecordsAdminComponent }
{ path: 'organization', component: OrganizationComponent },
{ path: 'user', component: UserComponent },
{ path: 'role', component: RoleComponent }
];
@NgModule({

48
src/app/system-management/system-management.module.ts

@ -5,14 +5,50 @@ import { OrganizationComponent } from './organization/organization.component';
import { UserComponent } from './user/user.component';
import { RoleComponent } from './role/role.component';
import { NavigationComponent } from './navigation/navigation.component';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzTableModule } from 'ng-zorro-antd/table';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import { NzInputModule } from 'ng-zorro-antd/input';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzFormModule } from 'ng-zorro-antd/form';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { AdduserComponent } from './user/adduser/adduser.component';
import { EdituserComponent } from './user/edituser/edituser.component';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzMessageModule } from 'ng-zorro-antd/message';
import { NzTreeModule } from 'ng-zorro-antd/tree';
import { AddroleComponent } from './role/addrole/addrole.component';
import { EditroleComponent } from './role/editrole/editrole.component';
import { NzSpinModule } from 'ng-zorro-antd/spin';
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select';
import { AddorComponent } from './organization/addor/addor.component';
import { EditorComponent } from './organization/editor/editor.component';
@NgModule({
declarations: [OrganizationComponent, UserComponent, RoleComponent, NavigationComponent],
declarations: [OrganizationComponent, UserComponent, RoleComponent, NavigationComponent, AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent],
imports: [
CommonModule,
SystemRoutingModule
]
SystemRoutingModule,
NzLayoutModule,
NzIconModule,
NzTableModule,
NzDropDownModule,
NzPaginationModule,
NzInputModule,
NzButtonModule,
NzFormModule,
FormsModule,
ReactiveFormsModule,
NzModalModule,
NzSelectModule,
NzMessageModule,
NzTreeModule,
NzSpinModule,
NzTreeSelectModule
],
entryComponents :[AdduserComponent,EdituserComponent,AddroleComponent,EditroleComponent,AddorComponent,EditorComponent]
})
export class SystemManagementModule { }

39
src/app/system-management/user/adduser/adduser.component.html

@ -0,0 +1,39 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="account" placeholder="请输入账号" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="name" placeholder="请输入姓名" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-tree-select formControlName="organization" [nzNodes]="nodes" nzPlaceHolder="请选择所属机构">
</nz-tree-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-select formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.name" [nzLabel]="item.displayName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="phonenum" placeholder="请输入手机号" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
</div>

0
src/app/system-management/user/adduser/adduser.component.scss

54
src/app/system-management/user/adduser/adduser.component.ts

@ -0,0 +1,54 @@
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { TreeService } from 'src/app/service/tree.service';
@Component({
selector: 'app-adduser',
templateUrl: './adduser.component.html',
styleUrls: ['./adduser.component.scss']
})
export class AdduserComponent implements OnInit {
@Input() title?: string;
@Input() subtitle?: string;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
account: [null, [Validators.required]],
name: [null, [Validators.required]],
organization: [null, [Validators.required]],
role: [null, [Validators.required]],
phonenum: [null, [Validators.required]]
});
this.getAllRoles()
this.getAllOrganization()
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
listOfData: any[] = [];
//获取角色列表
getAllRoles() {
this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => {
console.log('角色列表', data.result.items)
this.listOfData = data.result.items
})
}
//获取所有组织机构
nodes:any = []
getAllOrganization() {
this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => {
data.result.items.forEach(element => {
element.key = element.code
element.title = element.displayName
});
this.nodes = [...this.toTree.toTree(data.result.items)]
})
}
}

39
src/app/system-management/user/edituser/edituser.component.html

@ -0,0 +1,39 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input [(ngModel)]="data.userName" nz-input type="text" formControlName="account" placeholder="请输入账号" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input [(ngModel)]="data.name" nz-input type="text" formControlName="name" placeholder="请输入姓名" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-tree-select [(ngModel)]="data.organizationId" formControlName="organization" [nzNodes]="nodes" nzPlaceHolder="请选择所属机构">
</nz-tree-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-select [(ngModel)]="data.roleNames" formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.name" [nzLabel]="item.displayName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<nz-input-group>
<input [(ngModel)]="data.phoneNumber" nz-input type="text" formControlName="phonenum" placeholder="请输入手机号" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
</div>

0
src/app/system-management/user/edituser/edituser.component.scss

57
src/app/system-management/user/edituser/edituser.component.ts

@ -0,0 +1,57 @@
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { TreeService } from 'src/app/service/tree.service';
@Component({
selector: 'app-edituser',
templateUrl: './edituser.component.html',
styleUrls: ['./edituser.component.scss']
})
export class EdituserComponent implements OnInit {
@Input() data?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
account: [null, [Validators.required]],
name: [null, [Validators.required]],
organization: [null, [Validators.required]],
role: [null, [Validators.required]],
phonenum: [null, [Validators.required]]
});
console.log(this.data)
this.getAllRoles()
this.getAllOrganization()
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
}
listOfData: any[] = [];
//获取角色列表
getAllRoles() {
this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => {
console.log('角色列表', data.result.items)
this.listOfData = data.result.items
})
}
//获取所有组织机构
nodes:any = []
getAllOrganization() {
this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => {
data.result.items.forEach(element => {
element.key = element.code
element.title = element.displayName
});
this.nodes = [...this.toTree.toTree(data.result.items)]
})
}
}

64
src/app/system-management/user/user.component.html

@ -1 +1,63 @@
<p>user works!</p>
<div class="userBox" id="userBox">
<div class="topbox">
<div class="lefttop">
<span>用户列表</span>
<span><i nz-icon nzType="search"></i> {{usersNum}}名用户</span>
</div>
<div class="righttop">
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入用户名" formControlName="search" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
<button nz-button nzType="primary" (click)="addUser()"><i nz-icon nzType="plus-circle"
nzTheme="outline"></i>新增</button>
</div>
</div>
<div class="tablebox">
<nz-table #basicTable [nzData]="usersLIst" [nzShowPagination]='false' [nzPageSize]='16'>
<thead>
<tr>
<th></th>
<th>账号</th>
<th>姓名</th>
<th>角色</th>
<th>所属机构</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td><img src="../../../assets/images/user.png" alt=""></td>
<td>{{ data.userName }}</td>
<td>{{ data.name }}</td>
<td>
<span *ngFor="let item of data.roleNames">{{item}}</span>
</td>
<td>
<div class="ortype">
自营
</div>
{{data.organization}}
</td>
<td class="operation">
<a (click)="editUser(data)">编辑</a>
<a (click)="resetPassword(data)">重置密码</a>
<a (click)="delete(data)">删除</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
<div class="pagination">
<nz-pagination [nzHideOnSinglePage]="true" [nzPageIndex]="1" [nzTotal]="usersNum" [nzPageSize]="1"
[nzShowTotal]="totalTemplate" nzShowQuickJumper (nzPageIndexChange)="pageChange($event)">
</nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共{{usersNum}}条 </ng-template>
</div>
</div>

87
src/app/system-management/user/user.component.scss

@ -0,0 +1,87 @@
.userBox {
width: 100%;
height: 100%;
background: #FFFFFF;
box-sizing: border-box;
padding: 20px;
overflow: hidden;
display: flex;
flex-direction: column;
thead {}
tbody {
tr {
td:nth-child(1) {
text-align: right;
}
}
.operation {
a {
color: #2399FF;
margin-right: 18px;
}
a:last-child {
color: rgba(0, 13, 33, 0.48);
}
}
}
}
.topbox {
width: 100%;
height: 36px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.lefttop {
span:nth-child(1) {
color: #000D21;
margin-right: 16px;
}
span:nth-child(2) {
color: rgba(36, 36, 36, 0.24);
}
}
.righttop {
display: flex;
button {
margin-left: 16px;
}
nz-input-group {
height: 32px;
}
}
}
.tablebox {
flex: 1;
overflow-y: auto;
}
.pagination {
margin: 15px 0;
display: flex;
align-items: center;
justify-content: center;
}
.ortype {
width: 36px;
height: 20px;
background: #2399FF;
opacity: 1;
border-radius: 2px;
font-size: 12px;
margin-right: 8px;
color: #fff;
text-align: center;
}

186
src/app/system-management/user/user.component.ts

@ -1,15 +1,193 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalService } from 'ng-zorro-antd/modal';
import { AdduserComponent } from './adduser/adduser.component';
import { NzMessageService } from 'ng-zorro-antd/message';
import { HttpClient } from '@angular/common/http';
import { EdituserComponent } from './edituser/edituser.component';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.scss']
})
export class UserComponent implements OnInit {
constructor() { }
validateForm!: FormGroup;
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient) { }
ngOnInit(): void {
this.validateForm = this.fb.group({
search: [null]
});
this.getAllUsers()
}
//获取所有用户
usersLIst: any = []
usersNum:string
SkipCount: number = 0 //0 16 32 48
MaxResultCount: number = 16
getAllUsers() {
let params = {
SkipCount: String(this.SkipCount),
MaxResultCount: String(this.MaxResultCount)
}
this.http.get('/api/services/app/User/GetAll', {
params: params
}).subscribe((data: any) => {
this.usersLIst = data.result.items
this.usersNum = data.result.totalCount
console.log('所有用户', this.usersLIst)
})
}
pageChange($event){
console.log('页码改变',$event)
}
//搜索框提交
submitForm(): void {
console.log(12345)
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
}
//新增用户
addUser(): void {
const modal = this.modal.create({
nzTitle: '新增用户',
nzContent: AdduserComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzComponentParams: {
title: '',
subtitle: ''
},
nzOnOk: async () => {
console.log('hhhhhhh', instance.validateForm)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let body = {
userName: instance.validateForm.value.account,
name: instance.validateForm.value.name,
organizationId: instance.validateForm.value.organization,
roleNames: instance.validateForm.value.role,
phoneNumber: instance.validateForm.value.phonenum,
isActive: true
}
this.http.post('/api/services/app/User/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getAllUsers()
return true
}, err => {
resolve(err)
this.message.create('warning', '创建失败');
return false
})
})
} else {
this.message.create('warning', '请填写完整!');
return false
}
}
});
const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
// Return a result when closed
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
}
//编辑用户
editUser(data): void {
const modal = this.modal.create({
nzTitle: '编辑用户',
nzContent: EdituserComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzComponentParams: {
data: data,
},
nzOnOk: async () => {
console.log('hhhhhhh', instance.validateForm)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let body = {
userName: instance.validateForm.value.account,
name: instance.validateForm.value.name,
organizationId: instance.validateForm.value.organization,
roleNames: instance.validateForm.value.role,
phoneNumber: instance.validateForm.value.phonenum,
isActive: true
}
this.http.post('/api/services/app/User/Create', body).subscribe(data => {
resolve(data)
this.message.create('success', '创建成功!');
this.getAllUsers()
return true
}, err => {
resolve(err)
this.message.create('warning', '创建失败');
return false
})
})
} else {
this.message.create('warning', '请填写完整!');
return false
}
}
});
const instance = modal.getContentComponent();
}
//重置密码
resetPassword(item) {
this.modal.confirm({
nzTitle: `确定要重置${item.userName}这个账户的密码吗?`,
nzOkText: '确定',
nzOkType: 'primary',
nzOnOk: () => {
this.http.delete('/api/services/app/Role/Delete', {
params: {
Id: item.id
}
}).subscribe(data => {
this.message.create('success', '重置成功!');
this.getAllUsers()
})
},
nzCancelText: '取消',
nzOnCancel: () => {
}
});
}
//删除
delete(item) {
this.modal.confirm({
nzTitle: `确定要删除${item.userName}这个账户吗?`,
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
this.http.delete('/api/services/app/Role/Delete', {
params: {
Id: item.id
}
}).subscribe(data => {
this.message.create('success', '删除成功!');
this.getAllUsers()
})
},
nzCancelText: '取消',
nzOnCancel: () => {
}
});
}
}

4
src/app/ui/tabbar/tabbar.component.html

@ -16,7 +16,9 @@
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item (click)="system()">系统管理</li>
<li nz-menu-item (click)="navChange('/home/oliStationInfo')">基本信息</li>
<li nz-menu-item (click)="navChange('/home/equipmentInfo')">器材信息</li>
<li nz-menu-item (click)="navChange('/system/organization')">系统管理</li>
<li nz-menu-item (click)="signOut()">退出系统</li>
</ul>
</nz-dropdown-menu>

7
src/app/ui/tabbar/tabbar.component.ts

@ -59,9 +59,12 @@ export class TabbarComponent implements OnInit {
this.cookieService.set("refreshToken", '', new Date(new Date().getTime() + 1), '/');
this.router.navigate(['/login'])
}
system(){
this.router.navigate(['/system'])
navChange(router){
this.router.navigate([router])
}
//修改密码
changpsw() {
// let dialogRef = this.dialog.open(ChangepasswordComponent, { width: '348.000051px' });

BIN
src/assets/images/icon/admin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

BIN
src/assets/images/icon/organization.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

BIN
src/assets/images/icon/orgrey.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

BIN
src/assets/images/icon/power.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

BIN
src/assets/images/icon/role.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

BIN
src/assets/images/icon/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

BIN
src/assets/images/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
src/assets/images/userbig.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

10
src/styles.scss

@ -102,15 +102,5 @@ h1 {
font-size: 16px;
}
//滚动条样式
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-thumb {
background-image: inear-gradient(180deg, #2399FF 0%, rgba(0, 13, 33, 0.4) 100%);
}
::-webkit-scrollbar-track {
background-color: rgba(0, 13, 33, 0.41);
}

175
src/theme.less

@ -1,59 +1,30 @@
@import "../node_modules/ng-zorro-antd/ng-zorro-antd.less";
// @component-background: #002552;
@border-color-base: #91CCFF;
@select-background: transparent;
.ant-select-single:not(.ant-select-customize-input) .ant-select-selector,
.ant-picker,
.ant-btn {
border-radius: 0px;
}
.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{
// background: #083461;
}
//select picker 小剪头
.ant-select-arrow,
.ant-picker-separator {
color: #36A2FF;
}
//日期选择器
@input-placeholder-color: #345d85;
.ant-picker-suffix,
.ant-picker-input>input {
color: rgba(145, 204, 255, 0.95);
}
//分页器
#recordsboxadmin,
#recordsbox,
#equipmentInfo {
//弹窗遮罩层
.ant-modal-mask {
background: rgba(0, 0, 0, 0.05);
}
.ant-pagination-total-text,
.ant-pagination-options-quick-jumper {
color: white
}
//分页器
.ant-pagination-total-text,
.ant-pagination-options-quick-jumper {
color: white
}
.ant-pagination-item a,
.ant-pagination-prev .ant-pagination-item-link,
.ant-pagination-next .ant-pagination-item-link,
.ant-pagination-options-quick-jumper input {
color: white;
background: #0e2f4e;
}
.ant-pagination-item a,
.ant-pagination-prev .ant-pagination-item-link,
.ant-pagination-next .ant-pagination-item-link,
.ant-pagination-options-quick-jumper input {
color: white;
background: #0e2f4e;
.ant-pagination-item-active a {
background: #107495;
}
}
.ant-pagination-item-active a {
background: #107495;
}
//查询重置按钮
@ -141,7 +112,7 @@
//登录页input
#login {
#login,#equipmentInfo {
nz-input-group,
input {
@ -156,3 +127,111 @@
-webkit-font-size: 16px !important;
}
}
//表格
#userBox,
#roleBox {
.ant-table-thead>tr>th {
background: rgba(145, 204, 255, 0.15);
}
}
@select-background: transparent;
@border-color-base: #91CCFF;
//日期选择器
// @input-placeholder-color: #345d85;
#recordsboxadmin,
#recordsbox,
#warningbox,
#warningboxadmin {
::-webkit-input-placeholder {
/* WebKit browsers */
color: #345d85;
}
//滚动条样式
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-thumb {
background-image: linear-gradient(#2495f8, #1c73c2, #0a3d6a, #061d3c);
}
::-webkit-scrollbar-track {
background-color: #061d3c;
}
.ant-select-single:not(.ant-select-customize-input) .ant-select-selector,
.ant-picker,
.ant-btn {
border-radius: 0px;
}
//select picker 小剪头
.ant-select-arrow,
.ant-picker-separator {
color: #36A2FF;
}
//日期选择器
// @input-placeholder-color: #345d85;
.ant-picker-suffix,
.ant-picker-input>input {
color: rgba(145, 204, 255, 0.95);
}
//弹窗遮罩层
.ant-modal-mask {
background: rgba(0, 0, 0, 0.05);
}
//遮罩层
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
}
.ant-modal-body {
background: #072549;
height: 660px;
padding: 5px;
// border: 1px solid #8eb9e3;
box-shadow: 0 0 3px #8eb9e3;
color: #fff;
}
.ant-modal-close-x {
width: 36px;
height: 36px;
line-height: 36px;
color: white;
}
.vertical-center-modal .ant-modal {
top: 0;
}
}
// //弹窗遮罩层
// .ant-modal-mask {
// background: rgba(0, 0, 0, 0.05);
// }
#orbox {
nz-tree {
width: 660px;
}
nz-tree-node {
position: relative;
}
}

Loading…
Cancel
Save