From 60a702a3dbcbe6e16a26faab49e66d710d1f8656 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 十一月 2025 14:57:36 +0800
Subject: [PATCH] 湟水峡-销售台账/采购台账,有可能同一个公司不同单子,但是开票登记的时候会一起,一对多或者多对一

---
 src/views/inventoryManagement/issueManagement/index.vue |  109 ++++++++++++++++++------------------------------------
 1 files changed, 37 insertions(+), 72 deletions(-)

diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index f2c73cb..dec04a5 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -5,12 +5,20 @@
         <span class="search_title">渚涘簲鍟嗗悕绉帮細</span>
         <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery"
           clearable prefix-icon="Search" />
+        <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
+        <el-date-picker
+          v-model="searchForm.timeStr"
+          type="date"
+          placeholder="璇烽�夋嫨鏃ユ湡"
+          value-format="YYYY-MM-DD"
+          format="YYYY-MM-DD"
+          clearable
+          @change="handleQuery"
+        />
         <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
       </div>
       <div>
-        <!-- <el-button type="primary" @click="openForm('add')">鏂板鍑哄簱</el-button> -->
         <el-button @click="handleOut">瀵煎嚭</el-button>
-        <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> -->
       </div>
     </div>
     <div class="table_list">
@@ -26,7 +34,6 @@
         <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="200" show-overflow-tooltip />
         <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
         <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="90" show-overflow-tooltip />
-        <el-table-column label="搴撳瓨鏁伴噺" prop="inboundNum0" width="90" show-overflow-tooltip />
         <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
         <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />
         <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip />
@@ -68,17 +75,15 @@
 
 <script setup>
 import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref } from 'vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
 import { ElMessageBox } from "element-plus";
 import useUserStore from '@/store/modules/user'
-import { userListNoPage } from "@/api/system/user.js";
+import { userListNoPageByTenantId } from "@/api/system/user.js";
 import {
-  getStockInPage
+	getStockInPage,
 } from "@/api/inventoryManagement/stockIn.js";
 import {
-  getStockManagePage,
-    delStockManage,
-    stockOut,
+  stockOut,
 } from "@/api/inventoryManagement/stockManage.js";
 
 const userStore = useUserStore()
@@ -92,17 +97,13 @@
   size: 100,
 })
 const total = ref(0)
-const fileList = ref([])
 
 // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
 const dialogFormVisible = ref(false)
 const data = reactive({
   searchForm: {
     supplierName: '',
-    inboundQuantity:'',
-    inboundTime:'',
-    nickName: '',
-    userId: '',
+    timeStr: '',
   },
   form: {
     productrecordId: '',
@@ -128,34 +129,24 @@
 }
 const getList = () => {
   tableLoading.value = true
-  getStockInPage({ ...searchForm.value, ...page }).then(res => {
+  const params = { 
+    ...page,
+    supplierName: searchForm.value.supplierName,
+    timeStr: searchForm.value.timeStr
+  }
+  
+  getStockInPage(params).then(res => {
     tableLoading.value = false
     tableData.value = res.data.records
-    console.log('res', res.data.records)
+    total.value = res.data.total
   }).catch(() => {
     tableLoading.value = false
   })
 }
 
-const findNodeById = (nodes, productId) => {
-  for (let i = 0; i < nodes.length; i++) {
-    if (nodes[i].value === productId) {
-      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
-    }
-    if (nodes[i].children && nodes[i].children.length > 0) {
-      const foundNode = findNodeById(nodes[i].children, productId);
-      if (foundNode) {
-        return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
-      }
-    }
-  }
-  return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
 // 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = (selection) => {
-  // 杩囨护鎺夊瓙鏁版嵁
   selectedRows.value = selection.filter(item => item.id);
-  console.log('selection', selectedRows.value)
 }
 const expandedRowKeys = ref([])
 
@@ -163,8 +154,7 @@
 const summarizeMainTable = (param) => {
   return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
 };
-const currentRowId = ref(null) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
-
+const currentRowId = ref(null)
 const currentRowNum = ref(0)
 const salesLedgerProductId = ref(null);
 
@@ -175,17 +165,15 @@
   currentRowNum.value = row.inboundNum0
   salesLedgerProductId.value = row.salesLedgerProductId
   form.value = {}
-  // 鍒濆鍖栬〃鍗曟暟鎹�
   form.value = {
     productrecordId: '',
-    inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖
-    inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
-    nickName: '', // 榛樿褰撳墠鐢ㄦ埛
+    inboundQuantity: '',
+    inboundTime: getCurrentDate(),
+    nickName: '',
   }
-  console.log('form',form.value)
   // 鍔犺浇鐢ㄦ埛鍒楄〃
   try {
-    const userLists = await userListNoPage()
+    const userLists = await userListNoPageByTenantId()
     userList.value = userLists.data
   } catch (error) {
     console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
@@ -195,19 +183,19 @@
 // 鎻愪氦琛ㄥ崟
 const submitForm = () => {
   let num = Number(form.value.inboundQuantity)
-  if(num < 1 || num > currentRowNum.value){
+  if(num <= 0 || num > currentRowNum.value){
     return proxy.$modal.msgWarning("璇峰~鍏ユ湁鏁堟暟瀛�")
   }
   proxy.$refs["formRef"].validate(valid => {
     if (valid && currentRowId.value) {
       const outData = {
-        id: currentRowId.value, // 鍘熷璁板綍ID
+        id: currentRowId.value,
         salesLedgerProductId: salesLedgerProductId.value,
-        quantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
-        time: form.value.inboundTime, // 鍑哄簱鏃堕棿
-        userId: form.value.nickName // 鎿嶄綔浜�
+        quantity: form.value.inboundQuantity,
+        time: form.value.inboundTime,
+        userId: form.value.nickName,
+        type: 1 // 閲囪喘鍑哄簱
       }
-      console.log(outData)
 
       stockOut(outData).then(res => {
         proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
@@ -219,6 +207,7 @@
     }
   })
 }
+
 // 鍏抽棴寮规
 const closeDia = () => {
   proxy.resetForm("formRef")
@@ -240,36 +229,12 @@
     proxy.$modal.msg("宸插彇娑�")
   })
 }
-// 鍒犻櫎
-const handleDelete = () => {
-  let ids = []
-  if (selectedRows.value.length > 0) {
-    ids = selectedRows.value.map(item => item.id);
-  } else {
-    proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁')
-    return
-  }
-  ElMessageBox.confirm(
-    '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
-    '瀵煎嚭', {
-    confirmButtonText: '纭',
-    cancelButtonText: '鍙栨秷',
-    type: 'warning',
-  }
-  ).then(() => {
-    delStockManage(ids).then(res => {
-      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
-      getList()
-    })
-  }).catch(() => {
-    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 month = String(today.getMonth() + 1).padStart(2, '0');
   const day = String(today.getDate()).padStart(2, '0');
   return `${year}-${month}-${day}`;
 }

--
Gitblit v1.9.3