!381【需求】增加批量查看板件属性功能

Merge pull request !381 from 肖诗雅/lookOverBoardOptions_merge1
pull/381/MERGE
肖诗雅 5 years ago committed by ChenX
parent 75a9270fb2
commit 455ccb49a7

@ -0,0 +1,96 @@
import { Command } from "../Editor/CommandMachine";
import { app } from "../ApplicationServices/Application";
import { ModalPosition } from "../UI/Components/Modal/ModalsManage";
import { LookOverBoardInfosModal } from "../UI/Components/Board/LookOverBoardInfos";
import { LookOverBoardInfosStore } from "../UI/Store/LookOverBoardInfosStore";
import { Board } from "../DatabaseServices/Entity/Board";
import { PromptStatus } from "../Editor/PromptResult";
import { EFindType } from "../UI/Store/BoardFindInterface";
import { EBoardKeyList } from "../Common/BoardKeyList";
export class LookOverBoardInfos implements Command
{
async exec()
{
let enRes = await app.Editor.GetSelection({
Msg: "选择板件",
Filter: {
filterTypes: [Board]
}
});
if (enRes.Status === PromptStatus.Cancel)
return;
let brs = enRes.SelectSet.SelectEntityList as Board[];
const store = LookOverBoardInfosStore.GetInstance() as LookOverBoardInfosStore;
app.Editor.ModalManage.RenderModal(LookOverBoardInfosModal, ModalPosition.Center, { store, boardList: brs }, true);//改成modaless
app.Editor.SelectCtrl.Cancel();
app.Editor.ModalManage.Callback = async (res) =>
{
switch (res.type)
{
case EFindType.Modify:
await this.modify(store);
break;
default:
break;
}
app.Editor.ModalManage.ToggleShow();
if (store.isClose)
{
app.Editor.ModalManage.Clear();
app.Editor.ModalManage.EndCmd();
}
else
{
app.Editor.MaskManage.ShowMask();
}
}
}
modify(store: LookOverBoardInfosStore)
{
let map = store.boardInfos;
for (let [br, opts] of map)
{
for (let i in opts)
{
switch (i)
{
case EBoardKeyList.Height:
br.Height = parseFloat(opts[i]);
break;
case EBoardKeyList.Width:
br.Width = parseFloat(opts[i]);
break;
case EBoardKeyList.Thick:
br.Thickness = parseFloat(opts[i]);
break;
case "brName":
br.Name = opts.brName;
break;
case "boardName":
br.BoardProcessOption.boardName = opts.boardName;
break;
case EBoardKeyList.Lines:
case EBoardKeyList.UpSealed:
case EBoardKeyList.DownSealed:
case EBoardKeyList.LeftSealed:
case EBoardKeyList.RightSealed:
case EBoardKeyList.Mat:
case EBoardKeyList.Color:
case EBoardKeyList.RoomName:
case EBoardKeyList.CabinetName:
br.BoardProcessOption[i] = opts[i] as never;
break;
default:
break;
}
}
}
//重置修改数据
store.boardInfos = new Map();
}
}

