浏览代码

采购管理-选择弹窗-跨页选择/公用弹窗修改

jingbb 3 月之前
父节点
当前提交
b57ddc885b

+ 402 - 0
src/views/publicComponents/SelectPurchaseOrderMainModal.vue

@@ -0,0 +1,402 @@
+<!-- 采购订单主表选择 -->
+<template>
+    <a-modal
+      title="选择采购订单(Select Purchase Order)"
+      width="95%"
+      :visible="visible"
+      :maskClosable="false"
+      switchFullscreen
+      @ok = "handleOk"
+      @cancel="handleCancel">
+        <div>
+          <a-card  :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
+            <div class="table-page-search-wrapper">
+                <a-form :model="queryParams" :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="searchQuery" >
+                <a-row :gutter="24">
+                    <a-col :md="6" :sm="8">
+                        <a-form-item label="订单编号(bill code)">
+                            <j-input placeholder="请输入" v-model:value="queryParams.billCode"></j-input>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :md="6" :sm="8">
+                        <a-form-item label="单据日期(bill date)">
+                            <a-range-picker value-format="YYYY-MM-DD"  v-model:value="billDate"  @change="changeBillDate" class="query-group-cust"/>
+                        </a-form-item>
+                    </a-col> 
+                    <template v-if="toggleSearchStatus">
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="项目(project)">
+                                <ApiSelect
+                                    :api="ProjectOption"
+                                    showSearch
+                                    v-model:value="queryParams.project"
+                                    optionFilterProp="label"
+                                    resultField="records"
+                                    labelField="code"
+                                    valueField="id"
+                                    :params='{pageSize:-1}'
+                                    />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="产品分类(production class)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
+                                <ApiSelect
+                                :api="ClassList"
+                                showSearch
+                                v-model:value="queryParams.productionClass"
+                                optionFilterProp="label"
+                                resultField="records"
+                                labelField="name"
+                                valueField="id"
+                                :params='{pageSize:-1}'
+                                />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="供应商(supplier)">
+                                <ApiSelect
+                                :api="supplierOption"
+                                showSearch
+                                v-model:value="queryParams.supplier"
+                                optionFilterProp="label"
+                                resultField="records"
+                                labelField="name"
+                                valueField="id"
+                                :params='{pageSize:-1}'
+                                />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="优先级(priority)" >
+                                <JDictSelectTag v-model:value="queryParams.priority" placeholder="请选择" dictCode="priority" style="width: 100%;"/>
+                            </a-form-item>
+                        </a-col>
+                        
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="机型(model)">
+                                <j-input placeholder="请输入" v-model:value="queryParams.headModel"></j-input>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="产品编码(product code)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
+                                <j-input placeholder="请输入" v-model:value="queryParams.productCode"></j-input>
+                            </a-form-item>
+                        </a-col>                  
+                    </template>
+                    <a-col :md="6" :sm="8">
+                        <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+                            <a-button type="primary" @click="searchQuery" >查询(search)</a-button>
+                            <a-button type="primary" @click="searchReset"  style="margin-left: 8px">重置(reset)</a-button>
+                            <a @click="handleToggleSearch" style="margin-left: 8px">
+                            {{ toggleSearchStatus ? '收起' : '展开' }}
+                            <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
+                            </a>
+                        </span>
+                    </a-col>
+                </a-row>
+            </a-form>
+           </div>
+        </a-card>
+
+        <a-card  :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
+            <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
+            <template #message>
+                <template v-if="selectedRowKeys.length > 0">
+                <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
+                <a-divider type="vertical" />
+                <a @click="selectedRowKeys = []">清空</a>
+                </template>
+                <template v-else>
+                <span>未选中任何数据</span>
+                </template>
+            </template>
+            </a-alert>
+            <a-table
+                :columns="columns"
+                :row-key="record => record.rowKey"
+                :data-source="dataSource"
+                bordered
+                size="small"
+                @change="handleTableChange"
+                :pagination="pagination"
+                :scroll="{ x: 1800, y: 400 }"
+                :rowSelection="{ onSelect: onSelect, onSelectAll: onSelectAll,selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+            >
+            </a-table>
+        </a-card>
+      </div>
+    </a-modal>
+</template>
+<script lang="ts" setup>
+    import {ref, reactive } from 'vue';
+    import { defHttp} from '/@/utils/http/axios';
+    import { message } from 'ant-design-vue';
+    import {  ApiSelect, } from '/@/components/Form/index';
+    import { filterObj, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
+    import { JDictSelectTag,JInput} from '/@/components/Form';
+    import {ProjectOption,supplierOption,ClassList} from '../purchase/arrivedGoods/ArriveGoodsForm.api';
+    const emit = defineEmits([ 'selectPurchaseOrderMian']); //定义emit
+    var visible = ref(false)
+    var getListUrl=ref('')
+    const columns = [
+        { 
+            type: 'selection',
+            fixed: 'left',
+            width:0
+        },
+        {
+            title: '订单编号(bill code)',
+            dataIndex: 'billCode',
+            key: 'billCode',
+            align:"center",
+            width:250,
+            
+        },
+        {
+            title: '单据日期(bill date)',
+            dataIndex: 'billDate',
+            key: 'billDate',
+            align:"center"
+        },
+        {
+            title: '项目(project)',
+            dataIndex: 'projectName',
+            key: 'projectName',
+            align:"center",
+            width:250,
+        },
+        {
+            title: '供应商(supplier name)',
+            dataIndex: 'supplierName',
+            key: 'supplierName',
+            align:"center"
+        },
+        {
+            title: '优先级(priority)',
+            dataIndex: 'priority_dictText',
+            key: 'priority_dictText',
+            align:"center"
+        },
+        {
+            title: '产品分类(production class)',
+            dataIndex: 'productionClass_dictText',
+            key: 'productionClass_dictText',
+            align:"center",
+            width:250,
+        },
+        {
+            title: '机型(model)',
+            dataIndex: 'model',
+            key: 'model',
+            align:"center"
+        },
+    ];
+    const labelCol = ref({
+    xs: { span: 24 },
+    sm: { span: 9 },
+    });
+    const wrapperCol = ref({
+        xs: { span: 24 },
+        sm: { span: 15 },
+    });
+    const labelCol1 = ref({
+    xs: { span: 24 },
+    sm: { span: 10 },
+    });
+    const wrapperCol1 = ref({
+        xs: { span: 24 },
+        sm: { span: 14 },
+    });
+    const dataSource =ref([]);
+    let selectedRowKeys = ref([]);
+    let selectionRows = ref([]);
+    const toggleSearchStatus = ref(false);
+    var billDate = ref([])
+    const queryParams = ref({
+        billCode:'',
+        project:'',
+        projectName:'',
+        productionClass:'',
+        priority:'',
+        supplier:'',
+        supplierName:'',
+        headModel:'',
+        productCode:'',
+        billDate_begin:'',
+        billDate_end:'',
+        saleDepartment:'',
+        salesman:'',
+    });
+    let pagination = ref({
+      current: 1,
+      pageSize: 10,
+      total: '', // 假设总共有100条数据
+      showSizeChanger: true,
+      showQuickJumper: true,
+      showTotal: (total, range) => {
+          return range[0] + "-" + range[1] + " 共" + total + "条"
+      },
+      size:'small'
+    });
+    function loadData(){
+        let params = getQueryParams();
+        defHttp.get({ url: getListUrl.value,params}, { isTransformResponse: false })
+        .then((res) => {
+            if (res.success) {
+                res.result.records.map(item=>{
+                        item.rowKey = item.id
+                })
+                dataSource.value = res.result.records;
+                pagination.value.total = res.result.total;
+                pagination.value.current = res.result.current;
+                pagination.value.pageSize = res.result.size;                
+            } else {
+                message.error(res.message);
+            }
+        })
+        .finally(() => {
+            // loading.value = false;
+        });
+    }
+    function getQueryParams(){
+        let params = Object.assign(queryParams.value);
+        params.pageNo = pagination.value.current;
+        params.pageSize = pagination.value.pageSize;
+        return filterObj(params);
+    }
+    function handleTableChange(paginations, filters, sorter){
+        pagination.value.total = paginations.total;
+        pagination.value.current = paginations.current;
+        pagination.value.pageSize = paginations.pageSize;
+        loadData()
+    };
+    function searchQuery(){
+        pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
+        loadData();
+    }
+    function searchReset(){
+        billDate.value = []
+        pagination.value.current =1;
+        queryParams.value = {
+            billCode:'',
+            project:'',
+            projectName:'',
+            productionClass:'',
+            priority:'',
+            supplier:'',
+            supplierName:'',
+            headModel:'',
+            productCode:'',
+            billDate_begin:'',
+            billDate_end:'',
+            saleDepartment:'',
+            salesman:'',
+        }
+        pagination.value.current =1;
+        pagination.value.pageSize = 10; 
+        selectedRowKeys.value = []
+        selectionRows.value=[]
+        loadData();
+    }
+    function handleToggleSearch(){
+        toggleSearchStatus.value = !toggleSearchStatus.value;
+    }
+    function onSelectChange(selectedRowKeys1, selectionRows1) {
+        var arr = []
+        selectionRows.value.map(item=>{
+            arr.push(item.rowKey)
+        })
+        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.rowKey === record.rowKey
+            })
+            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.rowKey === val.rowKey) {
+                delIndex.push(index)
+                }
+            })
+            })
+            delIndex.forEach((item) => {
+            delete selectionRows2[item]
+            })
+            selectionRows2 = selectionRows2.filter((item) => {
+                return item !== undefined
+            })
+            selectionRows.value = selectionRows2
+        }
+    }
+    function handleOk(){
+        emit('selectPurchaseOrderMian', selectionRows.value)
+        handleCancel()
+    }
+    function handleCancel(){
+      visible.value = false
+      selectedRowKeys.value = []
+      selectionRows.value=[]
+      queryParams.value = {
+            billCode:'',
+            project:'',
+            projectName:'',
+            productionClass:'',
+            priority:'',
+            supplier:'',
+            supplierName:'',
+            headModel:'',
+            productCode:'',
+            billDate_begin:'',
+            billDate_end:'',
+            saleDepartment:'',
+            salesman:'',
+        }
+        pagination.value.current =1;
+        pagination.value.pageSize = 10; 
+    }
+    function getTable(){
+        visible.value = true
+        getListUrl.value = '/purCode/purOrder/listAlert'
+        loadData()
+    }
+    function changeBillDate(prop){
+       if(prop){
+            billDate.value = prop
+            queryParams.value.billDate_begin = prop[0]
+            queryParams.value.billDate_end = prop[1]
+       }else{
+            billDate.value = []
+            queryParams.value.billDate_begin = ''
+            queryParams.value.billDate_end = ''
+       }
+       
+    }
+    defineExpose({
+      getTable,
+    });
+</script>
+<style scoped lang="less">
+/deep/.ant-form-item{
+    margin-bottom: 8px !important;
+}
+// /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
+//     padding: 8px !important;
+// }
+
+</style>

