From 7c863257d23fd7f01c84a8996677e682d9d50b07 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 30 十二月 2025 09:38:38 +0800
Subject: [PATCH] 1.海川开心-部分页面添加默认值

---
 src/views/inventoryManagement/issueManagement/index.vue |   83 +++++++++++++++++++++++++----------------
 1 files changed, 51 insertions(+), 32 deletions(-)

diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index 7e8e580..02106f6 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -121,14 +121,15 @@
       <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
 			<div>{{getAvailableQuantityText()}}:{{currentRowNum}}</div>
         <el-form-item :label="getQuantityLabel()" prop="salesContractNo">
-          <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
+          <el-input-number :step="0.01" :min="0" :max="currentRowNum" style="width: 100%" v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
         </el-form-item>
         <el-form-item :label="getDateLabel()" prop="projectName">
           <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
             type="date" placeholder="璇烽�夋嫨" clearable />
         </el-form-item>
         <el-form-item :label="getPersonLabel()" prop="entryPerson">
-          <el-select v-model="form.nickName"                 filterable
+          <el-select v-model="form.nickName"
+										 filterable
                      default-first-option
                      :reserve-keyword="false" placeholder="璇烽�夋嫨" clearable>
             <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
@@ -161,6 +162,7 @@
     delStockManage,
     stockOut,
 } from "@/api/inventoryManagement/stockManage.js";
+import { getCurrentDate } from "@/utils/index.js";
 
 const userStore = useUserStore()
 const { proxy } = getCurrentInstance()
@@ -187,7 +189,7 @@
     nickName: '',
     userId: '',
     productCategory:'',
-    timeStr: getCurrentDate(),
+    // timeStr: getCurrentDate(),
   },
   form: {
     productrecordId: '',
@@ -216,12 +218,13 @@
   const params = { ...page }
   if (activeTab.value === 'production') {
     params.customerName = searchForm.value.customerName
-    params.timeStr = searchForm.value.timeStr
+    // params.timeStr = searchForm.value.timeStr
   } else {
     params.supplierName = searchForm.value.supplierName
-    params.timeStr = searchForm.value.timeStr
+    // params.timeStr = searchForm.value.timeStr
   }
   params.productCategory = searchForm.value.productCategory
+  params.flag = true
   let apiCall
   if (activeTab.value === 'production') {
     apiCall = getStockInPageByProduction(params)
@@ -243,7 +246,7 @@
   page.current = 1
   searchForm.value.supplierName = ''
   searchForm.value.customerName = ''
-  searchForm.value.timeStr = ''
+  // searchForm.value.timeStr = ''
   selectedRows.value = []
   searchForm.value.productCategory = ''
   getList()
@@ -287,20 +290,43 @@
   currentRowNum.value = row.inboundNum0
   salesLedgerProductId.value = row.salesLedgerProductId
   form.value = {}
-  // 鍒濆鍖栬〃鍗曟暟鎹�
-  form.value = {
-    productrecordId: '',
-    inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖
-    inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
-    nickName: '', // 榛樿褰撳墠鐢ㄦ埛
-  }
-  console.log('form',form.value)
+  
   // 鍔犺浇鐢ㄦ埛鍒楄〃
   try {
     const userLists = await userListNoPageByTenantId()
     userList.value = userLists.data
+    
+    // 鏍规嵁tab绫诲瀷璁剧疆榛樿鍙戣揣浜�
+    let defaultPersonName = ''
+    if (activeTab.value === 'production') {
+      defaultPersonName = '閭撹幑鑾�'
+    } else if (activeTab.value === 'purchase') {
+      defaultPersonName = '鍚寸帀姊�'
+    } else if (activeTab.value === 'manual') {
+      defaultPersonName = '浣曠惣鍗�'
+    }
+    
+    // 鏌ユ壘瀵瑰簲鐨勭敤鎴稩D
+    const defaultPerson = userList.value.find(user => user.nickName === defaultPersonName)
+    const defaultUserId = defaultPerson ? defaultPerson.userId : ''
+    
+    // 鍒濆鍖栬〃鍗曟暟鎹�
+    form.value = {
+      productrecordId: '',
+      inboundQuantity: currentRowNum.value, // 浣跨敤currentRowNum浣滀负榛樿鍊�
+      inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
+      nickName: defaultUserId, // 鏍规嵁tab绫诲瀷璁剧疆榛樿鍙戣揣浜�
+    }
+    console.log('form',form.value)
   } catch (error) {
     console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
+    // 濡傛灉鍔犺浇澶辫触锛屼娇鐢ㄧ┖鍊煎垵濮嬪寲
+    form.value = {
+      productrecordId: '',
+      inboundQuantity: currentRowNum.value,
+      inboundTime: getCurrentDate(),
+      nickName: '',
+    }
   }
 }
 
@@ -386,21 +412,13 @@
     proxy.$modal.msg("宸插彇娑�")
   })
 }
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
-  const today = new Date();
-  const year = today.getFullYear();
-  const month = String(today.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮�
-  const day = String(today.getDate()).padStart(2, '0');
-  return `${year}-${month}-${day}`;
-}
 
 // 鏍规嵁tab绫诲瀷鑾峰彇寮规鏍囬
 const getDialogTitle = () => {
   const titleMap = {
     production: '鏂板鍙戣揣',
-    purchase: '鏂板棰嗙敤',
-    manual: '鏂板棰嗙敤'
+    purchase: '鏂板鍙戞枡',
+    manual: '鏂板鍙戞枡'
   };
   return titleMap[activeTab.value] || '鏂板鍑哄簱';
 };
@@ -409,8 +427,8 @@
 const getAvailableQuantityText = () => {
   const textMap = {
     production: '鍙彂璐ф暟閲�',
-    purchase: '鍙鐢ㄦ暟閲�',
-    manual: '鍙鐢ㄦ暟閲�'
+    purchase: '鍙彂鏂欐暟閲�',
+    manual: '鍙彂鏂欐暟閲�'
   };
   return textMap[activeTab.value] || '鍙嚭搴撴暟閲�';
 };
@@ -419,8 +437,8 @@
 const getQuantityLabel = () => {
   const labelMap = {
     production: '鍙戣揣鏁伴噺锛�',
-    purchase: '棰嗙敤鏁伴噺锛�',
-    manual: '棰嗙敤鏁伴噺锛�'
+    purchase: '鍙戞枡鏁伴噺锛�',
+    manual: '鍙戞枡鏁伴噺锛�'
   };
   return labelMap[activeTab.value] || '鍑哄簱鏁伴噺锛�';
 };
@@ -429,8 +447,8 @@
 const getDateLabel = () => {
   const labelMap = {
     production: '鍙戣揣鏃ユ湡锛�',
-    purchase: '棰嗙敤鏃ユ湡锛�',
-    manual: '棰嗙敤鏃ユ湡锛�'
+    purchase: '鍙戞枡鏃ユ湡锛�',
+    manual: '鍙戞枡鏃ユ湡锛�'
   };
   return labelMap[activeTab.value] || '鍑哄簱鏃ユ湡锛�';
 };
@@ -439,8 +457,8 @@
 const getPersonLabel = () => {
   const labelMap = {
     production: '鍙戣揣浜猴細',
-    purchase: '棰嗙敤浜猴細',
-    manual: '棰嗙敤浜猴細'
+    purchase: '鍙戞枡浜猴細',
+    manual: '鍙戞枡浜猴細'
   };
   return labelMap[activeTab.value] || '鍑哄簱浜猴細';
 };
@@ -453,3 +471,4 @@
 <style scoped lang="scss"></style>
 
 
+

--
Gitblit v1.9.3