!560 优化商品选择

pull/560/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent 279c7369ee
commit a0630d10af

@ -49,7 +49,7 @@ Array [
3,
1,
"材质1",
2,
3,
"#ffffff",
false,
0.2,
@ -64,6 +64,8 @@ Array [
true,
true,
"",
"",
"",
1,
-1,
0,
@ -156,7 +158,7 @@ Array [
3,
1,
"材质1",
2,
3,
"#ffffff",
false,
0.2,
@ -171,6 +173,8 @@ Array [
true,
true,
"",
"",
"",
"PhysicalMaterialRecord",
2,
103,
@ -178,7 +182,7 @@ Array [
3,
1,
"材质1(1)",
2,
3,
"#ffffff",
false,
0.2,
@ -193,6 +197,8 @@ Array [
true,
true,
"",
"",
"",
1,
-1,
0,
@ -271,7 +277,7 @@ Array [
3,
1,
"材质1",
2,
3,
"#ffffff",
false,
0,
@ -286,6 +292,8 @@ Array [
true,
true,
"",
"",
"",
1,
-1,
0,

@ -269,7 +269,7 @@ export class BoardFindModify implements Command
break;
case EBoardKeyList.Mat:
br.BoardProcessOption[EBoardKeyList.Mat] = option[EBoardKeyList.Mat];
br.BoardProcessOption[EBoardKeyList.BrMat] = option.brMat;
br.BoardProcessOption[EBoardKeyList.BrMat] = option[EBoardKeyList.BrMat];
br.BoardProcessOption[EBoardKeyList.Color] = option[EBoardKeyList.Color];
break;
case EBoardKeyList.DrillType:
@ -365,7 +365,7 @@ export class BoardFindModify implements Command
option.brName = br.Name;
break;
case EBoardKeyList.Mat:
option.brMat = br.BoardProcessOption[EBoardKeyList.BrMat];
option[EBoardKeyList.BrMat] = br.BoardProcessOption[EBoardKeyList.BrMat];
option[EBoardKeyList.Mat] = br.BoardProcessOption[EBoardKeyList.Mat];
option[EBoardKeyList.Color] = br.BoardProcessOption[EBoardKeyList.Color];
break;

@ -10,4 +10,5 @@ export enum StoreageKeys
RoomName = "roomName",
LastOpenFileId = "lastfid",
Uid = "uid",
Goods = "Goods_",
}

@ -5,6 +5,14 @@ import { MaterialTableRecord } from "./MaterialTableRecord";
import { ObjectId } from "./ObjectId";
import { TextureTableRecord } from "./Texture";
export interface IGoodProps
{
name: string;
material: string;
color: string;
}
@Factory
export class PhysicalMaterialRecord extends MaterialTableRecord
{
@ -21,8 +29,11 @@ export class PhysicalMaterialRecord extends MaterialTableRecord
useMap = true;
useBumpMap = true;
useRoughnessMap = true;
shopId = "";
private _goodsInfo: IGoodProps = {
name: "",
color: "",
material: "",
};
private material = new MeshPhysicalMaterial({});
async Update()
{
@ -71,8 +82,15 @@ export class PhysicalMaterialRecord extends MaterialTableRecord
{
return this.material;
}
get GoodsInfo()
{
return this._goodsInfo;
}
set GoodsInfo(info: IGoodProps)
{
this.WriteAllObjectRecord();
Object.assign(this._goodsInfo, info);
}
//#region -------------------------File-------------------------
ReadFile(file: CADFiler)
{
@ -93,14 +111,21 @@ export class PhysicalMaterialRecord extends MaterialTableRecord
this.useMap = file.Read();
this.useBumpMap = file.Read();
this.useRoughnessMap = file.Read();
this.shopId = file.Read();
if (ver <= 2)
file.Read();
else
{
this._goodsInfo.name = file.Read();
this._goodsInfo.material = file.Read();
this._goodsInfo.color = file.Read();
}
this.Update();
}
//对象将自身数据写入到文件.
WriteFile(file: CADFiler)
{
super.WriteFile(file);
file.Write(2);
file.Write(3);
file.Write(this.color);
file.Write(this.transparent);
file.Write(this.matalness);
@ -114,7 +139,9 @@ export class PhysicalMaterialRecord extends MaterialTableRecord
file.Write(this.useMap);
file.Write(this.useBumpMap);
file.Write(this.useRoughnessMap);
file.Write(this.shopId);
file.Write(this._goodsInfo.name);
file.Write(this._goodsInfo.material);
file.Write(this._goodsInfo.color);
}
//#endregion
}

@ -5,6 +5,7 @@ import { IBoardFindOption, ECompareType } from "../UI/Store/BoardFindInterface";
import { ILatticeOption, ELatticeArrayType } from "../UI/Store/LatticeInterface";
import { HandleVePos, DoorPosType, HandleHorPos, IDrawerConfigOption } from "../UI/Store/DoorInterface";
import { CurtailType, IBoardBatchCurtailOption } from "../UI/Components/BoardBatchCurtailModal";
import { EBoardKeyList } from "../Common/BoardKeyList";
export const DefaultLayerBoardConfig: LayerBoardOption = {
version: 1,
@ -238,7 +239,7 @@ export const DefaultBoardFindOption: IBoardFindOption = {
roomName: "",
cabinetName: "",
brName: "",
brMat: "",
[EBoardKeyList.BrMat]: "",
material: "",
color: "",
lines: LinesType.Positive,
@ -389,5 +390,5 @@ export const DefaultLatticeConfig: ILatticeOption = {
isOpenCut: false,
upCut: 0,
downCut: 4,
}
};
Object.freeze(DefaultLatticeConfig);

@ -4,7 +4,7 @@ import * as React from 'react';
import { CSSProperties } from 'react';
import * as xaop from 'xaop';
import { app } from '../../ApplicationServices/Application';
import { ImgsUrl, MaterialUrls } from '../../Common/HostUrl';
import { ImgsUrl, MaterialUrls, ShopUrls } from '../../Common/HostUrl';
import { Post, PostJson, RequestStatus } from '../../Common/Request';
import { deflate, MaterialOut } from '../../Common/SerializeMaterial';
import { PhysicalMaterialRecord } from '../../DatabaseServices/PhysicalMaterialRecord';
@ -13,6 +13,10 @@ import { commandMachine } from '../../Editor/CommandMachine';
import { MaterialRendererSingle } from '../Editor/Asset/MaterialRenderer';
import { appUi } from '../Layout/ApplicationLayout';
import { AppToaster } from './Toaster';
import { appCache } from '../../Common/AppCache';
import { StoreageKeys } from '../../Common/StoreageKeys';
import { Board } from '../../DatabaseServices/Entity/Board';
import { EBoardKeyList } from '../../Common/BoardKeyList';
//蓝图.
const RootStyle: CSSProperties = {
@ -111,8 +115,12 @@ export class Asset extends React.Component<{ material: PhysicalMaterialRecord; }
//得到选择的实体.
let material = this.props.material as PhysicalMaterialRecord;
for (let en of app.Editor.SelectCtrl.SelectSet.SelectEntityList)
{
if (en instanceof Board)
{
en.Material = material.Id;
ApplyGoodInfo(en, material);
}
}
app.Viewer.UpdateRender();
@ -197,3 +205,10 @@ export class Asset extends React.Component<{ material: PhysicalMaterialRecord; }
);
}
}
export function ApplyGoodInfo(en: Board, material: PhysicalMaterialRecord)
{
en.BoardProcessOption[EBoardKeyList.BrMat] = material.GoodsInfo.name;
en.BoardProcessOption[EBoardKeyList.Color] = material.GoodsInfo.color;
en.BoardProcessOption[EBoardKeyList.Mat] = material.GoodsInfo.material;
}

@ -13,6 +13,7 @@ import { observable } from 'mobx';
import { LinesType, FaceDirection, ComposingType, DrillType } from '../../Store/BoardInterface';
import { userConfig } from '../../../Editor/UserConfig';
import { BoardDirectionIcon } from './BoardCommon';
import { GoodsList, IGoodInfo } from '../../MaterialEditor/GoodsList';
interface IBoardFindState
{
@ -26,6 +27,7 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
["左侧板", false], ["右侧板", false], ["顶板", false], ["底板", false],
["层板", false], ["背板", false], ["地脚线", false],
];
private showShops = observable.box(false);
constructor(props)
{
super(props);
@ -93,6 +95,14 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
});
this.setState({ userInputName: name });
};
private handleSelectGoods = (good: IGoodInfo) =>
{
const option = this.props.store.m_Option;
option[EBoardKeyList.BrMat] = good.name;
option[EBoardKeyList.Mat] = good.material;
option[EBoardKeyList.Color] = good.color;
this.showShops.set(false);
};
render()
{
const store = this.props.store;
@ -114,6 +124,10 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
["房名", EBoardKeyList.RoomName], ["柜名", EBoardKeyList.CabinetName],
];
const selectOptions = userConfig.DrillConfigs.size > 0 ? [...userConfig.DrillConfigs.keys(), "不排"] : [];
if (option.highDrill.length !== 4)
option.highDrill.push(...Array(4).fill(selectOptions[0]));
return (
<div
className={Classes.DIALOG_CONTAINER}
@ -474,7 +488,7 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
<HTMLSelect
options={["=", "!="]}
/>
<input className={Classes.INPUT} value={option.brMat} />
<input className={Classes.INPUT} value={option[EBoardKeyList.BrMat]} onChange={e => option[EBoardKeyList.BrMat] = e.target.value} />
</div>
<div>
<Checkbox
@ -490,23 +504,27 @@ export default class BoardFindModifyModal extends React.Component<{ store?: Boar
<HTMLSelect
options={["=", "!="]}
/>
<input className={Classes.INPUT} value={option[EBoardKeyList.Mat]} />
<input className={Classes.INPUT} value={option[EBoardKeyList.Mat]} onChange={e => option[EBoardKeyList.Mat] = e.target.value} />
</div>
<div>
<span></span>
<HTMLSelect
options={["=", "!="]}
/>
<input className={Classes.INPUT} value={option[EBoardKeyList.Color]} />
<input className={Classes.INPUT} value={option[EBoardKeyList.Color]} onChange={e => option[EBoardKeyList.Color] = e.target.value} />
</div>
</div>
<div className="flex">
<Button intent={Intent.PRIMARY}></Button>
<Button intent={Intent.PRIMARY} onClick={() => this.showShops.set(true)}></Button>
<Button
intent={Intent.PRIMARY}
onClick={() => this.getBoardOption(EBoardKeyList.Mat, "选择板件获取板材信息")}
></Button>
</div>
<GoodsList
open={this.showShops}
select={this.handleSelectGoods}
/>
</div>
<BoardFindSelectItem
useKey="lines"

@ -14,6 +14,8 @@ import { DrillingOption } from '../../Store/drillInterface';
import { RightPanelStore } from '../../Store/RightPanelStore/RightPanelStore';
import { RightTabId } from '../RightPanel/RightPanel';
import { DrillTypeSelectCom, Input5Or4Component, SetBoardDataBlock, SetBoardDataItem } from './BoardCommon';
import { GoodsList, IGoodInfo } from '../../MaterialEditor/GoodsList';
import { PhysicalMaterialRecord } from '../../../DatabaseServices/PhysicalMaterialRecord';
interface BoardProcessProps
{
@ -23,6 +25,8 @@ interface BoardProcessProps
}
@observer
export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
private showShops = observable.box(false);
private container: HTMLDivElement;
private matPars = [
["boardName", "板材名"], ["material", "材料"], ["color", "颜色"]
];
@ -85,15 +89,35 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
}
app.Editor.ModalManage.ToggleShow();
};
private selectGoods = (good: IGoodInfo) =>
{
this.props.opt[EBoardKeyList.BrMat] = good.name;
this.props.opt[EBoardKeyList.Mat] = good.material;
this.props.opt[EBoardKeyList.Color] = good.color;
if (this.props.br && this.props.br.Material)
{
let mat = this.props.br.Material.Object as PhysicalMaterialRecord;
mat.GoodsInfo = {
name: good.name,
material: good.material,
color: good.color,
};
}
this.showShops.set(false);
};
async UNSAFE_componentWillMount()
{
this.drillConfigs = userConfig.DrillConfigs;
}
componentDidMount()
{
this.container.addEventListener('keydown', e => e.stopPropagation());
}
render()
{
let isShowHighEditor = Boolean(this.props.br);
return (
<div className="board-info">
<div className="board-info" ref={el => this.container = el}>
{
this.renderEl()
}
@ -104,7 +128,14 @@ export class BoardProcessModal extends React.Component<BoardProcessProps, {}>{
option={this.props.opt}
isInline={true}
/>
<button className="bp3-button bp3-intent-success"></button>
<button
className="bp3-button bp3-intent-success"
onClick={() => this.showShops.set(true)}
></button>
<GoodsList
open={this.showShops}
select={this.selectGoods}
/>
</div>
<div>
<label className="bp3-label bp3-inline .modifier">

@ -150,7 +150,6 @@ export class DoorModal extends React.Component<{ store?: DoorDrawerStore, type:
private startSelectTemplate = () =>
{
this.startSelect.set(true);
document.getElementById("modal").style.overflow = "visible";
}
private changeTemplateProps = (parName: string, val: string) =>
{

@ -90,7 +90,6 @@ export class MaterialContainer extends React.Component<MaterialContainerProps, {
logo: logoPath,
file: deflate(materialJson),
zip_type: "gzip",
goods_id: material.shopId,
});
if (data.err_code === RequestStatus.Ok)
{

@ -1,7 +1,7 @@
import { ContextMenu, Menu, MenuItem, Icon } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import * as React from 'react';
import { Asset } from './Asset';
import { Asset, ApplyGoodInfo } from './Asset';
import { MaterialTable } from '../../DatabaseServices/MaterialTable';
import { PhysicalMaterialRecord } from '../../DatabaseServices/PhysicalMaterialRecord';
import { app } from '../../ApplicationServices/Application';
@ -64,7 +64,10 @@ export class MaterialExplorer extends React.Component<{ materialTable: MaterialT
{
let en = GetEntity(o);
if (en && en instanceof Board)
{
en.Material = material.Id;
ApplyGoodInfo(en, material);
}
}
app.Editor.UpdateScreen();
commandMachine.CommandEnd();

@ -3,30 +3,38 @@
@width: 70px;
@inputWidth: 75px;
@buttonWidth: 90px;
.bp3-dialog-body {
&>div:first-child {
width: 390px;
padding-right: 10px;
}
&>div:last-child {
width: 300px;
}
.br-find-item {
display: flex;
align-items: center;
margin-bottom: 5px;
&>label {
width: 60px;
margin: 0;
}
&>input,&>div{
&>input,
&>div {
margin: 0 5px;
width: 20%;
}
&>.bp3-html-select:nth-child(2) {
width: @selectWidth;
margin: 0 5px;
}
&>button {
height: 20px;
line-height: 20px;
@ -34,26 +42,33 @@
padding: 0 10px;
}
}
.br-find-item.small {
&>label {
width: @width;
}
&>input {
width: @inputWidth;
}
&>button {
flex: 1;
}
&>.select-name {
flex: 1;
display: flex;
justify-content: space-between;
margin: 0;
&>span {
height: 20px;
width: 40px;
}
&>button,& .bp3-popover-target>button{
&>button,
& .bp3-popover-target>button {
width: 40px;
white-space: nowrap;
height: 20px;
@ -61,6 +76,7 @@
min-height: 20px;
padding: 0 10px;
}
& .bp3-popover-content input {
display: block;
width: 100%;
@ -69,22 +85,39 @@
}
}
}
.mat-color {
position: relative;
.search-shop {
position: absolute;
right: 0;
top: 10px;
input {
width: 100%;
}
}
&>div:first-child {
&>div {
display: flex;
&>label {
margin: 0;
width: @width;
}
&>span {
padding-left: 26px;
width: @width;
}
&>input {
width: @inputWidth;
margin: 0 5px;
}
&>.bp3-html-select {
width: @selectWidth;
margin-left: 5px;
@ -92,55 +125,72 @@
}
}
}
&>button {
flex: 1;
}
}
}
.select-ent {
display: flex;
flex-wrap: wrap;
&>label {
width: 20%;
margin: 0;
}
}
.find-select-item {
display: flex;
&>label {
width: 25%;
}
&>div:nth-child(2) {
width: @selectWidth;
}
&>div:last-child {
flex: 1;
margin-left: 10px;
}
}
.find-sealed {
text-align: center;
&>div label {
margin-right: 0;
margin-left: 10px;
position: relative;
}
&>div:first-child,&>div:nth-child(2),&>div:nth-child(3){
&>div:first-child,
&>div:nth-child(2),
&>div:nth-child(3) {
label {
top: 1px;
}
}
&>div>input,&>div>div>input{
&>div>input,
&>div>div>input {
width: 30px;
padding: 0 2px;
margin-right: 5px;
}
.all-sealed {
position: absolute;
}
.select-drillType {
vertical-align: baseline;
}
&>.flex-center {
align-items: center;
}

@ -2,25 +2,33 @@
.bp3-select>select {
width: @inputWidth;
}
.long-select>.bp3-select>select {
width: @infoSelectWidth
}
.board-info>.bp3-label input {
width: @infoSelectWidth;
}
.board-info {
select,.br-set input{
select,
.br-set input {
width: @infoSelectWidth;
}
.br-set input {
margin-left: 5px;
}
}
}
#commonModal .notes {
.bp3-input {
height: @noteInputHeight;
}
.bp3-label {
line-height: @noteInputHeight;
}
@ -30,6 +38,7 @@
#commonModal .process-data .br-set input {
display: block;
}
/* 板件模型设置 */
#commonModal .boardModel {
display: inline-block;
@ -39,54 +48,70 @@
vertical-align: middle;
margin: 10px;
}
#commonModal .boardSize .bp3-label,#commonModal .behind-board .board-info .boardSize .bp3-input{
#commonModal .boardSize .bp3-label,
#commonModal .behind-board .board-info .boardSize .bp3-input {
display: inline-block;
margin: 0 5px;
}
#commonModal {
.boardSize {
min-width: 151px;
}
.select-drillType {
flex: 1;
}
}
#commonModal .board-info .boardSize .bp3-input {
width: 30px;
}
#commonModal .boardSize .bp3-inline {
line-height: 15px;
}
#commonModal .boardSize .bp3-label>.bp3-input {
display: block;
padding: 0;
padding-left: 5px;
line-height: 15px;
}
#commonModal .input-select>input, #commonModal .input-select span {
#commonModal .input-select>input,
#commonModal .input-select span {
margin: 0;
}
#commonModal .behind-board {
display: flex;
}
/* 板材信息 */
#commonModal {
.bp3-input,.lr-br .bp3-input{
.bp3-input,
.lr-br .bp3-input {
width: @inputWidth;
}
.boardSize .bp3-input {
width: 3rem;
}
}
//板名称输入框大小
#modal #commonModal .bp3-dialog-body .br-name {
width: @nameInput;
}
/* 排孔选项 */
#commonModal .hole {
margin-left: 0.5rem;
}
#commonModal .hole>label {
display: inline-block;
margin-right: 1rem;
@ -96,19 +121,26 @@
#commonModal .notes {
width: 20vmin;
}
#commonModal .notes>div {
display: flex;
}
#commonModal .notes>div>label {
height: @noteInputHeight;
line-height: @noteInputHeight;
}
#commonModal .notes>div>label:first-child ,#commonModal .notes>div>input:first-child{
#commonModal .notes>div>label:first-child,
#commonModal .notes>div>input:first-child {
width: 30%;
}
#commonModal .notes>div>label:last-child ,#commonModal .notes>div>input:last-child{
#commonModal .notes>div>label:last-child,
#commonModal .notes>div>input:last-child {
width: 70%;
}
#commonModal .notes>div input:hover {
background: #ccc;
}
@ -116,14 +148,27 @@
//选择材质
#commonModal .bp3-dialog-body .board-info {
.br-mat {
position: relative;
margin-bottom: 0.5rem;
// justify-content: space-between;
button {
width: 2rem;
}
input {
width: 6.5rem;
}
.search-shop {
position: absolute;
right: 0;
top: 20px;
input {
width: 100%;
}
}
}
.br-mat>div>div:last-child {
@ -136,7 +181,9 @@
}
#commonModal>.board-config {
.bp3-input,.bp3-select>select{
.bp3-input,
.bp3-select>select {
width: 5.5rem;
}
}
@ -149,22 +196,28 @@
padding-bottom: 0px;
min-height: 14px;
}
#commonModal .edge-sealing {
display: flex;
margin-top: 10px;
align-items: center;
ul {
padding: 10px;
}
.bp3-input {
width: 10rem;
}
}
#commonModal .bp3-dialog-body .option-header {
width: 15rem;
&>select {
height: 2rem;
}
.bp3-icon {
top: 4px;
}

