From 729b38ccaa1439af3f23b8457a6ec2271d1e9c1a Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期四, 04 九月 2025 23:19:19 +0800
Subject: [PATCH] art: 热处理入库

---
 src/views/lsw/LswMateriaView.vue |  138 ++++++++++++---------------------------------
 1 files changed, 37 insertions(+), 101 deletions(-)

diff --git a/src/views/lsw/LswMateriaView.vue b/src/views/lsw/LswMateriaView.vue
index adbb7c5..52f29b9 100644
--- a/src/views/lsw/LswMateriaView.vue
+++ b/src/views/lsw/LswMateriaView.vue
@@ -40,8 +40,7 @@
         </a-row>
       </a-form>
     </div>
-    <!--    <a-button @click="handleAdd" type="primary" icon="plus">鏂板鐗╂枡淇℃伅-娴嬭瘯</a-button>-->
-    <a-spin :spinning="confirmLoading">
+    <a-spin :spinning="loading">
       <div>
         <!-- 涓昏〃鍗曞尯鍩� -->
         <a-table
@@ -55,6 +54,7 @@
           :pagination="ipagination"
           :loading="loading"
           :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
+          :customRow="customTableRow"
           @change="handleTableChange">
           <!--鐘舵�佹爮涓�у睍绀�-->
           <span
@@ -118,24 +118,9 @@
         </a-table>
       </div>
       <!-- 瀛愯〃鍗曞尯鍩� -->
-      <a-tabs v-model="activeKey" @change="handleChangeTabs">
-        <a-tab-pane tab="鐗╂枡搴撳瓨淇℃伅" :key="refKeys[0]" :forceRender="true">
-          <div style="display: flex; align-items: center; margin-bottom: 10px;">
-            <a-tag color="green" style="font-weight: bold;">
-              搴撳瓨鎬婚噺锛歿{ totalInventoryQuantity }}
-            </a-tag>
-          </div>
-          <j-vxe-table
-            keep-source
-            :ref="refKeys[0]"
-            :loading="lswMaterialInventoryTable.loading"
-            :columns="lswMaterialInventoryTable.columns"
-            :dataSource="lswMaterialInventoryTable.dataSource"
-            :maxHeight="300"
-            :rowNumber="true"
-            :rowSelection="true"
-            :toolbar="false"
-          />
+      <a-tabs v-model="activeKey">
+        <a-tab-pane tab="搴撳瓨鏄庣粏" key="lswMaterialInventory" :forceRender="true">
+          <lsw-material-inventory-list ref="lswMaterialInventory" />
         </a-tab-pane>
       </a-tabs>
     </a-spin>
@@ -146,18 +131,16 @@
 <script>
 
 import { getAction } from '@/api/manage'
