yuansh 2 日 前
コミット
5af28f8580

+ 103 - 15
src/views/purchase/purchaseOrder/components/PurchaseOrderFormForm.vue

@@ -186,18 +186,14 @@
               </a-form-item>
             </a-col>
             <a-col :span="12">
-              <a-form-item
-                label="汇率(exchange rate)"
-                v-bind="validateInfos.exchangeRate"
-                id="PurchaseOrderFormModal-exchangeRate"
-                name="exchangeRate"
-              >
-                <a-input v-model:value="formData.exchangeRate" placeholder="请输入" allow-clear AutoComplete="off" disabled />
+              
+              <a-form-item label="采购员(purchasesman)" v-bind="validateInfos.purchaseman" id="PurchaseOrderFormModal-purchaseman" name="purchaseman">
+                <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="币种(currency)" v-bind="validateInfos.currency" id="PurchaseOrderFormModal-currency" name="currency">
-                <JDictSelectTag :disabled="!hasPermission('purCode:pur_order:editBz')" v-model:value="formData.currency" placeholder="请选择" dictCode="currency" @change="handleChangeCurrency" />
+                <JDictSelectTag :disabled="!hasPermission('purCode:pur_order:editBZ')" :showChooseOption='false' v-model:value="formData.currency"  dictCode="currency" @change="handleChangeCurrency" />
               </a-form-item>
             </a-col>
             <a-col :span="12">
@@ -211,9 +207,14 @@
               </a-form-item>
             </a-col>
             <a-col :span="12">
-              <a-form-item label="采购员(purchasesman)" v-bind="validateInfos.purchaseman" id="PurchaseOrderFormModal-purchaseman" name="purchaseman">
-                <a-input v-model:value="formData.purchasemanName" placeholder="请输入采购员(salesman)" allow-clear disabled />
-              </a-form-item>
+				<a-form-item
+				  label="汇率(exchange rate)"
+				  v-bind="validateInfos.exchangeRate"
+				  id="PurchaseOrderFormModal-exchangeRate"
+				  name="exchangeRate"
+				>
+				  <a-input v-model:value="formData.exchangeRate" placeholder="请输入" allow-clear AutoComplete="off" disabled />
+				</a-form-item>
             </a-col>
             <a-col :span="12">
               <a-form-item
@@ -304,6 +305,11 @@
           :disabled="disabled || formData.sourceCode2 !== ''"
           >选择供应商报价选定(select supplier quotation selection)</a-button
         >
+        <a-button @click="showModal"
+          type="primary" danger
+          style="margin-right: 1%; margin-bottom: 1%"
+          >变更报价(Change quotation)</a-button
+        >
         <j-vxe-table
           :keep-source="true"
           resizable
@@ -348,6 +354,11 @@
     <SelectSaleOrderModal ref="SelectSaleOrderModalRef" @select-sale-order="addFormSaleOrder" />
     <SelectSupplierQuotation ref="SelectSupplierQuotationRef" @select-supplier-quatation-confirm="addFromQuotation" />
   </a-spin>
+  <a-modal v-model:visible="modalVisible" title="请输入报价选定单号(注:该操作无法撤回)" @ok="chooseQuote" :confirm-loading="confirmLoading" 
+	:mask-closable="false"
+    :keyboard="false">
+      <a-input v-model:value="inputValue" placeholder="请输入报价选定单号"/>
+    </a-modal>
 </template>
 
 <script lang="ts">
@@ -419,6 +430,58 @@
       const SelectSupplierQuotationRef = ref();
       const BaseShipArchiveAccessoriesModalRef = ref();
       const SelectSaleOrderModalRef = ref();
