| | |
| | | import { defineComponent } from 'vue' |
| | | import { computed, defineComponent, onMounted, reactive, ref } from 'vue' |
| | | import type { Ref } from 'vue' |
| | | import BaseTable from '@/components/Table/Table' |
| | | import styles from './WmsContainer.module.scss' |
| | |
| | | import { columns } from './Config' |
| | | import TdButton from '@/components/TdButton/TdButton' |
| | | import { vPermission } from '@/libs/Permission/Permission' |
| | | import { getWmsEnumData } from '@/widgets/HIAWms/Models/Service/WmsMaterialDrawer' |
| | | import { ElForm, ElFormItem, ElInput, ElOption, ElSelect } from 'element-plus' |
| | | |
| | | interface RenderTableType { |
| | | url?: string |
| | |
| | | onSuccess, |
| | | onBeforeUpload, |
| | | } = useWmsContainer(props, ctx) |
| | | |
| | | // 新增的查询条件 |
| | | const queryForm = ref({ |
| | | containerNo: '', |
| | | containerType: '', |
| | | containerStatus: '', |
| | | filter: '', |
| | | }) |
| | | |
| | | const queryParams = computed(() => ({ |
| | | ...queryForm.value, |
| | | containerType: queryForm.value.containerType || '', // 处理下拉 |
| | | containerStatus: queryForm.value.containerStatus || '', |
| | | })) |
| | | |
| | | // 动态枚举选项 |
| | | const enumOptions = reactive({ |
| | | containerType: [] as Array<{ label: string; value: any }>, |
| | | containerStatus: [] as Array<{ label: string; value: any }>, |
| | | }) |
| | | |
| | | // 获取枚举数据 |
| | | const fetchEnumData = async () => { |
| | | try { |
| | | // 获取物料类型枚举 |
| | | const containerTypeData = await getWmsEnumData({ |
| | | EnumName: 'ContainerTypeEnum', |
| | | }) |
| | | enumOptions.containerType = containerTypeData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | |
| | | // 获取采购类型枚举 |
| | | const containerStatusData = await getWmsEnumData({ |
| | | EnumName: 'ContainerStatusEnum', |
| | | }) |
| | | enumOptions.containerStatus = containerStatusData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | } catch (error) { |
| | | console.error('获取枚举数据失败:', error) |
| | | } |
| | | } |
| | | |
| | | // 组件挂载时获取枚举数据 |
| | | onMounted(() => { |
| | | fetchEnumData() |
| | | }) |
| | | |
| | | // 新增的查询方法 |
| | | const handleQuery = async () => { |
| | | console.log('查询条件:', queryParams.value) |
| | | // tableRef.value.getTableList() |
| | | tableRef.value.getList(queryParams.value) |
| | | } |
| | | |
| | | // 重置查询条件 |
| | | const resetQuery = () => { |
| | | queryForm.value = { |
| | | containerNo: '', |
| | | containerType: '', |
| | | containerStatus: '', |
| | | filter: '', |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @returns 表格 |
| | |
| | | sort={sort.value} |
| | | onConfirm={onConfirmWmsContainer} |
| | | /> |
| | | |
| | | {/* 新增的查询表单 */} |
| | | <ElForm |
| | | inline |
| | | model={queryForm.value} |
| | | class={styles.queryForm} |
| | | label-width="80px" |
| | | > |
| | | <ElFormItem label="关键字"> |
| | | <ElInput |
| | | v-model={queryForm.value.filter} |
| | | placeholder="请输入关键字搜索" |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </ElFormItem> |
| | | <ElFormItem label="物料编码"> |
| | | <ElInput |
| | | v-model={queryForm.value.containerNo} |
| | | placeholder="请输入托盘编码" |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </ElFormItem> |
| | | <ElFormItem label="物料类型"> |
| | | <ElSelect |
| | | v-model={queryForm.value.containerType} |
| | | placeholder="请选择托盘类型" |
| | | clearable |
| | | loading={enumOptions.containerType.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.containerType.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="托盘状态"> |
| | | <ElSelect |
| | | v-model={queryForm.value.containerStatus} |
| | | placeholder="请选择托盘状态" |
| | | clearable |
| | | loading={enumOptions.containerStatus.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.containerStatus.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | {/* <ElFormItem label="日期范围"> |
| | | <ElDatePicker |
| | | v-model={queryForm.value.dateRange} |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | </ElFormItem> */} |
| | | <ElFormItem> |
| | | <IconButton type="primary" icon="search" onClick={handleQuery}> |
| | | 查询 |
| | | </IconButton> |
| | | <IconButton |
| | | style="margin-left: 10px;" |
| | | icon="refresh" |
| | | onClick={resetQuery} |
| | | > |
| | | 重置 |
| | | </IconButton> |
| | | </ElFormItem> |
| | | </ElForm> |
| | | |
| | | <div class={styles.headerContent}> |
| | | <div class={styles.header}> |
| | | <IconButton |