冲突合并

This commit is contained in:
BianLzhaoMin 2025-03-10 15:04:12 +08:00
commit 72aa94ad40
1 changed files with 573 additions and 23 deletions

View File

@ -233,8 +233,8 @@
<el-table-column prop="wholeTypeName" align="center" label="成套设备名称" /> <el-table-column prop="wholeTypeName" align="center" label="成套设备名称" />
<el-table-column label="机具名称" prop="typeCn" :show-overflow-tooltip="true" /> <el-table-column label="机具名称" prop="typeCn" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" prop="guigeCn" :show-overflow-tooltip="true" /> <el-table-column label="规格型号" prop="guigeCn" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" prop="unitCn" /> <el-table-column label="计量单位" prop="unitCn" align="center" />
<el-table-column label="库存数量" prop="num" /> <el-table-column label="库存数量" prop="num" align="center" />
<el-table-column label="预领数量" align="center"> <el-table-column label="预领数量" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
@ -797,28 +797,578 @@ export default {
return template return template
}, },
// methods: {
reset() { //
if (this.$refs.menu != undefined) { async GetUserInfo() {
this.$refs.menu.setCheckedKeys([]) const res = await getInfo()
} this.user = res.user
;(this.menuExpand = false), },
(this.menuNodeAll = false),
(this.deptExpand = true), //
(this.deptNodeAll = false), async GetUnitData() {
(this.form = { const params = {
roleId: undefined, id: this.queryParams.proId,
roleName: undefined, }
roleKey: undefined, const res = await getUnitData(params)
roleSort: 0, this.unitList = res.data
status: '0',
menuIds: [], this.GetAgreementInfoById()
deptIds: [], },
menuCheckStrictly: true, async getLevelTwoUnitCbx() {
deptCheckStrictly: true, const res = await getLevelTwoUnitCbx({ id: '' })
remark: undefined, console.log('🚀 ~ getLevelTwoUnitCbx ~ res:', res)
this.unitList = res.data
this.GetAgreementInfoById()
},
//
async GetProData() {
const params = {
id: this.queryParams.unitId,
}
const res = await getProData(params)
this.proList = res.data
this.GetAgreementInfoById()
},
//
async GetDeviceTypeTree() {
const params = {
level: 3,
}
getDeviceTypeTree(params).then((res) => {
this.deviceTypeTree = res.data
console.log('🚀 ~ getDeviceTypeTree ~ this.deviceTypeTree:', this.deviceTypeTree)
}) })
this.resetForm('form') },
getParentsById(list, id) {
for (let i in list) {
if (list[i].id == id) {
//value
return [list[i].id]
}
if (list[i].children) {
let node = this.getParentsById(list[i].children, id)
if (node !== undefined) {
//
node.unshift(list[i].id)
return node
}
}
}
},
// id
async GetAgreementInfoById() {
if (this.queryParams.unitId && this.queryParams.proId) {
const params = {
unitId: this.queryParams.unitId,
projectId: this.queryParams.proId,
}
const res = await getAgreementInfoById(params)
console.log(res, '根据工程和单位获取协议id')
if (res.data.isSlt == 1) {
this.$message.error('当前协议下对应的工程已完成结算,不可重复领料!')
this.isCost = true
if (this.leaseApplyDetails.length > 0) {
this.leaseApplyDetails = []
}
} else {
this.isCost = false
}
if (!(res.data && res.data.agreementId)) {
this.$message.error('当前单位和工程未上传')
this.queryParams.unitId = null
this.queryParams.proId = null
this.GetUnitData()
this.GetProData()
} else {
this.queryParams.agreementId = res.data.agreementId
this.queryParams.agreementCode = res.data.agreementCode
// // 1.
// getAgreementInfoByIdApi({
// agreementId: res.data.agreementId,
// })
}
}
},
//
async GetTaskDetail(taskId) {
const res = await getLeaseApplyListAll({ taskId })
const data = res.rows[0]
// unitId:null,
// proId:null,
// agreementId:null, //id
// agreementCode: null,
if (data.taskStatus == 100) {
this.queryParams.taskStatus = 32
this.queryParams.examineStatusId = '32'
}
this.queryParams.unitId = data.unitId
this.queryParams.costBearingParty = data.costBearingParty
this.queryParams.proId = data.proId
this.queryParams.leaseApplyInfo.phone = data.leaseApplyInfoList[0].phone
this.queryParams.leaseApplyInfo.leasePerson = data.leaseApplyInfoList[0].leasePerson
this.queryParams.agreementCode = data.agreementCode
this.queryParams.agreementId = data.agreementId
this.queryParams.estimateLeaseTime = data.estimateLeaseTime
// this.queryParams.leaseType = data.leaseType
this.$set(this.queryParams, 'leaseType', data.leaseType)
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark
this.leaseApplyInfoList = data.leaseApplyInfoList
this.leaseApplyDetails = data.leaseApplyDetails.map((item) => {
return this.handelEchoData(item)
})
},
//
async GetTaskDetail2(taskId) {
const res = await getLeaseApplyAuditListAll({ taskId })
const data = res.rows[0]
// unitId:null,
// proId:null,
// agreementId:null, //id
// agreementCode: null,
if (data.taskStatus == 100) {
this.queryParams.taskStatus = 32
this.queryParams.examineStatusId = '32'
}
this.queryParams.unitId = data.unitId
this.queryParams.proId = data.proId
this.queryParams.costBearingParty = data.costBearingParty
this.queryParams.leaseApplyInfo.phone = data.leaseApplyInfoList[0].phone
this.queryParams.leaseApplyInfo.leasePerson = data.leaseApplyInfoList[0].leasePerson
this.queryParams.agreementCode = data.agreementCode
this.queryParams.agreementId = data.agreementId
this.queryParams.estimateLeaseTime = data.estimateLeaseTime
// this.queryParams.leaseType = data.leaseType
this.$set(this.queryParams, 'leaseType', data.leaseType)
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark
this.leaseApplyInfoList = data.leaseApplyInfoList
this.leaseApplyDetails = data.leaseApplyDetails.map((item) => {
return this.handelEchoData(item)
})
},
//
handelEchoData(item) {
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
template.createBy = item.createBy
template.companyId = item.companyId
template.typeId = item.typeId
template.unitCn = item.unitName
template.typeCn = item.typeName
template.guigeCn = item.typeModelName
template.remark = item.remark
template.preNum = item.preNum
template.deviceNum = item.deviceNum
template.status = item.status
template.parenntId = item.parenntId
template.num = item.num
return template
},
//
reset() {
if (this.$refs.menu != undefined) {
this.$refs.menu.setCheckedKeys([])
}
;(this.menuExpand = false),
(this.menuNodeAll = false),
(this.deptExpand = true),
(this.deptNodeAll = false),
(this.form = {
roleId: undefined,
roleName: undefined,
roleKey: undefined,
roleSort: 0,
status: '0',
menuIds: [],
deptIds: [],
menuCheckStrictly: true,
deptCheckStrictly: true,
remark: undefined,
})
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.resetForm('queryForm')
},
//
handleSelectionChange(selection) {
// this.queryParams.leaseApplyDetails = selection
this.single = selection.length != 1
this.multiple = !selection.length
},
//
handleCommand(command, row) {
switch (command) {
case 'handleDataScope':
this.handleDataScope(row)
break
case 'handleAuthUser':
this.handleAuthUser(row)
break
default:
break
}
},
/** 保存按钮操作 */
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) {
this.$tab.closeOpenPage({
path: '/claimAndRefund/receiveByCq/receiveApply',
})
},
/** 删除按钮操作 */
handleDelete(row) {
// this.deviceType.forEach((e, index) => {
// if (e[3] === row.typeId) {
// this.deviceType.splice(index, 1)
// this.propsKey++
// }
// })
this.leaseApplyDetails.splice(row.index, 1)
},
/** 导出按钮操作 */
handleExport() {
// this.download('system/role/export', {
// ...this.queryParams
// }, `role_${new Date().getTime()}.xlsx`)
},
checkNum(row) {
let maxNum = row.num
if (row.preNum <= 1) {
row.preNum = 1
} else if (row.preNum >= maxNum) {
row.preNum = maxNum
}
},
///////
deviceTypeChange(val) {
console.log('🚀 ~ deviceTypeChange ~ val:', val)
this.queryParams.typeId = ''
this.typeListDev = []
// console.log('🚀 ~ deviceTypeChange ~ val:', val)
this.$nextTick(() => {
const deviceTypeList = this.$refs.deviceTypeCascader.getCheckedNodes()
console.log('🚀 ~ deviceTypeChange ~ deviceTypeList:', deviceTypeList[0])
this.selectParams = {
createBy: this.user.name,
companyId: deviceTypeList[0].data.companyId,
// num: deviceTypeList[0].data.num,
typeCn: deviceTypeList[0].data.label,
}
console.log('🚀 ~ deviceTypeChange ~ this.selectParams:', this.selectParams)
this.getMaTypeDataByIdFun(val[val.length - 1])
})
// if (val.length > 0) {
// const items = val.map((e) => {
// return e[3]
// })
// for (let i in items) {
// for (let z in deviceTypeList) {
// if (deviceTypeList[z].data.id === items[i]) {
// let { num, companyId, id, unitName } = deviceTypeList[z].data
// const isRepeat = this.leaseApplyDetails.some((e) => e.typeId === id)
// if (!isRepeat) {
// this.leaseApplyDetails.push({
// createBy: this.user.name,
// typeId: id,
// num,
// companyId,
// unitCn: unitName,
// typeCn: deviceTypeList[z].pathLabels[2],
// guigeCn: deviceTypeList[z].pathLabels[3],
// })
// }
// }
// }
// }
// console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails)
// } else {
// this.leaseApplyDetails = []
// }
},
//
async getMaTypeDataByIdFun(val) {
const res = await getMaTypeDataById({ id: val })
this.typeListDev = res.data.filter((e) => e.isStorage == 1)
console.log('🚀 ~ getMaTypeDataByIdFun ~ res:', res)
},
//
changeType(e) {
// console.log('🚀 ~ changeType ~ e:', e)
if (!e) return
//
const selectType = this.typeListDev.find((item) => item.id == e)
console.log('🚀 ~ changeType ~ selectType:', selectType)
this.selectParams.typeId = selectType.id
this.selectParams.guigeCn = selectType.name
this.selectParams.unitCn = selectType.unit
this.selectParams.num = selectType.num
console.log('🚀 ~ changeType ~ this.selectParams:', this.selectParams)
//
const isRepeat = this.leaseApplyDetails.find((item) => item.typeId == selectType.id)
// console.log('🚀 ~ changeType ~ isRepeat:', isRepeat)
if (isRepeat) {
this.$message.error('当前设备已添加,不可重复添加!')
return
}
this.leaseApplyDetails.push({ ...this.selectParams })
console.log('🚀 ~ changeType ~ this.leaseApplyDetails:', this.leaseApplyDetails)
},
////
handelTableItemData(node) {
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
template.createBy = this.user.name
console.log(node.data)
template.num = node.data.num
template.companyId = node.data.companyId
template.typeId = node.data.id
template.unitCn = node.data.unitName
template.typeCn = node.pathLabels[2]
template.guigeCn = node.pathLabels[3]
if (this.taskId) {
const index = this.leaseApplyInfoList.find((key) => key.companyId == node.data.companyId)
template.parenntId = index ? index.id : ''
}
return template
},
//
async getCostBearingFun() {
const { data: res } = await getCostBearingApi()
this.costBearingList = res
},
//
leaseTypeChange(val) {
console.log('🚀 ~ leaseTypeChange ~ val:', val)
if (val == 0) {
this.$set(this.queryParams, 'costBearingParty', '')
this.GetUnitData()
this.GetProData()
} else {
this.$delete(this.queryParams, 'costBearingParty')
this.queryParams.unitId = ''
this.queryParams.proId = ''
this.proList = []
this.getLevelTwoUnitCbx()
this.$nextTick(() => {
this.$refs.queryForm.clearValidate()
})
}
},
/* 获取抱杆下拉数据 */
async getHoldingPoleSelListData() {
const { data: res } = await getHoldingPoleSelListApi()
this.holdingPoleSelList = res
},
/* 抱杆成套设备change事件 */
onChangeWholeTypeName(val) {
val.forEach((e) => {
const selLable = this.holdingPoleSelList.find((j) => j.id === e)
const isPush = this.leaseApplyDetails.some((z) => z.ctParentId == e)
if (!isPush) {
const wholeTypeNameData = {
id: e,
wholeTypeName: selLable.wholeTypeName,
wholeTypeNum: 1,
childrenList: [],
}
queryCompleteSetToolsApi(wholeTypeNameData).then((res) => {
this.leaseApplyDetails.push({
wholeTypeName: selLable.wholeTypeName,
childrenList: res.data,
ctParentId: e,
})
})
}
})
// const selLable = this.holdingPoleSelList.find((e) => e.id === val)
// const wholeTypeNameData = {
// id: val,
// wholeTypeName: selLable.wholeTypeName,
// wholeTypeNum: 1,
// childrenList: [],
// }
// queryCompleteSetToolsApi(wholeTypeNameData).then((res) => {
// console.log(res, '996')
// this.leaseApplyDetails.push({
// wholeTypeName: selLable.wholeTypeName,
// childrenList: res.data,
// ctParentId: val,
// })
// // wholeTypeNameData.childrenList = res.data
// // wholeTypeNameData.childrenList.forEach((e) => (e.initNum = e.deviceNum))
// // const isREpeat = this.wholeTypeNameList.find((e) => e.id === val)
// // if (!isREpeat) {
// // this.wholeTypeNameList.push(wholeTypeNameData)
// // } else {
// // this.$modal.msgError('')
// // }
// // console.log(this.wholeTypeNameList, '---')
// })
// this.queryParams.wholeTypeName = ''
},
//
onRemoveTag(val) {
this.leaseApplyDetails = this.leaseApplyDetails.filter((e) => e.ctParentId !== val)
},
/* 删除 */
onHandelDelete(index) {
this.wholeTypeNameList.splice(index, 1)
},
/* 更改数量 */
onChangeInput(val, v) {
this.wholeTypeNameList[v].childrenList.forEach((e) => (e.deviceNum = e.initNum * val))
},
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {