瀏覽代碼

更新

projects/zg-zwq
朱文强 5 天之前
父節點
當前提交
e32530e459
共有 16 個文件被更改,包括 299 次插入208 次删除
  1. +54
    -0
      src/api/cost/allCost.js
  2. +59
    -31
      src/views/cost/costStatistics/add-or-updata.vue
  3. +169
    -115
      src/views/cost/costStatistics/index.vue
  4. +1
    -4
      src/views/cost/deep/costDeepEnergy/index.vue
  5. +1
    -4
      src/views/cost/deep/costDeepOthercostHis/index.vue
  6. +2
    -8
      src/views/cost/deep/costDeepOthercostLog/index.vue
  7. +2
    -5
      src/views/cost/deep/costDeepOthercostRule/index.vue
  8. +1
    -4
      src/views/cost/deep/costDeepRatioHis/index.vue
  9. +1
    -4
      src/views/cost/deep/costStatistics/index.vue
  10. +1
    -4
      src/views/cost/raw/costEnergy/index.vue
  11. +1
    -4
      src/views/cost/raw/costMaterial/index.vue
  12. +1
    -4
      src/views/cost/raw/costOriginRatioHis/index.vue
  13. +1
    -4
      src/views/cost/raw/costOthercostHis/index.vue
  14. +2
    -8
      src/views/cost/raw/costOthercostLog/index.vue
  15. +2
    -5
      src/views/cost/raw/costOthercostRule/index.vue
  16. +1
    -4
      src/views/cost/raw/costStatistics/index.vue

+ 54
- 0
src/api/cost/allCost.js 查看文件

@@ -0,0 +1,54 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 14:35:13
* @Description:
*/

import request from '@/utils/request'

// 获得总成本统计-按日期分页
export function getCostSumPage(query) {
return request({
url: '/monitoring/cost-sum/page',
method: 'get',
params: query
})
}
// 更新总成本统计-按日期
export function updateCostSum(data) {
return request({
url: '/monitoring/cost-sum/update',
method: 'put',
data: data
})
}
// 获得原片成本统计成本查询分页
export function getRawCostStatisticsRealtimePage(query) {
return request({
url: '/monitoring/cost-sum/page',
method: 'get',
params: query
})
}

