From 09542900534645e28c23f16caa94aa8a2c20cc5b Mon Sep 17 00:00:00 2001
From: payne <bzrlw2012@163.com>
Date: 周五, 03 5月 2024 16:10:02 +0800
Subject: [PATCH] 往来单位助记码功能调整为 中文名称输入立即调用接口实现

---
 iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/editForm.vue |   67 +++++++++++++++++++++++++++++----
 1 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/editForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/editForm.vue
index 080d07e..5aaa967 100644
--- a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/editForm.vue
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/editForm.vue
@@ -1,21 +1,25 @@
 锘�<template>
   <a-modal
-    title="缂栬緫瀹㈡埛妗f"
-    :width="900"
+    title="缂栬緫寰�鏉ュ崟浣�"
+    :width="1100"
     :visible="visible"
     :confirmLoading="confirmLoading"
     @ok="handleSubmit"
     @cancel="handleCancel">
     <a-spin :spinning="confirmLoading">
       <a-form :form="form">
-        <a-form-item label="瀹㈡埛涓枃鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
-          <a-input placeholder="璇疯緭鍏ュ鎴蜂腑鏂囧悕绉�" v-decorator="['custChinaName', {rules: [{required: true, message: '璇疯緭鍏ュ鎴蜂腑鏂囧悕绉帮紒'}]}]" />
+        <a-form-item label="涓枃鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+          <a-input placeholder="璇疯緭鍏ヤ腑鏂囧悕绉�"
+          @input="custChinaNameChange"
+          v-decorator="['custChinaName', {rules: [{required: true, message: '璇疯緭鍏ヤ腑鏂囧悕绉帮紒'}]}]" />
         </a-form-item>
-        <a-form-item label="瀹㈡埛鑻辨枃鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
-          <a-input placeholder="璇疯緭鍏ュ鎴疯嫳鏂囧悕绉�" v-decorator="['custEnglishName']" />
+        <a-form-item label="鑻辨枃鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
+          <a-input placeholder="璇疯緭鍏ヨ嫳鏂囧悕绉�" v-decorator="['custEnglishName']" />
         </a-form-item>
         <a-form-item label="鍔╄鐮�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
-          <a-input placeholder="璇疯緭鍏ュ姪璁扮爜" v-decorator="['mnemonicCode']" />
+          <!-- <a-input placeholder="璇疯緭鍏ュ姪璁扮爜" v-decorator="['mnemonicCode']" /> -->
+          <a-input  placeholder="璇疯緭鍏ュ姪璁扮爜" v-decorator="['mnemonicCode', { rules: [{ required: true, message: '璇疯緭鍏ュ姪璁扮爜锛�' }] }]" />
+       
         </a-form-item>
         <a-form-item label="绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol">
           <a-select style="width: 100%" placeholder="璇烽�夋嫨绫诲瀷" v-decorator="['custType', {rules: [{ required: true, message: '璇烽�夋嫨绫诲瀷锛�' }]}]">
@@ -55,7 +59,7 @@
 <script>
 import moment from 'moment'
   import {
-  BaseCustomerEdit
+  BaseCustomerEdit, BaseZjmList
   } from '@/api/modular/main/WmsBase/BaseCustomerManage'
   export default {
   data () {
@@ -142,7 +146,54 @@
       handleCancel () {
         this.form.resetFields()
         this.visible = false
+      },
+       /*涓枃鍚嶇О鍊兼敼鍙樿皟鐢ㄧ殑鏂规硶*/
+    custChinaNameChange(){
+      let custChinaNameValue = this.form.getFieldValue('custChinaName');
+       console.log(typeof custChinaNameValue)
+      console.log("custChinaNameValue:"+custChinaNameValue);
+      if(!custChinaNameValue){
+        this.form.setFieldsValue({
+              mnemonicCode: ''
+            })
+        return
       }
+      if (custChinaNameValue!=undefined&&!custChinaNameValue.trim().length) {
+        this.form.setFieldsValue({
+              mnemonicCode: ''
+            })
+           return
+       }
+      /*璋冪敤鑾峰彇鍔╄鐮佹帴鍙�*/ 
+      BaseZjmList({
+        'name': custChinaNameValue
+      }).then((res) => {
+        if (res.success) {
+          if (res.data) {
+            this.zjCode = res.data || '';
+            this.disabled = true;
+            this.form.setFieldsValue({
+              mnemonicCode: this.zjCode
+            })
+          } else {
+            // this.$message.warning("鍔╄鐮佺敓鎴愬け璐�")
+            this.form.setFieldsValue({
+              mnemonicCode: ''
+            })
+          }
+        } else {
+          this.$message.error('鍔╄鐮佺敓鎴愬け璐�:' + JSON.stringify(res.message))
+        }
+      }).finally((res) => {
+        this.confirmLoading = false
+      })
+    }
     }
   }
 </script>
+<style lang="less" scoped>
+  .ant-row.ant-form-item {
+    width: 50% !important;
+    display: inline-block;
+  }
+</style>
\ No newline at end of file

--
Gitblit v1.9.3