Compare commits

2 Commits

Author SHA1 Message Date
cad97ac4fd fix: 🧩 修复关闭标签对应的关联无法清空 2025-11-07 17:48:36 +08:00
1e80affb50 feat: 🚀 查询条件关联关系处理 2025-11-07 17:43:03 +08:00
9 changed files with 472 additions and 136 deletions

View File

@@ -1,10 +1,10 @@
import http from "@/api"; import http from "@/api";
// //列表
export const getSetWarehouseListApi = (params: any) => { export const getSetWarehouseListApi = (params: any) => {
return http.get<any>(`store`, params); return http.get<any>(`warehouse/relationship`, params);
}; };
// getWarehouseUpApi,getWarehouseDetailsApi,getWarehouseUpApi
//删除 //删除
export const getWarehouseDelApi = (params: any) => { export const getWarehouseDelApi = (params: any) => {
return http.delete<any>(`warehouse/relationship/${params}`); return http.delete<any>(`warehouse/relationship/${params}`);
@@ -18,10 +18,22 @@ export const getWarehouseUpApi = (id: any, params: any) => {
return http.post<any>(`warehouse/relationship/${id}`, params); return http.post<any>(`warehouse/relationship/${id}`, params);
}; };
//详情 //详情
// export const getWarehouseDetailsApi = (id: any) => { export const getWarehouseDetailsApi = (id: any) => {
// return http.get<any>(`store/${id}`); return http.get<any>(`warehouse/relationship/${id}`);
// }; };
// //导出
// export const getShopListExportApi = (params: any) => { //获取金蝶仓库
// return http.get<any>(`store/export`, 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);
};

122
src/components.d.ts vendored
View File

