diff --git a/src/Add-on/CombinatAttributeBrush.tsx b/src/Add-on/CombinatAttributeBrush.tsx index c68a4327e..b259942a5 100644 --- a/src/Add-on/CombinatAttributeBrush.tsx +++ b/src/Add-on/CombinatAttributeBrush.tsx @@ -1,4 +1,4 @@ -import { Button, Checkbox, Intent } from '@blueprintjs/core'; +import { Button, Checkbox, H5, Intent } from '@blueprintjs/core'; import { observable, toJS } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; @@ -8,6 +8,7 @@ import { EBoardKeyList } from '../Common/BoardKeyList'; import { ConfigUrls } from '../Common/HostUrl'; import { PostJson, RequestStatus } from '../Common/Request'; import { HardwareCompositeEntity } from "../DatabaseServices/Hardware/HardwareCompositeEntity"; +import { ProcessingGroupRecord } from '../DatabaseServices/ProcessingGroup/ProcessingGroupRecord'; import { Command } from "../Editor/CommandMachine"; import { PromptStatus } from "../Editor/PromptResult"; import { CommonModal } from '../UI/Components/Modal/ModalContainer'; @@ -22,6 +23,19 @@ interface IBrushOption name: boolean; factory: boolean; comments: boolean; + isSplite: boolean; + actualExpr: boolean; + isSplitePrice: boolean; + isHole: boolean; + brand: boolean; + model: boolean; + spec: boolean; + count: boolean; + unit: boolean; + ProcessingGroupList: boolean; + material: boolean; + color: boolean; + DataList: boolean; } export class CombinatAttributeBrush implements Command @@ -55,6 +69,19 @@ export class CombinatAttributeBrush implements Command name: false, factory: false, comments: false, + isSplite: false, + actualExpr: false, + isSplitePrice: false, + isHole: false, + brand: false, + model: false, + spec: false, + count: false, + unit: false, + ProcessingGroupList: false, + material: false, + color: false, + DataList: false, }); if (appCache.has(BrushModal.name)) { @@ -91,22 +118,36 @@ export class CombinatAttributeBrush implements Command en.HardwareOption = { ...orgEn.HardwareOption }; en.DataList = [...orgEn.DataList.map(d => [d[0], d[1]])] as [string, string][]; } + if (option.ProcessingGroupList) + { + // 复制加工组 + [...orgEn.ProcessingGroupList].map(item => + { + let pg = new ProcessingGroupRecord; + pg.Name = (item?.Object as ProcessingGroupRecord).Name; + pg.Objects = [en.Id]; + if (en.ProcessingGroupList.some(pgId => pg.Name === (pgId?.Object as ProcessingGroupRecord)?.Name)) + return; + app.Database.ProcessingGroupTable.Add(pg); + en.ProcessingGroupList.push(pg.Id); + }); + } else { - if (option.roomName) - en.HardwareOption[EBoardKeyList.RoomName] = orgEn.HardwareOption[EBoardKeyList.RoomName]; - - if (option.name) - en.HardwareOption.name = orgEn.HardwareOption.name; - - if (option.cabName) - en.HardwareOption[EBoardKeyList.CabinetName] = orgEn.HardwareOption[EBoardKeyList.CabinetName]; + for (const k in option) + { + if (option[k]) + { + if (k === 'cabName') + en.HardwareOption[EBoardKeyList.CabinetName] = orgEn.HardwareOption[EBoardKeyList.CabinetName]; - if (option.factory) - en.HardwareOption.factory = orgEn.HardwareOption.factory; + else if (k === 'DataList') + en.DataList = [...orgEn.DataList.map(d => [d[0], d[1]])] as [string, string][]; - if (option.comments) - en.HardwareOption.comments = orgEn.HardwareOption.comments; + else + en.HardwareOption[k] = orgEn.HardwareOption[k]; + } + } } } @@ -121,10 +162,24 @@ const PARS: [string, keyof IBrushOption][] = [ ["拷贝房间名称", "roomName"], ["拷贝厂家", "factory"], ["拷贝备注", "comments"], + ["拷贝拆解", "isSplite"], + ["拷贝拆解价格", "isSplitePrice"], + ["拷贝挖孔", "isHole"], + ["拷贝品牌", "brand"], + ["拷贝型号", "model"], + ["拷贝规格", "spec"], + ["拷贝数量", "count"], + ["拷贝单位", "unit"], + ["拷贝价格", "actualExpr"], + ["拷贝材质", "material"], + ["拷贝颜色", "color"], + ["拷贝特殊备注", "DataList"], + ["追加加工组", "ProcessingGroupList"], ]; @observer -export class BrushModal extends React.Component<{ option: IBrushOption; }> { +export class BrushModal extends React.Component<{ option: IBrushOption; }> +{ public render() { const option = this.props.option; @@ -142,11 +197,23 @@ export class BrushModal extends React.Component<{ option: IBrushOption; }> { } > -
+
基本属性
+
+
+ { + PARS.map(([t, k]) => + k !== 'ProcessingGroupList' && + option[k] = !option[k]} key={t} /> + ) + } +
+
+
+
加工组
{ - PARS.map(([t, k]) => - option[k] = !option[k]} key={t} /> - ) +
+ option["ProcessingGroupList"] = !option["ProcessingGroupList"]} key={"追加加工组"} /> +
}