成本统计页面调整及接口联调

dev-scheduling
jinna 2 months ago
parent 3b9b8f0a58
commit ba171e726b
  1. 50
      src/api/costManagement/costConfiguration.js
  2. 49
      src/api/costManagement/costStatistics.js
  3. 50
      src/api/costManagement/subjectFeeMaintenance.js
  4. 43
      src/api/performanceManagement/salaryManagement.js
  5. 343
      src/views/costManagement/components/batchAddProcess.vue
  6. 264
      src/views/costManagement/components/maintenanceCost.vue
  7. 212
      src/views/costManagement/components/materialMaintenance.vue
  8. 318
      src/views/costManagement/components/processMaintenance.vue
  9. 20
      src/views/costManagement/costConfiguration.vue
  10. 243
      src/views/costManagement/subjectFeeMaintenance.vue
  11. 450
      src/views/costStatistics/index.vue
  12. 1418
      src/views/personnelEfficiencyManagement/salaryManagement/salaryStandard.vue

@ -0,0 +1,50 @@
// 成本计算配置
import request from '@/axios';
// 工序维护列表
export const getCostList = params =>
request({
url: '/api/blade-desk/costCalculationProcess/page',
method: 'get',
params
});
// 工序列表
export const getProcessList = params =>
request({
url: '/api/blade-desk/bsProcessSet/list',
method: 'get',
params
});
// 新增
export const addCost = data =>
request({
url: '/api/blade-desk/costCalculationProcess/save',
method: 'post',
data
});
// 删除工序
export const deleteProcess = params =>
request({
url: '/api/blade-desk/costCalculationProcess/remove',
method: 'post',
params
});
// 物料维护列表
export const getMaterialList = params =>
request({
url: '/api/blade-desk/costCalculationGoods/page',
method: 'get',
params
});
// 删除物料
export const deleteMaterial = params =>
request({
url: '/api/blade-desk/costCalculationGoods/remove',
method: 'post',
params
});

@ -0,0 +1,49 @@
// 成本统计
import request from '@/axios';
import { exportBlob } from '@/api/common';
// 获取列表
export const getList = (params) =>{
return request({
url:'/api/blade-desk/costStatistics/page',
method:'get',
params
})
}
// 删除
export const deleteTable = (params) =>
request({
url: '/api/blade-desk/costStatistics/remove',
method: 'post',
params
});
// 校验
export const verifyTable = (params) =>
request({
url: '/api/blade-desk/costStatistics/costCalculationCheck',
method: 'get',
params
});
// 计算
export const calculateTable = (params) =>
request({
url: '/api/blade-desk/costStatistics/costCalculation',
method: 'get',
params
});
// 导出
export const exportData = (params) => {
return exportBlob('/api/blade-desk/costStatistics/export', params);
};
// 查看明细
export const getDetail = (params) =>
request({
url: '/api/blade-desk/subjectFeeDetail/findList',
method: 'get',
params
});

@ -0,0 +1,50 @@
// 费用科目维护
import request from '@/axios';
// 作业中心下拉
export const getWorkCenter = params =>
request({
url: '/api/blade-desk/BA/WorkCenter/listForSelect',
method: 'get',
params
});
// 查询列表
export const getList = params =>
request({
url: '/api/blade-desk/subjectFee/page',
method: 'get',
params
});
// 新增科目
export const addSubjectFee = params =>
request({
url: '/api/blade-desk/subjectFee/save',
method: 'post',
data: params
});
// 维护
export const maintainSubjectFee = params =>
request({
url: '/api/blade-desk/subjectFee/maintain',
method: 'post',
data: params
});
// 详情
export const detailSubjectFee = data =>
request({
url: '/api/blade-desk/subjectFee/detail',
method: 'post',
data
});
// 删除
export const delSubjectFee = params =>
request({
url: '/api/blade-desk/subjectFee/remove',
method: 'post',
params
});

@ -0,0 +1,43 @@
// 薪资维护标准
import request from '@/axios';
// /bsSalaryStandard/page
// /bsSalaryStandard/submit
// /bsSalaryStandard/remove
// /bsSalaryStandard/detail
// /bsSalaryStandard/download-excel-template
// /bsSalaryStandard/import-excel
// 获取工序下拉数据
export const getProcessList = (params) =>{
return request({
url:'/api/blade-desk/bsProcessSet/list',
method:'get',
params
})
}
// 薪资标准列表
export const getList = (params) =>{
return request({
url:'/api/blade-desk/bsSalaryStandard/page',
method:'get',
params
})
}
// 删除
export const deleteTable = (params) =>
request({
url: '/api/blade-desk/bsSalaryStandard/remove',
method: 'post',
params
});
// 新增
export const addTable = (data) =>
request({
url: '/api/blade-desk/bsSalaryStandard/submit',
method: 'post',
data
});

