| | |
| | | import { z } from '#/adapter/form'; |
| | | import { getSimpleBusinessList } from '#/api/crm/business'; |
| | | import { getSimpleContactList } from '#/api/crm/contact'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { useUserStore } from '#/packages/stores/src'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getAccountSimpleList } from '#/api/erp/finance/account'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getSupplierSimpleList } from '#/api/srm/supplier'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getWarehouseStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | |
| | |
| | | ]); |
| | | |
| | | const tableData = ref<ErpPurchaseInApi.PurchaseInItem[]>([]); // 表格数据 |
| | | const productOptions = ref<any[]>([]); // 产品下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | productOptions.value = await getProductSimpleList(); |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | }); |
| | | </script> |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | disabled |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | /> |
| | | <span>{{ row.productName || '-' }}</span> |
| | | </template> |
| | | <template #count="{ row }"> |
| | | <InputNumber |
| | |
| | | erpPriceMultiply, |
| | | } from '@vben/utils'; |
| | | |
| | | import { Input, InputNumber, Select, Switch } from 'ant-design-vue'; |
| | | import { Input, InputNumber, Switch } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { useFormItemColumns } from '../data'; |
| | | |
| | |
| | | ]); |
| | | |
| | | const tableData = ref<ErpPurchaseOrderApi.PurchaseOrderItem[]>([]); // 表格数据 |
| | | const productOptions = ref<MdmItemApi.Item[]>([]); // 产品下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | | const summaries = computed(() => { |
| | |
| | | } |
| | | |
| | | /** 处理产品变更 */ |
| | | async function handleProductChange(productId: any, row: any) { |
| | | const product = productOptions.value.find((p) => p.id === productId); |
| | | if (!product) { |
| | | function handleProductChange(item: MdmItemApi.Item | undefined, row: any) { |
| | | if (!item?.id) { |
| | | return; |
| | | } |
| | | row.productId = productId; |
| | | row.productUnitId = product.unitMeasureId; |
| | | row.productUnitName = product.unitMeasureName; |
| | | row.productName = product.name; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | row.productId = item.id; |
| | | row.productUnitId = item.unitMeasureId; |
| | | row.productUnitName = item.unitMeasureName; |
| | | row.productName = item.name; |
| | | row.productPrice = item.purchasePrice || 0; |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | }); |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | productOptions.value = res.list || []; |
| | | onMounted(() => { |
| | | // 目的:新增时,默认添加一行 |
| | | if (tableData.value.length === 0) { |
| | | handleAdd(); |
| | |
| | | <template> |
| | | <Grid class="w-full"> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | <MdmItemSelect |
| | | v-if="!disabled" |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | v-model:model-value="row.productId" |
| | | :label="row.productName" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | @change="handleProductChange($event, row)" |
| | | @change="(item) => handleProductChange(item, row)" |
| | | /> |
| | | <span v-else>{{ row.productName || '-' }}</span> |
| | | </template> |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getAccountSimpleList } from '#/api/erp/finance/account'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getSupplierSimpleList } from '#/api/srm/supplier'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getWarehouseStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | |
| | |
| | | ]); |
| | | |
| | | const tableData = ref<ErpPurchaseReturnApi.PurchaseReturnItem[]>([]); // 表格数据 |
| | | const productOptions = ref<any[]>([]); // 产品下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | productOptions.value = await getProductSimpleList(); |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | }); |
| | | </script> |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | disabled |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | /> |
| | | <span>{{ row.productName || '-' }}</span> |
| | | </template> |
| | | <template #count="{ row }"> |
| | | <InputNumber |
| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { ErpPurchaseStatisticsApi } from '#/api/erp/purchase/statistics'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { Page } from '@vben/common-ui'; |
| | | |
| | | import { Tag } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getPriceAnalysis } from '#/api/erp/purchase/statistics'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getAccountSimpleList } from '#/api/erp/finance/account'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps, withoutFixedColumns } from '#/utils'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | return res.list || []; |
| | | }, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getAccountSimpleList } from '#/api/erp/finance/account'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getCustomerSimpleList as getCrmCustomerSimpleList } from '#/api/crm/customer'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | return res.list || []; |
| | | }, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | return res.list || []; |
| | | }, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | <script lang="ts" setup> |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { ErpSaleOutApi } from '#/api/erp/sale/out'; |
| | | |
| | | import { computed, nextTick, onMounted, ref, watch } from 'vue'; |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getWarehouseStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | |
| | |
| | | ]); |
| | | |
| | | const tableData = ref<ErpSaleOutApi.SaleOutItem[]>([]); // 表格数据 |
| | | const productOptions = ref<MdmItemApi.Item[]>([]); // 物料下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | productOptions.value = res.list || []; |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | }); |
| | | </script> |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | disabled |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | /> |
| | | <span>{{ row.productName || '-' }}</span> |
| | | </template> |
| | | <template #count="{ row }"> |
| | | <InputNumber |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getAccountSimpleList } from '#/api/erp/finance/account'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getCustomerSimpleList as getCrmCustomerSimpleList } from '#/api/crm/customer'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | return res.list || []; |
| | | }, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | return res.list || []; |
| | | }, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getWarehouseStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { useFormItemColumns } from '../data'; |
| | | |
| | |
| | | ]); |
| | | |
| | | const tableData = ref<ErpSaleReturnApi.SaleReturnItem[]>([]); // 表格数据 |
| | | const productOptions = ref<MdmItemApi.Item[]>([]); // 物料下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | emit('update:items', [...tableData.value]); |
| | | } |
| | | |
| | | /** 处理产品变更:优先从关联订单物料中填充,兜底从全部物料中查找 */ |
| | | function handleProductChange(row: ErpSaleReturnApi.SaleReturnItem) { |
| | | /** 处理产品变更:优先从关联订单物料中填充,兜底使用弹框选中的物料 */ |
| | | function handleProductChange( |
| | | row: ErpSaleReturnApi.SaleReturnItem, |
| | | item?: MdmItemApi.Item, |
| | | ) { |
| | | // 优先从关联订单的物料中查找 |
| | | const orderItem = props.orderItems.find( |
| | | (item) => item.productId === row.productId, |
| | | (order) => order.productId === row.productId, |
| | | ); |
| | | if (orderItem) { |
| | | row.productName = orderItem.productName; |
| | |
| | | handleRowChange(row); |
| | | return; |
| | | } |
| | | // 兜底:从全部物料中查找 |
| | | const product = productOptions.value.find((item) => item.id === row.productId); |
| | | if (product) { |
| | | row.productName = product.name || ''; |
| | | row.productPrice = product.salesPrice ?? 0; |
| | | row.productUnitId = product.unitMeasureId; |
| | | row.productUnitName = product.unitMeasureName; |
| | | row.productBarCode = product.barCode; |
| | | if (item) { |
| | | row.productName = item.name || ''; |
| | | row.productPrice = item.salesPrice ?? 0; |
| | | row.productUnitId = item.unitMeasureId; |
| | | row.productUnitName = item.unitMeasureName; |
| | | row.productBarCode = item.barCode; |
| | | row.taxPercent = 0; |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | productOptions.value = res.list || []; |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | }); |
| | | </script> |
| | |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | v-if="orderItems?.length" |
| | | :disabled="disabled" |
| | | v-model:value="row.productId" |
| | | :options="orderItems?.length ? orderItems : productOptions" |
| | | :field-names="orderItems?.length ? { label: 'productName', value: 'productId' } : { label: 'name', value: 'id' }" |
| | | :options="orderItems" |
| | | :field-names="{ label: 'productName', value: 'productId' }" |
| | | class="w-full" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | @change="handleProductChange(row)" |
| | | /> |
| | | <MdmItemSelect |
| | | v-else |
| | | v-model:model-value="row.productId" |
| | | :label="row.productName" |
| | | :disabled="disabled" |
| | | placeholder="请选择产品" |
| | | @change="(item) => handleProductChange(row, item)" |
| | | /> |
| | | </template> |
| | | <template #count="{ row }"> |
| | | <InputNumber |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | <script lang="ts" setup> |
| | | import type { ErpProductApi } from '#/api/erp/product/product'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { ErpStockCheckApi } from '#/api/erp/stock/check'; |
| | | |
| | | import { computed, nextTick, onMounted, ref, watch } from 'vue'; |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { useFormItemColumns } from '../data'; |
| | | |
| | |
| | | const emit = defineEmits(['update:items']); |
| | | |
| | | const tableData = ref<ErpStockCheckApi.StockCheckItem[]>([]); // 表格数据 |
| | | const productOptions = ref<ErpProductApi.Product[]>([]); // 产品下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | } |
| | | |
| | | /** 处理产品变更 */ |
| | | async function handleProductChange(productId: any, row: any) { |
| | | const product = productOptions.value.find((p) => p.id === productId); |
| | | if (!product) { |
| | | async function handleProductChange(item: MdmItemApi.Item | undefined, row: any) { |
| | | if (!item?.id) { |
| | | return; |
| | | } |
| | | row.productId = productId; |
| | | row.productUnitId = product.unitId; |
| | | row.productBarCode = product.barCode; |
| | | row.productUnitName = product.unitName; |
| | | row.productName = product.name; |
| | | row.productId = item.id; |
| | | row.productUnitId = item.unitMeasureId; |
| | | row.productBarCode = item.barCode; |
| | | row.productUnitName = item.unitMeasureName; |
| | | row.productName = item.name; |
| | | row.stockCount = row.warehouseId |
| | | ? (await getStockCount(productId, row.warehouseId)) || 0 |
| | | : (await getStockCount(productId)) || 0; |
| | | ? (await getStockCount(item.id, row.warehouseId)) || 0 |
| | | : (await getStockCount(item.id)) || 0; |
| | | row.actualCount = row.stockCount || 0; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | row.productPrice = item.purchasePrice || 0; |
| | | row.count = row.actualCount - row.stockCount || 0; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | productOptions.value = await getProductSimpleList(); |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | // 目的:新增时,默认添加一行 |
| | | if (tableData.value.length === 0) { |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | <MdmItemSelect |
| | | v-model:model-value="row.productId" |
| | | :label="row.productName" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | :disabled="disabled" |
| | | @change="handleProductChange($event, row)" |
| | | @change="(item) => handleProductChange(item, row)" |
| | | /> |
| | | </template> |
| | | <template #actualCount="{ row }"> |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getSupplierSimpleList } from '#/api/srm/supplier'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | <script lang="ts" setup> |
| | | import type { ErpProductApi } from '#/api/erp/product/product'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { ErpStockInApi } from '#/api/erp/stock/in'; |
| | | |
| | | import { computed, nextTick, onMounted, ref, watch } from 'vue'; |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { useFormItemColumns } from '../data'; |
| | | |
| | |
| | | const emit = defineEmits(['update:items']); |
| | | |
| | | const tableData = ref<ErpStockInApi.StockInItem[]>([]); // 表格数据 |
| | | const productOptions = ref<ErpProductApi.Product[]>([]); // 产品下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | } |
| | | |
| | | /** 处理产品变更 */ |
| | | async function handleProductChange(productId: any, row: any) { |
| | | const product = productOptions.value.find((p) => p.id === productId); |
| | | if (!product) { |
| | | async function handleProductChange(item: MdmItemApi.Item | undefined, row: any) { |
| | | if (!item?.id) { |
| | | return; |
| | | } |
| | | row.productId = productId; |
| | | row.productUnitId = product.unitId; |
| | | row.productBarCode = product.barCode; |
| | | row.productUnitName = product.unitName; |
| | | row.productName = product.name; |
| | | row.productId = item.id; |
| | | row.productUnitId = item.unitMeasureId; |
| | | row.productBarCode = item.barCode; |
| | | row.productUnitName = item.unitMeasureName; |
| | | row.productName = item.name; |
| | | row.stockCount = row.warehouseId |
| | | ? (await getStockCount(productId, row.warehouseId)) || 0 |
| | | : (await getStockCount(productId)) || 0; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | ? (await getStockCount(item.id, row.warehouseId)) || 0 |
| | | : (await getStockCount(item.id)) || 0; |
| | | row.productPrice = item.purchasePrice || 0; |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | productOptions.value = await getProductSimpleList(); |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | // 目的:新增时,默认添加一行 |
| | | if (tableData.value.length === 0) { |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | <MdmItemSelect |
| | | v-model:model-value="row.productId" |
| | | :label="row.productName" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | :disabled="disabled" |
| | | @change="handleProductChange($event, row)" |
| | | @change="(item) => handleProductChange(item, row)" |
| | | /> |
| | | </template> |
| | | <template #count="{ row }"> |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | <script lang="ts" setup> |
| | | import type { ErpProductApi } from '#/api/erp/product/product'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { ErpStockMoveApi } from '#/api/erp/stock/move'; |
| | | |
| | | import { computed, nextTick, onMounted, ref, watch } from 'vue'; |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { useFormItemColumns } from '../data'; |
| | | |
| | |
| | | const emit = defineEmits(['update:items']); |
| | | |
| | | const tableData = ref<ErpStockMoveApi.StockMoveItem[]>([]); // 表格数据 |
| | | const productOptions = ref<ErpProductApi.Product[]>([]); // 产品下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | } |
| | | |
| | | /** 处理产品变更 */ |
| | | async function handleProductChange(productId: any, row: any) { |
| | | const product = productOptions.value.find((p) => p.id === productId); |
| | | if (!product) { |
| | | async function handleProductChange(item: MdmItemApi.Item | undefined, row: any) { |
| | | if (!item?.id) { |
| | | return; |
| | | } |
| | | row.productId = productId; |
| | | row.productUnitId = product.unitId; |
| | | row.productBarCode = product.barCode; |
| | | row.productUnitName = product.unitName; |
| | | row.productName = product.name; |
| | | row.productId = item.id; |
| | | row.productUnitId = item.unitMeasureId; |
| | | row.productBarCode = item.barCode; |
| | | row.productUnitName = item.unitMeasureName; |
| | | row.productName = item.name; |
| | | row.stockCount = row.fromWarehouseId |
| | | ? (await getStockCount(productId, row.fromWarehouseId)) || 0 |
| | | : (await getStockCount(productId)) || 0; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | ? (await getStockCount(item.id, row.fromWarehouseId)) || 0 |
| | | : (await getStockCount(item.id)) || 0; |
| | | row.productPrice = item.purchasePrice || 0; |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | productOptions.value = await getProductSimpleList(); |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | // 目的:新增时,默认添加一行 |
| | | if (tableData.value.length === 0) { |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | <MdmItemSelect |
| | | v-model:model-value="row.productId" |
| | | :label="row.productName" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | :disabled="disabled" |
| | | @change="handleProductChange($event, row)" |
| | | @change="(item) => handleProductChange(item, row)" |
| | | /> |
| | | </template> |
| | | <template #count="{ row }"> |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getCustomerSimpleList } from '#/api/erp/sale/customer'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'edit'; |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | fieldNames: { |
| | | label: 'name', |
| | | value: 'id', |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | <script lang="ts" setup> |
| | | import type { ErpProductApi } from '#/api/erp/product/product'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { ErpStockOutApi } from '#/api/erp/stock/out'; |
| | | |
| | | import { computed, nextTick, onMounted, ref, watch } from 'vue'; |
| | |
| | | import { Input, InputNumber, Select } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { getStockCount } from '#/api/erp/stock/stock'; |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { useFormItemColumns } from '../data'; |
| | | |
| | |
| | | const emit = defineEmits(['update:items']); |
| | | |
| | | const tableData = ref<ErpStockOutApi.StockOutItem[]>([]); // 表格数据 |
| | | const productOptions = ref<ErpProductApi.Product[]>([]); // 产品下拉选项 |
| | | const warehouseOptions = ref<any[]>([]); // 仓库下拉选项 |
| | | |
| | | /** 获取表格合计数据 */ |
| | |
| | | } |
| | | |
| | | /** 处理产品变更 */ |
| | | async function handleProductChange(productId: any, row: any) { |
| | | const product = productOptions.value.find((p) => p.id === productId); |
| | | if (!product) { |
| | | async function handleProductChange(item: MdmItemApi.Item | undefined, row: any) { |
| | | if (!item?.id) { |
| | | return; |
| | | } |
| | | row.productId = productId; |
| | | row.productUnitId = product.unitId; |
| | | row.productBarCode = product.barCode; |
| | | row.productUnitName = product.unitName; |
| | | row.productName = product.name; |
| | | row.productId = item.id; |
| | | row.productUnitId = item.unitMeasureId; |
| | | row.productBarCode = item.barCode; |
| | | row.productUnitName = item.unitMeasureName; |
| | | row.productName = item.name; |
| | | row.stockCount = row.warehouseId |
| | | ? (await getStockCount(productId, row.warehouseId)) || 0 |
| | | : (await getStockCount(productId)) || 0; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | ? (await getStockCount(item.id, row.warehouseId)) || 0 |
| | | : (await getStockCount(item.id)) || 0; |
| | | row.productPrice = item.purchasePrice || 0; |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | productOptions.value = await getProductSimpleList(); |
| | | warehouseOptions.value = await getWarehouseSimpleList(); |
| | | // 目的:新增时,默认添加一行 |
| | | if (tableData.value.length === 0) { |
| | |
| | | /> |
| | | </template> |
| | | <template #productId="{ row }"> |
| | | <Select |
| | | v-model:value="row.productId" |
| | | :options="productOptions" |
| | | :field-names="{ label: 'name', value: 'id' }" |
| | | class="w-full" |
| | | <MdmItemSelect |
| | | v-model:model-value="row.productId" |
| | | :label="row.productName" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | :disabled="disabled" |
| | | @change="handleProductChange($event, row)" |
| | | @change="(item) => handleProductChange(item, row)" |
| | | /> |
| | | </template> |
| | | <template #count="{ row }"> |
| | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 搜索表单 */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { getProductSimpleList } from '#/api/erp/product/product'; |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | /** 搜索表单 */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | |
| | | { |
| | | fieldName: 'productId', |
| | | label: '产品', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getProductSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getItemSimpleList } from '#/api/mdm/item'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components'; |
| | | import { QcIndicatorSelect } from '#/views/mes/qc/indicator/components'; |
| | | |
| | |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '产品物料', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择产品物料', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getItemSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | optionRender: (option: any) => { |
| | | const item = option.data; |
| | | return `${item.code} - ${item.name}`; |
| | | }, |
| | | }, |
| | | formItemClass: 'col-span-3', |
| | | rules: 'required', |
| | |
| | | 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"> |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { ErpPurchaseOrderSelect } from '#/views/erp/purchase/order/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '物料', |
| | | component: 'ApiSelect', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: '请选择物料', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getItemPage, |
| | | resultField: 'list', |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | optionRender: (option: any) => { |
| | | const item = option.data; |
| | | return `${item.code} - ${item.name}`; |
| | | }, |
| | | }, |
| | | rules: 'required', |
| | | }, |