<template>
  <div>
    <el-form :model="editQuery" :rules="formRules" ref="dataForm" label-width="100px">

      <el-row :gutter="20">
        <el-col :span="11">
          <el-form-item prop="cpmctymc" label="UDI码">
            <el-input v-model="editQuery.code" auto-complete="off" :disabled="true"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11">
          <el-form-item prop="batchNo" label="生产日期">
            <el-input v-model="editQuery.produceDate" auto-complete="off" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="11">
          <el-form-item prop="cpmctymc" label="物资名称">
            <el-input v-model="editQuery.cpmctymc" auto-complete="off" :disabled="true"
                     ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11">
          <el-form-item prop="batchNo" label="规格型号">
            <el-input v-model="editQuery.ggxh" auto-complete="off" :disabled="true"></el-input>
          </el-form-item>
        </el-col>

      </el-row>
      <el-row :gutter="20">
        <el-col :span="11">
          <el-form-item prop="batchNo" label="失效日期">
            <el-input v-model="editQuery.expireDate" auto-complete="off" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11">
          <el-form-item prop="serialNo" label="序列号">
            <el-input v-model="editQuery.serialNo" auto-complete="off" ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="11">
          <el-form-item prop="batchNo" label="批次号">
            <el-input v-model="editQuery.batchNo" auto-complete="off" ></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="11">
            <el-form-item prop="batchNo" label="备注">
              <el-input v-model="editQuery.remark" auto-complete="off" ></el-input>
            </el-form-item>
        </el-col>
      </el-row>
      <div style="text-align: right;margin-top: 20px">
        <el-button @click="cancelDialog">取 消</el-button>
        <el-button type="primary" @click="saveCode()">确 定</el-button>
      </div>
    </el-form>
  </div>

</template>

<script>

import {
  findByCode,
  saveCode, tabCode,updateCodeLost
} from "@/api/inout/code";

export default {
  name: "editCodeLost",
  props: {
    editQuery: {
      type: Object,
      required: true,
    },
    closeCodeDialog: {
      type: Function,
      required: true,
    }
  },

  data() {
    return {
      xlhEnable: false,
      isUseDyCheck: false
    };
  },

  methods: {
    saveCode() {
      updateCodeLost(this.editQuery)
          .then((response) => {
            if (response.code === 20000) {
              this.$message.success("提交成功");
              this.closeCodeDialog()
            } else {
              this.$message.error(response.message);
            }
            this.loading = false;
          });


    }
    ,
    cancelDialog() {
      this.closeCodeDialog();
    }
    ,
    findByCode() {
      let query = {udiCode: this.editData.code};
      findByCode(query)
        .then((response) => {
          if (response.code === 20000) {
            if (response.data.scbssfbhxlh == "否") {
              this.xlhEnable = true;
            }
            if (response.data.zxxsbzbhsydysl > 1) {
              this.isUseDyCheck = true;
            }
          } else {
          }
          this.loading = false;
        });
    }

  }
  ,
  created() {

    this.findByCode();
  }
}
</script>

<style scoped>

</style>
