CheckStepOneForm.vue 8.07 KB
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="sn编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="snCode">
              <a-input v-model="model.snCode"  type="text"  placeholder="请输入sn编码"  ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <span style="font-size: 22px;">一(3)介电强度(GB/T15579.1-2024 6.1.5)</span>
        <a-row>
          <a-col :span="24">
            <span style="font-size: 16px;color: #00A0E9">1.所有回路对外露导电部件应能承受规定的试验电压而无闪络或击穿。</span>
            <a-form-model-item  label="最大额定电压<=50" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jdqd1">
              <a-input style="width: 200px;"  v-model="model.jdqd1"  placeholder="请输入检验结果"  ></a-input>
              <a-select style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd1v2">
                <a-select-option  value="Pass">Pass</a-select-option>
                <a-select-option  value="Fail">Fail </a-select-option>
              </a-select>
<!--              <j-dict-select-tag style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd1_2" dictCode="pass_status"/>-->
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="最大额定电压220" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jdqd2">
              <a-input style="width: 200px;"  v-model="model.jdqd2" placeholder="请输入检验结果"  ></a-input>
              <a-select style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd2v2">
                <a-select-option  value="Pass">Pass</a-select-option>
                <a-select-option  value="Fail">Fail </a-select-option>
              </a-select>
<!--              <j-dict-select-tag style="width: 200px;"  placeholder="请选择判定结果" v-model="model.jdqd2_2" dictCode="pass_status"/>-->
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>

          <a-col :span="24">
            <a-form-model-item label="最大额定电压450" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jdqd3">
              <a-input style="width: 200px;" v-model="model.jdqd3" placeholder="请输入检验结果"  ></a-input>
              <a-select style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd3v2">
                <a-select-option  value="Pass">Pass</a-select-option>
                <a-select-option  value="Fail">Fail </a-select-option>
              </a-select>
<!--              <j-dict-select-tag style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd3_2" dictCode="pass_status"/>-->
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <span style="font-size: 16px;color: #00A0E9">1.输入回路对控制回路应能承受规定的试验电压而无闪络或击穿现象。</span>
            <a-form-model-item label="最大额定电压450" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jdqd4">
              <a-input style="width: 200px;" v-model="model.jdqd4" placeholder="请输入检验结果"  ></a-input>
              <a-select style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd4v2">
                <a-select-option  value="Pass">Pass</a-select-option>
                <a-select-option  value="Fail">Fail </a-select-option>
              </a-select>
<!--              <j-dict-select-tag style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd4_2" dictCode="pass_status"/>-->
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <span style="font-size: 16px;color: #00A0E9">2.焊接回路对控制回路应能承受规定的试验电压而无闪络或击穿现象。</span>
            <a-form-model-item label="最大额定电压220" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jdqd5">
              <a-input style="width: 200px;" v-model="model.jdqd5" placeholder="请输入检验结果"  ></a-input>
              <a-select style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd5v2">
                <a-select-option  value="Pass">Pass</a-select-option>
                <a-select-option  value="Fail">Fail </a-select-option>
              </a-select>
<!--              <j-dict-select-tag style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd5_2" dictCode="pass_status"/>-->
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <span style="font-size: 16px;color: #00A0E9">3.输入回路对焊接回路应能承受规定的试验电压而无闪络或击穿现象。</span>
            <a-form-model-item label="最大额定电压450" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jdqd6">
              <a-input style="width: 200px;" v-model="model.jdqd6" placeholder="请输入检验结果"  ></a-input>
              <a-select style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd6v2">
                <a-select-option  value="Pass">Pass</a-select-option>
                <a-select-option  value="Fail">Fail </a-select-option>
              </a-select>
<!--              <j-dict-select-tag style="width: 200px;" placeholder="请选择判定结果" v-model="model.jdqd6_2" dictCode="pass_status"/>-->
            </a-form-model-item>
          </a-col>

        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  import {ajaxGetDictItems, getDictItemsFromCache} from "@api/api";

  export default {
    name: 'CheckStepOneForm',
    components: {
    },
    props: {
      //表单禁用

    },
    data () {
      return {
        model:{
          jdqd1:'500',
          jdqd2:'1100',
          jdqd3:'1875',
          jdqd4:'1875',
          jdqd5:'1100',
          jdqd6:'3750'
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
        },
        url: {
          add: "/jianyan/checkStepOne/add",
          edit: "/jianyan/checkStepOne/edit",
          queryById: "/jianyan/checkStepOne/queryById"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      console.log('111==',this.model)
      this.modelDefault = JSON.parse(JSON.stringify(this.model));

    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
        console.log('1212==',this.model)
      },
      submitForm () {
        const that = this;
        if(this.model.snCode==undefined||this.model.snCode==''){
          this.$message.warning('请先填写sn编码!');
          return;
        }
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
         
        })
      },
    }
  }
</script>