Quellcode durchsuchen

销售发票-功能连调

jingbb vor 4 Monaten
Ursprung
Commit
c99efaae23

+ 15 - 15
src/views/saleCode/salesInvoice/components/SelectCommissionOrderModal.vue

@@ -222,21 +222,21 @@
       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;
-        });
+        // 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);

+ 12 - 15
src/views/saleCode/salesInvoice/components/SelectDeliveryNoticeModal.vue

@@ -105,7 +105,7 @@
             </a-alert>
             <a-table
                 :columns="columns"
-                :row-key="record => record.id"
+                :row-key="record => record.childId"
                 :data-source="dataSource"
                 bordered
                 size="small"
@@ -239,8 +239,8 @@
         },
         {
             title: '金额(money)',
-            dataIndex: 'taxMoney',
-            key: 'taxMoney',
+            dataIndex: 'money',
+            key: 'money',
             align:"center"
         },
     ];
@@ -279,8 +279,6 @@
         deliveryDate_end:'',
         saleDepartment:'',
         salesman:'',
-        submit:'1',
-        close:'0'
     });
     let pagination = ref({
       current: 1,
@@ -293,9 +291,12 @@
       },
       size:'small'
     });
-    function loadData(){
+    function loadData(data){
         let params = getQueryParams();
-        defHttp.get({ url: '/saleCode/saleDelivery/list',params}, { isTransformResponse: false })
+        if(data){
+            queryParams.value.project = data;
+        }
+        defHttp.get({ url: '/saleCode/saleDelivery/selectSaleDeliveryAlert',params}, { isTransformResponse: false })
         .then((res) => {
             if (res.success) {
                 dataSource.value = res.result.records;
@@ -360,8 +361,6 @@
             deliveryDate_end:'',
             saleDepartment:'',
             salesman:'',
-            submit:'1',
-            close:'0'
         }
         pagination.value.current =1;
         pagination.value.pageSize = 10; 
@@ -375,8 +374,8 @@
         selectedRows.value = rows
     }
     function handleOk(){
-        if(selectedRowKeys.value.length==0){
-            message.error('请勾选数据');
+        if(selectedRowKeys.value.length!==1){
+            message.error('请勾选一条数据');
         }else{
             emit('addDelivery', selectedRows.value)
             handleCancel()
@@ -401,13 +400,11 @@
             deliveryDate_end:'',
             saleDepartment:'',
             salesman:'',
-            submit:'1',
-            close:'0'
         }
     }
-    function getTable(){
+    function getTable(formData){
         visible.value = true 
-        loadData()
+        loadData(formData.project)
         getOptiom()
     }
     function changeBillDate(prop){

+ 162 - 87
src/views/saleCode/salesInvoice/components/saleInvoiceForm.vue

@@ -5,8 +5,8 @@
         <a-form v-bind="formItemLayout" name="saleInvoiceForm" ref="formRef">
           <a-row>
             <a-col :span="12">
-							<a-form-item label="发票编号(bill code)" v-bind="validateInfos.billCode" id="saleInvoiceForm-billCode" name="billCode" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
-								<a-input v-model:value="formData.billCode" placeholder="自动生成" disabled></a-input>
+							<a-form-item label="发票编号(invoice code)" v-bind="validateInfos.invoiceCode" id="saleInvoiceForm-invoiceCode" name="invoiceCode" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
+								<a-input v-model:value="formData.invoiceCode" placeholder="自动生成" disabled></a-input>
 							</a-form-item>
 						</a-col>
 						<a-col :span="12">
@@ -19,34 +19,49 @@
 								<a-input-search v-model:value="formData.projectName" placeholder="请输入项目(project)"  allow-clear enter-button="Search" :disabled="notAllowEdit" @search="onSearchProject"></a-input-search>
 							</a-form-item>
 						</a-col>
+            <a-col :span="12">
+							<a-form-item label="业务类型(busymess type)" v-bind="validateInfos.busynessType" id="saleInvoiceForm-busynessType" name="busynessType">
+								<JDictSelectTag v-model:value="formData.busynessType" placeholder="请选择" dictCode="	busyness_type" style="width: 100%;" :disabled="notAllowEdit"/>
+							</a-form-item>
+						</a-col>
 						<a-col :span="12">
-							<a-form-item label="购方(buyer)" v-bind="validateInfos.buyer" id="saleInvoiceForm-buyer" name="buyer" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
-                <JSelectInput   v-model:value="formData.buyer"  placeholder="请选择" :options="customerOption" disabled></JSelectInput>
+							<a-form-item label="购方(buyer)" v-bind="validateInfos.customer" id="saleInvoiceForm-customer" name="customer" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">   
+                <ApiSelect
+                  :api="getCustomerOptions"
+                  showSearch
+                  v-model:value="formData.customer"
+                  optionFilterProp="label"
+                  resultField="records"
+                  labelField="name"
+                  valueField="id"
+                  :params='{pageSize:-1}'
+                  disabled
+                />
 							</a-form-item>
 						</a-col>
 						<a-col :span="12">
 							<a-form-item label="购方税号(buyer's tax number)" v-bind="validateInfos.buyerTaxNumber" id="saleInvoiceForm-buyerTaxNumber" name="buyerTaxNumber">
-                <a-input v-model:value="formData.buyerTaxNumber" placeholder="请输入"  allow-clear ></a-input>
+                <a-input v-model:value="formData.buyerTaxNumber" placeholder="请输入"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
 							<a-form-item label="购方电话(buyer's telphone)" v-bind="validateInfos.buyerTelphone" id="saleInvoiceForm-buyerTelphone" name="buyerTelphone">
-                <a-input v-model:value="formData.buyerTelphone" placeholder="请输入"  allow-clear ></a-input>
+                <a-input v-model:value="formData.buyerTelphone" placeholder="请输入"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="购方地址(buyer's addres)" v-bind="validateInfos.buyerAddres" id="saleInvoiceForm-buyerAddres" name="buyerAddres">
-                <a-input v-model:value="formData.buyerAddres" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="购方地址(buyer's address)" v-bind="validateInfos.buyerAddress" id="saleInvoiceForm-buyerAddress" name="buyerAddress">
+                <a-input v-model:value="formData.buyerAddress" placeholder="请输入"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
 							<a-form-item label="购方银行(buyer's bank)" v-bind="validateInfos.buyerBank" id="saleInvoiceForm-buyerBank" name="buyerBank">
-                <a-input v-model:value="formData.buyerBank" placeholder="请输入"  allow-clear ></a-input>
+                <a-input v-model:value="formData.buyerBank" placeholder="请输入"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="购方银行账户(buyer's bank account)" v-bind="validateInfos.buyerBankAccount" id="saleInvoiceForm-buyerBankAccount" name="buyerBankAccount">
-                <a-input v-model:value="formData.buyerBankAccount" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="购方银行账户(buyer's bank account)" v-bind="validateInfos.buyerAccount" id="saleInvoiceForm-buyerAccount" name="buyerAccount">
+                <a-input v-model:value="formData.buyerAccount" placeholder="请输入"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
@@ -60,44 +75,54 @@
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="销方(saller)" v-bind="validateInfos.saller" id="saleInvoiceForm-saller" name="saller" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
-                <JSelectInput   v-model:value="formData.saller"  placeholder="请选择" :options="customerOption" ></JSelectInput>
-							</a-form-item>
+							<a-form-item label="销方(seller)" v-bind="validateInfos.seller" id="saleInvoiceForm-seller" name="saller" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
+                <ApiSelect
+                  :api="listHeard"
+                  showSearch
+                  v-model:value="formData.seller"
+                  optionFilterProp="label"
+                  resultField="records"
+                  labelField="name"
+                  valueField="id"
+                  :params='{pageSize:-1}'
+                  @change="changeSeller"
+                />
+              </a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="销方税号(saller's tax number)" v-bind="validateInfos.sallerTaxNumber" id="saleInvoiceForm-sallerTaxNumber" name="sallerTaxNumber">
-                <a-input v-model:value="formData.sallerTaxNumber" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="销方税号(seller's tax number)" v-bind="validateInfos.sellerTaxNumber" id="saleInvoiceForm-sellerTaxNumber" name="sellerTaxNumber">
+                <a-input v-model:value="formData.sellerTaxNumber" placeholder="请输入"  allow-clear ></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="销方电话(saller's telphone)" v-bind="validateInfos.sallerTelphone" id="saleInvoiceForm-sallerTelphone" name="sallerTelphone">
-                <a-input v-model:value="formData.sallerTelphone" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="销方电话(seller's telphone)" v-bind="validateInfos.sellerTelphone" id="saleInvoiceForm-sellerTelphone" name="sellerTelphone">
+                <a-input v-model:value="formData.sellerTelphone" placeholder="请输入"  allow-clear ></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="销方地址(saller's address)" v-bind="validateInfos.invoiceAddress" id="saleInvoiceForm-sallerAddress" name="sallerAddress">
-                <a-input v-model:value="formData.sallerAddress" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="销方地址(seller's address)" v-bind="validateInfos.sellerAddress" id="saleInvoiceForm-sellerAddress" name="sellerAddress">
+                <a-input v-model:value="formData.sellerAddress" placeholder="请输入"  allow-clear ></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="销方银行(saller's bank)" v-bind="validateInfos.sallerBank" id="saleInvoiceForm-sallerBank" name="sallerBank">
-                <a-input v-model:value="formData.sallerBank" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="销方银行(seller's bank)" v-bind="validateInfos.sellerBank" id="saleInvoiceForm-sellerBank" name="sellerBank">
+                <a-input v-model:value="formData.sellerBank" placeholder="请输入"  allow-clear ></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="销方银行账户(saller's bank account)" v-bind="validateInfos.sallerBankAccount" id="saleInvoiceForm-sallerBankAccount" name="sallerBankAccount">
-                <a-input v-model:value="formData.sallerBankAccount" placeholder="请输入"  allow-clear ></a-input>
+							<a-form-item label="销方银行账户(seller's bank account)" v-bind="validateInfos.sellerBankAccount" id="saleInvoiceForm-sellerBankAccount" name="sellerBankAccount">
+                <a-input v-model:value="formData.sellerBankAccount" placeholder="请输入"  allow-clear ></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
 							<a-form-item label="F号(F number)" v-bind="validateInfos.fnumber" id="saleInvoiceForm-fnumber" name="fnumber">
-                <a-input v-model:value="formData.fnumber" placeholder="请输入"  allow-clear ></a-input>
+                <a-input v-model:value="formData.fnumber" placeholder="请输入"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
 						
             <a-col :span="12">
-							<a-form-item label="备注(notes)" v-bind="validateInfos.quotationNotes" id="saleInvoiceForm-notes" name="notes" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
-								<a-input v-model:value="formData.notes" placeholder="请输入报价备注(quotation notes)"  allow-clear AutoComplete="off"></a-input>
+							<a-form-item label="备注(notes)" v-bind="validateInfos.notes" id="saleInvoiceForm-notes" name="notes" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
+								<a-input v-model:value="formData.notes" placeholder="请输入备注(notes)"  allow-clear AutoComplete="off"></a-input>
 							</a-form-item>
 						</a-col>
           </a-row>
@@ -108,7 +133,7 @@
 		<!-- 子表单区域 -->
     <a-tabs v-model:activeKey="activeKey" animated  style=" padding: 24px;padding-top: 0px;">
       <a-tab-pane tab="销售发票 - 发票明细(invoice details)" key="saleInvoiceDetails" :forceRender="true">
-        <a-button type="primary"  style="margin-right: 1%;margin-bottom: 1%;" @click="selectDeliveryList"> 选择发货通知单(select delevery notice)</a-button>
+        <a-button type="primary"  style="margin-right: 1%;margin-bottom: 1%;" @click="selectDeliveryList" > 选择发货通知单(select delevery notice)</a-button>
         <a-button type="primary" @click="selectCommissionList"> 选择佣金订单(selete commission order)</a-button>
         <j-vxe-table
           :keep-source="true"
@@ -151,7 +176,7 @@
       </a-tab-pane>
       
     </a-tabs>
-    <SelectDeliveryNoticeModal ref="SelectDeliveryNoticeModalRef"></SelectDeliveryNoticeModal>
+    <SelectDeliveryNoticeModal ref="SelectDeliveryNoticeModalRef" @addDelivery="addSonList"></SelectDeliveryNoticeModal>
     <BaseShipArchiveAccessoriesModal ref="BaseShipArchiveAccessoriesListRef"></BaseShipArchiveAccessoriesModal>
     <SelectCommissionOrderModal ref="SelectCommissionOrderModalRef"></SelectCommissionOrderModal>
     <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
@@ -162,7 +187,7 @@
   import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
   import { defHttp } from '/@/utils/http/axios';
   import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
-  import { querysaleInvoiceFormShipListByMainId,querySaleInvoiceDetailListByMainId,queryDataById, saveOrUpdate } from '../salesInvoiceForm.api';
+  import { querysaleInvoiceFormShipListByMainId,querySaleInvoiceDetailListByMainId,queryDataById, saveOrUpdate,listHeard } from '../salesInvoiceForm.api';
   import { JVxeTable } from '/@/components/jeecg/JVxeTable';
   import {saleInvoiceShipColumns, saleInvoiceDetailColumns} from '../salesInvoiceForm.data';
   import BaseShipArchiveAccessoriesModal from '../../../publicComponents/BaseShipArchiveAccessoriesModal.vue';
@@ -172,7 +197,7 @@
   import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
   import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
   import { JDictSelectTag,JSelectMultiple} from '/@/components/Form';
-  import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
+  import {  ApiSelect, } from '/@/components/Form/index';
   import { Form,message } from 'ant-design-vue';
   import { useUserStore } from '/@/store/modules/user';
   import moment from 'moment';
@@ -187,10 +212,10 @@
       JUpload,
       SelectProjectModal,
       JDictSelectTag,
-      JSelectInput,
       JSelectMultiple,
       SelectDeliveryNoticeModal,
-      SelectCommissionOrderModal
+      SelectCommissionOrderModal,
+      ApiSelect
     },
     props:{
       formDisabled:{
@@ -229,24 +254,28 @@
         delFlag: undefined,
         sourceCode:'',
         billDate: moment(new Date()).format('YYYY-MM-DD'),   
-        billCode: '',   
+        invoiceCode: '',   
         project: '',   
         projectName: '',   
-        buyer: '',   
-        buyerName: '',   
-        buyerTelphone: '',   
-        buyerAddres: '',   
+        customer: '',   
+        customerName: '',   
+        buyerTaxNumber: '',  
+        buyerTelphone:'', 
+        buyerAddress: '',   
         buyerBank: '',   
-        buyerBankAccount: '',   
+        buyerAccount: '',   
         invoiceHeader: '',   
         invoiceAddress:"",
-        sallerTaxNumber: '',   
-        sallerTelphone: '',
-        sallerAddress: '',
-        sallerBank: '',
-        sallerBankAccount: '',
+        seller:'',
+        sellerName:'',
+        sellerTaxNumber: '',   
+        sellerTelphone: '',
+        sellerAddress: '',
+        sellerBank: '',
+        sellerBankAccount: '',
         fnumber:'',
         notes:'',         
+        busynessType:''
       });
 
       //表单验证
@@ -310,8 +339,8 @@
       }
 
       const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, {
-        'saleQuotationShip': saleInvoiceFormShipTableRef,
-        'saleQuotationProduct': saleInvoiceDetailsTableRef,
+        'saleInvoiceShip': saleInvoiceFormShipTableRef,
+        'saleInvoiceProduct': saleInvoiceDetailsTableRef,
       });
       //获取表单信息
       async function getFormData() {
@@ -331,11 +360,11 @@
       }
       //保存
       async function submitForm() {
-        if(formData.sourceCode==''){
-          message.warning('请选择发票明细')
+        const mainData = await getFormData();
+        const subData = await getSubFormAndTableData();
+        if(!subData.saleInvoiceProductList||subData.saleInvoiceProductList.lenght==0){
+          message.warning('请添加发票明细')
         }else{
-          const mainData = await getFormData();
-          const subData = await getSubFormAndTableData();
           const values = Object.assign({}, dbData, mainData, subData);
           console.log('表单提交数据', values)
           const isUpdate = values.id ? true : false
@@ -366,21 +395,11 @@
         var newArray = [...saleInvoiceDetailsTable.dataSource]
         newArray.splice(prop.rowIndex, 1)
         saleInvoiceDetailsTable.dataSource = newArray  
-        // if( saleInvoiceDetailsTable.dataSource.length!==0){
-        //   var arr = []
-        //   saleInvoiceDetailsTable.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
-        // }
+        if( saleInvoiceDetailsTable.dataSource.length!==0){
+            notAllowEdit.value=true
+        }else{
+           notAllowEdit.value=false
+        }
       }
       //选择项目
       function addProject(data) {
@@ -390,27 +409,13 @@
         }else{
           formData.project = data[0].id
           formData.projectName = data[0].name
-          // formData.customer =data[0].customerId
-          // formData.customerName =data[0].customerId_dictText
+          formData.customer =data[0].customerId
+          formData.customerName =data[0].customerId_dictText
         }
       }
       //获取客户列表
-      function getCustomerOptions(){
-          let params = {pageSize:'-1',status:1}
-          defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params}, { isTransformResponse: false }).then(res=>{
-            if(res){
-              customerOption.value = []
-              res.result.records.forEach(item=>{
-                customerOption.value.push({
-                  label: item.name,
-                  value: item.id,
-                  priority:item.priority,
-                  intermediatorCommission:item.intermediatorCommission,
-                  commission:item.commission
-                })
-              })
-            }
-          })
+      function getCustomerOptions(params){
+        return defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params});
       }
       //查看配件信息
       function viewAccessory(prop){
@@ -421,13 +426,80 @@
         SelectProjectModalRef.value.getTable()
       }
       function changeValues(prop){
-        
+        if(prop.col.key=='taxPrice'||prop.col.key=='quantity'){
+          prop.row.taxPrice = prop.row.taxPrice&&prop.row.taxPrice!==''?prop.row.taxPrice:0
+          prop.row.quantity = prop.row.quantity&&prop.row.quantity!==''?prop.row.quantity:0
+          var num= Number(prop.row.taxPrice)*Number(prop.row.quantity)
+          prop.row.taxMoney = num.toFixed(2)
+          prop.row.taxRate  = prop.row.taxRate?prop.row.taxRate:0
+          prop.row.taxAmount = Number(prop.row.taxMoney)* Number(prop.row.taxRate)/100
+        }
       }
       function selectDeliveryList(){
-        SelectDeliveryNoticeModalRef.value.getTable()
+        if(formData.busynessType=='佣金业务'){
+          message.warning('佣金业务不能选择发货通知单')
+        }else if(saleInvoiceDetailsTable.dataSource==0||saleInvoiceDetailsTable.dataSource==undefined){
+          SelectDeliveryNoticeModalRef.value.getTable(formData)
+        }else{
+          message.warning('发票明细只可有一条数据')
+        }
       }
       function selectCommissionList(){
-        SelectCommissionOrderModalRef.value.getTable()
+        if(formData.busynessType=='普通业务'){
+          message.warning('普通业务不能选择佣金订单')
+        }else if(saleInvoiceDetailsTable.dataSource==0||saleInvoiceDetailsTable.dataSource==undefined){
+          SelectCommissionOrderModalRef.value.getTable()
+        }else{
+          message.warning('发票明细只可有一条数据')
+        }
+      }
+      function addSonList(data){
+        data.map(item=>{
+          item.sourceId = item.childId
+          item.quantity =  item.quantity&& item.quantity!==''?item.quantity:0
+          item.taxPrice =  item.taxPrice&& item.taxPrice!==''?item.taxPrice:0
+          item.taxMoney =  item.money&& item.money!==''?item.money:0
+          //暂无税率字段,设置默认为1
+          item.taxRate = item.taxRate?item.taxRate:0
+          item.taxAmount =item.taxMoney*item.taxRate/100
+        })
+        notAllowEdit.value=true
+        var arrSonFormDelivery = data.concat(saleInvoiceDetailsTable.dataSource)
+        saleInvoiceDetailsTable.dataSource=arrSonFormDelivery     
+        formData.project = data[0].project
+        formData.projectName = data[0].projectName
+        formData.customer = data[0].customer
+        formData.customerName = data[0].customerName
+        formData.sourceCode =data[0].billCode
+        formData.invoiceHeader=data[0].invoiceHeader
+        formData.invoiceAddress=data[0].invoiceAddress
+        formData.busynessType = '普通业务'
+        getCustomerOptions({pageSize:-1,id:data[0].customer}).then(res=>{
+          formData.buyerTaxNumber = res.records[0].dutyParagraph
+          formData.buyerTelphone = res.records[0].phone
+          formData.buyerAddress = res.records[0].invoiceAddress
+        })
+
+        getShipDetail(data[0].headId,'delivery')
+      }
+      function getShipDetail(id,status){
+        let params = {id:id}
+        let url = status=='delivery'?'/saleCode/saleDelivery/querySaleDeliveryShipByMainId':'/saleCode/saleDelivery/querySaleContractShipByMainId'
+        defHttp.get({url:url,params}, { isTransformResponse: false }).then(res=>{
+           if(res){
+            saleInvoiceFormShipTable.dataSource = res.result
+           }
+        })
+      }
+      async function changeSeller(value){
+        var param={id:value}
+        var result=await listHeard(param)     
+        formData.sellerName =result.records[0].name
+        formData.sellerTaxNumber =result.records[0].taxcode
+        formData.sellerTelphone =result.records[0].telphone
+        formData.sellerAddress =result.records[0].address
+        formData.sellerBank =result.records[0].bank
+        formData.sellerBankAccount =result.records[0].bankAccount
       }
       return {
         saleInvoiceFormShipTableRef,
@@ -461,7 +533,10 @@
         SelectDeliveryNoticeModalRef,
         selectDeliveryList,
         SelectCommissionOrderModalRef,
-        selectCommissionList
+        selectCommissionList,
+        addSonList,
+        listHeard,
+        changeSeller
       }
     }
   });

