dev-depre-allocation.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. <print-table-btn @click="printTable" />
  20. <div style="display: flex; align-items: center;">
  21. <year-month-select v-model="params.yearAndMonth" :showAllYear="false"></year-month-select>
  22. </div>
  23. </template>
  24. <template slot="jczSearch">
  25. <div style="display: flex; align-items: center;">
  26. <span>净残值率:</span>
  27. <avue-input-number v-model="extraParams.jczMin" :min="0" style="width: 100px !important;"></avue-input-number>
  28. <span style="width: 20px; text-align: center;">至</span>
  29. <avue-input-number v-model="extraParams.jczMax" :min="0" style="width: 100px !important;"></avue-input-number>
  30. </div>
  31. </template>
  32. <template slot="zcyzSearch">
  33. <div style="display: flex; align-items: center;">
  34. <span>资产原值:</span>
  35. <avue-input-number v-model="extraParams.zcyzMin" :min="0" style="width: 100px !important;"></avue-input-number>
  36. <span style="width: 20px; text-align: center;">至</span>
  37. <avue-input-number v-model="extraParams.zcyzMax" :min="0" style="width: 100px !important;"></avue-input-number>
  38. </div>
  39. </template>
  40. <template slot="yzjeSearch">
  41. <div style="display: flex; align-items: center;">
  42. <span>月折旧额:</span>
  43. <avue-input-number v-model="extraParams.yzjeMin" :min="0" style="width: 100px !important;"></avue-input-number>
  44. <span style="width: 20px; text-align: center;">至</span>
  45. <avue-input-number v-model="extraParams.yzjeMax" :min="0" style="width: 100px !important;"></avue-input-number>
  46. </div>
  47. </template>
  48. <template slot="attendanceHoursSearch">
  49. <div style="display: flex; align-items: center;">
  50. <span>月使用工时:</span>
  51. <avue-input-number v-model="extraParams.attendanceHoursMin" :min="0" style="width: 100px !important;"></avue-input-number>
  52. <span style="width: 20px; text-align: center;">至</span>
  53. <avue-input-number v-model="extraParams.attendanceHoursMax" :min="0" style="width: 100px !important;"></avue-input-number>
  54. </div>
  55. </template>
  56. <template slot="workHoursSearch">
  57. <div style="display: flex; align-items: center;">
  58. <span>已研发工时:</span>
  59. <avue-input-number v-model="extraParams.workHoursMin" :min="0" style="width: 100px !important;"></avue-input-number>
  60. <span style="width: 20px; text-align: center;">至</span>
  61. <avue-input-number v-model="extraParams.workHoursMax" :min="0" style="width: 100px !important;"></avue-input-number>
  62. </div>
  63. </template>
  64. </avue-crud>
  65. <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
  66. <WideTablePrinter
  67. ref="printWideTable"
  68. :columns="wideTableColumns"
  69. :data="data"
  70. :print-title="printTitle"
  71. :rows-per-page="30"
  72. :default-landscape="true"
  73. />
  74. </basic-container>
  75. </template>
  76. <script>
  77. import YearMonthSelect from "@/components/year-month-select";
  78. import {exportBlob} from "@/api/common";
  79. import {getToken} from "@/util/auth";
  80. import {downloadXls} from "@/util/util";
  81. import moment from "moment";
  82. import Decimal from "decimal.js";
  83. export default window.$crudCommon({
  84. components: {
  85. YearMonthSelect,
  86. },
  87. data() {
  88. return {
  89. params: {
  90. yearAndMonth: "",
  91. },
  92. defaultColumns: [],
  93. wideTableColumns: [],
  94. printTitle: "",
  95. };
  96. },
  97. watch: {
  98. 'params.yearAndMonth'(newVal) {
  99. this.page.currentPage = 1;
  100. this.getList(this.page);
  101. }
  102. },
  103. methods: {
  104. getSearchParams() {
  105. let newParams = { ...this.params, ...this.extraParams };
  106. if (newParams.jczMin !== null && newParams.jczMin !== undefined && newParams.jczMin !== '') {
  107. newParams.jczMin = new Decimal(newParams.jczMin).div(new Decimal(100)).toNumber();
  108. }
  109. if (newParams.jczMax !== null && newParams.jczMax !== undefined && newParams.jczMax !== '') {
  110. newParams.jczMax = new Decimal(newParams.jczMax).div(new Decimal(100)).toNumber();
  111. }
  112. return newParams;
  113. },
  114. handleExport() {
  115. exportBlob(`/api/kd-scientific/asset/kyyqsbzjfyfpb?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
  116. downloadXls(res.data, `${this.params.yearAndMonth}科研仪器设备折旧费用分配表.xlsx`);
  117. });
  118. },
  119. /**
  120. * 打印表格
  121. * @param isLandscape 是否横向打印
  122. */
  123. printTable(isLandscape) {
  124. this.wideTableColumns = this.$refs.crud.columnOption;
  125. this.printTitle = `${this.params.yearAndMonth}科研仪器设备折旧费用分配表`;
  126. this.$nextTick(() => {
  127. this.$refs.printWideTable.printTable(isLandscape);
  128. })
  129. },
  130. },
  131. }, {
  132. // 模块路径
  133. name: 'yfCostManage/yfCostStatistics/devDepreAllocation',
  134. res: ({ data }) => {
  135. data.records = data.records.map(item => {
  136. let _yanfaFenTanLv = item.yanfaFenTanLv;
  137. item.zcbm = item.asset ? item.asset.zcbm : '';
  138. item.zcmc = item.asset ? item.asset.zcmc : '';
  139. item.zclb = item.asset ? item.asset.zclb : '';
  140. item.yt = item.asset ? item.asset.yt : '';
  141. item.zcyz = item.asset ? item.asset.zcyz : '';
  142. item.jcz = new Decimal(item.asset.jcz || 0).mul(new Decimal(100));
  143. item.yzje = item.asset ? item.asset.yzje : '';
  144. item.attendanceHours = item.asset ? item.asset.zgs : '';
  145. item.yanfaFenTanLv = new Decimal(item.yanfaFenTanLv).mul(new Decimal(100));
  146. item.yanfaTanXiao = Number(new Decimal(item.yzje || 0).mul(_yanfaFenTanLv || 0)).toFixed(2);
  147. return item;
  148. });
  149. return data;
  150. },
  151. });
  152. </script>