From d308c16400fe214915900505353c760e64c02a16 Mon Sep 17 00:00:00 2001 From: "HUOJIN\\92525" Date: Fri, 19 Dec 2025 18:06:39 +0800 Subject: [PATCH] no message --- .../src/jeecg/components/JSearchSelect.vue | 12 +- .../Modal/src/components/ModalWrapper.vue | 3 +- src/views/base/item/Item.api.ts | 41 +- src/views/base/item/components/ItemSelect.vue | 416 ++++++++++++++++++ src/views/base/point/Point.api.ts | 10 +- src/views/base/point/PointList.vue | 9 +- .../base/point/components/PointSelect.vue | 111 +++-- src/views/base/stock/Stock.api.ts | 7 + src/views/base/stock/StockList.vue | 9 +- src/views/base/stock/components/StockForm.vue | 10 +- .../base/stock/components/StockSelect.vue | 415 +++++++++++++++++ src/views/conveyorLine/WcsMonitor.vue | 4 +- src/views/inventory/Inventory.data.ts | 15 +- src/views/inventory/InventoryList.vue | 28 +- .../inventory/components/InventoryForm.vue | 74 ++-- .../inventory/components/InventoryModal.vue | 26 +- src/views/inventoryLog/InventoryLog.data.ts | 32 +- src/views/inventoryLog/InventoryLogList.vue | 37 +- src/views/receive/asn/Asn.data.ts | 8 +- src/views/receive/asn/AsnList.vue | 23 +- src/views/shipping/Pick.data.ts | 40 +- src/views/shipping/PickList.vue | 30 +- src/views/shipping/components/PickForm.vue | 4 +- 23 files changed, 1113 insertions(+), 251 deletions(-) create mode 100644 src/views/base/item/components/ItemSelect.vue create mode 100644 src/views/base/stock/components/StockSelect.vue diff --git a/src/components/Form/src/jeecg/components/JSearchSelect.vue b/src/components/Form/src/jeecg/components/JSearchSelect.vue index 6c0776d..50f5fc4 100644 --- a/src/components/Form/src/jeecg/components/JSearchSelect.vue +++ b/src/components/Form/src/jeecg/components/JSearchSelect.vue @@ -14,7 +14,7 @@ @focus="handleAsyncFocus" @search="loadData" @change="handleAsyncChange" - @popupScroll="handlePopupScroll" + @popup-scroll="handlePopupScroll" :mode="multiple?'multiple':''" @select="handleSelect" @deselect="handleDeSelect" @@ -176,7 +176,7 @@ isHasData = true; searchKeyword = value; // update-end--author:liaozhiyang---date:20240731---for:【TV360X-1898】JsearchSelect组件传入字典表格式则支持滚动加载 - + lastLoad.value += 1; const currentLoad = unref(lastLoad); options.value = []; @@ -399,7 +399,7 @@ callback(); } } - + /** * 异步值取消选中事件 * @param selectedObj @@ -423,7 +423,7 @@ } } //update-end---author:wangshuai---date:2025-04-17---for:【issues/8101】前端dict组件导致内存溢出问题:搜索组件支持多选--- - + /** *回调方法 * */ @@ -480,12 +480,12 @@ // 如果设定了排序信息,需要写入排序信息,在关键词后加 [orderby:create_time,desc] if(props.params && props.params.column && props.params.order){ let temp = text||'' - + //update-begin-author:taoyan date:2023-5-22 for: /issues/4905 表单生成器字段配置时,选择关联字段,在进行高级配置时,无法加载数据库列表,提示 Sgin签名校验错误! #4905 temp = temp+'[orderby:'+props.params.column+','+props.params.order+']' return encodeURI(temp); //update-end-author:taoyan date:2023-5-22 for: /issues/4905 表单生成器字段配置时,选择关联字段,在进行高级配置时,无法加载数据库列表,提示 Sgin签名校验错误! #4905 - + }else{ return text; } diff --git a/src/components/Modal/src/components/ModalWrapper.vue b/src/components/Modal/src/components/ModalWrapper.vue index b583f0f..a3b4b27 100644 --- a/src/components/Modal/src/components/ModalWrapper.vue +++ b/src/components/Modal/src/components/ModalWrapper.vue @@ -161,7 +161,6 @@ } async function setModalHeight(option?) { - console.log("---------性能监控--------setModalHeight----------") const options = option || {}; const source = options.source; const callBack = options.callBack; @@ -208,7 +207,7 @@ callBack(realHeightRef.value); } // update-end--author:liaozhiyang---date:2024-04-18---for:【QQYUN-9035】basicModal不设置maxHeight或height会一直执行setModalHeight,需即使销毁MutationObserver - + emit('height-change', unref(realHeightRef)); } catch (error) { console.log(error); diff --git a/src/views/base/item/Item.api.ts b/src/views/base/item/Item.api.ts index eb8660e..14a35fc 100644 --- a/src/views/base/item/Item.api.ts +++ b/src/views/base/item/Item.api.ts @@ -1,12 +1,13 @@ import { defHttp } from '/@/utils/http/axios'; -import { useMessage } from "/@/hooks/web/useMessage"; +import { useMessage } from '/@/hooks/web/useMessage'; const { createConfirm } = useMessage(); enum Api { list = '/base/item/list', - save='/base/item/add', - edit='/base/item/edit', + queryById = '/base/item/queryById', + save = '/base/item/add', + edit = '/base/item/edit', deleteOne = '/base/item/delete', deleteBatch = '/base/item/deleteBatch', importExcel = '/base/item/importExcel', @@ -30,16 +31,22 @@ export const getImportUrl = Api.importExcel; */ export const list = (params) => defHttp.get({ url: Api.list, params }); +/** + * id查询 + * @param params + */ +export const queryById = (params) => defHttp.get({ url: Api.queryById, params }); + /** * 删除单个 * @param params * @param handleSuccess */ -export const deleteOne = (params,handleSuccess) => { - return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { +export const deleteOne = (params, handleSuccess) => { + return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); -} +}; /** * 批量删除 @@ -54,12 +61,20 @@ export const batchDelete = (params, handleSuccess) => { okText: '确认', cancelText: '取消', onOk: () => { - return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { - handleSuccess(); - }); - } + return defHttp + .delete( + { + url: Api.deleteBatch, + data: params, + }, + { joinParamsToUrl: true } + ) + .then(() => { + handleSuccess(); + }); + }, }); -} +}; /** * 保存或者更新 @@ -67,6 +82,6 @@ export const batchDelete = (params, handleSuccess) => { * @param isUpdate */ export const saveOrUpdate = (params, isUpdate) => { - let url = isUpdate ? Api.edit : Api.save; + const url = isUpdate ? Api.edit : Api.save; return defHttp.post({ url: url, params }, { isTransformResponse: false }); -} +}; diff --git a/src/views/base/item/components/ItemSelect.vue b/src/views/base/item/components/ItemSelect.vue new file mode 100644 index 0000000..cc94a12 --- /dev/null +++ b/src/views/base/item/components/ItemSelect.vue @@ -0,0 +1,416 @@ + + + + + + diff --git a/src/views/base/point/Point.api.ts b/src/views/base/point/Point.api.ts index 144fe02..b525f13 100644 --- a/src/views/base/point/Point.api.ts +++ b/src/views/base/point/Point.api.ts @@ -5,6 +5,7 @@ const { createConfirm } = useMessage(); enum Api { list = '/base/point/list', + queryById='/base/point/queryById', save='/base/point/add', edit='/base/point/edit', deleteOne = '/base/point/delete', @@ -30,6 +31,13 @@ export const getImportUrl = Api.importExcel; */ export const list = (params) => defHttp.get({ url: Api.list, params }); + +/** + * id查询 + * @param params + */ +export const queryById = (params) => defHttp.get({ url: Api.queryById, params }); + /** * 删除单个 * @param params @@ -67,6 +75,6 @@ export const batchDelete = (params, handleSuccess) => { * @param isUpdate */ export const saveOrUpdate = (params, isUpdate) => { - let url = isUpdate ? Api.edit : Api.save; + const url = isUpdate ? Api.edit : Api.save; return defHttp.post({ url: url, params }, { isTransformResponse: false }); } diff --git a/src/views/base/point/PointList.vue b/src/views/base/point/PointList.vue index dd22297..702d2cd 100644 --- a/src/views/base/point/PointList.vue +++ b/src/views/base/point/PointList.vue @@ -92,8 +92,6 @@ import { columns } from './Point.data'; import { list, deleteOne, batchDelete, saveOrUpdate, getImportUrl, getExportUrl } from './Point.api'; import PointModal from './components/PointModal.vue'; - import { useUserStore } from '/@/store/modules/user'; - import { useMessage } from '/@/hooks/web/useMessage'; import { getDateByPicker } from '/@/utils'; import { JInputTypeEnum } from '@/enums/cpteEnum'; import JInput from '../../../components/Form/src/jeecg/components/JInput.vue'; @@ -106,8 +104,6 @@ const queryParam = reactive({}); const toggleSearchStatus = ref(false); const registerModal = ref(); - const userStore = useUserStore(); - const { createMessage } = useMessage(); //将是否启用转换成开关 const enhancedColumns = columns.map((col) => { @@ -135,7 +131,7 @@ }); //注册table数据 - const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ + const { tableContext, onExportXls, onImportXls } = useListPage({ tableProps: { title: '库位', api: list, @@ -169,8 +165,7 @@ success: handleSuccess, }, }); - const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = - tableContext; + const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const labelCol = reactive({ xs: 24, sm: 4, diff --git a/src/views/base/point/components/PointSelect.vue b/src/views/base/point/components/PointSelect.vue index 6d02926..8fdd648 100644 --- a/src/views/base/point/components/PointSelect.vue +++ b/src/views/base/point/components/PointSelect.vue @@ -1,4 +1,4 @@ - + - + {{ getOptionLabel(option) }} @@ -31,6 +31,7 @@ import { useAttrs } from '/@/hooks/core/useAttrs'; import { propTypes } from '/@/utils/propTypes'; import { defHttp } from '/@/utils/http/axios'; + import { queryById } from '@/views/base/point/Point.api'; import { setPopContainer } from '/@/utils'; import { debounce } from 'lodash-es'; @@ -63,7 +64,7 @@ // 是否异步加载数据 async: propTypes.bool.def(true), // 分页大小 - pageSize: propTypes.number.def(20), + pageSize: propTypes.number.def(10), // 弹出层容器 popContainer: propTypes.string, // 自定义弹出层容器函数 @@ -80,7 +81,7 @@ }, emits: ['change', 'update:value', 'optionsLoaded'], setup(props, { emit }) { - const PointOptions = ref([]); + const Options = ref([]); const loading = ref(false); const allPoints = ref([]); const attrs = useAttrs({ excludeDefaultKeys: false }); @@ -103,7 +104,7 @@ * 获取选项显示文本 - 始终显示完整格式 */ function getOptionLabel(option: Point) { - return `${option.pointCode} - ${option.areaId_dictText }`; + return `${option.pointCode} - ${option.areaId_dictText}`; } /** @@ -141,10 +142,19 @@ return true; // 禁用前端过滤,完全依赖后端搜索 } + /** + * 确保库位唯一性的辅助函数 + */ + function ensureUnique(Points: Point[], newPoint: Point): Point[] { + // 如果已经存在相同id的库位,先移除旧的再添加新的 + const filtered = Points.filter(Point => Point.id !== newPoint.id); + return [newPoint, ...filtered]; + } + /** * 获取库位数据 */ - const fetchPoints = async (page = 1, keyword = '', isSearch = false) => { + const queryData = async (page = 1, keyword = '', isSearch = false) => { try { loading.value = true; @@ -158,29 +168,29 @@ }, }); - console.log('获取库位数据成功:', res); const records = res.records || []; if (page === 1 || isSearch) { // 第一页或搜索时,重置数据 allPoints.value = records; - PointOptions.value = records; + Options.value = records; } else { - // 滚动加载时,追加数据 - allPoints.value = [...allPoints.value, ...records]; - PointOptions.value = [...PointOptions.value, ...records]; + // 滚动加载时,追加数据(确保不重复) + const newRecords = records.filter(record => + !allPoints.value.some(Point => Point.id === record.id) + ); + allPoints.value = [...allPoints.value, ...newRecords]; + Options.value = [...Options.value, ...newRecords]; } // 修正分页判断逻辑 isHasData.value = records.length >= props.pageSize; - console.log('是否还有更多数据:', records.length); emit('optionsLoaded', allPoints.value); } catch (error) { - console.error('获取库位数据失败:', error); if (page === 1) { allPoints.value = []; - PointOptions.value = []; + Options.value = []; } } finally { loading.value = false; @@ -188,14 +198,33 @@ } }; + async function queryDataById(value: string) { + try { + const res = await queryById({ id: value }); + if (res) { + // 将查询到的单个库位信息添加到列表中,确保唯一性 + const Point = Array.isArray(res) ? res[0] : res; + if (Point) { + // 使用ensureUnique确保库位不重复 + allPoints.value = ensureUnique(allPoints.value, Point); + Options.value = ensureUnique(Options.value, Point); + } + return Point; + } + } catch (error) { + console.error('查询库位失败:', error); + } + return null; + } + /** * 根据选项值找到对应的选项对象 */ function findOptionByValue(value: string): Point | undefined { if (props.returnValue === 'object' || props.returnValue === 'id') { - return allPoints.value.find((item) => item.id === value); + return allPoints.value.find((Point) => Point.id === value); } else { - return allPoints.value.find((item) => item[props.returnValue as keyof Point] === value); + return allPoints.value.find((Point) => Point[props.returnValue as keyof Point] === value); } } @@ -242,7 +271,7 @@ isHasData.value = true; // 直接调用API进行搜索 - fetchPoints(1, value, true); + queryData(1, value, true); }, 300); /** @@ -253,7 +282,7 @@ if (allPoints.value.length === 0 && props.async) { pageNo.value = 1; isHasData.value = true; - fetchPoints(1, ''); + queryData(1, ''); } attrs.onFocus?.(); } @@ -266,7 +295,6 @@ // 根据配置返回相应的值 const returnValue = getReturnValue(value); - console.log('值变化:', returnValue); emit('update:value', returnValue); emit('change', returnValue); } @@ -279,11 +307,10 @@ const { scrollTop, scrollHeight, clientHeight } = target; if (!scrollLoading.value && isHasData.value && scrollTop + clientHeight >= scrollHeight - 10) { - console.log('滚动加载更多'); scrollLoading.value = true; pageNo.value++; - fetchPoints(pageNo.value, searchKeyword.value) + queryData(pageNo.value, searchKeyword.value) .finally(() => { scrollLoading.value = false; }) @@ -304,22 +331,50 @@ // 如果是异步模式且还没有加载数据,则先加载数据 if (props.async && allPoints.value.length === 0) { - await fetchPoints(); + await queryData(); } // 根据不同的returnValue设置选中的值 + let valueIds: string[] = []; + if (props.returnValue === 'object') { // 如果返回的是对象,value可能是对象或对象数组 if (Array.isArray(props.value)) { - selectedValue.value = props.value.map((item: any) => item.id); + valueIds = props.value.map((Point: any) => Point.id); + selectedValue.value = valueIds; } else { - selectedValue.value = (props.value as any).id; + valueIds = [(props.value as any).id]; + selectedValue.value = valueIds[0]; } } else if (props.returnValue === 'id') { - selectedValue.value = props.value as string | string[]; + if (Array.isArray(props.value)) { + valueIds = props.value as string[]; + selectedValue.value = valueIds; + } else { + valueIds = [props.value as string]; + selectedValue.value = valueIds[0]; + } } else { // 对于其他字段类型,直接使用传入的值 selectedValue.value = props.value as string | string[]; + // 这里需要根据字段值查找对应的ID + if (Array.isArray(props.value)) { + valueIds = props.value.map((v) => { + const option = allPoints.value.find((Point) => Point[props.returnValue as keyof Point] === v); + return option ? option.id : v; + }); + } else { + const option = allPoints.value.find((Point) => Point[props.returnValue as keyof Point] === props.value); + valueIds = option ? [option.id] : [props.value as string]; + } + } + + // 检查是否有值不在当前列表中,如果有则查询 + const missingIds = valueIds.filter((id) => !allPoints.value.some((Point) => Point.id === id)); + if (missingIds.length > 0) { + // 对每个不在列表中的ID进行查询 + const queryPromises = missingIds.map((id) => queryDataById(id)); + await Promise.all(queryPromises); } }; @@ -335,13 +390,13 @@ // 组件挂载时初始化 onMounted(() => { if (!props.async) { - fetchPoints(); + queryData(); } }); return { attrs, - PointOptions, + Options, loading, selectedValue, notFoundContent, diff --git a/src/views/base/stock/Stock.api.ts b/src/views/base/stock/Stock.api.ts index 12d2ab7..39df320 100644 --- a/src/views/base/stock/Stock.api.ts +++ b/src/views/base/stock/Stock.api.ts @@ -5,6 +5,7 @@ const { createConfirm } = useMessage(); enum Api { list = '/base/stock/list', + queryById='/base/stock/queryById', save='/base/stock/add', edit='/base/stock/edit', deleteOne = '/base/stock/delete', @@ -30,6 +31,12 @@ export const getImportUrl = Api.importExcel; */ export const list = (params) => defHttp.get({ url: Api.list, params }); +/** + * id查询 + * @param params + */ +export const queryById = (params) => defHttp.get({ url: Api.queryById, params }); + /** * 删除单个 * @param params diff --git a/src/views/base/stock/StockList.vue b/src/views/base/stock/StockList.vue index 193ac07..a2e2292 100644 --- a/src/views/base/stock/StockList.vue +++ b/src/views/base/stock/StockList.vue @@ -13,12 +13,7 @@ - + @@ -99,7 +94,7 @@ import { JDictSelectTag, JSearchSelect } from '@/components/Form'; import { JInputTypeEnum } from '@/enums/cpteEnum'; import JInput from '../../../components/Form/src/jeecg/components/JInput.vue'; - + import PointSelect from '@/views/base/point/components/PointSelect.vue'; const fieldPickers = reactive({}); const formRef = ref(); diff --git a/src/views/base/stock/components/StockForm.vue b/src/views/base/stock/components/StockForm.vue index d9ed8c2..847c155 100644 --- a/src/views/base/stock/components/StockForm.vue +++ b/src/views/base/stock/components/StockForm.vue @@ -27,12 +27,7 @@ - + @@ -60,8 +55,9 @@ import { Form } from 'ant-design-vue'; import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; import JSwitch from '@/components/Form/src/jeecg/components/JSwitch.vue'; - import { JDictSelectTag, JSearchSelect } from '@/components/Form'; + import { JDictSelectTag } from '@/components/Form'; import { getTenantId } from '@/utils/auth'; + import PointSelect from '@/views/base/point/components/PointSelect.vue'; const props = defineProps({ formDisabled: { type: Boolean, default: false }, diff --git a/src/views/base/stock/components/StockSelect.vue b/src/views/base/stock/components/StockSelect.vue new file mode 100644 index 0000000..4520894 --- /dev/null +++ b/src/views/base/stock/components/StockSelect.vue @@ -0,0 +1,415 @@ + + + + + + diff --git a/src/views/conveyorLine/WcsMonitor.vue b/src/views/conveyorLine/WcsMonitor.vue index 58ffc70..f0a3062 100644 --- a/src/views/conveyorLine/WcsMonitor.vue +++ b/src/views/conveyorLine/WcsMonitor.vue @@ -31,7 +31,7 @@
- 当前扫描 + 当前托盘 CURRENT SCAN
@@ -123,7 +123,7 @@ }); async function queryData() { - const conveyorLine = 'CKJBK01'; + const conveyorLine = 'ST102'; const res = await showConveyorLine(conveyorLine); scanData.value = { stockCode: res.stockCode, diff --git a/src/views/inventory/Inventory.data.ts b/src/views/inventory/Inventory.data.ts index 0b34842..1a9afd8 100644 --- a/src/views/inventory/Inventory.data.ts +++ b/src/views/inventory/Inventory.data.ts @@ -1,4 +1,5 @@ import { BasicColumn } from '/@/components/Table'; +import { render } from '@/utils/common/renderUtils'; //列表数据 export const columns: BasicColumn[] = [ { @@ -36,7 +37,19 @@ export const columns: BasicColumn[] = [ align: 'center', dataIndex: 'status_dictText', width: 100, - + customRender: ({ text }) => { + const statusColorMap = { + 禁用: 'red', + 可用: 'green', + 已分配: 'orange', + 出库中: 'cyan', + 移位中: 'blue', + 盘点中: 'purple', + 冻结: 'pink', + }; + const color = statusColorMap[text] || 'red'; + return render.renderTag(text, color); + }, }, { title: '外部仓库', diff --git a/src/views/inventory/InventoryList.vue b/src/views/inventory/InventoryList.vue index be96ba1..67b5716 100644 --- a/src/views/inventory/InventoryList.vue +++ b/src/views/inventory/InventoryList.vue @@ -7,34 +7,19 @@ - + - + - + @@ -52,7 +37,7 @@ - + @@ -90,7 +75,7 @@ - + @@ -108,6 +93,9 @@ import { useMessage } from '/@/hooks/web/useMessage'; import { getDateByPicker } from '/@/utils'; import { JDictSelectTag, JSearchSelect } from '@/components/Form'; + import ItemSelect from '@/views/base/item/components/ItemSelect.vue'; + import PointSelect from '@/views/base/point/components/PointSelect.vue'; + import StockSelect from '@/views/base/stock/components/StockSelect.vue'; const fieldPickers = reactive({}); diff --git a/src/views/inventory/components/InventoryForm.vue b/src/views/inventory/components/InventoryForm.vue index aafcb28..f532453 100644 --- a/src/views/inventory/components/InventoryForm.vue +++ b/src/views/inventory/components/InventoryForm.vue @@ -6,32 +6,17 @@ - + - + - + @@ -41,9 +26,32 @@ + + + + + - + + + + + + + + + + + + + @@ -63,17 +71,6 @@ - - - - - @@ -103,7 +100,10 @@ import { saveOrUpdate } from '../Inventory.api'; import { Form } from 'ant-design-vue'; import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; - import { JDictSelectTag, JSearchSelect } from '@/components/Form'; + import { JDictSelectTag } from '@/components/Form'; + import ItemSelect from '@/views/base/item/components/ItemSelect.vue'; + import PointSelect from '@/views/base/point/components/PointSelect.vue'; + import StockSelect from '@/views/base/stock/components/StockSelect.vue'; const props = defineProps({ formDisabled: { type: Boolean, default: false }, @@ -117,17 +117,17 @@ let tenantId = getTenantId(); const formData = reactive>({ id: '', - itemId: undefined, - pointId: undefined, - stockId: undefined, + itemId: '', + pointId: '', + stockId: '', quantity: '', queuedQty: 0, whCode: '', + project: '', + taskNo: '', propC1: '', - propC2: '', propC3: '', - status: '', - propD1: '', + status: 1, description: '', tenantId: tenantId, }); diff --git a/src/views/inventory/components/InventoryModal.vue b/src/views/inventory/components/InventoryModal.vue index 0a0e463..5d46301 100644 --- a/src/views/inventory/components/InventoryModal.vue +++ b/src/views/inventory/components/InventoryModal.vue @@ -1,18 +1,27 @@ -