// 导出总成本统计-按日期 Excel
export function exportCostSumExcel(query) {
return request({
url: '/monitoring/cost-sum/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

// 导出原片成本统计-历史成本 Excel
export function exportRawCostStatisticsHisExcel(query) {
return request({
url: '/monitoring/cost-sum/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

+ 59
- 31
src/views/cost/costStatistics/add-or-updata.vue 查看文件

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:59:45
* @LastEditTime: 2024-09-11 15:49:14
* @Description:
-->
<template>
@@ -11,46 +11,71 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="materialName">
<el-input
v-model="dataForm.materialName"
<el-form-item label="日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
disabled
placeholder="请输入原料名称" />
placeholder="日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="matPrice">
<el-input
v-model="dataForm.matPrice"
<el-form-item label="总成本" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
disabled
style="width: 70%"
placeholder="请输入单价" />
(元/吨)
placeholder="总成本" />
(元)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-form-item label="原片下片面积" prop="originArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
v-model="dataForm.originArea"
clearable
placeholder="请输入总价" />
placeholder="请输入原片下片面积" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="深加工下片面积" prop="deepArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.deepArea"
clearable
placeholder="请输入深加工下片面积" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原片成本" prop="originPrice">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.originPrice"
clearable
placeholder="请输入原片成本" />
(元)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-form-item label="深加工成本" prop="deepPrice">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.quantity"
v-model="dataForm.deepPrice"
clearable
placeholder="请输入累计用量" />
(吨)
placeholder="请输入深加工成本" />
()
</el-form-item>
</el-col>
</el-row>
@@ -59,28 +84,24 @@

<script>
import basicAdd from '@/mixins/basic-add';
import { updateMaterialHis } from '@/api/cost/costMaterial';
import { updateCostSum } from '@/api/cost/allCost';

export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateMaterialHis,
updateURL: updateCostSum,
},
dataForm: {
id: undefined,
originArea: undefined,
deepArea: undefined,
originPrice: undefined,
deepPrice: undefined,
price: undefined,
quantity: undefined,
matPrice: undefined,
materialName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
@@ -99,10 +120,17 @@ export default {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
const data = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
modifyOriginArea: this.dataForm.originArea,
modifyOriginPrice: this.dataForm.originPrice,
modifyDeepArea: this.dataForm.deepArea,
modifyDeepPrice: this.dataForm.deepPrice,
modifyPrice: this.dataForm.deepPrice + this.dataForm.originPrice,
};
// 修改的提交
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.urlOptions.updateURL(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');


+ 169
- 115
src/views/cost/costStatistics/index.vue 查看文件

@@ -1,78 +1,89 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['按日期', '按规格']" @change="currentMenu">
<template v-slot:tab1>
<div>按日期</div>
</template>
<template v-slot:tab2>
<div>按规格</div>
</template>
</ButtonNav>
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>

<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getMaterialPage } from '@/api/base/material';
import {
getMaterialHisPage,
getMaterialRealtimePage,
} from '@/api/cost/costMaterial';
getCostSumPage,
getRawCostStatisticsRealtimePage,
exportRawStatisticsRealtimeExcel,
exportCostSumExcel
} from '@/api/cost/allCost';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';

const tableProps = [
{
prop: 'recTime',
@@ -80,56 +91,66 @@ const tableProps = [
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'materialName',
label: '原料名称',
prop: 'originArea',
label: '原片下片面积',
},
{
prop: 'deepArea',
label: '深加工下片面积',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
prop: 'originPrice',
label: '原片成本/元',
align: 'right',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
prop: 'deepPrice',
label: '深加工成本/元',
align: 'right',
},
{
prop: 'price',
label: '总价(元)',
label: '总成本/元',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'materialName',
label: '原料名称',
prop: 'bindObjectName',
label: '产品名称',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
prop: 'costSum',
label: '原片单片成本/元',
align: 'right',
},
{
prop: 'time',
label: '单价生效时间',
subcomponent: typeRule,
prop: 'costPiece',
label: '深加工单片成本/元',
align: 'right',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
prop: 'costPiece',
label: '成品单片成本/元',
align: 'right',
},
{
prop: 'price',
label: '总价(元)',
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
export default {
name: 'costMaterial',
name: 'allCost',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getMaterialHisPage,
getDataListURL: getCostSumPage,
},
formConfig: [
{
@@ -144,14 +165,6 @@ export default {
defaultSelect: 1, // 默认值,
clearable: false,
},
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
@@ -169,16 +182,17 @@ export default {
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'datePicker',
label: '时间范围',
@@ -196,6 +210,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@@ -204,12 +227,10 @@ export default {
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
@@ -217,24 +238,26 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getMaterialPage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
if (val.statisticType === 2) {
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年第{w}周');
}else{
this.tableProps[0].filter = (val) =>
parseTime(val, '{y}年{m}月{d}日');
}
this.formConfig2[0].startPlaceholder = '开始时间';
this.formConfig2[0].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.materialId = val.name || null;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
@@ -252,7 +275,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@@ -263,7 +287,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '按日期' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@@ -274,9 +299,14 @@ export default {
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[0].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[0].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
@@ -284,7 +314,7 @@ export default {
// 获取数据2列表
getDataList2() {
if (this.listQuery.startTime) {
getMaterialRealtimePage(this.listQuery).then((response) => {
getRawCostStatisticsRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
@@ -304,6 +334,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportCostSumExcel;
title = '总成本统计-按日期';
} else {
exportURL = exportRawStatisticsRealtimeExcel;
title = '总成本统计-按规格';
}
// 处理查询参数
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>


+ 1
- 4
src/views/cost/deep/costDeepEnergy/index.vue 查看文件

@@ -237,13 +237,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-energy-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 1
- 4
src/views/cost/deep/costDeepOthercostHis/index.vue 查看文件

@@ -212,13 +212,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-othercost-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 2
- 8
src/views/cost/deep/costDeepOthercostLog/index.vue 查看文件

@@ -82,19 +82,13 @@ export default {
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-othercost-log:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`monitoring:cost-deep-othercost-log:delete`)
? {
},{
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [


+ 2
- 5
src/views/cost/deep/costDeepOthercostRule/index.vue 查看文件

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-04-15 16:52:38
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 16:46:26
* @LastEditTime: 2024-09-11 15:30:41
* @Description:
-->
<template>
@@ -77,13 +77,10 @@ export default {
getDataListURL: getRawOthercostRulePage,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-othercost-rule:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
};


+ 1
- 4
src/views/cost/deep/costDeepRatioHis/index.vue 查看文件

@@ -200,13 +200,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-ratio-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 1
- 4
src/views/cost/deep/costStatistics/index.vue 查看文件

@@ -262,13 +262,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 1
- 4
src/views/cost/raw/costEnergy/index.vue 查看文件

@@ -237,13 +237,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-energy-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 1
- 4
src/views/cost/raw/costMaterial/index.vue 查看文件

@@ -234,13 +234,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 1
- 4
src/views/cost/raw/costOriginRatioHis/index.vue 查看文件

@@ -144,13 +144,10 @@ export default {
statisticType: 1,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-origin-ratio-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
};


+ 1
- 4
src/views/cost/raw/costOthercostHis/index.vue 查看文件

@@ -212,13 +212,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-othercost-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


+ 2
- 8
src/views/cost/raw/costOthercostLog/index.vue 查看文件

@@ -82,19 +82,13 @@ export default {
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-othercost-log:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`monitoring:cost-othercost-log:delete`)
? {
},{
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [


+ 2
- 5
src/views/cost/raw/costOthercostRule/index.vue 查看文件

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-04-15 16:52:38
* @LastEditors: zwq
* @LastEditTime: 2024-04-17 17:01:26
* @LastEditTime: 2024-09-11 15:31:12
* @Description:
-->
<template>
@@ -77,13 +77,10 @@ export default {
getDataListURL: getRawOthercostRulePage,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-othercost-rule:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
};


+ 1
- 4
src/views/cost/raw/costStatistics/index.vue 查看文件

@@ -261,13 +261,10 @@ export default {
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
tableBtn: [{
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],


Loading…
取消
儲存