@ -1,4 +1,5 @@
import { operationExpReg } from "./Utils";
import { EBoardKeyList } from "./BoardKeyList";
export enum CheckObjectType
{
@ -11,6 +12,7 @@ export enum CheckObjectType
Lat = "lattice",
RLB = "rotateLayerBoard",
BBC = "boardbatchcurtail",
BBS = "lookoverboardinfos",
}
export namespace CheckoutValid
@ -51,6 +53,10 @@ export namespace CheckoutValid
return !Object.keys(obj).every(k =>
CheckBoardBatchCurtail(k, obj[k]) === ""
)
case CheckObjectType.BBS:
return !Object.keys(obj).every(k =>
CheckLookOverBoardInfos(k, obj[k]) === ""
)
default:
return true;
}
@ -77,6 +83,8 @@ export namespace CheckoutValid
return CheckoutRotateLayerBoardOption(k, v);
case CheckObjectType.BBC:
return CheckBoardBatchCurtail(k, v);
case CheckObjectType.BBS:
return CheckLookOverBoardInfos(k, v);
default:
return "";
}
@ -257,6 +265,25 @@ export namespace CheckoutValid
return "";
}
}
export function CheckLookOverBoardInfos(k: string, v: string): string
{
switch (k)
{
case EBoardKeyList.Height:
case EBoardKeyList.Width:
case EBoardKeyList.Thick:
case EBoardKeyList.UpSealed:
case EBoardKeyList.DownSealed:
case EBoardKeyList.LeftSealed:
case EBoardKeyList.RightSealed:
if (v === "" || isNaN(Number(v)))
{
return "数值不能为空且必须为数字";
}
default:
return "";
}
}
export function CheckOutReferenceCuttingOption(k: string, v: string): string
{
switch (k)

@ -64,6 +64,7 @@ import { DrawCircle0 } from '../Add-on/DrawZeroCircle';
import { Command_DXFImport } from '../Add-on/DXFLoad';
import { Entsel } from '../Add-on/Entsel';
import { Command_Erase } from '../Add-on/Erase';
import { ErpParseData } from '../Add-on/Erp/ParseData';
import { Command_Esc } from '../Add-on/Esc';
import { Command_Explode } from '../Add-on/Explode';
import { Command_ExplosionMap } from '../Add-on/ExplosionMap';
@ -79,6 +80,7 @@ import { Command_Length } from '../Add-on/Length';
import { Command_Lisp } from '../Add-on/Lisp';
import { DownLoadDConfig, UpLoadConfig } from '../Add-on/LoadConfig';
import { Fbx } from '../Add-on/loadfbx';
import { LookOverBoardInfos } from '../Add-on/LookOverBoardInfos';
import { MirrorCommand } from '../Add-on/Mirror';
import { Command_Move } from '../Add-on/Move';
import { Command_Offset } from '../Add-on/Offset';
@ -96,7 +98,7 @@ import { Command_Ssget } from '../Add-on/ssget';
import { Stretch } from '../Add-on/Stretch';
import { Sweep } from '../Add-on/Sweep';
import { Command_SwitchCamera } from '../Add-on/SwitchCamera';
import { CMD_Conceptual, CMD_Wireframe, CMD_Physical } from '../Add-on/SwitchVisualStyles';
import { CMD_Conceptual, CMD_Physical, CMD_Wireframe } from '../Add-on/SwitchVisualStyles';
import { DrawTangentLine } from '../Add-on/Tangent';
import { ShowTopLine } from '../Add-on/Template/ShowTopline';
// import { DrawFloor } from '../Add-on/DrawFloor';
@ -117,7 +119,6 @@ import { CommandServer } from '../DatabaseServices/CommandServer';
import { AutoTempateSizeAction } from '../DatabaseServices/Template/TemplateTest';
import { ICommand } from '../UI/Components/CommandPanel/CommandList';
import { commandMachine } from './CommandMachine';
import { ErpParseData } from '../Add-on/Erp/ParseData';
export function registerCommand()
@ -264,6 +265,7 @@ export function registerCommand()
commandMachine.RegisterCommand("jd", new AddPtOnBoard());
commandMachine.RegisterCommand("sd", new DeletePtOnBoard());
commandMachine.RegisterCommand("boardfindmodify", new BoardFindModify())
commandMachine.RegisterCommand("bbs", new LookOverBoardInfos())
commandMachine.RegisterCommand("boardbatchcurtail", new BoardBatchCurtail());
commandMachine.RegisterCommand("autodimbrs", new Command_AutoDimBrs());

@ -26,6 +26,7 @@ export interface ISetItemOption
inline?: boolean;
className?: string;
onBlur?(e?); /**输入框失去焦点触发 */
onFocus?(e?); /**输入框获得焦点触发 */
maxLength?: number;
inputRef?: (el) => void; //获取输入框HTMLElement
update?(); /*组件更新完成c触发*/
@ -459,6 +460,7 @@ interface IDrillTypeSelect
opt: BoardProcessOption;
br: Board;
isShowHigh?: boolean;
onFocus?: Function;
}
@observer
@ -554,6 +556,7 @@ export class DrillTypeSelectCom extends React.Component<IDrillTypeSelect, { isDa
}}
options={options}
onChange={this.handleChange}
onFocus={() => { if (this.props.onFocus) this.props.onFocus() }}
/>
if (this.props.br && this.props.isShowHigh)

