This commit is contained in:
parent
72aa94ad40
commit
58e06eb19d
|
|
@ -1031,121 +1031,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 保存按钮操作 */
|
/** 保存按钮操作 */
|
||||||
handleAdd() {
|
|
||||||
this.$refs.queryForm.validate(async (valid) => {
|
|
||||||
if (!valid) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
if (this.leaseApplyDetails.length === 0 && this.wholeTypeNameList.length === 0) {
|
|
||||||
this.$message.error('请添加机具类型或成套设备')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let canSave = true
|
|
||||||
if (this.leaseApplyDetails.length > 0) {
|
|
||||||
this.queryParams.leaseApplyDetails = this.leaseApplyDetails
|
|
||||||
try {
|
|
||||||
this.queryParams.leaseApplyDetails.forEach((item) => {
|
|
||||||
// if (item.num == 0) {
|
|
||||||
// this.$message.error('机具类型库存量为零无法领料')
|
|
||||||
// throw new Error()
|
|
||||||
// }
|
|
||||||
if (!item.childrenList && item.preNum == '') {
|
|
||||||
this.$message.error('请填写预领数量')
|
|
||||||
throw new Error()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} catch (e) {
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.leaseApplyDetails.forEach((e) => {
|
|
||||||
if (e.childrenList && e.childrenList.length > 0) {
|
|
||||||
e.childrenList.forEach((j) => {
|
|
||||||
const items = {
|
|
||||||
companyId: '101',
|
|
||||||
guigeCn: j.deviceType,
|
|
||||||
typeCn: j.typeName,
|
|
||||||
createBy: this.user.name,
|
|
||||||
typeId: j.deviceTypeId,
|
|
||||||
preNum: j.deviceNum,
|
|
||||||
num: j.num,
|
|
||||||
isCt: 0,
|
|
||||||
ctParentId: e.ctParentId,
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queryParams.leaseApplyDetails.push(items)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.queryParams.leaseApplyDetails = this.queryParams.leaseApplyDetails.filter((e) => !e.childrenList)
|
|
||||||
// if (this.wholeTypeNameList.length > 0) {
|
|
||||||
// const wholeTypeList = []
|
|
||||||
// this.wholeTypeNameList.forEach((i) => {
|
|
||||||
// i.childrenList.forEach((e) => {
|
|
||||||
// const items = {
|
|
||||||
// companyId: '101',
|
|
||||||
// guigeCn: e.deviceType,
|
|
||||||
// preNum: e.deviceNum,
|
|
||||||
// typeCn: e.typeName,
|
|
||||||
// typeId: e.deviceTypeId,
|
|
||||||
// wholeTypeName: i.wholeTypeName,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// wholeTypeList.push(items)
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
// this.queryParams.leaseApplyDetails = wholeTypeList
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (!canSave) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
this.queryParams.createBy = this.user.userName
|
|
||||||
this.queryParams.companyId = this.user.companyId
|
|
||||||
this.queryParams.userId = this.user.userId
|
|
||||||
let res
|
|
||||||
if (this.queryParams.leaseType == 1) {
|
|
||||||
this.queryParams.taskStatus = 117
|
|
||||||
}
|
|
||||||
if (this.taskId) {
|
|
||||||
this.leaseApplyInfoList.forEach((v) => {
|
|
||||||
v = Object.assign(v, this.queryParams.leaseApplyInfo)
|
|
||||||
this.$set(v, 'leaseApplyDetails', this.queryParams.leaseApplyDetails)
|
|
||||||
})
|
|
||||||
if (this.$route.query.isBack) {
|
|
||||||
this.queryParams.souceByRefuse = 1
|
|
||||||
}
|
|
||||||
if (this.rejectTaskStatus == 100) {
|
|
||||||
this.queryParams.souceByRefuse = 1
|
|
||||||
}
|
|
||||||
const params = {
|
|
||||||
...this.queryParams,
|
|
||||||
taskId: this.taskId,
|
|
||||||
leaseApplyInfoList: this.leaseApplyInfoList,
|
|
||||||
}
|
|
||||||
|
|
||||||
res = await editLeaseApply(params)
|
|
||||||
} else {
|
|
||||||
console.log(this.queryParams, '参数---')
|
|
||||||
res = await submitLeaseApply(this.queryParams)
|
|
||||||
}
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.$message({
|
|
||||||
type: 'success',
|
|
||||||
message: res.msg,
|
|
||||||
})
|
|
||||||
// this.$tab.closeOpenPage({
|
|
||||||
// path: '/claimAndRefund/receiveByCq/receiveApply',
|
|
||||||
// })
|
|
||||||
this.$emit('goBackPage')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleBack(row) {
|
handleBack(row) {
|
||||||
this.$tab.closeOpenPage({
|
this.$tab.closeOpenPage({
|
||||||
|
|
@ -1413,20 +1299,20 @@ export default {
|
||||||
let canSave = true
|
let canSave = true
|
||||||
if (this.leaseApplyDetails.length > 0) {
|
if (this.leaseApplyDetails.length > 0) {
|
||||||
this.queryParams.leaseApplyDetails = this.leaseApplyDetails
|
this.queryParams.leaseApplyDetails = this.leaseApplyDetails
|
||||||
try {
|
// try {
|
||||||
this.queryParams.leaseApplyDetails.forEach((item) => {
|
// this.queryParams.leaseApplyDetails.forEach((item) => {
|
||||||
if (item.num == 0) {
|
// if (item.num == 0) {
|
||||||
this.$message.error('机具类型库存量为零无法领料')
|
// this.$message.error('机具类型库存量为零无法领料')
|
||||||
throw new Error()
|
// throw new Error()
|
||||||
}
|
// }
|
||||||
if (!item.childrenList && item.preNum == '') {
|
// if (!item.childrenList && item.preNum == '') {
|
||||||
this.$message.error('请填写预领数量')
|
// this.$message.error('请填写预领数量')
|
||||||
throw new Error()
|
// throw new Error()
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
throw e
|
// throw e
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.leaseApplyDetails.forEach((e) => {
|
this.leaseApplyDetails.forEach((e) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue