Browse Source

运费采购订单-增加“选择发货通知单”功能

jingbb 4 months ago
parent
commit
2ebbf43ef3

+ 7 - 7
src/views/purchase/freightPurchaseOrder/FreightPurOrderForm.data.ts

@@ -62,13 +62,13 @@ export const ShippingNoticeColumns: JVxeColumn[] = [
       placeholder: '请输入${title}',
       defaultValue:'',
     },
-    {
-      title: '合同编号(contract code)',
-      key: 'contractCode',
-      type: JVxeTypes.normal,
-      placeholder: '请输入${title}',
-      defaultValue:'',
-    },
+    // {
+    //   title: '合同编号(contract code)',
+    //   key: 'contractCode',
+    //   type: JVxeTypes.normal,
+    //   placeholder: '请输入${title}',
+    //   defaultValue:'',
+    // },
     {
       title: '项目(project)',
       key: 'projectName',

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

@@ -58,6 +58,7 @@
           </j-vxe-table>
       </a-tab-pane>
       <a-tab-pane tab="运费采购订单 - 发货通知单(delivery notice)" key="DeliveryDotice" :forceRender="true">
+        <a-button type="primary" style="margin-right: 1%;margin-bottom: 1%;" @click="selectDelivery"> 选择发货通知单(select delivery)</a-button>
         <j-vxe-table
           :keep-source="true"
           resizable
@@ -80,6 +81,7 @@
       
     </a-tabs>
     <SelectPrpductModal ref="SelectPrpductModalRef" @selectProduct="addProduct"></SelectPrpductModal>
+    <SelectDeliveryNoticeModal ref="SelectDeliveryNoticeModalRef" @addDelivery="addDelivery"></SelectDeliveryNoticeModal>
   </a-spin>
 </template>
 
@@ -91,6 +93,7 @@
   import { JVxeTable } from '/@/components/jeecg/JVxeTable';
   import {ShippingNoticeColumns, FreightProDetailsColumns} from '../FreightPurOrderForm.data';
   import SelectPrpductModal from '../../../publicComponents/SelectPrpductModal.vue';
+  import SelectDeliveryNoticeModal from './SelectDeliveryNoticeModal.vue';
   import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
   import { JDictSelectTag} from '/@/components/Form';
   import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
@@ -104,7 +107,8 @@
 			JFormContainer,
       JDictSelectTag,
       JSelectInput,
-      SelectPrpductModal
+      SelectPrpductModal,
+      SelectDeliveryNoticeModal
     },
     props:{
       formDisabled:{
@@ -118,6 +122,7 @@
     setup(props, {emit}) {
       const loading = ref(false);
       const formRef = ref();
+      const SelectDeliveryNoticeModalRef= ref();
       const SelectPrpductModalRef = ref()
       const DeliveryDoticeTableableRef = ref();
       const DeliveryDoticeTable = reactive<Record<string, any>>({
@@ -299,6 +304,16 @@
           FreightProductDetailsTable.dataSource=arrProduct  
         }
       }
+      function selectDelivery(){
+        SelectDeliveryNoticeModalRef.value.getTable()
+      }
+      function addDelivery(data){
+        data.map(item=>{
+          item.sourceId = item.id
+        })
+        var arrDeliveryList = data.concat(DeliveryDoticeTable.dataSource)
+        DeliveryDoticeTable.dataSource=arrDeliveryList  
+      }
       /**
        * 值改变事件触发-树控件回调
        * @param key
@@ -333,7 +348,10 @@
         supplierOption,
         SelectPrpductModalRef,
         SelectProduct,
-        addProduct
+        addProduct,
+        SelectDeliveryNoticeModalRef,
+        addDelivery,
+        selectDelivery
       }
     }
   });

+ 399 - 0
src/views/purchase/freightPurchaseOrder/components/SelectDeliveryNoticeModal.vue

@@ -0,0 +1,399 @@
+<template>
+    <a-modal
+      title="选择发货通知单(Select delivery notice)"
+      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)">
+                            <a-input placeholder="请输入" v-model:value="queryParams.billCode"></a-input>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :md="6" :sm="8">
+                        <a-form-item label="发货日期(delivery date)">
+                            <a-range-picker value-format="YYYY-MM-DD"  v-model:value="deliveryDate"  @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="projectListList"
+                                    showSearch
+                                    v-model:value="queryParams.project"
+                                    optionFilterProp="label"
+                                    resultField="records"
+                                    labelField="name"
+                                    valueField="id"
+                                    />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :lg="8">
+                            <a-form-item name="customer">
+                            <template #label><span title="客户(customer)">客户(customer)</span></template>
+                            <a-input placeholder="请输入客户(customer)" v-model:value="queryParams.customerName" allow-clear ></a-input>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="产品分类(production class)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
+                                <!-- <a-input placeholder="请输入" v-model:value="queryParams.classId"></a-input> -->
+                                <JSelectInput   v-model:value="queryParams.productionClass"  placeholder="请选择" :options="classOption" ></JSelectInput>
+                            </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"/>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="机型(model)">
+                                <a-input placeholder="请输入" v-model:value="queryParams.model"></a-input>
+                            </a-form-item>
+                        </a-col>
+                        
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="厂家(maker)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
+                                <a-input placeholder="请输入" v-model:value="queryParams.maker"></a-input>
+                            </a-form-item>
+                        </a-col>                        
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="业务员(salesman)">
+                                <a-input placeholder="请输入" v-model:value="queryParams.salesman"></a-input>
+                            </a-form-item>
+                        </a-col>   
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="销售部门(sale department)" :label-col="labelCol1" :wrapper-col="wrapperCol1"> 
+                                <a-input placeholder="请输入" v-model:value="queryParams.saleDepartment"></a-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.id"
+                :data-source="dataSource"
+                bordered
+                size="small"
+                @change="handleTableChange"
+                :pagination="pagination"
+                :scroll="{ x: 2000, y: 300 }"
+                :rowSelection="{ 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 { filterObj, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
+    import { JDictSelectTag} from '/@/components/Form';
+    import {  ApiSelect, } from '/@/components/Form/index';
+    import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
+    const emit = defineEmits([ 'addDelivery']); //定义emit
+    let classOption = ref([])
+    var visible = ref(false)
+    const columns = [
+        {
+            title: '通知单号(bill code)',
+            dataIndex: 'billCode',
+            key: 'billCode',
+            align:"center",
+            width:250,
+            ellipsis: true,
+        },
+        {
+            title: '发货日期(delivery date)',
+            dataIndex: 'deliveryDate',
+            key: 'deliveryDate',
+            align:"center",
+            ellipsis: true,
+        },
+        {
+            title: '项目(project)',
+            dataIndex: 'projectName',
+            key: 'projectName',
+            align:"center",
+            width:250,
+            ellipsis: true,
+        },
+        {
+            title: '客户(customer)',
+            dataIndex: 'customerName',
+            key: 'customerName',
+            align:"center",
+            ellipsis: true,
+        },
+        {
+            title: '优先级(priority)',
+            dataIndex: 'priority_dictText',
+            key: 'priority_dictText',
+            align:"center"
+        },
+        {
+            title: '产品分类(production class)',
+            dataIndex: 'productionClass_dictText',
+            key: 'productionClass_dictText',
+            align:"center",
+            width:250,
+            ellipsis: true,
+        },
+        {
+            title: '机型(model)',
+            dataIndex: 'model',
+            key: 'model',
+            align:"center"
+        },
+        {
+            title: '厂家(maker)',
+            dataIndex: 'maker',
+            key: 'maker',
+            align:"center"
+        },
+        {
+            title: '销售部门(sale department)',
+            dataIndex: 'saleDepartment',
+            key: 'saleDepartment',
+            align:"center",
+            width:250,
+            ellipsis: true,
+        },
+        {
+            title: '业务员(salesman)',
+            dataIndex: 'salesman',
+            key: 'salesman',
+            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: 12 },
+    });
+    const wrapperCol1 = ref({
+        xs: { span: 24 },
+        sm: { span: 12 },
+    });
+    const dataSource =ref([]);
+    let selectedRowKeys = ref([]);
+    let selectedRows = ref([]);
+    const toggleSearchStatus = ref(false);
+    var deliveryDate = ref([])
+    const queryParams = ref({
+        billCode:'',
+        project:'',
+        projectName:'',
+        productionClass:'',
+        priority:'',
+        customerName:'',
+        customer:'',
+        model:'',
+        maker:'',
+        deliveryDate_begin:'',
+        deliveryDate_end:'',
+        saleDepartment:'',
+        salesman:'',
+        submit:'1',
+        close:'0'
+    });
+    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: '/saleCode/saleDelivery/list',params}, { isTransformResponse: false })
+        .then((res) => {
+            if (res.success) {
+                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 getOptiom(){
+    defHttp
+        .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
+        .then((res) => {
+            if (res.success) {
+              classOption.value = []
+              res.result.records.forEach(element => {
+                  var obj = {
+                    label: element.name?element.name:'无名称请维护',
+                    value: element.id?element.id:''
+                  };
+                  classOption.value.push( obj)
+              });    
+            }
+        })
+        .finally(() => {
+            // loading.value = false;
+        });
+  }
+    function searchQuery(){
+        loadData();
+    }
+    function searchReset(){
+        deliveryDate.value = []
+        queryParams.value = {
+            billCode:'',
+            project:'',
+            projectName:'',
+            productionClass:'',
+            priority:'',
+            customerName:'',
+            customer:'',
+            model:'',
+            maker:'',
+            deliveryDate_begin:'',
+            deliveryDate_end:'',
+            saleDepartment:'',
+            salesman:'',
+            submit:'1',
+            close:'0'
+        }
+        pagination.value.current =1;
+        pagination.value.pageSize = 10; 
+        loadData();
+    }
+    function handleToggleSearch(){
+        toggleSearchStatus.value = !toggleSearchStatus.value;
+    }
+    function onSelectChange(keys,rows){
+        selectedRowKeys.value = keys
+        selectedRows.value = rows
+    }
+    function handleOk(){
+        if(selectedRowKeys.value.length==0){
+            message.error('请勾选数据');
+        }else{
+            emit('addDelivery', selectedRows.value)
+            handleCancel()
+        }
+    }
+    function handleCancel(){
+        visible.value = false
+        selectedRowKeys.value = []
+        selectedRows.value=[]
+        deliveryDate.value = []
+        queryParams.value = {
+            billCode:'',
+            project:'',
+            projectName:'',
+            productionClass:'',
+            priority:'',
+            customerName:'',
+            customer:'',
+            model:'',
+            maker:'',
+            deliveryDate_begin:'',
+            deliveryDate_end:'',
+            saleDepartment:'',
+            salesman:'',
+            submit:'1',
+            close:'0'
+        }
+    }
+    function getTable(){
+        visible.value = true 
+        loadData()
+        getOptiom()
+    }
+    function changeBillDate(prop){
+       if(prop){
+            deliveryDate.value = prop
+            queryParams.value.deliveryDate_begin = prop[0]
+            queryParams.value.deliveryDate_end = prop[1]
+       }else{
+            deliveryDate.value = []
+            queryParams.value.deliveryDate_begin = ''
+            queryParams.value.deliveryDate_end = ''
+       }
+       
+    }
+    function projectListList(){
+        let params = {pageSize:-1}
+        return defHttp.get({url:'/baseCode/baseProjectArchive/list',params});
+    }
+    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>