Files
appco_dist/.output/server/chunks/build/index-CQrIpUTe.mjs
T
2025-08-27 20:20:03 +03:30

90 lines
2.9 KiB
JavaScript

import { a as useConfigStore, aE as useRoute, u as useRouter$1, _ as __nuxt_component_0 } from './server.mjs';
import { defineComponent, ref, watch, shallowRef, useSSRContext } from 'vue';
import { ssrRenderComponent } from 'vue/server-renderer';
import { s as selectedFeatures, b as setItems, i as items, v as variants, u as updateMyAttrs, c as formFields } from './handle-DppcF3zW.mjs';
import { differenceBy, cloneDeep } from 'lodash-es';
import { u as useProductStore } from './product-BPTplX4_.mjs';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
emits: ["update:visible", "update:isEdit", "success"],
setup(__props, { emit: __emit }) {
useConfigStore();
ref("1");
ref(null);
ref(false);
ref(false);
useRoute();
useRouter$1();
const loading = ref(false);
const dragKey = ref(0);
let selectedFeaturesLength = 0;
watch(selectedFeatures, async (new_features, oldFeatures) => {
console.log(new_features, 4444444444);
if (new_features?.length > selectedFeaturesLength) {
try {
loading.value = true;
console.log(new_features, 5555555);
await setItems(new_features);
selectedFeaturesLength = selectedFeatures.value.length;
dragKey.value++;
} catch (e) {
console.log(e);
} finally {
loading.value = false;
}
} else {
const deletedObject = differenceBy(oldFeatures, new_features);
selectedFeaturesLength = selectedFeatures.value.length;
const index = items.value.findIndex((x) => deletedObject[0] === x.id);
if (index !== -1) {
variants.value.forEach((val) => {
val.attribute_values[index] = null;
});
items.value.splice(index, 1);
dragKey.value++;
}
}
}, { deep: true });
watch(
items,
(newValue) => {
updateMyAttrs(items.value);
},
{ deep: true }
);
watch(() => formFields.variants, () => {
variants.value = formFields.variants;
console.log(variants.value, formFields.variants);
}, { deep: true });
useProductStore();
ref();
ref(["0"]);
cloneDeep(formFields);
ref(null);
ref([]);
ref(false);
ref([{ field: "athlete", rowDrag: true }, { field: "country" }]);
shallowRef();
ref([]);
ref({
width: 170,
filter: true
});
ref(null);
return (_ctx, _push, _parent, _attrs) => {
const _component_ClientOnly = __nuxt_component_0;
_push(ssrRenderComponent(_component_ClientOnly, _attrs, {}, _parent));
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/add/product/information/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as _ };