From 1c8c18285e5676df8b5eaabff33bfac9d1f33b13 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 22 五月 2026 09:23:43 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev_NEW_pro_OA

---
 src/pages/index.vue                                       |  448 ++++++++++++++++++++++++++-----------
 src/pages/login.vue                                       |   60 ++++
 src/api/login.js                                          |   71 +++--
 src/pages/works.vue                                       |    2 
 src/pages/productionManagement/productionReport/index.vue |    7 
 src/store/modules/user.ts                                 |   85 ++++---
 6 files changed, 460 insertions(+), 213 deletions(-)

diff --git a/src/api/login.js b/src/api/login.js
index 29a149d..561b98c 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -1,81 +1,82 @@
-import request from '@/utils/request'
+import request from "@/utils/request";
 
 // 鐧诲綍鏂规硶
-export function loginCheckFactory(username, password) {
+export function loginCheckFactory(username, password, factoryId) {
   const data = {
     username,
     password,
-  }
+    factoryId,
+  };
   return request({
-    url: '/loginCheckFactory',
+    url: "/loginCheckFactory",
     headers: {
-      isToken: false
+      isToken: false,
+      repeatSubmit: false,
     },
-    method: 'post',
-    data: data
-  })
+    method: "post",
+    data: data,
+  });
 }
 
 // 鑾峰彇鐢ㄦ埛璇︾粏淇℃伅
 export function getInfo() {
   return request({
-    url: '/getInfo',
-    method: 'get'
-  })
+    url: "/getInfo",
+    method: "get",
+  });
 }
 
 // 閫�鍑烘柟娉�
 export function logout() {
   return request({
-    url: '/logout',
-    method: 'post'
-  })
+    url: "/logout",
+    method: "post",
+  });
 }
 
 // 鑾峰彇鍏徃鍒楄〃
 export function userLoginFacotryList(params) {
   return request({
-    url: '/userLoginFacotryList',
-    method: 'get',
-    params: params
-  })
+    url: "/userLoginFacotryList",
+    method: "get",
+    params: params,
+  });
 }
 
 // 鑾峰彇鏈繃鏈熷叕鍛婃暟閲�
 export function noticesList(params) {
   return request({
-    url: '/collaborativeApproval/notice/page',
-    method: 'get',
-    params: params
-  })
+    url: "/collaborativeApproval/notice/page",
+    method: "get",
+    params: params,
+  });
 }
 
 // 鍙戦�佸鎴风鎺ㄩ�佹爣璇嗗埌鏈嶅姟鍣�
 export function updateClientId(data) {
   return request({
-    url: '/system/client/addOrUpdateClientId',
-    method: 'post',
-    data: data
-  })
+    url: "/system/client/addOrUpdateClientId",
+    method: "post",
+    data: data,
+  });
 }
-
 
 // 鏌ヨ鍏憡鍒楄〃
 export function listNotice(query) {
   return request({
-    url: '/system/notice/list',
-    method: 'get',
-    params: query
-  })
+    url: "/system/notice/list",
+    method: "get",
+    params: query,
+  });
 }
 
 // 鑾峰彇鏈娑堟伅鏁伴噺
 export function getNoticeCount(consigneeId) {
   return request({
-    url: '/system/notice/getCount',
-    method: 'get',
-    params: { consigneeId }
-  })
+    url: "/system/notice/getCount",
+    method: "get",
+    params: { consigneeId },
+  });
 }
 
 // 鏍囪娑堟伅涓哄凡璇�
diff --git a/src/pages/index.vue b/src/pages/index.vue
index b7d3fa9..2d253b2 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -3,23 +3,42 @@
     <scroll-view class="scroll" scroll-y>
       <!-- 椤堕儴 Banner锛氭斁鍏ユ粴鍔ㄥ尯鍩燂紝闅忛〉闈竴璧锋粴鍔紝涓嶅浐瀹氬湪椤堕儴 -->
       <view class="hero-section">