-import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
-import { JVXETypes } from '@/components/jeecg/JVxeTable'
-import JFormContainer from '@/components/jeecg/JFormContainer'
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import LswMaterialModal from '@views/lsw/modules/LswMaterialModal.vue'
+import LswMaterialInventoryList from './LswMaterialInventoryList.vue'
 
 export default {
-  name: 'LswMaterialForm',
-  mixins: [JVxeTableModelMixin, JeecgListMixin],
+  name: 'LswMaterialView',
+  mixins: [JeecgListMixin],
   components: {
     LswMaterialModal,
-    JFormContainer
+    LswMaterialInventoryList
   },
   data() {
     return {
@@ -175,8 +158,6 @@
       validatorRules: {},
       selectedRowKeys: [], // 鍒濆鍖栦负绌烘暟缁勶紙鍗曢�夋椂瀛樺偍鍗曚釜key锛�
       selectedRowData: null,
-      refKeys: ['lswMaterialInventory'],
-      tableKeys: ['lswMaterialInventory'],
       activeKey: 'lswMaterialInventory',
       columns: [
         {
@@ -226,63 +207,12 @@
           scopedSlots: { customRender: 'action' }
         }
       ],
-      // 鐗╂枡搴撳瓨淇℃伅
-      lswMaterialInventoryTable: {
-        loading: false,
-        dataSource: [],
-        columns: [
-          {
-            title: '鎵规鍙�',
-            key: 'batchNumber',
-            type: JVXETypes.input,
-            width: '200px',
-            placeholder: '璇疯緭鍏�${title}',
-            defaultValue: ''
-          },
-          {
-            title: '搴撳瓨绫诲瀷',
-            key: 'inventoryCategory',
-            type: JVXETypes.input,
-            width: '200px',
-            placeholder: '璇疯緭鍏�${title}',
-            defaultValue: ''
-          },
-          {
-            title: '鏁伴噺',
-            key: 'quantity',
-            type: JVXETypes.input,
-            width: '200px',
-            placeholder: '璇疯緭鍏�${title}',
-            defaultValue: ''
-          },
-          {
-            title: '搴撳瓨鍦�',
-            key: 'warehouseName',
-            type: JVXETypes.input,
-            width: '200px',
-            placeholder: '璇疯緭鍏�${title}',
-            defaultValue: ''
-          },
-          {
-            title: '搴撳瓨鐘舵��',
-            key: 'inventoryStatus',
-            type: JVXETypes.input,
-            width: '200px',
-            placeholder: '璇疯緭鍏�${title}',
-            defaultValue: ''
-          }
-        ]
-      },
       url: {
-        //searchlikeQuery
         list: '/lsw/lswMaterial/list',
         edit: '/lsw/lswMaterial/edit',
         active: '/lsw/lswMaterial/active',
         inactive: '/lsw/lswMaterial/inactive',
         queryById: '/lsw/lswMaterial/queryById',
-        lswMaterialInventory: {
-          list: '/lsw/lswMaterial/queryLswMaterialInventoryByMainId'
-        }
       }
     }
   },
@@ -298,15 +228,6 @@
     formDisabled() {
       return this.disabled
     },
-    totalInventoryQuantity() {
-      if (!this.lswMaterialInventoryTable.dataSource || this.lswMaterialInventoryTable.dataSource.length === 0) {
-        return '0'
-      }
-      return this.lswMaterialInventoryTable.dataSource.reduce((sum, item) => {
-        const quantity = Number(item.quantity) || 0
-        return sum + quantity
-      }, 0)
-    },
   },
   created() {
   },
@@ -318,21 +239,20 @@
       }
       return ''
     },
-    handleTableChange() {
-      console.log('test---->', this.selectedRowKeys[0])
-    },
     async onSelectChange(selectedRowKeys) {
-      this.lswMaterialInventoryTable.loading = true
       // 鍗曢�夋ā寮忎笅锛宻electedRowKeys 鏄暟缁勶紝浣嗛暱搴︽渶澶氫负1
-      console.log('鐐瑰嚮浜�---->')
       this.selectedRowKeys = selectedRowKeys
-      this.lswMaterialInventoryTable.dataSource = []
       // 鑾峰彇閫変腑琛岀殑瀹屾暣鏁版嵁
-      if (selectedRowKeys.length > 0) {
-        const selectedId = selectedRowKeys[0] // 閫変腑琛岀殑id
-        const lswMaterialInventoryResult = await getAction(this.url.lswMaterialInventory.list, { 'id': selectedId })
-        this.lswMaterialInventoryTable.dataSource = lswMaterialInventoryResult.result
-        this.lswMaterialInventoryTable.loading = false
+      if (selectedRowKeys.length === 1) {
+        //鍔犺浇搴撳瓨淇℃伅
+        this.$refs.lswMaterialInventory.queryParam.materialId = this.selectedRowKeys[0]
+        this.$refs.lswMaterialInventory.loadData(1)
+        this.$refs.lswMaterialInventory.statisticsInventory(this.selectedRowKeys[0])
+      }else {
+        //搴撳瓨淇℃伅娓呯┖
+        this.$refs.lswMaterialInventory.queryParam.materialId = 'null'
+        this.$refs.lswMaterialInventory.loadData(1)
+        this.$refs.lswMaterialInventory.statisticsInventory('null')
       }
     },
     handleActive(record) {
@@ -349,8 +269,24 @@
           that.$message.warning(res.message)
         }
       })
-    }
-
+    },
+    /**
+     * 鑷畾涔夎〃鏍艰
+     * @param record 琛ㄦ牸琛屼俊鎭�
+     * @returns {{style: {cursor: string}, on: {click: *}}} 鏍峰紡瀵硅薄涓庝簨浠舵柟娉�
+     */
+    customTableRow(record) {
+      return {
+        style: {
+          cursor: 'pointer'
+        },
+        on: {
+          click: () => {
+            this.onSelectChange([record.id])
+          }
+        }
+      }
+    },
   }
 }
 </script>

--
Gitblit v1.9.3