| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <template>
- <basic-container>
- <avue-crud
- v-bind="bindVal"
- v-on="onEvent"
- v-model="form"
- :page.sync="page"
- >
- <template slot="menuLeft">
- <el-button
- type="warning"
- size="small"
- plain
- icon="el-icon-download"
- @click="handleExport"
- >
- 导出
- </el-button>
- <print-table-btn @click="printTable" />
-
- <div style="display: flex; align-items: center;">
- <year-month-select v-model="params.yearAndMonth" :showAllYear="false"></year-month-select>
- </div>
- </template>
- <template slot="jczSearch">
- <div style="display: flex; align-items: center;">
- <span>净残值率:</span>
- <avue-input-number v-model="extraParams.jczMin" :min="0" style="width: 100px !important;"></avue-input-number>
- <span style="width: 20px; text-align: center;">至</span>
- <avue-input-number v-model="extraParams.jczMax" :min="0" style="width: 100px !important;"></avue-input-number>
- </div>
- </template>
- <template slot="zcyzSearch">
- <div style="display: flex; align-items: center;">
- <span>资产原值:</span>
- <avue-input-number v-model="extraParams.zcyzMin" :min="0" style="width: 100px !important;"></avue-input-number>
- <span style="width: 20px; text-align: center;">至</span>
- <avue-input-number v-model="extraParams.zcyzMax" :min="0" style="width: 100px !important;"></avue-input-number>
- </div>
- </template>
- <template slot="yzjeSearch">
- <div style="display: flex; align-items: center;">
- <span>月折旧额:</span>
- <avue-input-number v-model="extraParams.yzjeMin" :min="0" style="width: 100px !important;"></avue-input-number>
- <span style="width: 20px; text-align: center;">至</span>
- <avue-input-number v-model="extraParams.yzjeMax" :min="0" style="width: 100px !important;"></avue-input-number>
- </div>
- </template>
- <template slot="attendanceHoursSearch">
- <div style="display: flex; align-items: center;">
- <span>月使用工时:</span>
- <avue-input-number v-model="extraParams.attendanceHoursMin" :min="0" style="width: 100px !important;"></avue-input-number>
- <span style="width: 20px; text-align: center;">至</span>
- <avue-input-number v-model="extraParams.attendanceHoursMax" :min="0" style="width: 100px !important;"></avue-input-number>
- </div>
- </template>
- <template slot="workHoursSearch">
- <div style="display: flex; align-items: center;">
- <span>已研发工时:</span>
- <avue-input-number v-model="extraParams.workHoursMin" :min="0" style="width: 100px !important;"></avue-input-number>
- <span style="width: 20px; text-align: center;">至</span>
- <avue-input-number v-model="extraParams.workHoursMax" :min="0" style="width: 100px !important;"></avue-input-number>
- </div>
- </template>
-
- </avue-crud>
- <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
- <WideTablePrinter
- ref="printWideTable"
- :columns="wideTableColumns"
- :data="data"
- :print-title="printTitle"
- :rows-per-page="30"
- :default-landscape="true"
- />
- </basic-container>
- </template>
- <script>
- import YearMonthSelect from "@/components/year-month-select";
- import {exportBlob} from "@/api/common";
- import {getToken} from "@/util/auth";
- import {downloadXls} from "@/util/util";
- import moment from "moment";
- import Decimal from "decimal.js";
- export default window.$crudCommon({
- components: {
- YearMonthSelect,
- },
- data() {
- return {
- params: {
- yearAndMonth: "",
- },
- defaultColumns: [],
- wideTableColumns: [],
- printTitle: "",
- };
- },
- watch: {
- 'params.yearAndMonth'(newVal) {
- this.page.currentPage = 1;
- this.getList(this.page);
- }
- },
- methods: {
- getSearchParams() {
- let newParams = { ...this.params, ...this.extraParams };
- if (newParams.jczMin !== null && newParams.jczMin !== undefined && newParams.jczMin !== '') {
- newParams.jczMin = new Decimal(newParams.jczMin).div(new Decimal(100)).toNumber();
- }
- if (newParams.jczMax !== null && newParams.jczMax !== undefined && newParams.jczMax !== '') {
- newParams.jczMax = new Decimal(newParams.jczMax).div(new Decimal(100)).toNumber();
- }
- return newParams;
- },
- handleExport() {
- exportBlob(`/api/kd-scientific/asset/kyyqsbzjfyfpb?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
- downloadXls(res.data, `${this.params.yearAndMonth}科研仪器设备折旧费用分配表.xlsx`);
- });
- },
- /**
- * 打印表格
- * @param isLandscape 是否横向打印
- */
- printTable(isLandscape) {
- this.wideTableColumns = this.$refs.crud.columnOption;
- this.printTitle = `${this.params.yearAndMonth}科研仪器设备折旧费用分配表`;
- this.$nextTick(() => {
- this.$refs.printWideTable.printTable(isLandscape);
- })
- },
- },
- }, {
- // 模块路径
- name: 'yfCostManage/yfCostStatistics/devDepreAllocation',
- res: ({ data }) => {
- data.records = data.records.map(item => {
- let _yanfaFenTanLv = item.yanfaFenTanLv;
- item.zcbm = item.asset ? item.asset.zcbm : '';
- item.zcmc = item.asset ? item.asset.zcmc : '';
- item.zclb = item.asset ? item.asset.zclb : '';
- item.yt = item.asset ? item.asset.yt : '';
- item.zcyz = item.asset ? item.asset.zcyz : '';
- item.jcz = new Decimal(item.asset.jcz || 0).mul(new Decimal(100));
- item.yzje = item.asset ? item.asset.yzje : '';
- item.attendanceHours = item.asset ? item.asset.zgs : '';
- item.yanfaFenTanLv = new Decimal(item.yanfaFenTanLv).mul(new Decimal(100));
- item.yanfaTanXiao = Number(new Decimal(item.yzje || 0).mul(_yanfaFenTanLv || 0)).toFixed(2);
- return item;
- });
- return data;
- },
- });
- </script>
|