zhangwencui
2026-07-10 5783abee4e8c6ba1fc525545cf2a41ffe3e01926
物料产品选择勾选问题
已修改1个文件
50 ■■■■ 文件已修改
src/views/mes/md/item/components/select-dialog.vue 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/md/item/components/select-dialog.vue
@@ -1,21 +1,21 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemApi } from '#/api/mes/md/item';
import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
  import type { VxeTableGridOptions } from "#/adapter/vxe-table";
  import type { MesMdItemApi } from "#/api/mes/md/item";
  import type { MesMdItemTypeApi } from "#/api/mes/md/item/type";
import { nextTick, ref } from 'vue';
  import { nextTick, ref } from "vue";
import { CommonStatusEnum } from '../../../../../packages/constants/src';
  import { CommonStatusEnum } from "../../../../../packages/constants/src";
import { Card, message, Modal } from 'ant-design-vue';
  import { Card, message, Modal } from "ant-design-vue";
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getItemPage } from '#/api/mes/md/item';
import { MdItemTypeTree } from '#/views/mes/md/item/type/components';
  import { useVbenVxeGrid } from "#/adapter/vxe-table";
  import { getItemPage } from "#/api/mes/md/item";
  import { MdItemTypeTree } from "#/views/mes/md/item/type/components";
import { useItemSelectGridColumns, useItemSelectGridFormSchema } from '../data';
  import { useItemSelectGridColumns, useItemSelectGridFormSchema } from "../data";
defineOptions({ name: 'MdItemSelectDialog' });
  defineOptions({ name: "MdItemSelectDialog" });
const emit = defineEmits<{
  selected: [rows: MesMdItemApi.Item[]];
@@ -40,10 +40,10 @@
    ...(gridApi.grid.getCheckboxReserveRecords?.() ?? []),
    ...(gridApi.grid.getCheckboxRecords?.() ?? []),
  ] as MesMdItemApi.Item[];
  records.forEach((row) => {
    records.forEach(row => {
    const rowId = row.id;
    if (!rowId) {
      selectedMap.set(rowId as number, row);
      if (rowId) {
        selectedMap.set(rowId, row);
    }
  });
  return [...selectedMap.values()];
@@ -125,7 +125,7 @@
    },
    radioConfig: {
      highlight: true,
      trigger: 'row',
        trigger: "row",
    },
    proxyConfig: {
      ajax: {
@@ -141,7 +141,7 @@
      },
    },
    rowConfig: {
      keyField: 'id',
        keyField: "id",
      isHover: true,
    },
    toolbarConfig: {
@@ -173,7 +173,7 @@
/** 打开物料选择弹窗 */
async function openModal(
  selectedIds?: number[],
  options?: { multiple?: boolean },
    options?: { multiple?: boolean }
) {
  open.value = true;
  multiple.value = options?.multiple ?? true;
@@ -198,10 +198,10 @@
function handleConfirm() {
  const rows = multiple.value ? getMultipleSelectedRows() : selectedRows.value;
  if (rows.length === 0) {
    message.warning(multiple.value ? '请至少选择一条数据' : '请选择一条数据');
      message.warning(multiple.value ? "请至少选择一条数据" : "请选择一条数据");
    return;
  }
  emit('selected', multiple.value ? rows : [rows[0]!]);
    emit("selected", multiple.value ? rows : [rows[0]!]);
  open.value = false;
}
@@ -209,20 +209,16 @@
</script>
<template>
  <Modal
    v-model:open="open"
  <Modal v-model:open="open"
    title="物料产品选择"
    width="80%"
    :destroy-on-close="true"
    @ok="handleConfirm"
    @cancel="closeModal"
  >
         @cancel="closeModal">
    <div class="flex h-full w-full">
      <Card class="mr-4 h-full w-1/5">
        <MdItemTypeTree
          ref="typeTreeRef"
          @node-click="handleItemTypeNodeClick"
        />
        <MdItemTypeTree ref="typeTreeRef"
                        @node-click="handleItemTypeNodeClick" />
      </Card>
      <div class="w-4/5">
        <Grid table-title="物料产品列表" />