+ 56 - 28
src/views/publicComponents/SelectPurchaseOrderModal.vue

@@ -113,14 +113,14 @@
             </a-alert>
             <a-table
                 :columns="columns"
-                :row-key="record => record.childId"
+                :row-key="record => record.rowKey"
                 :data-source="dataSource"
                 bordered
                 size="small"
                 @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>
@@ -139,7 +139,6 @@
     var visible = ref(false)
     var fatherProject = ref('')
     var fatherSourceCode = ref('')
-    var fatherType =ref('')
     var getListUrl=ref('')
     const columns = [
         { 
@@ -211,6 +210,7 @@
             dataIndex: 'englishName',
             align:"center",
             width:250,
+            ellipsis: true,
         },
         {
             title: '型号(childModel)',
@@ -272,7 +272,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var billDate = ref([])
     const queryParams = ref({
@@ -306,6 +306,9 @@
         defHttp.get({ url: getListUrl.value,params}, { isTransformResponse: false })
         .then((res) => {
             if (res.success) {
+                res.result.records.map(item=>{
+                        item.rowKey = item.childId
+                })
                 dataSource.value = res.result.records;
                 pagination.value.total = res.result.total;
                 pagination.value.current = res.result.current;
@@ -337,6 +340,8 @@
     };
     function searchQuery(){
         pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -359,22 +364,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.rowKey)
+        })
+        selectedRowKeys.value =  arr
     }
-    function handleOk(){
-        if(fatherType.value=='payRequest'){
-            emit('selectPurchaseOrder', selectedRows.value)
-            handleCancel()
+    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.rowKey === record.rowKey
+            })
+            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.rowKey === val.rowKey) {
+                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)
             }
@@ -383,16 +423,14 @@
             }else if(new Set(arr).size!==1){
                 message.error('请勾选订单编号相同的数据');
             }else{
-                emit('selectPurchaseOrder', selectedRows.value)
+                emit('selectPurchaseOrder', selectionRows.value)
                 handleCancel()
-            }
-        }
-       
+            }       
     }
     function handleCancel(){
       visible.value = false
       selectedRowKeys.value = []
-      selectedRows.value=[]
+      selectionRows.value=[]
       queryParams.value = {
             billCode:'',
             project:'',
@@ -423,18 +461,9 @@
         }else{
             fatherSourceCode.value = ''
         }
-        fatherType.value='arrive'
         getListUrl.value = '/purCode/purOrder/selectPurOrderDetailAlert'
         loadData()
     }
