cuijian
2023-10-25 fa921a7f2a42a4215299b79a995aad18a6225f74
src/views/eam/modules/site/ProductionLineModel.vue
@@ -16,14 +16,14 @@
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              label="产线编号"
              label="工段编号"
              :labelCol="{span:4}"
              :wrapperCol="{span:18}"
            >
              <a-input
                :readOnly="disableSubmit"
                :readOnly="true"
                allow-clear
                placeholder="请输入产线编号"
                placeholder="将由系统自动生成"
                v-decorator="['num', validatorRules.num ]"
              />
            </a-form-item>
@@ -33,14 +33,14 @@
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              label="产线名称"
              label="工段名称"
              :labelCol="{span:4}"
              :wrapperCol="{span:18}"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入产线名称"
                placeholder="请输入工段名称"
                v-decorator="['name', validatorRules.name ]"
              />
            </a-form-item>
@@ -89,7 +89,7 @@
<script>
import pick from 'lodash.pick'
import { postAction, requestPut } from '@/api/manage'
import { getAction,postAction, requestPut } from '@/api/manage'
import { duplicateCheck } from '@/api/api'
export default {
@@ -118,14 +118,14 @@
      validatorRules: {
        num: {
          rules: [
            { required: true, message: '请输入产线编号!' },
            { required: true, message: '请输入工段编号!' },
            { min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' },
            { validator: this.validateNum },
          ]
        },
        name: {
          rules: [
            { required: true, message: '请输入产线名称!' },
            { required: true, message: '请输入工段名称!' },
            { min: 0, max: 30, message: '长度不超过 30 个字符', trigger: 'blur' },
            { validator: this.validateName },
          ]
@@ -138,7 +138,8 @@
      },
      url: {
        add: "/base/productionLine/add",
        edit: "/base/productionLine/edit"
        edit: "/base/productionLine/edit",
        getNum: '/eam/sysIdentity/getNumNew',
      },
      disableSubmit: false,
      //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
@@ -159,6 +160,15 @@
      this.$nextTick(() => {
        this.form.setFieldsValue(pick(this.model, 'num', 'name', 'shiftCategoryId', 'remark'))
      });
      if (!record.id) {
        this.$nextTick(() => {
          getAction(this.url.getNum, { type: 'ProductionLine', length: '4' }).then((res) => {
            if (res.success) {
              this.form.setFieldsValue({ num: res.message });
            }
          })
        });
      }
    },
    close() {
      this.$emit('close');