@@ -5,65 +5,65 @@
// Read more: https://github.com/vuejs/core/pull/3399 // Read more: https://github.com/vuejs/core/pull/3399
export {} export {}
declare module "vue" { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
403: typeof import("./components/ErrorMessage/403.vue")["default"]; 403: typeof import('./components/ErrorMessage/403.vue')['default']
404: typeof import("./components/ErrorMessage/404.vue")["default"]; 404: typeof import('./components/ErrorMessage/404.vue')['default']
500: typeof import("./components/ErrorMessage/500.vue")["default"]; 500: typeof import('./components/ErrorMessage/500.vue')['default']
ColSetting: typeof import("./components/ProTable/components/ColSetting.vue")["default"]; ColSetting: typeof import('./components/ProTable/components/ColSetting.vue')['default']
DetailsSearch: typeof import("./components/DetailsSearch/index.vue")["default"]; DetailsSearch: typeof import('./components/DetailsSearch/index.vue')['default']
ElAside: typeof import("element-plus/es")["ElAside"]; ElAside: typeof import('element-plus/es')['ElAside']
ElBreadcrumb: typeof import("element-plus/es")["ElBreadcrumb"]; ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
ElBreadcrumbItem: typeof import("element-plus/es")["ElBreadcrumbItem"]; ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import("element-plus/es")["ElButton"]; ElButton: typeof import('element-plus/es')['ElButton']
ElContainer: typeof import("element-plus/es")["ElContainer"]; ElContainer: typeof import('element-plus/es')['ElContainer']
ElDatePicker: typeof import("element-plus/es")["ElDatePicker"]; ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDialog: typeof import("element-plus/es")["ElDialog"]; ElDialog: typeof import('element-plus/es')['ElDialog']
ElDrawer: typeof import("element-plus/es")["ElDrawer"]; ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import("element-plus/es")["ElDropdown"]; ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import("element-plus/es")["ElDropdownItem"]; ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import("element-plus/es")["ElDropdownMenu"]; ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElForm: typeof import("element-plus/es")["ElForm"]; ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import("element-plus/es")["ElFormItem"]; ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import("element-plus/es")["ElHeader"]; ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import("element-plus/es")["ElIcon"]; ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import("element-plus/es")["ElInput"]; ElInput: typeof import('element-plus/es')['ElInput']
ElMain: typeof import("element-plus/es")["ElMain"]; ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import("element-plus/es")["ElMenu"]; ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import("element-plus/es")["ElMenuItem"]; ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import("element-plus/es")["ElOption"]; ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import("element-plus/es")["ElPagination"]; ElPagination: typeof import('element-plus/es')['ElPagination']
ElScrollbar: typeof import("element-plus/es")["ElScrollbar"]; ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import("element-plus/es")["ElSelect"]; ElSelect: typeof import('element-plus/es')['ElSelect']
ElSubMenu: typeof import("element-plus/es")["ElSubMenu"]; ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import("element-plus/es")["ElSwitch"]; ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import("element-plus/es")["ElTable"]; ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import("element-plus/es")["ElTableColumn"]; ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import("element-plus/es")["ElTabPane"]; ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import("element-plus/es")["ElTabs"]; ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import("element-plus/es")["ElTag"]; ElTag: typeof import('element-plus/es')['ElTag']
Empty: typeof import("./components/ProTable/components/Empty.vue")["default"]; Empty: typeof import('./components/ProTable/components/Empty.vue')['default']
Form: typeof import("./components/Form/index.vue")["default"]; Form: typeof import('./components/Form/index.vue')['default']
FormItem: typeof import("./components/Form/components/FormItem.vue")["default"]; FormItem: typeof import('./components/Form/components/FormItem.vue')['default']
FormTable: typeof import("./components/FormTable/index.vue")["default"]; FormTable: typeof import('./components/FormTable/index.vue')['default']
Grid: typeof import("./components/Grid/index.vue")["default"]; Grid: typeof import('./components/Grid/index.vue')['default']
GridItem: typeof import("./components/Grid/components/GridItem.vue")["default"]; GridItem: typeof import('./components/Grid/components/GridItem.vue')['default']
IEpArrowDown: typeof import("~icons/ep/arrow-down")["default"]; IEpArrowDown: typeof import('~icons/ep/arrow-down')['default']
IEpCircleClose: typeof import("~icons/ep/circle-close")["default"]; IEpCircleClose: typeof import('~icons/ep/circle-close')['default']
IEpFolderDelete: typeof import("~icons/ep/folder-delete")["default"]; IEpFolderDelete: typeof import('~icons/ep/folder-delete')['default']
IEpFullScreen: typeof import("~icons/ep/full-screen")["default"]; IEpFullScreen: typeof import('~icons/ep/full-screen')['default']
IEpRefresh: typeof import("~icons/ep/refresh")["default"]; IEpRefresh: typeof import('~icons/ep/refresh')['default']
IEpRemove: typeof import("~icons/ep/remove")["default"]; IEpRemove: typeof import('~icons/ep/remove')['default']
IEpSwitchButton: typeof import("~icons/ep/switch-button")["default"]; IEpSwitchButton: typeof import('~icons/ep/switch-button')['default']
ImportExcel: typeof import("./components/ImportExcel/index.vue")["default"]; ImportExcel: typeof import('./components/ImportExcel/index.vue')['default']
Loading: typeof import("./components/Loading/index.vue")["default"]; Loading: typeof import('./components/Loading/index.vue')['default']
Pagination: typeof import("./components/ProTable/components/Pagination.vue")["default"]; Pagination: typeof import('./components/ProTable/components/Pagination.vue')['default']
PermissionButton: typeof import("./components/PermissionButton/index.vue")["default"]; PermissionButton: typeof import('./components/PermissionButton/index.vue')['default']
ProTable: typeof import("./components/ProTable/index.vue")["default"]; ProTable: typeof import('./components/ProTable/index.vue')['default']
RouterLink: typeof import("vue-router")["RouterLink"]; RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import("vue-router")["RouterView"]; RouterView: typeof import('vue-router')['RouterView']
SearchForm: typeof import("./components/SearchForm/index.vue")["default"]; SearchForm: typeof import('./components/SearchForm/index.vue')['default']
SearchFormItem: typeof import("./components/SearchForm/components/SearchFormItem.vue")["default"]; SearchFormItem: typeof import('./components/SearchForm/components/SearchFormItem.vue')['default']
TableColumn: typeof import("./components/ProTable/components/TableColumn.vue")["default"]; TableColumn: typeof import('./components/ProTable/components/TableColumn.vue')['default']
} }
} }

View File