-        <view class="bg-img">
-          <view class="hero-content">
-            <view class="hero-ornaments">
-              <view class="hero-glow glow-left" />
-              <view class="hero-glow glow-right" />
-              <view class="hero-mist mist-top" />
-              <view class="hero-mist mist-bottom" />
-              <view class="hero-curve curve-main" />
-              <view class="hero-curve curve-sub" />
+        <view class="hero-banner">
+          <view class="hero-top">
+            <view class="hero-copy">
+              <view class="hero-badge">缁忚惀鐪嬫澘</view>
+              <text class="hero-title">{{ heroTitle }}</text>
+              <text class="hero-subtitle">{{ heroSubtitle }}</text>
+              <view class="hero-meta">
+                <text
+                  v-for="item in heroMetaItems"
+                  :key="item"
+                  class="hero-meta-item"
+                >
+                  {{ item }}
+                </text>
+              </view>
+            </view>
+            <view class="hero-avatar">
+              <text class="hero-avatar-text">{{ heroInitial }}</text>
             </view>
           </view>
-          <view class="hero-wave"></view>
+          <view class="hero-panels">
+            <view
+              v-for="item in heroMetrics"
+              :key="item.label"
+              class="hero-panel"
+            >
+              <text class="hero-panel-label">{{ item.label }}</text>
+              <text class="hero-panel-value">{{ item.value }}</text>
+              <text class="hero-panel-hint">{{ item.hint }}</text>
+            </view>
+          </view>
         </view>
       </view>
 
       <!-- 蹇嵎鍏ュ彛 -->
-      <view class="quick-section">
+      <view v-if="quickTools.length" class="quick-section">
         <up-grid :border="false" col="4">
           <up-grid-item
             v-for="item in quickTools"
@@ -35,7 +54,7 @@
       </view>
 
       <!-- 鏁版嵁鎬昏 -->
-      <view class="section">
+      <view v-if="hasOverviewSection" class="section">
         <view class="section-header">
           <view class="section-title">
             <view class="title-bar" />
@@ -48,7 +67,7 @@
         </view>
 
         <view v-show="overviewExpanded" class="overview">
-          <view class="overview-card sales">
+          <view v-if="canShowSalesOverview" class="overview-card sales">
             <view class="card-left">
               <text class="card-title">閿�鍞暟鎹�</text>
               <view class="card-metrics">
@@ -64,7 +83,7 @@
             </view>
           </view>
 
-          <view class="overview-card purchase">
+          <view v-if="canShowPurchaseOverview" class="overview-card purchase">
             <view class="card-left">
               <text class="card-title">閲囪喘鏁版嵁</text>
               <view class="card-metrics">
@@ -80,7 +99,7 @@
             </view>
           </view>
 
-          <view class="overview-card stock">
+          <view v-if="canShowStockOverview" class="overview-card stock">
             <view class="card-left">
               <text class="card-title">搴撳瓨鏁版嵁</text>
               <view class="card-metrics">
@@ -99,7 +118,7 @@
       </view>
 
       <!-- 瀹㈡埛鍚堝悓閲戦鍒嗘瀽 -->
-      <view class="section">
+      <view v-if="canShowContractAnalysis" class="section">
         <view class="section-header">
           <view class="section-title">
             <view class="title-bar" />
@@ -197,12 +216,15 @@
 import { analysisCustomerContractAmounts, getBusiness } from "@/api/viewIndex";
 import { createVersionUpgradeChecker } from "@/utils/versionUpgrade";
 import DownloadProgressMask from "@/components/DownloadProgressMask.vue";
+import useUserStore from "@/store/modules/user";
 
 const imgNum1 = "/static/images/index/num1.png";
 const imgNum2 = "/static/images/index/num2.png";
 const imgNum3 = "/static/images/index/num3.png";
 
-const quickTools = [
+const userStore = useUserStore();
+
+const quickToolSource = [
   {
     label: "鐢熶骇鎶ュ伐",
     icon: "/static/images/icon/shengchanbaogong.svg",
@@ -224,6 +246,8 @@
     route: "/pages/equipmentManagement/repair/index",
   },
 ];
+const quickTools = ref([...quickToolSource]);
+const allowedMenuTitles = ref(new Set());
 
 const isCanvas2d = ref(false);
 
@@ -272,6 +296,125 @@
   uni.showToast({ title: "鏇村鍔熻兘寰呮帴鍏�", icon: "none" });
 }
 
