| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <basic-container>
- <avue-crud
- ref="crud"
- v-bind="bindVal"
- v-on="onEvent"
- v-model="form"
- :page.sync="page"
- :before-open="handleBeforeOpen"
- :permission="permissionList"
- >
- <template slot="menuLeft">
- <el-button
- type="warning"
- size="small"
- plain
- icon="el-icon-download"
- @click="handleExport"
- >
- 导出
- </el-button>
- <print-table-btn @click="printTable" />
- <div>
- <year-month-select v-model="params.yearAndMonth" :showMonth="false"></year-month-select>
- </div>
-
- </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 {exportBlob} from "@/api/common";
- import YearMonthSelect from "@/components/year-month-select";
- import moment from "moment";
- import {getToken} from "@/util/auth";
- import {downloadXls} from "@/util/util";
- export default window.$crudCommon({
- components: {
- YearMonthSelect,
- },
- data() {
- return {
- params: {
- yearAndMonth: moment(new Date()).format('YYYY'),
- },
-
- printTitle: "",
- wideTableColumns: [],
- };
- },
- watch: {
- 'params.yearAndMonth'(newVal) {
- this.page.currentPage = 1;
- this.getList(this.page);
- }
- },
- methods: {
- handleExport() {
- exportBlob(`/api/kd-scientific/technician/ndgkjryhzb/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
- downloadXls(res.data, `${this.params.yearAndMonth}年度高新科技人员汇总表.xlsx`);
- });
- },
- printTable(isLandscape) {
- this.wideTableColumns = this.$refs.crud.columnOption;
- this.printTitle = `${this.params.yearAndMonth}年度高新科技人员汇总表`;
- this.$nextTick(() => {
- this.$refs.printWideTable.printTable(isLandscape);
- });
- },
- },
- }, {
- // 模块路径
- name: 'techPerson/highTechPersonSumList',
- res: ({ data }) => {
- data.records = data.records.map(item => {
- item.gender = item.gender ? String(item.gender) : '';
- return item;
- });
- return data;
- },
- });
- </script>
|