payne
2024-05-03 09542900534645e28c23f16caa94aa8a2c20cc5b
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/addForm.vue
@@ -5,6 +5,8 @@
      <a-form :form="form">
        <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>
@@ -13,7 +15,8 @@
        <a-form-item label="助记码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <!-- <a-input placeholder="请输入助记码" v-decorator="['mnemonicCode']" /> -->
          <a-input-search :disabled="disabled" placeholder="请输入助记码" v-decorator="['mnemonicCode']" @search="onSearch" />
          <!-- <a-input-search :disabled="disabled" placeholder="请输入助记码" v-decorator="['mnemonicCode']" @search="onSearch" /> -->
          <a-input  placeholder="请输入助记码" v-decorator="['mnemonicCode', { rules: [{ required: true, message: '请输入助记码!' }] }]" />
        </a-form-item>
        <a-form-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
@@ -87,14 +90,26 @@
      const custTypeOption = this.$options
      this.custTypeData = custTypeOption.filters['dictData']('base_customer_type')
    },
    onSearch() {
      let mnemonicCode = this.form.getFieldValue('mnemonicCode');
      if (!mnemonicCode) {
        this.$message.warning("请输入助记码")
    /*中文名称值改变调用的方法*/
    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': mnemonicCode
        'name': custChinaNameValue
      }).then((res) => {
        if (res.success) {
          if (res.data) {
@@ -104,18 +119,19 @@
              mnemonicCode: this.zjCode
            })
          } else {
            this.$message.warning("助记码生成失败")
            // this.$message.warning("助记码生成失败")
            this.form.setFieldsValue({
              mnemonicCode: ''
            })
          }
        } else {
          this.$message.error('新增失败:' + JSON.stringify(res.message))
          this.$message.error('助记码生成失败:' + JSON.stringify(res.message))
        }
      }).finally((res) => {
        this.confirmLoading = false
      })
    },
    /**
     * 提交表单
     */
@@ -130,7 +146,7 @@
            }
          }
          if (values.mnemonicCode && !this.zjCode) {
            this.$message.warning("请点击搜索助记码!")
            this.$message.warning("助记码不能为空!")
            return
          }
          this.confirmLoading = true