gaoluyang
21 小时以前 b51265aacb3e3adc00be85c159cfee8027f7d40b
银川
1.销售订单页面、物料管理页面联调
已修改8个文件
66 ■■■■■ 文件已修改
src/api/mes/wm/productsales/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/wls/productsales/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/data.ts 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/modules/form.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/materialstock/components/select-dialog.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/materialstock/data.ts 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/productsales/data.ts 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mes/wm/productsales/index.ts
@@ -14,6 +14,7 @@
    clientCode?: string; // 客户编码
    clientName?: string; // 客户名称
    salesOrderCode?: string; // 销售订单编号
    saleOrderId?: number; // 销售订单ID
    salesDate?: number; // 出库日期
    contactName?: string; // 收货人
    contactTelephone?: string; // 联系方式
src/api/wls/productsales/index.ts
@@ -14,6 +14,7 @@
    clientCode?: string; // 客户编码
    clientName?: string; // 客户名称
    salesOrderCode?: string; // 销售订单编号
    saleOrderId?: number; // 销售订单ID
    salesDate?: number; // 出库日期
    contactName?: string; // 收货人
    contactTelephone?: string; // 联系方式
src/views/basicData/mdm/data.ts
@@ -19,7 +19,7 @@
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) {
@@ -59,7 +59,7 @@
}
/** 新增/修改的表单 */
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi, categoryTreeData: any[] = []): VbenFormSchema[] {
  return [
    {
      component: "Input",
@@ -103,7 +103,7 @@
      rules: "required",
    },
    {
      component: "ApiTreeSelect",
      component: "TreeSelect",
      fieldName: "categoryId",
      label: "物料分类",
      rules: "selectRequired",
@@ -111,10 +111,8 @@
        placeholder: "请选择物料分类",
        allowClear: true,
        treeDefaultExpandAll: true,
        api: async () => {
          const res = await getItemTypeSimpleList();
          return buildCategoryTree(res || []);
        },
        treeData: categoryTreeData,
        fieldNames: { label: 'label', value: 'value', children: 'children' },
      },
    },
    {
src/views/basicData/mdm/modules/form.vue
@@ -11,7 +11,8 @@
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" });
@@ -56,8 +57,11 @@
    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();
src/views/erp/sale/order/index.vue
@@ -342,7 +342,7 @@
              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),
            },
            {
src/views/wls/materialstock/components/select-dialog.vue
@@ -161,7 +161,7 @@
            // 默认查未冻结
            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,
src/views/wls/materialstock/data.ts
@@ -8,7 +8,6 @@
import { DICT_TYPE } from '@vben/constants';
import { MdItemSelect } from '#/views/mes/md/item/components';
import { MdVendorSelect } from '#/views/mes/md/vendor/components';
import {
  WmWarehouseAreaSelect,
@@ -197,19 +196,21 @@
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: '请输入供应商名称',
      },
    },
    {
src/views/wls/productsales/data.ts
@@ -139,14 +139,6 @@
      },
    },
    {
      fieldName: 'salesOrderCode',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'saleOrderId',
      label: '销售订单编号',
      component: markRaw(ErpSaleOrderSelect),
@@ -163,6 +155,23 @@
        },
      },
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['salesOrderCode'],
        if: () => formType === 'create',
      },
    },
    {
      fieldName: 'salesOrderCode',
      label: '销售订单编号',
      component: 'Input',
      componentProps: {
        disabled: true,
        placeholder: '销售订单编号',
      },
      dependencies: {
        triggerFields: [''],
        if: () => formType !== 'create',
      },
    },
    {
      fieldName: 'salesDate',