-    function getTableFromPurPayRequestForm(){
-        visible.value = true
-        fatherProject.value = ''
-        fatherSourceCode.value = ''
-        fatherType.value='payRequest'
-        getListUrl.value = '/purCode/purOrder/listAlert'
-        loadData()
-    }
     function changeBillDate(prop){
        if(prop){
             billDate.value = prop
@@ -448,8 +477,7 @@
        
     }
     defineExpose({
-      getTable,
-      getTableFromPurPayRequestForm
+      getTable
     });
 </script>
 <style scoped lang="less">

+ 23 - 4
src/views/publicComponents/SelectSaleOrderMianModal.vue

@@ -89,6 +89,8 @@
     import {  ApiSelect, JInput} from '/@/components/Form/index';
     const emit = defineEmits([ 'selectSaleOrderMian']); //定义emit
     var visible = ref(false)
+    var getListUrl=ref('')
+    var type = ref('')
     const columns = [
         { 
             type: 'selection',
@@ -167,7 +169,7 @@
     });
     function loadData(){
         let params = getQueryParams();
-        defHttp.get({ url: '/saleCode/saleOrder/list',params}, { isTransformResponse: false })
+        defHttp.get({ url: getListUrl.value,params}, { isTransformResponse: false })
         .then((res) => {
             if (res.success) {
                 dataSource.value = res.result.records;
@@ -258,13 +260,19 @@
         }
     }
     function handleOk(){
-        if(selectionRows.value.length!==1){
-           message.warning('请选择一条数据')
-        }else{
+        if(type.value == 'commission'){
             emit('selectSaleOrderMian', selectionRows.value)
             handleCancel()
+        }else{
+            if(selectionRows.value.length!==1){
+                message.warning('请选择一条数据')
+            }else{
+                emit('selectSaleOrderMian', selectionRows.value)
+                handleCancel()
+            }
         }
         
+        
     }
     function handleCancel(){
         visible.value = false
@@ -283,9 +291,19 @@
         pagination.value.current =1;
         pagination.value.pageSize = 10; 
     }
+    //预收款节点和收款单节点
     function getTable(){
         visible.value = true
+        getListUrl.value='/saleCode/saleOrder/list'
+        loadData()
+        type.value = 'other'
+    }
+    //佣金付款申请
+    function getTableFormCommissionPayment (){
+        visible.value = true
+        getListUrl.value='/saleCode/saleOrder/selectSaleOrderDetailCommissionPay'
         loadData()
+        type.value = 'commission'
     }
 
     function changeBillDate(prop){
@@ -306,6 +324,7 @@
     }
     defineExpose({
       getTable,
+      getTableFormCommissionPayment
     });
 </script>
 <style scoped lang="less">

+ 6 - 7
src/views/publicComponents/SelectSaleOrderModal.vue

@@ -544,19 +544,20 @@
             fatherSourceCode.value = ''
         }
         fatherType.value='other'
-        getListUrl.value ='/saleCode/saleOrder/selectSaleOrderDetailAlert'
+        // getListUrl.value ='/saleCode/saleOrder/selectSaleOrderDetailAlert'
+        //发货通知单里使用不显示供应商
         if(data=='delivery'){
             showCustomer.value = 'yes'
+            getListUrl.value ='/saleCode/saleOrder/selectSaleOrderDetailAlertDelivery'
             columns= columns1.filter(function(value, i) {
                 return i !== 4;
             });
-            if(formData.customer&&formData.customer!==''){
-                
+            if(formData.customer&&formData.customer!==''){            
                 fatherCustomer.value = formData.customer
             }else{
                 fatherCustomer.value = ''
             }
-        }else{
+        }else  if(data=='purOrder'){                        
             showCustomer.value = 'no'
             columns= columns1.filter(function(value, i) {
                 return i !== 5;
@@ -566,9 +567,7 @@
             }else{
                 fatherSupplier.value = ''
             }
-            if(data=='purOrder'){
-                getListUrl.value ='/saleCode/saleOrder/selectSaleOrderDetailAlertExistSup'
-            }
+            getListUrl.value ='/saleCode/saleOrder/selectSaleOrderDetailAlertExistSup'
         }
         loadData()
     }

+ 13 - 6
src/views/purchase/commissionPayRequest/components/commissionPayRequestForm.vue

@@ -95,7 +95,7 @@
           </j-vxe-table>
       </a-tab-pane>
     </a-tabs>
-    <SelectSaleOrderModal ref="SelectSaleOrderModalRef" @selectSaleOrder="addDetailList"></SelectSaleOrderModal>
+    <SelectSaleOrderModal ref="SelectSaleOrderModalRef" @selectSaleOrderMian="addDetailList"></SelectSaleOrderModal>
   </a-spin>
 </template>
 
@@ -106,7 +106,7 @@
   import { queryPaymentDetailListByMainId,queryDataById, saveOrUpdate ,listPayee} from '../commissionPayRequestForm.api';
   import { JVxeTable } from '/@/components/jeecg/JVxeTable';
   import { paymentDetailColumns} from '../commissionPayRequestList.data';
-  import SelectSaleOrderModal from '../../../publicComponents/SelectSaleOrderModal.vue';
+  import SelectSaleOrderModal from '../../../publicComponents/SelectSaleOrderMianModal.vue';
   import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
   import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
   import { ApiSelect } from '/@/components/Form';
@@ -287,19 +287,22 @@
         
       }
       function selectOrder(){
-        SelectSaleOrderModalRef.value.getTableFromSalePayRequestForm()
+        SelectSaleOrderModalRef.value.getTableFormCommissionPayment()
       }
       function addDetailList(data){
+        var billCodeArr = []
         data.map(item=>{
-          item.sourceId = item.childId
+          item.sourceId = item.id
           item.saleCode =  item.billCode
+          billCodeArr.push(item.billCode)
           item.saleId =  item.id
-          item.orderMoney =  item.taxAmount
+          item.orderMoney =  item.orderMoney
+          item.id = undefined
         })
+        formData.sourceCode = formData.sourceCode+','+billCodeArr.join(',')
         var xTable = paymentDetailsTableRef.value!.getXTable()
         var arrSonFormDelivery = xTable.data.concat(data)
         paymentDetailsTable.dataSource=arrSonFormDelivery  
-
       }
       return {
         paymentDetailsTableRef,
@@ -346,5 +349,9 @@
   /deep/.ant-form-item{
     margin-bottom: 8px !important;
   }
+  /deep/.vxe-cell--valid-error-msg{
+    color: white !important;
+    background-color: white !important;
+  } 
       
 </style>

+ 2 - 0
src/views/purchase/freightPurchaseOrder/components/FreightPurOrderForm.vue

@@ -301,6 +301,7 @@
             item.productClass = item.classId_dictText
             item.productCode = item.code
             item.productId = item.id
+            item.id = undefined
           })
           var xTable = FreightProductDetailsTableRef.value!.getXTable()
           var arrProduct = xTable.data.concat(data)
@@ -313,6 +314,7 @@
       function addDelivery(data){
         data.map(item=>{
           item.sourceId = item.id
+          item.id = undefined
         })
         var xTable = DeliveryDoticeTableableRef.value!.getXTable()
         var arrDeliveryList = xTable.data.concat(data)

+ 50 - 9
src/views/purchase/freightPurchaseOrder/components/SelectDeliveryNoticeModal.vue

@@ -122,7 +122,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 2000, y: 400 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{ onSelect: onSelect, onSelectAll: onSelectAll, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -234,7 +234,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     const toggleSearchStatus = ref(false);
     var deliveryDate = ref([])
     const queryParams = ref({
@@ -256,7 +256,7 @@
     });
     let pagination = ref({
       current: 1,
-      pageSize: 10,
+      pageSize: 1,
       total: '', // 假设总共有100条数据
       showSizeChanger: true,
       showQuickJumper: true,
@@ -296,6 +296,8 @@
     };
     function searchQuery(){
         pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -318,28 +320,67 @@
             carriageUsed:'否',
         }
         pagination.value.current =1;
-        pagination.value.pageSize = 10; 
+        pagination.value.pageSize = 1; 
+        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.sid === 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(){
         if(selectedRowKeys.value.length==0){
             message.error('请勾选数据');
         }else{
-            emit('addDelivery', selectedRows.value)
+            emit('addDelivery', selectionRows.value)
             handleCancel()
         }
     }
     function handleCancel(){
         visible.value = false
         selectedRowKeys.value = []
-        selectedRows.value=[]
+        selectionRows.value=[]
         deliveryDate.value = []
         queryParams.value = {
             billCode:'',

+ 10 - 20
src/views/purchase/purPaymentRequest/components/purPaymentRequestForm.vue

@@ -107,7 +107,7 @@
           </j-vxe-table>
       </a-tab-pane>
     </a-tabs>
-    <SelectPurchaseOrderModal ref="SelectPurchaseOrderModalRef" @selectPurchaseOrder="addDetailList"></SelectPurchaseOrderModal>
+    <SelectPurchaseOrderModal ref="SelectPurchaseOrderModalRef" @selectPurchaseOrderMian="addDetailList"></SelectPurchaseOrderModal>
   </a-spin>
 </template>
 
@@ -118,7 +118,7 @@
   import { supplierOption,queryPaymentDetailListByMainId,queryDataById, saveOrUpdate } from '../purPaymentRequestForm.api';
   import { JVxeTable } from '/@/components/jeecg/JVxeTable';
   import { paymentDetailColumns} from '../purPaymentRequest.data';
-  import SelectPurchaseOrderModal from '../../../publicComponents/SelectPurchaseOrderModal.vue';
+  import SelectPurchaseOrderModal from '../../../publicComponents/SelectPurchaseOrderMainModal.vue';
   import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
   import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
   import { ApiSelect } from '/@/components/Form';
@@ -299,35 +299,25 @@
         var newArray = [...xTable.data]
         newArray.splice(prop.rowIndex, 1)
         paymentDetailsTable.dataSource = newArray  
-        // if( paymentDetailsTable.dataSource.length!==0){
-        //   var arr = []
-        //   paymentDetailsTable.dataSource.map(item=>{
-        //     if(item.sourceId){
-        //       arr.push(item.sourceId)
-        //     } 
-        //   })
-        //   if(arr.length==0){
-        //     formData.sourceCode=''
-        //     notAllowEdit.value=false
-        //   }
-        // }else{
-        //    formData.sourceCode=''
-        //    notAllowEdit.value=false
-        // }
       }
       function changeValues(prop){
         
       }
       function selectOrder(){
-        SelectPurchaseOrderModalRef.value.getTableFromPurPayRequestForm()
+        SelectPurchaseOrderModalRef.value.getTable()
       }
       function addDetailList(data){
+        var billCodeArr=[]
         data.map(item=>{
-          item.sourceId = item.childId
+          item.sourceId = item.id
           item.purchaseCode =  item.billCode
+          billCodeArr.push(item.billCode)
           item.purchaseId =  item.id
-          item.orderMoney =  item.taxAmount
+          item.orderMoney =  item.totalAmount
+          item.applyMoney =  item.totalAmountUsed
+          item.id =  undefined
         })
+        formData.sourceCode = formData.sourceCode+','+billCodeArr.join(',')
         var xTable = paymentDetailsTableRef.value!.getXTable()
         var arrSonFormDelivery = xTable.data.concat(data)
         paymentDetailsTable.dataSource=arrSonFormDelivery     

+ 9 - 4
src/views/purchase/purchaseInquiryForm/components/PurchaseInquiryFormForm.vue

@@ -509,12 +509,14 @@
         formData[key] = value;
       }
       async function handleDelete(prop) {
-        var newArray = [...PuechaseInquiryFormShipTable.dataSource];
+        var xTable = PuechaseInquiryFormProductTableRef.value!.getXTable()
+        var newArray = [...xTable.data];
         newArray.splice(prop.rowIndex, 1);
         PuechaseInquiryFormShipTable.dataSource = newArray;
       }
       async function handleDelete1(prop) {
-        var newArray = [...PuechaseInquiryFormProductTable.dataSource];
+        var xTable = PuechaseInquiryFormProductTableRef.value!.getXTable()
+        var newArray = [...xTable.data];
         newArray.splice(prop.rowIndex, 1);
         PuechaseInquiryFormProductTable.dataSource = newArray;
         if (PuechaseInquiryFormProductTable.dataSource.length !== 0) {
@@ -544,11 +546,13 @@
           item.productClass = item.classId_dictText;
           item.productCode = item.code;
           item.productId = item.id;
+          item.id=undefined
           item.unit = item.measurementUnit;
           item.needShip = '0';
           item.shipInspection = '';
         });
-        var arrProduct = data.concat(PuechaseInquiryFormProductTable.dataSource);
+        var xTable = PuechaseInquiryFormProductTableRef.value!.getXTable()
+        var arrProduct = xTable.data.concat(data);
         PuechaseInquiryFormProductTable.dataSource = arrProduct;
       }
       function addProject(data) {
@@ -569,7 +573,8 @@
           item.model = item.childModel;
           item.deliveryTime = formData.deliveryTime;
         });
-        var arrProduct = data.concat(PuechaseInquiryFormProductTable.dataSource);
+        var xTable = PuechaseInquiryFormProductTableRef.value!.getXTable()
+        var arrProduct = xTable.data.concat(data);
         notAllowEdit.value = true;
         inquiryPeriod.value[0] = data[0].inquiryPeriodBegin ? moment(data[0].inquiryPeriodBegin).format('YYYY-MM-DD') : '';
         inquiryPeriod.value[1] = data[0].inquiryPeriodEnd ? moment(data[0].inquiryPeriodEnd).format('YYYY-MM-DD') : '';

+ 50 - 9
src/views/purchase/purchaseInquiryForm/components/SelectCustomerInquiryModal.vue

@@ -117,7 +117,7 @@
           @change="handleTableChange"
           :pagination="pagination"
           :scroll="{ x: 4500, y: 400 }"
-          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+          :rowSelection="{ onSelect: onSelect, onSelectAll: onSelectAll,selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
         />
       </a-card>
     </div>
@@ -280,7 +280,7 @@
   });
   const dataSource = ref([]);
   let selectedRowKeys = ref([]);
-  let selectedRows = ref([]);
+  let selectionRows = ref([]);
   var fatherProject = ref('');
   var fatherSourceCode = ref('');
   const toggleSearchStatus = ref(false);
@@ -365,6 +365,8 @@
   }
   function searchQuery() {
     pagination.value.current = 1;
+    selectedRowKeys.value = []
+    selectionRows.value=[]
     loadData();
   }
   function searchReset() {
@@ -384,18 +386,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);
     }
