soft-works.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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="danger"
  12. size="small"
  13. icon="el-icon-delete"
  14. plain
  15. @click="handleDelete"
  16. >
  17. 删 除
  18. </el-button>
  19. <el-button
  20. type="success"
  21. size="small"
  22. plain
  23. icon="el-icon-upload2"
  24. @click="handleImport"
  25. >
  26. 导入
  27. </el-button>
  28. <el-button
  29. type="warning"
  30. size="small"
  31. plain
  32. icon="el-icon-download"
  33. @click="handleExport"
  34. >
  35. 导出
  36. </el-button>
  37. <el-button
  38. size="small"
  39. type="primary"
  40. icon="el-icon-printer"
  41. @click="printTable"
  42. >
  43. 打印
  44. </el-button>
  45. </template>
  46. <template slot="menuLeft">
  47. </template>
  48. </avue-crud>
  49. <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
  50. <WideTablePrinter
  51. ref="printWideTable"
  52. :columns="wideTableColumns"
  53. :data="data"
  54. :print-title="printTitle"
  55. :rows-per-page="30"
  56. :default-landscape="true"
  57. />
  58. </basic-container>
  59. </template>
  60. <script>
  61. import {exportBlob} from "@/api/common";
  62. import UploadExcelDialog from "@/components/upload-excel-dialog";
  63. import NProgress from 'nprogress';
  64. import 'nprogress/nprogress.css';
  65. import {getToken} from "@/util/auth";
  66. import {downloadXls} from "@/util/util";
  67. export default window.$crudCommon({
  68. components: {
  69. UploadExcelDialog,
  70. },
  71. data() {
  72. return {
  73. params: {},
  74. wideTableColumns: [],
  75. printTitle: "",
  76. };
  77. },
  78. methods: {
  79. handleImport() {
  80. // let excelParams = { yearAndMonth: this.params.yearAndMonth };
  81. this.$refs.uploadExcelDialog.open('/api/kd-scientific/kycg/rjzzq/import', {});
  82. },
  83. uploadAfter() {
  84. this.$message({
  85. type: "success",
  86. message: "导入成功!"
  87. });
  88. this.page.currentPage = 1;
  89. this.getList(this.page);
  90. },
  91. handleExport() {
  92. this.$confirm("是否导出吗?", "提示", {
  93. confirmButtonText: "确定",
  94. cancelButtonText: "取消",
  95. type: "warning"
  96. }).then(() => {
  97. NProgress.start();
  98. exportBlob(`/api/kd-scientific/kycg/rjzzq/export?${this.website.tokenHeader}=${getToken()}`, {}).then(res => {
  99. downloadXls(res.data, `软件著作.xlsx`);
  100. NProgress.done();
  101. })
  102. });
  103. },
  104. printTable() {
  105. this.wideTableColumns = this.$refs.crud.columnOption;
  106. this.printTitle = `科研成果`;
  107. this.$nextTick(() => {
  108. this.$refs.printWideTable.printTable(false);
  109. })
  110. },
  111. },
  112. }, {
  113. // 模块路径
  114. name: 'achievement/softWorks'
  115. });
  116. </script>