|  | @@ -6,7 +6,7 @@
 | 
	
		
			
				|  |  |            <a-row>
 | 
	
		
			
				|  |  |              <a-col :span="12">
 | 
	
		
			
				|  |  |                <a-form-item label="组织(organize)" v-bind="validateInfos.organize" id="SaleOrderForm-organize" name="organize">
 | 
	
		
			
				|  |  | -                <a-select v-model:value="formData.organize" :disabled="formData.id!==''">
 | 
	
		
			
				|  |  | +                <a-select v-model:value="formData.organize" :disabled="formData.id !== ''">
 | 
	
		
			
				|  |  |                    <a-select-option value="上海">上海</a-select-option>
 | 
	
		
			
				|  |  |                    <a-select-option value="香港">香港</a-select-option>
 | 
	
		
			
				|  |  |                  </a-select>
 | 
	
	
		
			
				|  | @@ -205,14 +205,46 @@
 | 
	
		
			
				|  |  |                  <a-input v-model:value="formData.purchasemanName" placeholder="请输入采购员(salesman)" allow-clear disabled />
 | 
	
		
			
				|  |  |                </a-form-item>
 | 
	
		
			
				|  |  |              </a-col>
 | 
	
		
			
				|  |  | +            <a-col :span="12">
 | 
	
		
			
				|  |  | +              <a-form-item label="折扣(discountHead)" v-bind="validateInfos.discountHead" id="SaleOrderForm-discountHead" name="discountHead">
 | 
	
		
			
				|  |  | +                <a-input-number
 | 
	
		
			
				|  |  | +                  v-model:value="formData.discountHead"
 | 
	
		
			
				|  |  | +                  placeholder="请输入折扣(discountHead)"
 | 
	
		
			
				|  |  | +                  :min="0"
 | 
	
		
			
				|  |  | +                  :max="100"
 | 
	
		
			
				|  |  | +                  @blur="discountHeadChange"
 | 
	
		
			
				|  |  | +                />
 | 
	
		
			
				|  |  | +              </a-form-item>
 | 
	
		
			
				|  |  | +            </a-col>
 | 
	
		
			
				|  |  | +            <a-col :span="12">
 | 
	
		
			
				|  |  | +              <a-form-item
 | 
	
		
			
				|  |  | +                label="折后金额(discountAmount)"
 | 
	
		
			
				|  |  | +                v-bind="validateInfos.discountAmount"
 | 
	
		
			
				|  |  | +                id="SaleOrderForm-discountAmount"
 | 
	
		
			
				|  |  | +                name="discountAmount"
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +                <a-input v-model:value="formData.discountAmount" allow-clear disabled />
 | 
	
		
			
				|  |  | +              </a-form-item>
 | 
	
		
			
				|  |  | +            </a-col>
 | 
	
		
			
				|  |  |              <a-col :span="12">
 | 
	
		
			
				|  |  |                <a-form-item label="备注(notes)" v-bind="validateInfos.notes" id="SaleOrderForm-notes" name="notes">
 | 
	
		
			
				|  |  |                  <a-input v-model:value="formData.notes" AutoComplete="off" />
 | 
	
		
			
				|  |  |                </a-form-item>
 | 
	
		
			
				|  |  |              </a-col>
 | 
	
		
			
				|  |  |              <a-col :span="12">
 | 
	
		
			
				|  |  | -              <a-form-item label="协议条款(agreement terms)"  v-bind="validateInfos.agreementTerms"  id="SaleOrderForm-agreementTerms"   name="agreementTerms">
 | 
	
		
			
				|  |  | -                <JSelectMultiple  v-model:value="formData.agreementTerms"   placeholder="" dictCode="base_agreement_terms,name,name"  page="false" showSearch/>
 | 
	
		
			
				|  |  | +              <a-form-item
 | 
	
		
			
				|  |  | +                label="协议条款(agreement terms)"
 | 
	
		
			
				|  |  | +                v-bind="validateInfos.agreementTerms"
 | 
	
		
			
				|  |  | +                id="SaleOrderForm-agreementTerms"
 | 
	
		
			
				|  |  | +                name="agreementTerms"
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +                <JSelectMultiple
 | 
	
		
			
				|  |  | +                  v-model:value="formData.agreementTerms"
 | 
	
		
			
				|  |  | +                  placeholder=""
 | 
	
		
			
				|  |  | +                  dictCode="base_agreement_terms,name,name"
 | 
	
		
			
				|  |  | +                  page="false"
 | 
	
		
			
				|  |  | +                  showSearch
 | 
	
		
			
				|  |  | +                />
 | 
	
		
			
				|  |  |                </a-form-item>
 | 
	
		
			
				|  |  |              </a-col>
 | 
	
		
			
				|  |  |            </a-row>
 | 
	
	
		
			
				|  | @@ -223,9 +255,19 @@
 | 
	
		
			
				|  |  |      <!-- 子表单区域 -->
 | 
	
		
			
				|  |  |      <a-tabs v-model:activeKey="activeKey" animated style="padding: 24px; padding-top: 0px">
 | 
	
		
			
				|  |  |        <a-tab-pane tab="采购订单 - 产品明细(product details)" key="purOrderFormShipFormProduct" :forceRender="true">
 | 
	
		
			
				|  |  | -        <a-button type="primary"  style="margin-right: 1%;margin-bottom: 1%;" @click="selectSaleOrderList" :disabled="formData.sourceCode!==''"> 选择销售订单(select saleorder)</a-button>
 | 
	
		
			
				|  |  | -        <a-button type="primary" style="margin-right: 1%;margin-bottom: 1%;" @click="selectVirtualProducts"> 选择虚拟产品(select virtual products)</a-button>
 | 
	
		
			
				|  |  | -        <a-button type="primary"  style="margin-right: 1%;margin-bottom: 1%;" @click="SelectSupplierQuotationList" :disabled="formData.sourceCode2!==''">选择供应商报价选定(select supplier quotation selection)</a-button>
 | 
	
		
			
				|  |  | +        <a-button type="primary" style="margin-right: 1%; margin-bottom: 1%" @click="selectSaleOrderList" :disabled="formData.sourceCode !== ''">
 | 
	
		
			
				|  |  | +          选择销售订单(select saleorder)</a-button
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +        <a-button type="primary" style="margin-right: 1%; margin-bottom: 1%" @click="selectVirtualProducts">
 | 
	
		
			
				|  |  | +          选择虚拟产品(select virtual products)</a-button
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +        <a-button
 | 
	
		
			
				|  |  | +          type="primary"
 | 
	
		
			
				|  |  | +          style="margin-right: 1%; margin-bottom: 1%"
 | 
	
		
			
				|  |  | +          @click="SelectSupplierQuotationList"
 | 
	
		
			
				|  |  | +          :disabled="formData.sourceCode2 !== ''"
 | 
	
		
			
				|  |  | +          >选择供应商报价选定(select supplier quotation selection)</a-button
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  |          <j-vxe-table
 | 
	
		
			
				|  |  |            :keep-source="true"
 | 
	
		
			
				|  |  |            resizable
 | 
	
	
		
			
				|  | @@ -266,16 +308,16 @@
 | 
	
		
			
				|  |  |          </j-vxe-table>
 | 
	
		
			
				|  |  |        </a-tab-pane>
 | 
	
		
			
				|  |  |      </a-tabs>
 | 
	
		
			
				|  |  | -    <SelectPrpductModal ref="SelectPrpductModalRef" @selectProduct ='addProduct'></SelectPrpductModal>
 | 
	
		
			
				|  |  | -    <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
 | 
	
		
			
				|  |  | -    <BaseShipArchiveAccessoriesModal ref="BaseShipArchiveAccessoriesModalRef"></BaseShipArchiveAccessoriesModal>
 | 
	
		
			
				|  |  | -    <SelectSaleOrderModal ref="SelectSaleOrderModalRef" @selectSaleOrder="addFormSaleOrder"></SelectSaleOrderModal>
 | 
	
		
			
				|  |  | -    <SelectSupplierQuotation ref="SelectSupplierQuotationRef" @selectSupplierQuatationConfirm="addFromQuotation"></SelectSupplierQuotation>
 | 
	
		
			
				|  |  | +    <SelectPrpductModal ref="SelectPrpductModalRef" @select-product="addProduct" />
 | 
	
		
			
				|  |  | +    <SelectProjectModal ref="SelectProjectModalRef" @select-project="addProject" />
 | 
	
		
			
				|  |  | +    <BaseShipArchiveAccessoriesModal ref="BaseShipArchiveAccessoriesModalRef" />
 | 
	
		
			
				|  |  | +    <SelectSaleOrderModal ref="SelectSaleOrderModalRef" @select-sale-order="addFormSaleOrder" />
 | 
	
		
			
				|  |  | +    <SelectSupplierQuotation ref="SelectSupplierQuotationRef" @select-supplier-quatation-confirm="addFromQuotation" />
 | 
	
		
			
				|  |  |    </a-spin>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script lang="ts">
 | 
	
		
			
				|  |  | -  import { defineComponent, ref, reactive, computed, toRaw } from 'vue';
 | 
	
		
			
				|  |  | +  import { defineComponent, ref, reactive, computed, toRaw, watch } from 'vue';
 | 
	
		
			
				|  |  |    import { defHttp } from '/@/utils/http/axios';
 | 
	
		
			
				|  |  |    import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
 | 
	
		
			
				|  |  |    import {
 | 
	
	
		
			
				|  | @@ -319,7 +361,7 @@
 | 
	
		
			
				|  |  |        SelectSaleOrderModal,
 | 
	
		
			
				|  |  |        ApiSelect,
 | 
	
		
			
				|  |  |        JSelectMultiple,
 | 
	
		
			
				|  |  | -      SelectSupplierQuotation
 | 
	
		
			
				|  |  | +      SelectSupplierQuotation,
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      props: {
 | 
	
		
			
				|  |  |        formDisabled: {
 | 
	
	
		
			
				|  | @@ -390,21 +432,20 @@
 | 
	
		
			
				|  |  |          currency: '',
 | 
	
		
			
				|  |  |          notes: '',
 | 
	
		
			
				|  |  |          agreementTerms: '',
 | 
	
		
			
				|  |  | +        discountHead: '',
 | 
	
		
			
				|  |  | +        discountAmount: '',
 | 
	
		
			
				|  |  | +        totalAmount: '',
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        //表单验证
 | 
	
		
			
				|  |  |        const validatorRules = reactive({
 | 
	
		
			
				|  |  | -        projectName: [
 | 
	
		
			
				|  |  | -          { required: true, message: '请选择报价项目(select project)' }
 | 
	
		
			
				|  |  | -        ],
 | 
	
		
			
				|  |  | -        organize: [
 | 
	
		
			
				|  |  | -          { required: true, message: '请选择组织(select organize)' }
 | 
	
		
			
				|  |  | -        ],
 | 
	
		
			
				|  |  | +        projectName: [{ required: true, message: '请选择报价项目(select project)' }],
 | 
	
		
			
				|  |  | +        organize: [{ required: true, message: '请选择组织(select organize)' }],
 | 
	
		
			
				|  |  |          // currency:[
 | 
	
		
			
				|  |  |          //   { required: true, message: '请选择币种(currency)' }
 | 
	
		
			
				|  |  |          // ],
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  | -      const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
 | 
	
		
			
				|  |  | +      const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
 | 
	
		
			
				|  |  |        const dbData = {};
 | 
	
		
			
				|  |  |        const formItemLayout = {
 | 
	
		
			
				|  |  |          labelCol: { xs: { span: 24 }, sm: { span: 7 } },
 | 
	
	
		
			
				|  | @@ -434,24 +475,25 @@
 | 
	
		
			
				|  |  |          formData.purchasemanName = userStore.getUserInfo.realname;
 | 
	
		
			
				|  |  |          formData.purchaseDepartment = userStore.getUserInfo.orgCode;
 | 
	
		
			
				|  |  |          formData.purchaseDepartmentName = userStore.getUserInfo.orgName;
 | 
	
		
			
				|  |  | +        formData.discountHead = '';
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        async function copy(data, id) {
 | 
	
		
			
				|  |  |          //主表数据
 | 
	
		
			
				|  |  |          await queryMainData(id);
 | 
	
		
			
				|  |  |          formData.id = '';
 | 
	
		
			
				|  |  |          formData.billCode = '';
 | 
	
		
			
				|  |  | -        formData.submit= undefined;
 | 
	
		
			
				|  |  | +        formData.submit = undefined;
 | 
	
		
			
				|  |  |          formData.sourceCode = '';
 | 
	
		
			
				|  |  |          formData.sourceCode2 = '';
 | 
	
		
			
				|  |  | -        formData.project=''
 | 
	
		
			
				|  |  | -        formData.projectName=''
 | 
	
		
			
				|  |  | +        formData.project = '';
 | 
	
		
			
				|  |  | +        formData.projectName = '';
 | 
	
		
			
				|  |  |          //子表数据
 | 
	
		
			
				|  |  |          const PurOrderFormShipFormShipDataList = await queryPurOrderFormShipFormShippTable(id);
 | 
	
		
			
				|  |  |          PurOrderFormShipFormShipTable.dataSource = [...PurOrderFormShipFormShipDataList];
 | 
	
		
			
				|  |  | -        data.map(item=>{
 | 
	
		
			
				|  |  | -          item.sourceId=''
 | 
	
		
			
				|  |  | -          item.sourceType =''
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | +        data.map((item) => {
 | 
	
		
			
				|  |  | +          item.sourceId = '';
 | 
	
		
			
				|  |  | +          item.sourceType = '';
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |          purOrderFormShipFormProductTable.dataSource = [...data];
 | 
	
		
			
				|  |  |          notAllowEdit.value = false;
 | 
	
		
			
				|  |  |        }
 | 
	
	
		
			
				|  | @@ -548,26 +590,26 @@
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        async function submitForm() {
 | 
	
		
			
				|  |  | -        var xTable = purOrderFormShipFormProductTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | -        if(xTable.data.length==0){
 | 
	
		
			
				|  |  | -          message.warning('请添加产品明细')
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | -          purOrderFormShipFormProductTableRef.value!.validateTable().then(async (errMap) =>  {
 | 
	
		
			
				|  |  | +        var xTable = purOrderFormShipFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  | +        if (xTable.data.length == 0) {
 | 
	
		
			
				|  |  | +          message.warning('请添加产品明细');
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          purOrderFormShipFormProductTableRef.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.submit=='1' ? true : false
 | 
	
		
			
				|  |  | -              await saveOrUpdate(values, isUpdate,isRevise);
 | 
	
		
			
				|  |  | +              console.log('表单提交数据', values);
 | 
	
		
			
				|  |  | +              const isUpdate = values.id ? true : false;
 | 
	
		
			
				|  |  | +              const isRevise = values.submit == '1' ? true : false;
 | 
	
		
			
				|  |  | +              await saveOrUpdate(values, isUpdate, isRevise);
 | 
	
		
			
				|  |  |                //关闭弹窗
 | 
	
		
			
				|  |  |                emit('success');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        function setFieldsValue(values) {
 | 
	
	
		
			
				|  | @@ -585,29 +627,32 @@
 | 
	
		
			
				|  |  |            item.productClass = item.classId_dictText;
 | 
	
		
			
				|  |  |            item.productCode = item.code;
 | 
	
		
			
				|  |  |            item.productId = item.id;
 | 
	
		
			
				|  |  | -          item.id = undefined
 | 
	
		
			
				|  |  | +          item.id = undefined;
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          var xTable = purOrderFormShipFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  |          var arrProduct = xTable.data.concat(data);
 | 
	
		
			
				|  |  |          purOrderFormShipFormProductTable.dataSource = arrProduct;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      function getShipList(id,status){
 | 
	
		
			
				|  |  | -        let params = {id:id}
 | 
	
		
			
				|  |  | -        let url = status=='quotation'?'/purCode/purQuotationSelection/queryPurQuotationSelectionShipByMainId':'/saleCode/saleOrder/querySaleOrderShipByMainId'
 | 
	
		
			
				|  |  | -          defHttp.get({url:url,params}, { isTransformResponse: false }).then(res=>{
 | 
	
		
			
				|  |  | -            if(res){
 | 
	
		
			
				|  |  | -              PurOrderFormShipFormShipTable.dataSource = res.result
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          })
 | 
	
		
			
				|  |  | +      function getShipList(id, status) {
 | 
	
		
			
				|  |  | +        let params = { id: id };
 | 
	
		
			
				|  |  | +        let url =
 | 
	
		
			
				|  |  | +          status == 'quotation'
 | 
	
		
			
				|  |  | +            ? '/purCode/purQuotationSelection/queryPurQuotationSelectionShipByMainId'
 | 
	
		
			
				|  |  | +            : '/saleCode/saleOrder/querySaleOrderShipByMainId';
 | 
	
		
			
				|  |  | +        defHttp.get({ url: url, params }, { isTransformResponse: false }).then((res) => {
 | 
	
		
			
				|  |  | +          if (res) {
 | 
	
		
			
				|  |  | +            PurOrderFormShipFormShipTable.dataSource = res.result;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      function addFormSaleOrder(data){
 | 
	
		
			
				|  |  | -        data.map(item=>{
 | 
	
		
			
				|  |  | -          item.model = item.childModel
 | 
	
		
			
				|  |  | -          item.sourceId = item.childId
 | 
	
		
			
				|  |  | -          item.sourceType = 'Con'+item.childId
 | 
	
		
			
				|  |  | -          item.sourceCode =item.billCode 
 | 
	
		
			
				|  |  | -          item.taxPrice=item.taxPriceGys
 | 
	
		
			
				|  |  | -          item.taxAmount = item.taxPrice*item.quantity
 | 
	
		
			
				|  |  | +      function addFormSaleOrder(data) {
 | 
	
		
			
				|  |  | +        data.map((item) => {
 | 
	
		
			
				|  |  | +          item.model = item.childModel;
 | 
	
		
			
				|  |  | +          item.sourceId = item.childId;
 | 
	
		
			
				|  |  | +          item.sourceType = 'Con' + item.childId;
 | 
	
		
			
				|  |  | +          item.sourceCode = item.billCode;
 | 
	
		
			
				|  |  | +          item.taxPrice = item.taxPriceGys;
 | 
	
		
			
				|  |  | +          item.taxAmount = item.taxPrice * item.quantity;
 | 
	
		
			
				|  |  |            // item.productClass =data[0].productClass
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          var xTable = purOrderFormShipFormProductTableRef.value!.getXTable();
 | 
	
	
		
			
				|  | @@ -636,35 +681,35 @@
 | 
	
		
			
				|  |  |            getShipList(data[0].headId, 'contract');
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      function addFromQuotation(data){
 | 
	
		
			
				|  |  | -        data.map(item=>{
 | 
	
		
			
				|  |  | -          item.fatherModel = item.model
 | 
	
		
			
				|  |  | -          item.model = item.childModel
 | 
	
		
			
				|  |  | -          item.sourceId = item.childId
 | 
	
		
			
				|  |  | -          item.sourceType = 'Quo'+item.childId
 | 
	
		
			
				|  |  | -          item.sourceCode =item.billCode
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | -        var arrProduct = data.concat(purOrderFormShipFormProductTable.dataSource)
 | 
	
		
			
				|  |  | -        purOrderFormShipFormProductTable.dataSource=arrProduct  
 | 
	
		
			
				|  |  | -        notAllowEdit.value=true
 | 
	
		
			
				|  |  | -        formData.sourceCode =data[0].billCode
 | 
	
		
			
				|  |  | -        if(formData.sourceCode2==''){
 | 
	
		
			
				|  |  | -          formData.project = data[0].inquiryProject
 | 
	
		
			
				|  |  | -          formData.projectName = data[0].projectName
 | 
	
		
			
				|  |  | -          formData.supplier= data[0].selectionSupplier
 | 
	
		
			
				|  |  | -          formData.supplierName= data[0].selectionSupplier_dictText
 | 
	
		
			
				|  |  | -          formData.priority =data[0].priority
 | 
	
		
			
				|  |  | -          formData.productionClass =data[0].productionClass
 | 
	
		
			
				|  |  | -          formData.model =data[0].fatherModel
 | 
	
		
			
				|  |  | -          formData.maker =data[0].maker
 | 
	
		
			
				|  |  | -          formData.exchangeRate = data[0].exchangeRateUsd
 | 
	
		
			
				|  |  | -          formData.currency = data[0].currency
 | 
	
		
			
				|  |  | -          getShipList(data[0].headId,'quotation')
 | 
	
		
			
				|  |  | +      function addFromQuotation(data) {
 | 
	
		
			
				|  |  | +        data.map((item) => {
 | 
	
		
			
				|  |  | +          item.fatherModel = item.model;
 | 
	
		
			
				|  |  | +          item.model = item.childModel;
 | 
	
		
			
				|  |  | +          item.sourceId = item.childId;
 | 
	
		
			
				|  |  | +          item.sourceType = 'Quo' + item.childId;
 | 
	
		
			
				|  |  | +          item.sourceCode = item.billCode;
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        var arrProduct = data.concat(purOrderFormShipFormProductTable.dataSource);
 | 
	
		
			
				|  |  | +        purOrderFormShipFormProductTable.dataSource = arrProduct;
 | 
	
		
			
				|  |  | +        notAllowEdit.value = true;
 | 
	
		
			
				|  |  | +        formData.sourceCode = data[0].billCode;
 | 
	
		
			
				|  |  | +        if (formData.sourceCode2 == '') {
 | 
	
		
			
				|  |  | +          formData.project = data[0].inquiryProject;
 | 
	
		
			
				|  |  | +          formData.projectName = data[0].projectName;
 | 
	
		
			
				|  |  | +          formData.supplier = data[0].selectionSupplier;
 | 
	
		
			
				|  |  | +          formData.supplierName = data[0].selectionSupplier_dictText;
 | 
	
		
			
				|  |  | +          formData.priority = data[0].priority;
 | 
	
		
			
				|  |  | +          formData.productionClass = data[0].productionClass;
 | 
	
		
			
				|  |  | +          formData.model = data[0].fatherModel;
 | 
	
		
			
				|  |  | +          formData.maker = data[0].maker;
 | 
	
		
			
				|  |  | +          formData.exchangeRate = data[0].exchangeRateUsd;
 | 
	
		
			
				|  |  | +          formData.currency = data[0].currency;
 | 
	
		
			
				|  |  | +          getShipList(data[0].headId, 'quotation');
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //选择供应商报价单选定
 | 
	
		
			
				|  |  | -      function SelectSupplierQuotationList (){
 | 
	
		
			
				|  |  | -        SelectSupplierQuotationRef.value.getTable(formData,'purOrder')
 | 
	
		
			
				|  |  | +      function SelectSupplierQuotationList() {
 | 
	
		
			
				|  |  | +        SelectSupplierQuotationRef.value.getTable(formData, 'purOrder');
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        function addProject(data) {
 | 
	
		
			
				|  |  |          if (data.lenght == 0) {
 | 
	
	
		
			
				|  | @@ -681,11 +726,11 @@
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        //产品明细-删除行
 | 
	
		
			
				|  |  |        function handleDelete(prop) {
 | 
	
		
			
				|  |  | -        var xTable = purOrderFormShipFormProductTableRef.value!.getXTable()
 | 
	
		
			
				|  |  | -        var newArray = [...xTable.data]
 | 
	
		
			
				|  |  | -        newArray.splice(prop.rowIndex, 1)
 | 
	
		
			
				|  |  | -        purOrderFormShipFormProductTable.dataSource = newArray  
 | 
	
		
			
				|  |  | -        if( purOrderFormShipFormProductTable.dataSource.length!==0){
 | 
	
		
			
				|  |  | +        var xTable = purOrderFormShipFormProductTableRef.value!.getXTable();
 | 
	
		
			
				|  |  | +        var newArray = [...xTable.data];
 | 
	
		
			
				|  |  | +        newArray.splice(prop.rowIndex, 1);
 | 
	
		
			
				|  |  | +        purOrderFormShipFormProductTable.dataSource = newArray;
 | 
	
		
			
				|  |  | +        if (purOrderFormShipFormProductTable.dataSource.length !== 0) {
 | 
	
		
			
				|  |  |            var arrQuo = [],
 | 
	
		
			
				|  |  |              arrCon = [];
 | 
	
		
			
				|  |  |            purOrderFormShipFormProductTable.dataSource.map((item) => {
 | 
	
	
		
			
				|  | @@ -706,18 +751,16 @@
 | 
	
		
			
				|  |  |            } else if (arrCon.length == 0) {
 | 
	
		
			
				|  |  |              formData.sourceCode2 = '';
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | -           notAllowEdit.value=false
 | 
	
		
			
				|  |  | -           formData.sourceCode2 = ''
 | 
	
		
			
				|  |  | -           formData.sourceCode = ''
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          notAllowEdit.value = false;
 | 
	
		
			
				|  |  | +          formData.sourceCode2 = '';
 | 
	
		
			
				|  |  | +          formData.sourceCode = '';
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |        // 选择销售订单
 | 
	
		
			
				|  |  |        function selectSaleOrderList() {
 | 
	
		
			
				|  |  | -        SelectSaleOrderModalRef.value.getTable(formData,'purOrder');
 | 
	
		
			
				|  |  | +        SelectSaleOrderModalRef.value.getTable(formData, 'purOrder');
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        function selectVirtualProducts() {
 | 
	
		
			
				|  |  |          SelectPrpductModalRef.value.getTableVirtual();
 | 
	
	
		
			
				|  | @@ -744,7 +787,39 @@
 | 
	
		
			
				|  |  |        function handleFormChange(key, value) {
 | 
	
		
			
				|  |  |          formData[key] = value;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      // 折扣改变
 | 
	
		
			
				|  |  | +      const discountHeadChange = (event) => {
 | 
	
		
			
				|  |  | +        console.log(purOrderFormShipFormProductTable.dataSource);
 | 
	
		
			
				|  |  | +        if (formData.totalAmount) {
 | 
	
		
			
				|  |  | +          formData.discountAmount = formData.totalAmount * (1 - formData.discountHead / 100);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      // 监听 count 的变化
 | 
	
		
			
				|  |  | +      watch(
 | 
	
		
			
				|  |  | +        purOrderFormShipFormProductTable,
 | 
	
		
			
				|  |  | +        (newValue, oldValue) => {
 | 
	
		
			
				|  |  | +          let data = newValue.dataSource;
 | 
	
		
			
				|  |  | +          let total = 0;
 | 
	
		
			
				|  |  | +          data.map((item) => {
 | 
	
		
			
				|  |  | +            total += item.taxAmount;
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +          formData.totalAmount = total;
 | 
	
		
			
				|  |  | +          console.log(111, formData.totalAmount);
 | 
	
		
			
				|  |  | +          if (formData.discountHead) {
 | 
	
		
			
				|  |  | +            formData.discountAmount = formData.totalAmount * (1 - formData.discountHead / 100);
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          if (data.length < 1) {
 | 
	
		
			
				|  |  | +            formData.discountHead = '';
 | 
	
		
			
				|  |  | +            formData.discountAmount = '';
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        { deep: true }
 | 
	
		
			
				|  |  | +      );
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        return {
 | 
	
		
			
				|  |  | +        discountHeadChange,
 | 
	
		
			
				|  |  |          PurOrderFormShipFormShipTableRef,
 | 
	
		
			
				|  |  |          PurOrderFormShipFormShipTable,
 | 
	
		
			
				|  |  |          purOrderFormShipFormProductTableRef,
 | 
	
	
		
			
				|  | @@ -807,8 +882,8 @@
 | 
	
		
			
				|  |  |    /deep/.ant-form-item {
 | 
	
		
			
				|  |  |      margin-bottom: 8px !important;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  /deep/.vxe-cell--valid-error-msg{
 | 
	
		
			
				|  |  | +  /deep/.vxe-cell--valid-error-msg {
 | 
	
		
			
				|  |  |      color: white !important;
 | 
	
		
			
				|  |  |      background-color: white !important;
 | 
	
		
			
				|  |  | -  }  
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  </style>
 |