@ -0,0 +1,289 @@
import React = require("react");
import { Board } from "../../../DatabaseServices/Entity/Board";
import { LookOverBoardInfosStore } from "../../Store/LookOverBoardInfosStore";
import { HTMLSelect, Icon } from "@blueprintjs/core";
import { LinesType, ComposingType, FaceDirection } from "../../Store/BoardInterface";
import { observer } from "mobx-react";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { CheckObjectType } from "../../../Common/CheckoutVaildValue";
import { ToasterInput } from "../Toaster";
export interface IBoardInfoListProps
{
dataList?: Board[];
store?: LookOverBoardInfosStore;
br: Board;
}
export interface IBoardInfoOptions
{
[EBoardKeyList.Height]?: string;
[EBoardKeyList.Width]?: string;
[EBoardKeyList.Thick]?: string;
"brName"?: string;
"boardName"?: string;
[EBoardKeyList.Mat]?: string;
[EBoardKeyList.Color]?: string;
[EBoardKeyList.RoomName]?: string;
[EBoardKeyList.CabinetName]?: string;
[EBoardKeyList.Lines]?: LinesType;
[EBoardKeyList.UpSealed]?: string;
[EBoardKeyList.DownSealed]?: string;
[EBoardKeyList.LeftSealed]?: string;
[EBoardKeyList.RightSealed]?: string;
}
@observer
export class BoardInfoList extends React.Component<IBoardInfoListProps, IBoardInfoOptions>
{
constructor(props)
{
super(props);
this.initState(this.props.br);
}
componentWillReceiveProps(nextProps)
{
this.initState(nextProps.br);
}
initState = (board: Board) =>
{
let br = board;
this.state = {
cabinetName: br.BoardProcessOption[EBoardKeyList.CabinetName],
roomName: br.BoardProcessOption[EBoardKeyList.RoomName],
brName: br.Name,
height: br.Height.toString(),
width: br.Width.toString(),
thickness: br.Thickness.toString(),
boardName: br.BoardProcessOption.boardName,
material: br.BoardProcessOption[EBoardKeyList.Mat],
color: br.BoardProcessOption[EBoardKeyList.Color],
lines: br.BoardProcessOption[EBoardKeyList.Lines],
sealedUp: br.BoardProcessOption[EBoardKeyList.UpSealed],
sealedDown: br.BoardProcessOption[EBoardKeyList.DownSealed],
sealedRight: br.BoardProcessOption[EBoardKeyList.RightSealed],
sealedLeft: br.BoardProcessOption[EBoardKeyList.LeftSealed],
}
}
//记录被修改的数据
modifyDataMap = (br: Board, modifyKey: string, value: string | LinesType | FaceDirection | ComposingType) =>
{
let dataMap = this.props.store.boardInfos;
if (dataMap.has(br))
{
let d = dataMap.get(br);
d[modifyKey] = value;
dataMap.set(br, d);
}
else
{
let opts: IBoardInfoOptions = {};
opts[modifyKey] = value;
dataMap.set(br, opts);
}
}
public render()
{
const store = this.props.store;
let br = this.props.br;
return (
<tr>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.RoomName}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.RoomName]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.RoomName }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.RoomName, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.CabinetName}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.CabinetName]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.CabinetName }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.CabinetName, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={"brName"}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ brName: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = "brName" }}
onBlur={(e) => { this.modifyDataMap(br, "brName", e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.Height}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.Height]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.Height }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.Height, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.Width}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.Width]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.Width }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.Width, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.Thick}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.Thick]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.Thick }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.Thick, e.target.value) }}
/>
</td>
<td>
<HTMLSelect
value={this.state.lines}
options={
[
{
label: "正纹",
value: LinesType.Positive.toString()
},
{
label: "反纹",
value: LinesType.Reverse.toString()
},
{
label: "可翻转",
value: LinesType.CanReversal.toString()
},
]
}
onChange={e =>
{
this.setState({ [EBoardKeyList.Lines]: parseFloat(e.target.value) });
this.modifyDataMap(br, EBoardKeyList.Lines, parseFloat(e.target.value));
}}
onClick={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.Lines }}
/>
</td>
<td>
<input
className="bp3-input"//加工
onFocus={() => { store.selectedBr = br }}
/>
</td>
{
br.IsSpecialShape ?
<td colSpan={4}>
<input className="bp3-input bp3-minimal" style={{ width: "100%", textAlign: "center" }} value="异型板件请查看高级封边" contentEditable={false}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.UpSealed }}
/>
</td>
:
<>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.UpSealed}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.UpSealed]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.UpSealed }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.UpSealed, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.DownSealed}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.DownSealed]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.DownSealed }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.DownSealed, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.LeftSealed}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.LeftSealed]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.LeftSealed }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.LeftSealed, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.RightSealed}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.RightSealed]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.RightSealed }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.RightSealed, e.target.value) }}
/>
</td>
</>
}
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={"boardName"}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ boardName: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = "boardName" }}
onBlur={(e) => { this.modifyDataMap(br, "boardName", e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.Mat}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.Mat]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.Mat }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.Mat, e.target.value) }}
/>
</td>
<td>
<ToasterInput
type={CheckObjectType.BBS}
optKey={EBoardKeyList.Color}
option={this.state}
uiOption={this.state}
onChange={(e) => { this.setState({ [EBoardKeyList.Color]: e.target.value }) }}
onFocus={() => { store.selectedBr = br; store.findSameTypeBrDataKey = EBoardKeyList.Color }}
onBlur={(e) => { this.modifyDataMap(br, EBoardKeyList.Color, e.target.value) }}
/>
</td>
<td>
<Icon icon={br.IsSpecialShape ? "tick" : "blank"} />
</td>
<td>
<Icon icon={br.BoardModeling.length > 0 ? "tick" : "blank"} />
</td>
</tr>
)
}
}

