<template>
  <!-- 详情 -->
  <div id="detailsDeclareDrawer">
    <a-drawer
      title="编辑"
      width="89%"
      placement="right"
      :closable="true"
      :visible="visible"
      @close="handleCancel">
      <!-- 主表信息  回显 -->
      <a-card :bordered="false">
        <div class="table-page-search-wrapper">
          <a-form-model layout="inline" ref="form" :model="detailsDeclareDrawer">
            <a-row :gutter="24">
              <a-col :md="6" :sm="8">
                <a-form-model-item label="商品税号" prop="proTaxNum">
                  AW837465506
                  <!-- <a-input v-model="detailsDeclareDrawer.proTaxNum"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="商品名称" prop="proName">
                  商品名称test
                  <!-- <a-input v-model="detailsDeclareDrawer.proName"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="订单号" prop="orderNum">
                  RT8374645
                  <!-- <a-input v-model="detailsDeclareDrawer.orderNum"></a-input> -->
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-card>

      <!-- 子表-->
      <a-card :bordered="false" style="margin:10px 0 60px 0;">
        <a-spin :spinning="confirmLoading">
          <a-form-model ref="formRef">
            <a-table
              bordered
              rowKey="id"
              :columns="declareColumns"
              :data-source="declareData"
              :loading="loading"
              :pagination="false"
              @change="handleTableChange"
            >
            </a-table>
          </a-form-model>
        </a-spin>
      </a-card>
    </a-drawer>

    <!-- 选择托书 弹框 -->
    <selectBook-modal ref="selectBookModal" :father="aa" @ok="modalFormOk"></selectBook-modal>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import SelectBookModal from '@views/declare-elements/selectBookModal.vue'

export default {
  name: 'EditDeclareDrawer', // 编辑 申报要素
  mixins: [JeecgListMixin],
  components: { SelectBookModal, JEllipsis }, // 选择托书
  data() {
    // let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />

    return {
      // 表头
      declareColumns: [
        {
          title: '序号',
          width: 90,
          dataIndex: 'index',
          customRender: (text, record, index) => `${index + 1}`,
          className: 'replacecolor'
        },
        {
          title: '申报要素内容',
          dataIndex: 'decEleContent',
          width: 90,
          className: 'replacecolor'
        },
        {
          title: '描述',
          dataIndex: 'desc',
          width: 160,
          className: 'replacecolor'
        }
      ],

      declareData: [
        { decEleContent: '品名', desc: '化纤制针织毛圈布' },
        { decEleContent: '织造方法', desc: '针织/钩编' },
        {}
      ],
      loading: false, // 表格加载
      visible: false,
      detailsDeclareDrawer: {},
      confirmLoading: false
    }
  },
  created() {},
  methods: {
    // 抽屉 取消
    handleCancel() {
      console.log('点击抽屉取消')
      this.close()
    },

    // -------------------------------------
    close() {
      this.$emit('close')
      this.visible = false
      this.$refs.form.resetFields()
    },
    aa() {},
    modalFormOk() {}
  },
  computed: {},
  mounted() {}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.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>
