yf-cost-share-list.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. :before-open="handleBeforeOpen"
  9. :permission="permissionList"
  10. >
  11. <template slot="menuLeft">
  12. <el-button
  13. type="warning"
  14. size="small"
  15. plain
  16. icon="el-icon-download"
  17. @click="handleExport"
  18. >
  19. 导出
  20. </el-button>
  21. <print-table-btn @click="printTable" />
  22. <div style="display: flex; align-items: center">
  23. <year-month-select
  24. v-model="params.yearAndMonth"
  25. :showAllYear="false"
  26. ></year-month-select>
  27. </div>
  28. </template>
  29. <!-- 资产原值 -->
  30. <template slot="zcyzSearch">
  31. <div style="display: flex; align-items: center">
  32. <avue-input-number
  33. v-model="params.zcyzStart"
  34. :min="0"
  35. ></avue-input-number>
  36. <span style="width: 70px; text-align: center">至</span>
  37. <avue-input-number
  38. v-model="params.zcycEnd"
  39. :min="0"
  40. ></avue-input-number>
  41. </div>
  42. </template>
  43. <!-- 净残值 -->
  44. <template slot="jczSearch">
  45. <div style="display: flex; align-items: center">
  46. <avue-input-number
  47. v-model="params.jczStart"
  48. :min="0"
  49. ></avue-input-number>
  50. <span style="width: 70px; text-align: center">至</span>
  51. <avue-input-number
  52. v-model="params.jczEnd"
  53. :min="0"
  54. ></avue-input-number>
  55. </div>
  56. </template>
  57. <!-- 折旧额 -->
  58. <template slot="zjeSearch">
  59. <div style="display: flex; align-items: center">
  60. <avue-input-number
  61. v-model="params.zjeStart"
  62. :min="0"
  63. ></avue-input-number>
  64. <span style="width: 70px; text-align: center">至</span>
  65. <avue-input-number
  66. v-model="params.zjeEnd"
  67. :min="0"
  68. ></avue-input-number>
  69. </div>
  70. </template>
  71. </avue-crud>
  72. <WideTablePrinter
  73. ref="printWideTable"
  74. :columns="wideTableColumns"
  75. :data="data"
  76. :print-title="printTitle"
  77. :rows-per-page="30"
  78. :default-landscape="true"
  79. />
  80. </basic-container>
  81. </template>
  82. <script>
  83. import { exportBloByPost } from "@/api/common";
  84. import YearMonthSelect from "@/components/year-month-select";
  85. import moment from "moment";
  86. import { getToken } from "@/util/auth";
  87. import { downloadXls } from "@/util/util";
  88. export default window.$crudCommon(
  89. {
  90. components: {
  91. YearMonthSelect,
  92. },
  93. data() {
  94. return {
  95. params: {
  96. yearAndMonth: moment(new Date()).format("YYYYMM"),
  97. },
  98. wideTableColumns: [],
  99. printTitle: "",
  100. };
  101. },
  102. watch: {
  103. "params.yearAndMonth"(newVal) {
  104. if (newVal.length > 4) {
  105. this.page.currentPage = 1;
  106. this.getList(this.page);
  107. }
  108. },
  109. },
  110. methods: {
  111. handleExport() {
  112. exportBloByPost(
  113. `/api/kd-scientific/technician/export?${
  114. this.website.tokenHeader
  115. }=${getToken()}`,
  116. this.params
  117. ).then((res) => {
  118. downloadXls(
  119. res.data,
  120. `研发资产费用分摊表${this.params.yearAndMonth}.xlsx`
  121. );
  122. });
  123. },
  124. /**
  125. * 打印表格
  126. * @param isLandscape 是否横向打印
  127. */
  128. printTable(isLandscape) {
  129. this.wideTableColumns = this.$refs.crud.columnOption;
  130. this.printTitle = `研发资产费用分摊表${this.params.yearAndMonth}`;
  131. this.$nextTick(() => {
  132. this.$refs.printWideTable.printTable(isLandscape);
  133. });
  134. },
  135. },
  136. },
  137. {
  138. // 模块路径
  139. name: "deviceManage/yfCostShareList",
  140. res: ({ data }) => {
  141. return data;
  142. },
  143. }
  144. );
  145. </script>