liuying
2024-04-25 7b197894d375f9c445f68f965eabef83ed6791e1
助记码
已修改3个文件
202 ■■■■■ 文件已修改
iWare_RawMaterialWarehouse_Web/src/api/modular/main/WmsBase/BaseCustomerManage.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/addForm.vue 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsArea/editForm.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/api/modular/main/WmsBase/BaseCustomerManage.js
@@ -26,6 +26,15 @@
  })
}
export function BaseZjmList (parameter) {
  return axios({
    url: '/WmsCommon/getMnemonicCode',
    method: 'get',
    params: parameter
  })
}
/**
 * 添加往来关系
 *
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/BaseCustomer/addForm.vue
@@ -1,25 +1,26 @@
<template>
  <a-modal
    title="新增往来关系"
    :width="1100"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
  <a-modal title="新增往来关系" :width="1100" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
        <a-form :form="form">
      <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="请输入中文名称"
            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-search :disabled="disabled" placeholder="请输入助记码" v-decorator="['mnemonicCode']" @search="onSearch" />
        </a-form-item>
        <a-form-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-select style="width: 100%" placeholder="请选择类型" v-decorator="['custType', {rules: [{ required: true, message: '请选择类型!' }]}]">
            <a-select-option v-for="(item,index) in custTypeData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
          <a-select style="width: 100%" placeholder="请选择类型"
            v-decorator="['custType', { rules: [{ required: true, message: '请选择类型!' }] }]">
            <a-select-option v-for="(item, index) in custTypeData" :key="index" :value="item.code">{{ item.name
            }}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
@@ -52,78 +53,114 @@
</template>
<script>
  import moment from 'moment'
  import {
  BaseCustomerAdd
  } from '@/api/modular/main/WmsBase/BaseCustomerManage'
  export default {
  data () {
  return {
  labelCol: {
  xs: { span: 24 },
  sm: { span: 5 }
  },
  wrapperCol: {
  xs: { span: 24 },
  sm: { span: 15 }
  },
  custTypeData: [],
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
      }
    },
    methods: {
    moment,
      // 初始化方法
      add (record) {
        this.visible = true
        this.$nextTick(() => {
        });
        const custTypeOption = this.$options
        this.custTypeData = custTypeOption.filters['dictData']('base_customer_type')
import moment from 'moment'
import {
  BaseCustomerAdd, BaseZjmList
} from '@/api/modular/main/WmsBase/BaseCustomerManage'
export default {
  data() {
    return {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      /**
       * 提交表单
       */
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
              }
            }
            BaseCustomerAdd(values).then((res) => {
              if (res.success) {
                this.$message.success('新增成功')
                this.confirmLoading = false
                this.$emit('ok', values)
                this.handleCancel()
              } else {
                this.$message.error('新增失败:' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 15 }
      },
      custTypeData: [],
      visible: false,
      confirmLoading: false,
      form: this.$form.createForm(this),
      zjCode: '',
      disabled: false
    }
  },
  methods: {
    moment,
    // 初始化方法
    add(record) {
      this.visible = true
      this.$nextTick(() => {
      });
      const custTypeOption = this.$options
      this.custTypeData = custTypeOption.filters['dictData']('base_customer_type')
    },
    onSearch() {
      let mnemonicCode = this.form.getFieldValue('mnemonicCode');
      if (!mnemonicCode) {
        this.$message.warning("请输入助记码")
        return
      }
      BaseZjmList({
        'name': mnemonicCode
      }).then((res) => {
        if (res.success) {
          if (res.data) {
            this.zjCode = res.data || '';
            this.disabled = true;
            this.form.setFieldsValue({
              mnemonicCode: this.zjCode
            })
          } else {
            this.confirmLoading = false
            this.$message.warning("助记码生成失败")
            this.form.setFieldsValue({
              mnemonicCode: ''
            })
          }
        })
      },
      handleCancel () {
        this.form.resetFields()
        this.visible = false
      }
        } else {
          this.$message.error('新增失败:' + JSON.stringify(res.message))
        }
      }).finally((res) => {
        this.confirmLoading = false
      })
    },
    /**
     * 提交表单
     */
    handleSubmit() {
      const { form: { validateFields } } = this
      validateFields((errors, values) => {
        if (!errors) {
          for (const key in values) {
            if (typeof (values[key]) === 'object') {
              values[key] = JSON.stringify(values[key])
            }
          }
          if (values.mnemonicCode && !this.zjCode) {
            this.$message.warning("请点击搜索助记码!")
            return
          }
          this.confirmLoading = true
          BaseCustomerAdd(values).then((res) => {
            if (res.success) {
              this.$message.success('新增成功')
              this.confirmLoading = false
              this.$emit('ok', values)
              this.handleCancel()
            } else {
              this.$message.error('新增失败:' + JSON.stringify(res.message))
            }
          }).finally((res) => {
            this.confirmLoading = false
          })
        } else {
          this.confirmLoading = false
        }
      })
    },
    handleCancel() {
      this.form.resetFields()
      this.visible = false
    }
  }
}
</script>
<style lang="less" scoped>
  .ant-row.ant-form-item {
    width: 50% !important;
    display: inline-block;
  }
.ant-row.ant-form-item {
  width: 50% !important;
  display: inline-block;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsArea/editForm.vue
@@ -32,7 +32,7 @@
        <a-form-item label="所属仓库" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-select style="width: 100%" placeholder="请选择所属仓库"
            v-decorator="['warehouseId', { rules: [{ required: true, message: '请选择所属仓库!' }] }]">
            <a-select-option v-for="(item, index) in warehouseIdData" :key="index" :value="item.code">{{ item.name
            <a-select-option v-for="(item, index) in warehouseIdData" :key="index" :value="item.id">{{ item.name
            }}</a-select-option>
          </a-select>
        </a-form-item>