| | |
| | | import type { MesMdItemApi } from "#/api/mes/md/item"; |
| | | import type { MesMdItemTypeApi } from "#/api/mes/md/item/type"; |
| | | |
| | | import { nextTick, ref } from "vue"; |
| | | import { computed, nextTick, ref } from "vue"; |
| | | |
| | | import { CommonStatusEnum } from "@vben/constants"; |
| | | |
| | | import { Card, message, Modal } from "ant-design-vue"; |
| | | import { Alert, Card, message, Modal, Tag } from "ant-design-vue"; |
| | | |
| | | import { useVbenVxeGrid } from "#/adapter/vxe-table"; |
| | | import { getItemPage } from "#/api/mes/md/item"; |
| | |
| | | const preSelectedIds = ref<number[]>([]); // 预选物料编号列表 |
| | | const productIds = ref<number[]>([]); // 限定可选的物料编号列表(为空则不限制) |
| | | const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>(); // 物料分类树 |
| | | const limitedToProducts = computed(() => productIds.value.length > 0); |
| | | const dialogTitle = computed(() => |
| | | limitedToProducts.value ? "路线产出选择" : "物料产品选择", |
| | | ); |
| | | const tableTitle = computed(() => |
| | | limitedToProducts.value ? "已配置的产出产品" : "物料产品列表", |
| | | ); |
| | | |
| | | /** 获取当前表格数据 */ |
| | | function getTableRows() { |
| | |
| | | }; |
| | | // 限定可选物料范围 |
| | | if (productIds.value.length > 0) { |
| | | params.pageSize = 1000; |
| | | params.ids = productIds.value.join(','); |
| | | } |
| | | const result = await getItemPage(params as never); |
| | |
| | | |
| | | <template> |
| | | <Modal v-model:open="open" |
| | | title="物料产品选择" |
| | | :title="dialogTitle" |
| | | width="80%" |
| | | :destroy-on-close="true" |
| | | @ok="handleConfirm" |
| | | @cancel="closeModal"> |
| | | <div class="flex h-[60vh] w-full"> |
| | | <Card |
| | | v-if="!limitedToProducts" |
| | | class="mr-4 h-full w-1/5" |
| | | :body-style="{ height: '100%', overflow: 'hidden' }" |
| | | > |
| | | <MdItemTypeTree ref="typeTreeRef" |
| | | @node-click="handleItemTypeNodeClick" /> |
| | | </Card> |
| | | <div class="w-4/5"> |
| | | <Grid table-title="物料产品列表" /> |
| | | <div :class="limitedToProducts ? 'w-full' : 'w-4/5'"> |
| | | <Alert |
| | | v-if="limitedToProducts" |
| | | class="mb-3" |
| | | message="仅可选择本路线已配置的产出产品" |
| | | description="如需增加可选项,请返回“产出产品及入库仓”步骤先添加产出。" |
| | | show-icon |
| | | type="info" |
| | | > |
| | | <template #action> |
| | | <Tag color="blue">{{ productIds.length }} 个产出</Tag> |
| | | </template> |
| | | </Alert> |
| | | <Grid :table-title="tableTitle" /> |
| | | </div> |
| | | </div> |
| | | </Modal> |