+
+function filterQuickToolsByRoutes() {
+  const routers = userStore.routers || [];
+
+  if (!routers || routers.length === 0) {
+    allowedMenuTitles.value = new Set();
+    quickTools.value = [...quickToolSource];
+    return;
+  }
+
+  const titles = new Set();
+  const collectMenuTitles = (routes) => {
+    if (!Array.isArray(routes)) return;
+    routes.forEach((route) => {
+      if (route.meta && route.meta.title) {
+        titles.add(route.meta.title);
+      }
+      if (route.children && route.children.length > 0) {
+        collectMenuTitles(route.children);
+      }
+    });
+  };
+  collectMenuTitles(routers);
+  allowedMenuTitles.value = titles;
+
+  quickTools.value = quickToolSource.filter((item) =>
+    titles.has(item.label)
+  );
+}
+
+function hasAnyPermission(titles) {
+  const titleSet = allowedMenuTitles.value;
+  if (!titleSet || titleSet.size === 0) return true;
+  return titles.some((title) => titleSet.has(title));
+}
+
+const canShowSalesOverview = computed(() => hasAnyPermission(["閿�鍞彴璐�"]));
+const canShowPurchaseOverview = computed(() => hasAnyPermission(["閲囪喘鍙拌处"]));
+const canShowStockOverview = computed(() => hasAnyPermission(["搴撳瓨绠$悊"]));
+const hasOverviewSection = computed(
+  () =>
+    canShowSalesOverview.value ||
+    canShowPurchaseOverview.value ||
+    canShowStockOverview.value
+);
+const canShowContractAnalysis = computed(() =>
+  hasAnyPermission(["閿�鍞彴璐�", "瀹㈡埛妗f", "瀹㈡埛寰�鏉�"])
+);
+
+const userDisplayName = computed(
+  () => userStore.nickName
+);
+const heroInitial = computed(() => userDisplayName.value.slice(0, 1).toUpperCase());
+const heroTitle = computed(() => `浣犲ソ锛�${userDisplayName.value}`);
+const heroSubtitle = computed(
+  () => userStore.currentFactoryName || "褰撳墠璐﹀彿宸茶繘鍏ヤ笟鍔¢椤�"
+);
+const heroMetaItems = computed(() => {
+  const items = [];
+  if (userStore.roleName) items.push(userStore.roleName);
+  if (userStore.currentLoginTime) items.push(`鐧诲綍浜� ${userStore.currentLoginTime}`);
+  if (!items.length) items.push("褰撳墠涓氬姟姒傝");
+  return items;
+});
+const visibleSectionCount = computed(() => {
+  let count = 0;
+  if (quickTools.value.length > 0) count += 1;
+  if (hasOverviewSection.value) count += 1;
+  if (canShowContractAnalysis.value) count += 1;
+  return count;
+});
+const heroMetrics = computed(() => {
+  const items = [];
+
+  if (canShowSalesOverview.value) {
+    items.push({
+      label: "閿�鍞�",
+      value: overviewCards.value.sales.today,
+      hint: "鏈湀钀ヤ笟棰�",
+    });
+  }
+  if (canShowPurchaseOverview.value) {
+    items.push({
+      label: "閲囪喘",
+      value: overviewCards.value.purchase.today,
+      hint: "鏈湀閲囪喘棰�",
+    });
+  }
+  if (canShowStockOverview.value) {
+    items.push({
+      label: "搴撳瓨",
+      value: overviewCards.value.stock.today,
+      hint: "褰撳墠搴撳瓨閲�",
+    });
+  }
+  if (canShowContractAnalysis.value && items.length < 3) {
+    items.push({
+      label: "鍚堝悓",
+      value: contractSummaryView.value.sumText,
+      hint: "瀹㈡埛鍚堝悓棰�",
+    });
+  }
+  if (items.length < 3) {
+    items.push({
+      label: "蹇嵎",
+      value: String(quickTools.value.length),
+      hint: "鍙敤鍏ュ彛",
+    });
+  }
+  if (items.length < 3) {
+    items.push({
+      label: "妯″潡",
+      value: String(visibleSectionCount.value),
+      hint: "鍙鏉垮潡",
+    });
+  }
+
+  return items.slice(0, 3);
+});
 
 function getByPath(obj, path) {
   if (!obj || !path) return undefined;
@@ -423,7 +566,13 @@
 async function loadHome() {
   chartReady.value = false;
   try {
-    const [bRes, cRes] = await Promise.all([getBusiness(), analysisCustomerContractAmounts()]);
+    const businessPromise = hasOverviewSection.value
+      ? getBusiness()
+      : Promise.resolve({ data: {} });
+    const contractPromise = canShowContractAnalysis.value
+      ? analysisCustomerContractAmounts()
+      : Promise.resolve({ data: { item: [], sum: "0", chain: "0", yny: "0" } });
+    const [bRes, cRes] = await Promise.all([businessPromise, contractPromise]);
     businessRaw.value = bRes?.data || {};
     const cData = cRes?.data || {};
     contractSummary.value = {
@@ -448,11 +597,21 @@
     isCanvas2d.value = false;
   }
   triggerVersionCheck("onMounted");
-  loadHome();
+  userStore
+    .getRouters()
+    .then(() => {
+      filterQuickToolsByRoutes();
+      loadHome();
+    })
+    .catch(() => {
+      filterQuickToolsByRoutes();
+      loadHome();
+    });
 });
 
 onShow(() => {
   triggerVersionCheck("onShow");
+  filterQuickToolsByRoutes();
 });
 </script>
 
@@ -508,146 +667,169 @@
 	}
 }
 .hero-section {
-	margin: 0 12px;
-	margin-bottom: 12px;
-	animation: fadeInUp 0.6s ease-out 0.1s both;
+  margin: 0 14px 12px;
+  animation: fadeInUp 0.6s ease-out 0.1s both;
 }
 
