<template>
  <div>
    <el-form
      :model="maForm"
      ref="maForm"
      size="small"
      :rules="rules"
      :inline="true"
      label-width="120px"
    >
      <el-form-item label="租赁单位" prop="unitId">
        <el-select
          v-model="maForm.unitId"
          placeholder="租赁单位"
          clearable
          filterable
          style="width: 240px"
          disabled
        >
          <el-option
            v-for="item in uniteList"
            :key="item.unitId"
            :label="item.unitName"
            :value="item.unitId"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="租赁工程" prop="projectId">
        <el-select
          v-model="maForm.projectId"
          placeholder="租赁工程"
          clearable
          filterable
          style="width: 240px"
          disabled
        >
          <el-option
            v-for="item in projectList"
            :key="item.proId"
            :label="item.proName"
            :value="item.proId"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="领料人" prop="leasePerson">
        <el-input
          v-model="maForm.leasePerson"
          placeholder="请输入领料人"
          clearable
          maxlength="50"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
          disabled
        />
      </el-form-item>

      <el-form-item label="联系电话" prop="phone">
        <el-input
          v-model="maForm.phone"
          placeholder="请输入联系电话"
          clearable
          maxlength="50"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
          disabled
        />
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          >导出</el-button
        >
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="equipmentList">
      <el-table-column label="序号" align="center" type="index" />
      <el-table-column
        label="类型名称"
        align="center"
        prop="maTypeName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="规格型号"
        align="center"
        prop="typeName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="计量单位"
        align="center"
        prop="unitName"
        :show-overflow-tooltip="true"
      >
      </el-table-column>
      <el-table-column
        label="当前库存"
        align="center"
        prop="purchaseNum"
        :show-overflow-tooltip="true"
      >
      </el-table-column>
      <el-table-column
        label="预领数量"
        align="center"
        prop="preNum"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="已领数量"
        align="center"
        prop="purchasePrice"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="管理模式"
        align="center"
        prop="purchasePrice"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="出库数量"
        align="center"
        prop="purchasePrice"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="备注"
        align="center"
        prop="remark"
        :show-overflow-tooltip="true"
      />
    </el-table>
  </div>
</template>

<script>
import { getPurchaseCheckInfo } from "@/api/purchase/goodsArrived";
import {
  uploadPurchaseFile,
  getPurchaseFileList,
} from "@/api/purchase/goodsAccept";
import { getToken } from "@/utils/auth";
export default {
  name: "QueryTools",
  dicts: ["purchase_task_status"],
  components: {
    // UploadImg,
  },
  props: {
    isView: {
      type: Boolean,
      default: () => {
        return false;
      },
    },
    queryTaskId: {
      type: [String, Number],
      default: () => {
        return "";
      },
    },
    queryId: {
      type: [String, Number],
      default: () => {
        return "";
      },
    },
  },
  data() {
    return {
      fixCodeList: ["否", "是"],
      //任务ID
      taskId: "",
      // 遮罩层
      loading: true,
      //任务数据
      taskInfo: {},
      // 表格数据
      equipmentList: [],
      // 是否显示弹出层
      open: false,
      rowData: {},
      maForm: {},
    };
  },
  computed: {},
  mounted() {
    this.taskId = this.queryTaskId;
    this.id = this.queryId;
    this.getTaskInfo();
  },
  methods: {
    //获取任务详情-列表数据
    getTaskInfo() {
      this.loading = true;
      getApplyInfo({ taskId: this.taskId, id: this.id }).then((response) => {
        this.taskInfo = response.data;
        this.equipmentList = response.data.purchaseCheckDetailsList;
        this.loading = false;
      });
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "/material/purchase_check_info/exportDetails",
        { taskId: this.taskId },
        `新购到货详情_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
  width: 60px !important;
  margin-bottom: 10px;
}
//隐藏图片上传框的css
::v-deep.disabled {
  .el-upload--picture-card {
    display: none;
  }
}
.custom-textarea {
  width: 300px;
  height: 100px;
}
.accept-img {
  color: #409eff;

  .a-two {
    margin-left: 20px;
  }
}

.left-tip {
  font-size: 16px;
  letter-spacing: 1px;
}
</style>