+ 52 - 13
src/views/saleCode/salesInvoice/salesInvoiceForm.api.ts

@@ -4,18 +4,22 @@ import { useMessage } from "/@/hooks/web/useMessage";
 const { createConfirm } = useMessage();
 
 enum Api {
-  list = '/saleCode/saleQuotation/list',
-  save='/saleCode/saleQuotation/add',
-  edit='/saleCode/saleQuotation/edit',
-  deleteOne = '/saleCode/saleQuotation/delete',
-  deleteBatch = '/saleCode/saleQuotation/deleteBatch',
-  importExcel = '/saleCode/saleQuotation/importExcel',
-  exportXls = '/saleCode/saleQuotation/exportXls',
-  queryDataById = '/saleCode/saleQuotation/queryById',
-  saleInvoiceFormShipList = '/saleCode/saleQuotation/querySaleQuotationShipByMainId',
-  saleInvoiceDetailList = '/saleCode/saleQuotation/querySaleQuotationProductByMainId',
-  submitBatch='/saleCode/saleQuotation/submitBatch',
-  cancelSubmitBatch='/saleCode/saleQuotation/returnSubmitBatch',
+  list = '/saleCode/saleInvoice/list',
+  save='/saleCode/saleInvoice/add',
+  edit='/saleCode/saleInvoice/edit',
+  deleteOne = '/saleCode/saleInvoice/delete',
+  deleteBatch = '/saleCode/saleInvoice/deleteBatch',
+  importExcel = '/saleCode/saleInvoice/importExcel',
+  exportXls = '/saleCode/saleInvoice/exportXls',
+  queryDataById = '/saleCode/saleInvoice/queryById',
+  saleInvoiceFormShipList = '/saleCode/saleInvoice/querySaleInvoiceShipByMainId',
+  saleInvoiceDetailList = '/saleCode/saleInvoice/querySaleInvoiceProductByMainId',
+  submitBatch='/saleCode/saleInvoice/submitBatch',
+  cancelSubmitBatch='/saleCode/saleInvoice/returnSubmitBatch',
+  heardList='/baseCode/baseCompanyInformation/list',
+  close='/saleCode/saleInvoice//closeBatch',
+  editSign='/saleCode/saleInvoice/updateSigning',
+  getDetail='/saleCode/saleInvoice/queryBySourceId',
   supplierList='/cuspCode/cuspSupplierProfile/list?pageSize=-1'
 }
 /**
@@ -48,6 +52,10 @@ export const querySaleInvoiceDetailListByMainId = (id) => defHttp.get({url: Api.
 export const list = (params) =>
   defHttp.get({url: Api.list, params});
 
+// 销方列表接口
+export const listHeard = (params) =>
+  defHttp.get({url: Api.heardList, params});
+
 // 供应商列表接口
 export const listSupplier = (params) =>
   defHttp.get({url: Api.supplierList, params});
@@ -122,4 +130,35 @@ export const cancelBatchSubmit = (params, handleSuccess) => {
       });
     }
   });
-}
+}
+// 作废
+export const batchClose = (params, handleSuccess) => {
+  createConfirm({
+    iconType: 'warning',
+    title: '确认作废',
+    content: '是否作废选中数据',
+    okText: '确认',
+    cancelText: '取消',
+    onOk: () => {
+      return defHttp.get({url: Api.close, params}, {joinParamsToUrl: true}).then(() => {
+        handleSuccess();
+      });
+    }
+  });
+}
+/**
+ * 上传签单后调用接口修改列表中签单字段
+ * @param params
+ */
+export const editSignSing = (params, handleSuccess) => {
+  defHttp.get({url: Api.editSign, params}, {joinParamsToUrl: true}).then(() => {
+       handleSuccess();
+   });
+}
+
+/**
+ * 获取销售订单详情/采购订单详情/销售合同/销售出库列表接口
+ * @param params
+ */
+export const getListDetail = (params) =>
+  defHttp.get({url: Api.getDetail, params});

