<template>
  <a-spin :spinning="confirmLoading">
    <a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
    <section ref="print" id="printContent" class="ant-card-body">
    <j-form-container :disabled="formDisabled">
      <!-- 主表单区域 -->
      <a-form :form="form" slot="detail">
      <a-row>
          <a-col :span="12" >
            <a-row>
                  <span style="font-size:24px;font-style:italic;font-weight:bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LINKEDNET</span>
            </a-row>
            <a-row>
                  <span style="font-size:24px;font-style:italic;font-weight:bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FREIGHT</span>
            </a-row>
          </a-col>
          <a-col :span="12" >
            <a-row>
              1404 BEDFORD OFFICE TOWER, BEDFORD CENTER, 12
            </a-row>
            <a-row>
              &nbsp;&nbsp;&nbsp;&nbsp;SMITH ROAD,BEDFORD GARDEN,JOHANNESBURG
            </a-row>
            <a-row>
              &nbsp;
            </a-row>
            <a-row>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              Tel no: 011-6151570 011-0297650 
            </a-row>
          </a-col>
      </a-row>
      <hr />
            <a-row style="font-size:24px;font-weight:bold;text-align:center;">
              Delivery Note
            </a-row>
            <a-row>
              &nbsp;
            </a-row>
        <a-row>
          <a-col :span="12" >
              <span class="ant-inputlabel">Contact Name:</span>
              <a-input v-model="model.contactName" class="ant-input"></a-input>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date:</span>
              <a-input v-model="model.createTime" class="ant-input"></a-input>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;phone No.:</span>
              <a-input v-model="model.phoneNo" class="ant-input"></a-input>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">Reference:</span>
              <a-input v-model="model.reference" class="ant-input"></a-input>
          </a-col>
          <a-col :span="24" >
              <span class="ant-inputlabel">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company:</span>
              <a-input v-model="model.company" class="ant-input"></a-input>
          </a-col>
          <a-col :span="24">
              <span class="ant-inputlabel">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Address:</span>
              <a-input v-model="model.address" class="ant-input"></a-input>
          </a-col>
        </a-row>
            <a-row>
              &nbsp;
            </a-row>
      </a-form>
    </j-form-container>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="false"
        :loading="loading">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
      </a-table>
      
        <a-row>
          &nbsp;
        </a-row>
        <a-row>
          &nbsp;
        </a-row>
        <a-row>
          <a-col :span="12" >
              <span class="ant-inputlabel">Deliver Print Name:</span>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">Receiver Print Name:</span>
          </a-col>
        </a-row>
        <a-row>
          &nbsp;
        </a-row>
        <a-row>
          <a-col :span="12" >
              <span class="ant-inputlabel">Signature:</span>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">Signature:</span>
          </a-col>
        </a-row>
        <a-row>
          &nbsp;
        </a-row>
        <a-row>
          <a-col :span="12" >
              <span class="ant-inputlabel">Phone No.</span>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">Phone No.</span>
          </a-col>
        </a-row>
        <a-row>
          &nbsp;
        </a-row>
        <a-row>
          <a-col :span="12" >
              <span class="ant-inputlabel">Date:</span>
          </a-col>
          <a-col :span="12" >
              <span class="ant-inputlabel">Date:</span>
          </a-col>
        </a-row>
        <a-row>
          &nbsp;
        </a-row>
    </section>
  </a-spin>
</template>

<script>

  import pick from 'lodash.pick'
  import { getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  import JFormContainer from '@/components/jeecg/JFormContainer'
  import JDate from '@/components/jeecg/JDate'  
  import { JeecgListMixin4Entry } from '@/mixins/JeecgListMixin4Entry'
  import '@/assets/less/TableExpand.less'

  export default {
    name: 'IostDeliveryNotePForm',
    mixins:[JeecgListMixin4Entry],
    components: {
      JFormContainer,
      JDate,
    },
    data() {
      return {
        columns: [
          {
            title:'Description',
            align:"center",
            dataIndex: 'description'
          },
          {
            title:'CTNS',
            align:"center",
            dataIndex: 'ctns'
          },
          {
            title:'Length(kg)',
            align:"center",
            dataIndex: 'length'
          },
          {
            title:'Width(kg)',
            align:"center",
            dataIndex: 'width'
          },
          {
            title:'Height(kg)',
            align:"center",
            dataIndex: 'height'
          },
          {
            title:'CBM',
            align:"center",
            dataIndex: 'cbm'
          },
          {
            title:'Weight(kg)',
            align:"center",
            dataIndex: 'weight',
            statistics: "true",
          },
          {
            title:'MARK',
            align:"center",
            dataIndex: 'mark'
          },
        ],
        form: this.$form.createForm(this),
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        labelCol2: {
          xs: { span: 24 },
          sm: { span: 3 },
        },
        wrapperCol2: {
          xs: { span: 24 },
          sm: { span: 20 },
        },
        confirmLoading: false,
        url: {
          add: "/basedata/iostDeliveryNote/add",
          edit: "/basedata/iostDeliveryNote/edit",
          queryById: "/basedata/iostDeliveryNote/queryById",
          list: '/basedata/iostDeliveryNote/queryIostDeliveryNoteListByMainIdWithSum'
        }
      }
    },
    props: {
      //流程表单data
      formData: {
        type: Object,
        default: ()=>{},
        required: false
      },
      //表单模式：false流程表单 true普通表单
      formBpm: {
        type: Boolean,
        default: false,
        required: false
      },
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled(){
        if(this.formBpm===true){
          if(this.formData.disabled===false){
            return false
          }
          return true
        }
        return this.disabled
      },
      showFlowSubmitButton(){
        if(this.formBpm===true){
          if(this.formData.disabled===false){
            return true
          }
        }
        return false
      }
    },
    created () {
    },
    methods: {
      edit (record) {
        let params = { id: record.id }
        this.queryParam = params;
        this.willLoadData = true;
        this.loadData(1);

        this.form.resetFields();
        this.model = Object.assign({}, record);
        this.visible = true;
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'contactName','createTime','phoneNo','reference','company','address'))
        })
        
      },
     popupCallback(row){
       this.form.setFieldsValue(pick(row,'contactName','createTime','phoneNo','reference','company','address'))
     },

    }
  }
</script>

<style scoped>
  /*update_begin author:scott date:20191203 for:打印机打印的字体模糊问题 */
  * {
    color: #000000!important;
    -webkit-tap-highlight-color: #000000!important;
  }
  /*update_end author:scott date:20191203 for:打印机打印的字体模糊问题 */

  .ant-card-body{
    margin-left: 0%;
    margin-right: 0%;
    margin-bottom: 1%;
    border:0px solid black;
    min-width: 800px;
    color:#000000!important;
  }
  .ant-input{
    border-left-width:0px!important;
    border-top-width:0px!important;
    border-right-width:0px!important;
    text-align: left;
    margin-left: 10px;
    width: 70%;
  }
  .ant-inputlabel{
    text-align: right;
  }
</style>