-.bg-img {
-	width: 100%;
-	height: 10.25rem;
-	background:
-		linear-gradient(135deg, rgba(234, 245, 255, 0.98) 0%, rgba(220, 239, 255, 0.94) 42%, rgba(244, 250, 255, 0.96) 100%),
-		url("/static/images/banner/backview.png") center/cover no-repeat;
-	border-radius: 18px;
-	position: relative;
-	overflow: hidden;
-	box-shadow: 0 12px 30px rgba(118, 154, 186, 0.16);
-	
-	&::before {
-		content: "";
-		position: absolute;
-		inset: 0;
-		background:
-			radial-gradient(circle at 14% 22%, rgba(255, 255, 255, 0.95) 0, rgba(255, 255, 255, 0) 28%),
-			radial-gradient(circle at 84% 18%, rgba(191, 226, 255, 0.7) 0, rgba(191, 226, 255, 0) 26%),
-			linear-gradient(180deg, rgba(255, 255, 255, 0.46) 0%, rgba(255, 255, 255, 0.16) 42%, rgba(206, 229, 247, 0.22) 100%);
-		pointer-events: none;
-	}
-	
-	&::after {
-		content: "";
-		position: absolute;
-		left: 18%;
-		bottom: -44px;
-		width: 64%;
-		height: 88px;
-		background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 72%);
-		border-radius: 50%;
-		filter: blur(10px);
-		pointer-events: none;
-	}
+.hero-banner {
+  position: relative;
+  overflow: hidden;
+  border-radius: 18px;
+  padding: 18px 16px 16px;
+  min-height: 182px;
+  background:
+    linear-gradient(135deg, rgba(22, 74, 170, 0.92) 0%, rgba(33, 115, 185, 0.88) 48%, rgba(18, 156, 144, 0.82) 100%),
+    url("/static/images/banner/backview.png") center right / cover no-repeat;
+  box-shadow: 0 14px 34px rgba(29, 78, 137, 0.2);
+  border: 1px solid rgba(255, 255, 255, 0.18);
+
+  &::before {
+    content: "";
+    position: absolute;
+    inset: 0;
+    background:
+      linear-gradient(120deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.02) 32%, rgba(255, 255, 255, 0) 60%),
+      radial-gradient(circle at top right, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 34%);
+    pointer-events: none;
+  }
+
+  &::after {
+    content: "";
+    position: absolute;
+    right: -28px;
+    bottom: -34px;
+    width: 156px;
+    height: 156px;
+    border-radius: 50%;
+    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 72%);
+    pointer-events: none;
+  }
 }
 