@ -0,0 +1,242 @@
import React = require("react");
import { observer, inject } from "mobx-react";
import { Classes, Icon, Button, Card, InputGroup } from "@blueprintjs/core";
import { LookOverBoardInfosStore } from "../../Store/LookOverBoardInfosStore";
import { ModalState } from "../Modal/ModalsManage";
import { BoardInfoList } from "./BoardInfosList";
import { Board } from "../../../DatabaseServices/Entity/Board";
import { SelectSetBase } from "../../../Editor/SelectBase";
import { app } from "../../../ApplicationServices/Application";
import { EBoardKeyList } from "../../../Common/BoardKeyList";
import { EFindType } from "../../Store/BoardFindInterface";
import { observable } from "mobx";
import { LinesType } from "../../Store/BoardInterface";
import { equaln } from "../../../Geometry/GeUtils";
@inject('store')
@observer
export class LookOverBoardInfosModal extends React.Component<{ store?: LookOverBoardInfosStore, boardList: Board[] }, {}>
{
dataList = this.props.boardList;
@observable searchRes: Board[] = this.props.boardList;
@observable searchingStr = "";
@observable private regexp: RegExp = new RegExp('^.*$', "i");
//查看选中板件
checkOutChosenBr = () =>
{
this.clearSelect();
let selectData = new SelectSetBase(app.Viewer);
selectData.m_SelectList.push(this.props.store.selectedBr.DrawObject);
app.Editor.SelectCtrl.SelectSet.AddSelect(selectData);
app.Editor.SelectCtrl.UpdateView();
}
//查看同类型板件
checkOutSameTypeBr = () =>
{
this.clearSelect();
let selectData = new SelectSetBase(app.Viewer);
let brs = this.filterBr();
selectData.m_SelectList.push(...brs.map((b) => { return b.DrawObject }))
app.Editor.SelectCtrl.SelectSet.AddSelect(selectData);
app.Editor.SelectCtrl.UpdateView();
}
//清楚当前选中
clearSelect = () =>
{
app.Editor.SelectCtrl.SelectSet.Clear();
app.Viewer.GripScene.Clear();
app.Editor.SelectCtrl.UpdateView();
}
//筛选同类型板件
filterBr = () =>
{
let key = this.props.store.findSameTypeBrDataKey;
let br = this.props.store.selectedBr;
let brRes: Board[] = [];
switch (key)
{
case EBoardKeyList.Height:
brRes = this.props.boardList.filter((b) => equaln(b.Height, br.Height));
break;
case EBoardKeyList.Width:
brRes = this.props.boardList.filter((b) => equaln(b.Width, br.Width));
break;
case EBoardKeyList.Thick:
brRes = this.props.boardList.filter((b) => equaln(b.Thickness, br.Thickness));
break;
case "brName":
brRes = this.props.boardList.filter((b) => b.Name === br.Name)
break;
case "boardName":
brRes = this.props.boardList.filter((b) => b.BoardProcessOption.boardName === br.BoardProcessOption.boardName);
break;
case EBoardKeyList.Mat:
case EBoardKeyList.Color:
case EBoardKeyList.RoomName:
case EBoardKeyList.CabinetName:
case EBoardKeyList.Lines:
brRes = this.props.boardList.filter((b) => b.BoardProcessOption[key] === br.BoardProcessOption[key]);
break;
case EBoardKeyList.UpSealed:
case EBoardKeyList.DownSealed:
case EBoardKeyList.LeftSealed:
case EBoardKeyList.RightSealed:
if (br.IsSpecialShape)
brRes = this.props.boardList.filter((b) => b.IsSpecialShape);
else
brRes = this.props.boardList.filter((b) => !b.IsSpecialShape && b.BoardProcessOption[key] === br.BoardProcessOption[key]);
break;
default:
break;
}
return brRes;
}
//处理数据并用正则筛选
regxpTest = (b: Board) =>
{
let arr = [];
arr.push(
b.Name,
b.BoardProcessOption.boardName,
b.Height.toString(),
b.Width.toString(),
b.Thickness.toString(),
b.BoardProcessOption[EBoardKeyList.Lines] === LinesType.Positive ? "正纹" : "反纹",
...[
EBoardKeyList.Mat, EBoardKeyList.Color,
EBoardKeyList.RoomName, EBoardKeyList.CabinetName,
]
.map((key) => { return b.BoardProcessOption[key]; })
);
if (b.IsSpecialShape)
for (let i = 0; i < 4; i++)
{
arr.push("异型板件请查看高级封边");
}
else
arr.push(
...[
EBoardKeyList.UpSealed, EBoardKeyList.DownSealed,
EBoardKeyList.LeftSealed, EBoardKeyList.RightSealed
]
.map((key) => { return b.BoardProcessOption[key]; })
)
return this.regexp.test(arr.join(''))
}
//查找
searchData = () =>
{
if (this.searchingStr === "")
{
this.searchRes = this.dataList;
return;
}
//构造搜索的正则
let m_comTmp = this.searchingStr.split('').join('.*') + '.*$';
this.regexp = new RegExp(m_comTmp, 'i');
this.searchRes = this.dataList.filter((b) => this.regxpTest(b));
}
render()
{
const store = this.props.store;
return (
<>
<div
className={Classes.DIALOG_CONTAINER}
style={{ width: "100%", height: "100%" }}
>
<div className={Classes.DIALOG + " br-lookover"}>
<div className={Classes.DIALOG_HEADER}
data-id="dragArea"
>
<Icon icon="bold" iconSize={18} />
<h4 className="bp3-heading"></h4>
<Button
aria-lable="Close"
minimal
icon="cross"
className={Classes.DIALOG_CLOSE_BUTTON}
onClick={() => { store.OnOk(ModalState.Cancel) }}
/>
</div>
<div className={Classes.DIALOG_BODY + " flex " + Classes.CARD}>
<Card className={"title"}>
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</Card>
<Card>
<table>
<tbody>
{
this.searchRes.map((br) =>
{
return (
<BoardInfoList
store={this.props.store}
dataList={this.searchRes}
br={br}
/>
)
})
}
</tbody>
</table>
</Card>
</div>
<div className={Classes.DIALOG_FOOTER}>
<label className={Classes.LABEL + " " + Classes.INLINE}>
<label>{`总计 ${this.props.boardList.length} 块板`}</label>
</label>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<InputGroup className={"search"} type="search" placeholder="关键字查找..." dir="auto"
onChange={(e) => { this.searchingStr = e.target.value; this.searchData() }}
value={this.searchingStr} />
<Button
text="查看选中板件"
onClick={this.checkOutChosenBr}
/>
<Button
text="显示同属性板件"
onClick={this.checkOutSameTypeBr}
/>
<Button
text="应用数据修改"
onClick={() =>
{
store.OnOk(ModalState.Ok, { type: EFindType.Modify, cname: "_modify" })
}} />
<Button
// 待补充
text="修改选择板件的板材" />
</div>
</div>
</div>
</div>
</>
)
}
}

