payne
2024-05-03 09542900534645e28c23f16caa94aa8a2c20cc5b
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/editForm.vue
@@ -1,6 +1,6 @@
<template>
  <a-modal
    title="编辑往来关系"
    title="编辑往来单位"
    :width="1100"
    :visible="visible"
    :confirmLoading="confirmLoading"
@@ -9,13 +9,17 @@
    <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-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>
        <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,48 @@
      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>