|
...
|
...
|
@@ -160,17 +160,17 @@ export default { |
|
|
|
})
|
|
|
|
},
|
|
|
|
add(record) {
|
|
|
|
console.log('产品类型:', record.productType)
|
|
|
|
// console.log('产品类型:', record.productType)
|
|
|
|
this.productType = record.productType
|
|
|
|
this.panduan = record
|
|
|
|
|
|
|
|
gongxuList(this.url.queryByType, { productTypeId: record.productType }).then((ress) => {
|
|
|
|
if (ress) {
|
|
|
|
//如果已派工时为0总工时*工时比例,否则(总工时-已派工时)*工时比例
|
|
|
|
console.log(record.dispatchedWorkingHours)
|
|
|
|
// console.log(record.dispatchedWorkingHours)
|
|
|
|
if (record.dispatchedWorkingHours <= 0 || record.dispatchedWorkingHours === '') {
|
|
|
|
console.log('aa', ress.result)
|
|
|
|
console.log(record.totalWorkingHours)
|
|
|
|
// console.log('aa', ress.result)
|
|
|
|
// console.log(record.totalWorkingHours)
|
|
|
|
// 将获取到的工序列表添加到数据源中
|
|
|
|
this.res = ress.result.map((item) => ({
|
|
|
|
workingProcedure: item.gongxu + ' (' + (item.bili * 100).toFixed() + '%)',
|
|
...
|
...
|
@@ -184,8 +184,8 @@ export default { |
|
|
|
productType: record.productType,
|
|
|
|
}))
|
|
|
|
} else if (record.dispatchedWorkingHours > 0) {
|
|
|
|
console.log('bb', ress.result)
|
|
|
|
console.log(record.totalWorkingHours)
|
|
|
|
// console.log('bb', ress.result)
|
|
|
|
// console.log(record.totalWorkingHours)
|
|
|
|
// 将获取到的工序列表添加到数据源中
|
|
|
|
this.res = ress.result.map((item) => ({
|
|
|
|
workingProcedure: item.gongxu + ' (' + (item.bili * 100).toFixed() + '%)',
|
|
...
|
...
|
@@ -201,7 +201,7 @@ export default { |
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
console.log('派发人:', this.userInfo().realname)
|
|
|
|
// console.log('派发人:', this.userInfo().realname)
|
|
|
|
},
|
|
|
|
...mapGetters(['nickname', 'avatar', 'userInfo']),
|
|
|
|
submitForm() {
|
|
...
|
...
|
@@ -220,23 +220,23 @@ export default { |
|
|
|
if (allNumeric) {
|
|
|
|
that.confirmLoading = true
|
|
|
|
data=nonEmptyUndertakerRecords;
|
|
|
|
console.log('res:', this.res)
|
|
|
|
// console.log('res:', this.res)
|
|
|
|
// 使用 reduce 方法累加工时字段值
|
|
|
|
const zong = this.res.reduce((acc, current) => {
|
|
|
|
if (current.undertaker !== null && current.undertaker !== undefined && current.undertaker !== '') {
|
|
|
|
console.log('current.workhours:', current.workHours)
|
|
|
|
// console.log('current.workhours:', current.workHours)
|
|
|
|
return acc + parseFloat(current.workHours)
|
|
|
|
}
|
|
|
|
return acc
|
|
|
|
}, 0)
|
|
|
|
console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
// console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
if (this.panduan.dispatchedWorkingHours === '' || this.panduan.dispatchedWorkingHours === null) {
|
|
|
|
this.panduan.dispatchedWorkingHours = 0
|
|
|
|
}
|
|
|
|
console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
// console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
const zongpaifa = parseFloat(this.panduan.dispatchedWorkingHours) + zong
|
|
|
|
console.log('派发工时和:', zong)
|
|
|
|
console.log('已派发工时:', zongpaifa)
|
|
|
|
// console.log('派发工时和:', zong)
|
|
|
|
// console.log('已派发工时:', zongpaifa)
|
|
|
|
if (zongpaifa <= this.panduan.totalWorkingHours) {
|
|
|
|
addPg(this.url.add, data)
|
|
|
|
.then((res) => {
|
...
|
...
|
|