@@ -404,7 +445,7 @@
     } else if (new Set(arr).size !== 1) {
       message.error('请勾选询价单号相同的数据');
     } else {
-      emit('selectCustomerInquiry', selectedRows.value);
+      emit('selectCustomerInquiry', selectionRows.value);
       handleCancel();
     }
   }
@@ -425,7 +466,7 @@
       billDate_end: '',
     };
     selectedRowKeys.value = [];
-    selectedRows.value = [];
+    selectionRows.value = [];
     pagination.value.current = 1;
     pagination.value.pageSize = 10;
   }

+ 1 - 0
src/views/purchase/purchaseOrder/components/PurchaseOrderFormForm.vue

@@ -568,6 +568,7 @@
           item.productClass = item.classId_dictText;
           item.productCode = item.code;
           item.productId = item.id;
+          item.id = undefined
         });
         var xTable = purOrderFormShipFormProductTableRef.value!.getXTable();
         var arrProduct = xTable.data.concat(data);

+ 9 - 4
src/views/purchase/purchaseQuotationFrm/components/PurchaseQuotationFormForm.vue

@@ -487,12 +487,14 @@
         formData[key] = value;
       }
       async function handleDelete(prop) {
-        var newArray = [...PuechaseQuotationFormShipTable.dataSource];
+        const xTable = PuechaseQuotationFormProductTableRef.value!.getXTable();
+        var newArray = [...xTable.data];
         newArray.splice(prop.rowIndex, 1);
         PuechaseQuotationFormShipTable.dataSource = newArray;
       }
       async function handleDelete1(prop) {
-        var newArray = [...PuechaseQuotationFormProductTable.dataSource];
+        const xTable = PuechaseQuotationFormProductTableRef.value!.getXTable();
+        var newArray = [...xTable.data];
         newArray.splice(prop.rowIndex, 1);
         PuechaseQuotationFormProductTable.dataSource = newArray;
         if (PuechaseQuotationFormProductTable.dataSource.length !== 0) {
@@ -525,8 +527,10 @@
           item.needShip = '0';
           item.shipInspection = '';
           item.productId = item.id;
+          item.id = undefined
         });
