Browse Source

[完善] 名称/编号 属性由程序自动生成

master
徐振升 4 years ago
parent
commit
273613fd6d
  1. 3
      src/app/working-area/model/axLegend.ts
  2. 10
      src/app/working-area/working-area.component.ts

3
src/app/working-area/model/axLegend.ts

@ -41,6 +41,7 @@ export class AxLegend extends AxShape {
public addItem(item: Legend) {
if (this.shapeMap.has(item.Name)) {
this.shapeMap.get(item.Name).Count++;
this.shapeMap.get(item.Name).Index++;
} else {
this.shapeMap.set(item.Name, item);
}
@ -449,6 +450,7 @@ export class Legend {
public Name: string;
public ImageUrl: string;
public Count: number;
public Index: number;
/**
*
*/
@ -456,5 +458,6 @@ export class Legend {
this.Name = name;
this.ImageUrl = imageUrl;
this.Count = count;
this.Index = 1;
}
}

10
src/app/working-area/working-area.component.ts

@ -171,7 +171,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* -
* -
*/
public VERSION = '1.4.2.20210325_rc';
public VERSION = '1.4.3.20210415_rc';
/**
*
*/
@ -598,15 +598,15 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
const itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1);
temp.addItem(itemLegend);
// 设置新增图形的名称/编号
let Id = temp.shapeMap.get(axShape.assetData.Name).Count;
let Id = temp.shapeMap.get(axShape.assetData.Name).Index;
let index = "000";
// 检查Id的长度
if (Id < 10) {
index = axShape.assetData.Id + "00" + Id;
index = axShape.assetData.Name + "00" + Id;
} else if (Id < 100) {
index = axShape.assetData.Id + "0" + Id;
index = axShape.assetData.Name + "0" + Id;
} else {
index = axShape.assetData.Id + Id;
index = axShape.assetData.Name + Id;
}
(axShape.assetData.PropertyInfos.find(i => i.PropertyName == "名称/编号")).PropertyValue = index;
}

Loading…
Cancel
Save