|
|
|
@ -24,10 +24,10 @@ import { PromptStatus } from "../../../Editor/PromptResult";
|
|
|
|
|
import { SelectSetBase } from "../../../Editor/SelectBase";
|
|
|
|
|
import '../../Css/ProcessingGroupModal.less';
|
|
|
|
|
import { ECompareType } from "../../Store/BoardFindInterface";
|
|
|
|
|
import { ProcessingGroupOption } from "../../Store/BoardInterface";
|
|
|
|
|
import { IConfigStore } from "../../Store/BoardStore";
|
|
|
|
|
import { userConfigStore } from "../../Store/UserConfigStore";
|
|
|
|
|
import { BoardModalType } from "../Board/BoardModalType";
|
|
|
|
|
import { IConfigOption } from "../Board/UserConfigComponent";
|
|
|
|
|
import { GetCompoentObjectIdString } from "../ComponentObjectId";
|
|
|
|
|
import { HandleDirComponent } from "../SourceManage/HandleDirComponent";
|
|
|
|
|
import { AppToaster } from "../Toaster";
|
|
|
|
@ -80,8 +80,12 @@ interface ProcessingGroupModalState
|
|
|
|
|
|
|
|
|
|
export class ProcessingGroupModalStore extends Singleton implements IConfigStore
|
|
|
|
|
{
|
|
|
|
|
configName: string = "default";
|
|
|
|
|
configsNames: string[];
|
|
|
|
|
flag: number = 0;//是否点击过查看 0 无, 1 查看, 2 添加
|
|
|
|
|
checkEnts: Entity[];
|
|
|
|
|
//多选时不独立添加加工组
|
|
|
|
|
addAlone = false;
|
|
|
|
|
//选择的组类别 值为组类别名称
|
|
|
|
|
selectedLeftNodeSet: Set<string> = new Set();
|
|
|
|
|
selectedRightNodeSet: Set<string> = new Set();
|
|
|
|
@ -93,11 +97,27 @@ export class ProcessingGroupModalStore extends Singleton implements IConfigStore
|
|
|
|
|
tempPgs: TemplatePgData[] = [];//所有 跟随模块自动识别的加工组的数据 (在删除提示和亮显时有用)
|
|
|
|
|
expandedNodesId = [];
|
|
|
|
|
processGroupCategory: string[] = [];
|
|
|
|
|
InitOption: () => void;
|
|
|
|
|
InitOption = () =>
|
|
|
|
|
{
|
|
|
|
|
this.processGroupCategory = ["抽屉", "格子抽", "裤抽", "酒格", "弧形", "拼框门", "异形加工"];
|
|
|
|
|
this.addAlone = false;
|
|
|
|
|
};
|
|
|
|
|
UpdateOption = (config: any) =>
|
|
|
|
|
{
|
|
|
|
|
if (Array.isArray(config))
|
|
|
|
|
this.processGroupCategory = config;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.processGroupCategory = config.processGroupCategory;
|
|
|
|
|
this.addAlone = config.addAlone;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
SaveConfig = () =>
|
|
|
|
|
{
|
|
|
|
|
let newConfig: IConfigOption = {};
|
|
|
|
|
newConfig.processGroupCategory = this.processGroupCategory;
|
|
|
|
|
let newConfig: ProcessingGroupOption = {
|
|
|
|
|
processGroupCategory: this.processGroupCategory,
|
|
|
|
|
addAlone: this.addAlone
|
|
|
|
|
};
|
|
|
|
|
return newConfig;
|
|
|
|
|
};
|
|
|
|
|
ResetData = () =>
|
|
|
|
@ -111,11 +131,8 @@ export class ProcessingGroupModalStore extends Singleton implements IConfigStore
|
|
|
|
|
this.selectedTempPgs = [];
|
|
|
|
|
this.expandedNodesId = [];
|
|
|
|
|
};
|
|
|
|
|
//
|
|
|
|
|
configName: string = "default";
|
|
|
|
|
configsNames: string[];
|
|
|
|
|
UpdateOption: Function;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SelectEntityTypes = (Board | HardwareCompositeEntity | HardwareTopline)[];
|
|
|
|
|
|
|
|
|
|
@observer
|
|
|
|
@ -718,12 +735,24 @@ export class ProcessingGroupModal extends React.Component<{ store: ProcessingGro
|
|
|
|
|
app.Editor.MaskManage.Clear();
|
|
|
|
|
await CommandWrap(async () =>
|
|
|
|
|
{
|
|
|
|
|
let ssRes = await app.Editor.GetSelection({
|
|
|
|
|
Msg: "请选择需要加入组的实体",
|
|
|
|
|
Filter: { filterTypes: this.filterTypes }
|
|
|
|
|
});
|
|
|
|
|
if (ssRes.Status !== PromptStatus.OK)
|
|
|
|
|
return;
|
|
|
|
|
let ssRes: any;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
ssRes = await app.Editor.GetSelection({
|
|
|
|
|
Msg: `请选择需要加入组的实体<当前为:多选时${this.props.store.addAlone ? "" : "不"}独立添加加工组>`,
|
|
|
|
|
KeyWordList: [{ key: "A", msg: `多选时${this.props.store.addAlone ? "不" : ""}独立添加加工组` }],
|
|
|
|
|
Filter: { filterTypes: this.filterTypes }
|
|
|
|
|
});
|
|
|
|
|
if (ssRes.Status === PromptStatus.Keyword)
|
|
|
|
|
{
|
|
|
|
|
if (ssRes.StringResult === "A")
|
|
|
|
|
this.props.store.addAlone = !this.props.store.addAlone;
|
|
|
|
|
}
|
|
|
|
|
else if (ssRes.Status === PromptStatus.OK)
|
|
|
|
|
break;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let ens = ssRes.SelectSet.SelectEntityList as SelectEntityTypes;
|
|
|
|
|
|
|
|
|
@ -785,13 +814,34 @@ export class ProcessingGroupModal extends React.Component<{ store: ProcessingGro
|
|
|
|
|
let ids = ens.map(en => en.Id);
|
|
|
|
|
for (let pgName of this.props.store.selectedLeftNodeSet)
|
|
|
|
|
{
|
|
|
|
|
let pg = new ProcessingGroupRecord;
|
|
|
|
|
pg.Name = pgName;
|
|
|
|
|
pg.Objects = ids;
|
|
|
|
|
app.Database.ProcessingGroupTable.Add(pg);
|
|
|
|
|
for (let en of ens)
|
|
|
|
|
en.ProcessingGroupList.push(pg.Id);
|
|
|
|
|
//多选时不独立添加加工组
|
|
|
|
|
if (this.props.store.addAlone)
|
|
|
|
|
{
|
|
|
|
|
for (let en of ens)
|
|
|
|
|
{
|
|
|
|
|
let pg = new ProcessingGroupRecord;
|
|
|
|
|
pg.Name = pgName;
|
|
|
|
|
pg.Objects = [en.Id];
|
|
|
|
|
app.Database.ProcessingGroupTable.Add(pg);
|
|
|
|
|
en.ProcessingGroupList.push(pg.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
let pg = new ProcessingGroupRecord;
|
|
|
|
|
pg.Name = pgName;
|
|
|
|
|
pg.Objects = ids;
|
|
|
|
|
app.Database.ProcessingGroupTable.Add(pg);
|
|
|
|
|
for (let en of ens)
|
|
|
|
|
en.ProcessingGroupList.push(pg.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let num = this.props.store.addAlone ? this.props.store.selectedLeftNodeSet.size * ens.length : this.props.store.selectedLeftNodeSet.size;
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: `成功添加了${num}个加工组!`,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.SUCCESS,
|
|
|
|
|
}, "AddProcessingGroup");
|
|
|
|
|
}, CommandNames.添加加工组);
|
|
|
|
|
this.setState({ nodes: this.parseNodes() });
|
|
|
|
|
this.props.store.expandedNodesId = [];
|
|
|
|
|