Bläddra i källkod

销售合同-添加“选择报价单功能”

jingbb 5 månader sedan
förälder
incheckning
f60399304f
1 ändrade filer med 40 tillägg och 14 borttagningar
  1. 40 14
      src/views/saleCode/saleContract/components/SaleContractModal.vue

+ 40 - 14
src/views/saleCode/saleContract/components/SaleContractModal.vue

@@ -2,13 +2,12 @@
   <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" width="95%" @ok="handleSubmit">
     <BasicForm @register="registerForm" ref="formRef" name="SaleContractForm">
         <template #quotationProjectName="props">
-								<a-input-search v-model:value="props.values.quotationProjectName"   allow-clear enter-button="Search" @search="onSearchProject( props)"></a-input-search>
+								<a-input-search v-model:value="props.values.quotationProjectName" :disabled="saleContractProductTable.dataSource.length!==0"   allow-clear enter-button="Search" @search="onSearchProject( props)"></a-input-search>
         </template>
     </BasicForm>
     <!-- 子表单区域 -->
     <a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs" style="padding: 24px;padding-top: 0px;">
       <a-tab-pane tab="销售合同-船明细" key="saleContractShip" :forceRender="true">
-        <a-button type="primary" @click="selectShip" style="margin-top: 10px;margin-bottom: 5px;"> 选择船(select ship)</a-button>
         <JVxeTable
           keep-source
           resizable
@@ -31,8 +30,8 @@
         </JVxeTable>
       </a-tab-pane>
       <a-tab-pane tab="销售合同-产品明细" key="saleContractProduct" :forceRender="true">
+        <a-button type="primary" @click="seleteQuotation" style="margin-top: 10px;margin-bottom: 5px;margin-right: 1%;"> 选择报价单(selete quotation)</a-button>
         <a-button type="primary" @click="selectProducts" style="margin-top: 10px;margin-bottom: 5px"> 选择产品(select product)</a-button>
-        <!-- <a-button type="primary" @click="chooseSupplier"> 选择供应商报价(selete supplier quotation)</a-button> -->
         <JVxeTable
           keep-source
           resizable
@@ -56,9 +55,9 @@
       </a-tab-pane>
     </a-tabs>
     <SelectProjectModal ref="SelectProjectModalRef"  @selectProject="addProject"></SelectProjectModal>
-    <SelectShipSModal ref="SelectShipSModalRef" @select="addShip"></SelectShipSModal>
     <BaseShipArchiveAccessoriesList ref="BaseShipArchiveAccessoriesListRef"></BaseShipArchiveAccessoriesList>
     <SelectPrpductModal ref="SelectPrpductModalRef" @selectProduct="addProduct"></SelectPrpductModal>
+    <SelectQuotationModal ref="SelectQuotationModalRef" @selectQuotation="addQuotation"></SelectQuotationModal>
   </BasicModal>
 </template>
 
@@ -72,7 +71,7 @@
     import {saveOrUpdate,saleContractShipList,saleContractProductList,querysaleVersonFormShipListByMainId,querySaleVersonProductListByMainId,queryVersonHistoryById} from '../SaleContract.api';
     import { defHttp } from '/@/utils/http/axios';
     import SelectProjectModal from './SelectProjectModal.vue';
-    import SelectShipSModal from './SelectShipSModal.vue';
+    import SelectQuotationModal from '../../../publicComponents/SelectQuotationModal.vue';
     import BaseShipArchiveAccessoriesList from './BaseShipArchiveAccessoriesModal.vue';
     import SelectPrpductModal from './SelectPrpductModal.vue';
     import { useUserStore } from '/@/store/modules/user';
@@ -88,8 +87,8 @@
     const activeKey = ref('saleContractShip');
     const saleContractShip = ref();
     const saleContractProduct = ref();
+    const SelectQuotationModalRef = ref()
     var SelectProjectModalRef = ref();
-    var SelectShipSModalRef = ref();
     var SelectPrpductModalRef = ref()
     var BaseShipArchiveAccessoriesListRef = ref();
     const tableRefs = {saleContractShip, saleContractProduct, };
@@ -205,14 +204,6 @@
             }
           })
       }
-    function selectShip(){
-        SelectShipSModalRef.value.getTable()
-    }
-    function addShip(data){
-      var arr = data.concat(saleContractShipTable.dataSource)
-        arr.map(item=>item.shipowner = item.relateCustomer)
-        saleContractShipTable.dataSource=arr 
-    }
     async function handleDelete(prop) {
         var newArray = [...saleContractShipTable.dataSource]
         newArray.splice(prop.rowIndex, 1)
@@ -224,6 +215,12 @@
     function selectProducts(){
       SelectPrpductModalRef.value.getTable()
     }
+    async function seleteQuotation(){
+      let fieldsValue = await getFieldsValue();
+      fieldsValue.project=fieldsValue.quotationProject
+      fieldsValue.projectName=fieldsValue.quotationProjectName
+      SelectQuotationModalRef.value.getTable(fieldsValue)
+    }
     function addProduct(data){
         var arrProduct = data.concat(saleContractProductTable.dataSource)
         arrProduct.map(item=>{
@@ -238,6 +235,35 @@
         newArray.splice(prop.rowIndex, 1)
         saleContractProductTable.dataSource = newArray  
     }
+    function addQuotation(data){
+        var arrProduct = data.concat(saleContractProductTable.dataSource)
+        arrProduct.map(item=>{
+          item.model = item.childModel
+          item.sourceId = item.childId
+        })
+        saleContractProductTable.dataSource=arrProduct 
+        setFieldsValue({
+           sourceCode:data[0].billCode,
+           quotationProjectName:data[0].quotationProjectName,
+           quotationProject:data[0].quotationProject,
+           quotationCustomerName:data[0].quotationCustomerName,
+           quotationCustomer:data[0].quotationCustomer,
+           priority:data[0].priority,
+           productionClass:data[0].productionClass,
+           model:data[0].headModel,
+           maker:data[0].maker,
+           currency:data[0].currency,
+          }) 
+          getShipList(data[0].headId)
+      }
+      function getShipList(id){
+        let params = {id:id}
+          defHttp.get({url:'/saleCode/saleQuotation/querySaleQuotationShipByMainId',params}, { isTransformResponse: false }).then(res=>{
+            if(res){
+              saleContractShipTable.dataSource = res.result
+            }
+          })
+      }
 </script>
 
 <style lang="less" scoped>