-        var arrProduct = data.concat(PuechaseQuotationFormProductTable.dataSource);
+        const xTable = PuechaseQuotationFormProductTableRef.value!.getXTable();
+        var arrProduct = xTable.data.concat(data);
         PuechaseQuotationFormProductTable.dataSource = arrProduct;
       }
       function addProject(data) {
@@ -555,7 +559,8 @@
           item.model = item.childModel;
           item.deliveryDayChild = formData.deliveryDayHead;
         });
-        var arrProduct = data.concat(PuechaseQuotationFormProductTable.dataSource);
+        const xTable = PuechaseQuotationFormProductTableRef.value!.getXTable();
+        var arrProduct = xTable.data.concat(data);
         notAllowEdit.value = true;
         PuechaseQuotationFormProductTable.dataSource = arrProduct;
         formData.quotationProject = data[0].inquiryProject;

+ 49 - 13
src/views/purchase/purchaseQuotationFrm/components/SelectSupplierInquiryModal.vue

@@ -120,7 +120,7 @@
                 @change="handleTableChange"
                 :pagination="pagination"
                 :scroll="{ x: 4500, y: 400 }"
-                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+                :rowSelection="{onSelect: onSelect, onSelectAll: onSelectAll, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
             >
             </a-table>
         </a-card>
