parent
3b9b8f0a58
commit
ba171e726b
12 changed files with 2139 additions and 1321 deletions
@ -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> |
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue