银川
1.销售订单页面展示字段修改
2.客户选择弹框复用调整
3.未使用菜单整理
4.发货通知、销售退货展示字段和操作权限判断修改
5.物料选择弹框展示字段修改
已修改7个文件
171 ■■■■ 文件已修改
src/views/basicData/mdm/components/data.ts 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/components/select-dialog.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/data.ts 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/modules/item-form.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/pro/task/data.ts 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/pro/workorder/data.ts 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wls/transfer/data.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/mdm/components/data.ts
@@ -2,8 +2,10 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MdmItemApi } from '#/api/mdm/item';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getItemTypeSimpleList } from '#/api/mes/md/item/type';
/** 物料选择弹窗搜索表单 */
export function useMdmItemSelectGridFormSchema(): VbenFormSchema[] {
@@ -27,30 +29,32 @@
      },
    },
    {
      fieldName: 'itemType',
      label: '物料类型',
      fieldName: 'categoryId',
      label: '物料分类',
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请选择物料分类',
        allowClear: true,
        api: async () => {
          const res = await getItemTypeSimpleList();
          return res || [];
        },
        labelField: 'name',
        valueField: 'id',
      },
    },
    {
      fieldName: 'status',
      label: '状态',
      component: 'Select',
      componentProps: {
        placeholder: '请选择状态',
        allowClear: true,
        placeholder: '请选择物料类型',
        options: [
          { label: '原料', value: 1 },
          { label: '半成品', value: 2 },
          { label: '成品', value: 3 },
          { label: '辅料', value: 4 },
        ],
        options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
      },
    },
  ];
}
/** 物料类型颜色映射 */
const itemTypeMap: Record<number, { label: string; color: string }> = {
  1: { label: '原料', color: 'green' },
  2: { label: '半成品', color: 'orange' },
  3: { label: '成品', color: 'blue' },
  4: { label: '辅料', color: 'purple' },
};
/** 物料选择弹窗列表字段 */
export function useMdmItemSelectGridColumns(
@@ -61,51 +65,45 @@
    {
      field: 'code',
      title: '物料编码',
      width: 180,
      minWidth: 120,
    },
    {
      field: 'name',
      title: '物料名称',
      minWidth: 160,
      minWidth: 180,
      align: 'left',
    },
    {
      field: 'specification',
      title: '规格型号',
      minWidth: 140,
      minWidth: 150,
      align: 'left',
    },
    {
      field: 'categoryId',
      title: '物料分类',
      minWidth: 120,
      align: 'center',
      slots: { default: 'categoryId' },
    },
    {
      field: 'unitMeasureName',
      title: '单位',
      width: 90,
      minWidth: 80,
      align: 'center',
    },
    {
      field: 'itemType',
      title: '物料类型',
      width: 110,
      align: 'center',
      formatter: ({ cellValue }: { cellValue: number }) => {
        const type = itemTypeMap[cellValue];
        return type ? type.label : '-';
      },
    },
    {
      field: 'isBatchManaged',
      title: '批次管理',
      width: 110,
      minWidth: 80,
      align: 'center',
      cellRender: {
        name: 'CellDict',
        props: { type: 'infra_boolean_string' },
      },
      slots: { default: 'isBatchManaged' },
    },
    {
      field: 'createTime',
      title: '创建时间',
      width: 180,
      formatter: 'formatDateTime',
      field: 'warehouseName',
      title: '默认仓库',
      minWidth: 100,
      align: 'center',
    },
  ];
}
src/views/basicData/mdm/components/select-dialog.vue
@@ -1,13 +1,15 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MdmItemApi } from '#/api/mdm/item';
import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
import { nextTick, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { message, Modal, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getItemPage } from '#/api/mdm/item';
import { getItemTypeSimpleList } from '#/api/mes/md/item/type';
import {
  useMdmItemSelectGridColumns,
@@ -24,6 +26,21 @@
const multiple = ref(true); // 是否多选
const selectedRows = ref<MdmItemApi.Item[]>([]); // 已选物料列表
const preSelectedIds = ref<number[]>([]); // 预选物料编号列表
const categoryList = ref<MesMdItemTypeApi.ItemType[]>([]); // 分类列表缓存
const TAG_COLORS = ['green', 'orange', 'blue', 'purple', 'cyan', 'magenta', 'geekblue', 'volcano', 'gold', 'lime'] as const;
function getCategoryName(categoryId?: number) {
  if (!categoryId || !categoryList.value.length) return '';
  const category = categoryList.value.find((item) => item.id === categoryId);
  return category?.name || '';
}
function getCategoryColor(categoryId?: number): string {
  if (!categoryId) return '';
  const index = categoryList.value.findIndex((item) => item.id === categoryId);
  return index >= 0 ? TAG_COLORS[index % TAG_COLORS.length]! : '';
}
/** 获取当前表格数据 */
function getTableRows() {
@@ -121,6 +138,13 @@
    proxyConfig: {
      ajax: {
        query: async ({ page }, formValues) => {
          if (!categoryList.value.length) {
            try {
              categoryList.value = await getItemTypeSimpleList();
            } catch {
              categoryList.value = [];
            }
          }
          return await getItemPage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
@@ -204,6 +228,15 @@
    @ok="handleConfirm"
    @cancel="closeModal"
  >
    <Grid table-title="物料列表" />
    <Grid table-title="物料列表">
      <template #categoryId="{ row }">
        <Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag>
        <span v-else>{{ getCategoryName(row.categoryId) || '-' }}</span>
      </template>
      <template #isBatchManaged="{ row }">
        <Tag v-if="row.isBatchManaged" color="success">是</Tag>
        <Tag v-else>否</Tag>
      </template>
    </Grid>
  </Modal>
</template>
src/views/erp/sale/order/data.ts
@@ -199,11 +199,6 @@
      formatter: 'formatAmount3',
    },
    {
      field: 'productBarCode',
      title: '条码',
      minWidth: 120,
    },
    {
      field: 'productUnitName',
      title: '单位',
      minWidth: 80,
@@ -274,7 +269,7 @@
    },
    {
      title: '操作',
      width: 320,
      width: 80,
      fixed: 'right',
      slots: { default: 'actions' },
      visible: !disabled,
src/views/erp/sale/order/modules/item-form.vue
@@ -1,5 +1,4 @@
<script lang="ts" setup>
import type { MdmItemApi } from '#/api/mdm/item';
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
import { computed, nextTick, onMounted, ref, watch } from 'vue';
@@ -13,8 +12,7 @@
import { Input, InputNumber, Select, Tag } from 'ant-design-vue';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getItemPage } from '#/api/mdm/item';
import { getStockCount } from '#/api/erp/stock/stock';
import { MdmItemSelect } from '#/views/basicData/mdm/components';
import { useFormItemColumns } from '../data';
@@ -36,8 +34,7 @@
  'update:totalPrice',
]);
const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]); // 表格数据
const productOptions = ref<MdmItemApi.Item[]>([]); // 物料下拉选项
const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]);
/** 获取表格合计数据 */
const summaries = computed(() => {
@@ -124,8 +121,7 @@
  const newRow = {
    id: undefined,
    productId: undefined,
    productUnitName: undefined, // 产品单位
    productBarCode: undefined, // 产品条码
    productUnitName: undefined,
    productPrice: undefined,
    stockCount: undefined,
    count: 1,
@@ -134,7 +130,7 @@
    taxPrice: undefined,
    totalPrice: undefined,
    remark: undefined,
    needProduction: 1, // 默认需要生产
    needProduction: 1,
  };
  tableData.value.push(newRow);
  // 通知父组件更新
@@ -153,12 +149,11 @@
}
/** 处理产品变更 */
async function handleProductChange(productId: any, row: any) {
  const product = productOptions.value.find((p) => p.id === productId);
function handleProductChange(product: any, row: any) {
  if (!product) {
    return;
  }
  row.productId = productId;
  row.productId = product.id;
  row.productUnitId = product.unitMeasureId;
  row.productBarCode = product.barCode;
  row.productUnitName = product.unitMeasureName;
@@ -166,7 +161,6 @@
  row.productUnitName3 = product.unitMeasureName3;
  row.productSpecification = product.specification;
  row.productName = product.name;
  row.stockCount = (await getStockCount(productId)) || 0;
  row.productPrice = product.salesPrice || 0;
  row.count = row.count || 1;
  handleRowChange(row);
@@ -221,8 +215,6 @@
/** 初始化 */
onMounted(async () => {
  const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 });
  productOptions.value = res.list || [];
  // 目的:新增时,默认添加一行
  if (tableData.value.length === 0) {
    handleAdd();
@@ -233,14 +225,11 @@
<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"
        :model-value="row.productId"
        placeholder="请选择产品"
        show-search
        @update:model-value="row.productId = $event"
        @change="handleProductChange($event, row)"
      />
      <span v-else>{{ row.productName || '-' }}</span>
src/views/mes/pro/task/data.ts
@@ -8,8 +8,8 @@
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { getRangePickerDefaultProps } from '#/utils';
import { MdClientSelect } from '#/views/mes/md/client/components';
import { MdItemSelect } from '#/views/mes/md/item/components';
import { MdWorkstationSelect } from '#/views/mes/md/workstation/components';
import { ProProcessSelect } from '#/views/mes/process-design/process/components';
@@ -57,7 +57,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
@@ -258,7 +258,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        disabled: true,
      },
src/views/mes/pro/workorder/data.ts
@@ -17,8 +17,8 @@
import { Button } from 'ant-design-vue';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { getRangePickerDefaultProps } from '#/utils';
import { MdClientSelect } from '#/views/mes/md/client/components';
import {
  MdItemSelect,
  MdProductBomSelect,
@@ -189,7 +189,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        disabled: headerReadonly,
        placeholder: '请选择客户',
@@ -292,7 +292,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
@@ -591,7 +591,7 @@
    {
      fieldName: 'clientId',
      label: '客户',
      component: markRaw(MdClientSelect),
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
      },
src/views/wls/transfer/data.ts
@@ -394,7 +394,7 @@
      ? [
          {
            title: '操作',
            width: 180,
            width: 240,
            fixed: 'right',
            slots: { default: 'actions' },
          } as const,