<template>
  <a-spin :spinning="confirmLoading">
    <a-button v-print="'#printContent1'" ghost type="primary">打印</a-button>
    <section ref="print" id="printContent1" class="ant-card-body">
    <j-form-container :disabled="formDisabled">
      <!-- 主表单区域 -->
      <a-form :form="form" slot="detail">
        <a-row>
          <a-col :span="8" >
              <span class="ant-inputlabel">&nbsp;&nbsp;&nbsp;&nbsp;散货柜编号:</span>
              <a-input v-model="model.bulkNo" class="ant-input"></a-input>
          </a-col>
          <a-col :span="8" >
              <span class="ant-inputlabel">仓库名称:</span>
              <a-input v-model="model.warehouseName_dictText" class="ant-input"></a-input>
          </a-col>
          <a-col :span="8" >
              <span class="ant-inputlabel">货柜号:</span>
              <a-input v-model="model.containerNo" class="ant-input"></a-input>
          </a-col>
          <a-col :span="8" >
              <span class="ant-inputlabel">&nbsp;&nbsp;&nbsp;&nbsp;装柜日期:</span>
              <a-input v-model="model.loadingDate" class="ant-input"></a-input>
          </a-col>
          <a-col :span="8" >
              <span class="ant-inputlabel">创建日期:</span>
              <a-input v-model="model.createTime" class="ant-input"></a-input>
          </a-col>
        </a-row>
      </a-form>
    </j-form-container>
        <a-row>
          &nbsp;
        </a-row>
      <!-- 子表单区域 -->
      <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>
    </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: 'IostReceivingCopyForm',
    mixins: [JeecgListMixin4Entry],
    components: {
      JFormContainer,
      JDate,
    },
    data() {
      return {
        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 },
        },
        form: this.$form.createForm(this),
        model: {},
        columns: [
          {
            title: '客户名称',
            align:"center",
            dataIndex: 'customerName'
          },
          {
            title: '体积',
            align:"center",
            dataIndex: 'volume'
          },
          {
            title: '重量',
            align:"center",
            dataIndex: 'weight'
          },
          {
            title: '箱数',
            align:"center",
            dataIndex: 'packages',
          },
          {
            title: '金额',
            align:"center",
            dataIndex: 'money'
          },
          {
            title: '入仓号',
            align:"center",
            dataIndex: 'receivingNo',
          },
          {
            title: '送货状态',
            align:"center",
            dataIndex: 'deliverStatus',
          }
        ],
        confirmLoading: false,
        url: {
        //   add: "/basedata/iostReceiving/add",
        //   edit: "/basedata/iostReceiving/edit",
        //   queryById: "/basedata/iostSummarySheet/queryByIdPrint",
          list: '/basedata/iostSummarySheet/queryIostSummarySheetListByMainIdiostListByMainId'
        }
      }
    },
    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,'bulkNo','warehouseName_dictText','containerNo','loadingData'))
        })
        
      },
     popupCallback(row){
       this.form.setFieldsValue(pick(row,'bulkNo','warehouseName_dictText','containerNo','loadingData'))
     },

    }
  }
</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>