|
...
|
...
|
@@ -169,12 +169,12 @@ export default { |
|
|
|
if (ress) {
|
|
|
|
//如果已派工时为0总工时*工时比例,否则(总工时-已派工时)*工时比例
|
|
|
|
console.log(record.dispatchedWorkingHours)
|
|
|
|
if (record.dispatchedWorkingHours <= 0) {
|
|
|
|
if (record.dispatchedWorkingHours <= 0 || record.dispatchedWorkingHours==='') {
|
|
|
|
console.log('aa', ress.result)
|
|
|
|
console.log(record.totalWorkingHours)
|
|
|
|
// 将获取到的工序列表添加到数据源中
|
|
|
|
this.res = ress.result.map((item) => ({
|
|
|
|
workingProcedure: item.gongxu,
|
|
|
|
workingProcedure: item.gongxu + " (" + (item.bili * 100).toFixed() + "%)",
|
|
|
|
undertaker: '', // 初始为空,等待用户输入
|
|
|
|
workHours: parseFloat((record.totalWorkingHours * item.bili).toFixed(2))
|
|
|
|
.toString()
|
|
...
|
...
|
@@ -213,6 +213,9 @@ export default { |
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
if (!this.res.some((record) => !record.undertaker) && !this.res.some((record)=>!record.workHours)) {
|
|
|
|
// 检查是否所有输入框的值都是数字
|
|
|
|
const allNumeric = this.res.every((record) => /^\d+(\.\d+)?$/.test(record.workHours));
|
|
|
|
if(allNumeric){
|
|
|
|
that.confirmLoading = true
|
|
|
|
console.log('res:', this.res)
|
|
|
|
// 使用 reduce 方法累加工时字段值
|
|
...
|
...
|
@@ -221,6 +224,10 @@ export default { |
|
|
|
return acc + parseFloat(current.workHours)
|
|
|
|
}, 0)
|
|
|
|
console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
if(this.panduan.dispatchedWorkingHours==='' || this.panduan.dispatchedWorkingHours===null){
|
|
|
|
this.panduan.dispatchedWorkingHours=0
|
|
|
|
}
|
|
|
|
console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
const zongpaifa = parseFloat(this.panduan.dispatchedWorkingHours) + zong
|
|
|
|
console.log('派发工时和:', zong)
|
|
|
|
console.log('已派发工时:', zongpaifa)
|
|
...
|
...
|
@@ -241,6 +248,10 @@ export default { |
|
|
|
that.$message.error('派发工时超过总工时')
|
|
|
|
that.confirmLoading = false
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
that.$message.error('工时格式错误')
|
|
|
|
that.confirmLoading = false
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
that.$message.error('页面字段不能为空')
|
|
|
|
that.confirmLoading = false
|
...
|
...
|
|