Browse Source

库存管理-选择弹窗-跨页选择

jingbb 3 months ago
parent
commit
16f0e42c39

+ 1 - 0
src/views/inventiry/inventoryCheck/components/inventoryCheckForm.vue

@@ -293,6 +293,7 @@
           item.inventoryQuantity = item.quantity ? item.quantity : 0;
           item.countedQuantity = 0;
           item.inventory = Number(item.countedQuantity) - Number(item.inventoryQuantity);
+          item.id = undefined
         });
         var xTable = stockDetailsTableRef.value!.getXTable()
         var arr = xTable.data.concat(data);

+ 2 - 1
src/views/inventiry/otherIn/components/otherInForm.vue

@@ -358,6 +358,7 @@
           item.productClass = item.classId_dictText
           item.productCode = item.code
           item.productId = item.id
+          item.id = undefined
         })
         var xTable = stockInTableRef.value!.getXTable()
         var arrProduct = xTable.data.concat(data)
@@ -373,7 +374,7 @@
         data.map(item=>{
           item.shipowner = item.relateCustomer
           item.shipId = item.id;
-
+          item.id=undefined
         })
         var xTable = otherInShipTableRef.value!.getXTable()
         var arr = xTable.data.concat(data)

+ 1 - 0
src/views/inventiry/otherOut/components/otherOutForm.vue

@@ -265,6 +265,7 @@
           item.productClass = item.productionClass_dictText;
           item.stockOutQuantity = item.quantity;
           item.inventorySelection = item.batchCode;
+          item.id = undefined
         });
         var xTable = otherOutTableRef.value!.getXTable()
         var arr = xTable.data.concat(data);

+ 50 - 12
src/views/inventiry/salesOutbound/components/SelectDeliveryModal.vue

@@ -123,7 +123,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 3500, y: 400 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{  onSelect: onSelect, onSelectAll: onSelectAll,selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -225,6 +225,7 @@
             dataIndex: 'englishName',
             align:"center",
             width:250,
+            ellipsis: true,
         },
         {
             title: '型号(childModel)',
@@ -256,15 +257,15 @@
         },
         {
             title: '单价(price)',
-            key: 'salePrice',
-            dataIndex: 'salePrice',
+            key: 'taxPrice',
+            dataIndex: 'taxPrice',
             align:"center",
             ellipsis: true,
         },
         {
             title: '金额(tax money)',
-            key: 'taxAmount',
-            dataIndex: 'taxAmount',
+            key: 'money',
+            dataIndex: 'money',
             align:"center",
             ellipsis: true,
         },
