<template>
  <div>
    <el-form :model="formData"  ref="dataForm" label-width="100px">
      <el-row type="flex" justify="end">
        <el-button-group style="display: flex;margin-bottom: 15px; margin-right: 50px;margin-top: -5px">
          <el-button
            type="primary"
            @click.native="saveOrder('3')"
            :loading="loading"
          >审核通过
          </el-button
          >
          <el-button
            type="primary"
            @click.native="saveOrder('4')"
            :loading="loading"
          >审核拒绝
          </el-button
          >
        </el-button-group>
      </el-row>
      <el-card style="margin-top: -5px;">
        <el-row :gutter="20">
          <el-col :span="11">
            <el-form-item prop="billNo" label="单据号:">
              <el-input v-model="formData.billNo" auto-complete="off" :disabled="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item prop="createTime" label="创建日期:">
              <el-date-picker
                :disabled="true"
                v-model="formData.createTime"
                type="datetime"
                placeholder="选择日期"
                style="width: 100%"
                :clearable="false"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="11">
            <el-form-item prop="invCode" label="领用仓库:">
              <el-input v-model="formData.invName" auto-complete="off" :disabled="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item class="query-form-item" prop="targetInvCode" label="往来信息:">
              <el-input v-model="formData.targetInvName" 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="remark" label="审核说明:">
              <el-input v-model="formData.auditRemark" auto-complete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card>
        <el-table v-loading="loading" :data="codeArray" style="width: 100%;"  border max-height="300" height="300" ref="multipleTable">
          <el-table-column label="序号" type="index" width="50"></el-table-column>
          <el-table-column label="产品通用名" prop="cpmctymc" show-overflow-tooltip></el-table-column>
          <el-table-column label="规格型号" prop="ggxh" show-overflow-tooltip></el-table-column>
          <el-table-column label="单据数量" prop="count" show-overflow-tooltip></el-table-column>
          <el-table-column label="注册/备案凭证号" prop="zczbhhzbapzbh" show-overflow-tooltip></el-table-column>
          <el-table-column label="生产企业" prop="ylqxzcrbarmc" show-overflow-tooltip></el-table-column>
        </el-table>
      </el-card>
    </el-form>
  </div>
</template>

<script>
import dialogInvProduct from "../DialogSelectInvProduct";
import {getAudit, getOrderDetail} from "@/api/inout/receiveOrder";

export default {
  name: "idQuery",
  props: {
    closeDialog: {
      type: Function,
      required: true,
    },
    idQuery: {
      type: Object,
      required: true,
    },
    formData: {
      invCode: null,
      targetInvCode: null,
      billNo: null,
      createTime: "",
      billType: "",
    },
    codeArray: [],
  },
  data() {
    return {
      showSearch: true,
      code: "",
      query: {
        orderIdFk: "",
        page: 1,
        limit: 10,
      },
    };
  },
  components: {
    dialogInvProduct
  },
  methods: {
    hideSearch() {
      this.showSearch = !this.showSearch;
    },
    handleDetail() {
      var  query={};
      query.orderIdFk = this.formData.billNo;
      getOrderDetail(query) //查找该单号下的所有条码
        .then((response) => {
          this.codeArray = response.data.list || [];
        })
        .catch(() => {
          this.codeArray = [];
        });
    },
    saveOrder(val){
      var data={
        id:this.formData.id,
        billNo:this.formData.billNo,
        status:val,
        auditRemark:this.formData.auditRemark
      };
      getAudit(data).then((res=>{
        if(res.code==20000){
          this.closeDialog();
        }else{
          this.$message.error(res.message);
        }
      }))
    }
  },
  filters: {},
  mounted() {},
  created() {
    console.log(this.idQuery)
     this.formData=this.idQuery;
     this.handleDetail();
  },
};
</script>
<style>

.ao-text {
  width: 100%;
  font-size: 13px;
  font-family: "Microsoft YaHei";
  float: right;
  text-align: right;
  margin-top: 10px;
}

</style>



