Преглед на файлове

1、更新软床报价配置选择弹窗

MY преди 1 ден
родител
ревизия
f17e4433e6

+ 24 - 23
JLHWEB/src/views/quote/softbedQuote/components/BedConfigModal.vue

@@ -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;

+ 2 - 2
JLHWEB/src/views/quote/softbedQuote/components/ConfigSection.vue

@@ -53,7 +53,7 @@ interface ConfigItem {
   selectedValue?: string; // 选中的配置值字符串(方便双向绑定)
 }
 
-defineProps({
+const props = defineProps({
   partName: { type: String, required: true },
   configItems: {
     type: Array as PropType<ConfigItem[]>,
@@ -73,7 +73,7 @@ const emit = defineEmits(["removeConfigItem", "addConfigItem"]);
 
 // 监听配置项名变化时,如果该配置项有对应valueList,自动选中第一个值
 function onConfigItemChange(item: ConfigItem, index: number) {
-  const options = configValueOptionsMap[item.pzname];
+  const options = props.configValueOptionsMap[item.pzname];
   if (options && options.length > 0) {
     item.selectedValue = options[0].label;
   } else {

+ 2 - 2
JLHWEB/src/views/quote/softbedQuote/index.vue

@@ -20,7 +20,6 @@
       </template>
     </LjVxeTable>
   </div>
-  <BedConfigModal v-model:visible="isModalVisible" @confirm="onConfigConfirm" />
 </template>
 
 <script setup lang="ts" name="softbedQuote">
@@ -43,6 +42,7 @@ import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords } from "@/utils/index";
 import BedConfigModal from "./components/BedConfigModal.vue";
+import dialog from "@/utils/dialog";
 
 const { t } = useI18n();
 const router = useRouter();
@@ -312,7 +312,7 @@ const action: detailAction[] = [
   buttonDefault({
     label: "测试弹窗",
     clickFunc: item => {
-      isModalVisible.value = true;
+      dialog(BedConfigModal, {}).then((data: any) => {});
     }
   })
 ];