feat: 🚀 物料列表刷新
This commit is contained in:
@@ -8,3 +8,7 @@ import http from "@/api";
|
|||||||
export const getMaterialListApi = (params: any) => {
|
export const getMaterialListApi = (params: any) => {
|
||||||
return http.get<any>(`material`, params);
|
return http.get<any>(`material`, params);
|
||||||
};
|
};
|
||||||
|
//刷新 /admapi/material/reload
|
||||||
|
export const getMaterialListReloadApi = (params: any) => {
|
||||||
|
return http.get<any>(`material/reload`, params);
|
||||||
|
};
|
||||||
|
|||||||
@@ -24,3 +24,8 @@ export const getUsersApi = (params: any) => {
|
|||||||
export const getProductLinesApi = (params: any) => {
|
export const getProductLinesApi = (params: any) => {
|
||||||
return http.get<any>(`basicinfo/productlines`, params);
|
return http.get<any>(`basicinfo/productlines`, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//仓库
|
||||||
|
export const getWarehousesListApi = () => {
|
||||||
|
return http.get<any>(`basicinfo/warehouses`);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { cloneDeep } from "lodash-es";
|
|
||||||
|
|
||||||
export const useFilter = (datas: any) => {
|
|
||||||
const target = cloneDeep(datas);
|
|
||||||
const returnTarget = target.filter((item: any) => {
|
|
||||||
return !item.disable;
|
|
||||||
});
|
|
||||||
return returnTarget;
|
|
||||||
};
|
|
||||||
@@ -31,7 +31,7 @@ export const useTable = (
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//订阅列表数据处理
|
//数据处理
|
||||||
const initSubscribeData = () => {
|
const initSubscribeData = () => {
|
||||||
if (routeName === "foundationSubscribeList") {
|
if (routeName === "foundationSubscribeList") {
|
||||||
if (Array.isArray(state.totalParam?.org_number) && state.totalParam?.org_number?.length) {
|
if (Array.isArray(state.totalParam?.org_number) && state.totalParam?.org_number?.length) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export const BUTTON = [
|
|||||||
{
|
{
|
||||||
text: "导出",
|
text: "导出",
|
||||||
permission: "foundationSetMaterialBtnExport",
|
permission: "foundationSetMaterialBtnExport",
|
||||||
type: "add",
|
type: "export",
|
||||||
props: {
|
props: {
|
||||||
type: "primary"
|
type: "primary"
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,6 @@ export const BUTTON = [
|
|||||||
{
|
{
|
||||||
text: "刷新",
|
text: "刷新",
|
||||||
permission: "foundationSetMaterialBtnRefresh",
|
permission: "foundationSetMaterialBtnRefresh",
|
||||||
type: "del"
|
type: "reset"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import { getMaterialListReloadApi } from "@/api/modules/foundationMaterial";
|
||||||
import { useMsg } from "@/hooks/useMsg";
|
import { useMsg } from "@/hooks/useMsg";
|
||||||
|
//getMaterialListResetApi
|
||||||
// 直接导出函数,无需额外包装对象
|
// 直接导出函数,无需额外包装对象
|
||||||
export const handleDel = (item: any, selectionList: any[], proTable: any) => {
|
export const handleExport = (item: any, selectionList: any[], proTable: any) => {
|
||||||
console.log("导出操作", item);
|
console.log("导出操作", item);
|
||||||
console.log(selectionList, "=selectionList=");
|
console.log(selectionList, "=selectionList=");
|
||||||
let length = selectionList.length;
|
let length = selectionList.length;
|
||||||
@@ -24,8 +26,8 @@ export const handleDel = (item: any, selectionList: any[], proTable: any) => {
|
|||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
// proTable: any
|
// proTable: any getMaterialListReloadApi
|
||||||
export const handleAdd = (item: any, selectionList: any[]) => {
|
export const handleReload = async (item: any, selectionList: any[], proTable: any) => {
|
||||||
console.log("刷新操作", item);
|
console.log("刷新操作", item);
|
||||||
let length = selectionList.length;
|
let length = selectionList.length;
|
||||||
let ids: any = [];
|
let ids: any = [];
|
||||||
@@ -36,9 +38,15 @@ export const handleAdd = (item: any, selectionList: any[]) => {
|
|||||||
selectionList.forEach((item: any) => {
|
selectionList.forEach((item: any) => {
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
});
|
});
|
||||||
|
let id = ids.join(",");
|
||||||
|
const result = await getMaterialListReloadApi({ id });
|
||||||
|
if (result?.code === 0) {
|
||||||
|
useMsg("success", "数据刷新成功 !");
|
||||||
|
proTable.value!.getTableList();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const btnClick: any = {
|
export const btnClick: any = {
|
||||||
del: handleDel,
|
export: handleExport,
|
||||||
add: handleAdd
|
reset: handleReload
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ const dataStore = reactive({
|
|||||||
});
|
});
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const $route = useRoute();
|
const $route = useRoute();
|
||||||
|
|
||||||
dataStore.formData[0].options = userStore.orgIdArr;
|
dataStore.formData[0].options = userStore.orgIdArr;
|
||||||
//新增
|
//新增
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export const FORM_DATA: FormItem[] = [
|
|||||||
options: []
|
options: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "sub_warehouse",
|
prop: "sub_warehouse_name",
|
||||||
placeholder: "请输入子仓库",
|
placeholder: "请输入子仓库",
|
||||||
type: "input",
|
type: "input",
|
||||||
label: "子仓库: "
|
label: "子仓库: "
|
||||||
|
|||||||
@@ -57,12 +57,16 @@ const dataStore = reactive<any>({
|
|||||||
selectionList: [], //选中表格的行
|
selectionList: [], //选中表格的行
|
||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
//设置组织数组
|
//设置组织数组
|
||||||
dataStore.formData[5].options = userStore.orgIdArr;
|
dataStore.formData[5].options = userStore.orgIdArr;
|
||||||
|
//设置仓库数据
|
||||||
|
dataStore.formData[6].options = userStore.warehouse;
|
||||||
//订阅人
|
//订阅人
|
||||||
dataStore.initParam.subscriber_name = userStore.userInfo.nickname;
|
dataStore.initParam.subscriber_name = userStore.userInfo.nickname;
|
||||||
|
};
|
||||||
|
init();
|
||||||
// 表格选择事件
|
// 表格选择事件
|
||||||
const selectionChange = (selection: any) => {
|
const selectionChange = (selection: any) => {
|
||||||
dataStore.selectionList = selection;
|
dataStore.selectionList = selection;
|
||||||
@@ -82,6 +86,7 @@ const handleSearch = async (params: any) => {
|
|||||||
//重置
|
//重置
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
dataStore.initParam = cloneDeep(RULE_FORM);
|
dataStore.initParam = cloneDeep(RULE_FORM);
|
||||||
|
init();
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTable.value!.getTableList();
|
proTable.value!.getTableList();
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export const handleReSet = async (item: any, selectionList: any[], proTable: any
|
|||||||
selectionList.forEach((item: any) => {
|
selectionList.forEach((item: any) => {
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
});
|
});
|
||||||
const result = await getSubscribeResetListApi(ids);
|
|
||||||
|
let id = ids.join(",");
|
||||||
|
const result = await getSubscribeResetListApi({ id });
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", "数据刷新成功 !");
|
useMsg("success", "数据刷新成功 !");
|
||||||
proTable.value!.getTableList();
|
proTable.value!.getTableList();
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts" name="home">
|
<script setup lang="ts" name="home">
|
||||||
//登录请求接口
|
//登录请求接口
|
||||||
import { getOrgsApi } from "@/api/modules/global";
|
import { getOrgsApi, getWarehousesListApi } from "@/api/modules/global";
|
||||||
|
|
||||||
//用户信息存储
|
//用户信息存储
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from "@/stores/modules/user";
|
||||||
//setOrgIdArr
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
//获取组织
|
//获取组织
|
||||||
const getOrgs = async () => {
|
const getOrgs = async () => {
|
||||||
@@ -30,16 +30,24 @@ const getOrgs = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
getOrgs();
|
getOrgs();
|
||||||
|
const getWarehousesList = async () => {
|
||||||
// //获取供应商
|
const result = await getWarehousesListApi();
|
||||||
// const getSupplier = async () => {
|
if (result?.code === 0) {
|
||||||
// const result = await getSupplierApi();
|
const { data } = result;
|
||||||
// if (result?.code === 0) {
|
if (data?.length) {
|
||||||
// const { data } = result;
|
let options: any = [];
|
||||||
// console.log(data, "=============>");
|
data.forEach((item: any) => {
|
||||||
// }
|
options.push({
|
||||||
// };
|
id: item.id,
|
||||||
// getSupplier();
|
value: item.warehouse_number,
|
||||||
|
label: item.warehouse_name
|
||||||
|
});
|
||||||
|
});
|
||||||
|
userStore.setWarehouse(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getWarehousesList();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user