@@ -278,7 +278,7 @@
     });
     const dataSource =ref([]);
     let selectedRowKeys = ref([]);
-    let selectedRows = ref([]);
+    let selectionRows = ref([]);
     var fatherProject = ref('');
     var fatherSourceCode = ref('');
     var fatherSupplier = ref('')
@@ -352,6 +352,8 @@
     
     function searchQuery(){
         pagination.value.current =1;
+        selectedRowKeys.value = []
+        selectionRows.value=[]
         loadData();
     }
     function searchReset(){
@@ -371,23 +373,57 @@
         }
         pagination.value.current =1;
         pagination.value.pageSize = 10; 
-        if(fatherProject.value&&fatherProject.value!==''){
-            queryParams.value.inquiryProject = fatherProject.value
-        }else{
-            queryParams.value.inquiryProject = ''
-        }
+        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)
       }
@@ -396,7 +432,7 @@
       }else if(new Set(arr).size!==1){
         message.error('请勾选询价单号相同的数据');
       }else{
-        emit('selectCustomerInquiry', selectedRows.value)
+        emit('selectCustomerInquiry', selectionRows.value)
         handleCancel()
       }
     }
@@ -417,7 +453,7 @@
             billDate_end:'',
         }
       selectedRowKeys.value = []
-      selectedRows.value=[]
+      selectionRows.value=[]
       pagination.value.current =1;
       pagination.value.pageSize = 10; 
     }