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

View File

@@ -183,8 +183,15 @@
</template> </template>
<script setup lang="ts" name="SearchForm"> <script setup lang="ts" name="SearchForm">
import { verificationInput } from "./components/utils/verificationInput"; import { verificationInput } from "./components/utils/verificationInput";
import { getSupplierApi, getCustomersApi, getProductLinesApi } from "@/api/modules/global"; import {
import { getSetWarehouseKingdeeListApi, getSetWarehouseSubwarehousesListApi } from "@/api/modules/setWarehouse"; getSupplierApi,
getCustomersApi,
getProductLinesApi,
getWarehousesKingdeeListApi,
getSubwarehouseskingdeeListApi
} from "@/api/modules/global";
// // getWarehousesKingdeeListApi getSubwarehouseskingdeeListApi getWarehousesJushuitanListApi getWarehousesLingXingListApi
// import { getWarehousesKingdeeListApi, getSubwarehouseskingdeeListApi } from "@/api/modules/setWarehouse";
const props = defineProps<{ const props = defineProps<{
formData: any[]; formData: any[];
searchParams: Record<string, any>; searchParams: Record<string, any>;
@@ -269,12 +276,11 @@ const getProductLines = async (keywords: any, item: any) => {
//金蝶仓库 //金蝶仓库
const getSetWarehouseKingdeeList = async (keywords: any, item: any) => { const getSetWarehouseKingdeeList = async (keywords: any, item: any) => {
if (Array.isArray(_searchParams.value.use_org_number) ** _searchParams.value.use_org_number.length) {
item.options = []; item.options = [];
let use_org_number = ""; let use_org_number = "";
if (Array.isArray(_searchParams.value.use_org_number) ** _searchParams.value.use_org_number.length) {
use_org_number = _searchParams.value.use_org_number.join(","); use_org_number = _searchParams.value.use_org_number.join(",");
} const result = await getWarehousesKingdeeListApi({
const result = await getSetWarehouseKingdeeListApi({
keywords: keywords, keywords: keywords,
use_org_number use_org_number
}); });
@@ -289,16 +295,16 @@ const getSetWarehouseKingdeeList = async (keywords: any, item: any) => {
}); });
item.options = options; item.options = options;
} }
}
}; };
//获取金蝶子仓库 //获取金蝶子仓库
const getSetWarehouseSubwarehousesList = async (keywords: any, item: any) => { const getSetWarehouseSubwarehousesList = async (keywords: any, item: any) => {
if (Array.isArray(_searchParams?.value?.kd_warehouse_number) ** _searchParams?.value?.kd_warehouse_number?.length) {
//先清空一下 //先清空一下
item.options = []; item.options = [];
let kd_warehouse_number = ""; let kd_warehouse_number = "";
if (Array.isArray(_searchParams.value.kd_warehouse_number) ** _searchParams.value.kd_warehouse_number.length) {
kd_warehouse_number = _searchParams.value.kd_warehouse_number.join(","); kd_warehouse_number = _searchParams.value.kd_warehouse_number.join(",");
} const result = await getSubwarehouseskingdeeListApi({
const result = await getSetWarehouseSubwarehousesListApi({
keywords, keywords,
warehouse_number: kd_warehouse_number warehouse_number: kd_warehouse_number
}); });
@@ -313,6 +319,7 @@ const getSetWarehouseSubwarehousesList = async (keywords: any, item: any) => {
}); });
item.options = options; item.options = options;
} }
}
}; };
//多选远程搜索 //多选远程搜索
@@ -348,7 +355,7 @@ const handleTagRemove = (item: any) => {
item.options = []; item.options = [];
} }
const { prop } = item; 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] }); 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(","); state.totalParam.kd_warehouse_number = state.totalParam.kd_warehouse_number.join(",");
} }
//金蝶子仓库 //金蝶子仓库
if (Array.isArray(state.totalParam?.kd_subwarehouse) && state.totalParam?.kd_subwarehouse?.length) { if (Array.isArray(state.totalParam?.kd_subwarehouse_number) && state.totalParam?.kd_subwarehouse_number?.length) {
state.totalParam.kd_subwarehouse = state.totalParam.kd_subwarehouse.join(","); 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; 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; return breadcrumbData;

View File

@@ -34,7 +34,7 @@ import PermissionButton from "@/components/PermissionButton/index.vue";
import { getMaterialListApi } from "@/api/modules/foundationMaterial"; import { getMaterialListApi } from "@/api/modules/foundationMaterial";
// import { useMsg } from "@/hooks/useMsg"; // import { useMsg } from "@/hooks/useMsg";
import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index"; import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index";
// import { getWarehousesListApi } from "@/api/modules/global";
// 表格TS // 表格TS
import { ProTableInstance } from "@/components/ProTable/interface"; import { ProTableInstance } from "@/components/ProTable/interface";
@@ -62,7 +62,7 @@ const selectionChange = (selection: any) => {
// 顶部按钮点击事件 // 顶部按钮点击事件
const handleButtonClickCallback = (item: any) => { const handleButtonClickCallback = (item: any) => {
console.log(item); 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 handleButtonClickCallback = (item: any) => {
const { type } = item; const { type } = item;
btnClick[type]({ btnClick[type]({
selectionList: dataStore.selectionList, selectionList: dataStore.selectionList,
proTableRef, proTableRef,

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
// import { RenderScope } from "@/components/ProTable/interface"; import { RenderScope } from "@/components/ProTable/interface";
export const COLUMNS = [ export const COLUMNS = [
{ type: "selection", fixed: "left", width: 40 }, { type: "selection", fixed: "left", width: 40 },
{ {
@@ -18,9 +18,18 @@ export const COLUMNS = [
{ {
align: "left", align: "left",
label: "金蝶子仓库", label: "金蝶子仓库",
prop: "kd_subwarehouse", prop: "kd_subwarehouse_number",
width: 400,
fixed: true, 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", align: "left",
@@ -34,15 +43,22 @@ export const COLUMNS = [
prop: "lx_warehouse_name", prop: "lx_warehouse_name",
width: 200 width: 200
}, },
{
align: "left",
label: "备注",
prop: "remark",
width: 200
},
{ {
align: "left", align: "left",
label: "更新人", label: "更新人",
prop: "creator" prop: "operator"
}, },
{ {
align: "left", align: "left",
label: "更新时间", label: "更新时间",
prop: "created_at" prop: "updated_at",
width: 200
} }
]; ];

View File

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