<template>
  <!-- 新增面料 装箱单  -->
  <div id="addFabricDrawer">
    <a-drawer title="新增面料" width="89%" placement="right" :closable="true" :visible="visible" @close="handleCancel">
      <!-- 主表信息 填写-->
      <a-card :bordered="true">
        <div class="table-page-search-wrapper">
          <a-form-model layout="inline" ref="form" :model="addFabric" :rules="validatorRules">
            <a-row :gutter="24">
              <a-col :md="6" :sm="8">
                <a-form-model-item label="单号" prop="oddNum">
                {{ addFabric.documentNo}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="集装箱号" prop="styleNum">
                  {{addFabric.containerNumber}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="装柜日期" prop="loadingDate">
                 {{addFabric.latestDateOfShipment}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="成衣工厂" prop="clothesFactory">
                  {{addFabric.garmentFactory}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="发票号" prop="invoiceNum">
                 {{addFabric.invoiceNo}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="制单人" prop="preparedBy">
                  {{addFabric.preparedBy}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="制单日期" prop="preparedDate">
                 {{addFabric.preparedDate}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="外销发票号" prop="exportInvoiceNo">
                 {{addFabric.exportInvoiceNo}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="托书号" prop="bookNum">
                  {{addFabric.shippingOrderNumber}}
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="备注" prop="note">
                  {{addFabric.remarks}}
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-card>

      <!--操作按钮区域 参照发运明细 増行-->
      <a-card :bordered="true" style="margin:10px 0 60px 0;">
        <!-- 子表   -->
        <a-spin :spinning="confirmLoading">
          <a-form-model ref="formRef" :rules="validatorRules">
            <a-table
              bordered
              :columns="addFabricColumns"
              :data-source="addFabricData"
              :loading="loading"
              pagination="false"
              :scroll="{ x: 1500 }"
              @change="handleTableChange"
            >
           
            </a-table>
          </a-form-model>
        </a-spin>
      </a-card>
      <!-- 页面底部提交取消 -->
      <div
        :style="{
          position: 'absolute',
          right: 0,
          bottom: 0,
          width: '100%',
          borderTop: '1px solid #e9e9e9',
          padding: '10px 16px',
          background: '#fff',
          textAlign: 'right',
          zIndex: 1
        }"
      >
        <a-button type="primary" @click="handleCancel">
          关闭
        </a-button>
      </div>
    </a-drawer>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'

export default {
  name: 'AddFabricDrawer', //  新增 装箱单 -面料
  mixins: [JeecgListMixin],
  computed: {},
  components: { JEllipsis}, // 参照发运明细 弹框
  data() {
    let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
    return {
      // 表头
      addFabricColumns: [
        {
          title: '业务员 Merchandiser',
          dataIndex: 'salesman',
          width: 120,
          fixed: 'left',
          className: 'replacecolor'
        },
        {
          title: '计划单号',
          dataIndex: 'planLotNumber',
          width: 160,
          fixed: 'left',
          className: 'replacecolor'
        },
        {
          title: '款号/Kimball',
          dataIndex: 'itemNumber',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '缸号/Batch no.',
          dataIndex: 'dyelotNumber',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '颜色/Color',
          dataIndex: 'colour',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '项目/Item(存货编码)',
          dataIndex: 'inventoryCode',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '存货名称(辅料名称)',
          dataIndex: 'inventoryName',
          width: 160,
          className: 'replacecolor'
        },

        {
          title: '报关品名',
          dataIndex: 'declarationName',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '成分/Composition',
          dataIndex: 'composition',
          width: 150,
          className: 'replacecolor'
        },

        {
          title: '门幅/Width',
          dataIndex: 'width',
          width: 140,
          className: 'replacecolor'
        },
        {
          title: '匹数/Rolls',
          dataIndex: 'rolls',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '毛重/GW/kg',
          dataIndex: 'grossWeight',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '净重/NW/kg',
          dataIndex: 'netWeight',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '染后重',
          dataIndex: 'afterHeavy',
          width: 90,
          className: 'replacecolor'
        },
        {
          title: '拷布重',
          dataIndex: 'kaoClothWeight',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '米数/Length/m',
          dataIndex: 'meter',
          width: 130,
          className: 'replacecolor'
        },
        {
          title: '价格',
          dataIndex: 'price',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '克重/G',
          dataIndex: 'gramWeight',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '供应商编码(染厂)',
          dataIndex: 'supplierCodeDyeingPlant',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '供应商(染厂)',
          dataIndex: 'supplierDyeingPlant',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '供应商编码(印厂)',
          dataIndex: 'supplierCodePrintingPlant',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '供应商(印厂)',
          dataIndex: 'supplierPrintingPlant',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '包装方式',
          dataIndex: 'mannerOfPacking ',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '处理方式',
          dataIndex: 'treatmentMethod',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '是否手册纱',
          dataIndex: 'manualYarnFlag',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '手册纱单价',
          dataIndex: 'manualYarnUnitPrice',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '手册纱占比%',
          dataIndex: 'manualYarnProportion',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '柜号',
          dataIndex: 'containerNumber',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '备注',
          dataIndex: 'memo',
          width: 160,
          customRender: t => ellipsis(t),
          className: 'replacecolor'
        },
        {
          title: '入库数量',
          dataIndex: 'inventoryQuantity',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '规格型号',
          dataIndex: 'specificationAndModel',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '实际报关数量',
          dataIndex: 'actualDeclaredQuantity',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '超发',
          dataIndex: 'excessQuantity',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '单位',
          dataIndex: 'masterMetering',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '备注(U8)',
          dataIndex: 'remarks2',
          width: 160,
          fixed: 'right',
          customRender: t => ellipsis(t),
          className: 'replacecolor'
        },
      ],
      addFabricData: [],
      loading: false, // 表格加载
      addFabric: {},
      visible: false,
      confirmLoading: false,
      validatorRules: { },
      dateFormat: 'YYYY-MM-DD'
    }
  },
  created() {},
  mounted() {},
  methods: {
    // 抽屉 取消
    handleCancel() {
      console.log('点击抽屉取消')
      this.close()
    },
 

    // -------------------------------------
    close() {
      this.$emit('close')
      this.visible = false
      this.addFabric = {}
      this.addFabricData = []
    },

     // 分页、排序、筛选变化时触发
    // handleTableChange(pagination, filters, sorter) {
    //   // console.log('当前页信息>>>>',pagination)
    //   this.queryParam.pageNo = pagination.current
    //   this.getAnnList()
    // }
  }
}
</script>

<style lang="less" scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/overwriter.less';
/deep/ .ant-table-thead > tr > th {
  text-align: center;
  // font-weight: 700;
}

/deep/ .ant-table-tbody {
  text-align: center;
}

// /deep/ th.replacecolor {
//   background-color: #ccc;
// }

// 抽屉里的card样式
/deep/ .ant-drawer-content {
  background-color: #f0f2f5;
}
/deep/ .ant-drawer-body {
  padding: 10px;
}
</style>
