|
|
@@ -19,26 +19,39 @@
|
|
|
<el-button :size="size" icon="el-icon-delete" @click="handleResetBtn">清空</el-button>
|
|
|
</template>
|
|
|
</avue-form>
|
|
|
- <div>
|
|
|
- <el-button
|
|
|
- type="warning"
|
|
|
- size="small"
|
|
|
- plain
|
|
|
- icon="el-icon-download"
|
|
|
- @click="handleExport"
|
|
|
- style="margin-right: 10px;"
|
|
|
- >
|
|
|
- 导出
|
|
|
- </el-button>
|
|
|
- <print-table-btn />
|
|
|
- </div>
|
|
|
<div style="display: flex; align-items: center;">
|
|
|
<year-month-select v-model="yearAndMonth" :showAllYear="false" style="margin: 6px 0 20px;"></year-month-select>
|
|
|
</div>
|
|
|
<template v-if="listData.length">
|
|
|
- <common-list v-for="(item, index) of listData" :data="item" :type="type" :key="index" style="margin-bottom: 25px;"></common-list>
|
|
|
+ <common-list v-for="(item, index) of listData" :data="item" :type="type" :key="index" style="margin-bottom: 25px;" @printClick="handlePrintClick"></common-list>
|
|
|
</template>
|
|
|
<el-empty v-else description="暂无数据"></el-empty>
|
|
|
+
|
|
|
+ <WideTablePrinter
|
|
|
+ ref="printWideTable"
|
|
|
+ :columns="wideTableColumns"
|
|
|
+ :data="wideTableData"
|
|
|
+ :print-title="pageTitle"
|
|
|
+ :rows-per-page="30"
|
|
|
+ :default-landscape="true"
|
|
|
+ :zoom="95"
|
|
|
+ >
|
|
|
+ <template slot="tableHeader">
|
|
|
+ <div>
|
|
|
+ <span style="margin-right: 140px;">{{ `研发项目编号:${currProject.xmbh}` }}</span>
|
|
|
+ <span>{{ `研发项目名称:${currProject.xmmc}` }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot="tableFooter">
|
|
|
+ <div>
|
|
|
+ <span style="margin-right: 140px;">发料人:</span>
|
|
|
+ <span>发料人:</span>
|
|
|
+ </div>
|
|
|
+ <div style="margin-top: 6px;">
|
|
|
+ <span>项目负责人:</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </WideTablePrinter>
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
|
|
|
@@ -46,9 +59,6 @@
|
|
|
import YearMonthSelect from "@/components/year-month-select";
|
|
|
import commonList from "./common-list.vue";
|
|
|
import { getList } from "@/api/yfCostManage/yfCostStatistics/clCost";
|
|
|
-import {exportBlob} from "@/api/common";
|
|
|
-import {getToken} from "@/util/auth";
|
|
|
-import {downloadXls} from "@/util/util";
|
|
|
import moment from "moment";
|
|
|
import Decimal from "decimal.js";
|
|
|
|
|
|
@@ -65,6 +75,15 @@ export default {
|
|
|
commonList
|
|
|
},
|
|
|
data() {
|
|
|
+ let codeLabel = '材料编号';
|
|
|
+ let nameLabel = '材料名称';
|
|
|
+ if (this.type === '动力') {
|
|
|
+ codeLabel = '动力编号';
|
|
|
+ nameLabel = '动力名称';
|
|
|
+ } else if (this.type === '燃料') {
|
|
|
+ codeLabel = '燃料编号';
|
|
|
+ nameLabel = '燃料名称';
|
|
|
+ }
|
|
|
return {
|
|
|
loading: false,
|
|
|
searchOption: {
|
|
|
@@ -91,6 +110,10 @@ export default {
|
|
|
|
|
|
yearAndMonth: "",
|
|
|
params: {},
|
|
|
+
|
|
|
+ wideTableColumns: [],
|
|
|
+ wideTableData: [],
|
|
|
+ currProject: {}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -98,6 +121,18 @@ export default {
|
|
|
this.loadData();
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ pageTitle() {
|
|
|
+ let title = '研发项目领料单';
|
|
|
+ if (this.type == '动力') {
|
|
|
+ title = '研发动力消耗单';
|
|
|
+ } else if (this.type == '燃料') {
|
|
|
+ title = '研发燃料消耗单';
|
|
|
+ }
|
|
|
+ let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
|
|
|
+ return `${yearAndMonthCN}${title}`;
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
loadData() {
|
|
|
let params = { ...this.params };
|
|
|
@@ -122,7 +157,6 @@ export default {
|
|
|
childItem.amount = new Decimal(childItem.unitPrice || 0).mul(new Decimal(childItem.useQuantity || 0)).toFixed(2);
|
|
|
return childItem;
|
|
|
})
|
|
|
- console.log(newList)
|
|
|
allList.push(newList);
|
|
|
});
|
|
|
});
|
|
|
@@ -133,17 +167,6 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- handleExport() {
|
|
|
- let title = '研发项目领料单';
|
|
|
- if (this.type == '动力') {
|
|
|
- title = '研发动力消耗单';
|
|
|
- } else if (this.type == '燃料') {
|
|
|
- title = '研发燃料消耗单';
|
|
|
- }
|
|
|
- exportBlob(`/api/kd-scientific/goods/yanfalingliaodan/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
- downloadXls(res.data, `${this.params.yearAndMonth}${title}.xlsx`);
|
|
|
- });
|
|
|
- },
|
|
|
handleSearchBtn() {
|
|
|
this.loadData();
|
|
|
},
|
|
|
@@ -152,6 +175,14 @@ export default {
|
|
|
this.$refs.searchForm.resetForm();
|
|
|
this.loadData();
|
|
|
},
|
|
|
+ handlePrintClick({ column, data, projectData }) {
|
|
|
+ this.wideTableColumns = [...column];
|
|
|
+ this.wideTableData = data;
|
|
|
+ this.currProject = projectData;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.printWideTable.printTable(true);
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
}
|
|
|
</script>
|