银川
1.销售订单页面展示字段修改
2.客户选择弹框复用调整
3.未使用菜单整理
4.发货通知、销售退货展示字段和操作权限判断修改
5.物料选择弹框展示字段修改
| | |
| | | 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[] { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | 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( |
| | |
| | | { |
| | | 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', |
| | | }, |
| | | ]; |
| | | } |
| | |
| | | <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, |
| | |
| | | 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() { |
| | |
| | | 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, |
| | |
| | | @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> |
| | |
| | | formatter: 'formatAmount3', |
| | | }, |
| | | { |
| | | field: 'productBarCode', |
| | | title: '条码', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'productUnitName', |
| | | title: '单位', |
| | | minWidth: 80, |
| | |
| | | }, |
| | | { |
| | | title: '操作', |
| | | width: 320, |
| | | width: 80, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | visible: !disabled, |
| | |
| | | <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'; |
| | |
| | | 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'; |
| | | |
| | |
| | | 'update:totalPrice', |
| | | ]); |
| | | |
| | | const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]); // 表格数据 |
| | | const productOptions = ref<MdmItemApi.Item[]>([]); // 物料下拉选项 |
| | | const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]); |
| | | |
| | | /** 获取表格合计数据 */ |
| | | const summaries = computed(() => { |
| | |
| | | const newRow = { |
| | | id: undefined, |
| | | productId: undefined, |
| | | productUnitName: undefined, // 产品单位 |
| | | productBarCode: undefined, // 产品条码 |
| | | productUnitName: undefined, |
| | | productPrice: undefined, |
| | | stockCount: undefined, |
| | | count: 1, |
| | |
| | | taxPrice: undefined, |
| | | totalPrice: undefined, |
| | | remark: undefined, |
| | | needProduction: 1, // 默认需要生产 |
| | | needProduction: 1, |
| | | }; |
| | | tableData.value.push(newRow); |
| | | // 通知父组件更新 |
| | |
| | | } |
| | | |
| | | /** 处理产品变更 */ |
| | | 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; |
| | |
| | | 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); |
| | |
| | | |
| | | /** 初始化 */ |
| | | onMounted(async () => { |
| | | const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 }); |
| | | productOptions.value = res.list || []; |
| | | // 目的:新增时,默认添加一行 |
| | | 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" |
| | | :model-value="row.productId" |
| | | placeholder="请选择产品" |
| | | show-search |
| | | @update:model-value="row.productId = $event" |
| | | @change="handleProductChange($event, row)" |
| | | /> |
| | | <span v-else>{{ row.productName || '-' }}</span> |
| | |
| | | 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'; |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | }, |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | |
| | | 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, |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | disabled: headerReadonly, |
| | | placeholder: '请选择客户', |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | }, |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | }, |
| | |
| | | ? [ |
| | | { |
| | | title: '操作', |
| | | width: 180, |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |