<template>
  <div>
    <div style="width: 100%; display: flex; align-items: center; justify-content: space-between;">
      <div class="left" style="display: flex;">
        <div style="margin-right: 50px;">研发项目编号：{{ data[0].xmbh }}</div>
        <div>项目项目名称：{{ data[0].xmmc }}</div>
      </div>
      <div class="right">
        <el-button
          type="warning"
          size="small"
          plain
          icon="el-icon-download"
          @click="handleExport"
          style="margin-right: 10px;"
        >
          导出
        </el-button>
      </div>
    </div>
    <avue-crud class="common-crud" :option="options" :data="data">
    </avue-crud>
  </div>
</template>

<script>
import {exportBlob} from "@/api/common";
import {getToken} from "@/util/auth";
import {downloadXls} from "@/util/util";

export default {
  props: {
    data: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      options: {
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        addBtn: false,
        searchLabelWidth: 140,
        labelWidth: 100,
        menuWidth: 180,
        menu: false,
        dialogClickModal: false,
        refreshBtn: false,
        columnBtn: false,
        gridBtn: false,
        dialogWidth: 500,
        dialogType: "drawer",
        showSummary: true,
        sumColumnList: [
          {
            label:'合计',
            name: 'ryrg',
            type: 'sum',
          },
          {
            name: 'zjtr',
            type: 'sum',
          },
          {
            name: 'zjfyycqdtfy',
            type: 'sum'
          },
          {
            name: 'sjf',
            type: 'sum'
          },
          {
            name: 'wxzctx',
            type: 'sum'
          },
          {
            name: 'zbtsfyysyfy',
            type: 'sum'
          },
          {
            name: 'qtfy',
            type: 'sum'
          },
          {
            name: 'wwyf',
            type: 'sum'
          },
          {
            name: 'amount',
            type: 'sum'
          }
        ],
        column: [
          {
            label: '凭证日期',
            prop: 'recordDate',
            span: 24,
            width: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '凭证字号',
            prop: 'voucherNumber',
            span: 24,
            width: 120,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '摘要',
            prop: 'digest',
            span: 24,
            width: 160,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '1、人员人工',
            prop: 'ryrg',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '2、直接投入',
            prop: 'zjtr',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '3、折旧费用与长期摊销费用',
            prop: 'zjfyycqdtfy',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '4、设计费',
            prop: 'sjf',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '5、无形资产摊销',
            prop: 'wxzctx',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '6、装备调试费用与试验费用',
            prop: 'zbtsfyysyfy',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '7、其他费用',
            prop: 'qtfy',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '8、委外研发',
            prop: 'wwyf',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '合计',
            prop: 'amount',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
          {
            label: '账簿名称',
            prop: 'cashbook',
            span: 24,
            minWidth: 90,
            align: 'center',
            showOverflowTooltip: true,
          },
        ],
      },
    };
  },
  methods: {
    handleExport() {
      this.$message.error("暂未开发");
      // exportBlob(`/api/kd-scientific/goods/yanfalingliaodan/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
      //   downloadXls(res.data, `${this.params.yearAndMonth}${title}.xlsx`);
      // });
    },
  }
};
</script>

<style lang="scss">
.common-crud {
  .avue-crud__header {
    min-height: 0;
  }
}
</style>
