feat: 🚀 仓库关系

This commit is contained in:
2025-11-07 09:46:06 +08:00
parent 1208835216
commit 107bd1a933
14 changed files with 604 additions and 97 deletions

View File

@@ -0,0 +1,27 @@
import http from "@/api";
//
export const getSetWarehouseListApi = (params: any) => {
return http.get<any>(`store`, params);
};
// getWarehouseUpApi,getWarehouseDetailsApi,getWarehouseUpApi
//删除
export const getWarehouseDelApi = (params: any) => {
return http.delete<any>(`warehouse/relationship/${params}`);
};
//新增 /admapi/warehouse/relationship
export const getWarehouseAddApi = (params: any) => {
return http.post<any>(`warehouse/relationship`, params);
};
//更新
export const getWarehouseUpApi = (id: any, params: any) => {
return http.post<any>(`warehouse/relationship/${id}`, params);
};
//详情
// export const getWarehouseDetailsApi = (id: any) => {
// return http.get<any>(`store/${id}`);
// };
// //导出
// export const getShopListExportApi = (params: any) => {
// return http.get<any>(`store/export`, params);
// };

View File

@@ -1,8 +1,8 @@
import http from "@/api";
//店鋪資料列表
export const getShopListApi = () => {
return http.get<any>(`store`);
export const getShopListApi = (params: any) => {
return http.get<any>(`store`, params);
};
//獲取接入系統列表數據
export const getShopAccessSystemApi = () => {
@@ -22,7 +22,7 @@ export const getShopUpApi = (id: any, params: any) => {
};
//详情
export const getShopDetailsApi = (id: any) => {
return http.post<any>(`store/${id}`);
return http.get<any>(`store/${id}`);
};
//导出
export const getShopListExportApi = (params: any) => {

View File

@@ -76,7 +76,22 @@
/>
</el-select>
</template>
<template v-if="item.type === 'selectMultiples'">
<el-select
v-model="_searchResult[`${item.prop}`]"
:placeholder="item.placeholder"
clearable
multiple
:disabled="item.disabled"
>
<el-option
v-for="option in item.options"
:label="option.label"
:value="option.value"
:key="option.label"
/>
</el-select>
</template>
<template v-if="item.type === 'date'">
<el-date-picker
:disabled="item.disabled"

View File

@@ -65,12 +65,6 @@ export const useTable = (
}
};
// //其他數據處理
// const initData = () => {
// if (state.totalParam?.warehouse_number) {
// state.totalParam.warehouse_number = state.totalParam?.warehouse_number.split("_")[0];
// }
// };
//删除临时参数和空值参数
const deleteParams = () => {
const KEY = ["Time", "customer_number1", "customer_numbers"];
@@ -86,7 +80,6 @@ export const useTable = (
*/
const getTableList = async () => {
if (!api) return;
try {
await initSubscribeData();
await deleteParams();
@@ -95,9 +88,7 @@ export const useTable = (
...state.totalParam,
...pageParam.value
};
const { data } = await api(params);
state.tableData = Array.isArray(data.data) && data.data.length ? data.data : [];
clearSelection && clearSelection();
if (isPageable && data.total_size !== undefined) {

View File

@@ -269,5 +269,5 @@
white-space: nowrap;
}
.el-message {
z-index: 555;
z-index: 888;
}

View File

@@ -164,7 +164,7 @@ export const DETAILS_FORM_DATA2: any[] = [
prop: "lingxing_store_number",
placeholder: "请输入",
type: "input",
label: " 领星店铺SellerID:",
label: "领星店铺SellerID:",
disabled: false,
required: true,
class: "form-item1"

View File

@@ -12,26 +12,22 @@ export const COLUMNS = [
align: "left",
label: "平台",
prop: "platform_name",
fixed: true,
width: 200
fixed: true
},
{
align: "left",
label: "订单接入系统",
prop: "access_system",
width: 200
prop: "access_system_name"
},
{
align: "left",
label: "聚水潭店铺名称",
prop: "jushuitan_store_name",
width: 200
prop: "jushuitan_store_name"
},
{
align: "left",
label: "领星店铺名称",
prop: "lingxing_store_name",
width: 200
prop: "lingxing_store_name"
},
{
align: "left",

View File

@@ -63,10 +63,10 @@ import {
import { useMsg } from "@/hooks/useMsg";
import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index";
import { DETAILS_RULE_FORM, DETAILS_FORM_DATA, DETAILS_FORM_DATA1, DETAILS_FORM_DATA2 } from "./constant/list/details";
//表格TS
// 表格TS
import { ProTableInstance } from "@/components/ProTable/interface";
//深拷贝方法
// 深拷贝方法
import { cloneDeep } from "lodash-es";
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTableRef = ref<ProTableInstance>();
@@ -75,22 +75,22 @@ const detailsRef = ref<any>(null);
const dataStore = reactive<any>({
columns: COLUMNS, //列表配置项
initParam: cloneDeep(RULE_FORM), // 初始化搜索条件|重置搜索条件
formData: FORM_DATA, //搜索配置项
formData: FORM_DATA, // 搜索配置项
buttons: cloneDeep(BUTTON),
labelWidth: "120px",
title: "新增店铺",
detailsFormData: cloneDeep(DETAILS_FORM_DATA),
detailsRuleForm: cloneDeep(DETAILS_RULE_FORM),
dialogVisible: false, //弹窗
accessSystemOptions: [], //
selectionList: [] //选中表格的行
dialogVisible: false, // 弹窗
accessSystemOptions: [], // 接入系統列表
selectionList: [] // 列表选中数据
});
console.log(dataStore.detailsFormData, "=detailsFormData=");
// 表格选择事件
const selectionChange = (selection: any) => {
dataStore.selectionList = selection;
};
//删除
// 删除
const handleDel = () => {
if (!dataStore.selectionList.length) {
useMsg("warning", "请选择数据 ");
@@ -108,35 +108,38 @@ const handleDel = () => {
});
const result = await getShopDelApi(ids.join(","));
if (result?.code === 0) {
proTable?.value!.getTableList();
proTableRef?.value!.getTableList();
useMsg("success", "删除成功 ");
}
})
.catch(() => {});
}
};
//新增
// 新增
const getShopAdd = async () => {
const result = await getShopAddApi(dataStore.detailsRuleForm);
if (result?.code === 0) {
useMsg("success", "新增成功 ");
setTimeout(() => {
dataStore.dialogVisible = false;
proTableRef?.value!.getTableList();
}, 600);
}
};
//更新
// 更新
const getShopUp = async () => {
const result = await getShopUpApi(dataStore.rowId, dataStore.detailsRuleForm);
if (result?.code === 0) {
useMsg("success", "更新成功 ");
setTimeout(() => {
dataStore.dialogVisible = false;
proTableRef?.value!.getTableList();
}, 600);
}
};
//详情
// 详情
const getShopDetails = async (id: any) => {
const result = await getShopDetailsApi(id);
if (result?.code === 0) {
@@ -146,12 +149,12 @@ const getShopDetails = async (id: any) => {
dataStore.detailsRuleForm = result?.data;
}
};
//表格row点击事件
// 表格row点击事件
const handleOpen = (row: any) => {
dataStore.rowId = row.id;
getShopDetails(row.id);
};
//獲取接入系統列表數據
// 獲取接入系統列表數據
const getShopAccessSystem = async () => {
const result = await getShopAccessSystemApi();
if (result?.code === 0) {
@@ -167,14 +170,14 @@ const getShopAccessSystem = async () => {
}
};
getShopAccessSystem();
//导出
// 导出
const handleExport = async () => {
const result = await getShopListExportApi(dataStore.initParam);
if (result?.code === 0) {
useMsg("success", "导出成功请前往导出列表中进行下载 ");
}
};
//顶部按钮点击事件
// 顶部按钮点击事件
const handleButtonClickCallback = (item: any) => {
const { type } = item;
if (type === "del") {
@@ -188,14 +191,15 @@ const handleButtonClickCallback = (item: any) => {
dataStore.dialogVisible = true;
}
};
//弹窗取消
// 弹窗取消
const handleClose = () => {
dataStore.detailsRuleForm = cloneDeep(DETAILS_RULE_FORM);
detailsRef?.value?.formElement?.resetFields();
dataStore.dialogVisible = false;
};
//提交前的验证条件
const handleAddYz = () => {
// 弹窗确认
const handleCommit = () => {
if (!dataStore.detailsRuleForm.platform_name) {
useMsg("warning", "平台不能为空 !");
return false;
@@ -228,28 +232,23 @@ const handleAddYz = () => {
useMsg("warning", "领星店铺SellerID不能为空 !");
return false;
}
};
//弹窗确认
const handleCommit = () => {
const is = handleAddYz();
if (!is) {
return;
}
if (dataStore.title === "新增店铺") {
getShopAdd();
} else {
getShopUp();
}
};
//搜索
// 搜索
const handleSearch = async (params: any) => {
console.log(params, "==============>");
dataStore.initParam = cloneDeep(params);
//这里需要等到表格刷新以后才去请求
nextTick(() => {
proTableRef?.value!.getTableList();
});
};
//重置
// 重置
const handleReset = () => {
dataStore.initParam = cloneDeep(RULE_FORM);
//这里需要等到表格刷新以后才去请求
@@ -257,6 +256,7 @@ const handleReset = () => {
proTableRef?.value!.getTableList();
});
};
// 接入系统切换
const setAccessSystem = (val: any) => {
if (val === 2) {
dataStore.detailsFormData = cloneDeep(DETAILS_FORM_DATA1);

View File

@@ -1,6 +1,15 @@
export const DETAILS_FORM_DATA: any[] = [
{
prop: "org_number",
prop: "use_org_number",
placeholder: "请输入",
type: "select",
label: "组织:",
disabled: false,
required: true,
class: "form-item1"
},
{
prop: "kd_warehouse_number ",
placeholder: "请输入",
type: "select",
label: "金蝶仓库:",
@@ -9,24 +18,26 @@ export const DETAILS_FORM_DATA: any[] = [
class: "form-item1"
},
{
prop: "org_number",
placeholder: "请输入",
type: "select",
prop: "kd_subwarehouse ",
placeholder: "请选择",
type: "selectMultiples",
label: "金蝶子仓库:",
disabled: false,
class: "form-item1"
},
{
prop: "org_number",
placeholder: "请输入",
type: "select",
label: "对应聚水潭仓库:",
disabled: false,
required: true,
class: "form-item1"
},
{
prop: "org_number",
prop: "jst_warehouse_number",
placeholder: "请输入",
type: "select",
label: "对应聚水潭仓库:",
disabled: false,
required: true,
class: "form-item1"
},
{
prop: "lx_warehouse_number",
placeholder: "请输入",
type: "select",
label: "对应领星仓库:",
@@ -35,4 +46,6 @@ export const DETAILS_FORM_DATA: any[] = [
class: "form-item1"
}
];
export const DETAILS_RULE_FORM: any = {};
export const DETAILS_RULE_FORM: any = {
use_org_number: "101"
};

View File

@@ -17,19 +17,26 @@ interface FormItem {
}
export const FORM_DATA: FormItem[] = [
{
prop: "org_number",
prop: "use_org_number",
placeholder: "请选择组织",
type: "selectMultiple",
label: "组织: ",
options: []
},
{
prop: "kd_warehouse_number",
placeholder: "请输入金蝶仓库",
type: "input",
label: "金蝶仓库: "
},
{
prop: "org_number",
prop: "kd_subwarehouse",
placeholder: "请输入金蝶子仓库",
type: "input",
label: "金蝶子仓库: "
},
{
prop: "org_number",
prop: "operator_name",
placeholder: "请输入更新人",
type: "input",
label: "更新人: "
@@ -41,7 +48,7 @@ export const FORM_DATA: FormItem[] = [
options: [],
startPlaceholder: "更新开始日期",
endPlaceholder: "更新结束日期",
startDate: "updated_at",
startDate: "update_time",
// endDate: "createEndDate",
label: "更新时间: "
}
@@ -49,5 +56,6 @@ export const FORM_DATA: FormItem[] = [
export const RULE_FORM = {
page: 1,
size: 50
size: 50,
use_org_number: ["101"]
};

View File

@@ -8,6 +8,13 @@ export const COLUMNS = [
prop: "material_number",
width: 200
},
{
align: "left",
fixed: true,
label: "组织",
prop: "use_org_number",
width: 200
},
{
align: "left",
label: "金蝶子仓库",

View File

@@ -1,4 +1,4 @@
<!-- 仓库关系 -->
<!-- 店铺资料 -->
<template>
<div class="table-box">
<div style="padding-bottom: 16px">
@@ -7,7 +7,7 @@
@handleButtonClickCallback="handleButtonClickCallback"
></PermissionButton>
</div>
<el-dialog v-model="dataStore.dialogVisible" width="660" :before-close="handleClose" title="新增店铺">
<el-dialog v-model="dataStore.dialogVisible" width="660" :before-close="handleClose" :title="dataStore.title">
<DetailsSearch
:formData="dataStore.detailsFormData"
:ruleForm="dataStore.detailsRuleForm"
@@ -26,7 +26,7 @@
<ProTable
ref="proTableRef"
:columns="dataStore.columns"
:request-api="getMaterialListApi"
:request-api="getShopListApi"
:init-param="dataStore.initParam"
@selectionChange="selectionChange"
>
@@ -38,22 +38,29 @@
:formData="dataStore.formData"
/>
</template>
<template #platform_store_name="scope">
<a @click="handleOpen(scope.row)" class="break-word to-details">
{{ scope.row.platform_store_name }}
</a>
</template>
</ProTable>
</div>
</template>
<script setup lang="ts" name="foundationSetWarehouse">
<script setup lang="ts" name="foundationSetShop">
import ProTable from "@/components/ProTable/index.vue";
import SearchForm from "@/components/SearchForm/index.vue";
import PermissionButton from "@/components/PermissionButton/index.vue";
import { getMaterialListApi } from "@/api/modules/foundationMaterial";
import { getShopListApi } from "@/api/modules/shop";
import { useUserStore } from "@/stores/modules/user";
import { getWarehouseDelApi, getWarehouseAddApi, getWarehouseUpApi } from "@/api/modules/setWarehouse";
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";
//表格TS
// 表格TS
import { ProTableInstance } from "@/components/ProTable/interface";
//深拷贝方法
// 深拷贝方法
import { cloneDeep } from "lodash-es";
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTableRef = ref<ProTableInstance>();
@@ -62,23 +69,30 @@ const detailsRef = ref<any>(null);
const dataStore = reactive<any>({
columns: COLUMNS, //列表配置项
initParam: cloneDeep(RULE_FORM), // 初始化搜索条件|重置搜索条件
formData: FORM_DATA, //搜索配置项
formData: FORM_DATA, // 搜索配置项
buttons: cloneDeep(BUTTON),
options: [], //规格型号
labelWidth: "120px",
title: "新增金蝶子仓与各系统仓库关系",
detailsFormData: cloneDeep(DETAILS_FORM_DATA),
detailsRuleForm: cloneDeep(DETAILS_RULE_FORM),
dialogVisible: false, //弹窗
selectionList: [] //选中表格的行
dialogVisible: false, // 弹窗
selectionList: [] // 列表选中数据
});
const userStore = useUserStore();
//初始化组织数据
const init = () => {
if (userStore.orgIdArr.length) {
dataStore.formData[0].options = userStore?.orgIdArr;
dataStore.detailsFormData[0].options = userStore?.orgIdArr;
}
};
init();
// 表格选择事件
const selectionChange = (selection: any) => {
dataStore.selectionList = selection;
};
//删除
// 删除
const handleDel = () => {
console.log();
if (!dataStore.selectionList.length) {
useMsg("warning", "请选择数据 ");
return;
@@ -90,40 +104,108 @@ const handleDel = () => {
})
.then(async () => {
let ids: any = [];
dataStore.selectionList.forEach((item: any) => {
dataStore.selectionList?.forEach((item: any) => {
ids.push(item.id);
});
// console.log(ids, "==========");
// const result = await getSubscribeDelApi(ids.join(","));
// if (result?.code === 0) {
// proTable?.value!.getTableList();
// useMsg("success", "删除成功 ");
// }
const result = await getWarehouseDelApi(ids.join(","));
if (result?.code === 0) {
proTableRef?.value!.getTableList();
useMsg("success", "删除成功 ");
}
})
.catch(() => {});
}
};
//顶部按钮点击事件
// 新增
const getWarehouseAdd = async () => {
const result = await getWarehouseAddApi(dataStore.detailsRuleForm);
if (result?.code === 0) {
useMsg("success", "新增成功 ");
setTimeout(() => {
dataStore.dialogVisible = false;
proTableRef?.value!.getTableList();
}, 600);
}
};
// 更新
const getWarehouseUp = async () => {
const result = await getWarehouseUpApi(dataStore.rowId, dataStore.detailsRuleForm);
if (result?.code === 0) {
useMsg("success", "更新成功 ");
setTimeout(() => {
dataStore.dialogVisible = false;
proTableRef?.value!.getTableList();
}, 600);
}
};
// 详情
const getShopDetails = async (id: any) => {
const result = await getShopDetailsApi(id);
if (result?.code === 0) {
dataStore.dialogVisible = true;
dataStore.title = "编辑金蝶子仓与各系统仓库关系";
setAccessSystem(result?.data?.access_system);
dataStore.detailsRuleForm = result?.data;
}
};
// 表格row点击事件
const handleOpen = (row: any) => {
dataStore.rowId = row.id;
getShopDetails(row.id);
};
// 导出
const handleExport = async () => {
const result = await getShopListExportApi(dataStore.initParam);
if (result?.code === 0) {
useMsg("success", "导出成功请前往导出列表中进行下载 ");
}
};
// 顶部按钮点击事件
const handleButtonClickCallback = (item: any) => {
const { type } = item;
if (type === "del") {
return handleDel();
}
if (type === "export") {
return handleExport();
}
if (type === "add") {
dataStore.title = "新增金蝶子仓与各系统仓库关系";
dataStore.dialogVisible = true;
}
};
//弹窗取消
// 弹窗取消
const handleClose = () => {
dataStore.detailsRuleForm = cloneDeep(DETAILS_RULE_FORM);
detailsRef?.value?.formElement?.resetFields();
dataStore.dialogVisible = false;
};
//弹窗确认
// 弹窗确认
const handleCommit = () => {
dataStore.dialogVisible = false;
if (!dataStore.detailsRuleForm.use_org_number) {
return useMsg("warning", "组织不能为空 !");
}
if (!dataStore.detailsRuleForm.kd_warehouse_number) {
return useMsg("warning", "金蝶仓库不能为空 !");
}
if (!dataStore.detailsRuleForm.kd_subwarehouse) {
return useMsg("warning", "金蝶子仓库不能为空 !");
}
if (!dataStore.detailsRuleForm.jst_warehouse_number) {
return useMsg("warning", "对应聚水潭仓库不能为空 !");
}
if (!dataStore.detailsRuleForm.lx_warehouse_number) {
return useMsg("warning", "对应对应领星仓库不能为空 !");
}
if (dataStore.title === "新增金蝶子仓与各系统仓库关系") {
getWarehouseAdd();
} else {
getWarehouseUp();
}
};
//搜索
// 搜索
const handleSearch = async (params: any) => {
dataStore.initParam = cloneDeep(params);
//这里需要等到表格刷新以后才去请求
@@ -131,7 +213,7 @@ const handleSearch = async (params: any) => {
proTableRef?.value!.getTableList();
});
};
//重置
// 重置
const handleReset = () => {
dataStore.initParam = cloneDeep(RULE_FORM);
//这里需要等到表格刷新以后才去请求

View File

@@ -53,6 +53,7 @@ import { cloneDeep } from "lodash-es";
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTableRef = ref<ProTableInstance>();
const router = useRouter();
const userStore = useUserStore();
// 数据源

File diff suppressed because one or more lines are too long