-.hero-content {
-	position: relative;
-	z-index: 1;
-	padding: 16px 16px 14px;
-	height: 100%;
-	backdrop-filter: blur(2px);
+.hero-top {
+  position: relative;
+  z-index: 1;
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-between;
+  gap: 14px;
 }
 
-.hero-ornaments {
-	position: relative;
-	width: 100%;
-	height: 100%;
+.hero-copy {
+  min-width: 0;
+  flex: 1;
 }
 
-.hero-glow {
-	position: absolute;
-	border-radius: 50%;
-	filter: blur(4px);
-	background: radial-gradient(circle, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0) 72%);
-	opacity: 0.9;
+.hero-badge {
+  display: inline-flex;
+  align-items: center;
+  height: 26px;
+  padding: 0 10px;
+  border-radius: 999px;
+  background: rgba(255, 255, 255, 0.16);
+  border: 1px solid rgba(255, 255, 255, 0.18);
+  color: rgba(255, 255, 255, 0.92);
+  font-size: 11px;
+  font-weight: 600;
 }
 
-.hero-glow.glow-left {
-	left: -10px;
-	top: 8px;
-	width: 120px;
-	height: 120px;
+.hero-title {
+  display: block;
+  margin-top: 12px;
+  color: #ffffff;
+  font-size: 24px;
+  font-weight: 700;
+  line-height: 1.2;
 }
 
-.hero-glow.glow-right {
-	right: -20px;
-	top: 4px;
-	width: 144px;
-	height: 144px;
-	background: radial-gradient(circle, rgba(207, 234, 255, 0.92) 0%, rgba(207, 234, 255, 0) 74%);
+.hero-subtitle {
+  display: block;
+  margin-top: 8px;
+  color: rgba(255, 255, 255, 0.84);
+  font-size: 13px;
+  line-height: 1.45;
 }
 
-.hero-mist {
-	position: absolute;
-	border-radius: 999px;
-	background: linear-gradient(90deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.08));
-	border: 1px solid rgba(255, 255, 255, 0.34);
-	backdrop-filter: blur(10px);
-	box-shadow: 0 10px 24px rgba(154, 190, 219, 0.14);
+.hero-meta {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 8px;
+  margin-top: 12px;
 }
 
-.hero-mist.mist-top {
-	left: 18px;
-	top: 20px;
-	width: 112px;
-	height: 18px;
+.hero-meta-item {
+  padding: 3px 10px;
+  border-radius: 999px;
+  background: rgba(255, 255, 255, 0.12);
+  color: rgba(255, 255, 255, 0.86);
+  font-size: 11px;
+  line-height: 18px;
 }
 
-.hero-mist.mist-bottom {
-	left: 18px;
-	top: 48px;
-	width: 72px;
-	height: 10px;
-	opacity: 0.82;
+.hero-avatar {
+  position: relative;
+  z-index: 1;
+  width: 52px;
+  height: 52px;
+  flex: 0 0 52px;
+  border-radius: 16px;
+  background: rgba(255, 255, 255, 0.18);
+  border: 1px solid rgba(255, 255, 255, 0.22);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
 }
 
-.hero-curve {
-	position: absolute;
-	border-radius: 999px;
-	border: 2px solid rgba(255, 255, 255, 0.72);
-	background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12));
-	box-shadow:
-		0 10px 26px rgba(154, 190, 219, 0.16),
-		inset 0 1px 0 rgba(255, 255, 255, 0.8);
-	backdrop-filter: blur(10px);
+.hero-avatar-text {
+  color: #ffffff;
+  font-size: 20px;
+  font-weight: 700;
 }
 
-.hero-curve.curve-main {
-	right: 18px;
-	bottom: 22px;
-	width: 176px;
-	height: 84px;
-	transform: rotate(-9deg);
-	border-top-left-radius: 90px;
-	border-bottom-right-radius: 90px;
-	opacity: 1;
+.hero-panels {
+  position: relative;
+  z-index: 1;
+  display: grid;
+  grid-template-columns: repeat(3, minmax(0, 1fr));
+  gap: 10px;
+  margin-top: 18px;
 }
 
-.hero-curve.curve-sub {
-	right: 96px;
-	bottom: 60px;
-	width: 104px;
-	height: 40px;
-	transform: rotate(-9deg);
-	border-top-left-radius: 60px;
-	border-bottom-right-radius: 60px;
-	opacity: 0.9;
+.hero-panel {
+  min-width: 0;
+  padding: 12px 10px;
+  border-radius: 14px;
+  background: rgba(11, 25, 48, 0.18);
+  border: 1px solid rgba(255, 255, 255, 0.14);
+  backdrop-filter: blur(10px);
 }
 
-.hero-wave {
-	height: 1.1rem;
-	background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(244, 249, 253, 0.96) 100%);
-	margin-top: -1px;
-	position: relative;
+.hero-panel-label {
+  display: block;
+  color: rgba(255, 255, 255, 0.7);
+  font-size: 11px;
+  line-height: 1.2;
+}
+
+.hero-panel-value {
+  display: block;
+  margin-top: 8px;
+  color: #ffffff;
+  font-size: 18px;
+  font-weight: 700;
+  line-height: 1.2;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+.hero-panel-hint {
+  display: block;
+  margin-top: 6px;
+  color: rgba(255, 255, 255, 0.72);
+  font-size: 11px;
+  line-height: 1.2;
 }
 
 .safe-top {
diff --git a/src/pages/login.vue b/src/pages/login.vue
index ee49113..2d96046 100644
--- a/src/pages/login.vue
+++ b/src/pages/login.vue
@@ -22,6 +22,21 @@
                   clearable
                   type="password"></up-input>
       </view>
+      <!-- <view class="input-item flex align-center"
+            v-if="factoryList.length > 0">
+        <up-input prefixIcon="home"
+                  placeholder="璇烽�夋嫨宸ュ巶"
+                  border="bottom"
+                  readonly
+                  @click="showFactorySelect = true"
+                  v-model="selectedFactoryName"
+                  clearable></up-input>
+        <up-action-sheet :show="showFactorySelect"
+                         :actions="factoryList"
+                         title="璇烽�夋嫨宸ュ巶"
+                         @close="showFactorySelect = false"
+                         @select="handleFactorySelect"></up-action-sheet>
+      </view> -->
       <view>
         <button @click="handleLogin"
                 class="login-btn cu-btn block bg-blue lg round">鐧诲綍</button>
@@ -70,9 +85,17 @@
   const loginForm = ref({
     userName: "",
     password: "",
-    currentFatoryName: "",
+    factoryId: "",
   });
   const factoryList = ref([]); // 鍏徃鍒楄〃
+  const showFactorySelect = ref(false);
+  const selectedFactoryName = ref("");
+
+  const handleFactorySelect = e => {
+    loginForm.value.factoryId = e.id;
+    selectedFactoryName.value = e.name;
+    showFactorySelect.value = false;
+  };
 
   // 淇濆瓨瀵嗙爜鍒版湰鍦板瓨鍌�
   function savePassword() {
@@ -127,17 +150,28 @@
               id: item.deptId,
               name: item.deptName,
             }));
+            // 濡傛灉鍙湁涓�涓伐鍘傦紝榛樿閫変腑
+            if (factoryList.value.length === 1) {
+              loginForm.value.factoryId = factoryList.value[0].id;
+              selectedFactoryName.value = factoryList.value[0].name;
+            }
           } else {
             // 濡傛灉res.data涓嶆槸鏁扮粍锛岃缃负绌烘暟缁�
             factoryList.value = [];
+            loginForm.value.factoryId = "";
+            selectedFactoryName.value = "";
           }
         })
         .catch(error => {
           showToast("鑾峰彇鍏徃鍒楄〃澶辫触:", error);
           factoryList.value = [];
+          loginForm.value.factoryId = "";
+          selectedFactoryName.value = "";
         });
     } else {
       factoryList.value = [];
+      loginForm.value.factoryId = "";
+      selectedFactoryName.value = "";
     }
   }
 
@@ -146,6 +180,8 @@
       showToast("璇疯緭鍏ユ偍鐨勮处鍙�");
     } else if (loginForm.value.password === "") {
       showToast("璇疯緭鍏ユ偍鐨勫瘑鐮�");
+    } else if (factoryList.value.length > 0 && loginForm.value.factoryId === "") {
+      showToast("璇烽�夋嫨宸ュ巶");
     } else {
       showToast("鐧诲綍涓紝璇疯�愬績绛夊緟...");
       pwdLogin();
@@ -254,7 +290,10 @@
       const accountInfo = uni.getAccountInfoSync();
       if (accountInfo?.miniProgram?.version) {
         versionName.value = accountInfo.miniProgram.version;
-        console.log("[login-version] 褰撳墠鐜=MP-WEIXIN锛岀増鏈�=", versionName.value);
+        console.log(
+          "[login-version] 褰撳墠鐜=MP-WEIXIN锛岀増鏈�=",
+          versionName.value
+        );
       }
     } catch (e) {
       // 鑾峰彇澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
@@ -270,18 +309,27 @@
         // @ts-ignore
         const appid = plus.runtime.appid;
         // @ts-ignore
-        plus.runtime.getProperty(appid, (info) => {
+        plus.runtime.getProperty(appid, info => {
           const v = info?.version || info?.versionName || "";
           if (v) {
             versionName.value = String(v);
-            console.log("[login-version] 褰撳墠鐜=APP-PLUS锛岀増鏈�=", versionName.value);
+            console.log(
+              "[login-version] 褰撳墠鐜=APP-PLUS锛岀増鏈�=",
+              versionName.value
+            );
           } else {
-            console.log("[login-version] APP-PLUS 鑾峰彇鍒扮殑鐗堟湰瀛楁涓虹┖锛屼娇鐢ㄩ粯璁ゅ��:", versionName.value);
+            console.log(
+              "[login-version] APP-PLUS 鑾峰彇鍒扮殑鐗堟湰瀛楁涓虹┖锛屼娇鐢ㄩ粯璁ゅ��:",
+              versionName.value
+            );
           }
           console.log("[login-version] 鏈�缁堢増鏈彿:", versionName.value);
         });
       } else {
-        console.log("[login-version] APP-PLUS 鐜涓嬬己灏� getProperty锛屼娇鐢ㄩ粯璁ゅ��:", versionName.value);
+        console.log(
+          "[login-version] APP-PLUS 鐜涓嬬己灏� getProperty锛屼娇鐢ㄩ粯璁ゅ��:",
+          versionName.value
+        );
         console.log("[login-version] 鏈�缁堢増鏈彿:", versionName.value);
       }
       // #endif
diff --git a/src/pages/productionManagement/productionReport/index.vue b/src/pages/productionManagement/productionReport/index.vue
index 4687c62..ac92038 100644
--- a/src/pages/productionManagement/productionReport/index.vue
+++ b/src/pages/productionManagement/productionReport/index.vue
@@ -423,8 +423,11 @@
         }
       }
 
-      form.value.planQuantity =
-        orderRow.planQuantity != null ? String(orderRow.planQuantity) : "";
+      const planQuantity = Number(orderRow.planQuantity || 0);
+      const completeQuantity = Number(orderRow.completeQuantity || 0);
+      form.value.planQuantity = String(
+        Math.max(0, planQuantity - completeQuantity)
+      );
       form.value.workOrderId = orderRow.id || "";
       form.value.reportWork = orderRow.reportWork || "";
       form.value.productionOrderRoutingOperationId =
diff --git a/src/pages/works.vue b/src/pages/works.vue
index 963efe5..65fd28a 100644
--- a/src/pages/works.vue
+++ b/src/pages/works.vue
@@ -1279,6 +1279,7 @@
 
     // 杩囨护鍚勪釜妯″潡
     filterArray(marketingItems);
+    filterArray(designItems);
     filterArray(purchaseItems, menuMapping.purchase.specialMapping);
     filterArray(financeManagementItems);
     filterArray(collaborationItems, menuMapping.collaboration.specialMapping);
@@ -1289,6 +1290,7 @@
     filterArray(productionItems);
     filterArray(equipmentItems);
     filterArray(archiveManagementItems);
+    filterArray(afterSalesServiceItems);
   };
 
   // 妫�鏌ユā鍧楁槸鍚︽湁鑿滃崟椤归渶瑕佹樉绀�
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 140e0a3..07b0f1c 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -1,9 +1,9 @@
-import {logout, getInfo, loginCheckFactory} from "@/api/login";
+import { logout, getInfo, loginCheckFactory } from "@/api/login";
 import { getRouters as getRoutersApi } from "@/api/menu";
 import { getToken, setToken, removeToken } from "@/utils/auth";
 import defAva from "@/static/images/profile.jpg";
 import { defineStore } from "pinia";
