| | |
| | | <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[]]; |
| | |
| | | ...(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()]; |
| | |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: 'row', |
| | | trigger: "row", |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | keyField: "id", |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | |
| | | /** 打开物料选择弹窗 */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean }, |
| | | options?: { multiple?: boolean } |
| | | ) { |
| | | open.value = true; |
| | | multiple.value = options?.multiple ?? true; |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | </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="物料产品列表" /> |