!1999 新增:查找修改添加查找实体名选项

pull/1992/MERGE
黄诗津 2 years ago committed by ChenX
parent 308d497751
commit b86ffbf7c7

@ -56,6 +56,9 @@ export class BoardFindModify implements Command
case EFindType.GetOption: case EFindType.GetOption:
await this.GetBoardOption(store.m_Option, res, store.UIOption); await this.GetBoardOption(store.m_Option, res, store.UIOption);
break; break;
case EFindType.GetHardWareOption:
await this.GetHardWareOption(store.m_Option, res, store.UIOption);
break;
case EFindType.RemoveModeling: case EFindType.RemoveModeling:
case EFindType.RemoveSpecialShape: case EFindType.RemoveSpecialShape:
case EFindType.RemoveModelingAndSpecial: case EFindType.RemoveModelingAndSpecial:
@ -561,6 +564,20 @@ export class BoardFindModify implements Command
UIOption[data.key] = option[data.key]; UIOption[data.key] = option[data.key];
} }
} }
private async GetHardWareOption(option: IBoardFindOption, data: { key: string, content: string; }, UIOption: any)
{
let hwRes = await app.Editor.GetEntity({
Msg: data.content,
Filter: { filterTypes: [HardwareCompositeEntity] }
});
if (hwRes.Status === PromptStatus.OK)
{
let hw = hwRes.Entity as HardwareCompositeEntity;
option[data.key] = hw.HardwareOption.name;
UIOption[data.key] = option[data.key];
}
}
private async RemoveBoardModelingOrSpecialShape(removeType: EFindType) private async RemoveBoardModelingOrSpecialShape(removeType: EFindType)
{ {
let brs = await this.GetBoards() as Board[]; let brs = await this.GetBoards() as Board[];
@ -601,6 +618,9 @@ export class BoardFindModify implements Command
case EBoardKeyList.CabinetName: case EBoardKeyList.CabinetName:
en.HardwareOption[EBoardKeyList.CabinetName] = option[EBoardKeyList.CabinetName]; en.HardwareOption[EBoardKeyList.CabinetName] = option[EBoardKeyList.CabinetName];
break; break;
case "hardwareName":
en.HardwareOption.name = option.hardwareName;
break;
default: default:
break; break;
} }
@ -639,6 +659,13 @@ export class BoardFindModify implements Command
value = option[i]; value = option[i];
isVail = this.CompareIsEqual(brValue, value, option.compareType[i]); isVail = this.CompareIsEqual(brValue, value, option.compareType[i]);
break; break;
case "hardwareName":
brValue = br.HardwareOption.name;
let names = option[i].split(",");
if (arrayLast(names) === "")
names.pop();
isVail = names.some(n => this.CompareIsEqual(brValue, n, option.compareType[i]));
break;
default: default:
isVail = false; isVail = false;
break; break;