@ -0,0 +1,343 @@
<template>
<el-dialog :title="title" append-to-body :modelValue="openShow" width="70%" @close="closeDialog()">
<div style="margin-bottom: 12px" v-if="moldAddMore">
<el-button type="primary" @click="addTable">插入一行</el-button>
<el-button type="danger" @click="delTable">删除选中行</el-button>
</div>
<!-- 单个 Form 包裹整个表格 -->
<el-form
ref="tableForm"
:model="form"
:rules="formRules"
label-width="0px"
>
<!-- 全局错误提示 -->
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px;">
{{ formError }}
</div>
<el-table :data="form.tableData" @select="selectChange" border>
<el-table-column type="selection" width="55"></el-table-column>
<!-- 作业中心绑定数组字段 -->
<el-table-column align="center" label="作业中心">
<template #header>
<span><i style="color: red">*</i>作业中心</span>
</template>
<template #default="scope">
<!-- prop 格式数组名[索引].字段名 -->
<el-form-item :prop="`tableData[${scope.$index}].workCenterId`" :rules="formRules.workCenterId">
<el-select
v-model="scope.row.workCenterId"
placeholder="请选择"
style="width: 100%"
@change="(val) => changeWork(val,scope.row)"
>
<el-option
v-for="item in wcData"
:key="item.id"
:value="item.id"
:label="item.wcName"
></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="工序" prop="processId">
<template #header>
<span><i style="color: red">*</i>工序</span>
</template>
<template #default="scope">
<!-- prop 格式数组名[索引].字段名 -->
<el-form-item :prop="`tableData[${scope.$index}].processId`" :rules="formRules.processId">
<el-select
multiple
v-model="scope.row.processId"
remote
:remote-method="remoteProcess"
filterable
:loading="processLoading"
@change="(val) => changeProcess(val,scope.row)"
>
<el-option v-for="item in processData" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="计算方式" prop="type">
<template #header>
<span><i style="color: red">*</i>计算方式</span>
</template>
<template #default="scope">
<!-- prop 格式数组名[索引].字段名 -->
<el-form-item :prop="`tableData[${scope.$index}].type`" :rules="formRules.type">
<el-radio-group v-model="scope.row.type" style="display: flex;margin:0 auto;">
<el-radio label="0">面积</el-radio>
<el-radio label="1">体积</el-radio>
</el-radio-group>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog()"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import { getWorkCenterList } from '@/api/processManagement/addQuantity.js';
import {getProcessList,addCost} from "@/api/costManagement/costConfiguration.js"
export default {
props:{
title:{
type:String,
default:''
},
moldAddMore:{
type:Boolean,
default:false
},
showDialog:{
type:Boolean,
default:false
}
},
data(){
return{
openShow:false,
formError:'',
wcData:[],
processLoading:false,
form:{
tableData:[]
},
selectProcess:[],
formRules:{
// 1
tableData: [
{
required: true,
message: '请至少添加一行数据',
trigger: 'submit',
type: 'array' //
},
{
validator: (rule, value, callback) => {
if (value.length === 0) {
callback(new Error('请至少添加一行数据'));
} else {
callback();
}
},
trigger: 'submit'
}
],
// workCenterId
workCenterId: [
{ required: true, message: '请选择作业中心', trigger: ['change', 'submit'] }
],
processId:[
{ required: true, message: '请选择工序', trigger: ['change', 'submit'] }
],
type:[
{ required: true, message: '请选择计算方式', trigger: ['change', 'submit'] }
]
},
}
},
created(){
this.openShow = this.showDialog
this.getWorkCenterList()
if(this.title == '新增'){
this.form.tableData = []
this.addTable()
}
},
methods:{
getWorkCenterList() {
getWorkCenterList().then(res => {
this.wcData = res.data.data || [];
});
},
remoteProcess(query){
this.processLoading = true
if(query == ''){
getProcessList({
current:1,
size:100
}).then(res =>{
this.processData = res.data.data.records
this.processLoading = false
})
}else{
getProcessList({
current:1,
size:100,
name:query
}).then(res =>{
this.processData = res.data.data.records
this.processLoading = false
})
}
},
addTable(){
this.form.tableData.push({
_select:false,
batchNo:''
})
},
changeWork(val,row){
row.workCenterName = this.wcData.find(item => item.id == val).wcName
},
changeProcess(val,row){
const result = this.processData.filter(item =>
val.some(val => val === item.id)
);
this.selectProcess = [...result,...this.selectProcess]
},
//
submitForm() {
this.formError = '';
// Form
this.$refs.tableForm.validate((isValid, invalidFields) => {
if (!isValid) {
//
this.formError = '存在未完善的字段,请检查表格中的红色提示';
this.$nextTick(() => {
//
const firstError = document.querySelector('.el-form-item.is-error');
if (firstError) {
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
});
return;
}
//
const submitData = this.form.tableData.map(row => {
const { _select, ...validData } = row; //
return validData;
});
console.log('submitData---------',submitData)
console.log('process=========',this.selectProcess)
const sumitResult = submitData.flatMap(item => {
// 1.
// 2.
return item.processId.map(val => ({
workCenterId:item.workCenterId,
workCenterName:item.workCenterName,
processId:val,
type:item.type
}));
});
const data2Map = new Map();
this.selectProcess.forEach(item => {
data2Map.set(item.id, item.name);
});
// 2. data1 processName
const result = sumitResult.map(item => {
// Map name
const processName = data2Map.get(item.processId);
// + processName
return {
...item,
processName: processName || '' // null
};
});
// -
const uniqueMap = new Map();
const duplicates = [];
for (const item of result) {
// ID_ID
const key = `${item.workCenterId}_${item.processId}`;
if (uniqueMap.has(key)) {
//
duplicates.push(item);
} else {
uniqueMap.set(key, item);
}
}
if (duplicates.length > 0) {
//
const duplicateProcessNames = duplicates.map(d => {
const proc = this.selectProcess.find(p => p.id === d.processId);
return proc ? proc.name : d.processId;
});
//
const uniqueNames = [...new Set(duplicateProcessNames)];
this.$message.error(`以下工序在相同作业中心下重复选择:${uniqueNames.join('、')}`);
return;
}
console.log('sumitResult===========',sumitResult)
console.log('result===========',result)
if(this.title == '新增'){
addCost(result).then(res =>{
if(res.data.code == 200){
this.$message.success('新增成功');
this.selectProcess = []
this.closeDialog(true);
}
})
}
})
},
closeDialog(val){
this.openShow = false
this.$emit('closeDialog',val)
}
}
}
</script>
<style lang="scss" scoped>
//
:deep(.el-table .el-form-item) {
margin-bottom: 0; //
}
//
:deep(.el-form-item__error) {
font-size: 12px;
white-space: nowrap;
z-index: 10;
background: #fff;
padding: 2px 4px;
border: 1px solid #f56c6c;
border-radius: 4px;
}
// textarea
.el-table__row {
height: 80px !important;
}
.el-table__cell {
vertical-align: middle !important;
}
.error-message {
font-size: 14px;
line-height: 1.5;
}
:deep(.el-table .el-table__cell) {
height: 50px !important;
padding: 0 !important;
line-height: 50px !important;
}
</style>

@ -0,0 +1,264 @@
<template>
<el-dialog :title="title" append-to-body :modelValue="openShow" width="70%" @close="closeDialog()">
<el-form :inline="true" :model="maintainForm" ref="maintainForm" :rules="maintainRules">
<el-form-item label="月份" prop="month">
<el-date-picker
v-if="title == '维护'"
v-model="maintainForm.month"
type="month"
placeholder="选择月份"
format="YYYY年MM月"
value-format="YYYY-MM"
:disabled="title == '详情'"
:disabled-date="disabledDate"
@change="changeMonth"
></el-date-picker>
<el-date-picker
v-if="title == '详情'"
v-model="maintainForm.month"
type="month"
placeholder="选择月份"
format="YYYY年MM月"
value-format="YYYY-MM"
@change="changeMonth"
></el-date-picker>
</el-form-item>
<el-form-item label="费用分配方式" prop="type">
<el-radio-group v-model="maintainForm.type" :disabled="title == '详情' || subjectName == '辅助人员材料费用'" @change="changeType">
<el-radio label="0">按金额</el-radio>
<el-radio label="1">按比例</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="总费用金额" prop="totalFee">
<el-input-number
v-model="maintainForm.totalFee"
controls-position="right"
:min="0"
:disabled="title == '详情' || maintainForm.type == 0 || subjectName == '辅助人员材料费用'"
@change="changeTotal"
></el-input-number>
</el-form-item>
</el-form>
<el-table :data="tableData" v-loading="loading">
<el-table-column type="index"></el-table-column>
<el-table-column label="作业中心" prop="workCenterName" align="center"></el-table-column>
<el-table-column label="比例" prop="rate" align="center">
<template #default="scope">
<el-input-number
v-model="scope.row.rate"
controls-position="right"
:min="0"
:max="100"
@change="(val) => changeRate(val,scope.row)"
:disabled="title == '详情' || maintainForm.type == 0"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="费用金额(元)" prop="fee" align="center">
<template #default="scope">
<el-input-number
v-model="scope.row.fee"
controls-position="right"
:min="0"
:disabled="title == '详情' || maintainForm.type == 1"
@change="changePrice"
></el-input-number>
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog()"> </el-button>
<el-button v-if="title == '维护'" type="primary" @click="submitMaintain"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import {getWorkCenter,maintainSubjectFee,detailSubjectFee} from "@/api/costManagement/subjectFeeMaintenance"
export default {
props:{
showDialog:{
type:Boolean,
default:false
},
title:{
type:String,
default:''
},
checkId:{
type:String,
default:''
},
month:{
type:String,
default:''
},
subjectName:{
type:String,
default:''
}
},
data(){
return{
openShow:false,
maintainForm:{
month:this.$dayjs().format('YYYY-MM')
},
tableData:[],
loading:false
}
},
mounted(){
this.openShow = this.showDialog
this.maintainForm.month = this.month ? this.month : this.$dayjs().format('YYYY-MM')
this.getDetail()
},
methods:{
getDetail(){
this.loading = true
detailSubjectFee({
id:this.checkId,
month:this.maintainForm.month
}).then(res =>{
console.log('res---------------------',res)
if(!res.data.data.subjectFeeDetailList || res.data.data.subjectFeeDetailList.length == 0){
this.tableData = []
if(this.title == '维护'){
this.maintainForm = {
month:res.data.data.month,
type:this.subjectName == '辅助人员材料费用' ? '1' : '0',
totalFee:res.data.data.totalFee == -1 ? null : res.data.data.totalFee,
}
this.getWorkCenterData()
}else{
this.maintainForm = {
month:res.data.data.month,
type:res.data.data.type,
totalFee:res.data.data.totalFee == -1 ? null : res.data.data.totalFee,
}
this.getWorkCenterData()
}
}else{
this.maintainForm = {
month:res.data.data.month,
type:res.data.data.type,
totalFee:res.data.data.totalFee,
}
this.tableData = res.data.data.subjectFeeDetailList
this.loading = false
}
})
},
changeMonth(){
this.getDetail()
},
changeType(val){
if(val == 0){
this.maintainForm.totalFee = null
this.tableData.map(item =>{
item.rate = 0
item.fee = 0
})
}else{
this.maintainForm.totalFee = null
this.tableData.map(item =>{
item.fee = 0
})
}
},
changeTotal(val){
if(this.maintainForm.type == 1){
this.tableData.map(item =>{
item.fee = item.rate / 100 * this.maintainForm.totalFee
})
}
},
getWorkCenterData(){
this.loading = true
getWorkCenter().then(res =>{
res.data.data.map(item =>{
this.tableData.push({
workCenterId:item.id,
workCenterName:item.wcName,
rate: this.title == '维护' ? 0 : null,
fee:this.title == '维护' ? 0 : null,
})
})
this.loading = false
})
},
changePrice(val){
console.log('val---------------------',val)
if(this.maintainForm.type == 0){
const totalMoney = this.tableData.reduce((sum, item) => {
// item.money null undefined 0
return sum + (Number(item.fee) || 0);
}, 0);
console.log('totalMoney---------------------',totalMoney)
this.maintainForm.totalFee = totalMoney;
}else{
return
}
},
changeRate(val,row){
console.log('val=============',val)
console.log('row=============',row)
if(this.maintainForm.type == '1'){
row.fee = this.maintainForm.totalFee * (val / 100)
}else{
return
}
},
submitMaintain(){
let params = {
...this.maintainForm,
id:this.checkId,
subjectFeeDetailList:this.tableData,
}
console.log('params---------------------',params)
if(params.type == 1){
const totalRatio = this.tableData.reduce((sum, item) => {
// item.money null undefined 0
return sum + (Number(item.rate) || 0);
}, 0);
if(totalRatio != 100){
this.$message.error('比例总和需为100%,请进行调整')
return
}
}
maintainSubjectFee(params).then(res =>{
console.log('res---------------------',res)
if(res.data.code == 200){
this.$message.success('保存成功')
this.closeDialog(true)
}
})
},
closeDialog(val){
this.openShow = false
this.$emit('closeDialog',val)
},
disabledDate(time) {
//
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth(); // 0-11
//
const targetYear = time.getFullYear();
const targetMonth = time.getMonth(); // 0-11
//
return (targetYear < currentYear) || (targetYear === currentYear && targetMonth < currentMonth);
},
}
}
</script>
<style>
</style>

@ -0,0 +1,212 @@
<template>
<div>
<el-alert
title="维护的物料不进行材料费用计算"
style="margin-bottom: 10px; background: #e6f7ff; border-color: #91d5ff"
show-icon
:closable="false"
>
</el-alert>
<avue-crud
height="calc(352px - 40px)"
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left>
<el-button type="danger" @click="handleDelete">删除</el-button>
</template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入</el-button>
</template>
</avue-crud>
<!-- 导入 -->
<basic-import
v-if="isShowImport"
title="导入"
:isShow="isShowImport"
templateUrl="/blade-desk/costCalculationGoods/importTemplate"
templateName="成本-物料维护模板.xls"
importUrl="/blade-desk/costCalculationGoods/import"
@closeDialog="closeDialog"
></basic-import>
</div>
</template>
<script>
import {getMaterialList,deleteMaterial} from "@/api/costManagement/costConfiguration"
import basicImport from '@/components/basic-import/main.vue';
export default {
components:{
basicImport
},
data(){
return{
loading:false,
isShowImport:false,
data:[],
form:{},
query:{},
page:{
pageSize:10,
currentPage:1,
total:0,
},
selectionList:[],
option: {
height: 'auto',
calcHeight: 32,
tip: false,
simplePage: true,
searchShow: true,
searchMenuSpan: 12,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: true,
viewBtn: false,
delBtn: false,
addBtn: false,
editBtn: false,
editBtnText: '修改',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
viewBtnText: '详情',
labelWidth: 120,
searchLabelWidth: "auto",
menuWidth: 100,
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
columnSort: true,
excelBtn: true,
columnSort: true,
index: false,
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
menu:false,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
align: 'center',
column: [
{
label:"物料编号",
prop:"goodsCode",
search:true
},
{
label:"物料名称",
prop:"goodsName",
search:true
},
{
label:"维护人",
prop:"updateUserName",
},
{
label:"维护时间",
prop:"updateTime",
}
],
},
}
},
created(){
},
methods:{
searchChange(params, done){
this.query = params;
this.page.currentPage = 1
this.onLoad()
done()
},
searchReset(){
this.query = {}
this.onLoad()
},
selectionChange(list){
this.selectionList = list
},
currentChange(currentPage){
this.page.currentPage = currentPage
},
sizeChange(pageSize){
this.page.pageSize = pageSize
},
refreshChange(){
this.onLoad()
},
handleDelete(){
if (this.selectionList.length == 0) {
this.$message.error('请先选择数据');
return;
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(res => {
deleteMaterial({
ids:this.selectionList.map(item => item.id).join(',')
}).then(res =>{
if(res.data.code == 200){
this.$message.success('删除成功')
this.onLoad()
}
})
});
},
handleImport(){
this.isShowImport = true
},
closeDialog(val){
this.isShowImport = false
if(val){
this.onLoad()
}
},
onLoad(){
this.loading = true
getMaterialList({
current:this.page.currentPage,
size:this.page.pageSize,
...this.query
}).then(res =>{
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
},
}
}
</script>
<style>
</style>

@ -0,0 +1,318 @@
<template>
<div>
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left>
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="danger" @click="handleDelete">删除</el-button>
</template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入</el-button>
</template>
<template #menu="scope">
<el-button
type="text"
v-if="tabPosition == 'processMaintenance'"
@click="maintainProcess(scope.row)"
>维护</el-button
>
<el-button
type="text"
v-if="tabPosition == 'processMaintenance'"
@click="deleteRow(scope.row)"
>删除</el-button
>
</template>
</avue-crud>
<batchAddProcess
v-if="showDialog"
:title="title"
:showDialog="showDialog"
:moldAddMore="moldAddMore"
@closeDialog="closeDialog"
></batchAddProcess>
<!-- 导入 -->
<basic-import
v-if="isShowImport"
title="导入"
:isShow="isShowImport"
templateUrl="/blade-desk/costCalculationProcess/importTemplate"
templateName="成本-工序维护模板.xls"
importUrl="/blade-desk/costCalculationProcess/import"
@closeDialog="closeDialog"
></basic-import>
</div>
</template>
<script>
import {getCostList,deleteProcess} from "@/api/costManagement/costConfiguration"
import batchAddProcess from './batchAddProcess.vue'
import basicImport from '@/components/basic-import/main.vue';
export default {
components:{
batchAddProcess,
basicImport
},
data(){
return{
form: {},
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
isShowImport:false,
showDialog:false,
title:"",
selectionList:[],
moldAddMore:false,
loading:false,
data:[],
query:{},
option: {
height: 'auto',
calcHeight: 32,
tip: false,
simplePage: true,
searchShow: true,
searchMenuSpan: 12,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: true,
viewBtn: false,
delBtn: false,
addBtn: false,
editBtn: false,
editBtnText: '修改',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
viewBtnText: '详情',
labelWidth: 120,
searchLabelWidth: "auto",
menuWidth: 100,
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
columnSort: true,
excelBtn: true,
columnSort: true,
index: false,
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
menu:false,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
align: 'center',
column: [
{
label: '作业中心',
prop: 'workCenterId',
type: 'select',
search: true,
sortable: true,
overHidden: true,
dicUrl: '/blade-desk/bsWorkCenter/getList',
props: {
label: 'wcName',
value: 'id',
},
rules: [
{
required: true,
message: '请输入作业中心',
trigger: 'blur',
},
],
},
{
label: '工序',
prop: 'processName',
search:false
},
{
label: '工序',
prop: 'processId',
type:"select",
search: true,
sortable: true,
overHidden: true,
hide:true,
remote:true,
// multiple: true,
dicUrl:"/api/blade-desk/bsProcessSet/list?current=1&size=300&name={{key}}",
props:{
label:"name",
value:"id",
res:'data.records'
},
rules: [
{
required: true,
message: '请输入工序',
trigger: 'blur',
},
],
},
{
label: '计算方式',
prop: 'type',
type:'select',
search: false,
sortable: true,
overHidden: true,
rules: [
{
required: true,
message: '请输入计算方式',
trigger: 'blur',
},
],
dicData:[
{label:'面积',value:'0'},
{label:'体积',value:'1'},
]
},
{
label: '维护人',
prop: 'updateUserName',
search: false,
sortable: true,
overHidden: true,
rules: [
{
required: true,
message: '请输入维护人',
trigger: 'blur',
},
],
},
{
label: '维护时间',
prop: 'updateTime',
search: false,
sortable: true,
overHidden: true,
rules: [
{
required: true,
message: '请输入维护时间',
trigger: 'blur',
},
],
},
],
},
}
},
created(){
},
methods:{
handleImport(){
this.isShowImport = true
},
searchChange(params, done){
this.query = params;
this.page.currentPage = 1
this.onLoad()
done()
},
searchReset(){
this.query = {}
this.onLoad()
},
selectionChange(list){
this.selectionList = list
},
currentChange(currentPage){
this.page.currentPage = currentPage
},
sizeChange(pageSize){
this.page.pageSize = pageSize
},
refreshChange(){
this.onLoad()
},
handleAdd(){
this.title = '新增'
this.moldAddMore = true
this.showDialog = true
},
handleDelete(){
if (this.selectionList.length == 0) {
this.$message.error('请先选择数据');
return;
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(res => {
deleteProcess({
ids:this.selectionList.map(item=>item.id).join(',')
}).then(res =>{
if(res.data.code == 200){
this.$message.success('删除成功')
this.onLoad()
}
})
});
},
closeDialog(val){
this.showDialog = false
this.isShowImport = false
if(val){
this.onLoad()
}
},
onLoad(){
this.loading = true
getCostList({
current:this.page.currentPage,
size:this.page.pageSize,
...this.query
}).then(res =>{
res.data.data.records.map(item =>{
item.processId = item.processId + ''
})
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
}
}
}
</script>
<style>
</style>

@ -3,16 +3,12 @@
<!-- 成本计算配置 -->
<el-tabs v-model="tabPosition" class="demo-tabs" @tab-change="tabPositionChange">
<el-tab-pane label="工序维护" name="processMaintenance"></el-tab-pane>
<el-tab-pane label="物料维护" name="materialMaintenance">
<el-alert
title="维护的物料不进行材料费用计算"
style="margin-bottom: 10px; background: #e6f7ff; border-color: #91d5ff"
show-icon
>
</el-alert>
</el-tab-pane>
<el-tab-pane label="物料维护" name="materialMaintenance"></el-tab-pane>
</el-tabs>
<avue-crud
<processMaintenance v-if="tabPosition == 'processMaintenance'"></processMaintenance>
<materialMaintenance v-if="tabPosition == 'materialMaintenance'"></materialMaintenance>
<!-- <avue-crud
:option="option"
:table-loading="loading"
:data="data"
@ -108,7 +104,7 @@
</el-table-column>
<el-table-column align="center" label="物料名称" prop="goodsName"></el-table-column>
</el-table>
</el-dialog>
</el-dialog> -->
<!-- 导入 -->
<basic-import
@ -126,9 +122,13 @@
<script>
import costColumnData from './js/costColumnData';
import basicImport from '@/components/basic-import/main.vue';
import processMaintenance from './components/processMaintenance.vue';
import materialMaintenance from './components/materialMaintenance.vue';
export default {
components: {
basicImport,
processMaintenance,
materialMaintenance
},
data() {
return {

@ -8,8 +8,6 @@
v-model="form"
v-model:page="page"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@ -29,8 +27,8 @@
</template>
<template #menu="scope">
<el-button type="text" @click="viewRow(scope.row)">详情</el-button>
<el-button type="text" @click="maintainRow(scope.row)">维护</el-button>
<el-button type="primary" text @click="viewRow(scope.row)">详情</el-button>
<el-button type="primary" text @click="maintenanceRow(scope.row)">维护</el-button>
</template>
</avue-crud>
<el-dialog
@ -57,7 +55,7 @@
append-to-body
:title="title"
:model-value="showMaintain"
@update:model-value="val => (showMaintain = val)"
@close="showMaintain = false"
>
<el-form :inline="true" :model="maintainForm" ref="maintainForm" :rules="maintainRules">
<el-form-item label="月份" prop="month">
@ -96,7 +94,6 @@
controls-position="right"
:min="0"
:max="100"
@change="(val) => changeRatio(val,scope.row)"
:disabled="title == '详情' || maintainForm.distributeType == 1"
></el-input-number>
</template>
@ -106,9 +103,8 @@
<el-input-number
v-model="scope.row.money"
controls-position="right"
:min="1"
:min="0"
:disabled="title == '详情' || maintainForm.distributeType == 2"
@change="changePrice"
></el-input-number>
</template>
</el-table-column>
@ -116,7 +112,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="showMaintain = false"> </el-button>
<el-button v-if="title == '维护'" type="primary" @click="submitMaintain"> </el-button>
<el-button v-if="title == '维护'" type="primary" @click="submitMaintain"> </el-button>
</span>
</template>
</el-dialog>
@ -158,24 +154,41 @@
</span>
</template>
</el-dialog>
<maintenaceCost
v-if="showDialog"
:showDialog="showDialog"
:title="maintenceTitle"
:checkId="checkId"
:month="month"
:subjectName="subjectName"
@closeDialog="closeDialog"
></maintenaceCost>
</basic-container>
</template>
<script>
import {getList,addSubjectFee,delSubjectFee} from '@/api/costManagement/subjectFeeMaintenance'
import basicImport from '@/components/basic-import/main.vue';
import maintenaceCost from "./components/maintenanceCost.vue"
export default {
components: {
basicImport,
maintenaceCost
},
data() {
return {
isShowImport: false,
data: [],
form: {},
query:{},
distributeType: '',
loading: false,
showAdd: false,
title: '详情',
subjectName:'',
showDialog:false,
checkId:'',
maintenceTitle:"",
tableData: [],
addForm: {},
selectionList: [],
@ -201,6 +214,7 @@ export default {
currentPage: 1,
total: 0,
},
month:'',
option: {
height: 'auto',
calcHeight: 32,
@ -214,6 +228,7 @@ export default {
border: true,
index: true,
selection: true,
selectable: (row, index) => row.subjectName != '辅助人员材料费用',
viewBtn: false,
delBtn: false,
addBtn: false,
@ -252,7 +267,7 @@ export default {
column: [
{
label: '费用科目',
prop: 'expenseAccount',
prop: 'subjectName',
search: true,
sortable: true,
overHidden: true,
@ -263,12 +278,20 @@ export default {
trigger: 'blur',
},
],
minWidth:100
},
{
label:"费用时间",
prop: 'month',
sortable: true,
minWidth:100
},
{
label: '分配方式',
prop: 'distributeType',
prop: 'type',
type: 'select',
search: false,
minWidth:100,
sortable: true,
overHidden: true,
rules: [
@ -279,16 +302,17 @@ export default {
},
],
dicData: [
{ label: '按金额', value: '1' },
{ label: '按比例', value: '2' },
{ label: '按金额', value: '0' },
{ label: '按比例', value: '1' },
],
},
{
label: '费用总金额(元)',
prop: 'totalCost',
prop: 'totalFee',
search: false,
sortable: true,
overHidden: true,
minWidth:100,
rules: [
{
required: true,
@ -299,7 +323,8 @@ export default {
},
{
label: '操作人',
prop: 'createUser',
prop: 'updateUserName',
minWidth:100,
search: false,
sortable: true,
overHidden: true,
@ -314,6 +339,7 @@ export default {
{
label: '更新时间',
prop: 'updateTime',
minWidth:100,
search: false,
sortable: true,
overHidden: true,
@ -331,47 +357,16 @@ export default {
},
mounted() {},
methods: {
disabledDate(time) {
//
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth(); // 0-11
//
const targetYear = time.getFullYear();
const targetMonth = time.getMonth(); // 0-11
//
return (targetYear < currentYear) || (targetYear === currentYear && targetMonth < currentMonth);
},
changeType(val){
console.log('val---------------------',val)
if(val == 1){
this.tableData.map(item =>{
item.ratio = 0
item.ratio = null
})
}
},
changePrice(val){
console.log('val---------------------',val)
if(this.maintainForm.distributeType == 1){
const totalMoney = this.tableData.reduce((sum, item) => {
// item.money null undefined 0
return sum + (Number(item.money) || 0);
}, 0);
this.maintainForm.totalCost = totalMoney;
}else{
return
}
},
changeRatio(val,row){
console.log('val=============',val)
console.log('row=============',row)
if(this.maintainForm.distributeType == '2'){
row.money = this.maintainForm.totalCost * (val / 100)
}else{
return
this.tableData.map(item =>{
item.money = null
})
}
},
//
@ -382,6 +377,25 @@ export default {
selectionChange(val) {
this.selectionList = val;
},
searchChange(params, done){
this.query = params;
this.page.currentPage = 1
this.onLoad()
done()
},
searchReset(){
this.query = {}
this.onLoad()
},
currentChange(currentPage){
this.page.currentPage = currentPage
},
sizeChange(pageSize){
this.page.pageSize = pageSize
},
refreshChange(){
this.onLoad()
},
//
handleDelete() {
if (this.selectionList.length == 0) {
@ -392,17 +406,36 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(res => {});
}).then(res => {
delSubjectFee({
ids:this.selectionList.map(item => item.id).join(',')
}).then(res =>{
if(res.data.code == 200){
this.$message.success('删除成功')
this.onLoad()
}
})
});
},
//
handleAdd() {
this.addForm = {}
this.showAdd = true;
},
//
submitAdd() {
this.$refs.addForm.validate(valid => {
if (valid) {
this.showAdd = false;
// this.showAdd = false;
addSubjectFee({
subjectName:this.addForm.expenseAccount
}).then(res =>{
if(res.data.code == 200){
this.$message.success('新增成功')
this.showAdd = false
this.onLoad()
}
})
}
});
},
@ -410,28 +443,57 @@ export default {
submitMaintain() {
this.$refs.maintainForm.validate(valid => {
if (valid) {
if(this.maintainForm.distributeType == 2){
const totalRatio = this.tableData.reduce((sum, item) => {
// item.money null undefined 0
return sum + (Number(item.ratio) || 0);
}, 0);
if(totalRatio != 100){
this.$message.error('比例总和需为100%,请进行调整')
return
}
}
this.showMaintain = false;
}
});
},
//
viewRow(row) {
this.title = '详情';
this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() };
this.tableData = row.tableData;
this.showMaintain = true;
this.maintenceTitle = '详情'
this.checkId = row.id
this.month = row.month
console.log('111111111111')
this.showDialog = true
// this.title = '';
// this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() };
// this.tableData = row.tableData;
// this.showMaintain = true;
},
//
maintainRow(row) {
this.title = '维护';
this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() };
this.tableData = row.tableData;
if(this.maintainForm.distributeType == 1){
this.tableData.map(item =>{
item.ratio = 0
})
maintenanceRow(row) {
this.maintenceTitle = '维护'
this.checkId = row.id
this.subjectName = row.subjectName
this.month = row.month
console.log('111111111111')
this.showDialog = true
// this.title = '';
// this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() };
// this.tableData = row.tableData;
// if(this.maintainForm.distributeType == 1){
// this.tableData.map(item =>{
// item.ratio = 0
// })
// }
// this.showMaintain = true;
},
closeDialog(val){
this.showDialog = false
if(val){
this.onLoad()
}
this.showMaintain = true;
},
//
getCurrentMonth() {
@ -497,47 +559,16 @@ export default {
}, 2000);
},
onLoad() {
this.data = [
{
id: 1,
expenseAccount: '房租补贴',
distributeType: '1',
totalCost: 1000,
createUser: '张三',
updateTime: '2016-09-21 08:50:08',
tableData: [
{ workCenter: '作业中心一', ratio: 40, money: 400 },
{ workCenter: '作业中心二', ratio: 30, money: 300 },
{ workCenter: '作业中心三', ratio: 30, money: 300 },
],
},
{
id: 2,
expenseAccount: '电话费',
distributeType: '2',
totalCost: 1000,
createUser: '张三',
updateTime: '2016-09-21 08:50:08',
tableData: [
{ workCenter: '作业中心一', ratio: 20, money: 200 },
{ workCenter: '作业中心二', ratio: 50, money: 500 },
{ workCenter: '作业中心三', ratio: 30, money: 300 },
],
},
{
id: 3,
expenseAccount: '差旅费',
distributeType: '1',
totalCost: 1000,
createUser: '张三',
updateTime: '2016-09-21 08:50:08',
tableData: [
{ workCenter: '作业中心一', ratio: 15, money: 150 },
{ workCenter: '作业中心二', ratio: 35, money: 350 },
{ workCenter: '作业中心三', ratio: 50, money: 500 },
],
},
];
this.loading = true
getList({
current:this.page.currentPage,
size:this.page.pageSize,
...this.query
}).then(res =>{
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
},
},
};

@ -1,28 +1,16 @@
<template>
<basic-container>
<!-- 成本统计 -->
<el-form :inline="true" :model="searchForm">
<el-form-item label="月份">
<el-date-picker v-model="searchForm.monthDate" type="month" placeholder="选择月" required>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary">查询</el-button>
<!-- <el-button type="primary">分派</el-button>
<el-button type="primary">保存</el-button> -->
</el-form-item>
</el-form>
<el-row>
<el-col :span="20">
<div style="width:100%;height:100%;display:flex;justify-content:space-between;">
<div style="width:80%;height:100%;">
<avue-crud
@current-row-change="handleCurrentRowChange"
:row-class-name="tableRowClassName"
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@ -32,85 +20,94 @@
@on-load="onLoad"
>
<template #menu-left>
<el-button type="primary" @click="openCostCalcDialog">成本计算</el-button>
<!-- <el-button type="primary" @click="isLockClick">锁定/解锁</el-button> -->
<el-button type="primary" @click="handleCost">成本计算</el-button>
<el-button type="danger" @click="handleDelete">删除</el-button>
</template>
<template #menu-right>
<el-button type="primary">导出</el-button>
<el-button type="primary" @click="handleExport">导出</el-button>
</template>
<!-- <template #wcCode="{ row }">{{ row.saCostConfig.bsWorkCenter.wcCode }}</template>
<template #wcName="{ row }">{{ row.saCostConfig.bsWorkCenter.wcName }}</template> -->
</avue-crud>
</el-col>
<el-col :span="4">
</div>
<div style="width:19%;height:100%;padding-top: 80px;">
<avue-crud
:option="detailsOption"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
style="margin-top: 30px; margin-left: 12px"
:option="detailOption"
:table-loading="detailLoading"
:data="detailData"
v-model="detailForm"
ref="detailCrud"
@current-change="detailCurrentChange"
@size-change="detailSizeChange"
@refresh-change="detailRefreshChange"
></avue-crud>
</el-col>
</el-row>
<el-dialog
:modelValue="openShow"
title="提示"
width="400px"
:close-on-click-modal="false"
class="cost-confirm-dialog"
>
<div class="dialog-content">
<i class="el-icon-warning"></i>
<p>
<span class="month-highlight">{{ selectMonth }}</span
>月已计算成本是否重新计算
</p>
</div>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleRecalculate">重新计算</el-button>
<el-button @click="CloseDialog">取消</el-button>
</div>
</template>
</el-dialog>
<el-dialog
:modelValue="openShow"
title="成本计算"
width="400px"
:close-on-click-modal="false"
class="cost-confirm-dialog"
>
<el-form ref="costForm" :model="costForm" :rules="costRules">
<el-form-item label="月份" prop="month">
<el-date-picker
style="width:100%;"
type="month"
:disabled="disabled"
v-model="costForm.month"
format="YYYY-MM"
value-format="YYYY-MM"
:clearable="false"
></el-date-picker>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :disabled="disabled" @click="openShow = false">取消</el-button>
<el-button :disabled="disabled" type="primary" @click="handleRecalculate">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</basic-container>
</template>
<script>
import {getList,deleteTable,verifyTable,calculateTable,exportData,getDetail} from "@/api/costManagement/costStatistics"
import { tr } from 'element-plus/es/locales.mjs'
export default {
data() {
return {
openShow: false,
searchForm: {},
loading: false,
data: [],
form: {},
selectionList: [],
page: {
data(){
return{
loading:false,
openShow:false,
data:[],
form:{},
query:{},
page:{
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
detailLoading:false,
detailData:[],
detailForm:{},
detailPage:{
pageSize: 10,
currentPage: 1,
total: 0,
},
costForm:{},
costRules:{
month:{required:true,message:'请选择月份',trigger:'change'}
},
disabled:false,
selectionList:[],
option:{
height: 'auto',
calcHeight: 32,
tip: false,
simplePage: true,
searchShow: true,
searchMenuSpan: 6,
searchMenuSpan: 18,
searchIcon: true,
searchIndex: 3,
tree: false,
@ -124,7 +121,7 @@ export default {
editBtnText: '修改',
viewBtnText: '详情',
labelWidth: 120,
searchLabelWidth: 120,
searchLabelWidth: "auto",
menu: false,
menuWidth: 220,
dialogWidth: 1200,
@ -137,6 +134,7 @@ export default {
excelBtn: true,
columnSort: true,
index: false,
highlightCurrentRow:true, //
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchGutter: 24,
@ -149,11 +147,10 @@ export default {
delBtnIcon: ' ',
editBtnIcon: ' ',
align: 'center',
column: [
{
label: '作业中心',
prop: 'wcName',
prop: 'workCenterName',
search: false,
sortable: false,
overHidden: true,
@ -161,31 +158,35 @@ export default {
{
label: '月份',
prop: 'month',
search: false,
type:"month",
format:"YYYY-MM",
valueFormat:"YYYY-MM",
search: true,
sortable: false,
overHidden: true,
width:80,
},
{
label: '制造费用(元)',
prop: 'drainCosts',
prop: 'productCost',
search: false,
sortable: false,
overHidden: true,
width: 100,
width: 95,
},
{
label: '作业中心材料费用(元)',
prop: 'materialCosts',
prop: 'workCenterMaterialCost',
search: false,
sortable: false,
overHidden: true,
width: 160,
width: 140,
},
{
label: '辅助人员材料费用(元)',
prop: 'materialCosts1',
prop: 'assistantMaterialCost',
search: false,
width: 160,
width: 140,
sortable: false,
overHidden: true,
},
@ -195,33 +196,32 @@ export default {
search: false,
sortable: false,
overHidden: true,
width: 120,
width: 100,
},
{
label: '月度产出(dm²)',
prop: 'monthlyOutput',
prop: 'monthOutputArea',
search: false,
width: 120,
sortable: false,
overHidden: true,
},
{
label: '月度产出(v)',
prop: 'volumeOutput2',
prop: 'monthOutputVolume',
search: false,
sortable: false,
overHidden: true,
},
],
},
detailsOption: {
detailOption:{
height: 'auto',
calcHeight: 32,
tip: false,
size: 'medium',
simplePage: true,
searchShow: true,
searchMenuSpan: 6,
searchMenuSpan: 18,
searchIcon: true,
searchIndex: 3,
tree: false,
@ -235,7 +235,7 @@ export default {
editBtnText: '修改',
viewBtnText: '详情',
labelWidth: 120,
searchLabelWidth: 120,
searchLabelWidth: 'auto',
menu: false,
menuWidth: 220,
dialogWidth: 1200,
@ -267,75 +267,255 @@ export default {
column: [
{
label: '类型',
prop: 'wcCode',
prop: 'subjectName',
search: false,
sortable: false,
overHidden: true,
},
{
label: '金额',
prop: 'wcCode1',
prop: 'fee',
search: false,
sortable: false,
overHidden: true,
},
],
},
};
}
}
},
mounted() {},
methods: {
openCostCalcDialog() {
this.openShow = true;
},
CloseDialog() {
this.openShow = false;
},
handleRecalculate() {
this.$message.success('重新计算成功');
this.openShow = false;
},
selectionChange(val) {
this.selectionList = val;
},
isLockClick() {
if (this.selectionList.length == 0) {
this.$message.error('请先选择数据');
created(){
},
methods:{
handleCurrentRowChange(row){
if (!row) {
this.detailData = [];
return;
}
this.detailLoading = true;
getDetail({
month: row.month,
workCenterId: row.workCenterId
}).then(res => {
if (res.data.code === 200) {
this.detailData = res.data.data || [];
}
}).finally(() => {
this.detailLoading = false;
});
},
handleCost(){
this.costForm.month = this.$dayjs().format('YYYY-MM');
this.openShow = true
},
//
handleDelete() {
if (this.selectionList.length == 0) {
this.$message.error('请先选择数据');
this.$message.error("请先选择数据");
return;
}
this.$confirm('确定将选择数据删除?', {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
deleteTable({
ids:this.selectionList.map(item=>item.id).join(',')
}).then(res =>{
if(res.data.code == 200){
this.$message.success('删除成功')
this.onLoad()
}
})
});
},
handleExport() {
this.$confirm('是否导出数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {});
}).then(() => {
// this.loading = true;
exportData({ month: this.query.month }).then(res => {
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '成本统计.xlsx';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
this.$message.success('导出成功');
this.loading = false;
}).catch(() => {
this.loading = false;
});
});
},
onLoad() {
this.data = [
{
id: 1,
wcName: '作业中心1',
month: '2025-3',
materialCosts: 99,
materialCosts1: 0,
unitCost: '89',
monthlyOutput: 0,
volumeOutput: '9',
drainCosts: '99',
volumeOutput2: '90',
wcCode: '类型1',
wcCode1: '4',
},
];
handleRecalculate(){
this.$refs.costForm.validate((valid) =>{
if(valid){
console.log('1111111111111111')
// this.$message.success('')
verifyTable({
month:this.costForm.month
}).then(res =>{
if(res.data.code == 200){
if(res.data.msg != '操作成功'){
this.$confirm(res.data.msg, {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.disabled = true
calculateTable({
month:this.costForm.month
}).then(res =>{
if(res.data.code == 200){
this.$message.success('计算成功')
this.openShow = false
this.disabled = false
this.onLoad()
}
})
})
}else{
calculateTable({
month:this.costForm.month
}).then(res =>{
if(res.data.code == 200){
this.$message.success('计算成功')
this.openShow = false
this.onLoad()
}
})
}
}
})
}
})
},
},
};
searchChange(params, done){
this.query = params;
this.page.currentPage = 1;
this.onLoad()
done();
},
searchReset(){
this.query = {}
this.onLoad()
},
selectionChange(list){
this.selectionList = list;
},
currentChange(currentPage){
this.page.currentPage = currentPage;
},
sizeChange(pageSize){
this.page.pageSize = pageSize;
},
refreshChange(){
this.onLoad()
},
onLoad(){
this.loading = true
getList({
current:this.page.currentPage,
size:this.page.pageSize,
...this.query
}).then(res =>{
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
//
this.$nextTick(() => {
if (this.data.length > 0 && this.$refs.crud) {
this.detailLoading = true
getDetail({
month:this.data[0].month,
workCenterId:this.data[0].workCenterId
}).then(res =>{
console.log('res---------',res)
this.detailData = res.data.data
this.$refs.crud.setCurrentRow(this.data[0]);
// this.handleCurrentRowChange(this.data[0]);
this.detailLoading = false
})
// this.detailData = [
// {wcCode:"001",wcCode1:32},
// {wcCode:"001",wcCode1:32},
// ]
// this.detailPage.total = this.detailData.length;
}
});
})
// this.data = [
// {
// id: 1,
// wcName: '1',
// month: '2025-3',
// materialCosts: 99,
// materialCosts1: 0,
// unitCost: '89',
// monthlyOutput: 0,
// volumeOutput: '9',
// drainCosts: '99',
// volumeOutput2: '90',
// wcCode: '1',
// wcCode1: '4',
// },
// {
// id: 2,
// wcName: '2',
// month: '2025-3',
// materialCosts: 99,
// materialCosts1: 0,
// unitCost: '89',
// monthlyOutput: 0,
// volumeOutput: '9',
// drainCosts: '99',
// volumeOutput2: '90',
// wcCode: '1',
// wcCode1: '4',
// },
// ];
// //
// this.$nextTick(() => {
// if (this.data.length > 0 && this.$refs.crud) {
// this.$refs.crud.setCurrentRow(this.data[0]);
// this.handleCurrentRowChange(this.data[0]);
// this.detailData = [
// {wcCode:"001",wcCode1:32},
// {wcCode:"001",wcCode1:32},
// ]
// this.detailPage.total = this.detailData.length;
// }
// });
// this.page.total = this.data.length;
},
}
}
</script>
<style></style>
<style scoped lang="scss">
::v-deep .el-card__body{
height: 100% !important;
}
::v-deep .el-table__row.current-row {
background-color: yellow !important; /* 这里替换为你想要的颜色,例如浅蓝色 */
}
// 2. ()
//
::v-deep .el-table__row.current-row:hover > td {
background-color: yellow !important; /* 比选中色稍深一点的颜色 */
}
// 3. ()
::v-deep .el-table__row.current-row td {
background-color: yellow !important;
}
</style>
Loading…
Cancel
Save