| | |
| | | clientCode?: string; // 客户编码 |
| | | clientName?: string; // 客户名称 |
| | | salesOrderCode?: string; // 销售订单编号 |
| | | saleOrderId?: number; // 销售订单ID |
| | | salesDate?: number; // 出库日期 |
| | | contactName?: string; // 收货人 |
| | | contactTelephone?: string; // 联系方式 |
| | |
| | | clientCode?: string; // 客户编码 |
| | | clientName?: string; // 客户名称 |
| | | salesOrderCode?: string; // 销售订单编号 |
| | | saleOrderId?: number; // 销售订单ID |
| | | salesDate?: number; // 出库日期 |
| | | contactName?: string; // 收货人 |
| | | contactTelephone?: string; // 联系方式 |
| | |
| | | let unitListPromise: Promise<any[]> | null = null; |
| | | |
| | | /** 将扁平分类列表转为 TreeSelect 所需的树形结构 */ |
| | | function buildCategoryTree(list: any[]): any[] { |
| | | export function buildCategoryTree(list: any[]): any[] { |
| | | const map = new Map<number, any>(); |
| | | const roots: any[] = []; |
| | | for (const item of list) { |
| | |
| | | } |
| | | |
| | | /** 新增/修改的表单 */ |
| | | export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | export function useFormSchema(formApi?: VbenFormApi, categoryTreeData: any[] = []): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | component: "Input", |
| | |
| | | rules: "required", |
| | | }, |
| | | { |
| | | component: "ApiTreeSelect", |
| | | component: "TreeSelect", |
| | | fieldName: "categoryId", |
| | | label: "物料分类", |
| | | rules: "selectRequired", |
| | |
| | | placeholder: "请选择物料分类", |
| | | allowClear: true, |
| | | treeDefaultExpandAll: true, |
| | | api: async () => { |
| | | const res = await getItemTypeSimpleList(); |
| | | return buildCategoryTree(res || []); |
| | | }, |
| | | treeData: categoryTreeData, |
| | | fieldNames: { label: 'label', value: 'value', children: 'children' }, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import { createItem, getItem, updateItem } from '#/api/mdm/item'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema, clearUnitListCache } from '../data'; |
| | | import { useFormSchema, clearUnitListCache, buildCategoryTree } from '../data'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | |
| | | defineOptions({ name: "ItemForm" }); |
| | | |
| | |
| | | const data = modalApi.getData<MdmItemApi.Item>(); |
| | | // 清除单位缓存,确保获取最新数据 |
| | | clearUnitListCache(); |
| | | // 加载最新分类数据 |
| | | const categoryRes = await getItemTypeSimpleList(); |
| | | const categoryTreeData = buildCategoryTree(categoryRes || []); |
| | | // 设置 schema(formApi 已初始化) |
| | | formApi.setState({ schema: useFormSchema(formApi) }); |
| | | formApi.setState({ schema: useFormSchema(formApi, categoryTreeData) }); |
| | | if (data?.id) { |
| | | // 编辑模式 |
| | | modalApi.lock(); |
| | |
| | | type: 'link', |
| | | icon: 'ant-design:file-protect-outlined', |
| | | auth: ['mes:wm-sales-notice:create'], |
| | | ifShow: () => row.status === 20 && (row.canCreateSalesNotice || row.productionStatus === 1), |
| | | ifShow: () => row.status === 20 && row.canCreateSalesNotice, |
| | | onClick: handleGenerateNotice.bind(null, row), |
| | | }, |
| | | { |
| | |
| | | // 默认查未冻结 |
| | | frozen: false, |
| | | itemTypeId: searchItemTypeId.value, |
| | | itemId: formValues.mdmItemId ?? props.mdmItemId, |
| | | itemId: props.mdmItemId, |
| | | warehouseId: formValues.warehouseId ?? props.warehouseId, |
| | | virtualFilter: |
| | | props.virtualFilter === 'all' ? undefined : props.virtualFilter, |
| | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | |
| | | export function useSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | fieldName: 'itemName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择物料', |
| | | allowClear: true, |
| | | placeholder: '请输入物料名称', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | allowClear: true, |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'saleOrderId', |
| | | label: '销售订单编号', |
| | | component: markRaw(ErpSaleOrderSelect), |
| | |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['salesOrderCode'], |
| | | if: () => formType === 'create', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: '销售订单编号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '销售订单编号', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | if: () => formType !== 'create', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesDate', |