!141 UI数据转换

Merge pull request !141 from ZoeLeeFZ/DataAda_PR
pull/141/MERGE
ChenX 6 years ago
parent c4736685d9
commit 4a8ae4d6fa

@ -14,17 +14,17 @@ export class DrawBehindBoard extends DrawBoardTool
let newBox = box.clone(); let newBox = box.clone();
const opt = data.boardConfig as BehindBoardOption; const opt = data.boardConfig as BehindBoardOption;
//判断延伸 //判断延伸
let leftExt = parseFloat(opt.leftExt); let leftExt = opt.leftExt;
let rightExt = parseFloat(opt.rightExt); let rightExt = opt.rightExt;
let topExt = parseFloat(opt.topExt); let topExt = opt.topExt;
let bottomExt = parseFloat(opt.bottomExt); let bottomExt = opt.bottomExt;
newBox.max.add(new Vector3(leftExt + rightExt, 0, topExt + bottomExt)); newBox.max.add(new Vector3(leftExt + rightExt, 0, topExt + bottomExt));
newBox.translate(new Vector3(-leftExt, 0, -bottomExt)); newBox.translate(new Vector3(-leftExt, 0, -bottomExt));
//获取背板高度 //获取背板高度
let size = newBox.getSize(new Vector3()); let size = newBox.getSize(new Vector3());
let height = opt.height === "H" ? size.z : parseFloat(opt.height); let height = opt.height === Infinity ? size.z : opt.height;
let moveDist = parseFloat(opt.moveDist); let moveDist = opt.moveDist;
//判断背板位置,更新背板高度 //判断背板位置,更新背板高度
switch (opt.boardPosition) switch (opt.boardPosition)
@ -39,16 +39,16 @@ export class DrawBehindBoard extends DrawBoardTool
break; break;
} }
let count = parseInt(opt.count); let count = opt.count;
//相对位置 //相对位置
let relPos = opt.boardRelative; let relPos = opt.boardRelative;
//单层空间宽度 //单层空间宽度
let spaceSize = parseFloat(opt.spaceSize); let spaceSize = opt.spaceSize;
let thickness = parseFloat(opt.thickness); let thickness = opt.thickness;
let board = Board.CreateBoard(height, size.x, thickness, BoardType.Behind); let board = Board.CreateBoard(height, size.x, thickness, BoardType.Behind);
opt.height = height.toString(); opt.height = height;
opt.width = size.x.toString(); opt.width = size.x;
//等分单层空间大小 //等分单层空间大小
let singleSize = (size.y - (thickness * count)) / (count + 1); let singleSize = (size.y - (thickness * count)) / (count + 1);

@ -55,8 +55,8 @@ export class DrawClosingStrip implements Command
let max = totalSpace.max; let max = totalSpace.max;
let min = totalSpace.min; let min = totalSpace.min;
let pos = new Vector3(); let pos = new Vector3();
let thickness = parseFloat(opt.thickness); let thickness = opt.thickness;
let width = parseFloat(opt.width); let width = opt.width;
let br: Board; let br: Board;
//靠上,横板为层板,基点位置为前右上方的点往上移动一个厚度 竖板为背板,基点为前左上方点 //靠上,横板为层板,基点位置为前右上方的点往上移动一个厚度 竖板为背板,基点为前左上方点
@ -108,8 +108,8 @@ export class DrawClosingStrip implements Command
} }
opt.type = br.BoardType; opt.type = br.BoardType;
opt.height = br.Length.toString(); opt.height = br.Length;
opt.width = br.Width.toString(); opt.width = br.Width;
br.Name = opt.name; br.Name = opt.name;
br.m_BoardProcessOption = Object.assign({}, this.store.m_BoardProcessOption); br.m_BoardProcessOption = Object.assign({}, this.store.m_BoardProcessOption);

