| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <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"></year-month-select>
- </div>
- </template>
- <!-- 开始时间 -->
- <template slot="kssjSearch">
- <el-date-picker
- v-model="params.kssjRange"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- value-format="yyyy-MM-dd"
- style="width: 240px !important;"
- >
- </el-date-picker>
- </template>
-
- </avue-crud>
- <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";
- export default window.$crudCommon({
- components: {
- YearMonthSelect,
- },
- data() {
- return {
- params: {
- yearAndMonth: moment(new Date()).format('YYYYMM'),
- },
- wideTableColumns: [],
- printTitle: "",
- };
- },
- watch: {
- 'params.yearAndMonth'(newVal) {
- this.page.currentPage = 1;
- this.getList(this.page);
- }
- },
- methods: {
- loadData() {},
- handleExport() {
- exportBlob(`/api/kd-scientific/attendance/export?${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}研发费用明细表.xlsx`;
- this.$nextTick(() => {
- this.$refs.printWideTable.printTable(isLandscape);
- })
- },
- },
- }, {
- // 模块路径
- name: 'externalReports/kjAuxiliaryDetails',
- res: ({ data }) => {
- return data;
- },
- });
- </script>
|