| | |
| | | createAward, deleteAward, getAward, getAwardByProject, approveAward, generatePurchaseOrder, |
| | | confirmTenderProject, |
| | | } from '#/api/srm/tender'; |
| | | import { getSupplierList } from '#/api/srm/supplier'; |
| | | import { getItemSimpleList } from '#/api/mdm/item'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | |
| | | import { getSupplierList } from '#/api/srm/supplier'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { |
| | | TENDER_STATUS, |
| | | TENDER_STATUS_CELLTAG, |
| | |
| | | const activeTab = ref('info'); |
| | | |
| | | // ========== 下拉选项数据 ========== |
| | | const mdmItemList = ref<MdmItemApi.Item[]>([]); |
| | | const supplierList = ref<{ id: number; name: string }[]>([]); |
| | | |
| | | onMounted(async () => { |
| | | const [items, suppliers] = await Promise.all([ |
| | | getItemSimpleList(), |
| | | getSupplierList(), |
| | | ]); |
| | | mdmItemList.value = items; |
| | | supplierList.value = suppliers; |
| | | supplierList.value = await getSupplierList(); |
| | | }); |
| | | |
| | | const filterOption = (input: string, option: any) => |
| | |
| | | return ids; |
| | | }); |
| | | |
| | | // 物料下拉可选列表(排除已添加的) |
| | | const availableMdmItems = computed(() => |
| | | mdmItemList.value.filter((item) => !addedProductIds.value.has(item.id!)), |
| | | ); |
| | | |
| | | async function loadProject() { |
| | | project.value = await getTenderProject(projectId); |
| | | } |
| | |
| | | try { materialList.value = await getMaterialList(projectId); } finally { materialLoading.value = false; } |
| | | } |
| | | async function handleSaveMaterial() { |
| | | // 同一招标项目下不允许重复添加同一物料 |
| | | if (materialForm.value.productId && addedProductIds.value.has(materialForm.value.productId)) { |
| | | message.warning('该物料已添加,请勿重复添加'); |
| | | return; |
| | | } |
| | | if (materialForm.value.id) { |
| | | await updateMaterial(materialForm.value); |
| | | } else { |
| | |
| | | materialFormVisible.value = false; |
| | | loadMaterials(); |
| | | } |
| | | function onMaterialSelect(itemId: number) { |
| | | const item = mdmItemList.value.find((i) => i.id === itemId); |
| | | function onMaterialSelect(item?: MdmItemApi.Item) { |
| | | if (item) { |
| | | materialForm.value.productCode = item.code; |
| | | materialForm.value.productName = item.name; |
| | |
| | | <a-modal v-model:open="materialFormVisible" :title="materialForm.id ? '编辑物料' : '添加物料'" :width="560" @ok="handleSaveMaterial"> |
| | | <a-form layout="vertical" class="mt-4"> |
| | | <a-form-item label="MDM物料" required> |
| | | <a-select v-model:value="materialForm.productId" show-search placeholder="搜索并选择MDM物料" :filter-option="filterOption" option-label-prop="label" @change="onMaterialSelect"> |
| | | <a-select-option v-for="item in availableMdmItems" :key="item.id" :value="item.id" :label="`${item.code} ${item.name}`"> |
| | | <div class="flex flex-col"> |
| | | <span class="font-medium">{{ item.code }}</span> |
| | | <span class="text-xs text-gray-400">{{ item.name }}{{ item.specification ? ` · ${item.specification}` : '' }}</span> |
| | | </div> |
| | | </a-select-option> |
| | | </a-select> |
| | | <MdmItemSelect |
| | | v-model:model-value="materialForm.productId" |
| | | :label="materialForm.productName" |
| | | placeholder="请选择MDM物料" |
| | | @change="onMaterialSelect" |
| | | /> |
| | | </a-form-item> |
| | | <a-row :gutter="12"> |
| | | <a-col :span="12"> |