|
@@ -15,30 +15,14 @@ export default defineComponent({
|
|
|
const queditor = useQueditor();
|
|
|
|
|
|
const replaceMat = async (record: any) => {
|
|
|
- console.log("replace=>", record);
|
|
|
-
|
|
|
+ // console.error("replace=>", record);
|
|
|
const branchFolder = await resource.showModal<AssetItemFile>(
|
|
|
<LibraryModal nodeTypes={["matGroupItem", "mat", "packMat"]} />,
|
|
|
- {
|
|
|
- width: "900px",
|
|
|
- }
|
|
|
+ { width: "900px" }
|
|
|
);
|
|
|
- console.log("branchFolder: ", branchFolder);
|
|
|
-
|
|
|
+ // console.error("branchFolder: ", branchFolder);
|
|
|
const data = await branchFolder.getAssetDetail();
|
|
|
- console.log("data: ", data);
|
|
|
-
|
|
|
- if (data && data.source) {
|
|
|
- const matConf = resource.store.matSlots.find(
|
|
|
- (item) => item.id == record.id
|
|
|
- );
|
|
|
- if (matConf) {
|
|
|
- matConf.material = data.source;
|
|
|
- } else {
|
|
|
- const matSlot = { id: record.id, material: data.source };
|
|
|
- resource.store.matSlots.push(matSlot);
|
|
|
- }
|
|
|
- }
|
|
|
+ // console.error("data: ", data);
|
|
|
|
|
|
let mat;
|
|
|
switch (branchFolder.nodeType) {
|
|
@@ -57,11 +41,21 @@ export default defineComponent({
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- const targetComp = getTargetProCom();
|
|
|
- console.error("targetComp: ", targetComp);
|
|
|
+ if (data && mat) {
|
|
|
+ const matConf = resource.store.matSlots.find(
|
|
|
+ (item) => item.id == record.id
|
|
|
+ );
|
|
|
+ if (matConf) {
|
|
|
+ matConf.material = mat;
|
|
|
+ } else {
|
|
|
+ const matSlot = { id: record.id, material: mat };
|
|
|
+ resource.store.matSlots.push(matSlot);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.error("resource.store.matSlots: ", resource.store.matSlots);
|
|
|
|
|
|
+ const targetComp = getTargetProCom();
|
|
|
if (!targetComp || !mat) return;
|
|
|
-
|
|
|
queditor.actions.updatePackProductCompMat(targetComp, mat);
|
|
|
};
|
|
|
|