-import config from '@/config.js'
+import config from "@/config.js";
 
 export interface LoginForm {
   userName: string;
@@ -28,43 +28,54 @@
   actions: {
     // 閮ㄩ棬鐧诲綍
     loginCheckFactory(userInfo: any) {
-      const userName = userInfo.userName
-      const password = userInfo.password
+      const userName = userInfo.userName.trim();
+      const password = userInfo.password;
+      const factoryId = userInfo.factoryId;
       return new Promise((resolve, reject) => {
-        loginCheckFactory(userName, password).then((res: any) => {
-          setToken(res.token)
-          this.token = res.token
-          resolve(null)
-        }).catch((error: any) => {
-          reject(error)
-        })
-      })
+        loginCheckFactory(userName, password, factoryId)
+          .then((res: any) => {
+            const token = res.token || res.data?.token;
+            if (token) {
+              setToken(token);
+              this.token = token;
+              resolve(null);
+            } else {
+              reject("鏈幏鍙栧埌鐧诲綍浠ょ墝");
+            }
+          })
+          .catch((error: any) => {
+            reject(error);
+          });
+      });
     },
     // 鑾峰彇鐢ㄦ埛淇℃伅
     getInfo() {
       return new Promise((resolve, reject) => {
         getInfo()
           .then((res: any) => {
-            const user = res.user
-            let avatar = user.avatar || ""
-            avatar = config.baseUrl + '/profile/' + avatar
-            if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
-              this.roles = res.roles
-              this.permissions = res.permissions
+            // 鍏煎 res.data 缁撴瀯
+            const data = res.data || res;
+            const user = data.user || {};
+            let avatar = user.avatar || "";
+            avatar = config.baseUrl + "/profile/" + avatar;
+            if (data.roles && data.roles.length > 0) {
+              // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
+              this.roles = data.roles;
+              this.permissions = data.permissions;
             } else {
-              this.roles = ['ROLE_DEFAULT']
+              this.roles = ["ROLE_DEFAULT"];
             }
-            this.id = user.userId
-            this.name = user.userName
-            this.avatar = avatar
-            this.currentFactoryName = user.currentFactoryName
-            this.nickName = user.nickName
-            this.roleName = user.roles[0].roleName
-            this.currentDeptId = user.tenantId
-            this.currentLoginTime = this.getCurrentTime()
-            resolve(res);
+            this.id = user.userId || "";
+            this.name = user.userName || "";
+            this.avatar = avatar;
+            this.currentFactoryName = user.currentFactoryName || "";
+            this.nickName = user.nickName || "";
+            this.roleName = Array.isArray(user.roles) && user.roles.length > 0 ? user.roles[0].roleName || "" : "";
+            this.currentDeptId = user.tenantId || "";
+            this.currentLoginTime = this.getCurrentTime();
+            resolve(data);
           })
-          .catch((error) => {
+          .catch(error => {
             reject(error);
           });
       });
@@ -83,19 +94,19 @@
             removeToken();
             resolve(null);
           })
-          .catch((error) => {
+          .catch(error => {
             reject(error);
           });
       });
     },
     getCurrentTime() {
       const now = new Date();
-      const year = now.getFullYear();       // 鑾峰彇骞翠唤
-      const month = String(now.getMonth() + 1).padStart(2, '0');  // 鏈堜唤浠�0寮�濮嬶紝瑕�+1锛屽苟琛ラ浂
-      const day = String(now.getDate()).padStart(2, '0');         // 鏃ユ湡琛ラ浂
-      const hours = String(now.getHours()).padStart(2, '0');      // 灏忔椂琛ラ浂
-      const minutes = String(now.getMinutes()).padStart(2, '0');  // 鍒嗛挓琛ラ浂
-      const seconds = String(now.getSeconds()).padStart(2, '0');  // 绉掓暟琛ラ浂
+      const year = now.getFullYear(); // 鑾峰彇骞翠唤
+      const month = String(now.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮嬶紝瑕�+1锛屽苟琛ラ浂
+      const day = String(now.getDate()).padStart(2, "0"); // 鏃ユ湡琛ラ浂
+      const hours = String(now.getHours()).padStart(2, "0"); // 灏忔椂琛ラ浂
+      const minutes = String(now.getMinutes()).padStart(2, "0"); // 鍒嗛挓琛ラ浂
+      const seconds = String(now.getSeconds()).padStart(2, "0"); // 绉掓暟琛ラ浂
       return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
     },
     // 鑾峰彇璺敱鏉冮檺
@@ -107,7 +118,7 @@
             this.routers = res.data || [];
             resolve(res);
           })
-          .catch((error) => {
+          .catch(error => {
             reject(error);
           });
       });

--
Gitblit v1.9.3