@@ -76,13 +76,14 @@
/> />
</el-select> </el-select>
</template> </template>
<!-- 多选不带输入 -->
<template v-if="item.type === 'selectMultiples'"> <template v-if="item.type === 'selectMultiples'">
<el-select <el-select
v-model="_searchResult[`${item.prop}`]" v-model="_searchResult[`${item.prop}`]"
:placeholder="item.placeholder" :placeholder="item.placeholder"
clearable
multiple multiple
:disabled="item.disabled" :disabled="item.disabled"
style="max-height: 150px; overflow-y: auto"
> >
<el-option <el-option
v-for="option in item.options" v-for="option in item.options"
@@ -152,10 +153,30 @@
></el-option> ></el-option>
</el-select> </el-select>
</template> </template>
<!-- 单选带模糊搜索 -->
<template v-if="item.type === 'selectMultipleD'">
<el-select
v-model="_searchResult[`${item.prop}`]"
filterable
:reserve-keyword="false"
:disabled="item.disabled"
:placeholder="item.placeholder"
clearable
@clear="handleSelectMultipleDClear(item)"
>
<!-- 循环渲染选项label 为显示文本value 为实际提交值 -->
<el-option
v-for="option in item.options"
:key="option.value"
:label="option.label"
:value="option.value"
></el-option>
</el-select>
</template>
<!-- 客户也是多选带模糊搜搜 -->
<template <template
v-if="item.type === 'selectMultipleRemoteCustomersNames' || item.type === 'selectProductLinesRemote'" v-if="item.type === 'selectMultipleRemoteCustomersNames' || item.type === 'selectProductLinesRemote'"
> >
<!-- // filterable -->
<el-select <el-select
v-model="_searchResult[`${item.prop}`]" v-model="_searchResult[`${item.prop}`]"
:placeholder="item.placeholder" :placeholder="item.placeholder"
@@ -200,6 +221,7 @@ const props = defineProps<{
selectMultipleRemoveTag?: () => void; selectMultipleRemoveTag?: () => void;
selectMultipleRemoteTag1?: () => void; selectMultipleRemoteTag1?: () => void;
setRuleFormValue?: () => void; setRuleFormValue?: () => void;
selectMultipleDClear?: () => void;
}>(); }>();
let _searchResult = computed(() => { let _searchResult = computed(() => {
@@ -212,6 +234,7 @@ const emits = defineEmits<{
(e: "setRuleFormValue", result: Record<string, any>): void; (e: "setRuleFormValue", result: Record<string, any>): void;
(e: "selectMultipleRemoveTag", result: Record<string, any>): void; (e: "selectMultipleRemoveTag", result: Record<string, any>): void;
(e: "selectMultipleRemoteTag1", result: Record<string, any>): void; (e: "selectMultipleRemoteTag1", result: Record<string, any>): void;
(e: "selectMultipleDClear", result: Record<string, any>): void;
}>(); }>();
const handleRomoveTag = (item: any) => { const handleRomoveTag = (item: any) => {
@@ -222,6 +245,7 @@ const handleTagRemove1 = (item: any) => {
item.options = []; item.options = [];
} }
}; };
//客戶 //客戶
const getCustomers = async (keywords: any, item: any) => { const getCustomers = async (keywords: any, item: any) => {
let org_number = _searchResult.value.org_number.join(","); let org_number = _searchResult.value.org_number.join(",");
@@ -285,6 +309,10 @@ const getUsers = async (keywords: any, item: any) => {
} }
}; };
const handleSelectMultipleDClear = (item: any) => {
emits("selectMultipleDClear", { item });
};
//远程搜索多选 //远程搜索多选
const handleSelectMultipleRemote = (query: any, item: any) => { const handleSelectMultipleRemote = (query: any, item: any) => {
if (!query) { if (!query) {

View File

@@ -86,8 +86,15 @@
/> />
</el-select> </el-select>
</template> </template>
<!-- getProductLinesApi -->
<template v-if="item.type === 'selectMultipleRemote' || item.type === 'selectProductLinesRemote'"> <template
v-if="
item.type === 'selectMultipleRemote' ||
item.type === 'selectProductLinesRemote' ||
item.type === 'selectRemoteKD' ||
item.type === 'selectRemoteKDSubwarehouse'
"
>
<el-select <el-select
v-model.trim="_searchParams[`${item.prop}`]" v-model.trim="_searchParams[`${item.prop}`]"
:placeholder="item.placeholder" :placeholder="item.placeholder"
@@ -96,7 +103,6 @@
filterable filterable
:reserve-keyword="false" :reserve-keyword="false"
@remove-tag="handleTagRemove(item)" @remove-tag="handleTagRemove(item)"
@clear="handleClear(item)"
:loading="loading" :loading="loading"
class="m-2 select" class="m-2 select"
remote-show-suffix remote-show-suffix
@@ -178,6 +184,7 @@
<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 { getSupplierApi, getCustomersApi, getProductLinesApi } from "@/api/modules/global";
import { getSetWarehouseKingdeeListApi, getSetWarehouseSubwarehousesListApi } from "@/api/modules/setWarehouse";
const props = defineProps<{ const props = defineProps<{
formData: any[]; formData: any[];
searchParams: Record<string, any>; searchParams: Record<string, any>;
@@ -259,10 +266,57 @@ 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) {
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
});
});
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) {
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
});
});
item.options = options;
}
};
//多选远程搜索 //多选远程搜索
const handleSelectMultipleRemote = async (query: any, item: any) => { const handleSelectMultipleRemote = async (query: any, item: any) => {
console.log(remoteRef.value, "==========remoteRef=========");
loading.value = true; loading.value = true;
if (!query) { if (!query) {
loading.value = false; loading.value = false;
@@ -281,8 +335,11 @@ const handleSelectMultipleRemote = async (query: any, item: any) => {
getCustomers(valClone, item); getCustomers(valClone, item);
} else if (item.type === "selectProductLinesRemote") { } else if (item.type === "selectProductLinesRemote") {
//品线 //品线
getProductLines(valClone, item); getProductLines(valClone, item);
} else if (item.type === "selectRemoteKD") {
getSetWarehouseKingdeeList(valClone, item);
} else if (item.type === "selectRemoteKDSubwarehouse") {
getSetWarehouseSubwarehousesList(valClone, item);
} }
loading.value = false; loading.value = false;
}; };
@@ -290,9 +347,15 @@ const handleTagRemove = (item: any) => {
if (!_searchParams.value[item.prop].length) { if (!_searchParams.value[item.prop].length) {
item.options = []; item.options = [];
} }
const { prop } = item;
if (prop === "kd_warehouse_number" || prop === "kd_subwarehouse") {
emits("selectMultipleRemoveTag", { item, org_number: _searchParams.value[prop] });
}
}; };
const handleTagRemove1 = (item: any) => { const handleTagRemove1 = (item: any) => {
emits("selectMultipleRemoveTag", { item, org_number: _searchParams.value.org_number }); const { prop } = item;
console.log(prop);
emits("selectMultipleRemoveTag", { item, org_number: _searchParams.value[prop] });
}; };
//单选远程搜索(供应商) //单选远程搜索(供应商)
const remoteMethod = async (query: any, item: any) => { const remoteMethod = async (query: any, item: any) => {

View File

@@ -63,6 +63,20 @@ export const useTable = (
state.totalParam.subscriber_name = state.totalParam?.subscriber_name.replace(/[,]/g, ","); state.totalParam.subscriber_name = state.totalParam?.subscriber_name.replace(/[,]/g, ",");
} }
} }
if (routeName === "foundationSetWarehouse") {
//组织
if (Array.isArray(state.totalParam?.use_org_number) && state.totalParam?.use_org_number?.length) {
state.totalParam.use_org_number = state.totalParam.use_org_number.join(",");
}
//金蝶仓库
if (Array.isArray(state.totalParam?.kd_warehouse_number) && state.totalParam?.kd_warehouse_number?.length) {
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(",");
}
}
}; };
//删除临时参数和空值参数 //删除临时参数和空值参数

