<template>
  <div class="detail-container">
    <el-page-header @back="goBack" :content="listItem ? '编辑':'新增'"></el-page-header>

    <div class="main-title">
      <div class="title">工程信息单</div>
    </div>

    <el-form ref="mainForm" :model="mainForm" label-width="100px" size="small" label-position="left">
      <el-row :gutter="20">
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="工程信息单" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入工程信息单"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
          <el-form-item label="单据日期" prop="date">
            <el-date-picker
              v-model="mainForm.date"
              type="date"
              value-format="yyyy-MM-dd"
              style="width: 100%;"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="品类" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入品类"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="经销商编码" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入经销商编码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="项目名称" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入项目名称"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="单据类型" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入单据类型"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="经销商名称" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入经销商名称"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="使用单位" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入使用单位"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="安装地址" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入安装地址"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="工程编号" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入工程编号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="厂工程编码" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入厂工程编码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="工程登录类型" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入工程登录类型"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="16">
          <el-form-item label="备注" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="业务员" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入业务员"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="制单人" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入制单人"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
          <el-form-item label="制单日期" prop="date">
            <el-date-picker
              v-model="mainForm.date"
              type="date"
              value-format="yyyy-MM-dd"
              style="width: 100%;"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
          <el-form-item label="合同有效期" prop="date">
            <el-date-picker
              v-model="mainForm.date"
              type="date"
              value-format="yyyy-MM-dd"
              style="width: 100%;"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div class="main-title">
      <div class="title">货品信息</div>
      <el-button type="primary" size="small" icon="el-icon-plus">添加货品</el-button>
    </div>

    <div class="table" style="margin-top: 20px">
      <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
        <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
        <el-table-column align="center" label="销售类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="产品编码" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="产品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="单价" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="订单金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="备注" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="税率" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
      </el-table>
    </div>
    
    <div class="page-footer">
      <div class="footer" :class="classObj">
        <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
        <el-button type="primary" @click="clickSubmitForm">提交审核</el-button>
        <el-popconfirm title="确定关闭吗？" @onConfirm="goBack" style="margin-left: 10px;">
          <el-button slot="reference">关 闭</el-button>
        </el-popconfirm>
      </div>
    </div>

  </div>
</template>

<script>
import { getDetail } from "@/api/supply/engin";

export default {
  name: 'EnginForm',
  componentName: 'EnginForm',
  props: ['listItem'],
  data() {
    return {
      detailData: {},
      mainForm: {

      },
    }
  },

  computed: {
    sidebar() {
      return this.$store.state.app.sidebar
    },
    classObj() {
      return {
        hideSidebar: !this.sidebar.opened,
        openSidebar: this.sidebar.opened
      }
    },
  },

  created() {
    this.getDetail();
  },

  methods: {
    // 返回列表
    goBack() {
      this.$emit('backListFormDetail');
    },

    // 获取详情
    getDetail() {
      getDetail({id: this.listItem.id}).then(res => {
        this.detailData = res.data;
      })
    },

    clickSubmitForm() {

    },
  }
}
</script>

<style scoped lang="scss">
  .detail-container {
    width: 100%;
    height: 100%;
  }
  .main-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    height: 60px;
    border-bottom: 1px solid #DCDFE6;
    margin-bottom: 20px;
    .title {
      font-size: 16px;
      font-weight: 600;
      padding-left: 10px;
    }
  }
</style>