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

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

@ -8,8 +8,6 @@
v-model="form" v-model="form"
v-model:page="page" v-model:page="page"
ref="crud" ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@selection-change="selectionChange" @selection-change="selectionChange"
@ -29,8 +27,8 @@
</template> </template>
<template #menu="scope"> <template #menu="scope">
<el-button type="text" @click="viewRow(scope.row)">详情</el-button> <el-button type="primary" text @click="viewRow(scope.row)">详情</el-button>
<el-button type="text" @click="maintainRow(scope.row)">维护</el-button> <el-button type="primary" text @click="maintenanceRow(scope.row)">维护</el-button>
</template> </template>
</avue-crud> </avue-crud>
<el-dialog <el-dialog
@ -57,7 +55,7 @@
append-to-body append-to-body
:title="title" :title="title"
:model-value="showMaintain" :model-value="showMaintain"
@update:model-value="val => (showMaintain = val)" @close="showMaintain = false"
> >
<el-form :inline="true" :model="maintainForm" ref="maintainForm" :rules="maintainRules"> <el-form :inline="true" :model="maintainForm" ref="maintainForm" :rules="maintainRules">
<el-form-item label="月份" prop="month"> <el-form-item label="月份" prop="month">
@ -96,7 +94,6 @@
controls-position="right" controls-position="right"
:min="0" :min="0"
:max="100" :max="100"
@change="(val) => changeRatio(val,scope.row)"
:disabled="title == '详情' || maintainForm.distributeType == 1" :disabled="title == '详情' || maintainForm.distributeType == 1"
></el-input-number> ></el-input-number>
</template> </template>
@ -106,9 +103,8 @@
<el-input-number <el-input-number
v-model="scope.row.money" v-model="scope.row.money"
controls-position="right" controls-position="right"
:min="1" :min="0"
:disabled="title == '详情' || maintainForm.distributeType == 2" :disabled="title == '详情' || maintainForm.distributeType == 2"
@change="changePrice"
></el-input-number> ></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
@ -116,7 +112,7 @@
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="showMaintain = false"> </el-button> <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> </span>
</template> </template>
</el-dialog> </el-dialog>
@ -158,24 +154,41 @@
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<maintenaceCost
v-if="showDialog"
:showDialog="showDialog"
:title="maintenceTitle"
:checkId="checkId"
:month="month"
:subjectName="subjectName"
@closeDialog="closeDialog"
></maintenaceCost>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import {getList,addSubjectFee,delSubjectFee} from '@/api/costManagement/subjectFeeMaintenance'
import basicImport from '@/components/basic-import/main.vue'; import basicImport from '@/components/basic-import/main.vue';
import maintenaceCost from "./components/maintenanceCost.vue"
export default { export default {
components: { components: {
basicImport, basicImport,
maintenaceCost
}, },
data() { data() {
return { return {
isShowImport: false, isShowImport: false,
data: [], data: [],
form: {}, form: {},
query:{},
distributeType: '', distributeType: '',
loading: false, loading: false,
showAdd: false, showAdd: false,
title: '详情', title: '详情',
subjectName:'',
showDialog:false,
checkId:'',
maintenceTitle:"",
tableData: [], tableData: [],
addForm: {}, addForm: {},
selectionList: [], selectionList: [],
@ -201,6 +214,7 @@ export default {
currentPage: 1, currentPage: 1,
total: 0, total: 0,
}, },
month:'',
option: { option: {
height: 'auto', height: 'auto',
calcHeight: 32, calcHeight: 32,
@ -214,6 +228,7 @@ export default {
border: true, border: true,
index: true, index: true,
selection: true, selection: true,
selectable: (row, index) => row.subjectName != '辅助人员材料费用',
viewBtn: false, viewBtn: false,
delBtn: false, delBtn: false,
addBtn: false, addBtn: false,
@ -252,7 +267,7 @@ export default {
column: [ column: [
{ {
label: '费用科目', label: '费用科目',
prop: 'expenseAccount', prop: 'subjectName',
search: true, search: true,
sortable: true, sortable: true,
overHidden: true, overHidden: true,
@ -263,12 +278,20 @@ export default {
trigger: 'blur', trigger: 'blur',
}, },
], ],
minWidth:100
},
{
label:"费用时间",
prop: 'month',
sortable: true,
minWidth:100
}, },
{ {
label: '分配方式', label: '分配方式',
prop: 'distributeType', prop: 'type',
type: 'select', type: 'select',
search: false, search: false,
minWidth:100,
sortable: true, sortable: true,
overHidden: true, overHidden: true,
rules: [ rules: [
@ -279,16 +302,17 @@ export default {
}, },
], ],
dicData: [ dicData: [
{ label: '按金额', value: '1' }, { label: '按金额', value: '0' },
{ label: '按比例', value: '2' }, { label: '按比例', value: '1' },
], ],
}, },
{ {
label: '费用总金额(元)', label: '费用总金额(元)',
prop: 'totalCost', prop: 'totalFee',
search: false, search: false,
sortable: true, sortable: true,
overHidden: true, overHidden: true,
minWidth:100,
rules: [ rules: [
{ {
required: true, required: true,
@ -299,7 +323,8 @@ export default {
}, },
{ {
label: '操作人', label: '操作人',
prop: 'createUser', prop: 'updateUserName',
minWidth:100,
search: false, search: false,
sortable: true, sortable: true,
overHidden: true, overHidden: true,
@ -314,6 +339,7 @@ export default {
{ {
label: '更新时间', label: '更新时间',
prop: 'updateTime', prop: 'updateTime',
minWidth:100,
search: false, search: false,
sortable: true, sortable: true,
overHidden: true, overHidden: true,
@ -331,47 +357,16 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { 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){ changeType(val){
console.log('val---------------------',val) console.log('val---------------------',val)
if(val == 1){ if(val == 1){
this.tableData.map(item =>{ 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{ }else{
return this.tableData.map(item =>{
item.money = null
})
} }
}, },
// //
@ -382,6 +377,25 @@ export default {
selectionChange(val) { selectionChange(val) {
this.selectionList = 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() { handleDelete() {
if (this.selectionList.length == 0) { if (this.selectionList.length == 0) {
@ -392,17 +406,36 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', 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() { handleAdd() {
this.addForm = {}
this.showAdd = true; this.showAdd = true;
}, },
// //
submitAdd() { submitAdd() {
this.$refs.addForm.validate(valid => { this.$refs.addForm.validate(valid => {
if (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() { submitMaintain() {
this.$refs.maintainForm.validate(valid => { this.$refs.maintainForm.validate(valid => {
if (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; this.showMaintain = false;
} }
}); });
}, },
// //
viewRow(row) { viewRow(row) {
this.title = '详情'; this.maintenceTitle = '详情'
this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() }; this.checkId = row.id
this.tableData = row.tableData; this.month = row.month
this.showMaintain = true; 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) { maintenanceRow(row) {
this.title = '维护'; this.maintenceTitle = '维护'
this.maintainForm = { ...row, month: row.month || this.getCurrentMonth() }; this.checkId = row.id
this.tableData = row.tableData; this.subjectName = row.subjectName
if(this.maintainForm.distributeType == 1){ this.month = row.month
this.tableData.map(item =>{ console.log('111111111111')
item.ratio = 0 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() { getCurrentMonth() {
@ -497,47 +559,16 @@ export default {
}, 2000); }, 2000);
}, },
onLoad() { onLoad() {
this.data = [ this.loading = true
{ getList({
id: 1, current:this.page.currentPage,
expenseAccount: '房租补贴', size:this.page.pageSize,
distributeType: '1', ...this.query
totalCost: 1000, }).then(res =>{
createUser: '张三', this.data = res.data.data.records
updateTime: '2016-09-21 08:50:08', this.page.total = res.data.data.total
tableData: [ this.loading = false
{ 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 },
],
},
];
}, },
}, },
}; };

@ -1,28 +1,16 @@
<template> <template>
<basic-container> <basic-container>
<!-- 成本统计 --> <div style="width:100%;height:100%;display:flex;justify-content:space-between;">
<el-form :inline="true" :model="searchForm"> <div style="width:80%;height:100%;">
<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">
<avue-crud <avue-crud
@current-row-change="handleCurrentRowChange"
:row-class-name="tableRowClassName"
:option="option" :option="option"
:table-loading="loading" :table-loading="loading"
:data="data" :data="data"
v-model="form" v-model="form"
v-model:page="page" v-model:page="page"
ref="crud" ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@selection-change="selectionChange" @selection-change="selectionChange"
@ -32,85 +20,94 @@
@on-load="onLoad" @on-load="onLoad"
> >
<template #menu-left> <template #menu-left>
<el-button type="primary" @click="openCostCalcDialog">成本计算</el-button> <el-button type="primary" @click="handleCost">成本计算</el-button>
<!-- <el-button type="primary" @click="isLockClick">锁定/解锁</el-button> -->
<el-button type="danger" @click="handleDelete">删除</el-button> <el-button type="danger" @click="handleDelete">删除</el-button>
</template> </template>
<template #menu-right> <template #menu-right>
<el-button type="primary">导出</el-button> <el-button type="primary" @click="handleExport">导出</el-button>
</template> </template>
<!-- <template #wcCode="{ row }">{{ row.saCostConfig.bsWorkCenter.wcCode }}</template>
<template #wcName="{ row }">{{ row.saCostConfig.bsWorkCenter.wcName }}</template> -->
</avue-crud> </avue-crud>
</el-col> </div>
<el-col :span="4"> <div style="width:19%;height:100%;padding-top: 80px;">
<avue-crud <avue-crud
:option="detailsOption" :option="detailOption"
:table-loading="loading" :table-loading="detailLoading"
:data="data" :data="detailData"
v-model="form" v-model="detailForm"
v-model:page="page" ref="detailCrud"
ref="crud" @current-change="detailCurrentChange"
@row-update="rowUpdate" @size-change="detailSizeChange"
@row-save="rowSave" @refresh-change="detailRefreshChange"
@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"
></avue-crud> ></avue-crud>
</el-col> </div>
</el-row>
<el-dialog <el-dialog
:modelValue="openShow" :modelValue="openShow"
title="提示" title="成本计算"
width="400px" width="400px"
:close-on-click-modal="false" :close-on-click-modal="false"
class="cost-confirm-dialog" class="cost-confirm-dialog"
> >
<div class="dialog-content"> <el-form ref="costForm" :model="costForm" :rules="costRules">
<i class="el-icon-warning"></i> <el-form-item label="月份" prop="month">
<p> <el-date-picker
<span class="month-highlight">{{ selectMonth }}</span style="width:100%;"
>月已计算成本是否重新计算 type="month"
</p> :disabled="disabled"
</div> v-model="costForm.month"
format="YYYY-MM"
value-format="YYYY-MM"
:clearable="false"
></el-date-picker>
</el-form-item>
</el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="handleRecalculate">重新计算</el-button> <el-button :disabled="disabled" @click="openShow = false">取消</el-button>
<el-button @click="CloseDialog">取消</el-button> <el-button :disabled="disabled" type="primary" @click="handleRecalculate">确定</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
</div>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import {getList,deleteTable,verifyTable,calculateTable,exportData,getDetail} from "@/api/costManagement/costStatistics"
import { tr } from 'element-plus/es/locales.mjs'
export default { export default {
data() { data(){
return { return{
openShow: false, loading:false,
searchForm: {}, openShow:false,
loading: false, data:[],
data: [], form:{},
form: {}, query:{},
selectionList: [], page:{
page: { pageSize: 10,
currentPage: 1,
total: 0,
},
detailLoading:false,
detailData:[],
detailForm:{},
detailPage:{
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
total: 0, total: 0,
}, },
option: { costForm:{},
costRules:{
month:{required:true,message:'请选择月份',trigger:'change'}
},
disabled:false,
selectionList:[],
option:{
height: 'auto', height: 'auto',
calcHeight: 32, calcHeight: 32,
tip: false, tip: false,
simplePage: true, simplePage: true,
searchShow: true, searchShow: true,
searchMenuSpan: 6, searchMenuSpan: 18,
searchIcon: true, searchIcon: true,
searchIndex: 3, searchIndex: 3,
tree: false, tree: false,
@ -124,7 +121,7 @@ export default {
editBtnText: '修改', editBtnText: '修改',
viewBtnText: '详情', viewBtnText: '详情',
labelWidth: 120, labelWidth: 120,
searchLabelWidth: 120, searchLabelWidth: "auto",
menu: false, menu: false,
menuWidth: 220, menuWidth: 220,
dialogWidth: 1200, dialogWidth: 1200,
@ -137,6 +134,7 @@ export default {
excelBtn: true, excelBtn: true,
columnSort: true, columnSort: true,
index: false, index: false,
highlightCurrentRow:true, //
showOverflowTooltip: true, showOverflowTooltip: true,
searchLabelPosition: 'left', searchLabelPosition: 'left',
searchGutter: 24, searchGutter: 24,
@ -149,11 +147,10 @@ export default {
delBtnIcon: ' ', delBtnIcon: ' ',
editBtnIcon: ' ', editBtnIcon: ' ',
align: 'center', align: 'center',
column: [ column: [
{ {
label: '作业中心', label: '作业中心',
prop: 'wcName', prop: 'workCenterName',
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
@ -161,31 +158,35 @@ export default {
{ {
label: '月份', label: '月份',
prop: 'month', prop: 'month',
search: false, type:"month",
format:"YYYY-MM",
valueFormat:"YYYY-MM",
search: true,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
width:80,
}, },
{ {
label: '制造费用(元)', label: '制造费用(元)',
prop: 'drainCosts', prop: 'productCost',
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
width: 100, width: 95,
}, },
{ {
label: '作业中心材料费用(元)', label: '作业中心材料费用(元)',
prop: 'materialCosts', prop: 'workCenterMaterialCost',
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
width: 160, width: 140,
}, },
{ {
label: '辅助人员材料费用(元)', label: '辅助人员材料费用(元)',
prop: 'materialCosts1', prop: 'assistantMaterialCost',
search: false, search: false,
width: 160, width: 140,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
}, },
@ -195,33 +196,32 @@ export default {
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
width: 120, width: 100,
}, },
{ {
label: '月度产出(dm²)', label: '月度产出(dm²)',
prop: 'monthlyOutput', prop: 'monthOutputArea',
search: false, search: false,
width: 120,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
}, },
{ {
label: '月度产出(v)', label: '月度产出(v)',
prop: 'volumeOutput2', prop: 'monthOutputVolume',
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
}, },
], ],
}, },
detailsOption: { detailOption:{
height: 'auto', height: 'auto',
calcHeight: 32, calcHeight: 32,
tip: false, tip: false,
size: 'medium', size: 'medium',
simplePage: true, simplePage: true,
searchShow: true, searchShow: true,
searchMenuSpan: 6, searchMenuSpan: 18,
searchIcon: true, searchIcon: true,
searchIndex: 3, searchIndex: 3,
tree: false, tree: false,
@ -235,7 +235,7 @@ export default {
editBtnText: '修改', editBtnText: '修改',
viewBtnText: '详情', viewBtnText: '详情',
labelWidth: 120, labelWidth: 120,
searchLabelWidth: 120, searchLabelWidth: 'auto',
menu: false, menu: false,
menuWidth: 220, menuWidth: 220,
dialogWidth: 1200, dialogWidth: 1200,
@ -267,75 +267,255 @@ export default {
column: [ column: [
{ {
label: '类型', label: '类型',
prop: 'wcCode', prop: 'subjectName',
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
}, },
{ {
label: '金额', label: '金额',
prop: 'wcCode1', prop: 'fee',
search: false, search: false,
sortable: false, sortable: false,
overHidden: true, overHidden: true,
}, },
], ],
}
}
}, },
}; created(){
},
mounted() {},
methods: {
openCostCalcDialog() {
this.openShow = true;
},
CloseDialog() {
this.openShow = false;
},
handleRecalculate() {
this.$message.success('重新计算成功');
this.openShow = false;
},
selectionChange(val) {
this.selectionList = val;
}, },
isLockClick() { methods:{
if (this.selectionList.length == 0) { handleCurrentRowChange(row){
this.$message.error('请先选择数据'); if (!row) {
this.detailData = [];
return; 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() { handleDelete() {
if (this.selectionList.length == 0) { if (this.selectionList.length == 0) {
this.$message.error('请先选择数据'); this.$message.error("请先选择数据");
return; 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: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', 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() { handleRecalculate(){
this.data = [ this.$refs.costForm.validate((valid) =>{
{ if(valid){
id: 1, console.log('1111111111111111')
wcName: '作业中心1', // this.$message.success('')
month: '2025-3', verifyTable({
materialCosts: 99, month:this.costForm.month
materialCosts1: 0, }).then(res =>{
unitCost: '89', if(res.data.code == 200){
monthlyOutput: 0, if(res.data.msg != '操作成功'){
volumeOutput: '9', this.$confirm(res.data.msg, {
drainCosts: '99', confirmButtonText: "确定",
volumeOutput2: '90', cancelButtonText: "取消",
wcCode: '类型1', type: "warning",
wcCode1: '4', }).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> </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