Compare commits

2 Commits

Author SHA1 Message Date
eea0925899 fix: 🧩 修复bug 2025-10-17 16:59:21 +08:00
c913152460 feat: 🚀 修复bug 2025-10-17 16:38:54 +08:00
14 changed files with 103 additions and 39 deletions

View File

@@ -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;
}; };

View File

@@ -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 {

View File

@@ -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

View File

@@ -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;

View File

@@ -146,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 };
}, },

View File

@@ -56,6 +56,7 @@ 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 +64,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);
}, },

View File

@@ -39,7 +39,6 @@ router.beforeEach(async (to, from, next) => {
// 1.NProgress 开始 // 1.NProgress 开始
NProgress.start(); NProgress.start();
const currentPath = window.location.pathname; const currentPath = window.location.pathname;
console.log(currentPath, "=currentPath=");
// 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;

View File

@@ -125,7 +125,6 @@ export const useAuthStore = defineStore({
}; };
processRoutes(this.authMenuList); processRoutes(this.authMenuList);
console.log(pageButtonMap, "=pageButtonMap=");
this.pageButtonMap = pageButtonMap; this.pageButtonMap = pageButtonMap;
}, },

View File

@@ -17,33 +17,72 @@ export const useTabsStore = defineStore({
] ]
}), }),
actions: { actions: {
// Add Tabs按 name 去重,首页始终在最前
async addTabs(tabItem: any) { async addTabs(tabItem: any) {
// 1. 校验参数:确保 tabItem 有 name避免异常数据 // 1. 校验参数:首页必须有 name其他标签必须有 path
if (!tabItem.name) return; if ((tabItem.name === "home" && !tabItem.name) || (!tabItem.name && !tabItem.path)) {
return;
}
// 2. 去重逻辑:按 name 判断是否已存在 // 2. 区分首页和普通标签的去重逻辑
const isExist = this.tabsMenuList.some(item => item.name === tabItem.name); 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) { if (!isExist) {
// 3. 首页name: "home")添加到数组开头,其他标签添加到末尾 // 3. 首页放首位,其他放末尾
if (tabItem.name === "home") { if (tabItem.name === "home") {
// 先移除旧首页(防止极端情况残留),再添加新首页到最前 // 先移除旧首页(防止重复),再添加到最前
this.tabsMenuList = this.tabsMenuList.filter(item => item.name !== "home"); this.tabsMenuList = this.tabsMenuList.filter(item => item.name !== "home");
this.tabsMenuList.unshift(tabItem); // 首页放第一位 this.tabsMenuList.unshift(tabItem);
} else { } else {
this.tabsMenuList.push(tabItem); // 非首页放末尾 this.tabsMenuList.push(tabItem);
} }
} else { } else {
// 4. 可选优化:若标签已存在,同步更新其 path如首页参数变化时 // 4. 已存在时更新信息
this.tabsMenuList = this.tabsMenuList.map(item => { this.tabsMenuList = this.tabsMenuList.map(item => {
if (item.name === tabItem.name) { if (tabItem.name === "home" && item.name === "home") {
return { ...item, path: tabItem.path }; // 更新 path,保留其他属性 // 首页:更新 path 等信息(如首页参数变化)
return { ...item, path: tabItem.path };
} else if (item.path === tabItem.path) {
// 普通标签:全量更新(如标题、参数)
return { ...item, ...tabItem };
} }
return item; return item;
}); });
} }
}, },
// // 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原有逻辑不变无需修改 // Remove Tabs原有逻辑不变无需修改
async removeTabs(tabPath: string, isCurrent: boolean = true) { async removeTabs(tabPath: string, isCurrent: boolean = true) {
@@ -89,6 +128,7 @@ export const useTabsStore = defineStore({
// 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;

View File

@@ -13,6 +13,7 @@
:labelWidth="dataStore.labelWidth" :labelWidth="dataStore.labelWidth"
@selectMultipleRemoveTag="handleSelectMultipleRemoveTag" @selectMultipleRemoveTag="handleSelectMultipleRemoveTag"
:inline="true" :inline="true"
ref="detailsRef"
/> />
</div> </div>
</div> </div>
@@ -29,7 +30,7 @@ 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";
const dataStore = reactive({ const dataStore = reactive({
formData: cloneDeep(FORM_DATA), formData: cloneDeep(FORM_DATA),
ruleForm: cloneDeep(RULE_FORM), ruleForm: cloneDeep(RULE_FORM),
@@ -42,9 +43,9 @@ const dataStore = reactive({
const userStore = useUserStore(); const userStore = useUserStore();
const $route = useRoute(); const $route = useRoute();
const $router = useRouter(); 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"];
} }
@@ -65,12 +66,20 @@ 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 = () => {
detailsRef?.value?.formElement?.resetFields();
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); console.log(params);
@@ -78,10 +87,7 @@ const getSubscribeAdd = async (params: any) => {
if (result?.code === 0) { if (result?.code === 0) {
useMsg("success", "新增成功 "); useMsg("success", "新增成功 ");
dataStore.ruleForm = cloneDeep(RULE_FORM); dataStore.ruleForm = cloneDeep(RULE_FORM);
init(); dataStore.ruleForm.org_number = ["101"];
setTimeout(() => {
$router.replace({ path: "/foundation/subscribe/list/index" });
}, 300);
} }
}; };
//更新 //更新
@@ -89,6 +95,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();
} }
}; };
@@ -122,7 +129,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;

View File

@@ -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,

View File

@@ -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 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
@@ -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">

View File

@@ -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;

View File

@@ -1,9 +1,13 @@
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", "导出成功 ");
} }