|
|
@@ -0,0 +1,126 @@
|
|
|
+<template>
|
|
|
+ <basic-container>
|
|
|
+ <avue-crud
|
|
|
+ v-bind="bindVal"
|
|
|
+ v-on="onEvent"
|
|
|
+ v-model="form"
|
|
|
+ :page.sync="page"
|
|
|
+ >
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ plain
|
|
|
+ @click="handleDelete"
|
|
|
+ >
|
|
|
+ 删 除
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ size="small"
|
|
|
+ plain
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ @click="handleImport"
|
|
|
+ >
|
|
|
+ 导入
|
|
|
+ </el-button>
|
|
|
+ <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="xmmcForm">
|
|
|
+ <project-select placeholder="请选择项目名称" v-model="form.xmId" @change="handleProjectChange"></project-select>
|
|
|
+ </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 UploadExcelDialog from "@/components/upload-excel-dialog";
|
|
|
+import projectSelect from "@/components/project-select";
|
|
|
+import moment from "moment";
|
|
|
+
|
|
|
+
|
|
|
+export default window.$crudCommon({
|
|
|
+ components: {
|
|
|
+ YearMonthSelect,
|
|
|
+ projectSelect,
|
|
|
+ UploadExcelDialog,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ params: {
|
|
|
+ yearAndMonth: moment(new Date()).format('YYYYMM'),
|
|
|
+ },
|
|
|
+ defaultColumns: [],
|
|
|
+
|
|
|
+ wideTableColumns: [],
|
|
|
+ printTitle: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'params.yearAndMonth'(newVal) {
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleImport() {
|
|
|
+ let excelParams = { yearAndMonth: this.params.yearAndMonth };
|
|
|
+ this.$refs.uploadExcelDialog.open('/api/kd-scientific/technician/import', excelParams);
|
|
|
+ },
|
|
|
+ uploadAfter() {
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ exportBloByPost(`/api/kd-scientific/technician/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}`;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.printWideTable.printTable(isLandscape);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+}, {
|
|
|
+ // 模块路径
|
|
|
+ name: 'yfCostManage/basicDataSetting/leaseRecords',
|
|
|
+ res: ({ data }) => {
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|