View File

@@ -2,47 +2,59 @@ export const DETAILS_FORM_DATA: any[] = [
{ {
prop: "use_org_number", prop: "use_org_number",
placeholder: "请输入", placeholder: "请输入",
type: "select", type: "selectMultipleD",
label: "组织:", label: "组织:",
disabled: false, disabled: false,
required: true, required: true,
class: "form-item1" class: "form-item1",
options: []
}, },
{ {
prop: "kd_warehouse_number ", prop: "kd_warehouse_number",
placeholder: "请输入", placeholder: "请选择",
type: "select", type: "selectMultipleD",
label: "金蝶仓库:", label: "金蝶仓库:",
disabled: false, disabled: false,
required: true, required: true,
class: "form-item1" class: "form-item1",
options: []
}, },
{ {
prop: "kd_subwarehouse ", prop: "kd_subwarehouse",
placeholder: "请选择", placeholder: "请选择",
type: "selectMultiples", type: "selectMultiples",
label: "金蝶子仓库:", label: "金蝶子仓库:",
disabled: false, disabled: false,
required: true, class: "form-item1",
class: "form-item1" options: []
}, },
{ {
prop: "jst_warehouse_number", prop: "jst_warehouse_number",
placeholder: "请输入", placeholder: "请选择",
type: "select", type: "select",
label: "对应聚水潭仓库:", label: "对应聚水潭仓库:",
disabled: false, disabled: false,
required: true, class: "form-item1",
options: []
class: "form-item1"
}, },
{ {
prop: "lx_warehouse_number", prop: "lx_warehouse_number",
placeholder: "请输入", placeholder: "请选择",
type: "select", type: "select",
label: "对应领星仓库:", label: "对应领星仓库:",
disabled: false, disabled: false,
required: true, class: "form-item1",
options: []
},
{
//textarea
prop: "remark",
placeholder: "请输入",
type: "textarea",
label: "备注:",
disabled: false,
maxLength: 5000,
class: "form-item1" class: "form-item1"
} }
]; ];

