wxzctx-cost.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div>
  3. <avue-crud
  4. ref="crud"
  5. v-bind="bindVal"
  6. v-on="onEvent"
  7. v-model="form"
  8. :page.sync="page"
  9. :before-open="handleBeforeOpen"
  10. :permission="permissionList"
  11. >
  12. <template slot="menuLeft">
  13. <el-button
  14. v-if="!isSelAnnual"
  15. type="danger"
  16. size="small"
  17. icon="el-icon-delete"
  18. plain
  19. @click="handleDelete"
  20. >
  21. 删 除
  22. </el-button>
  23. <el-button
  24. v-if="!isSelAnnual"
  25. type="success"
  26. size="small"
  27. plain
  28. icon="el-icon-upload2"
  29. @click="handleImport"
  30. >
  31. 导入
  32. </el-button>
  33. <el-button
  34. type="warning"
  35. size="small"
  36. plain
  37. icon="el-icon-download"
  38. @click="handleExport"
  39. >
  40. 导出
  41. </el-button>
  42. <print-table-btn @click="printTable" />
  43. </template>
  44. </avue-crud>
  45. <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
  46. <WideTablePrinter
  47. ref="printWideTable"
  48. :columns="wideTableColumns"
  49. :data="data"
  50. :print-title="printTitle"
  51. :rows-per-page="30"
  52. :default-landscape="true"
  53. />
  54. </div>
  55. </template>
  56. <script>
  57. import {exportBloByPost} from "@/api/common";
  58. import UploadExcelDialog from "@/components/upload-excel-dialog";
  59. import {getToken} from "@/util/auth";
  60. import {downloadXls} from "@/util/util";
  61. export default window.$crudCommon({
  62. components: {
  63. UploadExcelDialog,
  64. },
  65. data() {
  66. return {
  67. wideTableColumns: [],
  68. printTitle: "",
  69. };
  70. },
  71. created() {
  72. this.option.height = window.innerHeight - 270;
  73. let newOption = { ...this.option };
  74. // 姓名下拉框,设置监听事件
  75. newOption.column.forEach(item => {
  76. if (item.prop == "zcmc") {
  77. item.change = ({ item }) => {
  78. if (!!item) {
  79. this.form = {
  80. ...this.form,
  81. ytxe: item.zcyz,
  82. };
  83. }
  84. }
  85. }
  86. });
  87. this.option = { ...newOption };
  88. },
  89. methods: {
  90. handleBeforeOpen(done) {
  91. this.option.column.forEach(item => {
  92. if (item.prop == "zcmc") {
  93. item.dicUrl = '/api/kd-scientific/zc/page';
  94. item.dicQuery.yearAndMonth = '202507';
  95. }
  96. });
  97. done();
  98. },
  99. handleImport() {
  100. this.$refs.uploadExcelDialog.open('/api/kd-scientific/ys-wxzctxfy/import');
  101. },
  102. uploadAfter() {
  103. this.page.currentPage = 1;
  104. this.getList(this.page);
  105. },
  106. handleExport() {
  107. exportBloByPost(`/api/kd-scientific/ys-wxzctxfy/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
  108. downloadXls(res.data, `无形资产摊销费用.xlsx`);
  109. });
  110. },
  111. /**
  112. * 打印表格
  113. * @param isLandscape 是否横向打印
  114. */
  115. printTable(isLandscape) {
  116. this.wideTableColumns = this.$refs.crud.columnOption;
  117. this.printTitle = `无形资产摊销费用`;
  118. this.$nextTick(() => {
  119. this.$refs.printWideTable.printTable(isLandscape);
  120. })
  121. },
  122. },
  123. }, {
  124. // 模块路径
  125. name: 'projectManage/wxzctxCost',
  126. res: ({ data }) => {
  127. return data;
  128. },
  129. });
  130. </script>