From 2e77330d87341624c88301562fd137b58f9a101a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 25 十二月 2025 10:57:35 +0800
Subject: [PATCH] 1.海川开心-录入日期都默认当天,封装公用组件和方法
---
src/views/inventoryManagement/issueManagement/index.vue | 62 ++++++++++++++++++++-----------
1 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index e4f5bd0..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,10 +218,10 @@
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
@@ -244,7 +246,7 @@
page.current = 1
searchForm.value.supplierName = ''
searchForm.value.customerName = ''
- searchForm.value.timeStr = ''
+ // searchForm.value.timeStr = ''
selectedRows.value = []
searchForm.value.productCategory = ''
getList()
@@ -288,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: '',
+ }
}
}
@@ -387,14 +412,6 @@
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 = () => {
@@ -454,3 +471,4 @@
<style scoped lang="scss"></style>
+
--
Gitblit v1.9.3