@ -13,25 +13,25 @@ export class DrawLayerBoard extends DrawBoardTool
{ {
const opt = data.boardConfig as LayerBoardOption; const opt = data.boardConfig as LayerBoardOption;
let size = box.getSize(new Vector3()); let size = box.getSize(new Vector3());
let width = (opt.isTotalLength || opt.height === "L") ? size.y : parseFloat(opt.height); let width = (opt.isTotalLength || opt.height === Infinity) ? size.y : opt.height;
let count = parseInt(opt.count); let count = opt.count;
let type = opt.boardRelative; let type = opt.boardRelative;
let spaceSize = parseFloat(opt.spaceSize); let spaceSize = opt.spaceSize;
let frontShrink = parseFloat(opt.frontShrink); let frontShrink = opt.frontShrink;
if (opt.isTotalLength) if (opt.isTotalLength)
{ {
width -= frontShrink; width -= frontShrink;
} }
let leftShrink = parseFloat(opt.leftShrink); let leftShrink = opt.leftShrink;
let rightShrink = parseFloat(opt.rightShrink); let rightShrink = opt.rightShrink;
let thickness = parseFloat(opt.thickness); let thickness = opt.thickness;
let len = size.x - leftShrink - rightShrink; let len = size.x - leftShrink - rightShrink;
let board = Board.CreateBoard(size.x - leftShrink - rightShrink, width, thickness, BoardType.Layer); let board = Board.CreateBoard(size.x - leftShrink - rightShrink, width, thickness, BoardType.Layer);
opt.height = len.toString(); opt.height = len;
opt.width = width.toString(); opt.width = width;
//等分单层空间大小 //等分单层空间大小
let singleSize = (size.z - (thickness * count)) / (count + 1); let singleSize = (size.z - (thickness * count)) / (count + 1);

@ -22,10 +22,10 @@ export class DrawLeftRight implements Command
app.m_Editor.m_ModalManage.Callback = async () => app.m_Editor.m_ModalManage.Callback = async () =>
{ {
let data = store.m_BoardOption; let data = store.m_BoardOption;
let lenght = parseFloat(data.height); let lenght = data.height;
let width = parseFloat(data.width); let width = data.width;
let thickness = parseFloat(data.thickness); let thickness = data.thickness;
let spacing = parseFloat(data.spaceSize); let spacing = data.spaceSize;
let leftBoard = Jig.Draw(Board.CreateBoard(lenght, width, thickness, BoardType.Vertical)); let leftBoard = Jig.Draw(Board.CreateBoard(lenght, width, thickness, BoardType.Vertical));
let rightBoard = Jig.Draw(Board.CreateBoard(lenght, width, thickness, BoardType.Vertical)); let rightBoard = Jig.Draw(Board.CreateBoard(lenght, width, thickness, BoardType.Vertical));

@ -20,12 +20,11 @@ export class DrawSingleBoard implements Command
app.m_Editor.m_ModalManage.Callback = async () => app.m_Editor.m_ModalManage.Callback = async () =>
{ {
const opt = store.m_BoardOption; const opt = store.m_BoardOption;
let board = Jig.Draw(Board.CreateBoard(parseFloat(opt.height), parseFloat(opt.width), parseFloat(opt.thickness), opt.type)); let board = Jig.Draw(Board.CreateBoard(opt.height, opt.width, opt.thickness, opt.type));
board.Name = opt.name;
board.m_BoardProcessOption = store.m_BoardProcessOption; board.m_BoardProcessOption = store.m_BoardProcessOption;
let rx = Math.degToRad(parseFloat(opt.rotateX)); let rx = Math.degToRad(opt.rotateX);
let ry = Math.degToRad(parseFloat(opt.rotateY)); let ry = Math.degToRad(opt.rotateY);
let rz = Math.degToRad(parseFloat(opt.rotateZ)); let rz = Math.degToRad(opt.rotateZ);
let eu = new Euler(rx, ry, rz); let eu = new Euler(rx, ry, rz);
board.ApplyMatrix(new Matrix4().makeRotationFromEuler(eu)); board.ApplyMatrix(new Matrix4().makeRotationFromEuler(eu));

@ -77,12 +77,12 @@ export class DrawTopBottomBoard implements Command
let basePt: Vector3; let basePt: Vector3;
let length: number; let length: number;
let thickness = parseFloat(opt.thickness); let thickness = opt.thickness;
let offset = parseFloat(opt.offset); let offset = opt.offset;
let forwardDistance = parseFloat(opt.forwardDistance); let forwardDistance = opt.forwardDistance;
let rot = spaceParse.SpaceOCS; let rot = spaceParse.SpaceOCS;
let leftExt = parseFloat(opt.leftExt); let leftExt = opt.leftExt;
let rightExt = parseFloat(opt.rightExt); let rightExt = opt.rightExt;
if (opt.isWrapSide) if (opt.isWrapSide)
{ {
@ -107,14 +107,7 @@ export class DrawTopBottomBoard implements Command
let footBoard = Board.CreateBoard( let footBoard = Board.CreateBoard(
offset, offset,
spaceParse.SpaceLength, spaceParse.SpaceLength,
parseFloat(opt.footThickness), BoardType.Behind); opt.footThickness, BoardType.Behind);
// footBoard.m_BoardConfigOption = {
// type: BoardType.Behind,
// name: "地脚线",
// height: offset.toString(),
// width: spaceParse.SpaceLength.toString(),
// thickness: opt.footThickness
// };
footBoard.m_BoardProcessOption = Object.assign({}, this.store.m_BoardProcessOption); footBoard.m_BoardProcessOption = Object.assign({}, this.store.m_BoardProcessOption);
footBoard.m_BoardProcessOption.composingFace = ComposingType.Reverse; footBoard.m_BoardProcessOption.composingFace = ComposingType.Reverse;
footBoard.m_BoardProcessOption.bigHoleDir = PXLFaceType.Reverse; footBoard.m_BoardProcessOption.bigHoleDir = PXLFaceType.Reverse;
@ -128,12 +121,9 @@ export class DrawTopBottomBoard implements Command
basePt.add(new Vector3(rightExt, -forwardDistance)); basePt.add(new Vector3(rightExt, -forwardDistance));
let len = length + leftExt + rightExt; let len = length + leftExt + rightExt;
let width = spaceParse.SpaceWidth + forwardDistance + parseFloat(opt.behindDistance); let width = spaceParse.SpaceWidth + forwardDistance + opt.behindDistance;
let board = Board.CreateBoard(len, width, thickness, BoardType.Layer); let board = Board.CreateBoard(len, width, thickness, BoardType.Layer);
// board.m_BoardConfigOption = Object.assign({}, opt);
// board.m_BoardConfigOption.height = len.toString();
// board.m_BoardConfigOption.width = width.toString();
board.m_BoardProcessOption = Object.assign({}, this.store.m_BoardProcessOption); board.m_BoardProcessOption = Object.assign({}, this.store.m_BoardProcessOption);

@ -10,28 +10,27 @@ import { DrawBoardTool } from './DrawBoardTool';
export class DrawVerticalBoard extends DrawBoardTool export class DrawVerticalBoard extends DrawBoardTool
{ {
protected drawType = BoardType.Vertical; protected drawType = BoardType.Vertical;
protected buildBoard(box: Box3Ext, ro: Matrix4, data: BoardData) protected buildBoard(box: Box3Ext, ro: Matrix4, data: BoardData)
{ {
const opt = data.boardConfig as VerticalBoardOption; const opt = data.boardConfig as VerticalBoardOption;
let size = box.getSize(new Vector3()); let size = box.getSize(new Vector3());
let frontShrink = parseFloat(opt.frontShrink); let frontShrink = opt.frontShrink;
let bottomShink = parseFloat(opt.bottomShrink); let bottomShink = opt.bottomShrink;
let width = (opt.isTotalWidth || opt.width === "L") ? size.y : parseFloat(opt.width); let width = (opt.isTotalWidth || opt.width === Infinity) ? size.y : opt.width;
let length = (opt.isTotalLength || opt.width === "H") ? size.z : parseFloat(opt.height); let length = (opt.isTotalLength || opt.width === Infinity) ? size.z : opt.height;
if (opt.isTotalWidth) width -= frontShrink; if (opt.isTotalWidth) width -= frontShrink;
if (opt.isTotalLength) length -= bottomShink; if (opt.isTotalLength) length -= bottomShink;
let count = parseInt(opt.count); let count = opt.count;
let type = opt.boardRelative; let type = opt.boardRelative;
let spaceSize = parseFloat(opt.spaceSize); let spaceSize = opt.spaceSize;
let thickness = parseFloat(opt.thickness); let thickness = opt.thickness;
let board = Board.CreateBoard(length, width, thickness, BoardType.Vertical); let board = Board.CreateBoard(length, width, thickness, BoardType.Vertical);
opt.height = length.toString(); opt.height = length;
opt.width = width.toString(); opt.width = width;
//等分单层空间大小 //等分单层空间大小
let singleSize = (size.x - (thickness * count)) / (count + 1); let singleSize = (size.x - (thickness * count)) / (count + 1);

@ -0,0 +1,30 @@
import { observable } from "mobx";
export class DataAdapter
{
static ConvertUIData(obj: Object, isobser: boolean = true): Object
{
let uiObj = {};
for (let i in obj)
{
if (typeof obj[i] === "number")
{
if (obj[i] === Infinity)
{
//=H?L?
uiObj[i] = "";
}
else
{
uiObj[i] = obj[i].toString();
}
}
else
{
uiObj[i] = obj[i];
}
}
return isobser ? observable.object(uiObj) : uiObj;
}
}

@ -4,29 +4,34 @@ import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { BehindHeightPositon, BrRelativePos } from '../../Store/BoardInterface'; import { BehindHeightPositon, BrRelativePos } from '../../Store/BoardInterface';
import { BehindBoardStore } from '../../Store/BoardStore'; import { BehindBoardStore } from '../../Store/BoardStore';
import { BoardConfigBlock, BoardModel, ItemName, SetBoardDataBlock, SetBoardDataItem } from './BoardCommon'; import { BoardModel, ItemName, SetBoardDataBlock, SetBoardDataItem, BoardRePosBlock } from './BoardCommon';
import { DataAdapter } from '../../../Common/DataAdapter';
@observer @observer
export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore }, {}> export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore }, {}>
{ {
@observable uiOption;
private m_ScaleParameter = [ private m_ScaleParameter = [
["knifeRad", "刀具半径"], ["knifeRad", "刀具半径"],
["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"] ["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"]
]; ];
@observable private moveDir = "移动"; @observable private moveDir = "移动";
constructor(props) componentWillMount()
{ {
super(props); let store = this.props.store;
let pos = this.props.store.m_BoardOption.boardPosition; let pos = store.m_BoardOption.boardPosition;
this.uiOption = DataAdapter.ConvertUIData(store.m_BoardOption);
if (pos === BehindHeightPositon.ForTop) if (pos === BehindHeightPositon.ForTop)
this.moveDir = "上移" this.moveDir = "上移";
else if (pos === BehindHeightPositon.ForBottom) else if (pos === BehindHeightPositon.ForBottom)
this.moveDir = "下移" this.moveDir = "下移";
else
this.uiOption.height = "H"
} }
render() render()
{ {
let store = this.props.store; let store = this.props.store;
return ( return (
<> <>
<ItemName title="板名称" opt={store.m_BoardOption} className="br-name" /> <ItemName title="板名称" opt={store.m_BoardOption} className="br-name" />
@ -34,7 +39,7 @@ export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore
<h6 className={Classes.HEADING}></h6> <h6 className={Classes.HEADING}></h6>
<SetBoardDataBlock <SetBoardDataBlock
pars={this.m_ScaleParameter} pars={this.m_ScaleParameter}
opt={store.m_BoardProcessOption} option={store.m_BoardProcessOption}
className="flexWrap" className="flexWrap"
/> />
</div> </div>
@ -46,22 +51,22 @@ export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore
{ {
let value = e.currentTarget.value as BehindHeightPositon let value = e.currentTarget.value as BehindHeightPositon
store.m_BoardOption.boardPosition = value; store.m_BoardOption.boardPosition = value;
let height = store.m_BoardOption.height; let height = this.uiOption.height;
if (value === BehindHeightPositon.ForTop) if (value === BehindHeightPositon.ForTop)
{ {
this.moveDir = "上移"; this.moveDir = "上移";
store.m_BoardOption.height = height === "H" ? "0" : height this.uiOption.height = height === Infinity ? "0" : height
} }
else if (value === BehindHeightPositon.ForBottom) else if (value === BehindHeightPositon.ForBottom)
{ {
store.m_BoardOption.height = height === "H" ? "0" : height this.uiOption.height = height === Infinity ? "0" : height
this.moveDir = "下移"; this.moveDir = "下移";
} }
else else
store.m_BoardOption.height = "H" this.uiOption.height = "H";
}} }}
selectedValue={store.m_BoardOption.boardPosition} selectedValue={this.uiOption.boardPosition}
> >
<Radio label="总高" value={BehindHeightPositon.AllHeight} /> <Radio label="总高" value={BehindHeightPositon.AllHeight} />
<Radio label="靠上" value={BehindHeightPositon.ForTop} /> <Radio label="靠上" value={BehindHeightPositon.ForTop} />
@ -71,25 +76,33 @@ export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore
<SetBoardDataItem <SetBoardDataItem
optKey="height" optKey="height"
option={store.m_BoardOption} option={store.m_BoardOption}
uiOption={this.uiOption}
title="板高" title="板高"
isDisabled={store.m_BoardOption.boardPosition === BehindHeightPositon.AllHeight} isDisabled={store.m_BoardOption.boardPosition === BehindHeightPositon.AllHeight}
/> />
<SetBoardDataItem <SetBoardDataItem
optKey="moveDist" optKey="moveDist"
option={store.m_BoardOption} option={store.m_BoardOption}
uiOption={this.uiOption}
title={this.moveDir} title={this.moveDir}
isDisabled={store.m_BoardOption.boardPosition === BehindHeightPositon.AllHeight} isDisabled={store.m_BoardOption.boardPosition === BehindHeightPositon.AllHeight}
/> />
</div> </div>
</div> </div>
<BoardConfigBlock <BoardRePosBlock
opt={store.m_BoardOption} uiOption={this.uiOption}
opt1={new Map([[BrRelativePos.Front, "靠前"], [BrRelativePos.Back, "靠后"]])} option={store.m_BoardOption}
posPars={new Map([[BrRelativePos.Front, "靠前"], [BrRelativePos.Back, "靠后"]])}
/> />
<div className="process-data"> <div className="process-data">
<h6 className={Classes.HEADING}></h6> <h6 className={Classes.HEADING}></h6>
<div className="boardSize center"> <div className="boardSize center">
<SetBoardDataItem title="上延伸" optKey="topExt" option={store.m_BoardOption} inline={true} /> <SetBoardDataItem
title="上延伸"
optKey="topExt"
option={store.m_BoardOption}
inline={true}
/>
<div> <div>
<SetBoardDataItem title="左延伸" optKey="leftExt" option={store.m_BoardOption} inline={true} /> <SetBoardDataItem title="左延伸" optKey="leftExt" option={store.m_BoardOption} inline={true} />
<BoardModel /> <BoardModel />

@ -2,15 +2,18 @@ import { Checkbox, Classes, HTMLSelect, Radio, RadioGroup } from '@blueprintjs/c
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { BoardType } from '../../../DatabaseServices/Board'; import { BoardType } from '../../../DatabaseServices/Board';
import { BehindBoardOption, BoardConfigOption, BoardOption, BrRelativePos, LayerBoardOption, TBBoardOption, VerticalBoardOption } from '../../Store/BoardInterface'; import { BoardConfigOption, BoardOption, BrRelativePos, TBBoardOption } from '../../Store/BoardInterface';
import { BoardStore } from '../../Store/BoardStore'; import { BoardStore } from '../../Store/BoardStore';
import { DrillingOption } from './drillInterface'; import { DrillingOption } from './drillInterface';
type OptionType = BoardOption | DrillingOption;
interface ISetItemOption interface ISetItemOption
{ {
optKey: string; optKey: string;
title: string; title: string;
option: OptionType; option: OptionType;
uiOption?: Object;
isDisabled?: boolean; isDisabled?: boolean;
placeHolder?: string; placeHolder?: string;
onChange?: Function; onChange?: Function;
@ -18,29 +21,43 @@ interface ISetItemOption
} }
interface ISetBlockOption interface ISetBlockOption
{ {
pars: Array<Array<string>>, pars: Array<Array<string>>;
opt: BoardOption option: OptionType;
className?: string, uiOption?: Object;
isInline?: boolean, className?: string;
isInline?: boolean;
}
interface TBProps
{
pars: Map<string, string>;
option: TBBoardOption;
uiOption: Object;
istop: boolean;
}
interface BroadPosProps
{
uiOption: Object;
option: BoardOption;
posPars: Map<BrRelativePos, string>;
} }
type OptionType = BoardOption | DrillingOption
//设置板件数据组件 //设置板件数据组件
export const SetBoardDataItem = observer( export const SetBoardDataItem = observer(
(opt: ISetItemOption) => (props: ISetItemOption) =>
<div className={"br-set " + (opt.inline ? "inline" : "")}> {
let showData = props.uiOption ? props.uiOption : props.option;
return (
<div className={"br-set " + (props.inline ? "inline" : "")}>
<span> <span>
{opt.title} {props.title}:
</span> </span>
<input <input
className={BoardStore.IsVailOption(opt.optKey, opt.option[opt.optKey]) ? "bp3-input" : "bp3-input bp3-intent-danger"} className={BoardStore.IsVailOption(props.optKey, showData[props.optKey]) ? "bp3-input" : "bp3-input bp3-intent-danger"}
value={opt.option[opt.optKey]} value={showData[props.optKey]}
disabled={opt.isDisabled} disabled={props.isDisabled}
placeholder={opt.placeHolder} placeholder={props.placeHolder}
onChange={e => onChange={e =>
{ {
if (!BoardStore.IsVailOption(opt.optKey, e.target.value)) if (!BoardStore.IsVailOption(props.optKey, e.target.value))
{ {
e.target.className += " bp3-intent-danger" e.target.className += " bp3-intent-danger"
} }
@ -48,11 +65,28 @@ export const SetBoardDataItem = observer(
{ {
e.target.className = "bp3-input" e.target.className = "bp3-input"
} }
opt.option[opt.optKey] = e.target.value; showData[props.optKey] = e.target.value;
opt.onChange && opt.onChange(); }}
onBlur={e =>
{
if (
typeof props.option[props.optKey] === 'number'
&& e.target.value !== ""
&& !isNaN(parseFloat(e.target.value))
)
{
props.option[props.optKey] = parseFloat(e.target.value);
}
else
{
props.option[props.optKey] = e.target.value;
}
}} }}
/> />
</div> </div>
)
}
); );
export const SetBoardDataBlock = observer( export const SetBoardDataBlock = observer(
@ -63,47 +97,50 @@ export const SetBoardDataBlock = observer(
<SetBoardDataItem <SetBoardDataItem
key={k} key={k}
optKey={k} optKey={k}
option={props.opt} option={props.option}
uiOption={props.uiOption}
title={v} title={v}
/> />
) )
} }
</div> </div>
); );
export const TBBoardDataBlock = export const TBBoardDataBlock =
observer( observer(
({ pars, opt, istop }: { pars: Map<string, string>, opt: TBBoardOption, istop: boolean }) => (props: TBProps) =>
{ {
return ( return (
<div className="pt-card pt-elevation-0 tb-br"> <div className="pt-card pt-elevation-0 tb-br">
<h6 className={Classes.HEADING}>{istop ? "顶板" : "底板"}</h6> <h6 className={Classes.HEADING}>{props.istop ? "顶板" : "底板"}</h6>
<Checkbox <Checkbox
checked={opt.isDraw} checked={props.option.isDraw}
label="是否绘制" label="是否绘制"
onChange={() => opt.isDraw = !opt.isDraw} onChange={() => props.option.isDraw = !props.option.isDraw}
/> />
<RadioGroup <RadioGroup
className="flex" className="flex"
onChange={e => opt.isWrapSide = e.currentTarget.value === "1"} onChange={e => props.option.isWrapSide = e.currentTarget.value === "1"}
selectedValue={opt.isWrapSide ? "1" : "0"} selectedValue={props.option.isWrapSide ? "1" : "0"}
> >
<Radio className="widthHalf" label={istop ? "侧包顶" : "侧包底"} value="0" /> <Radio className="widthHalf" label={props.istop ? "侧包顶" : "侧包底"} value="0" />
<Radio className="widthHalf" label={istop ? "顶包侧" : "底包侧"} value="1" /> <Radio className="widthHalf" label={props.istop ? "顶包侧" : "底包侧"} value="1" />
</RadioGroup> </RadioGroup>
<div className="flexWrap"> <div className="flexWrap">
{ {
Array.from(pars.keys()).map(k => Array.from(props.pars.keys()).map(k =>
{ {
if (k !== "footThickness" || (k === "footThickness" && !istop)) if (k !== "footThickness" || (k === "footThickness" && !props.istop))
return ( return (
<SetBoardDataItem <SetBoardDataItem
title={pars.get(k)} title={props.pars.get(k)}
optKey={k} optKey={k}
key={k} key={k}
option={opt} option={props.option}
uiOption={props.uiOption}
isDisabled={ isDisabled={
((k === "rightExt" || k === "leftExt") && !opt.isWrapSide) || ((k === "rightExt" || k === "leftExt") && !props.option.isWrapSide) ||
((k === "offset" || k === "footThickness") && opt.isWrapSide) ((k === "offset" || k === "footThickness") && props.option.isWrapSide)
} /> } />
) )
}) })
@ -113,19 +150,16 @@ export const TBBoardDataBlock =
) )
}); });
export const BoardModel = () => export const BoardModel = () =>
{
return (
<label className="boardModel"> <label className="boardModel">
<span className="arrow arrowtop"></span> <span className="arrow arrowtop"></span>
<span className="line"></span> <span className="line"></span>
<span className="arrow arrowbottom"></span> <span className="arrow arrowbottom"></span>
</label> </label>
)
}
export const BoardConfigBlock = observer( export const BoardRePosBlock = observer(
({ opt, opt1 }: { opt: VerticalBoardOption | LayerBoardOption | BehindBoardOption, opt1: Map<BrRelativePos, string> }) => (props: BroadPosProps) =>
{ {
let pars = let pars =
[["spaceSize", "空间"], ["count", "板数"], ["thickness", "板厚"]]; [["spaceSize", "空间"], ["count", "板数"], ["thickness", "板厚"]];
@ -137,13 +171,13 @@ export const BoardConfigBlock = observer(
onChange={e => onChange={e =>
{ {
let value = e.currentTarget.value as BrRelativePos; let value = e.currentTarget.value as BrRelativePos;
opt.boardRelative = value; props.option["boardRelative"] = value;
}} }}
selectedValue={opt.boardRelative} selectedValue={props.option["boardRelative"]}
> >
{ {
Array.from(opt1.keys()).map((k, i) => Array.from(props.posPars.keys()).map((k, i) =>
<Radio key={i} label={opt1.get(k)} value={k} /> <Radio key={i} label={props.posPars.get(k)} value={k} />
) )
} }
<Radio label="等分" value={BrRelativePos.Div} /> <Radio label="等分" value={BrRelativePos.Div} />
@ -154,9 +188,10 @@ export const BoardConfigBlock = observer(
<SetBoardDataItem <SetBoardDataItem
key={k} key={k}
optKey={k} optKey={k}
option={opt} uiOption={props.uiOption}
option={props.option}
title={v} title={v}
isDisabled={(k === "spaceSize" && opt.boardRelative === BrRelativePos.Div)} isDisabled={(k === "spaceSize" && props.option["boardRelative"] === BrRelativePos.Div)}
/> />
) )
} }

@ -24,17 +24,17 @@ export const BoardConfigModal =
<SetBoardDataBlock <SetBoardDataBlock
className="flexWrap" className="flexWrap"
pars={pars} pars={pars}
opt={data.boardConfig} option={data.boardConfig}
/> />
<SetBoardDataBlock <SetBoardDataBlock
className="flexWrap" className="flexWrap"
pars={rotatePars} pars={rotatePars}
opt={data.boardConfig} option={data.boardConfig}
/> />
<SetBoardDataBlock <SetBoardDataBlock
className="flexWrap" className="flexWrap"
pars={groovePars} pars={groovePars}
opt={data.boardProcess} option={data.boardProcess}
/> />
<div> <div>
<Checkbox checked={true} label="异型" inline={true} /> <Checkbox checked={true} label="异型" inline={true} />

@ -30,12 +30,12 @@ export class BoardOptionModal extends React.Component<{ board: Board }, {}>
let newConfig = { let newConfig = {
name: br.Name, name: br.Name,
type: br.BoardType, type: br.BoardType,
height: FixedNotZero(br.Length, 2), height: parseFloat(FixedNotZero(br.Length, 2)),
width: FixedNotZero(br.Width, 2), width: parseFloat(FixedNotZero(br.Width, 2)),
thickness: FixedNotZero(br.Thickness, 2), thickness: parseFloat(FixedNotZero(br.Thickness, 2)),
rotateX: FixedNotZero(Math.radToDeg(euler.x), 2), rotateX: parseFloat(FixedNotZero(Math.radToDeg(euler.x), 2)),
rotateY: FixedNotZero(Math.radToDeg(euler.y), 2), rotateY: parseFloat(FixedNotZero(Math.radToDeg(euler.y), 2)),
rotateZ: FixedNotZero(Math.radToDeg(euler.z), 2), rotateZ: parseFloat(FixedNotZero(Math.radToDeg(euler.z), 2)),
} }
if (this.m_ConfigOption) if (this.m_ConfigOption)
{ {
@ -51,17 +51,17 @@ export class BoardOptionModal extends React.Component<{ board: Board }, {}>
let board = this.props.board; let board = this.props.board;
Object.assign(board.m_BoardProcessOption, this.m_ProcessOption); Object.assign(board.m_BoardProcessOption, this.m_ProcessOption);
board.Name = this.m_ConfigOption.name; board.Name = this.m_ConfigOption.name;
board.Length = parseFloat(this.m_ConfigOption.height); board.Length = this.m_ConfigOption.height;
board.Width = parseFloat(this.m_ConfigOption.width); board.Width = this.m_ConfigOption.width;
board.Thickness = parseFloat(this.m_ConfigOption.thickness); board.Thickness = this.m_ConfigOption.thickness;
board.BoardType = this.m_ConfigOption.type; board.BoardType = this.m_ConfigOption.type;
//应用旋转分量 //应用旋转分量
let oldEuler = new Euler().setFromRotationMatrix(new Matrix4().extractRotation(board.BoardOCS)); let oldEuler = new Euler().setFromRotationMatrix(new Matrix4().extractRotation(board.BoardOCS));
let newEuler = new Euler( let newEuler = new Euler(
Math.degToRad(parseFloat(this.m_ConfigOption.rotateX)), Math.degToRad(this.m_ConfigOption.rotateX),
Math.degToRad(parseFloat(this.m_ConfigOption.rotateY)), Math.degToRad(this.m_ConfigOption.rotateY),
Math.degToRad(parseFloat(this.m_ConfigOption.rotateZ)) Math.degToRad(this.m_ConfigOption.rotateZ)
) )
if (!equaln(oldEuler.x, newEuler.x) if (!equaln(oldEuler.x, newEuler.x)
|| !equaln(oldEuler.y, newEuler.y) || !equaln(oldEuler.y, newEuler.y)

@ -26,7 +26,7 @@ export const BoardProcessModal = observer(({ opt }: { opt: BoardProcessOption })
<div className="flex br-mat"> <div className="flex br-mat">
<SetBoardDataBlock <SetBoardDataBlock
pars={matPars} pars={matPars}
opt={opt} option={opt}
isInline={true} isInline={true}
/> />
<button className="bp3-button bp3-intent-success"></button> <button className="bp3-button bp3-intent-success"></button>

@ -37,7 +37,7 @@ export const ClosingStripModal =
<h6 className={Classes.HEADING}></h6> <h6 className={Classes.HEADING}></h6>
<SetBoardDataBlock <SetBoardDataBlock
pars={pars} pars={pars}
opt={props.store.m_BoardOption} option={props.store.m_BoardOption}
/> />
</div> </div>
) )

@ -2,9 +2,17 @@ import { Button, Classes } from '@blueprintjs/core';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { DrillStore } from '../../Store/DrillStore'; import { DrillStore } from '../../Store/DrillStore';
import { observable } from 'mobx';
import { DataAdapter } from '../../../Common/DataAdapter';
@observer @observer
export class DrillRulesComponent extends React.Component<{ store?: DrillStore }, {}>{ export class DrillRulesComponent extends React.Component<{ store?: DrillStore, data: any }, {}>{
@observable uiOption: Object;
constructor(props)
{
super(props);
this.uiOption = DataAdapter.ConvertUIData(this.props.store.m_BoardOption);
}
render() render()
{ {
const store = this.props.store; const store = this.props.store;
@ -14,10 +22,12 @@ export class DrillRulesComponent extends React.Component<{ store?: DrillStore },
<div> <div>
<input <input
className="bp3-input" className="bp3-input"
value={store.m_BoardOption.startDist} value={this.uiOption["startDist"]}
onChange={e => onChange={e =>
{ {
store.m_BoardOption.startDist = e.target.value; this.uiOption["startDist"] = e.target.value;
if (e.target.value !== "" && !isNaN(parseFloat(e.target.value)))
store.m_BoardOption.startDist = parseFloat(e.target.value);
}} }}
/> />
<span> <span>
@ -25,10 +35,12 @@ export class DrillRulesComponent extends React.Component<{ store?: DrillStore },
</span> </span>
<input <input
className="bp3-input" className="bp3-input"
value={store.m_BoardOption.endDist} value={this.uiOption["endDist"]}
onChange={e => onChange={e =>
{ {
store.m_BoardOption.endDist = e.target.value; this.uiOption["endDist"] = e.target.value;
if (e.target.value !== "" && !isNaN(parseFloat(e.target.value)))
store.m_BoardOption.endDist = parseFloat(e.target.value);
}} }}
/> />
<Button <Button

@ -1,22 +1,27 @@
import { Button, Checkbox, Classes, Radio, RadioGroup,Icon } from '@blueprintjs/core'; import { Button, Checkbox, Classes, HTMLSelect, Icon, Radio, RadioGroup } from '@blueprintjs/core';
import { observable } from 'mobx';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import * as xaop from 'xaop';
import { app } from '../../../ApplicationServices/Application'; import { app } from '../../../ApplicationServices/Application';
import { DataAdapter } from '../../../Common/DataAdapter';
import { KeyBoard } from '../../../Common/KeyEnum';
import { commandMachine } from '../../../Editor/CommandMachine';
import { DrillStore } from '../../Store/DrillStore'; import { DrillStore } from '../../Store/DrillStore';
import { ModalState } from '../Modal/ModalsManage';
import { ItemName, SetBoardDataItem } from './BoardCommon'; import { ItemName, SetBoardDataItem } from './BoardCommon';
import { BoardModalType } from './BoardModal'; import { BoardModalType } from './BoardModal';
import { DrillType, SpacingType } from './drillInterface'; import { DrillType, SpacingType } from './drillInterface';
import { DrillRulesComponent } from './DrillRules'; import { DrillRulesComponent } from './DrillRules';
import { UserConfig } from './UserConfig'; import { UserConfig } from './UserConfig';
import { commandMachine } from '../../../Editor/CommandMachine';
import { ModalState } from '../Modal/ModalsManage';
import { KeyBoard } from '../../../Common/KeyEnum';
import * as xaop from 'xaop';
@inject('store') @inject('store')
@observer @observer
export class DrillModal extends React.Component<{ store?: DrillStore }, {}> { export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
@observable private showData;
private posPars = [["originDist", "起始距离"], ["retDist", "剩余距离"]]; private posPars = [["originDist", "起始距离"], ["retDist", "剩余距离"]];
private holePars = [ private holePars = [
["wbHoleRad", "大孔半径"], ["wbHoleDepth", "大孔深度"], ["wbHoleRad", "大孔半径"], ["wbHoleDepth", "大孔深度"],
@ -28,7 +33,11 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
["ljgRad", "连接杆半径"], ["ljgLength", "连接杆长度"], ["ljgRad", "连接杆半径"], ["ljgLength", "连接杆长度"],
["ymjRad", "预埋件半径"], ["ymjDepth", "预埋件深度"] ["ymjRad", "预埋件半径"], ["ymjDepth", "预埋件深度"]
]; ];
constructor(props)
{
super(props);
this.showData = DataAdapter.ConvertUIData(this.props.store.m_BoardOption);
}
registerEvent() registerEvent()
{ {
let store = this.props.store; let store = this.props.store;
@ -76,14 +85,18 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
store.type = e.currentTarget.value as DrillType; store.type = e.currentTarget.value as DrillType;
if (store.type === DrillType.Three){ if (store.type === DrillType.Three){
store.m_BoardOption.name = "三合一"; store.m_BoardOption.name = "三合一";
store. m_BoardOption.pxlRad="7.5"; store.m_BoardOption.pxlRad=7.5;
store. m_BoardOption.ljgLength="34"; store.m_BoardOption.ljgLength=34;
this.showData["pxlRad"]="7.5";
this.showData["ljgLength"]="34";
} }
else else
{ {
store.m_BoardOption.name = "二合一"; store.m_BoardOption.name = "二合一";
store. m_BoardOption.pxlRad = "10"; store.m_BoardOption.pxlRad = 10;
store. m_BoardOption.ljgLength = "10"; store.m_BoardOption.ljgLength = 10;
this.showData["pxlRad"] = "10";
this.showData["ljgLength"] = "10";
} }
}} }}
> >
@ -105,10 +118,11 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
<SetBoardDataItem <SetBoardDataItem
optKey="count" optKey="count"
option={store.m_BoardOption} option={store.m_BoardOption}
uiOption={this.showData}
title="数量" title="数量"
onChange={()=>{ onChange={()=>{
if (parseFloat(store. m_BoardOption.count) <= 2 && store. m_BoardOption.haveDist){ if (parseFloat(this.showData["count"]) <= 2 && this.showData["haveDist"]){
store. m_BoardOption.haveDist=false store.m_BoardOption.haveDist=false;
} }
}} }}
/> />
@ -120,6 +134,7 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
key={k} key={k}
optKey={k} optKey={k}
option={store.m_BoardOption} option={store.m_BoardOption}
uiOption={this.showData}
title={v} title={v}
isDisabled={ isDisabled={
(k === "retDist" && store. m_BoardOption.isEqualProportion) (k === "retDist" && store. m_BoardOption.isEqualProportion)
@ -136,6 +151,7 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
selectedValue={store. m_BoardOption.spacing} selectedValue={store. m_BoardOption.spacing}
onChange={e => onChange={e =>
{ {
this.showData.spacing = e.currentTarget.value;
store.m_BoardOption.spacing = e.currentTarget.value as SpacingType; store.m_BoardOption.spacing = e.currentTarget.value as SpacingType;
}} }}
> >
@ -171,7 +187,7 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
disabled={ disabled={
store.m_BoardOption.isForceDiv store.m_BoardOption.isForceDiv
|| !store.m_BoardOption.count || !store.m_BoardOption.count
|| parseFloat(store. m_BoardOption.count) <= 2 || parseFloat(this.showData.count) <= 2
|| store.m_BoardOption.spacing===SpacingType.EqualDist || store.m_BoardOption.spacing===SpacingType.EqualDist
} }
checked={store. m_BoardOption.haveDist} checked={store. m_BoardOption.haveDist}
@ -180,12 +196,15 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
onChange={() => store. m_BoardOption.haveDist = !store. m_BoardOption.haveDist} onChange={() => store. m_BoardOption.haveDist = !store. m_BoardOption.haveDist}
/> />
<input <input
disabled={store. m_BoardOption.isForceDiv || !store. m_BoardOption.count || parseFloat(store. m_BoardOption.count) <= 2} disabled={store.m_BoardOption.isForceDiv
|| this.showData.count===""
|| parseFloat(this.showData.count) <= 2}
className="bp3-input dist-input" className="bp3-input dist-input"
value={store. m_BoardOption.dist2To1Dist} value={this.showData.dist2To1Dist}
onChange={e => onChange={e =>
{ {
store. m_BoardOption.dist2To1Dist = e.target.value; this.showData.dist2To1Dist = e.target.value;
store.m_BoardOption.dist2To1Dist = parseFloat(e.target.value);
}} }}
/> />
</div> </div>
@ -196,10 +215,11 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
<input <input
type="text" type="text"
className="bp3-input" className="bp3-input"
value={store. m_BoardOption.pxlOffset} value={this.showData.pxlOffset}
onChange={e => onChange={e =>
{ {
store. m_BoardOption.pxlOffset = e.target.value; store.m_BoardOption.pxlOffset = parseFloat(e.target.value);
this.showData.pxlOffset = e.target.value;
}} }}
/> />
</div> </div>
@ -207,10 +227,11 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
<span>:</span> <span>:</span>
<input <input
className="bp3-input" className="bp3-input"
value={store. m_BoardOption.collsionDist} value={this.showData.collsionDist}
onChange={e => onChange={e =>
{ {
store. m_BoardOption.collsionDist = e.target.value; store.m_BoardOption.collsionDist = parseFloat(e.target.value);
this.showData.collsionDist = e.target.value;
}} }}
/> />
</div> </div>
@ -273,14 +294,17 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
</div> </div>
<div> <div>
<Checkbox checked={true} inline={true} label="使用模板" /> <Checkbox checked={false} inline={true} label="使用模板" />
<div className="bp3-select bp3-inline .modifier"> <HTMLSelect
<select> options={
<option value="0">1</option> [
<option value="1">1</option> {
<option value="1">1</option> label:"模板",
</select> value:""
</div> }
]
}
/>
</div> </div>
<h5 className={Classes.HEADING}></h5> <h5 className={Classes.HEADING}></h5>
<Checkbox <Checkbox
@ -307,9 +331,13 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
<div className="small-input flexWrap flex-col"> <div className="small-input flexWrap flex-col">
<div> <div>
<span></span> <span></span>
<input type="text" className="bp3-input" value={store. m_BoardOption.notGangDist} onChange={e => <input
className="bp3-input"
value={this.showData.notGangDist}
onChange={e =>
{ {
store. m_BoardOption.notGangDist = e.target.value; this.showData.notGangDist = e.target.value;
store.m_BoardOption.notGangDist = parseFloat(e.target.value);
}} /> }} />
<span></span> <span></span>
</div> </div>
@ -318,7 +346,7 @@ export class DrillModal extends React.Component<{ store?: DrillStore }, {}> {
</div> </div>
</div> </div>
<div className="bp3-card small-input flex flex-col"> <div className="bp3-card small-input flex flex-col">
<DrillRulesComponent store={store} /> <DrillRulesComponent store={store} data={this.showData} />
</div> </div>
</div> </div>
</div> </div>

@ -3,7 +3,8 @@ import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { BrRelativePos } from '../../Store/BoardInterface'; import { BrRelativePos } from '../../Store/BoardInterface';
import { LayerBoardStore } from '../../Store/BoardStore'; import { LayerBoardStore } from '../../Store/BoardStore';
import { BoardConfigBlock, ItemName, SetBoardDataBlock, SetBoardDataItem } from './BoardCommon'; import { BoardRePosBlock, SetBoardDataBlock, SetBoardDataItem, ItemName } from './BoardCommon';
import { DataAdapter } from '../../../Common/DataAdapter';
export const LayerBoardModal = export const LayerBoardModal =
(observer((props: { store?: LayerBoardStore }) => (observer((props: { store?: LayerBoardStore }) =>
@ -13,6 +14,7 @@ export const LayerBoardModal =
const nailPars2 = [["front", "前边"], ["behind", "后边"], ["count", "个数"], ["rad", "半径"], ["length", "长度"], ["depth", "深度"]]; const nailPars2 = [["front", "前边"], ["behind", "后边"], ["count", "个数"], ["rad", "半径"], ["length", "长度"], ["depth", "深度"]];
let brOpt = props.store.m_BoardOption; let brOpt = props.store.m_BoardOption;
let uiOption = DataAdapter.ConvertUIData(brOpt);
let nailOpt = props.store.layerNailOption; let nailOpt = props.store.layerNailOption;
return ( return (
<> <>
@ -25,20 +27,27 @@ export const LayerBoardModal =
{ {
brOpt.isTotalLength = !brOpt.isTotalLength; brOpt.isTotalLength = !brOpt.isTotalLength;
if (brOpt.isTotalLength) if (brOpt.isTotalLength)
brOpt.height = "L"; {
uiOption['height'] = "L";
brOpt.height = Infinity;
}
}} /> }} />
<Checkbox checked={brOpt.isActive} label="活动" className="widthHalf" onChange={() => <Checkbox checked={brOpt.isActive} label="活动" className="widthHalf" onChange={() =>
{ {
brOpt.isActive = !brOpt.isActive; brOpt.isActive = !brOpt.isActive;
if (brOpt.isActive) if (brOpt.isActive)
{ {
brOpt.leftShrink = "1"; uiOption['leftShrink'] = "1";
brOpt.rightShrink = "1"; uiOption['rightShrink'] = "1";
brOpt.leftShrink = 1;
brOpt.rightShrink = 1;
} }
else else
{ {
brOpt.leftShrink = "0"; uiOption['leftShrink'] = "0";
brOpt.rightShrink = "0"; uiOption['rightShrink'] = "0";
brOpt.leftShrink = 0;
brOpt.rightShrink = 0;
} }
}} /> }} />
@ -50,6 +59,7 @@ export const LayerBoardModal =
key={k} key={k}
optKey={k} optKey={k}
option={brOpt} option={brOpt}
uiOption={uiOption}
title={v} title={v}
isDisabled={(k === "height" && brOpt.isTotalLength)} isDisabled={(k === "height" && brOpt.isTotalLength)}
/> />
@ -103,13 +113,14 @@ export const LayerBoardModal =
</div> </div>
<SetBoardDataBlock <SetBoardDataBlock
pars={nailPars2} pars={nailPars2}
opt={props.store.layerNailOption} option={props.store.layerNailOption}
className="flexWrap" className="flexWrap"
/> />
</div> </div>
<BoardConfigBlock <BoardRePosBlock
opt={props.store.m_BoardOption} uiOption={uiOption}
opt1={new Map([[BrRelativePos.Top, "靠上"], [BrRelativePos.Bottom, "靠下"]])} option={props.store.m_BoardOption}
posPars={new Map([[BrRelativePos.Top, "靠上"], [BrRelativePos.Bottom, "靠下"]])}
/> />
</> </>
) )

@ -1,7 +1,8 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from 'react'; import * as React from 'react';
import { DataAdapter } from '../../../Common/DataAdapter';
import { SingleBoardStore } from "../../Store/BoardStore"; import { SingleBoardStore } from "../../Store/BoardStore";
import { ItemName, SetBoardDataBlock, BoardTypeComponent } from "./BoardCommon"; import { BoardTypeComponent, ItemName, SetBoardDataBlock } from "./BoardCommon";
export const SingleBoardModal = export const SingleBoardModal =
(observer((props: { store?: SingleBoardStore }) => (observer((props: { store?: SingleBoardStore }) =>
@ -14,18 +15,20 @@ export const SingleBoardModal =
]; ];
let opt = props.store.m_BoardOption; let opt = props.store.m_BoardOption;
let processOpt = props.store.m_BoardProcessOption; let processOpt = props.store.m_BoardProcessOption;
let uiOpt = DataAdapter.ConvertUIData(opt);
return ( return (
<div> <div>
<BoardTypeComponent opt={opt} /> <BoardTypeComponent opt={opt} />
<ItemName title="板名称" opt={props.store.m_BoardOption} /> <ItemName title="板名称" opt={props.store.m_BoardOption} />
<SetBoardDataBlock <SetBoardDataBlock
pars={pars} pars={pars}
opt={opt} option={opt}
uiOption={uiOpt}
isInline={true} isInline={true}
/> />
<SetBoardDataBlock <SetBoardDataBlock
pars={processPars} pars={processPars}
opt={processOpt} option={processOpt}
isInline={true} isInline={true}
/> />
</div> </div>

@ -2,12 +2,14 @@ import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { TopBottomBoardStore } from '../../Store/BoardStore'; import { TopBottomBoardStore } from '../../Store/BoardStore';
import { TBBoardDataBlock } from './BoardCommon'; import { TBBoardDataBlock } from './BoardCommon';
import { DataAdapter } from '../../../Common/DataAdapter';
export const TopBottomBoardModal = export const TopBottomBoardModal =
(observer((props: { store?: TopBottomBoardStore }) => (observer((props: { store?: TopBottomBoardStore }) =>
{ {
let store = props.store; let store = props.store;
const uiTOption = DataAdapter.ConvertUIData(store.topBoardOption);
const uiBOption = DataAdapter.ConvertUIData(store.bottomBoardOption);
let pars = new Map([ let pars = new Map([
["thickness", "板厚"], ["forwardDistance", "前距"], ["behindDistance", "后距"], ["thickness", "板厚"], ["forwardDistance", "前距"], ["behindDistance", "后距"],
["leftExt", "左延伸"], ["rightExt", "右延伸"], ["leftExt", "左延伸"], ["rightExt", "右延伸"],
@ -16,12 +18,14 @@ export const TopBottomBoardModal =
return ( return (
<div> <div>
<TBBoardDataBlock <TBBoardDataBlock
opt={store.topBoardOption} option={store.topBoardOption}
uiOption={uiTOption}
pars={pars} pars={pars}
istop={true} istop={true}
/> />
<TBBoardDataBlock <TBBoardDataBlock
opt={store.bottomBoardOption} option={store.bottomBoardOption}
uiOption={uiBOption}
pars={pars} pars={pars}
istop={false} istop={false}
/> />

@ -3,7 +3,8 @@ import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { BrRelativePos } from '../../Store/BoardInterface'; import { BrRelativePos } from '../../Store/BoardInterface';
import { VerticalBoardStore } from '../../Store/BoardStore'; import { VerticalBoardStore } from '../../Store/BoardStore';
import { BoardConfigBlock, ItemName, SetBoardDataItem } from './BoardCommon'; import { BoardRePosBlock, SetBoardDataItem, ItemName } from './BoardCommon';
import { DataAdapter } from '../../../Common/DataAdapter';
export const VerticalBoardModal = export const VerticalBoardModal =
(observer((props: { store?: VerticalBoardStore }) => (observer((props: { store?: VerticalBoardStore }) =>
@ -11,6 +12,18 @@ export const VerticalBoardModal =
const store = props.store; const store = props.store;
const scalePars = [["frontShrink", "前缩"], ["bottomShrink", "位高"], ["width", "板深"], ["height", "板高"]]; const scalePars = [["frontShrink", "前缩"], ["bottomShrink", "位高"], ["width", "板深"], ["height", "板高"]];
const brOpt = store.m_BoardOption; const brOpt = store.m_BoardOption;
const uiOption = DataAdapter.ConvertUIData(brOpt);
if (brOpt.isTotalWidth)
uiOption["width"] = "L";
else
uiOption["width"] = brOpt.width === Infinity ? "L" : brOpt.width.toString();
if (brOpt.isTotalLength)
uiOption["height"] = "H";
else
uiOption["height"] = brOpt.height === Infinity ? "H" : brOpt.height.toString();
return ( return (
<> <>
<ItemName title="板名称" opt={props.store.m_BoardOption} className="br-name" /> <ItemName title="板名称" opt={props.store.m_BoardOption} className="br-name" />
@ -21,14 +34,14 @@ export const VerticalBoardModal =
<Checkbox checked={brOpt.isTotalWidth} className="widthHalf" label="总深" onChange={() => <Checkbox checked={brOpt.isTotalWidth} className="widthHalf" label="总深" onChange={() =>
{ {
brOpt.isTotalWidth = !brOpt.isTotalWidth; brOpt.isTotalWidth = !brOpt.isTotalWidth;
if (brOpt.isTotalWidth)
brOpt.width = "L"; uiOption["width"] = brOpt.isTotalWidth ? "L" : uiOption["width"];
}} /> }} />
<Checkbox checked={brOpt.isTotalLength} className="widthHalf" label="总高" onChange={() => <Checkbox checked={brOpt.isTotalLength} className="widthHalf" label="总高" onChange={() =>
{ {
brOpt.isTotalLength = !brOpt.isTotalLength; brOpt.isTotalLength = !brOpt.isTotalLength;
if (brOpt.isTotalLength)
brOpt.height = "H"; uiOption["height"] = brOpt.isTotalWidth ? "H" : uiOption["height"];
}} /> }} />
</div> </div>
<div className="flexWrap"> <div className="flexWrap">
@ -37,6 +50,7 @@ export const VerticalBoardModal =
<SetBoardDataItem <SetBoardDataItem
key={k} key={k}
optKey={k} optKey={k}
uiOption={uiOption}
option={store.m_BoardOption} option={store.m_BoardOption}
title={v} title={v}
isDisabled={(k === "width" && store.m_BoardOption.isTotalWidth) isDisabled={(k === "width" && store.m_BoardOption.isTotalWidth)
@ -48,9 +62,10 @@ export const VerticalBoardModal =
</div> </div>
</div> </div>
</div> </div>
<BoardConfigBlock <BoardRePosBlock
opt={store.m_BoardOption} uiOption={uiOption}
opt1={new Map([[BrRelativePos.Left, "靠左"], [BrRelativePos.Right, "靠右"]])} option={store.m_BoardOption}
posPars={new Map([[BrRelativePos.Left, "靠左"], [BrRelativePos.Right, "靠右"]])}
/> />
</> </>
) )

@ -10,43 +10,37 @@ export enum SpacingType
} }
export interface DrillingOption export interface DrillingOption
{ {
startDist: string; startDist: number;
endDist: string; endDist: number;
name: string;//拆单名 name: string;//拆单名
originDist: string;//起始距离 originDist: number;//起始距离
retDist: string;//剩余距离 retDist: number;//剩余距离
isEqualProportion: boolean;//是否等比例 isEqualProportion: boolean;//是否等比例
spacing: SpacingType;//间距类型 spacing: SpacingType;//间距类型
count: string;//排钻数量 count: number;//排钻数量
isFromBack: boolean;//余量是否从后面算 isFromBack: boolean;//余量是否从后面算
isForceDiv: boolean;//是否强制等分 isForceDiv: boolean;//是否强制等分
notGangDist: string;//不排钻距离 notGangDist: number;//不排钻距离
pxlOffset: string;//偏心轮偏移距离 pxlOffset: number;//偏心轮偏移距离
collsionDist: string;//碰撞偏移距离 collsionDist: number;//碰撞偏移距离
haveDist: boolean; //第二个排钻距离第一个排钻 haveDist: boolean; //第二个排钻距离第一个排钻
dist2To1Dist: string; //第二个排钻距离第一个排钻的距离 dist2To1Dist: number; //第二个排钻距离第一个排钻的距离
tIsOffset: boolean;//通孔偏移 tIsOffset: boolean;//通孔偏移
tIsChange: boolean;//通孔改预埋件 tIsChange: boolean;//通孔改预埋件
tHoleOffset: string; //通孔偏移 tHoleOffset: number; //通孔偏移
tYmjRad: string;//通孔改小孔半径 tYmjRad: number;//通孔改小孔半径
isDrawWood: boolean; isDrawWood: boolean;
wbHoleRad: string;//木销大孔 wbHoleRad: number;//木销大孔
wbHoleDepth: string; wbHoleDepth: number;
wsHoleRad: string;//木销小孔 wsHoleRad: number;//木销小孔
wsHoleLength: string; wsHoleLength: number;
wdepth: string;//木销深度 wdepth: number;//木销深度
pxlRad: string;//偏心轮 pxlRad: number;//偏心轮
pxlDepth: string; pxlDepth: number;
ljgRad: string;//连接杆 ljgRad: number;//连接杆
ljgLength: string; ljgLength: number;
ymjRad: string;//预埋件 ymjRad: number;//预埋件
ymjDepth: string; ymjDepth: number;
ljgPos: string;//偏心轮位置 ljgPos: string;//偏心轮位置
woodPinPos: string;//木销位置 woodPinPos: string;//木销位置
} }
export interface DrillRule
{
startDist: string;
endDist: string;
}

@ -1,5 +1,6 @@
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { DataAdapter } from '../../../Common/DataAdapter';
import { SideBoardStore } from '../../Store/BoardStore'; import { SideBoardStore } from '../../Store/BoardStore';
import { SetBoardDataBlock } from './BoardCommon'; import { SetBoardDataBlock } from './BoardCommon';
@ -8,11 +9,12 @@ export const LeftRightBoardModal =
(observer((props: { store?: SideBoardStore }) => (observer((props: { store?: SideBoardStore }) =>
{ {
let pars = [["height", "柜高"], ["width", "柜深"], ["thickness", "板厚"], ["spaceSize", "总宽"]]; let pars = [["height", "柜高"], ["width", "柜深"], ["thickness", "板厚"], ["spaceSize", "总宽"]];
let uiOption = DataAdapter.ConvertUIData(props.store.m_BoardOption);
return ( return (
<SetBoardDataBlock <SetBoardDataBlock
pars={pars} pars={pars}
opt={props.store.m_BoardOption} uiOption={uiOption}
isInline={true} option={props.store.m_BoardOption}
className="lr-br" className="lr-br"
/> />
) )

@ -97,13 +97,13 @@ export interface BoardConfigOption extends BoardOption
{ {
type: BoardType; type: BoardType;
name: string; name: string;
thickness?: string; thickness?: number;
height?: string; height?: number;
width?: string; width?: number;
} }
export interface SideBoardOption extends BoardConfigOption export interface SideBoardOption extends BoardConfigOption
{ {
spaceSize?: string; //空间宽度 spaceSize?: number; //空间宽度
} }
/** /**
@ -116,16 +116,16 @@ export interface SideBoardOption extends BoardConfigOption
export interface BehindBoardOption extends BoardConfigOption export interface BehindBoardOption extends BoardConfigOption
{ {
//上下左右延伸 //上下左右延伸
leftExt: string; leftExt: number;
rightExt: string; rightExt: number;
topExt: string; topExt: number;
bottomExt: string; bottomExt: number;
//板件位置 //板件位置
boardPosition: BehindHeightPositon; boardPosition: BehindHeightPositon;
moveDist: string; moveDist: number;
spaceSize?: string; spaceSize?: number;
count?: string; count?: number;
//板件相对位置 //板件相对位置
boardRelative?: BrRelativePos; boardRelative?: BrRelativePos;
} }
@ -139,14 +139,13 @@ export interface BehindBoardOption extends BoardConfigOption
*/ */
export interface LayerBoardOption extends BoardConfigOption export interface LayerBoardOption extends BoardConfigOption
{ {
//前后左右缩 frontShrink: number;
frontShrink: string; leftShrink: number;
leftShrink: string; rightShrink: number;
rightShrink: string;
isTotalLength: boolean; isTotalLength: boolean;
isActive: boolean; isActive: boolean;
spaceSize?: string; spaceSize?: number;
count?: string; count?: number;
boardRelative?: BrRelativePos; boardRelative?: BrRelativePos;
} }
@ -181,30 +180,30 @@ export interface LayerNailOption
*/ */
export interface VerticalBoardOption extends BoardConfigOption export interface VerticalBoardOption extends BoardConfigOption
{ {
frontShrink: string; //前缩 frontShrink: number; //前缩
bottomShrink: string;//底缩 bottomShrink: number;//底缩
isTotalLength: boolean; //是否取总高 isTotalLength: boolean; //是否取总高
isTotalWidth: boolean;//是否取总宽 isTotalWidth: boolean;//是否取总宽
count?: string; count?: number;
spaceSize?: string; spaceSize?: number;
boardRelative?: BrRelativePos; boardRelative?: BrRelativePos;
} }
export interface TBBoardOption extends BoardConfigOption export interface TBBoardOption extends BoardConfigOption
{ {
isDraw: boolean; isDraw: boolean;
forwardDistance: string; //前距 forwardDistance: number; //前距
behindDistance: string; //后距 behindDistance: number; //后距
isWrapSide: boolean; isWrapSide: boolean;
leftExt: string; leftExt: number;
rightExt: string; rightExt: number;
offset: string; offset: number;
footThickness: string; //地脚厚 footThickness: number; //地脚厚
} }
export interface SingleBoardOption extends BoardConfigOption export interface SingleBoardOption extends BoardConfigOption
{ {
rotateX: string; rotateX: number;
rotateY: string; rotateY: number;
rotateZ: string; rotateZ: number;
} }
export enum StripType export enum StripType

@ -96,10 +96,10 @@ export class SideBoardStore extends BoardStore
@observable m_BoardOption: SideBoardOption = { @observable m_BoardOption: SideBoardOption = {
type: BoardType.Vertical, type: BoardType.Vertical,
name: "", name: "",
height: "1200", height: 1200,
width: "600", width: 600,
thickness: "18", thickness: 18,
spaceSize: "836" spaceSize: 836
}; };
title = "左右侧板"; title = "左右侧板";
} }
@ -110,27 +110,27 @@ export class TopBottomBoardStore extends BoardStore
type: BoardType.Layer, type: BoardType.Layer,
name: "顶板", name: "顶板",
isDraw: true, isDraw: true,
thickness: "18", thickness: 18,
forwardDistance: "0", forwardDistance: 0,
behindDistance: "-18", behindDistance: -18,
isWrapSide: false, isWrapSide: false,
leftExt: "0", leftExt: 0,
rightExt: "0", rightExt: 0,
offset: "0", offset: 0,
footThickness: "18" footThickness: 18
}; };
@observable bottomBoardOption: TBBoardOption = { @observable bottomBoardOption: TBBoardOption = {
type: BoardType.Layer, type: BoardType.Layer,
name: "底板", name: "底板",
isDraw: true, isDraw: true,
thickness: "18", thickness: 18,
forwardDistance: "0", forwardDistance: 0,
behindDistance: "-18", behindDistance: -18,
isWrapSide: false, isWrapSide: false,
leftExt: "0", leftExt: 0,
rightExt: "0", rightExt: 0,
offset: "80", offset: 80,
footThickness: "18" footThickness: 18
}; };
title = "顶底板"; title = "顶底板";
@ -167,17 +167,17 @@ export class BehindBoardStore extends BoardStore
@observable m_BoardOption: BehindBoardOption = { @observable m_BoardOption: BehindBoardOption = {
type: BoardType.Behind, type: BoardType.Behind,
name: "背板", name: "背板",
leftExt: "0", leftExt: 0,
rightExt: "0", rightExt: 0,
topExt: "0", topExt: 0,
bottomExt: "0", bottomExt: 0,
thickness: "18", thickness: 18,
boardPosition: BehindHeightPositon.AllHeight, boardPosition: BehindHeightPositon.AllHeight,
height: "H", height: Infinity,
moveDist: "0", moveDist: 0,
boardRelative: BrRelativePos.Back, boardRelative: BrRelativePos.Back,
spaceSize: "0", spaceSize: 0,
count: "1" count: 1
}; };
constructor() constructor()
{ {
@ -192,15 +192,15 @@ export class LayerBoardStore extends BoardStore
@observable m_BoardOption: LayerBoardOption = { @observable m_BoardOption: LayerBoardOption = {
type: BoardType.Layer, type: BoardType.Layer,
name: "层板", name: "层板",
frontShrink: "0", frontShrink: 0,
leftShrink: "0", leftShrink: 0,
rightShrink: "0", rightShrink: 0,
height: "L", height: Infinity,
isTotalLength: true, isTotalLength: true,
boardRelative: BrRelativePos.Div, boardRelative: BrRelativePos.Div,
thickness: "18", thickness: 18,
count: "1", count: 1,
spaceSize: "0", spaceSize: 0,
isActive: false isActive: false
} }
@observable layerNailOption: LayerNailOption = { @observable layerNailOption: LayerNailOption = {
@ -246,16 +246,16 @@ export class VerticalBoardStore extends BoardStore
@observable m_BoardOption: VerticalBoardOption = { @observable m_BoardOption: VerticalBoardOption = {
type: BoardType.Vertical, type: BoardType.Vertical,
name: "立板", name: "立板",
frontShrink: "0", frontShrink: 0,
bottomShrink: "0", bottomShrink: 0,
width: "L", width: Infinity,
height: "H", height: Infinity,
isTotalLength: true, isTotalLength: true,
isTotalWidth: true, isTotalWidth: true,
boardRelative: BrRelativePos.Div, boardRelative: BrRelativePos.Div,
thickness: "18", thickness: 18,
count: "1", count: 1,
spaceSize: "0" spaceSize: 0
} }
} }
@ -265,12 +265,12 @@ export class SingleBoardStore extends BoardStore
@observable m_BoardOption: SingleBoardOption = { @observable m_BoardOption: SingleBoardOption = {
name: "层板", name: "层板",
type: BoardType.Layer, type: BoardType.Layer,
height: "1200", height: 1200,
width: "600", width: 600,
thickness: "18", thickness: 18,
rotateX: "0", rotateX: 0,
rotateY: "0", rotateY: 0,
rotateZ: "0" rotateZ: 0
} }
} }
export class ClosingStripStore extends BoardStore export class ClosingStripStore extends BoardStore
@ -281,8 +281,8 @@ export class ClosingStripStore extends BoardStore
name: "收口条", name: "收口条",
striptype: StripType.H, striptype: StripType.H,
boardRelative: BrRelativePos.Left, boardRelative: BrRelativePos.Left,
width: "50", width: 50,
thickness: "18" thickness: 18
} }
} }
export class DoorStore extends BoardStore export class DoorStore extends BoardStore

@ -20,40 +20,40 @@ export class DrillStore extends BoardStore
Init() Init()
{ {
let originOption: DrillingOption = { let originOption: DrillingOption = {
startDist: "0", startDist: 0,
endDist: "40", endDist: 40,
//位置参数 //位置参数
name: "三合一", name: "三合一",
originDist: "50", originDist: 50,
retDist: "50", retDist: 50,
isEqualProportion: false, isEqualProportion: false,
spacing: SpacingType.EqualDist, spacing: SpacingType.EqualDist,
count: "0", count: 0,
//木销属性 //木销属性
isDrawWood: false, isDrawWood: false,
wbHoleRad: "0", wbHoleRad: 0,
wbHoleDepth: "13.5", wbHoleDepth: 13.5,
wsHoleRad: "3", wsHoleRad: 3,
wsHoleLength: "20", wsHoleLength: 20,
wdepth: "13.5", wdepth: 13.5,
//通孔属性 //通孔属性
tIsOffset: true, tIsOffset: true,
tIsChange: false, tIsChange: false,
tHoleOffset: "0", tHoleOffset: 0,
tYmjRad: "5", tYmjRad: 5,
isFromBack: false, isFromBack: false,
isForceDiv: false, isForceDiv: false,
notGangDist: "15", notGangDist: 15,
pxlOffset: "0", pxlOffset: 0,
collsionDist: "15", collsionDist: 15,
haveDist: false, haveDist: false,
dist2To1Dist: "128", dist2To1Dist: 128,
pxlRad: "7.5", pxlRad: 7.5,
pxlDepth: "13.5", pxlDepth: 13.5,
ljgRad: "3", ljgRad: 3,
ljgLength: "34", ljgLength: 34,
ymjRad: "5", ymjRad: 5,
ymjDepth: "13.5", ymjDepth: 13.5,
ljgPos: "H*0.5", ljgPos: "H*0.5",
woodPinPos: "H*0.5" woodPinPos: "H*0.5"
} }
@ -62,43 +62,43 @@ export class DrillStore extends BoardStore
this.rules.push(originOption); this.rules.push(originOption);
let opt1 = Object.assign({}, originOption); let opt1 = Object.assign({}, originOption);
opt1.count = "1"; opt1.count = 1;
opt1.startDist = "40"; opt1.startDist = 40;
opt1.endDist = "80"; opt1.endDist = 80;
this.rules.push(opt1); this.rules.push(opt1);
let opt2 = Object.assign({}, opt1); let opt2 = Object.assign({}, opt1);
opt2.count = "2"; opt2.count = 2;
opt2.isForceDiv = true; opt2.isForceDiv = true;
opt2.startDist = "80"; opt2.startDist = 80;
opt2.endDist = "200"; opt2.endDist = 200;
this.rules.push(opt2); this.rules.push(opt2);
let opt3 = Object.assign({}, opt2); let opt3 = Object.assign({}, opt2);
opt3.isForceDiv = false; opt3.isForceDiv = false;
opt3.startDist = "200"; opt3.startDist = 200;
opt3.endDist = "500"; opt3.endDist = 500;
this.rules.push(opt3); this.rules.push(opt3);
let opt4 = Object.assign({}, opt3); let opt4 = Object.assign({}, opt3);
opt4.count = "3"; opt4.count = 3;
opt4.startDist = "500"; opt4.startDist = 500;
opt4.endDist = "900"; opt4.endDist = 900;
this.rules.push(opt4); this.rules.push(opt4);
let opt5 = Object.assign({}, opt4); let opt5 = Object.assign({}, opt4);
opt5.count = "4"; opt5.count = 4;
opt5.startDist = "900"; opt5.startDist = 900;
opt5.endDist = "1500"; opt5.endDist = 1500;
this.rules.push(opt5); this.rules.push(opt5);
let opt6 = Object.assign({}, opt5); let opt6 = Object.assign({}, opt5);
opt6.count = "5"; opt6.count = 5;
opt6.originDist = "100"; opt6.originDist = 100;
opt6.retDist = "100"; opt6.retDist = 100;
opt6.startDist = "1500"; opt6.startDist = 1500;
opt6.endDist = "2000"; opt6.endDist = 2000;
this.rules.push(opt6); this.rules.push(opt6);
} }
SaveRuleOption() SaveRuleOption()
@ -115,7 +115,7 @@ export class DrillStore extends BoardStore
hasEqualRule = false; hasEqualRule = false;
break; break;
} }
if (parseFloat(this.m_BoardOption.startDist) > parseFloat(rule.startDist)) if (this.m_BoardOption.startDist > rule.startDist)
{ {
insertIndex = i; insertIndex = i;
} }

Loading…
Cancel
Save