@@ -287,7 +288,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var deliveryDate = ref([])
     const queryParams = ref({
@@ -378,13 +379,50 @@
     function handleToggleSearch(){
         toggleSearchStatus.value = !toggleSearchStatus.value;
     }
-    function onSelectChange(keys,rows){
-        selectedRowKeys.value = keys
-        selectedRows.value = rows
+    function onSelectChange(selectedRowKeys1, selectionRows1) {
+        var arr = []
+        selectionRows.value.map(item=>{
+            arr.push(item.childId)
+        })
+        selectedRowKeys.value =  arr
+    }
+    function onSelect(record, selected, selectionRows1, nativeEvent) {
+        if (selected) {
+            selectionRows.value.push(record)
+            console.log( selectionRows.value);
+        }else{
+            const delIndex = selectionRows.value.findIndex((val) => {
+            return val.childId === record.childId
+            })
+            selectionRows.value.splice(delIndex, 1)
+        }
+    }
+    function onSelectAll(selected, selectionRows1, changeRows) {
+        if (selected) {
+            selectionRows.value = selectionRows.value.concat(changeRows)
+        }
+        if (!selected) {
+            let selectionRows2 = JSON.parse(JSON.stringify(selectionRows.value))
+            const delIndex = []
+            selectionRows2.forEach((item, index) => {
+            changeRows.forEach((val, itemIndex) => {
+                if (item.childId === val.childId) {
+                delIndex.push(index)
+                }
+            })
+            })
+            delIndex.forEach((item) => {
+            delete selectionRows2[item]
+            })
+            selectionRows2 = selectionRows2.filter((item) => {
+                return item !== undefined
+            })
+            selectionRows.value = selectionRows2
+        }
     }
     function handleOk(){
         var arr = []
-        selectedRows.value.map(item=>arr.push(item.billCode))
+        selectionRows.value.map(item=>arr.push(item.billCode))
         if(fatherSourceCode.value&&fatherSourceCode.value!==''){
             arr.push(fatherSourceCode.value)
         }
@@ -393,14 +431,14 @@
         }else if(new Set(arr).size!==1){
             message.error('请勾选发货单号相同的数据');
         }else{
-            emit('SelectDelivery', selectedRows.value)
+            emit('SelectDelivery', selectionRows.value)
             handleCancel()
         }
     }
     function handleCancel(){
         visible.value = false
         selectedRowKeys.value = []
-        selectedRows.value=[]
+        selectionRows.value=[]
         deliveryDate.value = []
         queryParams.value = {
             billCode:'',

+ 4 - 0
src/views/publicComponents/SelectSaleOrderModal.vue

@@ -403,6 +403,8 @@
     }
     function searchQuery(){
         pagination.value.current = 1
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -427,6 +429,8 @@
         }
         pagination.value.current =1;
         pagination.value.pageSize = 10; 
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function handleToggleSearch(){

+ 1 - 0
src/views/publicComponents/SelectShipSModal.vue

@@ -44,6 +44,7 @@
             },
            showTableSetting:false,
            showActionColumn:false,
+           rowKey: 'id',
            actionColumn: {
                width: 200,
                fixed:'right'

+ 50 - 8
src/views/publicComponents/SelectStaningStockModal.vue

@@ -139,7 +139,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 3500, y: 420 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{onSelect: onSelect, onSelectAll: onSelectAll, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -228,6 +228,7 @@
             dataIndex: 'englishName',
             align:"center",
             width:250,
+            ellipsis: true,
         },
         {
             title: '产品中文名(chinese name)',
@@ -289,7 +290,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     const queryParams = ref({
         warehouse:'',
@@ -364,6 +365,8 @@
     };
     function searchQuery(){
         pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -385,20 +388,59 @@
         }
         pagination.value.current =1;
         pagination.value.pageSize = 10; 
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function handleToggleSearch(){
         toggleSearchStatus.value = !toggleSearchStatus.value;
     }
-    function onSelectChange(keys,rows){
-        selectedRowKeys.value = keys
-        selectedRows.value = rows
+    function onSelectChange(selectedRowKeys1, selectionRows1) {
+        var arr = []
+        selectionRows.value.map(item=>{
+            arr.push(item.id)
+        })
+        selectedRowKeys.value =  arr
+    }
+    function onSelect(record, selected, selectionRows1, nativeEvent) {
+        if (selected) {
+            selectionRows.value.push(record)
+            console.log( selectionRows.value);
+        }else{
+            const delIndex = selectionRows.value.findIndex((val) => {
+            return val.id === record.id
+            })
+            selectionRows.value.splice(delIndex, 1)
+        }
+    }
+    function onSelectAll(selected, selectionRows1, changeRows) {
+        if (selected) {
+            selectionRows.value = selectionRows.value.concat(changeRows)
+        }
+        if (!selected) {
+            let selectionRows2 = JSON.parse(JSON.stringify(selectionRows.value))
+            const delIndex = []
+            selectionRows2.forEach((item, index) => {
+            changeRows.forEach((val, itemIndex) => {
+                if (item.id === val.id) {
+                delIndex.push(index)
+                }
+            })
+            })
+            delIndex.forEach((item) => {
+            delete selectionRows2[item]
+            })
+            selectionRows2 = selectionRows2.filter((item) => {
+                return item !== undefined
+            })
+            selectionRows.value = selectionRows2
+        }
     }
     function handleOk(){
         var arrProject = [],
         arrWareHouse=[],
         arrGoodsAllocation=[]
-        selectedRows.value.map(item=>{
+        selectionRows.value.map(item=>{
             arrProject.push(item.project)
             arrWareHouse.push(item.warehouse)
             arrGoodsAllocation.push(item.goodsAllocation)
@@ -408,14 +450,14 @@
         }else if(new Set(arrProject).size!==1||new Set(arrWareHouse).size!==1||new Set(arrGoodsAllocation).size!==1){
             message.error('请勾选项目、仓库、货位都相同的数据');
         }else{
-            emit('SelectStaningStock', selectedRows.value)
+            emit('SelectStaningStock', selectionRows.value)
             handleCancel()
         }
     }
     function handleCancel(){
         visible.value = false
         selectedRowKeys.value = []
-        selectedRows.value=[]
+        selectionRows.value=[]
         queryParams.value = {
             warehouse:'',
             goodsAllocation:"",

+ 49 - 8
src/views/publicComponents/selectArrivalList.vue

@@ -120,7 +120,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 3200, y: 400 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{onSelect: onSelect, onSelectAll: onSelectAll, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -248,7 +248,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var arrivalDate = ref([])
     const queryParams = ref({
@@ -311,6 +311,8 @@
     };
     function searchQuery(){
         pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -330,18 +332,57 @@
         }
         pagination.value.current =1;
         pagination.value.pageSize = 10; 
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function handleToggleSearch(){
         toggleSearchStatus.value = !toggleSearchStatus.value;
     }
-    function onSelectChange(keys,rows){
-        selectedRowKeys.value = keys
-        selectedRows.value = rows
+    function onSelectChange(selectedRowKeys1, selectionRows1) {
+        var arr = []
+        selectionRows.value.map(item=>{
+            arr.push(item.childId)
+        })
+        selectedRowKeys.value =  arr
+    }
+    function onSelect(record, selected, selectionRows1, nativeEvent) {
+        if (selected) {
+            selectionRows.value.push(record)
+            console.log( selectionRows.value);
+        }else{
+            const delIndex = selectionRows.value.findIndex((val) => {
+            return val.childId === record.childId
+            })
+            selectionRows.value.splice(delIndex, 1)
+        }
+    }
+    function onSelectAll(selected, selectionRows1, changeRows) {
+        if (selected) {
+            selectionRows.value = selectionRows.value.concat(changeRows)
+        }
+        if (!selected) {
+            let selectionRows2 = JSON.parse(JSON.stringify(selectionRows.value))
+            const delIndex = []
+            selectionRows2.forEach((item, index) => {
+            changeRows.forEach((val, itemIndex) => {
+                if (item.childId === val.childId) {
+                delIndex.push(index)
+                }
+            })
+            })
+            delIndex.forEach((item) => {
+            delete selectionRows2[item]
+            })
+            selectionRows2 = selectionRows2.filter((item) => {
+                return item !== undefined
+            })
+            selectionRows.value = selectionRows2
+        }
     }
     function handleOk(){
         var arr = []
-        selectedRows.value.map(item=>arr.push(item.billCode))
+        selectionRows.value.map(item=>arr.push(item.billCode))
         if(fatherSourceCode.value&&fatherSourceCode.value!==''){
             arr.push(fatherSourceCode.value)
         }
@@ -350,14 +391,14 @@
         }else if(new Set(arr).size!==1){
             message.error('请勾选到货单号相同的数据');
         }else{
-            emit('selectArrrivalOrder', selectedRows.value)
+            emit('selectArrrivalOrder', selectionRows.value)
             handleCancel()
         }
     }
     function handleCancel(){
       visible.value = false
       selectedRowKeys.value = []
-      selectedRows.value=[]
+      selectionRows.value=[]
       queryParams.value = {
             billCode:'',
             project:'',

+ 3 - 2
src/views/purchase/arrivedGoods/components/ArriveGoodsFormForm.vue

@@ -44,10 +44,10 @@
             <a-col :span="12">
               <a-form-item
                 label="供应商(supplier)"
-                v-bind="validateInfos.supplierName"
+                v-bind="validateInfos.supplier"
                 :label-col="formItemLayout.labelCol1"
                 :wrapper-col="formItemLayout.wrapperCol1"
-                id="ArriveGoodsForm-supplierName"
+                id="ArriveGoodsForm-supplier"
                 name="supplierName"
               >
                 <ApiSelect
@@ -561,6 +561,7 @@
           formData.projectName = data[0].projectName
           formData.supplierName = data[0].supplierName
           formData.supplier= data[0].supplier
+          debugger
           formData.priority =data[0].priority
           formData.productionClass =data[0].productionClass
           formData.model =data[0].headModel