Browse Source

销售管理-选择弹窗跨页选择/子表序列问题/字段显示问题

jingbb 3 months ago
parent
commit
16d8091a5e

+ 50 - 9
src/views/publicComponents/SelectContractModal.vue

@@ -133,7 +133,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>
@@ -299,7 +299,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var billDate = ref([])
     const queryParams = ref({
@@ -386,6 +386,8 @@
   }
     function searchQuery(){
         pagination.value.current = 1
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -409,34 +411,73 @@
         }
         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)
         }
         if(selectedRowKeys.value.length==0){
             message.error('请勾选数据');
         }else if(new Set(arr).size!==1){
-            message.error('请勾选询价单号相同的数据');
+            message.error('请勾选合同编号相同的数据');
         }else{
-            emit('selectContract', selectedRows.value)
+            emit('selectContract', selectionRows.value)
             handleCancel()
         }
     }
     function handleCancel(){
       visible.value = false
       selectedRowKeys.value = []
-      selectedRows.value=[]
+      selectionRows.value=[]
       billDate.value = []
       queryParams.value = {
             billCode:'',

+ 2 - 0
src/views/publicComponents/SelectPrpductModal.vue

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

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

@@ -121,7 +121,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>
@@ -288,7 +288,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var billDate = ref([])
     const queryParams = ref({
@@ -353,6 +353,8 @@
     };
     function searchQuery(){
         pagination.value.current =1
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -374,18 +376,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)
         }
@@ -394,14 +435,14 @@
         }else if(new Set(arr).size!==1){
             message.error('请勾选报价单号相同的数据');
         }else{
-            emit('selectQuotation', selectedRows.value)
+            emit('selectQuotation', selectionRows.value)
             handleCancel()
         }
     }
     function handleCancel(){
         visible.value = false
         selectedRowKeys.value = []
-        selectedRows.value=[]
+        selectionRows.value=[]
         billDate.value = []
         queryParams.value = {
             billCode:'',

+ 45 - 8
src/views/publicComponents/SelectSaleOrderMianModal.vue

@@ -74,7 +74,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 1500, y: 400 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{ onSelect: onSelect, onSelectAll: onSelectAll,sselectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -142,7 +142,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var billDate = ref([])
     const queryParams = ref({
@@ -216,15 +216,52 @@
     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(){
-        if(selectedRows.value.length!==1){
+        if(selectionRows.value.length!==1){
            message.warning('请选择一条数据')
         }else{
-            emit('selectSaleOrderMian', selectedRows.value)
+            emit('selectSaleOrderMian', selectionRows.value)
             handleCancel()
         }
         
@@ -232,7 +269,7 @@
     function handleCancel(){
         visible.value = false
         selectedRowKeys.value = []
-        selectedRows.value=[]
+        selectionRows.value=[]
         billDate.value = []
         queryParams.value = {
             billCode:'',

+ 47 - 9
src/views/publicComponents/SelectSaleOrderModal.vue

@@ -148,7 +148,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 4000, y: 400 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{ onSelect: onSelect, onSelectAll: onSelectAll, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -263,6 +263,7 @@
             dataIndex: 'englishName',
             align:"center",
             width:250,
+            ellipsis: true,
         },
         {
             title: '型号(childModel)',
@@ -324,7 +325,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var billDate = ref([])
     const queryParams = ref({
@@ -431,18 +432,55 @@
     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(){
         if(fatherType.value=='payRequest'){
-            emit('selectSaleOrder', selectedRows.value)
+            emit('selectSaleOrder', selectionRows.value)
             handleCancel()
         }else{
             var arr = [],
             arrSupplier=[]
-            selectedRows.value.map(item=>{
+            selectionRows.value.map(item=>{
                 arr.push(item.billCode)
                 arrSupplier.push(item.supplierId)
             })
@@ -456,7 +494,7 @@
             }else if(new Set(arrSupplier).size!==1){
                 message.error('请勾选供应商相同的数据');
             }else{
-                emit('selectSaleOrder', selectedRows.value)
+                emit('selectSaleOrder', selectionRows.value)
                 handleCancel()
             }
         }
@@ -465,7 +503,7 @@
     function handleCancel(){
         visible.value = false
         selectedRowKeys.value = []
-        selectedRows.value=[]
+        selectionRows.value=[]
         billDate.value = []
         queryParams.value = {
             billCode:'',

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

@@ -124,7 +124,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>
@@ -254,7 +254,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     const queryParams = ref({
         billCode:'',
@@ -316,6 +316,8 @@
     };
     function searchQuery(){
         pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -333,18 +335,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)
       }
@@ -353,14 +394,14 @@
       }else if(new Set(arr).size!==1){
         message.error('请勾选询价单号相同的数据');
       }else{
-        emit('selectSupplierQuatationConfirm', selectedRows.value)
+        emit('selectSupplierQuatationConfirm', selectionRows.value)
         handleCancel()
       }
     }
     function handleCancel(){
       visible.value = false
       selectedRowKeys.value = []
-      selectedRows.value=[]
+      selectionRows.value=[]
       queryParams.value = {
             billCode:'',
             billDate:'',

+ 1 - 0
src/views/saleCode/quotation/components/quotationFormForm.vue

@@ -813,6 +813,7 @@
           item.productClass = item.productClass;
           item.productCode = item.productCode;
           item.sourceId = item.childId;
+          item.id = undefined
           item.fatherModel = item.model;
           item.model = item.childModel;
           item.deliveryTime = formData.deliveryTime;

+ 1 - 0
src/views/saleCode/saleContract/components/SaleContractModal.vue

@@ -296,6 +296,7 @@
     data.map((item) => {
       item.model = item.childModel;
       item.sourceId = item.childId;
+      item.id =undefined;
       item.taxPrice = item.salePrice;
       item.deliveryTime = moment(time.billDate).add(Number(item.deliveryDayChild), 'days').format('YYYY-MM-DD');
     });

+ 3 - 3
src/views/saleCode/saleInquiryForm/components/SaleInquiryFormForm.vue

@@ -285,12 +285,12 @@
 
       
 
-      function add() {
-        resetFields();
+      async function add() {
+        await resetFields();
         saleInquiryFormShipTable.dataSource = [];
         saleInquiryFormProductTable.dataSource = [];
         activeKey.value = 'saleInquiryFormProduct'
-        getCustomerOptions()
+        await getCustomerOptions()
         inquiryPeriod.value = []
         formData.salesman=userStore.getUserInfo.username;
         formData.salesmanName=userStore.getUserInfo.realname;

+ 2 - 2
src/views/saleCode/saleInquiryForm/components/SaleInquiryFormModal.vue

@@ -1,6 +1,6 @@
 <template>
-  <BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="95%" @ok="handleSubmit" :maskClosable="false">
-    <sale-inquiry-form-form ref="formComponent" :formDisabled="formDisabled" :formBpm="false" @success="submitSuccess"></sale-inquiry-form-form>
+  <BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="95%" @ok="handleSubmit">
+    <saleInquiryFormForm ref="formComponent" :formDisabled="formDisabled" :formBpm="false" @success="submitSuccess"></saleInquiryFormForm>
   </BasicModal>
 </template>
 

+ 2 - 1
src/views/saleCode/salesInvoice/components/SelectDeliveryNoticeModal.vue

@@ -230,7 +230,8 @@
             title: '厂家(maker)',
             dataIndex: 'maker',
             key: 'maker',
-            align:"center"
+            align:"center",
+            ellipsis: true,
         },
         {
             title: '质量等级(quality grade)',

+ 1 - 0
src/views/saleCode/salesOrder/components/SlaeOrderFormForm.vue

@@ -729,6 +729,7 @@
           item.model = item.childModel;
           item.deliveryTime = formData.deliveryTime&&formData.deliveryTime!==''?formData.deliveryTime:moment(formData.billDate).add(Number(data[0].deliveryDayChild), 'days').format('YYYY-MM-DD');
           item.sourceId = item.childId;
+          item.id=undefined;
           item.sourceType = 'Quo' + item.childId;
           item.taxPrice = item.salePrice;
           if (formData.doubleDiscount && formData.doubleDiscount !== '') {