|
|
|
@ -5,6 +5,7 @@ import { commandMachine } from "../../../Editor/CommandMachine";
|
|
|
|
|
import { shareViewApp } from "../Service";
|
|
|
|
|
import { BoxStore } from "../Store";
|
|
|
|
|
import { resetBoxView } from "../Util";
|
|
|
|
|
import { CheckEmptySvg, CheckedSvg } from "./CommonSvgs";
|
|
|
|
|
import { SPToaster } from "./SPToater";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -23,6 +24,29 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
const [list, setList] = useState<any>({});
|
|
|
|
|
const [key, setKey] = useState<number>(0);
|
|
|
|
|
const boxStore: BoxStore = BoxStore.GetInstance();
|
|
|
|
|
const [selectAll, setSelectAll] = useState(false);
|
|
|
|
|
|
|
|
|
|
// 判断是否全选状态
|
|
|
|
|
function isSelectAll(roomName: string)
|
|
|
|
|
{
|
|
|
|
|
let obj = shareViewApp.BoxCtrl.CabinetFormatData || {};
|
|
|
|
|
if (obj[roomName].length != boxStore.Index.length)
|
|
|
|
|
{
|
|
|
|
|
setSelectAll(false);
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
let flag = true;
|
|
|
|
|
for (const el of obj[roomName])
|
|
|
|
|
{
|
|
|
|
|
if (!boxStore.Index.includes(el.index))
|
|
|
|
|
{
|
|
|
|
|
flag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setSelectAll(flag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useImperativeHandle(ref, () => (
|
|
|
|
|
{
|
|
|
|
@ -42,6 +66,7 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
{
|
|
|
|
|
SPToaster.show({ message: "没有柜体" });
|
|
|
|
|
}
|
|
|
|
|
isSelectAll(boxStore.RoomName);
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
@ -80,6 +105,23 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function showCabinet()
|
|
|
|
|
{
|
|
|
|
|
await props.reset();
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.Esc);
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.SelectAll);
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.HideSelect);
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.Swiso);
|
|
|
|
|
boxStore.Index.forEach((el) =>
|
|
|
|
|
{
|
|
|
|
|
shareViewApp.BoxCtrl.SetBoxVisible(el, true);
|
|
|
|
|
});
|
|
|
|
|
shareViewApp.Editor.UpdateScreen();
|
|
|
|
|
resetBoxView();
|
|
|
|
|
setKey(key + 1);
|
|
|
|
|
boxStore.SelectedBoard = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className={`sp-cabinet-bottom-sheet-msak ${visible ? 'open' : ""}`}
|
|
|
|
@ -88,7 +130,46 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
</div>
|
|
|
|
|
<div className={`sp-cabinet-bottom-sheet ${visible ? 'open' : ''}`}>
|
|
|
|
|
<div className="sp-bottom-sheet-title">
|
|
|
|
|
<div>选择柜体</div>
|
|
|
|
|
<div style={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
|
|
|
|
|
<span>选择柜体</span>
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
fontWeight: "normal",
|
|
|
|
|
marginLeft: 12,
|
|
|
|
|
color: "#1890ff",
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
cursor: "pointer",
|
|
|
|
|
}}
|
|
|
|
|
onClick={async () =>
|
|
|
|
|
{
|
|
|
|
|
if (list[selectedTab])
|
|
|
|
|
{
|
|
|
|
|
const indexes = [];
|
|
|
|
|
if (selectAll)
|
|
|
|
|
{
|
|
|
|
|
indexes.push(list[selectedTab][0].index);
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
list[selectedTab].forEach(item =>
|
|
|
|
|
{
|
|
|
|
|
indexes.push(item.index);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
boxStore.Index = indexes;
|
|
|
|
|
boxStore.RoomName = selectedTab;
|
|
|
|
|
await showCabinet();
|
|
|
|
|
setSelectAll(!selectAll);
|
|
|
|
|
}
|
|
|
|
|
}}>
|
|
|
|
|
{
|
|
|
|
|
selectAll ? <CheckedSvg></CheckedSvg> : <CheckEmptySvg></CheckEmptySvg>
|
|
|
|
|
}
|
|
|
|
|
全选房间柜子
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<Icon className="sp-bottom-sheet-close" onClick={closeSheet} icon="cross"></Icon>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="sp-tab-bar" >
|
|
|
|
@ -102,6 +183,7 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
{
|
|
|
|
|
scrollCenter(i, 'tabbar');
|
|
|
|
|
setSelectedTab(key);
|
|
|
|
|
isSelectAll(key);
|
|
|
|
|
}}
|
|
|
|
|
>{key}</div>
|
|
|
|
|
);
|
|
|
|
@ -120,11 +202,6 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
${boxStore.RoomName == selectedTab && boxStore.Index.includes(item.index) ? 'active' : ''}`}
|
|
|
|
|
onClick={async () =>
|
|
|
|
|
{
|
|
|
|
|
await props.reset();
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.Esc);
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.SelectAll);
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.HideSelect);
|
|
|
|
|
await commandMachine.ExecCommand(CommandNames.Swiso);
|
|
|
|
|
if (boxStore.RoomName == item.roomName)
|
|
|
|
|
{
|
|
|
|
|
if (boxStore.Index.includes(item.index))
|
|
|
|
@ -142,14 +219,8 @@ const CabinetBottomSheet: React.FC<IProps> = forwardRef((props, ref) =>
|
|
|
|
|
boxStore.RoomName = item.roomName;
|
|
|
|
|
boxStore.Index = [item.index];
|
|
|
|
|
}
|
|
|
|
|
boxStore.Index.forEach((el) =>
|
|
|
|
|
{
|
|
|
|
|
shareViewApp.BoxCtrl.SetBoxVisible(el, true);
|
|
|
|
|
});
|
|
|
|
|
shareViewApp.Editor.UpdateScreen();
|
|
|
|
|
resetBoxView();
|
|
|
|
|
setKey(key + 1);
|
|
|
|
|
boxStore.SelectedBoard = null;
|
|
|
|
|
await showCabinet();
|
|
|
|
|
setSelectAll(boxStore.Index.length == list[item.roomName].length);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div className="sp-tab-view-item-logo">
|
|
|
|
|