View File

@@ -26,14 +26,16 @@ export const FORM_DATA: FormItem[] = [
{ {
prop: "kd_warehouse_number", prop: "kd_warehouse_number",
placeholder: "请输入金蝶仓库", placeholder: "请输入金蝶仓库",
type: "input", type: "selectRemoteKD",
label: "金蝶仓库: " label: "金蝶仓库: ",
options: []
}, },
{ {
prop: "kd_subwarehouse", prop: "kd_subwarehouse",
placeholder: "请输入金蝶子仓库", placeholder: "请输入金蝶子仓库",
type: "input", type: "selectRemoteKDSubwarehouse",
label: "金蝶子仓库: " label: "金蝶子仓库: ",
options: []
}, },
{ {
prop: "operator_name", prop: "operator_name",

View File

@@ -5,44 +5,44 @@ export const COLUMNS = [
align: "left", align: "left",
fixed: true, fixed: true,
label: "金蝶仓库", label: "金蝶仓库",
prop: "material_number", prop: "kd_warehouse_name",
width: 200 width: 200
}, },
{ {
align: "left", align: "left",
fixed: true, fixed: true,
label: "组织", label: "组织",
prop: "use_org_number", prop: "use_org_name",
width: 200 width: 200
}, },
{ {
align: "left", align: "left",
label: "金蝶子仓库", label: "金蝶子仓库",
prop: "sku", prop: "kd_subwarehouse",
fixed: true, fixed: true,
width: 200 width: 200
}, },
{ {
align: "left", align: "left",
label: "对应聚水潭仓库", label: "对应聚水潭仓库",
prop: "material_name", prop: "jst_warehouse_name",
width: 200 width: 200
}, },
{ {
align: "left", align: "left",
label: "对应领星仓库", label: "对应领星仓库",
prop: "org_name", prop: "lx_warehouse_name",
width: 200 width: 200
}, },
{ {
align: "left", align: "left",
label: "更新人", label: "更新人",
prop: "product_line" prop: "creator"
}, },
{ {
align: "left", align: "left",
label: "更新时间", label: "更新时间",
prop: "bar_code" prop: "created_at"
} }
]; ];

View File

