!2273 新增:加工组同时选中多个对象,可以分别添加上加工组

pull/2269/MERGE
林三 1 year ago committed by ChenX
parent 1e8b7a8fea
commit 38cabe1a76

@ -13,11 +13,11 @@ export class Command_ShowProcessingGroupModal implements Command
let config = await userConfigStore.GetConfig(BoardModalType.ProcessGroupCategory);
if (!config)
{
store.processGroupCategory = ["抽屉", "格子抽", "裤抽", "酒格", "弧形", "拼框门", "异形加工"];
store.InitOption();
userConfigStore.SaveConfig(BoardModalType.ProcessGroupCategory, ProcessingGroupModalStore.GetInstance(), { isInit: true, toaster: false });
}
else
store.processGroupCategory = config.processGroupCategory;
store.UpdateOption(config);
app.Editor.ModalManage.RenderModeless(ProcessingGroupModal, { store: store }, { canMinimize: false, resizable: false });
}
}

@ -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 = [];

@ -613,3 +613,9 @@ export interface ShareBoardInfConfigurationOption
IsExportHardware: boolean; //是否导出五金
showBom: boolean; //是否展示物料明细
}
export interface ProcessingGroupOption
{
processGroupCategory: string[];
addAlone: boolean;
}

@ -267,7 +267,7 @@ export class UserConfigStore extends Singleton
if (configs)
{
if (type === BoardModalType.ProcessGroupCategory)
return { processGroupCategory: configs as Array<string> };
return configs;
let confNames = [...Object.keys(configs)];
let curName = userConfig.userConfigName[type];
if (!curName)
@ -344,7 +344,7 @@ export class UserConfigStore extends Singleton
if (type === BoardModalType.ProcessGroupCategory)
{
configs = newConfig.processGroupCategory;
configs = newConfig;
}
else
{

Loading…
Cancel
Save