| | |
| | | |
| | | import { nextTick, ref } from "vue"; |
| | | |
| | | import { CommonStatusEnum } from "../../../../../packages/constants/src"; |
| | | import { CommonStatusEnum } from "@vben/constants"; |
| | | |
| | | import { Card, message, Modal } from "ant-design-vue"; |
| | | |
| | |
| | | const selectedRows = ref<MesMdItemApi.Item[]>([]); // 已选物料列表 |
| | | const selectedItemTypeId = ref<number>(); // 当前筛选分类编号 |
| | | const preSelectedIds = ref<number[]>([]); // 预选物料编号列表 |
| | | const productIds = ref<number[]>([]); // 限定可选的物料编号列表(为空则不限制) |
| | | const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>(); // 物料分类树 |
| | | |
| | | /** 获取当前表格数据 */ |
| | |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getItemPage({ |
| | | const params: Record<string, unknown> = { |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | itemTypeId: selectedItemTypeId.value, |
| | | status: CommonStatusEnum.ENABLE, |
| | | }); |
| | | }; |
| | | // 限定可选物料范围 |
| | | if (productIds.value.length > 0) { |
| | | params.pageSize = 1000; |
| | | params.ids = productIds.value.join(','); |
| | | } |
| | | const result = await getItemPage(params as never); |
| | | return result; |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | /** 打开物料选择弹窗 */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean } |
| | | options?: { multiple?: boolean; productIds?: number[] } |
| | | ) { |
| | | open.value = true; |
| | | multiple.value = options?.multiple ?? true; |
| | | preSelectedIds.value = selectedIds || []; |
| | | productIds.value = options?.productIds || []; |
| | | await nextTick(); |
| | | gridApi.setGridOptions({ |
| | | columns: useItemSelectGridColumns(multiple.value), |