|
@@ -169,12 +169,12 @@ export default { |
|
@@ -169,12 +169,12 @@ export default { |
|
169
|
if (ress) {
|
169
|
if (ress) {
|
|
170
|
//如果已派工时为0总工时*工时比例,否则(总工时-已派工时)*工时比例
|
170
|
//如果已派工时为0总工时*工时比例,否则(总工时-已派工时)*工时比例
|
|
171
|
console.log(record.dispatchedWorkingHours)
|
171
|
console.log(record.dispatchedWorkingHours)
|
|
172
|
- if (record.dispatchedWorkingHours <= 0) {
|
172
|
+ if (record.dispatchedWorkingHours <= 0 || record.dispatchedWorkingHours==='') {
|
|
173
|
console.log('aa', ress.result)
|
173
|
console.log('aa', ress.result)
|
|
174
|
console.log(record.totalWorkingHours)
|
174
|
console.log(record.totalWorkingHours)
|
|
175
|
// 将获取到的工序列表添加到数据源中
|
175
|
// 将获取到的工序列表添加到数据源中
|
|
176
|
this.res = ress.result.map((item) => ({
|
176
|
this.res = ress.result.map((item) => ({
|
|
177
|
- workingProcedure: item.gongxu,
|
177
|
+ workingProcedure: item.gongxu + " (" + (item.bili * 100).toFixed() + "%)",
|
|
178
|
undertaker: '', // 初始为空,等待用户输入
|
178
|
undertaker: '', // 初始为空,等待用户输入
|
|
179
|
workHours: parseFloat((record.totalWorkingHours * item.bili).toFixed(2))
|
179
|
workHours: parseFloat((record.totalWorkingHours * item.bili).toFixed(2))
|
|
180
|
.toString()
|
180
|
.toString()
|
|
@@ -213,6 +213,9 @@ export default { |
|
@@ -213,6 +213,9 @@ export default { |
|
213
|
this.$refs.form.validate((valid) => {
|
213
|
this.$refs.form.validate((valid) => {
|
|
214
|
if (valid) {
|
214
|
if (valid) {
|
|
215
|
if (!this.res.some((record) => !record.undertaker) && !this.res.some((record)=>!record.workHours)) {
|
215
|
if (!this.res.some((record) => !record.undertaker) && !this.res.some((record)=>!record.workHours)) {
|
|
|
|
216
|
+ // 检查是否所有输入框的值都是数字
|
|
|
|
217
|
+ const allNumeric = this.res.every((record) => /^\d+(\.\d+)?$/.test(record.workHours));
|
|
|
|
218
|
+ if(allNumeric){
|
|
216
|
that.confirmLoading = true
|
219
|
that.confirmLoading = true
|
|
217
|
console.log('res:', this.res)
|
220
|
console.log('res:', this.res)
|
|
218
|
// 使用 reduce 方法累加工时字段值
|
221
|
// 使用 reduce 方法累加工时字段值
|
|
@@ -221,6 +224,10 @@ export default { |
|
@@ -221,6 +224,10 @@ export default { |
|
221
|
return acc + parseFloat(current.workHours)
|
224
|
return acc + parseFloat(current.workHours)
|
|
222
|
}, 0)
|
225
|
}, 0)
|
|
223
|
console.log(this.panduan.dispatchedWorkingHours)
|
226
|
console.log(this.panduan.dispatchedWorkingHours)
|
|
|
|
227
|
+ if(this.panduan.dispatchedWorkingHours==='' || this.panduan.dispatchedWorkingHours===null){
|
|
|
|
228
|
+ this.panduan.dispatchedWorkingHours=0
|
|
|
|
229
|
+ }
|
|
|
|
230
|
+ console.log(this.panduan.dispatchedWorkingHours)
|
|
224
|
const zongpaifa = parseFloat(this.panduan.dispatchedWorkingHours) + zong
|
231
|
const zongpaifa = parseFloat(this.panduan.dispatchedWorkingHours) + zong
|
|
225
|
console.log('派发工时和:', zong)
|
232
|
console.log('派发工时和:', zong)
|
|
226
|
console.log('已派发工时:', zongpaifa)
|
233
|
console.log('已派发工时:', zongpaifa)
|
|
@@ -241,6 +248,10 @@ export default { |
|
@@ -241,6 +248,10 @@ export default { |
|
241
|
that.$message.error('派发工时超过总工时')
|
248
|
that.$message.error('派发工时超过总工时')
|
|
242
|
that.confirmLoading = false
|
249
|
that.confirmLoading = false
|
|
243
|
}
|
250
|
}
|
|
|
|
251
|
+ }else{
|
|
|
|
252
|
+ that.$message.error('工时格式错误')
|
|
|
|
253
|
+ that.confirmLoading = false
|
|
|
|
254
|
+ }
|
|
244
|
} else {
|
255
|
} else {
|
|
245
|
that.$message.error('页面字段不能为空')
|
256
|
that.$message.error('页面字段不能为空')
|
|
246
|
that.confirmLoading = false
|
257
|
that.confirmLoading = false
|