diff --git a/apps/web-antd/src/views/mes/dv/checkplan/components/index.ts b/apps/web-antd/src/views/mes/dv/checkplan/components/index.ts index ff080b299..87010bda0 100644 --- a/apps/web-antd/src/views/mes/dv/checkplan/components/index.ts +++ b/apps/web-antd/src/views/mes/dv/checkplan/components/index.ts @@ -1 +1,2 @@ +export { default as DvCheckPlanSelectDialog } from './select-dialog.vue'; export { default as DvCheckPlanSelect } from './select.vue'; diff --git a/apps/web-antd/src/views/mes/dv/checkplan/components/select.vue b/apps/web-antd/src/views/mes/dv/checkplan/components/select.vue index 4c9a2c3d1..07e71de90 100644 --- a/apps/web-antd/src/views/mes/dv/checkplan/components/select.vue +++ b/apps/web-antd/src/views/mes/dv/checkplan/components/select.vue @@ -1,15 +1,19 @@ diff --git a/apps/web-antd/src/views/mes/dv/checkplan/data.ts b/apps/web-antd/src/views/mes/dv/checkplan/data.ts index bb77b4879..ef7e5d640 100644 --- a/apps/web-antd/src/views/mes/dv/checkplan/data.ts +++ b/apps/web-antd/src/views/mes/dv/checkplan/data.ts @@ -245,3 +245,68 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: multiple ? 'checkbox' : 'radio', width: 50 }, + { field: 'code', title: '计划编码', minWidth: 180 }, + { field: 'name', title: '计划名称', minWidth: 150 }, + { + field: 'type', + title: '计划类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_SUBJECT_TYPE }, + }, + }, + { field: 'startDate', title: '开始日期', width: 120, formatter: 'formatDate' }, + { field: 'endDate', title: '结束日期', width: 120, formatter: 'formatDate' }, + { field: 'cycleCount', title: '频率', width: 100 }, + { + field: 'cycleType', + title: '周期类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_CYCLE_TYPE }, + }, + }, + { + field: 'status', + title: '状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_CHECK_PLAN_STATUS }, + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/dv/machinery/components/index.ts b/apps/web-antd/src/views/mes/dv/machinery/components/index.ts index fee5e15af..b3d061fac 100644 --- a/apps/web-antd/src/views/mes/dv/machinery/components/index.ts +++ b/apps/web-antd/src/views/mes/dv/machinery/components/index.ts @@ -1 +1,2 @@ +export { default as DvMachinerySelectDialog } from './select-dialog.vue'; export { default as DvMachinerySelect } from './select.vue'; diff --git a/apps/web-antd/src/views/mes/dv/machinery/components/select.vue b/apps/web-antd/src/views/mes/dv/machinery/components/select.vue index f0b6a7481..5104e9771 100644 --- a/apps/web-antd/src/views/mes/dv/machinery/components/select.vue +++ b/apps/web-antd/src/views/mes/dv/machinery/components/select.vue @@ -1,17 +1,19 @@ diff --git a/apps/web-antd/src/views/mes/dv/machinery/data.ts b/apps/web-antd/src/views/mes/dv/machinery/data.ts index b54a2c556..a0e08b633 100644 --- a/apps/web-antd/src/views/mes/dv/machinery/data.ts +++ b/apps/web-antd/src/views/mes/dv/machinery/data.ts @@ -276,3 +276,65 @@ export function useImportFormSchema(): VbenFormSchema[] { }, ]; } + +/** 设备选择弹窗的搜索表单 */ +export function useMachinerySelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '设备编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入设备编码', + }, + }, + { + fieldName: 'name', + label: '设备名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入设备名称', + }, + }, + { + fieldName: 'workshopId', + label: '所属车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + allowClear: true, + placeholder: '请选择所属车间', + }, + }, + ]; +} + +/** 设备选择弹窗的字段 */ +export function useMachinerySelectGridColumns( + multiple = false, +): VxeTableGridOptions['columns'] { + return [ + { type: multiple ? 'checkbox' : 'radio', width: 50 }, + { field: 'code', title: '设备编码', width: 120 }, + { field: 'name', title: '设备名称', minWidth: 120 }, + { field: 'brand', title: '品牌', minWidth: 120 }, + { field: 'specification', title: '规格型号', minWidth: 120 }, + { field: 'workshopName', title: '所属车间', width: 120 }, + { + field: 'status', + title: '设备状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_MACHINERY_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 160, + formatter: 'formatDateTime', + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/md/client/modules/product-sales-list.vue b/apps/web-antd/src/views/mes/md/client/modules/product-sales-list.vue index 040989b90..04a64a2d0 100644 --- a/apps/web-antd/src/views/mes/md/client/modules/product-sales-list.vue +++ b/apps/web-antd/src/views/mes/md/client/modules/product-sales-list.vue @@ -2,15 +2,31 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MesWmProductSalesApi } from '#/api/mes/wm/productsales'; +import { useVbenModal } from '@vben/common-ui'; import { DICT_TYPE } from '@vben/constants'; +import { Button } from 'ant-design-vue'; + import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getProductSalesPage } from '#/api/mes/wm/productsales'; +import ProductSalesForm from '#/views/mes/wm/productsales/modules/form.vue'; const props = defineProps<{ clientId: number; }>(); +const [DetailModal, detailModalApi] = useVbenModal({ + connectedComponent: ProductSalesForm, + destroyOnClose: true, +}); + +/** 查看销售出库单详情 */ +function handleViewSales(row: MesWmProductSalesApi.ProductSales) { + if (row.id) { + detailModalApi.setData({ formType: 'detail', id: row.id }).open(); + } +} + const [Grid] = useVbenVxeGrid({ gridOptions: { columns: [ @@ -18,6 +34,7 @@ const [Grid] = useVbenVxeGrid({ field: 'code', title: '出库单编号', minWidth: 160, + slots: { default: 'code' }, }, { field: 'name', @@ -70,5 +87,12 @@ const [Grid] = useVbenVxeGrid({ diff --git a/apps/web-antd/src/views/mes/qc/rqc/modules/form.vue b/apps/web-antd/src/views/mes/qc/rqc/modules/form.vue index 952ec0854..9933e2312 100644 --- a/apps/web-antd/src/views/mes/qc/rqc/modules/form.vue +++ b/apps/web-antd/src/views/mes/qc/rqc/modules/form.vue @@ -136,9 +136,7 @@ const [Modal, modalApi] = useVbenModal({ if (!ok) { return; } - // 关闭并提示 message.success($t('ui.actionMessage.operationSuccess')); - await modalApi.close(); emit('success'); } finally { modalApi.unlock(); @@ -160,7 +158,10 @@ const [Modal, modalApi] = useVbenModal({ formType.value = data.formType; formApi.setState({ schema: useFormSchema(formType.value, formApi) }); formApi.setDisabled(formType.value === 'detail'); - modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); + modalApi.setState({ + confirmText: formType.value === 'detail' ? undefined : '保存', + showConfirmButton: formType.value !== 'detail', + }); if (data?.id) { modalApi.lock(); try { diff --git a/apps/web-antd/src/views/mes/tm/tool/components/index.ts b/apps/web-antd/src/views/mes/tm/tool/components/index.ts index 8af00d7b0..a157cd4de 100644 --- a/apps/web-antd/src/views/mes/tm/tool/components/index.ts +++ b/apps/web-antd/src/views/mes/tm/tool/components/index.ts @@ -1 +1,2 @@ +export { default as TmToolSelectDialog } from './select-dialog.vue'; export { default as TmToolSelect } from './select.vue'; diff --git a/apps/web-antd/src/views/mes/tm/tool/components/select.vue b/apps/web-antd/src/views/mes/tm/tool/components/select.vue index 134b947f0..e0efacde5 100644 --- a/apps/web-antd/src/views/mes/tm/tool/components/select.vue +++ b/apps/web-antd/src/views/mes/tm/tool/components/select.vue @@ -1,55 +1,141 @@ diff --git a/apps/web-antd/src/views/mes/tm/tool/data.ts b/apps/web-antd/src/views/mes/tm/tool/data.ts index 1d5498cb3..004d70004 100644 --- a/apps/web-antd/src/views/mes/tm/tool/data.ts +++ b/apps/web-antd/src/views/mes/tm/tool/data.ts @@ -325,3 +325,85 @@ export function useGridColumns(): VxeTableGridOptions['column }, ]; } + +/** 工具选择弹窗的搜索表单 */ +export function useToolSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '工具编码', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入工具编码', + }, + }, + { + fieldName: 'name', + label: '工具名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入工具名称', + }, + }, + { + fieldName: 'toolTypeId', + label: '工具类型', + component: markRaw(TmToolTypeSelect), + componentProps: { + placeholder: '请选择工具类型', + }, + }, + { + fieldName: 'brand', + label: '品牌', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入品牌', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_TM_TOOL_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + ]; +} + +/** 工具选择弹窗的字段 */ +export function useToolSelectGridColumns( + multiple = false, +): VxeTableGridOptions['columns'] { + return [ + { type: multiple ? 'checkbox' : 'radio', width: 50 }, + { field: 'code', title: '工具编码', width: 120 }, + { field: 'name', title: '工具名称', minWidth: 120 }, + { field: 'brand', title: '品牌', minWidth: 100 }, + { field: 'specification', title: '型号规格', minWidth: 100 }, + { field: 'toolTypeName', title: '工具类型', width: 120 }, + { field: 'quantity', title: '库存数量', width: 100 }, + { field: 'availableQuantity', title: '可用数量', width: 100 }, + { + field: 'status', + title: '状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_TM_TOOL_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 180, + formatter: 'formatDateTime', + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/wm/salesnotice/components/select-dialog.vue b/apps/web-antd/src/views/mes/wm/salesnotice/components/select-dialog.vue index 7a7019833..28047e30c 100644 --- a/apps/web-antd/src/views/mes/wm/salesnotice/components/select-dialog.vue +++ b/apps/web-antd/src/views/mes/wm/salesnotice/components/select-dialog.vue @@ -3,14 +3,16 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MesWmSalesNoticeApi } from '#/api/mes/wm/salesnotice'; -import { nextTick, ref } from 'vue'; +import { markRaw, nextTick, ref } from 'vue'; import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; import { message, Modal } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getSalesNoticePage } from '#/api/mes/wm/salesnotice'; +import { MdClientSelect } from '#/views/mes/md/client/components'; const emit = defineEmits<{ selected: [rows: MesWmSalesNoticeApi.SalesNotice[]]; @@ -23,8 +25,8 @@ const syncingSingleSelection = ref(false); // 是否同步单选勾选状态 const selectedRows = ref([]); // 已选通知单列表 const preSelectedIds = ref([]); // 预选通知单编号列表 -/** 搜索表单 */ -function useSearchSchema(): VbenFormSchema[] { +/** 搜索表单:未固定状态时展示状态下拉,固定状态时隐藏 */ +function useSearchSchema(hasFixedStatus: boolean): VbenFormSchema[] { return [ { fieldName: 'code', @@ -53,6 +55,31 @@ function useSearchSchema(): VbenFormSchema[] { placeholder: '请输入销售订单编号', }, }, + { + fieldName: 'clientId', + label: '客户', + component: markRaw(MdClientSelect), + componentProps: { + placeholder: '请选择客户', + }, + }, + ...(hasFixedStatus + ? [] + : [ + { + fieldName: 'status', + label: '单据状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions( + DICT_TYPE.MES_WM_SALES_NOTICE_STATUS, + 'number', + ), + placeholder: '请选择单据状态', + }, + } as VbenFormSchema, + ]), ]; } @@ -165,7 +192,7 @@ function applyPreSelection() { const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { - schema: useSearchSchema(), + schema: useSearchSchema(false), }, gridOptions: { columns: useGridColumns(), @@ -182,8 +209,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ return await getSalesNoticePage({ pageNo: page.currentPage, pageSize: page.pageSize, - status: fixedStatus.value, ...formValues, + // 固定状态优先,未固定时用搜索表单里的状态 + status: fixedStatus.value ?? formValues.status, }); }, }, @@ -219,6 +247,10 @@ async function openModal( multiple.value = options?.multiple ?? false; fixedStatus.value = options?.status; preSelectedIds.value = selectedIds || []; + // 固定状态时隐藏状态搜索项,未固定时展示 + gridApi.formApi.setState({ + schema: useSearchSchema(fixedStatus.value != null), + }); await nextTick(); await resetQueryState(); await gridApi.query(); diff --git a/apps/web-ele/src/views/mes/dv/checkplan/components/index.ts b/apps/web-ele/src/views/mes/dv/checkplan/components/index.ts index ff080b299..87010bda0 100644 --- a/apps/web-ele/src/views/mes/dv/checkplan/components/index.ts +++ b/apps/web-ele/src/views/mes/dv/checkplan/components/index.ts @@ -1 +1,2 @@ +export { default as DvCheckPlanSelectDialog } from './select-dialog.vue'; export { default as DvCheckPlanSelect } from './select.vue'; diff --git a/apps/web-ele/src/views/mes/dv/checkplan/components/select.vue b/apps/web-ele/src/views/mes/dv/checkplan/components/select.vue index 12009bbc8..c81a7b380 100644 --- a/apps/web-ele/src/views/mes/dv/checkplan/components/select.vue +++ b/apps/web-ele/src/views/mes/dv/checkplan/components/select.vue @@ -1,13 +1,19 @@ diff --git a/apps/web-ele/src/views/mes/dv/checkplan/data.ts b/apps/web-ele/src/views/mes/dv/checkplan/data.ts index a0daf30d3..0e4bd514d 100644 --- a/apps/web-ele/src/views/mes/dv/checkplan/data.ts +++ b/apps/web-ele/src/views/mes/dv/checkplan/data.ts @@ -245,3 +245,68 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { type: multiple ? 'checkbox' : 'radio', width: 50 }, + { field: 'code', title: '计划编码', minWidth: 180 }, + { field: 'name', title: '计划名称', minWidth: 150 }, + { + field: 'type', + title: '计划类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_SUBJECT_TYPE }, + }, + }, + { field: 'startDate', title: '开始日期', width: 120, formatter: 'formatDate' }, + { field: 'endDate', title: '结束日期', width: 120, formatter: 'formatDate' }, + { field: 'cycleCount', title: '频率', width: 100 }, + { + field: 'cycleType', + title: '周期类型', + width: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_CYCLE_TYPE }, + }, + }, + { + field: 'status', + title: '状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_CHECK_PLAN_STATUS }, + }, + }, + ]; +} diff --git a/apps/web-ele/src/views/mes/dv/machinery/components/index.ts b/apps/web-ele/src/views/mes/dv/machinery/components/index.ts index fee5e15af..b3d061fac 100644 --- a/apps/web-ele/src/views/mes/dv/machinery/components/index.ts +++ b/apps/web-ele/src/views/mes/dv/machinery/components/index.ts @@ -1 +1,2 @@ +export { default as DvMachinerySelectDialog } from './select-dialog.vue'; export { default as DvMachinerySelect } from './select.vue'; diff --git a/apps/web-ele/src/views/mes/dv/machinery/components/select.vue b/apps/web-ele/src/views/mes/dv/machinery/components/select.vue index f16f10e0e..c6639fedd 100644 --- a/apps/web-ele/src/views/mes/dv/machinery/components/select.vue +++ b/apps/web-ele/src/views/mes/dv/machinery/components/select.vue @@ -1,15 +1,19 @@ diff --git a/apps/web-ele/src/views/mes/dv/machinery/data.ts b/apps/web-ele/src/views/mes/dv/machinery/data.ts index 1c385a8df..07f87a100 100644 --- a/apps/web-ele/src/views/mes/dv/machinery/data.ts +++ b/apps/web-ele/src/views/mes/dv/machinery/data.ts @@ -273,3 +273,65 @@ export function useImportFormSchema(): VbenFormSchema[] { }, ]; } + +/** 设备选择弹窗的搜索表单 */ +export function useMachinerySelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '设备编码', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入设备编码', + }, + }, + { + fieldName: 'name', + label: '设备名称', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入设备名称', + }, + }, + { + fieldName: 'workshopId', + label: '所属车间', + component: markRaw(MdWorkshopSelect), + componentProps: { + clearable: true, + placeholder: '请选择所属车间', + }, + }, + ]; +} + +/** 设备选择弹窗的字段 */ +export function useMachinerySelectGridColumns( + multiple = false, +): VxeTableGridOptions['columns'] { + return [ + { type: multiple ? 'checkbox' : 'radio', width: 50 }, + { field: 'code', title: '设备编码', width: 120 }, + { field: 'name', title: '设备名称', minWidth: 120 }, + { field: 'brand', title: '品牌', minWidth: 120 }, + { field: 'specification', title: '规格型号', minWidth: 120 }, + { field: 'workshopName', title: '所属车间', width: 120 }, + { + field: 'status', + title: '设备状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_DV_MACHINERY_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 160, + formatter: 'formatDateTime', + }, + ]; +} diff --git a/apps/web-ele/src/views/mes/md/client/modules/product-sales-list.vue b/apps/web-ele/src/views/mes/md/client/modules/product-sales-list.vue index 040989b90..38fc62a82 100644 --- a/apps/web-ele/src/views/mes/md/client/modules/product-sales-list.vue +++ b/apps/web-ele/src/views/mes/md/client/modules/product-sales-list.vue @@ -2,15 +2,31 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MesWmProductSalesApi } from '#/api/mes/wm/productsales'; +import { useVbenModal } from '@vben/common-ui'; import { DICT_TYPE } from '@vben/constants'; +import { ElButton } from 'element-plus'; + import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getProductSalesPage } from '#/api/mes/wm/productsales'; +import ProductSalesForm from '#/views/mes/wm/productsales/modules/form.vue'; const props = defineProps<{ clientId: number; }>(); +const [DetailModal, detailModalApi] = useVbenModal({ + connectedComponent: ProductSalesForm, + destroyOnClose: true, +}); + +/** 查看销售出库单详情 */ +function handleViewSales(row: MesWmProductSalesApi.ProductSales) { + if (row.id) { + detailModalApi.setData({ formType: 'detail', id: row.id }).open(); + } +} + const [Grid] = useVbenVxeGrid({ gridOptions: { columns: [ @@ -18,6 +34,7 @@ const [Grid] = useVbenVxeGrid({ field: 'code', title: '出库单编号', minWidth: 160, + slots: { default: 'code' }, }, { field: 'name', @@ -70,5 +87,12 @@ const [Grid] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mes/qc/rqc/modules/form.vue b/apps/web-ele/src/views/mes/qc/rqc/modules/form.vue index 72e1eb760..4a094c727 100644 --- a/apps/web-ele/src/views/mes/qc/rqc/modules/form.vue +++ b/apps/web-ele/src/views/mes/qc/rqc/modules/form.vue @@ -143,9 +143,7 @@ const [Modal, modalApi] = useVbenModal({ if (!ok) { return; } - // 关闭并提示 ElMessage.success($t('ui.actionMessage.operationSuccess')); - await modalApi.close(); emit('success'); } finally { modalApi.unlock(); @@ -167,7 +165,10 @@ const [Modal, modalApi] = useVbenModal({ formType.value = data.formType; formApi.setState({ schema: useFormSchema(formType.value, formApi) }); formApi.setDisabled(formType.value === 'detail'); - modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); + modalApi.setState({ + confirmText: formType.value === 'detail' ? undefined : '保存', + showConfirmButton: formType.value !== 'detail', + }); if (data?.id) { modalApi.lock(); try { diff --git a/apps/web-ele/src/views/mes/tm/tool/components/index.ts b/apps/web-ele/src/views/mes/tm/tool/components/index.ts index 8af00d7b0..a157cd4de 100644 --- a/apps/web-ele/src/views/mes/tm/tool/components/index.ts +++ b/apps/web-ele/src/views/mes/tm/tool/components/index.ts @@ -1 +1,2 @@ +export { default as TmToolSelectDialog } from './select-dialog.vue'; export { default as TmToolSelect } from './select.vue'; diff --git a/apps/web-ele/src/views/mes/tm/tool/components/select.vue b/apps/web-ele/src/views/mes/tm/tool/components/select.vue index ea1f3aa09..d5bb9006b 100644 --- a/apps/web-ele/src/views/mes/tm/tool/components/select.vue +++ b/apps/web-ele/src/views/mes/tm/tool/components/select.vue @@ -1,52 +1,139 @@ diff --git a/apps/web-ele/src/views/mes/tm/tool/data.ts b/apps/web-ele/src/views/mes/tm/tool/data.ts index e19f0198f..0aed584d6 100644 --- a/apps/web-ele/src/views/mes/tm/tool/data.ts +++ b/apps/web-ele/src/views/mes/tm/tool/data.ts @@ -328,3 +328,85 @@ export function useGridColumns(): VxeTableGridOptions['column }, ]; } + +/** 工具选择弹窗的搜索表单 */ +export function useToolSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '工具编码', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入工具编码', + }, + }, + { + fieldName: 'name', + label: '工具名称', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入工具名称', + }, + }, + { + fieldName: 'toolTypeId', + label: '工具类型', + component: markRaw(TmToolTypeSelect), + componentProps: { + placeholder: '请选择工具类型', + }, + }, + { + fieldName: 'brand', + label: '品牌', + component: 'Input', + componentProps: { + clearable: true, + placeholder: '请输入品牌', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + clearable: true, + options: getDictOptions(DICT_TYPE.MES_TM_TOOL_STATUS, 'number'), + placeholder: '请选择状态', + }, + }, + ]; +} + +/** 工具选择弹窗的字段 */ +export function useToolSelectGridColumns( + multiple = false, +): VxeTableGridOptions['columns'] { + return [ + { type: multiple ? 'checkbox' : 'radio', width: 50 }, + { field: 'code', title: '工具编码', width: 120 }, + { field: 'name', title: '工具名称', minWidth: 120 }, + { field: 'brand', title: '品牌', minWidth: 100 }, + { field: 'specification', title: '型号规格', minWidth: 100 }, + { field: 'toolTypeName', title: '工具类型', width: 120 }, + { field: 'quantity', title: '库存数量', width: 100 }, + { field: 'availableQuantity', title: '可用数量', width: 100 }, + { + field: 'status', + title: '状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_TM_TOOL_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + width: 180, + formatter: 'formatDateTime', + }, + ]; +} diff --git a/apps/web-ele/src/views/mes/wm/salesnotice/components/select-dialog.vue b/apps/web-ele/src/views/mes/wm/salesnotice/components/select-dialog.vue index d3d4c351f..e810e189b 100644 --- a/apps/web-ele/src/views/mes/wm/salesnotice/components/select-dialog.vue +++ b/apps/web-ele/src/views/mes/wm/salesnotice/components/select-dialog.vue @@ -3,14 +3,16 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MesWmSalesNoticeApi } from '#/api/mes/wm/salesnotice'; -import { nextTick, ref } from 'vue'; +import { markRaw, nextTick, ref } from 'vue'; import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; import { ElButton, ElDialog, ElMessage } from 'element-plus'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getSalesNoticePage } from '#/api/mes/wm/salesnotice'; +import { MdClientSelect } from '#/views/mes/md/client/components'; const emit = defineEmits<{ selected: [rows: MesWmSalesNoticeApi.SalesNotice[]]; @@ -23,8 +25,8 @@ const syncingSingleSelection = ref(false); // 是否同步单选勾选状态 const selectedRows = ref([]); // 已选通知单列表 const preSelectedIds = ref([]); // 预选通知单编号列表 -/** 搜索表单 */ -function useSearchSchema(): VbenFormSchema[] { +/** 搜索表单:未固定状态时展示状态下拉,固定状态时隐藏 */ +function useSearchSchema(hasFixedStatus: boolean): VbenFormSchema[] { return [ { fieldName: 'code', @@ -53,6 +55,31 @@ function useSearchSchema(): VbenFormSchema[] { placeholder: '请输入销售订单编号', }, }, + { + fieldName: 'clientId', + label: '客户', + component: markRaw(MdClientSelect), + componentProps: { + placeholder: '请选择客户', + }, + }, + ...(hasFixedStatus + ? [] + : [ + { + fieldName: 'status', + label: '单据状态', + component: 'Select', + componentProps: { + clearable: true, + options: getDictOptions( + DICT_TYPE.MES_WM_SALES_NOTICE_STATUS, + 'number', + ), + placeholder: '请选择单据状态', + }, + } as VbenFormSchema, + ]), ]; } @@ -165,7 +192,7 @@ function applyPreSelection() { const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { - schema: useSearchSchema(), + schema: useSearchSchema(false), }, gridOptions: { columns: useGridColumns(), @@ -182,8 +209,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ return await getSalesNoticePage({ pageNo: page.currentPage, pageSize: page.pageSize, - status: fixedStatus.value, ...formValues, + // 固定状态优先,未固定时用搜索表单里的状态 + status: fixedStatus.value ?? formValues.status, }); }, }, @@ -219,6 +247,10 @@ async function openModal( multiple.value = options?.multiple ?? false; fixedStatus.value = options?.status; preSelectedIds.value = selectedIds || []; + // 固定状态时隐藏状态搜索项,未固定时展示 + gridApi.formApi.setState({ + schema: useSearchSchema(fixedStatus.value != null), + }); await nextTick(); await resetQueryState(); await gridApi.query();