| | |
| | | getAreaAreaDataList, |
| | | getAisleDataList, |
| | | } from '@/widgets/HIAWms/Models/Service/WmsMaterialDrawer' |
| | | // 引入公共选项配置 |
| | | import { FILTER_MODE_OPTIONS_STRING } from '@/components/DyFormForHighQuery/DyFormForHighQueryOptions' |
| | | import WmsPlaceQueryDrawer from '../Dialog/WmsPlaceQueryDrawer/WmsPlaceQueryDrawer' |
| | | |
| | | interface RenderTableType { |
| | | url?: string |
| | |
| | | onError, |
| | | onSearch, |
| | | onRowClick, |
| | | dialogConfigForQuery, |
| | | onConfirmWmsPlace, |
| | | onCheck, |
| | | onAddWmsPlace, |
| | | onExport, |
| | | openDetail, |
| | | onSuccess, |
| | | onAdvancedQuery, |
| | | onBeforeUpload, |
| | | } = useWmsPlace(props, ctx) |
| | | |
| | | //定义高级查询引用 |
| | | const wmsPlaceQueryDrawerRef = ref(null) |
| | | // 新增的查询条件 |
| | | const queryForm = ref({ |
| | | placeNo: '', |
| | | storageTypeNo: '', |
| | | placeStatus: '', |
| | | areaCode: '', |
| | | aisle: '', |
| | | islock: '', |
| | | emptyContainer: '', |
| | | filter: '', |
| | | searchVal: '', |
| | | str_searchFormInputAttrs: [], |
| | | searchVal_FilterMode: '', |
| | | }) |
| | | |
| | | const queryParams = computed(() => ({ |
| | | ...queryForm.value, |
| | | storageTypeNo: queryForm.value.storageTypeNo || '', // 处理下拉 |
| | | placeStatus: queryForm.value.placeStatus || '', |
| | | islock: queryForm.value.islock || '', |
| | | aisle: queryForm.value.aisle || '', |
| | | areaCode: queryForm.value.areaCode || '', |
| | | emptyContainer: queryForm.value.emptyContainer || '', |
| | | })) |
| | | //定义整体模糊查询的列数组(注意:必须大小写跟后端的实体类属性名一致,否则会导致匹配不对的问题) |
| | | const _searchFormInputAttrs = ref(['PlaceNo']) |
| | | const searchFormInputAttrs_Placeholder = ref('请输入库位编号') |
| | | |
| | | // 动态枚举选项 |
| | | const enumOptions = reactive({ |
| | | storageTypeNo: [] as Array<{ label: string; value: any }>, |
| | | placeStatus: [] as Array<{ label: string; value: any }>, |
| | | yesOrNo: [] as Array<{ label: string; value: any }>, |
| | | islock: [] as Array<{ label: string; value: any }>, |
| | | emptyContainer: [] as Array<{ label: string; value: any }>, |
| | | }) |
| | | |
| | | let areaTypelist = [] as Array<{ label: string; value: any }> |
| | | let aisleTypelist = [] as Array<{ label: string; value: any }> |
| | | |
| | | // 获取枚举数据 |
| | | const fetchEnumData = async () => { |
| | | try { |
| | | // 获取物料类型枚举 |
| | | const storageTypeNoData = await getWmsEnumData({ |
| | | const placeTypeEnumData = await getWmsEnumData({ |
| | | EnumName: 'PlaceTypeEnum', |
| | | }) |
| | | enumOptions.storageTypeNo = storageTypeNoData.map((item) => ({ |
| | | enumOptions.storageTypeNo = placeTypeEnumData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | |
| | | // 获取采购类型枚举 |
| | | const placeStatusData = await getWmsEnumData({ |
| | | const placeStatusEnumData = await getWmsEnumData({ |
| | | EnumName: 'PlaceStatusEnum', |
| | | }) |
| | | enumOptions.placeStatus = placeStatusData.map((item) => ({ |
| | | enumOptions.placeStatus = placeStatusEnumData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | |
| | | const yesNoData = await getWmsEnumData({ |
| | | const yesNoEnumData = await getWmsEnumData({ |
| | | EnumName: 'YesNoEnum', |
| | | }) |
| | | enumOptions.yesOrNo = yesNoData.map((item) => ({ |
| | | enumOptions.islock = yesNoEnumData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | enumOptions.emptyContainer = yesNoEnumData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | |
| | | console.error('获取枚举数据失败:', error) |
| | | } |
| | | } |
| | | const getAreaType = async () => { |
| | | try { |
| | | const areaListData = await getAreaAreaDataList() |
| | | areaTypelist = areaListData.map((item) => ({ |
| | | label: item.areaName || '', |
| | | value: item.areaNo || '', // 同上 |
| | | })) |
| | | } catch (error) { |
| | | areaTypelist = [] // 失败时重置为空数组 |
| | | } |
| | | } |
| | | |
| | | const getAisleList = async () => { |
| | | try { |
| | | const aisleListData = await getAisleDataList() |
| | | aisleTypelist = aisleListData.map((item) => ({ |
| | | label: item.aisleName || '', |
| | | value: item.aisle || '', |
| | | })) |
| | | } catch (error) { |
| | | console.error('获取巷道列表失败:', error) |
| | | aisleTypelist = [] // 失败时重置为空数组 |
| | | } |
| | | } |
| | | // 定义响应式查询数据 |
| | | const _curHighQueryData = ref({ |
| | | searchVal: '', |
| | | str_searchFormInputAttrs: [], |
| | | searchVal_FilterMode: '', |
| | | }) |
| | | // 组件挂载时获取枚举数据 |
| | | onMounted(() => { |
| | | fetchEnumData() |
| | | getAreaType() |
| | | getAisleList() |
| | | queryForm.value.searchVal_FilterMode = |
| | | FILTER_MODE_OPTIONS_STRING[0]?.value || '' |
| | | _curHighQueryData.value.searchVal_FilterMode = |
| | | queryForm.value.searchVal_FilterMode |
| | | _curHighQueryData.value.str_searchFormInputAttrs = |
| | | _searchFormInputAttrs.value |
| | | }) |
| | | |
| | | // 新增的查询方法 |
| | | const handleQuery = async () => { |
| | | console.log('查询条件:', queryParams.value) |
| | | // tableRef.value.getTableList() |
| | | tableRef.value.getList(queryParams.value) |
| | | // 新版的查询方法(主页面中的按钮【查询】) |
| | | const handleQueryForMain = async () => { |
| | | _curHighQueryData.value.searchVal = queryForm.value.searchVal |
| | | _curHighQueryData.value.searchVal_FilterMode = |
| | | queryForm.value.searchVal_FilterMode |
| | | _curHighQueryData.value.str_searchFormInputAttrs = |
| | | _searchFormInputAttrs.value |
| | | tableRef.value.getList(_curHighQueryData.value) |
| | | } |
| | | |
| | | // 重置查询条件 |
| | | // 新版的查询方法(高级查询中的按钮【查询】) |
| | | const handleQuery = async (extraParams = {}) => { |
| | | let filteredData = commonGetHighQueryForm(extraParams) |
| | | commonSaveCurHighQueryData(filteredData) |
| | | tableRef.value.getList(filteredData) |
| | | } |
| | | // 新版的查询重置 |
| | | const resetQuery = () => { |
| | | queryForm.value = { |
| | | placeNo: '', |
| | | storageTypeNo: '', |
| | | placeStatus: '', |
| | | aisle: '', |
| | | areaCode: '', |
| | | islock: '', |
| | | emptyContainer: '', |
| | | filter: '', |
| | | } |
| | | queryForm.value.searchVal = '' |
| | | queryForm.value.searchVal_FilterMode = |
| | | FILTER_MODE_OPTIONS_STRING[0]?.value || '' |
| | | queryForm.value.str_searchFormInputAttrs = _searchFormInputAttrs.value |
| | | } |
| | | //新版的导出方法 |
| | | const handleExport = () => { |
| | | onExport(_curHighQueryData.value) |
| | | } |
| | | // 新版的查询弹出框关闭方法 |
| | | const closeQuery = (extraParams = {}) => { |
| | | let filteredData = commonGetHighQueryForm(extraParams) |
| | | console.log('closeQuery方法') |
| | | console.log(filteredData) |
| | | commonSaveCurHighQueryData(filteredData) |
| | | } |
| | | //保存查询值 |
| | | const commonSaveCurHighQueryData = (filteredData = {}) => { |
| | | _curHighQueryData.value = { ..._curHighQueryData.value, ...filteredData } |
| | | _curHighQueryData.value.searchVal = queryForm.value.searchVal |
| | | _curHighQueryData.value.searchVal_FilterMode = |
| | | queryForm.value.searchVal_FilterMode |
| | | _curHighQueryData.value.str_searchFormInputAttrs = |
| | | _searchFormInputAttrs.value |
| | | } |
| | | //获取高级查询弹出框的查询值 |
| | | const commonGetHighQueryForm = (extraParams = {}) => { |
| | | // 过滤掉 undefined 的值 |
| | | let filteredData = Object.assign( |
| | | {}, |
| | | ...Object.entries(extraParams).map(([key, value]) => |
| | | value !== undefined ? { [key]: value } : {} |
| | | ) |
| | | ) |
| | | //组合模糊查询 |
| | | filteredData.searchVal = queryForm.value.searchVal |
| | | filteredData.searchVal_FilterMode = queryForm.value.searchVal_FilterMode |
| | | filteredData.str_searchFormInputAttrs = _searchFormInputAttrs.value |
| | | return filteredData |
| | | } |
| | | |
| | | /** |
| | |
| | | sort={sort.value} |
| | | onConfirm={onConfirmWmsPlace} |
| | | /> |
| | | {/* 新增的查询表单 */} |
| | | <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.placeNo} |
| | | placeholder="请输入库位编码" |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </ElFormItem> |
| | | <ElFormItem label="库位类型"> |
| | | <ElSelect |
| | | v-model={queryForm.value.storageTypeNo} |
| | | placeholder="请选择托盘类型" |
| | | clearable |
| | | loading={enumOptions.storageTypeNo.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.storageTypeNo.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="库位状态"> |
| | | <ElSelect |
| | | v-model={queryForm.value.placeStatus} |
| | | placeholder="请选择托盘状态" |
| | | clearable |
| | | loading={enumOptions.placeStatus.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.placeStatus.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="库区"> |
| | | <ElSelect |
| | | v-model={queryForm.value.areaCode} |
| | | placeholder="请选择库区" |
| | | clearable |
| | | loading={areaTypelist.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {areaTypelist.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="巷道"> |
| | | <ElSelect |
| | | v-model={queryForm.value.aisle} |
| | | placeholder="请选择库区" |
| | | clearable |
| | | loading={aisleTypelist.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {aisleTypelist.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="是否锁定"> |
| | | <ElSelect |
| | | v-model={queryForm.value.islock} |
| | | placeholder="请选择是否锁定" |
| | | clearable |
| | | loading={enumOptions.yesOrNo.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.yesOrNo.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="是否空托"> |
| | | <ElSelect |
| | | v-model={queryForm.value.emptyContainer} |
| | | placeholder="请选择是否空托" |
| | | clearable |
| | | loading={enumOptions.yesOrNo.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.yesOrNo.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem> |
| | | <IconButton type="primary" icon="search" onClick={handleQuery}> |
| | | 查询 |
| | | </IconButton> |
| | | <IconButton |
| | | style="margin-left: 10px;" |
| | | icon="refresh" |
| | | onClick={resetQuery} |
| | | > |
| | | 重置 |
| | | </IconButton> |
| | | </ElFormItem> |
| | | </ElForm> |
| | | {/* 高级查询 */} |
| | | <WmsPlaceQueryDrawer |
| | | ref="wmsPlaceQueryDrawerRef" |
| | | v-model={dialogConfigForQuery.visible} |
| | | title={dialogConfigForQuery.title} |
| | | row={current.value} |
| | | sort={sort.value} |
| | | onConfirmQuery={handleQuery} |
| | | onRestQuery={resetQuery} |
| | | onClose={closeQuery} |
| | | /> |
| | | |
| | | <div class={styles.headerContent}> |
| | | <div class={styles.header}> |
| | |
| | | 添加 |
| | | </IconButton> |
| | | <el-divider direction="vertical" /> |
| | | |
| | | <el-upload |
| | | v-permission="wmsPlace-import" |
| | | name="file" |
| | |
| | | <IconButton |
| | | v-permission="wmsPlace-output" |
| | | icon="out" |
| | | onClick={onExport} |
| | | onClick={handleExport} |
| | | > |
| | | 导出 |
| | | </IconButton> |
| | | </div> |
| | | {/* <Search |
| | | placeholder="请输入关键字" |
| | | v-model={search.value} |
| | | onConfirm={onSearch} |
| | | style={{ marginTop: '-1px' }} |
| | | /> */} |
| | | <ElFormItem style={{ marginTop: '15px' }}> |
| | | <ElFormItem label="关键字"> |
| | | <el-tooltip |
| | | class="box-item" |
| | | effect="dark" |
| | | content={searchFormInputAttrs_Placeholder.value} |
| | | placement="top-start" |
| | | > |
| | | <ElInput |
| | | v-model={queryForm.value.searchVal} |
| | | placeholder={searchFormInputAttrs_Placeholder.value} |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </el-tooltip> |
| | | </ElFormItem> |
| | | <ElFormItem label="" style="width:100px;"> |
| | | <ElSelect |
| | | v-model={queryForm.value.searchVal_FilterMode} |
| | | placeholder="请选择" |
| | | class={styles.formItem} |
| | | > |
| | | {FILTER_MODE_OPTIONS_STRING.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <IconButton |
| | | type="primary" |
| | | icon="search" |
| | | onClick={handleQueryForMain} |
| | | > |
| | | 查询 |
| | | </IconButton> |
| | | {/* <IconButton style="" icon="refresh" onClick={resetQuery}> |
| | | 重置 |
| | | </IconButton> */} |
| | | <IconButton |
| | | v-permission="wmsPlace-add" |
| | | icon="search" |
| | | onClick={onAdvancedQuery} |
| | | type="primary" |
| | | > |
| | | 高级查询 |
| | | </IconButton> |
| | | </ElFormItem> |
| | | </div> |
| | | |
| | | <RenderBaseTable |
| | | url="/api/v1/HIAWms/wmsPlace" |
| | | url="/api/v1/HIAWms/wmsPlace/page" |
| | | dataSource={dataSource} |
| | | isChecked={true} |
| | | isDrag={true} |