fix(产出与成本报表):新增

This commit is contained in:
liaohechuan 2025-06-04 16:23:56 +08:00
parent e487bc42fb
commit 91be75607f
2 changed files with 235 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import request from '@/router/axios'
import {iep} from '@/api/prefix'
// 检索主列表数据
export function readOutCostReportPage(query) {
return request({
url: iep('/nlv-wip/readOutCostReportPage'),
method: 'get',
params: query
})
}

View File

@ -0,0 +1,224 @@
<template>
<!--产出与成本报表-->
<div class="execution">
<basic-container>
<!-- 搜尋框 -->
<el-form ref="searchForm" :model="searchForm" label-width="120px" label-suffix=":" :inline="true">
<el-row>
<el-col :span="6">
<el-form-item label="日期始" prop="dateFrom">
<el-date-picker
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
v-model="searchForm.dateFrom"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="日期止" prop="dateTo">
<el-date-picker
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
v-model="searchForm.dateTo"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-button type="primary" icon="el-icon-search" size="small" @click="search(true)">检索</el-button>
<el-button type="primary" icon="el-icon-document" size="small" @click="doExport">导出</el-button>
<el-button icon="el-icon-delete" size="small" @click="searchReset">清空</el-button>
</el-col>
</el-row>
</el-form>
<el-tabs v-model="tabActiveName">
<el-tab-pane label="查询结果" name="outCostReportDetailTab">
<el-table ref="outCostReportData" :data="outCostReportData" tooltip-effect="dark" border style="width: 100%;"
:row-key="'handle'"
:highlight-current-row="true"
stripe>
<el-table-column prop="sumOutputQty" label="产出总米数" header-align="center">
<template slot-scope="scope">
<div>
{{ scope.row.sumOutputQty }}
</div>
</template>
</el-table-column>
<el-table-column prop="totalCost" label="总成本" header-align="center">
<template slot-scope="scope">
<div>
{{ scope.row.totalCost }}
</div>
</template>
</el-table-column>
<el-table-column prop="unitCost" label="单位成本" header-align="center">
<template slot-scope="scope">
<div>
{{ scope.row.unitCost }}
</div>
</template>
</el-table-column>
<el-table-column prop="unitEnergy" label="单位能耗" header-align="center">
<template slot-scope="scope">
<div>
{{ scope.row.unitEnergy }}
</div>
</template>
</el-table-column>
</el-table>
<div style="width: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<el-pagination @current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page.sync="page.current"
:page-sizes="[10, 20, 50, 100, 200]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total">
</el-pagination>
</div>
</el-tab-pane>
</el-tabs>
</basic-container>
</div>
</template>
<script>
import {mapGetters} from 'vuex';
import {getStore} from '@/util/store';
import {hideLoading, showLoading} from "@/const/loading";
import {readOutCostReportPage} from "@/api/mes/wip-nalinv/outCostReport";
export default {
name: 'outCostReport',
data() {
return {
tabActiveName: "outCostReportDetailTab",
searchForm: {
site: getStore({name: 'tenantId'}),
dateFrom: this.formattedDate(),
dateTo: this.formattedDate()
},
outCostReportData: [],
site: getStore({name: 'tenantId'}),
page: {
total: 0,
current: 1,
size: 10
},
}
},
created() {
this.searchForm = Object.assign({}, this.searchForm);
},
computed: {
//读取权限
...mapGetters(['permissions', 'userInfo']),
permissionList() {
return {
addBtn: false,
delBtn: false,
editBtn: false,
}
},
},
methods: {
// 获取当前日期
formattedDate() {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份是从 0 开始的,所以需要加 1
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`; // 格式化为 YYYY-MM-DD
},
// 页面大小改变
handleSizeChange(val) {
this.page.size = val;
this.page.current = 1;
this.search();
},
//页面切换
handleCurrentChange(val) {
this.page.current = val;
this.search();
},
// 检索列表数据
search(flag) {
if (!this.searchForm.dateFrom) {
this.$message.error("日期始不可为空!");
return;
}
if (!this.searchForm.dateTo) {
this.$message.error("日期止不可为空!");
return;
}
if (flag) {
this.page.current = 1;
}
showLoading();
readOutCostReportPage({
...this.searchForm,
current: this.page.current,
size: this.page.size
}).then((response) => {
hideLoading();
if (response.data.code !== 0) {
this.$message.error(response.data.message);
} else {
this.outCostReportData = response.data.data.records;
this.page.total = response.data.data.total;
this.page.current = response.data.data.current;
}
}).catch(() => {
hideLoading();
});
},
// 导出
doExport() {
let me = this;
if (!me.searchForm.dateFrom) {
me.$message.error("日期始不可为空!");
return;
}
if (!me.searchForm.dateTo) {
me.$message.error("日期止不可为空!");
return;
}
me.$confirm(`是否确认导出?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.downBlobFile("/iep-app/nlv-wip/exportOutCostReport", me.searchForm, "产出与成本报表.xlsx");
})
},
// 清空事件
searchReset() {
this.searchForm = {
site: this.site,
dateFrom: this.formattedDate(),
dateTo: this.formattedDate()
};
this.outCostReportData = [];
},
},
}
</script>
<style lang="scss" scoped>
// 解决input框中添加disabled不可编辑属性后,改变字体颜色样式(主要解决:默认字体颜色为灰色)
::v-deep .el-input.is-disabled .el-input__inner {
color: black;
}
/* 禁用 el-input 时禁用图标和清除按钮 */
.el-input.is-disabled .el-input__icon,
.el-input.is-disabled .el-input__clear {
pointer-events: none;
}
</style>