@@ -14,6 +14,7 @@
:labelWidth="dataStore.labelWidth" :labelWidth="dataStore.labelWidth"
:inline="true" :inline="true"
:isSearch="true" :isSearch="true"
@selectMultipleDClear="handleSelectMultipleDClear"
ref="detailsRef" ref="detailsRef"
/> />
<template #footer> <template #footer>
@@ -26,7 +27,7 @@
<ProTable <ProTable
ref="proTableRef" ref="proTableRef"
:columns="dataStore.columns" :columns="dataStore.columns"
:request-api="getShopListApi" :request-api="getSetWarehouseListApi"
:init-param="dataStore.initParam" :init-param="dataStore.initParam"
@selectionChange="selectionChange" @selectionChange="selectionChange"
> >
@@ -36,6 +37,7 @@
@reset="handleReset" @reset="handleReset"
:searchParams="dataStore.initParam" :searchParams="dataStore.initParam"
:formData="dataStore.formData" :formData="dataStore.formData"
@selectMultipleRemoveTag="handleSelectMultipleRemoveTag"
/> />
</template> </template>
<template #platform_store_name="scope"> <template #platform_store_name="scope">
@@ -47,13 +49,23 @@
</div> </div>
</template> </template>
<script setup lang="ts" name="foundationSetShop"> <script setup lang="ts" name="foundationSetWarehouse">
import ProTable from "@/components/ProTable/index.vue"; import ProTable from "@/components/ProTable/index.vue";
import SearchForm from "@/components/SearchForm/index.vue"; import SearchForm from "@/components/SearchForm/index.vue";
import PermissionButton from "@/components/PermissionButton/index.vue"; import PermissionButton from "@/components/PermissionButton/index.vue";
import { getShopListApi } from "@/api/modules/shop";
import { useUserStore } from "@/stores/modules/user"; import { useUserStore } from "@/stores/modules/user";
import { getWarehouseDelApi, getWarehouseAddApi, getWarehouseUpApi } from "@/api/modules/setWarehouse"; import {
getSetWarehouseListApi,
getWarehouseDelApi,
getWarehouseAddApi,
getWarehouseUpApi,
getWarehouseDetailsApi,
getSetWarehouseKingdeeListApi,
getSetWarehouseSubwarehousesListApi,
getSetWarehouseSubwarehousesLingXingListApi,
getSetWarehouseSubwarehousesJushuitanListApi
} from "@/api/modules/setWarehouse";
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";
@@ -117,8 +129,8 @@ const handleDel = () => {
} }
}; };
// 新增 // 新增
const getWarehouseAdd = async () => { const getWarehouseAdd = async (params: any) => {
const result = await getWarehouseAddApi(dataStore.detailsRuleForm); const result = await getWarehouseAddApi(params);
if (result?.code === 0) { if (result?.code === 0) {
useMsg("success", "新增成功 "); useMsg("success", "新增成功 ");
setTimeout(() => { setTimeout(() => {
@@ -128,8 +140,8 @@ const getWarehouseAdd = async () => {
} }
}; };
// 更新 // 更新
const getWarehouseUp = async () => { const getWarehouseUp = async (params: any) => {
const result = await getWarehouseUpApi(dataStore.rowId, dataStore.detailsRuleForm); const result = await getWarehouseUpApi(dataStore.rowId, params);
if (result?.code === 0) { if (result?.code === 0) {
useMsg("success", "更新成功 "); useMsg("success", "更新成功 ");
setTimeout(() => { setTimeout(() => {
@@ -139,8 +151,8 @@ const getWarehouseUp = async () => {
} }
}; };
// 详情 // 详情
const getShopDetails = async (id: any) => { const getWarehouseDetails = async (id: any) => {
const result = await getShopDetailsApi(id); const result = await getWarehouseDetailsApi(id);
if (result?.code === 0) { if (result?.code === 0) {
dataStore.dialogVisible = true; dataStore.dialogVisible = true;
dataStore.title = "编辑金蝶子仓与各系统仓库关系"; dataStore.title = "编辑金蝶子仓与各系统仓库关系";
@@ -148,19 +160,74 @@ const getShopDetails = async (id: any) => {
dataStore.detailsRuleForm = result?.data; dataStore.detailsRuleForm = result?.data;
} }
}; };
//获取金蝶仓库
const getSetWarehouseKingdeeList = async () => {
dataStore.detailsFormData[1].options = [];
const result = await getSetWarehouseKingdeeListApi({ use_org_number: dataStore.detailsRuleForm.use_org_number });
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
options.push({
label: item.warehouse_name,
value: item.warehouse_number
});
});
dataStore.detailsFormData[1].options = options;
}
};
//获取金蝶子仓库
const getSetWarehouseSubwarehousesList = async () => {
//先清空一下
dataStore.detailsFormData[2].options = [];
const result = await getSetWarehouseSubwarehousesListApi({
warehouse_number: dataStore.detailsRuleForm.kd_warehouse_number
});
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
options.push({
label: item.sub_warehouse_name,
value: item.sub_warehouse_number
});
});
dataStore.detailsFormData[2].options = options;
}
};
//获取领星仓库
const getSetWarehouseSubwarehousesLingXingList = async () => {
const result = await getSetWarehouseSubwarehousesLingXingListApi();
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
options.push({
label: item.warehouse_name,
value: item.warehouse_number + ""
});
});
dataStore.detailsFormData[4].options = options;
}
};
//获取聚水潭仓库
const getSetWarehouseSubwarehousesJushuitanList = async () => {
const result = await getSetWarehouseSubwarehousesJushuitanListApi();
if (result?.code === 0) {
let options: any = [];
result?.data?.forEach((item: any) => {
options.push({
label: item.warehouse_name,
value: item.warehouse_number + ""
});
});
dataStore.detailsFormData[3].options = options;
}
};
// 表格row点击事件 // 表格row点击事件
const handleOpen = (row: any) => { const handleOpen = (row: any) => {
dataStore.rowId = row.id; dataStore.rowId = row.id;
getShopDetails(row.id); getWarehouseDetails(row.id);
}; };
// 导出
const handleExport = async () => {
const result = await getShopListExportApi(dataStore.initParam);
if (result?.code === 0) {
useMsg("success", "导出成功请前往导出列表中进行下载 ");
}
};
// 顶部按钮点击事件 // 顶部按钮点击事件
const handleButtonClickCallback = (item: any) => { const handleButtonClickCallback = (item: any) => {
const { type } = item; const { type } = item;
@@ -184,25 +251,23 @@ const handleClose = () => {
// 弹窗确认 // 弹窗确认
const handleCommit = () => { const handleCommit = () => {
if (!dataStore.detailsRuleForm.use_org_number) { let params = cloneDeep(dataStore.detailsRuleForm);
if (!params.use_org_number) {
return useMsg("warning", "组织不能为空 !"); return useMsg("warning", "组织不能为空 !");
} }
if (!dataStore.detailsRuleForm.kd_warehouse_number) { if (!params.kd_warehouse_number) {
return useMsg("warning", "金蝶仓库不能为空 !"); return useMsg("warning", "金蝶仓库不能为空 !");
} }
if (!dataStore.detailsRuleForm.kd_subwarehouse) { //将金蝶子仓库转换为字符串
return useMsg("warning", "金蝶子仓库不能为空 !"); let kd_subwarehouse = params.kd_subwarehouse;
} if (Array.isArray(kd_subwarehouse) && kd_subwarehouse.length) {
if (!dataStore.detailsRuleForm.jst_warehouse_number) { params.kd_subwarehouse = kd_subwarehouse.join(",");
return useMsg("warning", "对应聚水潭仓库不能为空 !");
}
if (!dataStore.detailsRuleForm.lx_warehouse_number) {
return useMsg("warning", "对应对应领星仓库不能为空 !");
} }
if (dataStore.title === "新增金蝶子仓与各系统仓库关系") { if (dataStore.title === "新增金蝶子仓与各系统仓库关系") {
getWarehouseAdd(); getWarehouseAdd(params);
} else { } else {
getWarehouseUp(); getWarehouseUp(params);
} }
}; };
// 搜索 // 搜索
@@ -221,6 +286,146 @@ const handleReset = () => {
proTableRef?.value!.getTableList(); proTableRef?.value!.getTableList();
}); });
}; };
//监听组织和金蝶仓库清空按钮(会触发下面的watch)
const handleSelectMultipleDClear = (params: any) => {
const {
item: { prop }
} = params;
dataStore.detailsRuleForm[prop] = "";
};
/**
* 监听查询条件标签关闭统一处理组织、仓库、子仓库联动修复split类型错误
* @param params { item: { prop: string } } - 关闭标签的相关参数包含字段标识prop
*/
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":
handleOrgTagRemove(paramValue);
break;
case "kd_warehouse_number":
handleKdWarehouseTagRemove(paramValue);
break;
case "kd_subwarehouse":
handleKdSubWarehouseTagRemove(paramValue);
break;
default:
break;
}
};
/**
* 组织标签关闭处理(联动仓库、子仓库)
* @param remainingOrgValues 关闭后剩余的组织value数组["101"]、["101","115"]
*/
const handleOrgTagRemove = (remainingOrgValues: any[]) => {
// 2. 筛选仓库:基于原始金蝶仓库数据,聚合所有剩余组织对应的仓库(去重)
let filteredWarehouses = [];
if (remainingOrgValues.length > 0) {
filteredWarehouses = dataStore.formData[1].options.filter(warehouse =>
remainingOrgValues.includes(warehouse.use_org_number)
);
// 去重:避免同一仓库被多个组织关联导致重复
filteredWarehouses = Array.from(new Map(filteredWarehouses.map(item => [item.value, item])).values());
}
// 3. 重置仓库状态(清空已选+更新选项)
dataStore.initParam.kd_warehouse_number = "";
dataStore.formData[1].options = [];
dataStore.formData[1].options = filteredWarehouses;
// 4. 重置子仓库状态(仓库变化后必须清空)
dataStore.initParam.kd_subwarehouse = "";
dataStore.formData[2].options = [];
};
/**
* 金蝶仓库标签关闭处理(联动子仓库)
* @param remainingWarehouseValues 关闭后剩余的仓库value数组["AD"]、["AD","CK001"]
*/
const handleKdWarehouseTagRemove = (remainingWarehouseValues: any[]) => {
// 2. 筛选子仓库:基于原始金蝶子仓库数据,聚合所有剩余仓库对应的子仓库
let filteredSubWarehouses = [];
if (remainingWarehouseValues.length > 0) {
filteredSubWarehouses = dataStore.formData[2].options.filter(subWarehouse =>
remainingWarehouseValues.includes(subWarehouse.warehouse_number)
);
} else {
// 仓库全部关闭:显示所有原始子仓库数据
filteredSubWarehouses = [...dataStore.formData[2].options];
}
// 3. 重置子仓库状态(清空已选+更新选项)
dataStore.initParam.kd_subwarehouse = "";
dataStore.formData[2].options = [];
dataStore.formData[2].options = filteredSubWarehouses;
};
/**
* 金蝶子仓库标签关闭处理(仅更新自身,不联动上级)
* @param remainingSubWarehouseValues 关闭后剩余的子仓库value数组
*/
const handleKdSubWarehouseTagRemove = (remainingSubWarehouseValues: any[]) => {
// 同步表单已选值
dataStore.formData[2].options = remainingSubWarehouseValues;
};
// //监听弹窗开启
watch(
() => dataStore.dialogVisible,
(newVal: any) => {
if (newVal) {
getSetWarehouseKingdeeList();
getSetWarehouseSubwarehousesLingXingList();
getSetWarehouseSubwarehousesJushuitanList();
}
},
{
deep: true
}
);
//监听组织值改变(值改变关联关系需重置)
watch(
() => dataStore.detailsRuleForm.use_org_number,
(newVal: any) => {
if (newVal) {
dataStore.detailsRuleForm.kd_warehouse_number = "";
dataStore.detailsRuleForm.kd_subwarehouse = "";
getSetWarehouseKingdeeList();
} else {
dataStore.detailsRuleForm.kd_warehouse_number = "";
dataStore.detailsRuleForm.kd_subwarehouse = "";
}
}
);
//监听金蝶仓库值改变(值改变关联关系需重置)
watch(
() => dataStore.detailsRuleForm.kd_warehouse_number,
(newVal: any) => {
if (newVal) {
dataStore.detailsRuleForm.kd_subwarehouse = "";
getSetWarehouseSubwarehousesList();
} else {
dataStore.detailsRuleForm.kd_subwarehouse = "";
}
}
);
</script> </script>
<style scope lang="scss"> <style scope lang="scss">