|  | @@ -303,6 +303,15 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        //表单验证
 | 
	
		
			
				|  |  |        const validatorRules = reactive({
 | 
	
		
			
				|  |  | +        quotationProjectName: [
 | 
	
		
			
				|  |  | +          { required: true, message: '请选择报价项目(select project)' }
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        quotationCustomer:[
 | 
	
		
			
				|  |  | +          { required: true, message: '请选择报价客户(select customer)' }
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        currency:[
 | 
	
		
			
				|  |  | +          { required: true, message: '请选择币种(select currency)' }
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
 | 
	
		
			
				|  |  |        const dbData = {};
 | 
	
	
		
			
				|  | @@ -406,19 +415,26 @@
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //保存
 | 
	
		
			
				|  |  |        async function submitForm() {
 | 
	
		
			
				|  |  | -        if(formData.sourceCode==''){
 | 
	
		
			
				|  |  | -          message.warning('请选择供应商报价单')
 | 
	
		
			
				|  |  | +        var xTable = saleQuotationFormProductTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | +        if(xTable.data.length==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
 | 
	
		
			
				|  |  | -          const isRevise = values.status=='1' ? true : false
 | 
	
		
			
				|  |  | -          await saveOrUpdate(values, isUpdate,isRevise);
 | 
	
		
			
				|  |  | -          //关闭弹窗
 | 
	
		
			
				|  |  | -          emit('success');
 | 
	
		
			
				|  |  | -        }        
 | 
	
		
			
				|  |  | +          saleQuotationFormProductTableRef.value!.validateTable().then(async (errMap) =>  {
 | 
	
		
			
				|  |  | +            if (errMap) {
 | 
	
		
			
				|  |  | +              console.log('表单验证未通过:', { errMap });
 | 
	
		
			
				|  |  | +            } 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
 | 
	
		
			
				|  |  | +              const isRevise = values.status=='1' ? true : false
 | 
	
		
			
				|  |  | +              await saveOrUpdate(values, isUpdate,isRevise);
 | 
	
		
			
				|  |  | +              //关闭弹窗
 | 
	
		
			
				|  |  | +              emit('success');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        }       
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        
 | 
	
		
			
				|  |  |        function setFieldsValue(values) {
 | 
	
	
		
			
				|  | @@ -439,13 +455,15 @@
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //传明细-删除行
 | 
	
		
			
				|  |  |        async function handleDelete(prop) {
 | 
	
		
			
				|  |  | -        var newArray = [...saleQuotationFormShipTable.dataSource]
 | 
	
		
			
				|  |  | +        var xTable = saleQuotationFormShipTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | +        var newArray = [...xTable.data]
 | 
	
		
			
				|  |  |          newArray.splice(prop.rowIndex, 1)
 | 
	
		
			
				|  |  |          saleQuotationFormShipTable.dataSource = newArray 
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //产品明细-删除行
 | 
	
		
			
				|  |  |        async function handleDelete1(prop) {
 | 
	
		
			
				|  |  | -        var newArray = [...saleQuotationFormProductTable.dataSource]
 | 
	
		
			
				|  |  | +        var xTable = saleQuotationFormProductTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | +        var newArray = [...xTable.data]
 | 
	
		
			
				|  |  |          newArray.splice(prop.rowIndex, 1)
 | 
	
		
			
				|  |  |          saleQuotationFormProductTable.dataSource = newArray  
 | 
	
		
			
				|  |  |          if( saleQuotationFormProductTable.dataSource.length!==0){
 | 
	
	
		
			
				|  | @@ -474,7 +492,8 @@
 | 
	
		
			
				|  |  |            item.shipowner = item.relateCustomer
 | 
	
		
			
				|  |  |            item.shipId = item.id
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  | -        var arr = data.concat(saleQuotationFormShipTable.dataSource)
 | 
	
		
			
				|  |  | +        var xTable = saleQuotationFormShipTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | +        var arr = xTable.data.concat(data)
 | 
	
		
			
				|  |  |          saleQuotationFormShipTable.dataSource=arr             
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //增行-产品明细
 | 
	
	
		
			
				|  | @@ -490,7 +509,8 @@
 | 
	
		
			
				|  |  |            item.grossMargin = obj.grossMargin
 | 
	
		
			
				|  |  |            item.discount= formData.custumerDiscount
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
 | 
	
		
			
				|  |  | +        var xTable = saleQuotationFormProductTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | +        var arrProduct = xTable.data.concat(data)
 | 
	
		
			
				|  |  |          saleQuotationFormProductTable.dataSource=arrProduct    
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //选择项目
 | 
	
	
		
			
				|  | @@ -591,7 +611,7 @@
 | 
	
		
			
				|  |  |        //修改主表交期
 | 
	
		
			
				|  |  |        function changeDelivertTime(){
 | 
	
		
			
				|  |  |           if(saleQuotationFormProductTable.dataSource.length>0){
 | 
	
		
			
				|  |  | -            const xTable = saleQuotationFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  | +            var xTable = saleQuotationFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  |              var newArr = [...xTable.data]
 | 
	
		
			
				|  |  |              newArr.map(item=>{
 | 
	
		
			
				|  |  |                item.deliveryDayChild = formData.deliveryDayHead
 | 
	
	
		
			
				|  | @@ -654,7 +674,8 @@
 | 
	
		
			
				|  |  |            item.exchangeRateGys = item.exchangeRateUsd
 | 
	
		
			
				|  |  |            item.taxPriceGys = item.taxPrice
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
 | 
	
		
			
				|  |  | +        var xTable = saleQuotationFormProductTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | +        var arrProduct = xTable.data.concat(data)
 | 
	
		
			
				|  |  |          arrProduct.map(item=>{
 | 
	
		
			
				|  |  |            customerOption.value.map(event=>{
 | 
	
		
			
				|  |  |              if(event.value==formData.quotationCustomer){
 | 
	
	
		
			
				|  | @@ -746,7 +767,7 @@
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        function changeDiscountOrExchangeRate(){
 | 
	
		
			
				|  |  |          if(saleQuotationFormProductTable.dataSource.length>0){
 | 
	
		
			
				|  |  | -          const xTable = saleQuotationFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  | +          var xTable = saleQuotationFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  |            var newArr = [...xTable.data]
 | 
	
		
			
				|  |  |            formData.exchangeRate = (formData.exchangeRate==''||formData.exchangeRate===null||!formData.exchangeRate)?1:formData.exchangeRate
 | 
	
		
			
				|  |  |            newArr.map(item=>{
 | 
	
	
		
			
				|  | @@ -842,5 +863,9 @@
 | 
	
		
			
				|  |  |    /deep/.ant-form-item{
 | 
	
		
			
				|  |  |      margin-bottom: 8px !important;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +  /deep/.vxe-cell--valid-error-msg{
 | 
	
		
			
				|  |  | +    color: white !important;
 | 
	
		
			
				|  |  | +    background-color: white !important;
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |        
 | 
	
		
			
				|  |  |  </style>
 |