<template>
    <!-- 往来单位 新增、编辑 表单组件 -->
    <div>
      <TableModel
        :formLabel="formLabel"
        :columnsList="columnsList"
        ref="tableRef"
        style="display: flex; flex-direction: column"
        :send-params="transObj"
        :request-api="queryPurchaseArrivalListInnerApi"
        :show-operation="false"
        :show-sel="false"
      >
        <template slot="btn" slot-scope="{ queryParams }">
          <el-button type="success"
          >确认</el-button>
          <el-button type="danger"
          >驳回</el-button>
        </template>
      </TableModel>
    </div>
</template>

<script>
import { columnsList } from '../config-table-confirm'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {
  queryPurchaseArrivalListInnerApi
} from '@/api/purchase/arrival'
export default {
    name: 'TableConfirm',
    props: {
        editParams: {
            type: Object,
            default: () => null,
        },
        sendParams: {
          type: Object,
          default: () => null,
        },
        sendRange: {
          type: Array,
          default: () => null
        },
        sendCascader: {
          type: Array,
          default: () => null
        }
    },
    components: { Treeselect },
    created() {
      console.log(this.sendParams)
      this.transObj = { ['id']: this.sendParams['id'] }
    },
    mounted() {
        if (this.editParams) {
            Object.assign(this.storageConfigParams, this.editParams)
            this.subSort = 2
        } else {
            this.subSort = 1
        }
    },
    data() {
        return {
            formLabel: [
              { f_label: '类型规格', f_model: 'typeId', f_type: 'selCas', f_selList: this.sendCascader },
              { f_label: '机具厂家', f_model: 'supplierId', f_type: 'sel', f_selList: this.sendRange },
              { f_label: '出厂日期', f_model: 'productDate', f_type: 'date' },
            ],
            columnsList,
            subSort: '', // 提交类型：新增 1 / 修改 2
            storageConfigParams: {
                houseId: undefined, // 仓库名称
                typeId: undefined, // 物资名称
            },
            transObj: {}
        }
    },
    methods: {
      queryPurchaseArrivalListInnerApi
    },
}
</script>

<style scoped>
::v-deep .el-select {
    width: 100%;
}
::v-deep .el-form-item__label{
  font-weight: normal;
}
</style>
