<template>
  <a-modal
    title="事故单"
    v-model="accidentListModVis"
    :confirmLoading="confirmLoading"
    width="86%"
    style="top:330px;left:100px;minHeight:700px"
    :footer="null"
  >
    <!-- tabel 加载 -->
    <a-spin :spinning="confirmLoading">
      <!-- 回显信息  -->
      <div class="table-page-search-wrapper" style="marginTop:20px;">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="8">
              <a-form-item label="单号">
                <a-input v-model="accidentList.accidentNumber"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-item label="责任人">
                <a-input v-model="accidentList.responsibilityPerson1"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="日期">
                <a-input v-model="accidentList.accidentData"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="工厂">
                <a-input v-model="accidentList.accidentUndertaker"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-item label="客户">
                <a-input v-model="accidentList.customer"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="款号">
                <a-input v-model="accidentList.styleNumber"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="计划单号">
                <a-input v-model="accidentList.planNumber"> </a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="计划员">
                <a-input v-model="accidentList.planPersonnel"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-item label="业务员">
                <a-input v-model="accidentList.businessPeople"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-item label="承担方订单号">
                <a-input v-model="accidentList.garmentSalesOrder"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-item label="物料">
                <a-input v-model="accidentList.material"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-item label="QC">
                <a-input v-model="accidentList.qualityControl"></a-input>
              </a-form-item>
            </a-col>

            <a-col :md="24" :sm="24">
              <a-form-item label="备注" class="noteBg">
                <a-input type="textarea" v-model="accidentList.financeRemark" style="minHeight:100px;"></a-input>

                <!-- 导出 打印 返回  -->
                <a-row style="marginTop:20px;">
                  <a-col :md="24" :sm="12">
                    <span style="float: right;" class="table-operator">
                      <a-button type="primary" icon="download" @click="handleExportXls('采购数量')">导出</a-button>
                      <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button>
                      <a-button type="primary" @click="backFabricLossTable" icon="rollback">返回</a-button>
                    </span>
                  </a-col>
                </a-row>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-spin>
  </a-modal>
</template>

<script>
export default {
  name: 'AccidentListModal', // 事故单 弹框
  components: {},
  data() {
    return {
      loading: false,
      confirmLoading: false,
      accidentListModVis: false,
      accidentList: []
    }
  },
  // 接收父组件 方法
  props: {
    father: {
      type: Function,
      default: null
    }
  },
  created() {},
  methods: {
    //  导出
    handleExportXls(fileName) {
      console.log('需导出的fileName:', fileName)
      const params = this.dyeLossRateData
      console.log('导出参数', params)
      // downFile('/scas/dyeLoss/excel', params).then(data => {
      //   console.log('888')
      //   if (!data) {
      //     this.$message.warning('文件下载失败')
      //     return
      //   }
      //   if (typeof window.navigator.msSaveBlob !== 'undefined') {
      //     window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
      //   } else {
      //     let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
      //     let link = document.createElement('a')
      //     link.style.display = 'none'
      //     link.href = url
      //     link.setAttribute('download', fileName + '.xls')
      //     document.body.appendChild(link)
      //     link.click()
      //     document.body.removeChild(link) // 下载完成移除元素
      //     window.URL.revokeObjectURL(url) // 释放掉blob对象
      //   }
      // })
    },
    // 打印
    print() {},
    // 返回
    backFabricLossTable() {
      console.log('返回到面料损耗表')
      this.accidentListModVis = false
    }
  }
}
</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;
// }
</style>
