Commit 15ab89c5 by 史雅文

库存盘点新增弹窗添加筛选

parent d02b3597
...@@ -9,14 +9,14 @@ VITE_PUBLIC_PATH = / ...@@ -9,14 +9,14 @@ VITE_PUBLIC_PATH = /
# 可以有多个,注意多个不能换行,否则代理将会失效 # 可以有多个,注意多个不能换行,否则代理将会失效
# VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]] # VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
# VITE_PROXY=[["/api","https://vvbin.cn/test"]] # VITE_PROXY=[["/api","https://vvbin.cn/test"]]
VITE_PROXY = [["/system","http://192.168.8.149:8053"],["/language","http://192.168.8.149:8053"],["/api","http://192.168.8.149:8053"]] VITE_PROXY = [["/system","http://192.168.8.106:8053"],["/language","http://192.168.8.49:8053"],["/api","http://192.168.8.49:8053"]]
# 是否删除Console.log # 是否删除Console.log
VITE_DROP_CONSOLE = false VITE_DROP_CONSOLE = false
# 接口地址 # 接口地址
# 如果没有跨域问题,直接在这里配置即可 # 如果没有跨域问题,直接在这里配置即可
VITE_GLOB_API_URL=http://192.168.8.100:8053 VITE_GLOB_API_URL=http://192.168.8.49:8053
# 文件上传接口 可选 # 文件上传接口 可选
VITE_GLOB_UPLOAD_URL = /system/oss/upload VITE_GLOB_UPLOAD_URL = /system/oss/upload
......
import {
import { MesWarehouseInventoryPageModel, MesWarehouseInventoryPageParams, MesWarehouseInventoryPageResult } from './model/KcpdModel'; InventoryFilterParams,
InventoryItem,
MesWarehouseInventoryPageModel,
MesWarehouseInventoryPageParams,
MesWarehouseInventoryPageResult,
} from './model/KcpdModel';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
...@@ -8,16 +13,14 @@ enum Api { ...@@ -8,16 +13,14 @@ enum Api {
List = '/ckgl/kcpd/list', List = '/ckgl/kcpd/list',
Info = '/ckgl/kcpd/info', Info = '/ckgl/kcpd/info',
MesWarehouseInventory = '/ckgl/kcpd', MesWarehouseInventory = '/ckgl/kcpd',
Inventory = '/ckgl/kczb/Inventory',
Export = '/ckgl/kcpd/export', Export = '/ckgl/kcpd/export',
} }
/** export async function getMesWarehouseInventoryPage(
* @description: 查询MesWarehouseInventory分页列表 params: MesWarehouseInventoryPageParams,
*/ mode: ErrorMessageMode = 'modal',
export async function getMesWarehouseInventoryPage(params: MesWarehouseInventoryPageParams, mode: ErrorMessageMode = 'modal') { ) {
return defHttp.get<MesWarehouseInventoryPageResult>( return defHttp.get<MesWarehouseInventoryPageResult>(
{ {
url: Api.Page, url: Api.Page,
...@@ -29,9 +32,6 @@ export async function getMesWarehouseInventoryPage(params: MesWarehouseInventory ...@@ -29,9 +32,6 @@ export async function getMesWarehouseInventoryPage(params: MesWarehouseInventory
); );
} }
/**
* @description: 获取MesWarehouseInventory信息
*/
export async function getMesWarehouseInventory(id: String, mode: ErrorMessageMode = 'modal') { export async function getMesWarehouseInventory(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesWarehouseInventoryPageModel>( return defHttp.get<MesWarehouseInventoryPageModel>(
{ {
...@@ -44,10 +44,10 @@ export async function getMesWarehouseInventory(id: String, mode: ErrorMessageMod ...@@ -44,10 +44,10 @@ export async function getMesWarehouseInventory(id: String, mode: ErrorMessageMod
); );
} }
/** export async function addMesWarehouseInventory(
* @description: 新增MesWarehouseInventory mesWarehouseInventory: Recordable,
*/ mode: ErrorMessageMode = 'modal',
export async function addMesWarehouseInventory(mesWarehouseInventory: Recordable, mode: ErrorMessageMode = 'modal') { ) {
return defHttp.post<boolean>( return defHttp.post<boolean>(
{ {
url: Api.MesWarehouseInventory, url: Api.MesWarehouseInventory,
...@@ -59,10 +59,10 @@ export async function addMesWarehouseInventory(mesWarehouseInventory: Recordable ...@@ -59,10 +59,10 @@ export async function addMesWarehouseInventory(mesWarehouseInventory: Recordable
); );
} }
/** export async function updateMesWarehouseInventory(
* @description: 更新MesWarehouseInventory mesWarehouseInventory: Recordable,
*/ mode: ErrorMessageMode = 'modal',
export async function updateMesWarehouseInventory(mesWarehouseInventory: Recordable, mode: ErrorMessageMode = 'modal') { ) {
return defHttp.put<boolean>( return defHttp.put<boolean>(
{ {
url: Api.MesWarehouseInventory, url: Api.MesWarehouseInventory,
...@@ -74,9 +74,6 @@ export async function updateMesWarehouseInventory(mesWarehouseInventory: Recorda ...@@ -74,9 +74,6 @@ export async function updateMesWarehouseInventory(mesWarehouseInventory: Recorda
); );
} }
/**
* @description: 删除MesWarehouseInventory(批量删除)
*/
export async function deleteMesWarehouseInventory(ids: string[], mode: ErrorMessageMode = 'modal') { export async function deleteMesWarehouseInventory(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>( return defHttp.delete<boolean>(
{ {
...@@ -89,14 +86,9 @@ export async function deleteMesWarehouseInventory(ids: string[], mode: ErrorMess ...@@ -89,14 +86,9 @@ export async function deleteMesWarehouseInventory(ids: string[], mode: ErrorMess
); );
} }
/**
* @description: 导出MesWarehouseInventory
*/
export async function exportMesWarehouseInventory( export async function exportMesWarehouseInventory(
params?: object, params?: object,
mode: ErrorMessageMode = 'modal' mode: ErrorMessageMode = 'modal',
) { ) {
return defHttp.download( return defHttp.download(
{ {
...@@ -110,5 +102,18 @@ export async function exportMesWarehouseInventory( ...@@ -110,5 +102,18 @@ export async function exportMesWarehouseInventory(
}, },
); );
} }
export async function getInventoryByFilter(
params: InventoryFilterParams,
mode: ErrorMessageMode = 'modal',
) {
return defHttp.post<{ data: InventoryItem[]; success: boolean; msg?: string; code?: number }>(
{
url: Api.Inventory,
data: params,
},
{
errorMessageMode: mode,
},
);
}
...@@ -212,3 +212,20 @@ export interface MesWarehouseInventoryRelaModel { ...@@ -212,3 +212,20 @@ export interface MesWarehouseInventoryRelaModel {
* @description: MesWarehouseInventory分页返回值结构 * @description: MesWarehouseInventory分页返回值结构
*/ */
export type MesWarehouseInventoryPageResult = BasicFetchResult<MesWarehouseInventoryPageModel>; export type MesWarehouseInventoryPageResult = BasicFetchResult<MesWarehouseInventoryPageModel>;
export interface InventoryFilterParams {
ckwz: string[];
cplx: string[];
cp: string[];
}
export interface InventoryItem {
id: string;
cpmc: string;
cplx: string;
ck: string;
hw: string;
pch: string;
pdsl: number | null;
zbid: string;
}
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
function customClick(item) { function customClick(item) {
if (item.key == 'confirm') { if (item.key == 'confirm') {
handleSubmit(); handleSubmit();
} else if (item.key == 'cancel' && props.formType !== 'normal') { } else if (item.key == 'cancel') {
handleClose(); handleClose();
closeModal(); closeModal();
} else if (item.key == 'reset') { } else if (item.key == 'reset') {
......
import { FormProps, FormSchema } from '/@/components/Form'; import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { getInventoryByFilter } from '/@/api/ckgl/kcpd';
import type { InventoryFilterParams, InventoryItem } from '/@/api/ckgl/kcpd/model/KcpdModel';
const parseSelectValueToArray = (value: unknown): string[] => {
if (Array.isArray(value)) return value.filter(Boolean) as string[];
if (typeof value === 'string') {
return value
? value
.split(',')
.map((s) => s.trim())
.filter(Boolean)
: [];
}
if (value === undefined || value === null || value === '') return [];
return [String(value)];
};
async function handleStartInventory(_schema, formModel, formActionType) {
if (formModel?.id) {
formActionType?.showMessage?.('编辑状态不可开始盘点');
return;
}
const payload: InventoryFilterParams = {
// 这里的 ckwz/cp 在 schema 中已配置为保存 label(名称)
ckwz: parseSelectValueToArray(formModel?.ckwz),
cplx: parseSelectValueToArray(formModel?.cplx),
cp: parseSelectValueToArray(formModel?.cp),
};
console.log('[库存盘点] 请求参数:', payload);
if (!payload.ckwz.length && !payload.cplx.length && !payload.cp.length) {
formActionType?.showMessage?.('请先选择仓库位置、产品类型或产品');
return;
}
try {
const res = await getInventoryByFilter(payload, 'message');
console.log('[库存盘点] /ckgl/kczb/Inventory 返回:', res);
// 注意:defHttp 可能已解包,res 可能直接就是 data 数组
const inventoryList = Array.isArray(res) ? res : res?.data || [];
console.log('[库存盘点] /ckgl/kczb/Inventory 解析后的列表:', inventoryList);
const list =
(inventoryList || []).map((item: InventoryItem) => ({
id: item.id,
cp: item.cpmc,
cplx: item.cplx,
wz: item.hw,
pch: item.pch,
pdsl: item.pdsl ?? 0,
zbid: item.zbid,
})) || [];
await formActionType?.setFieldsValue?.({ mesWarehouseInventoryRelaList: list });
formActionType?.showMessage?.(list.length ? '开始盘点成功' : '未查询到匹配数据');
} catch (error) {
console.error('开始盘点失败', error);
formActionType?.showMessage?.('开始盘点失败,请稍后重试');
}
}
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
...@@ -160,6 +219,7 @@ export const formProps: FormProps = { ...@@ -160,6 +219,7 @@ export const formProps: FormProps = {
labelAlign: 'right', labelAlign: 'right',
layout: 'horizontal', layout: 'horizontal',
size: 'default', size: 'default',
buttonList: [],
schemas: [ schemas: [
{ {
key: '44f1b3495b854c708ce9f13c0e6afc94', key: '44f1b3495b854c708ce9f13c0e6afc94',
...@@ -201,7 +261,7 @@ export const formProps: FormProps = { ...@@ -201,7 +261,7 @@ export const formProps: FormProps = {
disabled: false, disabled: false,
isShow: true, isShow: true,
margin: '10px', margin: '10px',
events: { click: "formActionType.showMessage('开始盘点')" }, events: { click: handleStartInventory },
type: 1, type: 1,
event: [], event: [],
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
...@@ -335,8 +395,8 @@ export const formProps: FormProps = { ...@@ -335,8 +395,8 @@ export const formProps: FormProps = {
span: 4, span: 4,
placeholder: '请选择仓库位置', placeholder: '请选择仓库位置',
showLabel: true, showLabel: true,
showSearch: false, showSearch: true,
isMultiple: false, isMultiple: true,
clearable: false, clearable: false,
disabled: false, disabled: false,
staticOptions: [ staticOptions: [
...@@ -346,7 +406,8 @@ export const formProps: FormProps = { ...@@ -346,7 +406,8 @@ export const formProps: FormProps = {
], ],
datasourceType: 'api', datasourceType: 'api',
labelField: 'label', labelField: 'label',
valueField: 'value', // 保存名称(=label),开始盘点接口要求传名称
valueField: 'label',
apiConfig: { apiConfig: {
path: '/getStoreLocation', path: '/getStoreLocation',
method: 'GET', method: 'GET',
...@@ -386,8 +447,8 @@ export const formProps: FormProps = { ...@@ -386,8 +447,8 @@ export const formProps: FormProps = {
span: 4, span: 4,
placeholder: '请选择产品类型类型', placeholder: '请选择产品类型类型',
showLabel: true, showLabel: true,
showSearch: false, showSearch: true,
isMultiple: false, isMultiple: true,
clearable: false, clearable: false,
disabled: false, disabled: false,
staticOptions: [ staticOptions: [
...@@ -431,8 +492,8 @@ export const formProps: FormProps = { ...@@ -431,8 +492,8 @@ export const formProps: FormProps = {
span: 4, span: 4,
placeholder: '请选择产品', placeholder: '请选择产品',
showLabel: true, showLabel: true,
showSearch: false, showSearch: true,
isMultiple: false, isMultiple: true,
clearable: false, clearable: false,
disabled: false, disabled: false,
staticOptions: [ staticOptions: [
...@@ -442,7 +503,8 @@ export const formProps: FormProps = { ...@@ -442,7 +503,8 @@ export const formProps: FormProps = {
], ],
datasourceType: 'api', datasourceType: 'api',
labelField: 'label', labelField: 'label',
valueField: 'value', // 保存名称(=label),开始盘点接口要求传名称
valueField: 'label',
apiConfig: { apiConfig: {
path: '/scgl/scjh/getAllProduct', path: '/scgl/scjh/getAllProduct',
method: 'GET', method: 'GET',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment