Compare commits
12 Commits
f057f07ce7
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| c0750ed493 | |||
| 8a958c987e | |||
| 0861dae12d | |||
| e8dc354c10 | |||
| eea0925899 | |||
| c913152460 | |||
| 7efeb8faf0 | |||
| 8a064cf1b9 | |||
| f08b094efc | |||
| 9aa3782667 | |||
| 574c46580f | |||
| 3c72a248fa |
2
.env
2
.env
@@ -1,5 +1,5 @@
|
|||||||
# title
|
# title
|
||||||
VITE_GLOB_APP_TITLE = OPS供应链系统
|
VITE_GLOB_APP_TITLE = WMS系统
|
||||||
|
|
||||||
# 本地运行端口号
|
# 本地运行端口号
|
||||||
VITE_PORT = 8080
|
VITE_PORT = 8080
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
VITE_APP_API_VERSION = "" #版本号
|
VITE_APP_API_VERSION = "" #版本号
|
||||||
VITE_APP_API_BASEURL = https://opsscmapi.f2b211.com/api/ #请求地址
|
VITE_APP_API_BASEURL = https://newwms.api.f2b211.com/v1/admapi/ #请求地址
|
||||||
VITE_APP_SSO_LOGINURL = https://uc.v3.f2b211.com/uc/login
|
VITE_APP_SSO_LOGINURL = https://uc.v3.f2b211.com/uc/login
|
||||||
VITE_APP_SSO_APPID = 100664627590856707
|
VITE_APP_SSO_APPID = 100664627590856709
|
||||||
|
|
||||||
VITE_REDIRECT_URL = https://wms.v2.f2b211.com/login #单点从定向地址
|
VITE_REDIRECT_URL = https://newwms.f2b211.com/login #单点从定向地址
|
||||||
VITE_SINGLE_URL = https://uc.v3.f2b211.com/ #单点登录通知
|
VITE_SINGLE_URL = https://uc.v3.f2b211.com/ #单点登录通知
|
||||||
# 线上环境
|
# 线上环境
|
||||||
VITE_USER_NODE_ENV = production
|
VITE_USER_NODE_ENV = production
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export const loginApi = (params: Login.ReqLoginCode) => {
|
|||||||
|
|
||||||
// 获取菜单列表
|
// 获取菜单列表
|
||||||
export const getAuthMenuListApi = () => {
|
export const getAuthMenuListApi = () => {
|
||||||
console.log("触发了吗");
|
|
||||||
return http.get<any>(`/user/permissions`, {}, { noLoading: true });
|
return http.get<any>(`/user/permissions`, {}, { noLoading: true });
|
||||||
// return authMenuList;
|
// return authMenuList;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,5 +12,8 @@ export const getSubscribeResetListApi = (params: any) => {
|
|||||||
return http.get<any>(`subscribe/wrr/reload`, params);
|
return http.get<any>(`subscribe/wrr/reload`, params);
|
||||||
};
|
};
|
||||||
export const getSubscribeResetListExportApi = (params: any) => {
|
export const getSubscribeResetListExportApi = (params: any) => {
|
||||||
|
if (params?.notif_ret_status === "空") {
|
||||||
|
params.notif_ret_status = 0;
|
||||||
|
}
|
||||||
return http.get<any>(`subscribe/wrr/export`, params);
|
return http.get<any>(`subscribe/wrr/export`, params);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,14 +13,14 @@
|
|||||||
:label="item.label"
|
:label="item.label"
|
||||||
:prop="item.prop"
|
:prop="item.prop"
|
||||||
:label-width="labelWidth || '81px'"
|
:label-width="labelWidth || '81px'"
|
||||||
:rules="item.rules"
|
|
||||||
:error="item.error"
|
:error="item.error"
|
||||||
|
:required="item.required"
|
||||||
:show-message="item.showMessage ? item.showMessage : false"
|
:show-message="item.showMessage ? item.showMessage : false"
|
||||||
:inline-message="item.inlineMessage"
|
:inline-message="item.inlineMessage"
|
||||||
:style="item.style ? item.style : 'margin-right:8px;position: relative;'"
|
:style="item.style ? item.style : 'margin-right:8px;position: relative;'"
|
||||||
:required="item.required"
|
|
||||||
:class="item.class ? item.class : 'form-item'"
|
:class="item.class ? item.class : 'form-item'"
|
||||||
>
|
>
|
||||||
|
<!-- :required="item.required" -->
|
||||||
<template v-if="item.type === 'input'">
|
<template v-if="item.type === 'input'">
|
||||||
<el-input
|
<el-input
|
||||||
v-model.trim="_searchResult[`${item.prop}`]"
|
v-model.trim="_searchResult[`${item.prop}`]"
|
||||||
@@ -31,6 +31,15 @@
|
|||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="item.type === 'textarea'">
|
||||||
|
<el-input
|
||||||
|
v-model.trim="_searchResult[`${item.prop}`]"
|
||||||
|
:placeholder="item.placeholder"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
type="textarea"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
</template>
|
||||||
<template v-if="item.type === 'inputs'">
|
<template v-if="item.type === 'inputs'">
|
||||||
<el-input
|
<el-input
|
||||||
v-model.trim="_searchResult[`${item.startProp}`]"
|
v-model.trim="_searchResult[`${item.startProp}`]"
|
||||||
@@ -142,6 +151,7 @@
|
|||||||
class="m-2 select"
|
class="m-2 select"
|
||||||
:remote-method="(query:any)=> handleSelectMultipleRemote(query, item)"
|
:remote-method="(query:any)=> handleSelectMultipleRemote(query, item)"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
|
style="max-height: 300px; overflow-y: auto"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
:label="option.label"
|
:label="option.label"
|
||||||
@@ -188,7 +198,6 @@ const emits = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const handleRomoveTag = (item: any) => {
|
const handleRomoveTag = (item: any) => {
|
||||||
console.log(_searchResult.value, "=-_searchResult.value=");
|
|
||||||
emits("selectMultipleRemoveTag", { item, org_number: _searchResult.value.org_number });
|
emits("selectMultipleRemoveTag", { item, org_number: _searchResult.value.org_number });
|
||||||
};
|
};
|
||||||
const handleTagRemove1 = (item: any) => {
|
const handleTagRemove1 = (item: any) => {
|
||||||
@@ -319,9 +328,10 @@ const valueVerifyInputs = (item: any) => {
|
|||||||
prop: item.prop
|
prop: item.prop
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// const handleSelectMultipleClear = (item: any) => {
|
|
||||||
// console.log(item, "===========>");
|
defineExpose({
|
||||||
// };
|
formElement: ruleFormRef
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scope>
|
<style lang="scss" scope>
|
||||||
.search-box1 {
|
.search-box1 {
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ const handleRemoteClick = (item: any, index: number) => {
|
|||||||
emits("handleRemoteClickValue", { item, index });
|
emits("handleRemoteClickValue", { item, index });
|
||||||
};
|
};
|
||||||
const handleEnterInput = (item: any, index: number) => {
|
const handleEnterInput = (item: any, index: number) => {
|
||||||
console.log("1232323");
|
|
||||||
emits("handleKeyupEnterInputValue", {
|
emits("handleKeyupEnterInputValue", {
|
||||||
item,
|
item,
|
||||||
index
|
index
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ const newValInitParams = toRef(props, "initParam");
|
|||||||
const { selectionChange, selectedList, selectedListIds, isSelected } = useSelection(props.rowKey);
|
const { selectionChange, selectedList, selectedListIds, isSelected } = useSelection(props.rowKey);
|
||||||
|
|
||||||
// 清空选中数据列表
|
// 清空选中数据列表
|
||||||
const clearSelection = () => tableRef.value!.clearSelection();
|
const clearSelection = () => tableRef?.value!.clearSelection();
|
||||||
// 表格操作 Hooks
|
// 表格操作 Hooks
|
||||||
const { tableData, pageable, getTableList, handleSizeChange, handleCurrentChange } = useTable(
|
const { tableData, pageable, getTableList, handleSizeChange, handleCurrentChange } = useTable(
|
||||||
routeName.value,
|
routeName.value,
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ const handleSelectMultipleRemote = async (query: any, item: any) => {
|
|||||||
getCustomers(valClone, item);
|
getCustomers(valClone, item);
|
||||||
} else if (item.type === "selectProductLinesRemote") {
|
} else if (item.type === "selectProductLinesRemote") {
|
||||||
//品线
|
//品线
|
||||||
console.log("走到了这里");
|
|
||||||
getProductLines(valClone, item);
|
getProductLines(valClone, item);
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
export const usePathUrl = () => {
|
export const usePathUrl = (redirect_path?: any) => {
|
||||||
const PATH_URL = `${import.meta.env.VITE_APP_SSO_LOGINURL}?client_id=${
|
let PATH_URL: any = "";
|
||||||
|
if (redirect_path) {
|
||||||
|
PATH_URL = `${import.meta.env.VITE_APP_SSO_LOGINURL}?client_id=${
|
||||||
|
import.meta.env.VITE_APP_SSO_APPID
|
||||||
|
}&redirect_uri=${encodeURIComponent(
|
||||||
|
import.meta.env.VITE_REDIRECT_URL + "?redirect_path=" + redirect_path
|
||||||
|
)}&response_type=code`;
|
||||||
|
return PATH_URL;
|
||||||
|
} else {
|
||||||
|
PATH_URL = `${import.meta.env.VITE_APP_SSO_LOGINURL}?client_id=${
|
||||||
import.meta.env.VITE_APP_SSO_APPID
|
import.meta.env.VITE_APP_SSO_APPID
|
||||||
}&redirect_uri=${encodeURIComponent(import.meta.env.VITE_REDIRECT_URL)}&response_type=code`;
|
}&redirect_uri=${encodeURIComponent(import.meta.env.VITE_REDIRECT_URL)}&response_type=code`;
|
||||||
return PATH_URL;
|
return PATH_URL;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,14 +90,15 @@ export const useTable = (
|
|||||||
try {
|
try {
|
||||||
await initSubscribeData();
|
await initSubscribeData();
|
||||||
await deleteParams();
|
await deleteParams();
|
||||||
// await initData();
|
state.tableData = [];
|
||||||
let params = {
|
let params = {
|
||||||
...state.totalParam,
|
...state.totalParam,
|
||||||
...pageParam.value
|
...pageParam.value
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await api(params);
|
const { data } = await api(params);
|
||||||
state.tableData = data.data || [];
|
|
||||||
|
state.tableData = Array.isArray(data.data) && data.data.length ? data.data : [];
|
||||||
clearSelection && clearSelection();
|
clearSelection && clearSelection();
|
||||||
if (isPageable && data.total_size !== undefined) {
|
if (isPageable && data.total_size !== undefined) {
|
||||||
updatePageable({
|
updatePageable({
|
||||||
@@ -145,7 +146,6 @@ export const useTable = (
|
|||||||
state.totalParam = {};
|
state.totalParam = {};
|
||||||
// 同步到查询参数
|
// 同步到查询参数
|
||||||
state.searchParam = { ...newVal };
|
state.searchParam = { ...newVal };
|
||||||
console.log(state.searchParam, "= state.searchParam=");
|
|
||||||
// 同步到参数快照
|
// 同步到参数快照
|
||||||
state.totalParam = { ...newVal, ...pageParam.value };
|
state.totalParam = { ...newVal, ...pageParam.value };
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<!-- <el-icon v-show="item.meta.icon && globalStore.breadcrumbIcon" class="breadcrumb-icon">
|
<!-- <el-icon v-show="item.meta.icon && globalStore.breadcrumbIcon" class="breadcrumb-icon">
|
||||||
<component :is="item.meta.icon"></component>
|
<component :is="item.meta.icon"></component>
|
||||||
</el-icon> -->
|
</el-icon> -->
|
||||||
|
<!-- {{ breadcrumbList }} -->
|
||||||
<span class="breadcrumb-title">{{ item.meta.title }}</span>
|
<span class="breadcrumb-title">{{ item.meta.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
@@ -28,13 +28,22 @@ const route = useRoute();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const globalStore = useGlobalStore();
|
const globalStore = useGlobalStore();
|
||||||
|
// const routeName: any = ref(router.currentRoute.value.name);
|
||||||
const breadcrumbList = computed(() => {
|
const breadcrumbList = computed(() => {
|
||||||
let breadcrumbData = authStore.breadcrumbListGet[route.matched[route.matched.length - 1].path] ?? [];
|
let breadcrumbData = authStore.breadcrumbListGet[route.matched[route.matched.length - 1].path] ?? [];
|
||||||
// 🙅♀️不需要首页面包屑可删除以下判断
|
// 🙅♀️不需要首页面包屑可删除以下判断
|
||||||
if (breadcrumbData[0].path !== HOME_URL) {
|
if (breadcrumbData[0].path !== HOME_URL) {
|
||||||
breadcrumbData = [{ path: HOME_URL, meta: { icon: "HomeFilled", title: "首页" } }, ...breadcrumbData];
|
breadcrumbData = [{ path: HOME_URL, meta: { icon: "HomeFilled", title: "首页" } }, ...breadcrumbData];
|
||||||
}
|
}
|
||||||
|
if (route.query.title === "新增订阅" || "编辑订阅") {
|
||||||
|
breadcrumbData.forEach((item: any) => {
|
||||||
|
if (item.name === "foundationSubscribeListAdd") {
|
||||||
|
item.meta.title = route.query.title;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log("");
|
||||||
|
}
|
||||||
|
|
||||||
return breadcrumbData;
|
return breadcrumbData;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ watch(
|
|||||||
() => {
|
() => {
|
||||||
if (route.meta.isFull) return;
|
if (route.meta.isFull) return;
|
||||||
tabsMenuValue.value = route.fullPath;
|
tabsMenuValue.value = route.fullPath;
|
||||||
|
|
||||||
let title: any = route.query.title ? route.query.title : route.meta.title;
|
let title: any = route.query.title ? route.query.title : route.meta.title;
|
||||||
|
|
||||||
const tabsParams = {
|
const tabsParams = {
|
||||||
icon: route.meta.icon as string,
|
icon: route.meta.icon as string,
|
||||||
title: title,
|
title: title,
|
||||||
@@ -63,6 +65,7 @@ watch(
|
|||||||
name: route.name as string,
|
name: route.name as string,
|
||||||
close: !route.meta.isAffix
|
close: !route.meta.isAffix
|
||||||
};
|
};
|
||||||
|
|
||||||
tabStore.addTabs(tabsParams);
|
tabStore.addTabs(tabsParams);
|
||||||
route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route.name as string);
|
route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route.name as string);
|
||||||
},
|
},
|
||||||
@@ -107,13 +110,12 @@ const tabClick = (tabItem: TabsPaneContext) => {
|
|||||||
|
|
||||||
// Remove Tab
|
// Remove Tab
|
||||||
const tabRemove = (fullPath: TabPaneName) => {
|
const tabRemove = (fullPath: TabPaneName) => {
|
||||||
if (fullPath === "/index") {
|
const name = tabStore.tabsMenuList.filter(item => item.path == fullPath)[0].name || "";
|
||||||
|
|
||||||
|
if (fullPath === "/index" || name === "home") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// const name = tabStore.tabsMenuList.filter(item => item.path == fullPath)[0].name || "";
|
|
||||||
// keepAliveStore.removeKeepAliveName(name);
|
|
||||||
// tabStore.removeTabs(fullPath as string, fullPath == route.fullPath);
|
|
||||||
const name = tabStore.tabsMenuList.filter(item => item.path == fullPath)[0].name || "";
|
|
||||||
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath);
|
tabStore.removeTabs(fullPath as string, fullPath == route.fullPath);
|
||||||
let isKeepAlive = tabStore.tabsMenuList.some((item: any) => {
|
let isKeepAlive = tabStore.tabsMenuList.some((item: any) => {
|
||||||
return item.name === name;
|
return item.name === name;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
|
|
||||||
// 1.NProgress 开始
|
// 1.NProgress 开始
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
|
const currentPath = window.location.pathname;
|
||||||
// 2.动态设置标题
|
// 2.动态设置标题
|
||||||
const title = import.meta.env.VITE_GLOB_APP_TITLE;
|
const title = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||||
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title;
|
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title;
|
||||||
@@ -51,6 +51,17 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
|
|
||||||
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
||||||
if (ROUTER_WHITE_LIST.includes(to.path)) return next();
|
if (ROUTER_WHITE_LIST.includes(to.path)) return next();
|
||||||
|
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
||||||
|
if (ROUTER_WHITE_LIST.includes(to.path)) return next();
|
||||||
|
|
||||||
|
// 如果没有token但是有订阅路由就将订阅路由当参数携带
|
||||||
|
if (!userStore.newUserToken && currentPath === "/foundation/subscribe/warehousing/index") {
|
||||||
|
return next({
|
||||||
|
path: LOGIN_URL,
|
||||||
|
replace: true,
|
||||||
|
query: { redirect_path: currentPath } // 通过query传递参数
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 5.判断是否有 Token,没有重定向到 login 页面
|
// 5.判断是否有 Token,没有重定向到 login 页面
|
||||||
if (!userStore.newUserToken) return next({ path: LOGIN_URL, replace: true });
|
if (!userStore.newUserToken) return next({ path: LOGIN_URL, replace: true });
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ export interface TabsMenuProps {
|
|||||||
/* TabsState */
|
/* TabsState */
|
||||||
export interface TabsState {
|
export interface TabsState {
|
||||||
tabsMenuList: TabsMenuProps[];
|
tabsMenuList: TabsMenuProps[];
|
||||||
|
isSubscribeAdd: Boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ export const useAuthStore = defineStore({
|
|||||||
// 获取权限菜单列表并处理按钮权限
|
// 获取权限菜单列表并处理按钮权限
|
||||||
async getAuthMenuList() {
|
async getAuthMenuList() {
|
||||||
const { data } = await getAuthMenuListApi();
|
const { data } = await getAuthMenuListApi();
|
||||||
let dataClone = data;
|
let dataClone =
|
||||||
|
Array.isArray(data) && data.length
|
||||||
// 如果没有路由数据,设置默认首页
|
? data
|
||||||
this.authMenuList = dataClone || [
|
: [
|
||||||
{
|
{
|
||||||
path: "/index",
|
path: "/index",
|
||||||
name: "home",
|
name: "home",
|
||||||
@@ -83,6 +83,9 @@ export const useAuthStore = defineStore({
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 如果没有路由数据,设置默认首页
|
||||||
|
this.authMenuList = dataClone;
|
||||||
|
|
||||||
// 提取按钮权限
|
// 提取按钮权限
|
||||||
this.buttonPermissions = extractButtonPermissions(this.authMenuList);
|
this.buttonPermissions = extractButtonPermissions(this.authMenuList);
|
||||||
// 构建页面与按钮的映射关系
|
// 构建页面与按钮的映射关系
|
||||||
@@ -92,7 +95,6 @@ export const useAuthStore = defineStore({
|
|||||||
// 构建页面与按钮的映射关系
|
// 构建页面与按钮的映射关系
|
||||||
buildPageButtonMap() {
|
buildPageButtonMap() {
|
||||||
const pageButtonMap: PageButtonMap = {};
|
const pageButtonMap: PageButtonMap = {};
|
||||||
|
|
||||||
// 递归处理路由,建立页面与按钮的关联
|
// 递归处理路由,建立页面与按钮的关联
|
||||||
const processRoutes = (routes: any[], parentPageName?: string) => {
|
const processRoutes = (routes: any[], parentPageName?: string) => {
|
||||||
routes.forEach((route: any) => {
|
routes.forEach((route: any) => {
|
||||||
@@ -102,7 +104,6 @@ export const useAuthStore = defineStore({
|
|||||||
if (!pageButtonMap[route.name]) {
|
if (!pageButtonMap[route.name]) {
|
||||||
pageButtonMap[route.name] = [];
|
pageButtonMap[route.name] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理子节点中的按钮权限
|
// 处理子节点中的按钮权限
|
||||||
if (route.children && route.children.length > 0) {
|
if (route.children && route.children.length > 0) {
|
||||||
route.children.forEach((child: any) => {
|
route.children.forEach((child: any) => {
|
||||||
@@ -123,9 +124,7 @@ export const useAuthStore = defineStore({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
processRoutes(this.authMenuList);
|
processRoutes(this.authMenuList);
|
||||||
console.log(pageButtonMap, "=pageButtonMap=");
|
|
||||||
this.pageButtonMap = pageButtonMap;
|
this.pageButtonMap = pageButtonMap;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,86 @@ import piniaPersistConfig from "@/config/piniaPersist";
|
|||||||
export const useTabsStore = defineStore({
|
export const useTabsStore = defineStore({
|
||||||
id: "wms-tabs",
|
id: "wms-tabs",
|
||||||
state: (): TabsState => ({
|
state: (): TabsState => ({
|
||||||
tabsMenuList: []
|
isSubscribeAdd: false,
|
||||||
|
tabsMenuList: [
|
||||||
|
{
|
||||||
|
icon: "", // 首页的icon,按实际路由meta.icon填写(如"Home")
|
||||||
|
title: "首页", // 固定首页标题
|
||||||
|
path: "/index", // 首页的基础路径(无参数版本,避免初始参数冗余)
|
||||||
|
name: "home", // 必须与首页路由的name一致(如路由定义中name: "home")
|
||||||
|
close: true // 首页是否可关闭,按业务需求设置(通常true,若禁止关闭设为false)
|
||||||
|
}
|
||||||
|
]
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
// Add Tabs
|
|
||||||
async addTabs(tabItem: any) {
|
async addTabs(tabItem: any) {
|
||||||
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
// 1. 校验参数:首页必须有 name,其他标签必须有 path
|
||||||
|
if ((tabItem.name === "home" && !tabItem.name) || (!tabItem.name && !tabItem.path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 区分首页和普通标签的去重逻辑
|
||||||
|
let isExist = false;
|
||||||
|
if (tabItem.name === "home") {
|
||||||
|
// 首页:按 name 去重(确保唯一)
|
||||||
|
isExist = this.tabsMenuList.some(item => item.name === "home");
|
||||||
|
} else {
|
||||||
|
// 普通标签:按完整 path 去重(区分参数)
|
||||||
|
isExist = this.tabsMenuList.some(item => item.path === tabItem.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isExist) {
|
||||||
|
// 3. 首页放首位,其他放末尾
|
||||||
|
if (tabItem.name === "home") {
|
||||||
|
// 先移除旧首页(防止重复),再添加到最前
|
||||||
|
this.tabsMenuList = this.tabsMenuList.filter(item => item.name !== "home");
|
||||||
|
this.tabsMenuList.unshift(tabItem);
|
||||||
|
} else {
|
||||||
this.tabsMenuList.push(tabItem);
|
this.tabsMenuList.push(tabItem);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 4. 已存在时更新信息
|
||||||
|
this.tabsMenuList = this.tabsMenuList.map(item => {
|
||||||
|
if (tabItem.name === "home" && item.name === "home") {
|
||||||
|
// 首页:更新 path 等信息(如首页参数变化)
|
||||||
|
return { ...item, path: tabItem.path };
|
||||||
|
} else if (item.path === tabItem.path) {
|
||||||
|
// 普通标签:全量更新(如标题、参数)
|
||||||
|
return { ...item, ...tabItem };
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// Remove Tabs
|
// // Add Tabs:按 name 去重,首页始终在最前
|
||||||
|
// async addTabs(tabItem: any) {
|
||||||
|
// // 1. 校验参数:确保 tabItem 有 name(避免异常数据)
|
||||||
|
// if (!tabItem.name) return;
|
||||||
|
|
||||||
|
// // 2. 去重逻辑:按 name 判断是否已存在
|
||||||
|
// const isExist = this.tabsMenuList.some(item => item.name === tabItem.name);
|
||||||
|
|
||||||
|
// if (!isExist) {
|
||||||
|
// // 3. 首页(name: "home")添加到数组开头,其他标签添加到末尾
|
||||||
|
// if (tabItem.name === "home") {
|
||||||
|
// // 先移除旧的首页(防止极端情况残留),再添加新首页到最前
|
||||||
|
// this.tabsMenuList = this.tabsMenuList.filter(item => item.name !== "home");
|
||||||
|
// this.tabsMenuList.unshift(tabItem); // 首页放第一位
|
||||||
|
// } else {
|
||||||
|
// this.tabsMenuList.push(tabItem); // 非首页放末尾
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 4. 可选优化:若标签已存在,同步更新其 path(如首页参数变化时)
|
||||||
|
// this.tabsMenuList = this.tabsMenuList.map(item => {
|
||||||
|
// if (item.name === tabItem.name) {
|
||||||
|
// return { ...item, path: tabItem.path }; // 仅更新 path,保留其他属性
|
||||||
|
// }
|
||||||
|
// return item;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
|
||||||
|
// Remove Tabs(原有逻辑不变,无需修改)
|
||||||
async removeTabs(tabPath: string, isCurrent: boolean = true) {
|
async removeTabs(tabPath: string, isCurrent: boolean = true) {
|
||||||
const tabsMenuList = this.tabsMenuList;
|
const tabsMenuList = this.tabsMenuList;
|
||||||
if (isCurrent) {
|
if (isCurrent) {
|
||||||
@@ -28,22 +98,46 @@ export const useTabsStore = defineStore({
|
|||||||
}
|
}
|
||||||
this.tabsMenuList = tabsMenuList.filter(item => item.path !== tabPath);
|
this.tabsMenuList = tabsMenuList.filter(item => item.path !== tabPath);
|
||||||
},
|
},
|
||||||
// Close MultipleTab
|
|
||||||
|
// Close MultipleTab(原有逻辑不变)
|
||||||
async closeMultipleTab(tabsMenuValue?: string) {
|
async closeMultipleTab(tabsMenuValue?: string) {
|
||||||
this.tabsMenuList = this.tabsMenuList.filter(item => {
|
this.tabsMenuList = this.tabsMenuList.filter(item => {
|
||||||
return item.path === tabsMenuValue || !item.close;
|
return item.path === tabsMenuValue || !item.close;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// Set Tabs
|
|
||||||
|
// Set Tabs(原有逻辑不变)
|
||||||
async setTabs(tabsMenuList: any[]) {
|
async setTabs(tabsMenuList: any[]) {
|
||||||
this.tabsMenuList = tabsMenuList;
|
// 补充:设置 tabs 时也需去重,避免批量设置时带入重复首页
|
||||||
|
const uniqueTabs = [];
|
||||||
|
const nameSet = new Set();
|
||||||
|
// 先处理首页,确保在最前
|
||||||
|
const homeTab = tabsMenuList.find(item => item.name === "home");
|
||||||
|
if (homeTab) {
|
||||||
|
uniqueTabs.push(homeTab);
|
||||||
|
nameSet.add("home");
|
||||||
|
}
|
||||||
|
// 再处理其他标签,去重
|
||||||
|
tabsMenuList.forEach(tab => {
|
||||||
|
if (!nameSet.has(tab.name)) {
|
||||||
|
nameSet.add(tab.name);
|
||||||
|
uniqueTabs.push(tab);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.tabsMenuList = uniqueTabs;
|
||||||
},
|
},
|
||||||
// Set Tabs Title
|
|
||||||
|
// Set Tabs Title(原有逻辑不变)
|
||||||
async setTabsTitle(title: string) {
|
async setTabsTitle(title: string) {
|
||||||
|
console.log("12332323");
|
||||||
const nowFullPath = location.hash.substring(1);
|
const nowFullPath = location.hash.substring(1);
|
||||||
this.tabsMenuList.forEach(item => {
|
this.tabsMenuList.forEach(item => {
|
||||||
if (item.path == nowFullPath) item.title = title;
|
if (item.path == nowFullPath) item.title = title;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
async setSIsSubscribeAdd(is: any) {
|
||||||
|
console.log(is, "==========is========");
|
||||||
|
this.isSubscribeAdd = is;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
persist: piniaPersistConfig("wms-tabs")
|
persist: piniaPersistConfig("wms-tabs")
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const handleSearch = async (params: any) => {
|
|||||||
dataStore.initParam = cloneDeep(params);
|
dataStore.initParam = cloneDeep(params);
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTableRef.value!.getTableList();
|
proTableRef?.value!.getTableList();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//重置
|
//重置
|
||||||
@@ -87,7 +87,7 @@ const handleReset = () => {
|
|||||||
dataStore.initParam = cloneDeep(RULE_FORM);
|
dataStore.initParam = cloneDeep(RULE_FORM);
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTableRef.value!.getTableList();
|
proTableRef?.value!.getTableList();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const handleExport = async (params: any) => {
|
|||||||
const { initParam } = params;
|
const { initParam } = params;
|
||||||
const result = await getMaterialListExportApi(initParam);
|
const result = await getMaterialListExportApi(initParam);
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", "导出成功 !");
|
useMsg("success", "导出成功请前往导出列表中进行下载!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//刷新
|
//刷新
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
:labelWidth="dataStore.labelWidth"
|
:labelWidth="dataStore.labelWidth"
|
||||||
@selectMultipleRemoveTag="handleSelectMultipleRemoveTag"
|
@selectMultipleRemoveTag="handleSelectMultipleRemoveTag"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
|
ref="detailsRef"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -22,15 +23,16 @@
|
|||||||
import PermissionButton from "@/components/PermissionButton/index.vue";
|
import PermissionButton from "@/components/PermissionButton/index.vue";
|
||||||
import DetailsSearch from "@/components/DetailsSearch/index.vue";
|
import DetailsSearch from "@/components/DetailsSearch/index.vue";
|
||||||
import { FORM_DATA, RULE_FORM } from "./constant/add";
|
import { FORM_DATA, RULE_FORM } from "./constant/add";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { getSubscribeDetailsApi, getSubscribeUpdateApi, getSubscribeAddApi } from "@/api/modules/subscribe";
|
||||||
import { getSubscribeDetailsApi, getSubscribeAddApi, getSubscribeUpdateApi } from "@/api/modules/subscribe";
|
|
||||||
import { setDetailsData } from "./init/setDetailsData";
|
import { setDetailsData } from "./init/setDetailsData";
|
||||||
import { useMsg } from "@/hooks/useMsg";
|
import { useMsg } from "@/hooks/useMsg";
|
||||||
import { BUTTON } from "./constant/add/button";
|
import { BUTTON } from "./constant/add/button";
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from "@/stores/modules/user";
|
||||||
import { cloneDeep } from "lodash-es";
|
import { cloneDeep } from "lodash-es";
|
||||||
|
import $Bus from "@/utils/mittBus";
|
||||||
|
// import { useTabsStore } from "@/stores/modules/tabs";
|
||||||
|
// const tabStore = useTabsStore();
|
||||||
const dataStore = reactive({
|
const dataStore = reactive({
|
||||||
formData: cloneDeep(FORM_DATA),
|
formData: cloneDeep(FORM_DATA),
|
||||||
ruleForm: cloneDeep(RULE_FORM),
|
ruleForm: cloneDeep(RULE_FORM),
|
||||||
@@ -42,10 +44,10 @@ const dataStore = reactive({
|
|||||||
});
|
});
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const $route = useRoute();
|
const $route = useRoute();
|
||||||
|
const $router = useRouter();
|
||||||
|
const detailsRef = ref<any>(null);
|
||||||
dataStore.formData[0].options = userStore.orgIdArr;
|
dataStore.formData[0].options = userStore.orgIdArr;
|
||||||
const init = () => {
|
const init = () => {
|
||||||
//$route.query.title === "新增订阅" ? org_number: ["101"],
|
|
||||||
if ($route.query.title === "新增订阅") {
|
if ($route.query.title === "新增订阅") {
|
||||||
dataStore.ruleForm.org_number = ["101"];
|
dataStore.ruleForm.org_number = ["101"];
|
||||||
}
|
}
|
||||||
@@ -53,8 +55,17 @@ const init = () => {
|
|||||||
init();
|
init();
|
||||||
//新增
|
//新增
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
|
if ($route.query.title === "编辑订阅") {
|
||||||
|
$router.replace({
|
||||||
|
path: "/foundation/subscribe/list/add",
|
||||||
|
query: {
|
||||||
|
title: "新增订阅"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ($route.query.title === "新增订阅") {
|
||||||
if (
|
if (
|
||||||
dataStore.ruleForm?.customer_number.length ||
|
dataStore.ruleForm?.customer_number?.length ||
|
||||||
dataStore.ruleForm?.org_number ||
|
dataStore.ruleForm?.org_number ||
|
||||||
dataStore.ruleForm?.product_lines ||
|
dataStore.ruleForm?.product_lines ||
|
||||||
dataStore.ruleForm?.subscriber_dduid
|
dataStore.ruleForm?.subscriber_dduid
|
||||||
@@ -66,17 +77,30 @@ const handleAdd = () => {
|
|||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
dataStore.ruleForm = cloneDeep(RULE_FORM);
|
dataStore.ruleForm = cloneDeep(RULE_FORM);
|
||||||
|
dataStore.ruleForm.org_number = ["101"];
|
||||||
dataStore.isAdd = true;
|
dataStore.isAdd = true;
|
||||||
|
detailsRef?.value?.formElement?.resetFields();
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleGoList = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
$router.replace({ path: "/foundation/subscribe/list/index" });
|
||||||
|
$Bus.emit("setResetList");
|
||||||
|
}, 300);
|
||||||
};
|
};
|
||||||
|
|
||||||
//添加
|
//添加
|
||||||
const getSubscribeAdd = async (params: any) => {
|
const getSubscribeAdd = async (params: any) => {
|
||||||
|
console.log(params);
|
||||||
const result = await getSubscribeAddApi(params);
|
const result = await getSubscribeAddApi(params);
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", "新增成功 !");
|
useMsg("success", "新增成功 !");
|
||||||
|
dataStore.ruleForm = cloneDeep(RULE_FORM);
|
||||||
|
dataStore.ruleForm.org_number = ["101"];
|
||||||
|
detailsRef?.value?.formElement?.resetFields();
|
||||||
|
handleGoList();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//更新
|
//更新
|
||||||
@@ -84,6 +108,7 @@ const getSubscribeUpdate = async (params: any) => {
|
|||||||
const result = await getSubscribeUpdateApi($route.query.id, params);
|
const result = await getSubscribeUpdateApi($route.query.id, params);
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", "更新成功 !");
|
useMsg("success", "更新成功 !");
|
||||||
|
handleGoList();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -117,7 +142,6 @@ const handleCommit = () => {
|
|||||||
};
|
};
|
||||||
//详情
|
//详情
|
||||||
const getSubscribeDetails = async () => {
|
const getSubscribeDetails = async () => {
|
||||||
console.log($route.query.id);
|
|
||||||
let id = $route.query.id;
|
let id = $route.query.id;
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const FORM_DATA: any[] = [
|
|||||||
{
|
{
|
||||||
prop: "customer_number",
|
prop: "customer_number",
|
||||||
placeholder: "请输入",
|
placeholder: "请输入",
|
||||||
type: "input",
|
type: "textarea",
|
||||||
label: "客户编码:",
|
label: "客户编码:",
|
||||||
disabled: true,
|
disabled: true,
|
||||||
required: true,
|
required: true,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="foundationSubscribeList">
|
<script setup lang="ts" name="foundationSubscribeList">
|
||||||
|
import { onMounted } from "vue";
|
||||||
import SearchForm from "@/components/SearchForm/index.vue";
|
import SearchForm from "@/components/SearchForm/index.vue";
|
||||||
import ProTable from "@/components/ProTable/index.vue";
|
import ProTable from "@/components/ProTable/index.vue";
|
||||||
import PermissionButton from "@/components/PermissionButton/index.vue";
|
import PermissionButton from "@/components/PermissionButton/index.vue";
|
||||||
@@ -46,7 +47,7 @@ import { ProTableInstance } from "@/components/ProTable/interface";
|
|||||||
import { btnClick } from "./init";
|
import { btnClick } from "./init";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from "@/stores/modules/user";
|
||||||
|
import $Bus from "@/utils/mittBus";
|
||||||
//深拷贝方法
|
//深拷贝方法
|
||||||
import { cloneDeep } from "lodash-es";
|
import { cloneDeep } from "lodash-es";
|
||||||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
|
||||||
@@ -91,7 +92,7 @@ const handleSearch = async (params: any) => {
|
|||||||
dataStore.initParam = cloneDeep(params);
|
dataStore.initParam = cloneDeep(params);
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTableRef.value!.getTableList();
|
proTableRef?.value!.getTableList();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//重置
|
//重置
|
||||||
@@ -99,7 +100,7 @@ const handleReset = () => {
|
|||||||
dataStore.initParam = cloneDeep(RULE_FORM);
|
dataStore.initParam = cloneDeep(RULE_FORM);
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTableRef.value!.getTableList();
|
proTableRef?.value!.getTableList();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -162,6 +163,13 @@ watch(
|
|||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
onMounted(() => {
|
||||||
|
$Bus.on("setResetList", () => {
|
||||||
|
nextTick(() => {
|
||||||
|
proTableRef?.value!.getTableList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scope lang="scss">
|
<style scope lang="scss">
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const handleDel = (params: any) => {
|
|||||||
});
|
});
|
||||||
const result = await getSubscribeDelApi(ids.join(","));
|
const result = await getSubscribeDelApi(ids.join(","));
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
proTable.value!.getTableList();
|
proTable?.value!.getTableList();
|
||||||
useMsg("success", "删除成功 !");
|
useMsg("success", "删除成功 !");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ export const setDetailsData = (dataStore: any, data: any) => {
|
|||||||
useOrgName: item.use_org_name
|
useOrgName: item.use_org_name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log(customers_names, "=customers_names=");
|
|
||||||
console.log(dataStore.ruleForm.customers, "=dataStore.ruleForm.customers=");
|
|
||||||
//客户名称值回填
|
//客户名称值回填
|
||||||
dataStore.ruleForm.customer_number1 = dataStore.ruleForm.customers;
|
dataStore.ruleForm.customer_number1 = dataStore.ruleForm.customers;
|
||||||
dataStore.ruleForm.customer_number = dataStore.ruleForm.customers;
|
dataStore.ruleForm.customer_number = dataStore.ruleForm.customers;
|
||||||
|
|||||||
@@ -81,7 +81,12 @@ export const FORM_DATA: FormItem[] = [
|
|||||||
type: "input",
|
type: "input",
|
||||||
label: "子仓库: "
|
label: "子仓库: "
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: "customer_name",
|
||||||
|
placeholder: "请输入客户名称",
|
||||||
|
type: "input",
|
||||||
|
label: "客户名称: "
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: "Time",
|
prop: "Time",
|
||||||
type: "daterange",
|
type: "daterange",
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ const handleSearch = async (params: any) => {
|
|||||||
dataStore.initParam = cloneDeep(params);
|
dataStore.initParam = cloneDeep(params);
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTable.value!.getTableList();
|
proTable?.value!.getTableList();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//重置
|
//重置
|
||||||
@@ -110,7 +110,7 @@ const handleReset = () => {
|
|||||||
init();
|
init();
|
||||||
//这里需要等到表格刷新以后才去请求
|
//这里需要等到表格刷新以后才去请求
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
proTable.value!.getTableList();
|
proTable?.value!.getTableList();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handleClickSuccess = (row: any) => {
|
const handleClickSuccess = (row: any) => {
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
import { useMsg } from "@/hooks/useMsg";
|
import { useMsg } from "@/hooks/useMsg";
|
||||||
import { getSubscribeResetListApi, getSubscribeResetListExportApi } from "@/api/modules/warehousing";
|
import { getSubscribeResetListApi, getSubscribeResetListExportApi } from "@/api/modules/warehousing";
|
||||||
|
import { cloneDeep } from "lodash-es";
|
||||||
// 导出
|
// 导出
|
||||||
export const handleExport = async (params: any) => {
|
export const handleExport = async (data: any) => {
|
||||||
const { initParam } = params;
|
const { initParam } = data;
|
||||||
const result = await getSubscribeResetListExportApi(initParam);
|
let params = cloneDeep(initParam);
|
||||||
|
params.org_number =
|
||||||
|
Array.isArray(params?.org_number) && params?.org_number?.length ? params.org_number.join(",") : params.org_number;
|
||||||
|
const result = await getSubscribeResetListExportApi(params);
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", "导出成功 !");
|
useMsg("success", "导出成功请前往导出列表中进行下载 !");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// proTable: any
|
// proTable: any
|
||||||
export const handleReSet = async (item: any, selectionList: any[], proTable: any) => {
|
export const handleReSet = async (params: any) => {
|
||||||
console.log("刷新操作", item);
|
const { proTable, selectionList } = params;
|
||||||
let length = selectionList.length;
|
let length = selectionList.length;
|
||||||
if (length && length > 100) {
|
if (length && length > 100) {
|
||||||
useMsg("warning", "选中刷新数据最大100条 !");
|
useMsg("warning", "选中刷新数据最大100条 !");
|
||||||
@@ -25,7 +29,7 @@ export const handleReSet = async (item: any, selectionList: any[], proTable: any
|
|||||||
const result = await getSubscribeResetListApi({ id });
|
const result = await getSubscribeResetListApi({ id });
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", "数据刷新成功 !");
|
useMsg("success", "数据刷新成功 !");
|
||||||
proTable.value!.getTableList();
|
proTable?.value!.getTableList();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,48 +6,61 @@
|
|||||||
|
|
||||||
<script setup lang="ts" name="home">
|
<script setup lang="ts" name="home">
|
||||||
//登录请求接口
|
//登录请求接口
|
||||||
import { getOrgsApi, getWarehousesListApi } from "@/api/modules/global";
|
// import { getOrgsApi, getWarehousesListApi } from "@/api/modules/global";
|
||||||
|
import { useRoute, useRouter } from "vue-router";
|
||||||
//用户信息存储
|
//用户信息存储
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
// import { useUserStore } from "@/stores/modules/user";
|
||||||
const userStore = useUserStore();
|
// const userStore = useUserStore();
|
||||||
//获取组织
|
//路由;
|
||||||
const getOrgs = async () => {
|
const $route = useRoute();
|
||||||
const result = await getOrgsApi();
|
const $router = useRouter();
|
||||||
if (result?.code === 0) {
|
// //获取组织
|
||||||
const { data } = result;
|
// const getOrgs = async () => {
|
||||||
if (data?.length) {
|
// const result = await getOrgsApi();
|
||||||
let options: any = [];
|
// if (result?.code === 0) {
|
||||||
data.forEach((item: any) => {
|
// const { data } = result;
|
||||||
options.push({
|
// if (data?.length) {
|
||||||
id: item.id,
|
// let options: any = [];
|
||||||
value: item.org_number,
|
// data.forEach((item: any) => {
|
||||||
label: item.org_name
|
// options.push({
|
||||||
});
|
// id: item.id,
|
||||||
});
|
// value: item.org_number,
|
||||||
userStore.setOrgIdArr(options);
|
// label: item.org_name
|
||||||
}
|
// });
|
||||||
|
// });
|
||||||
|
// userStore.setOrgIdArr(options);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// getOrgs();
|
||||||
|
// const getWarehousesList = async () => {
|
||||||
|
// const result = await getWarehousesListApi();
|
||||||
|
// if (result?.code === 0) {
|
||||||
|
// const { data } = result;
|
||||||
|
// if (data?.length) {
|
||||||
|
// let options: any = [];
|
||||||
|
// data.forEach((item: any) => {
|
||||||
|
// options.push({
|
||||||
|
// id: item.id,
|
||||||
|
// value: item.warehouse_name,
|
||||||
|
// label: item.warehouse_name
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// userStore.setWarehouse(options);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// getWarehousesList();
|
||||||
|
|
||||||
|
const init = () => {
|
||||||
|
let redirect_path: any = $route.query.redirect_path;
|
||||||
|
if (redirect_path) {
|
||||||
|
setTimeout(() => {
|
||||||
|
$router.push({ path: redirect_path });
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getOrgs();
|
init();
|
||||||
const getWarehousesList = async () => {
|
|
||||||
const result = await getWarehousesListApi();
|
|
||||||
if (result?.code === 0) {
|
|
||||||
const { data } = result;
|
|
||||||
if (data?.length) {
|
|
||||||
let options: any = [];
|
|
||||||
data.forEach((item: any) => {
|
|
||||||
options.push({
|
|
||||||
id: item.id,
|
|
||||||
value: item.warehouse_name,
|
|
||||||
label: item.warehouse_name
|
|
||||||
});
|
|
||||||
});
|
|
||||||
userStore.setWarehouse(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
getWarehousesList();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
//useRouter
|
//useRouter
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { getOrgsApi, getWarehousesListApi } from "@/api/modules/global";
|
||||||
// import { useMsg } from "@/hooks/useMsg";
|
// import { useMsg } from "@/hooks/useMsg";
|
||||||
//重定向
|
//重定向
|
||||||
import { usePathUrl } from "@/hooks/usePathUrl";
|
import { usePathUrl } from "@/hooks/usePathUrl";
|
||||||
@@ -18,18 +19,66 @@ const userStore = useUserStore();
|
|||||||
const $route = useRoute();
|
const $route = useRoute();
|
||||||
const $router = useRouter();
|
const $router = useRouter();
|
||||||
|
|
||||||
|
//获取组织
|
||||||
|
const getOrgs = async () => {
|
||||||
|
const result = await getOrgsApi();
|
||||||
|
if (result?.code === 0) {
|
||||||
|
const { data } = result;
|
||||||
|
if (data?.length) {
|
||||||
|
let options: any = [];
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
options.push({
|
||||||
|
id: item.id,
|
||||||
|
value: item.org_number,
|
||||||
|
label: item.org_name
|
||||||
|
});
|
||||||
|
});
|
||||||
|
userStore.setOrgIdArr(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getWarehousesList = async () => {
|
||||||
|
const result = await getWarehousesListApi();
|
||||||
|
if (result?.code === 0) {
|
||||||
|
const { data } = result;
|
||||||
|
if (data?.length) {
|
||||||
|
let options: any = [];
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
options.push({
|
||||||
|
id: item.id,
|
||||||
|
value: item.warehouse_name,
|
||||||
|
label: item.warehouse_name
|
||||||
|
});
|
||||||
|
});
|
||||||
|
userStore.setWarehouse(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
const loginHttp = async (code: any) => {
|
const loginHttp = async (code: any) => {
|
||||||
const result: Record<string, any> = await loginApi(code);
|
const result: Record<string, any> = await loginApi(code);
|
||||||
if (result.code === 0) {
|
if (result.code === 0) {
|
||||||
userStore.setToken(result?.data?.access_token);
|
userStore.setToken(result?.data?.access_token);
|
||||||
console.log(result?.data?.access_token, "=data.access_token=");
|
|
||||||
// 设置用户信息
|
// 设置用户信息
|
||||||
userStore.setUserInfo(result?.data?.user_data);
|
userStore.setUserInfo(result?.data?.user_data);
|
||||||
//设置好了token和用户信息跳转到首页
|
|
||||||
|
let redirect_path: any = $route.query.redirect_path;
|
||||||
|
|
||||||
|
if (result?.data?.access_token) {
|
||||||
|
getWarehousesList();
|
||||||
|
getOrgs();
|
||||||
|
}
|
||||||
|
if (redirect_path) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$router.push({ path: "/" });
|
$router.replace({ path: redirect_path });
|
||||||
}, 500);
|
}, 500);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
$router.replace({ path: "/" });
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
location.href = usePathUrl();
|
location.href = usePathUrl();
|
||||||
}
|
}
|
||||||
@@ -37,14 +86,20 @@ const loginHttp = async (code: any) => {
|
|||||||
|
|
||||||
// 登录前的判断
|
// 登录前的判断
|
||||||
const login = () => {
|
const login = () => {
|
||||||
const { code } = $route.query;
|
const { code, redirect_path } = $route.query;
|
||||||
// 没有code直接跳转到登录页
|
// 没有code直接跳转到登录页
|
||||||
|
if (!code && redirect_path) {
|
||||||
|
location.href = usePathUrl(redirect_path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!code) {
|
if (!code) {
|
||||||
location.href = usePathUrl();
|
location.href = usePathUrl();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 有code就登录请求
|
// 有code就登录请求
|
||||||
|
if (code) {
|
||||||
loginHttp(code);
|
loginHttp(code);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
login();
|
login();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user