|
@@ -1,11 +1,5 @@
|
|
|
<template>
|
|
|
- <LjDialogNew
|
|
|
- v-model="visible"
|
|
|
- width="600px"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :modal-append-to-body="false"
|
|
|
- :destroy-on-close="true"
|
|
|
- >
|
|
|
+ <LjDialogNew v-bind="$attrs" width="600px" :closed="closed">
|
|
|
<template #header>
|
|
|
<div class="flx-1">
|
|
|
<span class="text-h5-b">配置项值选择</span>
|
|
@@ -80,8 +74,6 @@ interface ConfigItem {
|
|
|
selectedValue?: string;
|
|
|
}
|
|
|
|
|
|
-const visible = ref(true);
|
|
|
-
|
|
|
const showHeadboard = ref(true);
|
|
|
const showNightstand = ref(true);
|
|
|
const showBedframe = ref(false);
|
|
@@ -126,6 +118,15 @@ const headboardConfigs = reactive<ConfigItem[]>([
|
|
|
{ pzid: 101, printid: 2, pznamemx: "红色" }
|
|
|
],
|
|
|
selectedValue: "白色"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ pzid: 201,
|
|
|
+ pzname: "材质",
|
|
|
+ valueList: [
|
|
|
+ { pzid: 201, printid: 1, pznamemx: "皮质" },
|
|
|
+ { pzid: 201, printid: 2, pznamemx: "布艺" }
|
|
|
+ ],
|
|
|
+ selectedValue: "皮质"
|
|
|
}
|
|
|
]);
|
|
|
|
|
@@ -143,13 +144,13 @@ const nightstandConfigs = reactive<ConfigItem[]>([
|
|
|
|
|
|
const bedframeConfigs = reactive<ConfigItem[]>([]);
|
|
|
|
|
|
-function removeConfigItem(part: string, index: number) {
|
|
|
+const removeConfigItem = (part: string, index: number) => {
|
|
|
if (part === "headboard") headboardConfigs.splice(index, 1);
|
|
|
else if (part === "nightstand") nightstandConfigs.splice(index, 1);
|
|
|
else if (part === "bedframe") bedframeConfigs.splice(index, 1);
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
-function addConfigItem(part: string) {
|
|
|
+const addConfigItem = (part: string) => {
|
|
|
const newItem: ConfigItem = {
|
|
|
pzid: Date.now(),
|
|
|
pzname: "",
|
|
@@ -159,22 +160,22 @@ function addConfigItem(part: string) {
|
|
|
if (part === "headboard") headboardConfigs.push(newItem);
|
|
|
else if (part === "nightstand") nightstandConfigs.push(newItem);
|
|
|
else if (part === "bedframe") bedframeConfigs.push(newItem);
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
-function onCancel() {
|
|
|
- visible.value = false;
|
|
|
- // 如果有重置操作也放这里
|
|
|
-}
|
|
|
+const emits = defineEmits(["cancel", "submit", "closed", "update:modelValue"]);
|
|
|
+const onCancel = () => {
|
|
|
+ emits("cancel");
|
|
|
+};
|
|
|
|
|
|
-function onConfirm() {
|
|
|
- // 你可以在这里收集、校验选配数据
|
|
|
- // 比如 console.log 当前配置项等
|
|
|
- visible.value = false;
|
|
|
-}
|
|
|
+const onConfirm = () => {
|
|
|
+ emits("submit", {});
|
|
|
+};
|
|
|
+const closed = () => {
|
|
|
+ emits("closed");
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-/* 弹窗最大高度限制,防止无限撑大 */
|
|
|
.el-dialog {
|
|
|
max-height: 80vh;
|
|
|
display: flex;
|