+	  
+	  const modalVisible = ref(false);
+	  const confirmLoading = ref(false);
+	  const inputValue = ref('');
+	  
+	  const showModal = () => {
+	    modalVisible.value = true;
+	  };
+	  
+	  const chooseQuote = () => {
+		  
+		if(inputValue.value == '' || inputValue.value == null){
+			message.error('请输入新的报价选定单号');
+			return false;
+		}
+		  
+		confirmLoading.value = true; // 启用加载状态
+	    try {
+	      
+			  let params = { id: formData.id,code: inputValue.value,project:formData.project };
+			  let url = '/purCode/purQuotationSelection/purQuotationSelectionProductBy';
+			  
+			  defHttp.get({ url: url, params }, { isTransformResponse: false }).then((res) => {
+				   console.log(res.success)
+				if (res.success) {
+					
+					const row = res.result;
+					
+					resetFields();
+					const tmpData = {};
+					Object.keys(formData).forEach((key) => {
+					  if (row.hasOwnProperty(key)) {
+						tmpData[key] = row[key];
+					  }
+					});
+					//赋值
+					Object.assign(formData, tmpData);
+					purOrderFormShipFormProductTable.dataSource = res.result.purOrderProductList;
+				}else{
+					
+					message.error(res.message);
+				}
+				
+			 });
+		  
+	      } finally {
+			inputValue.value = '';
+	        confirmLoading.value = false; // 无论成功失败都关闭加载
+	        modalVisible.value = false;
+	      }
+	  };
+	  
       const PurOrderFormShipFormShipTable = reactive<Record<string, any>>({
         loading: false,
         columns: purchaseOrderShipColumns,
@@ -438,6 +501,7 @@
         delFlag: undefined,
         sourceCode: '',
         sourceCode2: '',
+        changeSourceCode: '',
         submit: undefined,
         organize: '',
         billCode: '',
@@ -478,6 +542,8 @@
       //表单验证
       const validatorRules = reactive({
         projectName: [{ required: true, message: '请选择报价项目(select project)' }],
+        currency: [{ required: true, message: '请选择币种(select currency)' }],
+        exchangeRate: [{ required: true, message: '请维护本月税率' }],
         organize: [{ required: true, message: '请选择组织(select organize)' }],
         // currency:[
         //   { required: true, message: '请选择币种(currency)' }
@@ -523,6 +589,7 @@
         formData.submit = undefined;
         formData.sourceCode = '';
         formData.sourceCode2 = '';
+        formData.changeSourceCode = '';
         formData.project = '';
         formData.projectName = '';
         //子表数据
@@ -892,7 +959,8 @@
       // 监听币种变化,获取汇率
       watch(() => formData.currency, 
         async (newVal, oldVal) => {
-          if (newVal && newVal !== oldVal) {
+			
+          if (newVal && newVal !== oldVal && oldVal!=null && oldVal!='') {
             // setExchangeRate();
             await handleChangeCurrency(newVal, oldVal);
           }
@@ -905,13 +973,19 @@
         const currentCurrency = formData.currency;
         if (currentCurrency && newDate !== oldDate) {
           // 保留当前币种不变,但重新获取汇率并刷新子表
+		   
           await handleChangeCurrency(currentCurrency, currentCurrency);
         }
       },
       { immediate: false }
       );
       async function handleChangeCurrency (newCurrency?: string, oldCurrency?: string) {
-        if (!newCurrency || !oldCurrency) return;
+		  if (!newCurrency || !oldCurrency){
+			  
+			  			  console.log(33333333333)
+			  formData.exchangeRate = '';
+				return
+		  }
 
           const date = moment(formData.billDate);
           const year = date.format('YYYY');
@@ -920,9 +994,18 @@
           try {
             // 获取旧币种汇率(原币种)与 新币种汇率(新币种),并展示新币种汇率
             const oldRateRes = await getExchangeRate({ year, month, currency: oldCurrency });
-            const oldExchangeRate = parseFloat(oldRateRes || '1');
+            const oldExchangeRate = parseFloat(oldRateRes || '0');
+			if(oldExchangeRate == 0){
+				formData.exchangeRate = '';
+				return
+			}
             const newRateRes = await getExchangeRate({ year, month, currency: newCurrency });
-            const newExchangeRate = parseFloat(newRateRes || '1');
+            const newExchangeRate = parseFloat(newRateRes || '0');
+			if(newExchangeRate == 0){
+				formData.exchangeRate = '';
+				return
+			}
+			
             formData.exchangeRate = isNaN(newExchangeRate) ? '' : newExchangeRate;
             purOrderFormShipFormProductTable.dataSource = purOrderFormShipFormProductTable.dataSource.map(item => {
               const originalTaxPriceOriginal = item.taxPriceOriginal;
@@ -994,6 +1077,11 @@
         SelectSupplierQuotationList,
         addFromQuotation,
         handleChangeCurrency,
+        showModal,
+		modalVisible,
+		inputValue,
+		chooseQuote,
+		confirmLoading,
       };
     },
   });

+ 11 - 1
src/views/purchase/selectionQuotationForm/components/SelectQuotationFormForm.vue

@@ -371,6 +371,7 @@
            await getSupplierQuotationDetail(data[0].id)
            await getSupplierSummaryAmount(data[0].id)
         }else{
+			
           formData.inquiryProject = ''
           formData.projectName = ''
         }
@@ -379,7 +380,16 @@
       async function getShipDetail(id){
           let params = {projectId:id}
           await defHttp.get({url:'/purCode/purInquiryForm/getPurInquiryFormByProject',params}, { isTransformResponse: false }).then(res=>{
-            if(res!==''){
+			
+			if('undefined' != res.success && undefined != res.success && !res.success){
+				message.warning(res.message)
+				
+				formData.inquiryProject = ''
+				formData.projectName = ''
+				return
+			}
+			if(res!==''){
+				
               formData.priority = res.priority
               formData.productionClass = res.productionClass
               formData.model = res.model