+ 17 - 11
src/views/saleCode/salesInvoice/salesInvoiceForm.data.ts

@@ -6,15 +6,15 @@ import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
 //列表数据
 export const columns: BasicColumn[] = [
    {
-    title: '发票单号(bill code)',
+    title: '发票单号(invoice code)',
     align:"center",
     ellipsis:true,
-    dataIndex: 'billCode'
+    dataIndex: 'invoiceCode'
    },  
    {
-    title: '发票日期(delivert date)',
+    title: '发票日期(bill date)',
     align:"center",
-    dataIndex: 'deliveryDate',
+    dataIndex: 'billDate',
     customRender:({text}) =>{
       text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
       return text;
@@ -31,13 +31,13 @@ export const columns: BasicColumn[] = [
     title: '客户订单号(customer order number)',
     align:"center",
     width:250,
-    dataIndex: 'customerOrderNumber'
+    dataIndex: 'orderNumber'
    },
    {
     title: '购方(buyer)',
     align:"center",
     ellipsis:true,
-    dataIndex: 'buyer'
+    dataIndex: 'customerName'
    },
    {
     title: '购方税号(buyer tax number)',
@@ -50,22 +50,28 @@ export const columns: BasicColumn[] = [
     title: '销售订单(sale order)',
     align:"center",
     dataIndex: 'saleOrder',
+    width:200,
+    slots: { customRender: 'jumpTo' },
    },
    {
     title: '采购订单(purchase order)',
     align:"center",
-    dataIndex: 'purchaseOrder'
+    dataIndex: 'purchaseOrder',
+    width:200,
+    slots: { customRender: 'jumpTo' },
    },
    {
     title: '销售合同(sale contract)',
     align:"center",
-    dataIndex: 'saleContract'
+    dataIndex: 'saleContract',
+    slots: { customRender: 'jumpTo' },
    },
    {
     title: '签单/提单(sign/bill of lading)',
     align:"center",
     dataIndex: 'sign',
     width:300,
+    slots: { customRender: 'signFile' },
    },
    {
     title: '价税合计(tax money)',
@@ -77,7 +83,7 @@ export const columns: BasicColumn[] = [
     title: '盖章发票(stapm invoice)',
     align:"center",
     dataIndex: 'stapmInvoice',
-    
+    slots: { customRender: 'viewFile' },    
    },
    {
     title: '提交(submit)',
@@ -148,7 +154,7 @@ export const saleInvoiceDetailColumns: JVxeColumn[] = [
     },    
     {
       title: '产品名称(product name)',
-      key: 'ProductName',
+      key: 'chineseName',
       type: JVxeTypes.normal,
       placeholder: '请输入${title}',
       width:"200px",
@@ -189,7 +195,7 @@ export const saleInvoiceDetailColumns: JVxeColumn[] = [
     {
       title: '备注(notes)',
       key: 'notes',
-      type: JVxeTypes.normal,
+      type: JVxeTypes.input,
       placeholder: '请输入${title}',
       width:"200px",
       defaultValue:'',

+ 111 - 27
src/views/saleCode/salesInvoice/salesInvoiceList.vue

@@ -11,16 +11,16 @@
                 </a-form-item>
             </a-col> 
             <a-col :lg="8">
-                <a-form-item name="billCode" :label-col="labelCol1" :wrapper-col="wrapperCol1">
-                  <template #label><span title="发票编号(bill code)">发票编号(bill code)</span></template>
-                  <a-input placeholder="请输入发票编号(bill code)" v-model:value="queryParam.billCode" allow-clear AutoComplete="off"></a-input>
+                <a-form-item name="invoiceCode" :label-col="labelCol1" :wrapper-col="wrapperCol1">
+                  <template #label><span title="发票编号(invoice code)">发票编号(invoice code)</span></template>
+                  <a-input placeholder="请输入发票编号(invoice code)" v-model:value="queryParam.invoiceCode" allow-clear AutoComplete="off"></a-input>
                 </a-form-item>
             </a-col>          
             <template v-if="toggleSearchStatus">
               <a-col :lg="8">
                 <a-form-item name="project">
-                  <template #label><span title="系统项目(project)">系统项目(project)</span></template>
-                  <a-input v-model:value="queryParam.project" placeholder="请输入" AutoComplete="off"/>
+                  <template #label><span title="项目(project)">项目(project)</span></template>
+                  <a-input v-model:value="queryParam.projectName" placeholder="请输入" AutoComplete="off"/>
                 </a-form-item>
               </a-col>
               <a-col :lg="8">
@@ -30,9 +30,9 @@
                 </a-form-item>
               </a-col>
               <a-col :lg="8">
-                <a-form-item name="customerOrderNumber" :label-col="labelCol1" :wrapper-col="wrapperCol1">
+                <a-form-item name="orderNumber" :label-col="labelCol1" :wrapper-col="wrapperCol1">
                   <template #label><span title="客户订单号(customer order number)">客户订单号(customer order number)</span></template>
-                  <a-input placeholder="请输入" v-model:value="queryParam.customerOrderNumber" allow-clear AutoComplete="off"></a-input>
+                  <a-input placeholder="请输入" v-model:value="queryParam.orderNumber" allow-clear AutoComplete="off"></a-input>
                 </a-form-item>
               </a-col>
               <a-col :lg="8">
@@ -65,6 +65,7 @@
             <a-button  type="primary" v-auth="'saleCode:sale_order:exportXls'"  preIcon="ant-design:export-outlined" @click="onExportXls"> 导出(export)</a-button>
             <a-button  type="primary"  @click="submit" > 提交(submit)</a-button>
             <a-button  type="primary"  @click="cancelSubmit"> 取消提交(cancelSubmit)</a-button>
+            <a-button  type="primary"  @click="handleNullify"> 作废(nullify)</a-button>
             <a-dropdown v-if="selectedRowKeys.length > 0">
                 <template #overlay>
                   <a-menu>
@@ -86,9 +87,27 @@
         <!--字段回显插槽-->
         <template v-slot:bodyCell="{ column, record, index, text }">
         </template>
+
+        <template #jumpTo="props">
+            <a @click="handleView(props)">查看(view)</a>
+        </template>
+        <template #viewFile="props">
+          <a-upload name="file" :showUploadList="false" :action="uploadUrl" :headers="headers"  @change="value => handleChange(value, props)">
+            <a>上传(upload)</a>
+          </a-upload>
+          <a>/</a>
+          <a :href="props.record.stampInvoice">查看</a>
+        </template>
+        
+        <template #signFile="props">
+            <a  @click="handleViewSin(props)" >查看(view)</a>
+        </template>
       </BasicTable>
       <!-- 表单区域 -->
-      <saleInvoiceFormModal  @register="registerModal" @success="handleSuccess"></saleInvoiceFormModal>
+      <saleInvoiceFormModal  @register="registerModal" @success="handleSuccess" v-if="viewType==''"></saleInvoiceFormModal>
+      <SaleOrderFormList  @register="registerModal" v-if="viewType=='saleOrder'" @visibleChange="changeVisi"></SaleOrderFormList>
+      <PurchaseOrderFormList  @register="registerModal" v-if="viewType=='purchaseOrder'" @visibleChange="changeVisi"></PurchaseOrderFormList>
+      <SaleContractList  @register="registerModal" v-if="viewType=='saleContract'" @visibleChange="changeVisi"></SaleContractList>
     </div>
   </template>
   
@@ -98,20 +117,27 @@
     import { useListPage } from '/@/hooks/system/useListPage'
     import {useModal} from '/@/components/Modal';
     import {columns,} from './salesInvoiceForm.data';
-    import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,batchSubmit,cancelBatchSubmit} from './salesInvoiceForm.api';
+    import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,batchSubmit,cancelBatchSubmit,batchClose,editSignSing,getListDetail} from './salesInvoiceForm.api';
     import { cloneDeep } from "lodash-es";
     import { defHttp } from '/@/utils/http/axios';
     import { JDictSelectTag} from '/@/components/Form';
     import saleInvoiceFormModal from './components/saleInvoiceFormModal.vue';
-    import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
-    import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
-    import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
+    import SaleOrderFormList from '../salesOrder/components/SaleOrderFormModal.vue'
+    import PurchaseOrderFormList from '../../purchase/purchaseOrder/components/PurchaseOrderFormModal.vue'
+    import SaleContractList from '../saleContract/components/SaleContractModal.vue'
     import { message } from 'ant-design-vue';
+    import { getHeaders } from '/@/utils/common/compUtils';
+    import { uploadUrl } from '/@/api/common/api';
+    import { useGlobSetting } from '/@/hooks/setting';
+    const globSetting = useGlobSetting();
+    const baseUploadUrl = globSetting.uploadUrl;
+    const headers = getHeaders();
     const formRef = ref();
     const queryParam = reactive<any>({});
     //注册model
     const [registerModal, {openModal}] = useModal();
     var classOption = ref([]);
+    var viewType= ref('');
      //注册table数据
     const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
         tableProps:{
@@ -125,7 +151,7 @@
                  fixed:'right'
              },
              scroll:{
-              x:'2800px'
+              x:'3000px'
              },
              beforeFetch: async (params) => {
                let rangerQuery = await setRangeQuery();
@@ -163,23 +189,13 @@
      /**
       * 编辑事件
       */
-    function handleEdit(record: Recordable) {
-       openModal(true, {
+    async function handleEdit(record: Recordable) {
+        openModal(true, {
          record,
          isUpdate: true,
          showFooter: true,
          isRevise: false
-       });
-     }
-  
-     //修订
-     function handleRevise(record: Recordable){
-      openModal(true, {
-         record,
-         isUpdate: true,
-         showFooter: true,
-         isRevise: true
-       });
+       })   
      }
     //  产品分类
     function getOptiom(){
@@ -296,7 +312,75 @@
         cancelBatchSubmit({ids: ids},handleSuccess);
       }
     }
-  
+    // 作废
+    function handleNullify(){
+      if(selectedRowKeys.value.length==0){
+        message.warning('请选择数据')
+      }else{
+        var ids=selectedRowKeys.value.join(',')
+        batchClose({ids: ids},handleSuccess);
+      }
+    }
+    function handleChange(info,props){
+        if (info.file.status !== 'uploading') {
+          // console.log(info.file, info.fileList);
+        }
+        if (info.file.status === 'done') {
+          if (info.file.response.success) {
+            editSinging(info.file.response.message,props.record)
+          } else {
+            message.error(`${info.file.name} ${info.file.response.message}.`);
+          }
+        } else if (info.file.status === 'error') {
+          message.error(`文件上传失败: ${info.file.msg} `);
+        }
+    }
+    function editSinging(fileName,record){
+      var params = {
+        id: record.id,
+        stampInvoice: baseUploadUrl+'/sys/common/static/'+fileName
+      }
+      editSignSing(params,handleSuccess);
+    }
+    async function handleView(prop){
+      var param={
+        id:'',
+        type:''
+      }
+      if(prop.column.dataIndex=='saleOrder'){
+        viewType.value = 'saleOrder'
+        param.id=prop.record.id
+        param.type='saleOrder'
+      }else if(prop.column.dataIndex=='purchaseOrder'){
+        viewType.value = 'purchaseOrder'
+        param.id=prop.record.id
+        param.type='purchaseOrder'
+      }else if(prop.column.dataIndex=='saleContract'){
+        viewType.value = 'saleContract'
+        param.id=prop.record.id
+        param.type='saleContract'
+      }
+      var record = await getListDetail(param)
+      openModal(true, {
+          record,
+         isUpdate: true,
+         showFooter: false,
+       });
+    }
+    async function handleViewSin(prop){
+      var param={
+        id:prop.record.id,
+        type:'signBill'
+      }
+      var record = await getListDetail(param)
+      prop.record.sign = baseUploadUrl+'/sys/common/static/'+record.signing
+      window.location.href = prop.record.sign
+    }
+    function changeVisi(data){
+      if(!data){
+        viewType.value=''
+      }
+    }
     /* ----------------------以下为原生查询需要添加的-------------------------- */
     const toggleSearchStatus = ref<boolean>(false);
     const labelCol = reactive({