107-1.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. v-bind="bindVal"
  5. v-on="onEvent"
  6. v-model="form"
  7. :page.sync="page"
  8. >
  9. <template slot="menuLeft">
  10. <el-button
  11. type="warning"
  12. size="small"
  13. plain
  14. icon="el-icon-download"
  15. @click="handleExport"
  16. >
  17. 导出
  18. </el-button>
  19. </template>
  20. <template slot="body">
  21. <h3 class="page-title">{{ pageTitle }}</h3>
  22. <year-month-select
  23. v-model="params.year"
  24. :showMonth="false"
  25. ></year-month-select>
  26. </template>
  27. </avue-crud>
  28. </basic-container>
  29. </template>
  30. <script>
  31. import { exportBlob } from "@/api/common";
  32. import YearMonthSelect from "@/components/year-month-select";
  33. import moment from "moment";
  34. import { getToken } from "@/util/auth";
  35. import { downloadXls } from "@/util/util";
  36. import { mapGetters } from "vuex"
  37. import { computed } from "vue";
  38. export default window.$crudCommon({
  39. components: {
  40. YearMonthSelect,
  41. },
  42. data() {
  43. return {
  44. params: {
  45. year: "",
  46. },
  47. };
  48. },
  49. watch: {
  50. "params.year"() {
  51. this.page.currentPage = 1;
  52. this.getList(this.page);
  53. },
  54. },
  55. computed: {
  56. ...mapGetters(['tag']),
  57. pageTitle() {
  58. let yearCN = this.params.year ? moment(this.params.year).format('yyyy年') : '';
  59. return `${yearCN}${this.tag.label}`
  60. }
  61. },
  62. methods: {
  63. loadData() {
  64. this.loading = true;
  65. this.api.getList(this.getSearchParams()).then(res => {
  66. this.loading = false;
  67. if (res.data.code == 200) {
  68. this.data = res.data.data.map(item => {
  69. item.xmStageField = item.xmStage;
  70. item.govBonusField = item.govBonus;
  71. return item;
  72. });
  73. }
  74. })
  75. },
  76. getFormData() {
  77. return { yearAndMonth: this.params.year, xmId: this.form.xmId, id: this.form.id, xmStage: this.form.xmStageField, govBonus: this.form.govBonusField };
  78. },
  79. handleExport() {
  80. exportBlob(
  81. `/api/kd-scientific/qyyjkfxmqk/export?${
  82. this.website.tokenHeader
  83. }=${getToken()}`,
  84. this.params
  85. ).then((res) => {
  86. downloadXls(
  87. res.data,
  88. `${this.params.year}企业研究开发项目情况.xlsx`
  89. );
  90. });
  91. },
  92. },
  93. },
  94. {
  95. // 模块路径
  96. name: "externalReports/107-1",
  97. });
  98. </script>