Compare commits

2 Commits

Author SHA1 Message Date
b0e729f9c0 fix: 🧩 修复金蝶仓库和子仓库options无法清空 2025-11-08 10:40:06 +08:00
caf79bae5a feat: 🚀 仓库关系查询-详情-更新 2025-11-08 09:48:16 +08:00
11 changed files with 158 additions and 102 deletions

View File

@@ -29,3 +29,19 @@ export const getProductLinesApi = (params: any) => {
export const getWarehousesListApi = () => {
return http.get<any>(`basicinfo/warehouses`);
};
//获取金蝶仓库
export const getWarehousesKingdeeListApi = (params: any) => {
return http.get<any>(`basicinfo/warehouses/kingdee`, params);
};
//获取金蝶子仓库
export const getSubwarehouseskingdeeListApi = (params: any) => {
return http.get<any>(`basicinfo/subwarehouses/kingdee`, params);
};
//获取聚水潭仓库 /admapi/basicinfo/warehouses/jushuitan
export const getWarehousesJushuitanListApi = (params: any) => {
return http.get<any>(`basicinfo/warehouses/jushuitan`, params);
};
export const getWarehousesLingXingListApi = (params: any) => {
return http.get<any>(`basicinfo/warehouses/lingxing`, params);
};

View File

@@ -22,18 +22,18 @@ export const getWarehouseDetailsApi = (id: any) => {
return http.get<any>(`warehouse/relationship/${id}`);
};
//获取金蝶仓库
export const getSetWarehouseKingdeeListApi = (params: any) => {
return http.get<any>(`basicinfo/warehouses/kingdee`, params);
};
//获取金蝶子仓库
export const getSetWarehouseSubwarehousesListApi = (params: any) => {
return http.get<any>(`basicinfo/subwarehouses/kingdee`, params);
};
//获取聚水潭仓库 /admapi/basicinfo/warehouses/jushuitan
export const getSetWarehouseSubwarehousesJushuitanListApi = (params: any) => {
return http.get<any>(`basicinfo/warehouses/jushuitan`, params);
};
export const getSetWarehouseSubwarehousesLingXingListApi = (params: any) => {
return http.get<any>(`basicinfo/warehouses/lingxing`, params);
};
// //获取金蝶仓库
// export const getSetWarehouseKingdeeListApi = (params: any) => {
// return http.get<any>(`basicinfo/warehouses/kingdee`, params);
// };
// //获取金蝶子仓库
// export const getSetWarehouseSubwarehousesListApi = (params: any) => {
// return http.get<any>(`basicinfo/subwarehouses/kingdee`, params);
// };
// //获取聚水潭仓库 /admapi/basicinfo/warehouses/jushuitan
// export const getSetWarehouseSubwarehousesJushuitanListApi = (params: any) => {
// return http.get<any>(`basicinfo/warehouses/jushuitan`, params);
// };
// export const getSetWarehouseSubwarehousesLingXingListApi = (params: any) => {
// return http.get<any>(`basicinfo/warehouses/lingxing`, params);
// };

View File

@@ -183,8 +183,15 @@
</template>
<script setup lang="ts" name="SearchForm">
import { verificationInput } from "./components/utils/verificationInput";
import { getSupplierApi, getCustomersApi, getProductLinesApi } from "@/api/modules/global";
import { getSetWarehouseKingdeeListApi, getSetWarehouseSubwarehousesListApi } from "@/api/modules/setWarehouse";
import {
getSupplierApi,
getCustomersApi,
getProductLinesApi,
getWarehousesKingdeeListApi,
getSubwarehouseskingdeeListApi
} from "@/api/modules/global";
// // getWarehousesKingdeeListApi getSubwarehouseskingdeeListApi getWarehousesJushuitanListApi getWarehousesLingXingListApi
// import { getWarehousesKingdeeListApi, getSubwarehouseskingdeeListApi } from "@/api/modules/setWarehouse";
const props = defineProps<{
formData: any[];
searchParams: Record<string, any>;
@@ -269,49 +276,49 @@ const getProductLines = async (keywords: any, item: any) => {
//金蝶仓库
const getSetWarehouseKingdeeList = async (keywords: any, item: any) => {
item.options = [];
let use_org_number = "";
if (Array.isArray(_searchParams.value.use_org_number) ** _searchParams.value.use_org_number.length) {
item.options = [];
let use_org_number = "";
use_org_number = _searchParams.value.use_org_number.join(",");
}
const result = await getSetWarehouseKingdeeListApi({
keywords: keywords,
use_org_number
});
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((it: any) => {
options.push({
label: it.warehouse_name,
value: it.warehouse_number,
use_org_number: it.use_org_number
});
const result = await getWarehousesKingdeeListApi({
keywords: keywords,
use_org_number
});
item.options = options;
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((it: any) => {
options.push({
label: it.warehouse_name,
value: it.warehouse_number,
use_org_number: it.use_org_number
});
});
item.options = options;
}
}
};
//获取金蝶子仓库
const getSetWarehouseSubwarehousesList = async (keywords: any, item: any) => {
//先清空一下
item.options = [];
let kd_warehouse_number = "";
if (Array.isArray(_searchParams.value.kd_warehouse_number) ** _searchParams.value.kd_warehouse_number.length) {
if (Array.isArray(_searchParams?.value?.kd_warehouse_number) ** _searchParams?.value?.kd_warehouse_number?.length) {
//先清空一下
item.options = [];
let kd_warehouse_number = "";
kd_warehouse_number = _searchParams.value.kd_warehouse_number.join(",");
}
const result = await getSetWarehouseSubwarehousesListApi({
keywords,
warehouse_number: kd_warehouse_number
});
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((it: any) => {
options.push({
label: it.sub_warehouse_name,
value: it.sub_warehouse_number,
warehouse_number: it.warehouse_number
});
const result = await getSubwarehouseskingdeeListApi({
keywords,
warehouse_number: kd_warehouse_number
});
item.options = options;
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((it: any) => {
options.push({
label: it.sub_warehouse_name,
value: it.sub_warehouse_number,
warehouse_number: it.warehouse_number
});
});
item.options = options;
}
}
};
@@ -348,7 +355,7 @@ const handleTagRemove = (item: any) => {
item.options = [];
}
const { prop } = item;
if (prop === "kd_warehouse_number" || prop === "kd_subwarehouse") {
if (prop === "kd_warehouse_number" || prop === "kd_subwarehouse_number") {
emits("selectMultipleRemoveTag", { item, org_number: _searchParams.value[prop] });
}
};

View File

@@ -73,8 +73,8 @@ export const useTable = (
state.totalParam.kd_warehouse_number = state.totalParam.kd_warehouse_number.join(",");
}
//金蝶子仓库
if (Array.isArray(state.totalParam?.kd_subwarehouse) && state.totalParam?.kd_subwarehouse?.length) {
state.totalParam.kd_subwarehouse = state.totalParam.kd_subwarehouse.join(",");
if (Array.isArray(state.totalParam?.kd_subwarehouse_number) && state.totalParam?.kd_subwarehouse_number?.length) {
state.totalParam.kd_subwarehouse_number = state.totalParam.kd_subwarehouse_number.join(",");
}
}
};

View File

@@ -41,7 +41,13 @@ const breadcrumbList = computed(() => {
item.meta.title = route.query.title;
}
});
console.log("");
}
if (route.query.title === "新增仓位找货优先级" || "编辑仓位找货优先级") {
breadcrumbData.forEach((item: any) => {
if (item.name === "foundationSetGoodsAdd") {
item.meta.title = route.query.title;
}
});
}
return breadcrumbData;

View File

@@ -34,7 +34,7 @@ import PermissionButton from "@/components/PermissionButton/index.vue";
import { getMaterialListApi } from "@/api/modules/foundationMaterial";
// import { useMsg } from "@/hooks/useMsg";
import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index";
// import { getWarehousesListApi } from "@/api/modules/global";
// 表格TS
import { ProTableInstance } from "@/components/ProTable/interface";
@@ -62,7 +62,7 @@ const selectionChange = (selection: any) => {
// 顶部按钮点击事件
const handleButtonClickCallback = (item: any) => {
console.log(item);
$router.push({ path: "/foundation/set/goods/add" });
$router.push({ path: "/foundation/set/goods/add", query: { title: "编辑仓位找货优先级" } });
};
// 搜索

View File

@@ -66,7 +66,6 @@ const selectionChange = (selection: any) => {
};
const handleButtonClickCallback = (item: any) => {
const { type } = item;
btnClick[type]({
selectionList: dataStore.selectionList,
proTableRef,

View File

@@ -20,7 +20,7 @@ export const DETAILS_FORM_DATA: any[] = [
options: []
},
{
prop: "kd_subwarehouse",
prop: "kd_subwarehouse_number",
placeholder: "请选择",
type: "selectMultiples",
label: "金蝶子仓库:",

View File

@@ -30,15 +30,16 @@ export const FORM_DATA: FormItem[] = [
label: "金蝶仓库: ",
options: []
},
{
prop: "kd_subwarehouse",
prop: "kd_subwarehouse_number",
placeholder: "请输入金蝶子仓库",
type: "selectRemoteKDSubwarehouse",
label: "金蝶子仓库: ",
options: []
},
{
prop: "operator_name",
prop: "operator",
placeholder: "请输入更新人",
type: "input",
label: "更新人: "

View File

@@ -1,4 +1,4 @@
// import { RenderScope } from "@/components/ProTable/interface";
import { RenderScope } from "@/components/ProTable/interface";
export const COLUMNS = [
{ type: "selection", fixed: "left", width: 40 },
{
@@ -18,9 +18,18 @@ export const COLUMNS = [
{
align: "left",
label: "金蝶子仓库",
prop: "kd_subwarehouse",
prop: "kd_subwarehouse_number",
width: 400,
fixed: true,
width: 200
render: (scope: RenderScope<any>): VNode | string | any => {
let arr: any = [];
if (Array.isArray(scope.row.kd_subwarehouse) && scope.row.kd_subwarehouse.length) {
scope.row.kd_subwarehouse?.forEach((item: any) => {
arr.push(item.subwarehouse_name);
});
}
return Array.isArray(arr) && arr.length ? arr.join(",") : "";
}
},
{
align: "left",
@@ -34,15 +43,22 @@ export const COLUMNS = [
prop: "lx_warehouse_name",
width: 200
},
{
align: "left",
label: "备注",
prop: "remark",
width: 200
},
{
align: "left",
label: "更新人",
prop: "creator"
prop: "operator"
},
{
align: "left",
label: "更新时间",
prop: "created_at"
prop: "updated_at",
width: 200
}
];

View File

@@ -40,9 +40,10 @@
@selectMultipleRemoveTag="handleSelectMultipleRemoveTag"
/>
</template>
<template #platform_store_name="scope">
<template #kd_warehouse_name="scope">
<a @click="handleOpen(scope.row)" class="break-word to-details">
{{ scope.row.platform_store_name }}
{{ scope.row.kd_warehouse_name }}
</a>
</template>
</ProTable>
@@ -60,12 +61,15 @@ import {
getWarehouseDelApi,
getWarehouseAddApi,
getWarehouseUpApi,
getWarehouseDetailsApi,
getSetWarehouseKingdeeListApi,
getSetWarehouseSubwarehousesListApi,
getSetWarehouseSubwarehousesLingXingListApi,
getSetWarehouseSubwarehousesJushuitanListApi
getWarehouseDetailsApi
} from "@/api/modules/setWarehouse";
import {
getWarehousesKingdeeListApi,
getSubwarehouseskingdeeListApi,
getWarehousesJushuitanListApi,
getWarehousesLingXingListApi
} from "@/api/modules/global";
import { useMsg } from "@/hooks/useMsg";
import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index";
import { DETAILS_RULE_FORM, DETAILS_FORM_DATA } from "./constant/list/details";
@@ -156,14 +160,26 @@ const getWarehouseDetails = async (id: any) => {
if (result?.code === 0) {
dataStore.dialogVisible = true;
dataStore.title = "编辑金蝶子仓与各系统仓库关系";
setAccessSystem(result?.data?.access_system);
dataStore.detailsRuleForm = result?.data;
//临时变量存储金蝶和金蝶子仓库
let kd_warehouse_number = dataStore?.detailsRuleForm?.kd_warehouse_number;
let kd_subwarehouse = dataStore?.detailsRuleForm?.kd_subwarehouse;
//判断金蝶仓库和金蝶子仓库是否存在
if (kd_warehouse_number && Array.isArray(kd_subwarehouse) && kd_subwarehouse.length) {
let kd_subwarehouse_number: any[] = [];
dataStore?.detailsRuleForm?.kd_subwarehouse?.forEach((item: any) => {
kd_subwarehouse_number.push(item.subwarehouse_number);
});
nextTick(() => {
dataStore.detailsRuleForm.kd_subwarehouse_number = kd_subwarehouse_number;
});
}
}
};
//获取金蝶仓库
const getSetWarehouseKingdeeList = async () => {
dataStore.detailsFormData[1].options = [];
const result = await getSetWarehouseKingdeeListApi({ use_org_number: dataStore.detailsRuleForm.use_org_number });
const result = await getWarehousesKingdeeListApi({ use_org_number: dataStore.detailsRuleForm.use_org_number });
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
@@ -179,7 +195,7 @@ const getSetWarehouseKingdeeList = async () => {
const getSetWarehouseSubwarehousesList = async () => {
//先清空一下
dataStore.detailsFormData[2].options = [];
const result = await getSetWarehouseSubwarehousesListApi({
const result = await getSubwarehouseskingdeeListApi({
warehouse_number: dataStore.detailsRuleForm.kd_warehouse_number
});
if (result?.code === 0) {
@@ -196,7 +212,7 @@ const getSetWarehouseSubwarehousesList = async () => {
//获取领星仓库
const getSetWarehouseSubwarehousesLingXingList = async () => {
const result = await getSetWarehouseSubwarehousesLingXingListApi();
const result = await getWarehousesLingXingListApi();
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
@@ -210,7 +226,7 @@ const getSetWarehouseSubwarehousesLingXingList = async () => {
};
//获取聚水潭仓库
const getSetWarehouseSubwarehousesJushuitanList = async () => {
const result = await getSetWarehouseSubwarehousesJushuitanListApi();
const result = await getWarehousesJushuitanListApi();
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
@@ -259,9 +275,9 @@ const handleCommit = () => {
return useMsg("warning", "金蝶仓库不能为空 !");
}
//将金蝶子仓库转换为字符串
let kd_subwarehouse = params.kd_subwarehouse;
if (Array.isArray(kd_subwarehouse) && kd_subwarehouse.length) {
params.kd_subwarehouse = kd_subwarehouse.join(",");
let kd_subwarehouse_number = params.kd_subwarehouse_number;
if (Array.isArray(kd_subwarehouse_number) && kd_subwarehouse_number.length) {
params.kd_subwarehouse_number = kd_subwarehouse_number.join(",");
}
if (dataStore.title === "新增金蝶子仓与各系统仓库关系") {
@@ -292,6 +308,8 @@ const handleSelectMultipleDClear = (params: any) => {
item: { prop }
} = params;
dataStore.detailsRuleForm[prop] = "";
// if(dataStore.)
// console.log("1232322222222");
};
/**
* 监听查询条件标签关闭统一处理组织、仓库、子仓库联动修复split类型错误
@@ -301,20 +319,6 @@ const handleSelectMultipleRemoveTag = (params: any) => {
const { item } = params;
const { prop } = item;
const paramValue = dataStore.initParam[prop]; // 获取当前参数值
console.log(paramValue, "=============");
// // 核心:兼容多种参数类型,解析为「去重数组」(容错处理)
// let remainingValues: string[] = [];
// if (typeof paramValue === "string" && paramValue.trim()) {
// // 情况1参数是有效字符串 → 分割为数组
// remainingValues = Array.from(new Set(paramValue.split(",").filter(val => val.trim())));
// } else if (Array.isArray(paramValue)) {
// // 情况2参数是数组 → 直接去重
// remainingValues = Array.from(new Set(paramValue.filter(val => val && val.trim())));
// } else {
// // 情况3参数是undefined/null/空值 → 空数组
// remainingValues = [];
// }
// 根据字段标识分发处理逻辑
switch (prop) {
case "use_org_number":
@@ -323,7 +327,7 @@ const handleSelectMultipleRemoveTag = (params: any) => {
case "kd_warehouse_number":
handleKdWarehouseTagRemove(paramValue);
break;
case "kd_subwarehouse":
case "kd_subwarehouse_number":
handleKdSubWarehouseTagRemove(paramValue);
break;
default:
@@ -352,7 +356,7 @@ const handleOrgTagRemove = (remainingOrgValues: any[]) => {
dataStore.formData[1].options = filteredWarehouses;
// 4. 重置子仓库状态(仓库变化后必须清空)
dataStore.initParam.kd_subwarehouse = "";
dataStore.initParam.kd_subwarehouse_number = "";
dataStore.formData[2].options = [];
};
@@ -373,7 +377,7 @@ const handleKdWarehouseTagRemove = (remainingWarehouseValues: any[]) => {
}
// 3. 重置子仓库状态(清空已选+更新选项)
dataStore.initParam.kd_subwarehouse = "";
dataStore.initParam.kd_subwarehouse_number = "";
dataStore.formData[2].options = [];
dataStore.formData[2].options = filteredSubWarehouses;
};
@@ -391,8 +395,11 @@ watch(
() => dataStore.dialogVisible,
(newVal: any) => {
if (newVal) {
//金蝶倉庫
getSetWarehouseKingdeeList();
//领星仓库
getSetWarehouseSubwarehousesLingXingList();
//聚水潭仓库
getSetWarehouseSubwarehousesJushuitanList();
}
},
@@ -404,13 +411,16 @@ watch(
watch(
() => dataStore.detailsRuleForm.use_org_number,
(newVal: any) => {
console.log(newVal, "==============value=============");
if (newVal) {
dataStore.detailsRuleForm.kd_warehouse_number = "";
dataStore.detailsRuleForm.kd_subwarehouse = "";
dataStore.detailsRuleForm.kd_subwarehouse_number = "";
getSetWarehouseKingdeeList();
} else {
dataStore.detailsRuleForm.kd_warehouse_number = "";
dataStore.detailsRuleForm.kd_subwarehouse = "";
dataStore.detailsRuleForm.kd_subwarehouse_number = "";
dataStore.detailsFormData[1].options = [];
dataStore.detailsFormData[2].options = [];
}
}
);
@@ -419,10 +429,11 @@ watch(
() => dataStore.detailsRuleForm.kd_warehouse_number,
(newVal: any) => {
if (newVal) {
dataStore.detailsRuleForm.kd_subwarehouse = "";
dataStore.detailsRuleForm.kd_subwarehouse_number = "";
getSetWarehouseSubwarehousesList();
} else {
dataStore.detailsRuleForm.kd_subwarehouse = "";
dataStore.detailsRuleForm.kd_subwarehouse_number = "";
dataStore.detailsFormData[2].options = [];
}
}
);