@ -296,7 +296,7 @@ export const DefaultClosingStripOption: ClosingStripOption = {
Object.freeze(DefaultClosingStripOption); Object.freeze(DefaultClosingStripOption);
export const DefaultBoardFindOption: IBoardFindOption = { export const DefaultBoardFindOption: IBoardFindOption = {
version: 5, version: 6,
condition: { condition: {
layer: false, layer: false,
height: false, height: false,
@ -310,6 +310,7 @@ export const DefaultBoardFindOption: IBoardFindOption = {
useSpecial: false, useSpecial: false,
useModeling: false, useModeling: false,
roomName: false, roomName: false,
hardwareName: false,
cabinetName: false, cabinetName: false,
brName: false, brName: false,
material: false, material: false,
@ -337,6 +338,7 @@ export const DefaultBoardFindOption: IBoardFindOption = {
roomName: ECompareType.Equal, roomName: ECompareType.Equal,
cabinetName: ECompareType.Equal, cabinetName: ECompareType.Equal,
brName: ECompareType.Equal, brName: ECompareType.Equal,
hardwareName: ECompareType.Equal,
[EBoardKeyList.Mat]: ECompareType.Equal, [EBoardKeyList.Mat]: ECompareType.Equal,
[EBoardKeyList.Color]: ECompareType.Equal, [EBoardKeyList.Color]: ECompareType.Equal,
[EBoardKeyList.BrMat]: ECompareType.Equal, [EBoardKeyList.BrMat]: ECompareType.Equal,
@ -360,6 +362,7 @@ export const DefaultBoardFindOption: IBoardFindOption = {
roomName: "", roomName: "",
cabinetName: "", cabinetName: "",
brName: "", brName: "",
hardwareName: "",
[EBoardKeyList.BrMat]: "", [EBoardKeyList.BrMat]: "",
material: "", material: "",
color: "", color: "",

@ -23,6 +23,7 @@ import { Config_ModalType } from './UserConfig';
interface IBoardFindState interface IBoardFindState
{ {
userInputName: string; userInputName: string;
hardwareInput: string;
} }
@inject('store') @inject('store')
@ -33,12 +34,16 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
["左侧板", false], ["右侧板", false], ["顶板", false], ["底板", false], ["左侧板", false], ["右侧板", false], ["顶板", false], ["底板", false],
["层板", false], ["背板", false], ["地脚线", false], ["层板", false], ["背板", false], ["地脚线", false],
]; ];
@observable _hardwareNameList: [string, boolean][] = [
["无盖铰链", false], ["半盖铰链", false], ["全盖铰链", false],
];
private showShops = observable.box(false); private showShops = observable.box(false);
constructor(props) constructor(props)
{ {
super(props); super(props);
this.state = { this.state = {
userInputName: "", userInputName: "",
hardwareInput: "",
}; };
} }
componentDidMount() componentDidMount()
@ -110,6 +115,14 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
app.Editor.ModalManage.ToggleShow(); app.Editor.ModalManage.ToggleShow();
app.Editor.MaskManage.ShowMask(); app.Editor.MaskManage.ShowMask();
} }
private async getHardWareOption(key: string, content: string)
{
app.Editor.MaskManage.Clear();
app.Editor.ModalManage.ToggleShow();
await app.Editor.ModalManage.ExecCmd({ type: EFindType.GetHardWareOption, key, content });
app.Editor.ModalManage.ToggleShow();
app.Editor.MaskManage.ShowMask();
}
private handleApplyBrName = () => private handleApplyBrName = () =>
{ {
let name = this.state.userInputName; let name = this.state.userInputName;
@ -123,6 +136,19 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
}); });
this.setState({ userInputName: name }); this.setState({ userInputName: name });
}; };
private handleApplyBrHardWare = () =>
{
let name = this.state.hardwareInput;
if (name)
name += ",";
this._hardwareNameList.forEach(v =>
{
if (v[1])
name += v[0] + ",";
});
this.setState({ hardwareInput: name });
};
private handleSelectGoods = (good: IGoodInfo) => private handleSelectGoods = (good: IGoodInfo) =>
{ {
const option = this.props.store.m_Option; const option = this.props.store.m_Option;
@ -367,7 +393,11 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
<input <input
className={Classes.INPUT} className={Classes.INPUT}
value={option.brName} value={option.brName}
onChange={e => option.brName = e.target.value} onChange={e =>
{
option.brName = e.target.value;
this.setState({ userInputName: e.target.value });
}}
/> />
<div className="select-name"> <div className="select-name">
<Button text="拾取" onClick={() => this.getBoardOption("brName", "选择板件获取板名")} /> <Button text="拾取" onClick={() => this.getBoardOption("brName", "选择板件获取板名")} />
@ -429,6 +459,93 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
/> />
</div> </div>
</div> </div>
<div className="br-find-item small">
<Checkbox
checked={option.condition.hardwareName}
label="实体名"
onChange={() =>
{
option.condition.hardwareName = !option.condition.hardwareName;
this.handleIsSelectAll();
}}
/>
<HTMLSelect
value={option.compareType.hardwareName}
options={["=", "!=", "//"]}
onChange={e =>
{
option.compareType.hardwareName = e.target.value as ECompareType;
}}
/>
<input
className={Classes.INPUT}
value={option.hardwareName}
onChange={e =>
{
option.hardwareName = e.target.value;
this.setState({ hardwareInput: e.target.value });
}}
/>
<div className="select-name">
<Button text="拾取" onClick={() => this.getHardWareOption("hardwareName", "选择五金获取实体名")} />
<Popover
usePortal={false}
modifiers={{
arrow: { enabled: false },
}}
position={Position.LEFT}
content={
<Card style={{ width: 300 }}>
<H5></H5>
<div>
{
this._hardwareNameList.map(v =>
<Checkbox
key={v[0]}
checked={v[1]}
label={v[0]}
inline
onChange={() =>
{
v[1] = !v[1];
}}
/>
)
}
</div>
<div>
<Button
text="应用选中"
intent={Intent.PRIMARY}
onClick={this.handleApplyBrHardWare}
/>
</div>
<input
className={Classes.INPUT}
value={this.state.hardwareInput}
onChange={e => this.setState({ hardwareInput: e.target.value })}
/>
<div className="flex-arround">
<Button
text="确定"
className={Classes.POPOVER_DISMISS}
intent={Intent.SUCCESS}
onClick={() =>
{
option.hardwareName = this.state.hardwareInput;
}}
/>
<Button
className={Classes.POPOVER_DISMISS}
text="取消"
intent={Intent.DANGER} />
</div>
</Card>}
target={<Button text="选择" />}
/>
</div>
</div>
<div> <div>
<Checkbox <Checkbox
checked={option.condition.useKeyWord} checked={option.condition.useKeyWord}

@ -15,6 +15,7 @@ export interface IBoardFindOption extends IBaseOption
[EBoardKeyList.RoomName]: string; [EBoardKeyList.RoomName]: string;
[EBoardKeyList.CabinetName]: string; [EBoardKeyList.CabinetName]: string;
brName: string; //板名 brName: string; //板名
hardwareName: string; //五金实体名
[EBoardKeyList.BrMat]: string; //板材 [EBoardKeyList.BrMat]: string; //板材
[EBoardKeyList.Mat]: string; [EBoardKeyList.Mat]: string;
[EBoardKeyList.Color]: string; [EBoardKeyList.Color]: string;
@ -49,6 +50,7 @@ export interface IFindCondition
[EBoardKeyList.RoomName]: boolean; [EBoardKeyList.RoomName]: boolean;
[EBoardKeyList.CabinetName]: boolean; [EBoardKeyList.CabinetName]: boolean;
brName: boolean; brName: boolean;
hardwareName: boolean;
[EBoardKeyList.Mat]: boolean; [EBoardKeyList.Mat]: boolean;
[EBoardKeyList.Lines]: boolean; [EBoardKeyList.Lines]: boolean;
[EBoardKeyList.BigHole]: boolean; [EBoardKeyList.BigHole]: boolean;
@ -76,6 +78,7 @@ export interface ICompareType
[EBoardKeyList.RoomName]: ECompareType; [EBoardKeyList.RoomName]: ECompareType;
[EBoardKeyList.CabinetName]: ECompareType; [EBoardKeyList.CabinetName]: ECompareType;
brName: ECompareType; brName: ECompareType;
hardwareName: ECompareType;
[EBoardKeyList.BrMat]: ECompareType; [EBoardKeyList.BrMat]: ECompareType;
[EBoardKeyList.Mat]: ECompareType; [EBoardKeyList.Mat]: ECompareType;
[EBoardKeyList.Color]: ECompareType; [EBoardKeyList.Color]: ECompareType;
@ -105,6 +108,7 @@ export enum EFindType
RemoveModelingAndSpecial = 7, RemoveModelingAndSpecial = 7,
ModifyHardware = 8, ModifyHardware = 8,
FindMinSize = 9, FindMinSize = 9,
GetHardWareOption = 10,
} }
export enum ECompareType export enum ECompareType

@ -100,6 +100,13 @@ export class BoardFindStore extends BoardStore
cof.option.condition[EBoardKeyList.KnifeRad] = false; cof.option.condition[EBoardKeyList.KnifeRad] = false;
cof.option[EBoardKeyList.KnifeRad] = ""; cof.option[EBoardKeyList.KnifeRad] = "";
} }
if (cof.option.version < 6)
{
cof.option.version = 6;
cof.option.compareType.hardwareName = ECompareType.Equal;
cof.option.condition.hardwareName = false;
cof.option.hardwareName = "";
}
Object.assign(this.m_Option, cof.option); Object.assign(this.m_Option, cof.option);
if (this.m_UiOption) if (this.m_UiOption)

Loading…
Cancel
Save