@ -0,0 +1,41 @@
#modal .br-lookover{
height: 100%;
max-height: 600px;
width: 100%;
.bp3-dialog-body {
flex-direction: column;
.bp3-input{
width: 60px;
}
}
.bp3-input.seal{
width: 40px;
}
.flex{
overflow: auto;
.bp3-card:not(.title){
width: 100%;
overflow: auto;
padding-top: 5px;
height: 100%;
}
.title{
padding: 0 20px;
}
}
table {
th{
width:62px;//fixed width
}
th:nth-child(7){
width: 71px;
}
th:nth-child(16),th:nth-child(17){
width: 32px;
}
.bp3-dialog-body{
height: 100%;
overflow: auto;
}
}
}

@ -17,7 +17,7 @@
position: fixed;
outline: none;
font-size: 8px;
overflow: hidden; //影响到DisplayConfigPanel 的ColorPick
// overflow: hidden; //影响到DisplayConfigPanel 的ColorPick
select{
font-size: 8px;
}
@ -148,5 +148,6 @@
@import (less) "./BoardFind.less";
@import (less) "./WineRack.less";
@import (less) "../../Template/Topline.less";
@import (less) "./LookOverBoardInfos.less";

@ -1,5 +1,7 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Rnd } from "react-rnd2";
import { EnableAll } from 'react-rnd2/lib/resizable/resizable';
import * as xaop from 'xaop';
import { Pick } from '../../../Add-on/Array';
import { app } from '../../../ApplicationServices/Application';
@ -10,7 +12,6 @@ import { commandMachine } from '../../../Editor/CommandMachine';
import { CommandState } from '../../../Editor/CommandState';
import { Editor } from '../../../Editor/Editor';
import './ModalStyle/Modal.less';
export enum ModalPosition
{
Center = "center",
@ -39,6 +40,7 @@ export interface IModalResult<T = any>
export class ModalManage
{
rnd: Rnd;
m_PromisRes: (res: IModalResult) => void;//promis回调;
private m_ModalContainer: HTMLElement;
Callback: Function = null;
@ -106,14 +108,27 @@ export class ModalManage
}
e.stopPropagation();
}
RenderModeless(Component: any, pos: ModalPosition, props?: any)
RenderModeless(Component: any, pos: ModalPosition, props?: any, resizable = false)
{
this.m_ModalContainer.style.overflow = resizable ? "unset" : "hidden";
app.Editor.MaskManage.ShowMask();
this.m_ModalContainer.focus();
ReactDOM.render(<Component {...props} />, this.m_ModalContainer, () =>
{
this.MoveModal();
});
ReactDOM.render(
<Rnd
ref={e => this.rnd = e}
style={{ position: "unset" }}
enableResizing={resizable ? EnableAll : {}}
dragHandleClassName="drag-area"
minHeight={resizable ? 180 : 0}
minWidth={resizable ? 747 : 0}
resizeCatchInbreak={5}
>
<Component {...props} />
</Rnd>
, this.m_ModalContainer, () =>
{
this.MoveModal();
});
//设置初始位置
if (pos === ModalPosition.Right)
@ -145,10 +160,10 @@ export class ModalManage
this.m_ModalOldPosition.left = this.m_ModalContainer.style.left;
this.m_ModalOldPosition.top = this.m_ModalContainer.style.top;
}
RenderModal(Component: any, pos: ModalPosition, props: { store?: any, [key: string]: any })
RenderModal(Component: any, pos: ModalPosition, props: { store?: any, [key: string]: any }, resizable = false)
{
this.m_IsModal = true;
this.RenderModeless(Component, pos, props);
this.RenderModeless(Component, pos, props, resizable);
}
async EndExecingCmd()
{

@ -3,7 +3,7 @@ import * as React from 'react';
import { observer } from "mobx-react";
import { ISetItemOption } from "./Board/BoardCommon";
import { observable } from "mobx";
import { CheckoutValid } from "../../Common/CheckoutVaildValue";
import { CheckoutValid, CheckObjectType } from "../../Common/CheckoutVaildValue";
export const AppToaster = Toaster.create({
className: "recipe-toaster",
position: Position.TOP,
@ -71,18 +71,25 @@ export class ToasterInput extends React.Component<IToasterInputProps, {}>
handleFocus = e =>
{
this.getErrorMsg(e.target.value);
if (this.props.onFocus)
this.props.onFocus(e);
}
handleBlur = e =>
{
this.hideErrorMsg = true;
if (this.props.onBlur)
this.props.onBlur();
this.props.onBlur(e);
}
componentWillMount()
{
const props = this.props;
this.showData = props.uiOption ? props.uiOption : props.option;
}
componentWillReceiveProps(nextProps)
{
if (this.props.type === CheckObjectType.BBS)
this.showData = nextProps.uiOption ? nextProps.uiOption : nextProps.option;
}
render()
{
const props = this.props;

@ -0,0 +1,37 @@
import { BoardStore } from "./BoardStore";
import { ModalState } from "../Components/Modal/ModalsManage";
import { app } from "../../ApplicationServices/Application";
import { observable } from "mobx";
import { Board } from "../../DatabaseServices/Entity/Board";
import { IBoardInfoOptions } from "../Components/Board/BoardInfosList";
import { CheckObjectType, CheckoutValid } from "../../Common/CheckoutVaildValue";
import { AppToaster } from "../Components/Toaster";
export class LookOverBoardInfosStore extends BoardStore
{
@observable isClose: boolean = false;
boardInfos: Map<Board, IBoardInfoOptions> = new Map();
selectedBr: Board;
@observable findSameTypeBrDataKey: string;
async OnOk<T>(state: number, data?: T)
{
if (state === ModalState.Cancel)
{
app.Editor.ModalManage.Clear();
app.Editor.ModalManage.EndCmd();
}
else
{
for (let [br, opts] of this.boardInfos)
{
if (CheckoutValid.HasInvailValue(opts, CheckObjectType.BBS))
{
AppToaster.show({ message: "存在无效数值,请修正", timeout: 1000 });
return;
}
}
app.Editor.MaskManage.Clear();
app.Editor.ModalManage.ToggleShow();
await app.Editor.ModalManage.ExecCmd(data);
}
}
}
Loading…
Cancel
Save