@ -47,7 +47,7 @@ export class ModalManage
private m_IsModal: boolean = false;
private m_IsMinimize: boolean = true;
events: Function[] = [];
private m_ModalOldPosition: { left: string, top: string } = { left: "0", top: "0" };
private m_ModalOldPosition: { left: string, top: string; } = { left: "0", top: "0" };
private minimizeEl: HTMLElement = null;
private originDialogDisplayVal: string = "flex";
@ -159,7 +159,7 @@ export class ModalManage
RenderModeless(Component: any, pos: ModalPosition, props?: any, resizable = false, isMinimize = true)
{
this.m_IsMinimize = isMinimize;
this.m_ModalContainer.style.overflow = resizable ? "unset" : "hidden";
// this.m_ModalContainer.style.overflow = resizable ? "unset" : "hidden";
app.Editor.MaskManage.ShowMask();
this.m_ModalContainer.focus();
ReactDOM.render(

@ -13,23 +13,10 @@ export class DisplayConfigPanel extends React.Component<{ store: ConfigStore }>
{
@observable private _OpenColorPick = false;
@observable _AAType = "性能";
private _observerOpenColor: Function;
UNSAFE_componentWillMount()
{
this._AAType = app.Viewer.AAType === AAType.FXAA ? "性能" : "质量";
}
componentDidMount()
{
let modal = document.getElementById('modal');
this._observerOpenColor = autorun(() =>
{
modal.style.overflow = this._OpenColorPick ? "visible" : "hidden";
})
}
componentWillUnmount()
{
this._observerOpenColor();
}
handleChangeColor = (color: ColorResult) =>
{
this.props.store.bgColor = color.hex;

@ -0,0 +1,144 @@
import * as React from 'react';
import { observable, IObservableValue } from 'mobx';
import { InputGroup, Icon, Classes } from '@blueprintjs/core';
import { RequestStatus, PostJson } from '../../Common/Request';
import { ShopUrls } from '../../Common/HostUrl';
import { appCache } from '../../Common/AppCache';
import { StoreageKeys } from '../../Common/StoreageKeys';
import { Pagination } from '../Components/SourceManage/Pagination';
import { observer } from 'mobx-react';
import { KeyBoard } from '../../Common/KeyEnum';
export interface IGoodInfo
{
goods_id: string;
name: string;
color: string,
material: string,
}
interface IGoodsListProps
{
select: (good: IGoodInfo) => void;
open: IObservableValue<boolean>;
}
@observer
export class GoodsList extends React.Component<IGoodsListProps> {
private timeId: NodeJS.Timeout;
@observable searchStr = "";
@observable goods = [];
@observable info = {
count: 0,
currentPage: 1,
pageCount: 20
}
UNSAFE_componentWillMount()
{
this.handleSearch();
}
public render()
{
return (
this.props.open.get() &&
<>
<div className="search-shop"
tabIndex={-1}
onKeyUp={this.handleKeyDown}
>
<InputGroup
placeholder="搜索要关联的商品"
value={this.searchStr}
onChange={this.handleChange}
autoFocus
rightElement={<Icon icon="double-caret-vertical" />} />
<div className="title">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<ul className={Classes.LIST_UNSTYLED}>
{
this.goods.map(v =>
{
let mat = v.goods_param.find(p => p.name === "材料");
let color = v.goods_param.find(p => p.name === "颜色");
let thick = v.goods_param.find(p => p.name === "厚");
let matName = mat ? mat.value : "";
let colorName = color ? color.value : "";
let info = {
goods_id: v.goods_id,
name: v.goods_name,
color: colorName,
material: matName,
}
appCache.set(StoreageKeys.Goods + v.goods_id, info);
return <li
value={v.goods_id}
onClick={() => this.props.select(info)}
>
<span>{v.goods_sn}</span>
<span>{v.goods_name}</span>
<span>{thick ? thick.value : ""}</span>
<span>{matName}</span>
<span>{colorName}</span>
<span>{v.goods_stock}</span>
</li>
})
}
</ul>
{
this.info.count > 20 &&
<Pagination
pageData={this.info}
getImgListFun={this.handleSearch}
/>
}
</div>
<div className="masking" onClick={this.handleHideSelect}></div>
</>
);
}
handleChange = (e: React.ChangeEvent<HTMLInputElement>) =>
{
this.searchStr = e.target.value;
if (this.timeId)
clearTimeout(this.timeId);
this.timeId = setTimeout(async () =>
{
await this.handleSearch();
}, 500);
};
handleSearch = async (opt: { curr_page: number } = { curr_page: 1 }) =>
{
this.info.currentPage = opt.curr_page;
let data = await PostJson(ShopUrls.get, {
...opt,
goods_name: this.searchStr,
bind_type: 1,
goods_type: 1,
});
if (data.err_code === RequestStatus.Ok)
{
this.info.count = data.count;
observable(this.goods).replace(data.goods);
}
};
private handleKeyDown = (e: React.KeyboardEvent) =>
{
if (e.keyCode === KeyBoard.Escape)
{
this.handleHideSelect();
}
}
private handleHideSelect = () =>
{
this.props.open.set(false);
}
}

@ -4,20 +4,24 @@
height: calc(~"100% - 50px");
display: flex;
padding: 0;
&>div:first-child {
width: 160px;
}
&>div:last-child {
flex: 1;
display: flex;
flex-wrap: wrap;
align-content: flex-start;
overflow: auto;
h5 {
width: 100%;
}
}
&>div>div {
text-align: center;
margin-right: 10px;
@ -26,22 +30,28 @@
position: relative;
box-shadow: none;
padding: 0;
.editor-content {
&>label {
display: flex;
&>span {
text-align: left;
margin-right: 20px;
}
&>div {
display: flex;
margin: 0;
justify-content: space-between;
&>label {
display: flex;
span {
width: 20px;
}
input {
width: 60px;
}
@ -49,10 +59,12 @@
}
}
}
.delete-btn {
position: absolute;
top: 0;
right: 0;
svg {
color: #000;
}
@ -60,9 +72,11 @@
}
}
.select-img {
z-index: 60;
}
//不需要拖拽大小
.lm_splitter {
display: none;
@ -74,9 +88,11 @@
user-select: none;
overflow: hidden;
}
.img-select-hint:hover {
cursor: pointer;
}
.img-select-hint:hover:before {
content: "双击选择图片";
position: absolute;
@ -95,15 +111,21 @@
margin: 3px;
display: flex;
align-items: center;
&>span {
width: 60px;
}
&>div{
button{
height: 22px;
min-height: 22px;
padding: 0 10px;
& .br-set {
margin-bottom: 0 !important;
}
& .br-set>span:first-child {
display: inline-block;
width: 60px !important;
}
&>div {
input {
vertical-align: middle;
background: #fff;
@ -112,22 +134,56 @@
height: 22px;
}
}
}
.search-shop {
position: absolute;
top: 60px;
position: fixed;
top: 112px;
right: 30px;
z-index: 35;
padding: 10px;
background: rgb(48, 64, 77);
background: #fff;
font-size: 16px;
width: 740px;
outline: 1px solid #ccc;
.title {
display: flex;
span {
width: 25%;
background: #ccc;
padding: 5px 5px;
}
}
ul>li {
display: flex;
span {
width: 25%;
overflow: hidden;
text-overflow: ellipsis;
outline: 1px solid #ccc;
white-space: nowrap;
}
}
input {
height: 2.5rem !important;
}
.bp3-input-action {
top: 5px !important;
}
li:hover {
background: rgb(26, 128, 191)
}
.pagination li {
padding-left: 11px;
}
}

@ -1,91 +1,60 @@
import { Button, Classes, Icon, InputGroup, Intent } from "@blueprintjs/core";
import { Button, Intent } from "@blueprintjs/core";
import { observable } from "mobx";
import { inject, observer } from "mobx-react";
import * as React from "react";
import { PostJson, RequestStatus } from "../../Common/Request";
import { MaterialStore } from "../Store/MaterialStore";
import { ShopUrls } from "../../Common/HostUrl";
interface ICreateMaterialState
{
showShops: boolean;
searchStr: string;
}
import { GoodsList, IGoodInfo } from "./GoodsList";
import { SetBoardDataBlock } from "../Components/Board/BoardCommon";
import { CheckObjectType } from "../../Common/CheckoutVaildValue";
import { AppToaster } from "../Components/Toaster";
@inject('store')
@observer
export class MaterialLinkShopId extends React.Component<{ store?: MaterialStore; }, ICreateMaterialState>
export class MaterialLinkShopId extends React.Component<{ store?: MaterialStore; }, {}>
{
@observable goods = [];
private timeId = null;
private closeTimeId = null;
private showShops = observable.box(false);
private container: HTMLElement;
private matPars = [
["name", "板材名"], ["material", "材料"], ["color", "颜色"]
];
constructor(props)
{
super(props);
this.state = {
showShops: false,
searchStr: "",
};
}
handleOpenShopList = async () =>
{
this.setState({ showShops: true });
await this.handleSearch();
};
handleChange = (e: React.ChangeEvent<HTMLInputElement>) =>
{
this.setState({ searchStr: e.target.value });
if (this.timeId)
clearTimeout(this.timeId);
this.timeId = setTimeout(async () =>
{
await this.handleSearch();
}, 500);
};
handleSearch = async () =>
{
let data = await PostJson(ShopUrls.get, {
goods_name: this.state.searchStr,
bind_type: 1
});
if (data.err_code === RequestStatus.Ok)
{
observable(this.goods).replace(data.goods);
}
this.showShops.set(true);
};
handleSelectGood = (good) =>
handleSelectGood = (good: IGoodInfo) =>
{
if (this.closeTimeId)
clearTimeout(this.closeTimeId);
const store = this.props.store;
store.shopInfo.name = good.goods_name;
store.shopInfo.id = good.goods_id;
this.setState({ showShops: false, searchStr: "" });
store.goodsInfo.name = good.name;
store.goodsInfo.color = good.color;
store.goodsInfo.material = good.material;
this.showShops.set(false);
AppToaster.show({
message: "如果你将这个材质赋予到板件,我们会把材质的板材信息拷贝到板件中",
timeout: 2500,
});
};
handleHideSelect = () =>
componentDidMount()
{
if (this.closeTimeId)
clearTimeout(this.closeTimeId);
this.closeTimeId = setTimeout(() =>
{
this.setState({ showShops: false });
}, 300);
};
this.container.addEventListener('keydown', e => e.stopPropagation());
}
render()
{
return (
<label
className="select-shop"
ref={el => this.container = el}
onKeyDown={e => e.stopPropagation()}
>
<span style={{ width: 60 }}></span>
<div>
<input
disabled
placeholder="点击选择商品"
value={this.props.store.shopInfo.name}
<div className="flex">
<SetBoardDataBlock
type={CheckObjectType.BR}
pars={this.matPars}
option={this.props.store.goodsInfo as any}
isInline={true}
/>
<Button
text="选择"
@ -93,31 +62,10 @@ export class MaterialLinkShopId extends React.Component<{ store?: MaterialStore;
onClick={this.handleOpenShopList}
/>
</div>
{
this.state.showShops &&
<div className="search-shop"
tabIndex={-1}
>
<InputGroup
placeholder="搜索要关联的商品"
value={this.state.searchStr}
onChange={this.handleChange}
autoFocus
onBlur={this.handleHideSelect}
rightElement={<Icon icon="double-caret-vertical" />} />
<ul className={Classes.LIST_UNSTYLED}>
{
this.goods.map(v =>
<li
value={v.goods_id}
onClick={() => this.handleSelectGood(v)}
>
{v.goods_name}
</li>)
}
</ul>
</div>
}
<GoodsList
open={this.showShops}
select={this.handleSelectGood}
/>
</label>
);
}

@ -15,7 +15,7 @@ export interface IBoardFindOption extends IBaseOption
[EBoardKeyList.RoomName]: string;
[EBoardKeyList.CabinetName]: string;
brName: string; //板名
brMat: string; //板材
[EBoardKeyList.BrMat]: string; //板材
[EBoardKeyList.Mat]: string;
[EBoardKeyList.Color]: string;
[EBoardKeyList.Lines]: LinesType;

@ -69,7 +69,7 @@ export class BoardFindStore extends BoardStore
roomName: "",
cabinetName: "",
brName: "",
brMat: "",
[EBoardKeyList.BrMat]: "",
material: "",
color: "",
lines: LinesType.Positive,

@ -1,11 +1,9 @@
import { Intent } from "@blueprintjs/core";
import { action, autorun, observable } from "mobx";
import { action, autorun, observable, toJS } from "mobx";
import { end } from "xaop";
import { app } from "../../ApplicationServices/Application";
import { ShopUrls } from "../../Common/HostUrl";
import { PostJson, RequestStatus } from "../../Common/Request";
import { Singleton } from "../../Common/Singleton";
import { PhysicalMaterialRecord } from "../../DatabaseServices/PhysicalMaterialRecord";
import { IGoodProps, PhysicalMaterialRecord } from "../../DatabaseServices/PhysicalMaterialRecord";
import { TextureTableRecord } from "../../DatabaseServices/Texture";
import { MaterialEditor } from "../../Editor/MaterialEditor";
import { IDirectoryProps } from "../Components/SourceManage/CommonPanel";
@ -30,9 +28,10 @@ export class MaterialStore extends Singleton
protected reactionDestroy;
@observable isOpenTexture = false;
@observable isOpenImgList = false;
@observable shopInfo = {
@observable goodsInfo: IGoodProps = {
name: "",
id: "",
color: "",
material: "",
};
currentEditorStore: TextureStore;
@ -133,8 +132,7 @@ export class MaterialStore extends Singleton
this.Material.useBumpMap = this.bumpMaping.use.get();
this.Material.useRoughnessMap = this.roughnessMaping.use.get();
if (this.shopInfo.id)
this.Material.shopId = this.shopInfo.id;
this.Material.GoodsInfo = toJS(this.goodsInfo);
this.textureMaping.UpdateStore(this.textureMaping.textureId);
this.bumpMaping.UpdateStore(this.bumpMaping.textureId);
@ -157,18 +155,7 @@ export class MaterialStore extends Singleton
this.bumpScale.set(this.Material.bumpScale);
this.roughness.set(this.Material.roughness);
this.shopInfo.id = this.Material.shopId;
this.shopInfo.name = "";
if (this.shopInfo.id)
{
let data = await PostJson(ShopUrls.get, {
goods_id: [this.shopInfo.id]
});
if (data.err_code === RequestStatus.Ok && data.goods.length > 0)
{
this.shopInfo.name = data.goods[0].goods_name;
}
}
Object.assign(this.goodsInfo, this.Material.GoodsInfo);
}
}
InitTextureStore()

Loading…
Cancel
Save