领退管理-优化

This commit is contained in:
bb_pan 2025-03-20 15:42:42 +08:00
parent b279180b62
commit cafcef6f2e
5 changed files with 263 additions and 146 deletions

View File

@ -373,6 +373,16 @@ export function getMaTypeDataById(data) {
data,
})
}
export function getFourMaTypeList(data) {
return request({
url: '/material/select/getFourMaTypeList',
method: 'post',
headers: {
repeatSubmit: false,
},
data,
})
}
// 获取预退数量
export function getPreAuditNum(params) {

View File

@ -57,17 +57,20 @@
<el-form-item label="协议号" prop="agreementCode">
<el-input maxlength="50" v-model="queryParams.agreementCode" disabled style="width: 240px"></el-input>
</el-form-item>
<!-- <el-form-item label="成套设备" prop="agreementCode">
<el-form-item label="成套设备" prop="agreementCode">
<el-select
clearable
style="width: 240px"
placeholder="请选择成套设备"
@change="onChangeWholeTypeName"
v-model="queryParams.wholeName"
@remove-tag="onRemoveTag"
v-model="queryParams.wholeTypeName"
multiple
:disabled="isEdit"
>
<el-option v-for="item in holdingPoleSelList" :key="item.id" :label="item.wholeName" :value="item.id" />
<el-option v-for="item in holdingPoleSelList" :key="item.id" :label="item.wholeTypeName" :value="item.id" />
</el-select>
</el-form-item> -->
</el-form-item>
<el-form-item label="类型名称" prop="status">
<el-cascader
filterable
@ -79,7 +82,7 @@
ref="deviceTypeCascader"
:options="deviceTypeTree"
@change="deviceTypeChange"
placeholder="请输入规格型号"
placeholder="请输入类型名称"
popper-class="popper-select"
:props="deviceTypeTreeProps"
:disabled="(isEdit && !isView) || isCost || wholeTypeNameList.length > 0"
@ -162,14 +165,14 @@
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col> -->
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col> -->
</el-row>
<el-table v-show="wholeTypeNameList.length > 0" :data="wholeTypeNameList">
@ -177,16 +180,22 @@
<el-table-column type="expand">
<template slot-scope="props">
<el-table :data="props.row.childrenList">
<el-table-column align="center" prop="typeName" label="设备名称" />
<el-table-column align="center" prop="typeName" label="机具名称" />
<el-table-column align="center" label="规格型号" prop="deviceType" />
<el-table-column align="center" label="设备所属" prop="deviceAscription" />
<el-table-column label="预领数量" prop="deviceNum" align="center" />
<el-table-column align="center" label="库存数量" prop="num" />
<el-table-column align="center" label="是否管理库存">
<template slot-scope="{ row }">
<el-tag size="mini" type="primary" v-if="row.isStorage == 1"></el-tag>
<el-tag size="mini" type="warning" v-if="row.isStorage == 0"></el-tag>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column prop="wholeName" align="center" label="抱杆设备名称" />
<el-table-column align="center" label="抱杆设备数量" width="260">
<el-table-column prop="wholeTypeName" align="center" label="成套设备名称" />
<el-table-column align="center" label="成套设备数量" width="260">
<template slot-scope="scope">
<el-input-number
:min="1"
@ -196,19 +205,14 @@
/>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="180">
<el-table-column align="center" label="操作" width="180" v-if="!isEdit">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="onHandelDelete(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-table
v-loading="loading"
:data="leaseApplyDetails"
v-show="wholeTypeNameList.length === 0"
@selection-change="handleSelectionChange"
>
<el-table v-loading="loading" :data="leaseApplyDetails" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" type="index" width="80" />
<el-table-column label="机具名称" prop="typeCn" :show-overflow-tooltip="true" />
@ -253,6 +257,13 @@
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" v-if="isView">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleBack(scope.row)"-->
<!-- v-hasPermi="['system:role:edit']"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
@ -411,14 +422,14 @@ export default {
},
//
leaseApplyDetails: [],
wholeName: '',
wholeTypeName: '',
},
typeListDev: [], //
selectParams: {},
typeList: [
{ id: '0', name: '工程租赁' },
{ id: '1', name: '长期领用' },
], //
typeListDev: [], //
selectParams: {},
leaseApplyDetails: [],
leaseApplyInfoList: [],
//
@ -538,14 +549,38 @@ export default {
this.getCostBearingFun()
this.getHoldingPoleSelListData()
// this.GetDeviceTypeTree()
// this.getList();
if (this.$route.query.taskId && !this.$route.query.isBack) {
console.log('查看')
this.GetTaskDetail(this.$route.query.taskId)
}
if (this.$route.query.taskId && this.$route.query.isBack) {
console.log('驳回提交查看')
this.GetTaskDetail2(this.$route.query.taskId)
}
// this.taskId = this.$route.query.taskId
// this.isEdit = this.$route.query.isEdit
this.taskId = this.viewTaskId
if (this.taskId) {
this.GetTaskDetail(this.taskId)
this.GetDeviceTypeTree()
Promise.all([this.GetTaskDetail(this.taskId), this.GetDeviceTypeTree()]).then(() => {
let selectList = []
this.leaseApplyDetails.forEach((e) => {
selectList.push(this.getParentsById(this.deviceTypeTree, e.typeId))
})
this.$nextTick(() => {
this.deviceType = selectList
this.propsKey++
})
})
} else {
this.GetDeviceTypeTree()
}
// console.log(typeof(this.isEdit))
// this.$set('isEdit',this.$route.query.isEdit)
},
methods: {
@ -639,6 +674,12 @@ export default {
} else {
this.queryParams.agreementId = res.data.agreementId
this.queryParams.agreementCode = res.data.agreementCode
// // 1.
// getAgreementInfoByIdApi({
// agreementId: res.data.agreementId,
// })
}
}
},
@ -648,6 +689,11 @@ export default {
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'
@ -655,21 +701,26 @@ export default {
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.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.wholeTypeName = data.wholeTypeName
// this.queryParams.leaseType = data.leaseType
this.$set(this.queryParams, 'leaseType', data.leaseType)
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0]?.remark
this.leaseApplyInfoList = data.leaseApplyInfoList
this.leaseApplyDetails = data.leaseApplyDetails.map((item) => {
this.leaseApplyDetails = data.leaseApplyDetails?.map((item) => {
return this.handelEchoData(item)
})
if (data.ctLeaseApplyDetails) {
this.getCtFileList(data.ctLeaseApplyDetails)
}
let selectList = []
this.leaseApplyDetails.forEach((item) => {
this.leaseApplyDetails?.forEach((item) => {
try {
selectList.push(this.getParentsById(this.deviceTypeTree, item.typeId))
console.log('🚀 ~ 以大代小 ~ item:')
@ -689,7 +740,6 @@ export default {
this.deviceType = selectList
this.propsKey++
})
console.log('🚀 ~ this.leaseApplyDetails:', this.leaseApplyDetails)
},
//
async GetTaskDetail2(taskId) {
@ -713,6 +763,7 @@ export default {
this.queryParams.agreementCode = data.agreementCode
this.queryParams.agreementId = data.agreementId
this.queryParams.estimateLeaseTime = data.estimateLeaseTime
this.queryParams.wholeTypeName = data.wholeTypeName
// this.queryParams.leaseType = data.leaseType
this.$set(this.queryParams, 'leaseType', data.leaseType)
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark
@ -720,6 +771,39 @@ export default {
this.leaseApplyDetails = data.leaseApplyDetails.map((item) => {
return this.handelEchoData(item)
})
if (data.ctLeaseApplyDetails) {
this.getCtFileList(data.ctLeaseApplyDetails)
}
},
//
getCtFileList(ctData) {
const ctList = []
for (const key in ctData) {
ctList.push({
wholeTypeName: key,
wholeTypeNum: ctData[key][0].setsNum,
childrenList: [],
id: ctData[key][0].ctParentId,
})
}
ctList.forEach((e) => {
queryCompleteSetToolsApi(e).then((res) => {
e.childrenList = res.data.map((j) => {
return {
...j,
initNum: j.deviceNum,
}
})
e.childrenList.forEach((i) => {
i.deviceNum = i.initNum * e.wholeTypeNum
})
this.wholeTypeNameList.push(e)
})
})
},
//
handelEchoData(item) {
@ -814,8 +898,8 @@ export default {
try {
this.queryParams.leaseApplyDetails.forEach((item) => {
// if (item.num == 0) {
// this.$message.error('')
// throw new Error()
// this.$message.error('')
// throw new Error()
// }
if (item.preNum == '') {
this.$message.error('请填写预领数量')
@ -827,6 +911,14 @@ export default {
}
}
const submitQueryParams = JSON.parse(JSON.stringify(this.queryParams))
if (submitQueryParams.leaseApplyDetails.length > 0) {
submitQueryParams.leaseApplyDetails.forEach((e) => {
e.isCt = 1
})
}
if (this.wholeTypeNameList.length > 0) {
const wholeTypeList = []
this.wholeTypeNameList.forEach((i) => {
@ -837,14 +929,18 @@ export default {
preNum: e.deviceNum,
typeCn: e.typeName,
typeId: e.deviceTypeId,
wholeName: i.wholeName,
wholeTypeName: i.wholeTypeName,
isCt: 0,
ctParentId: i.id,
setsNum: i.wholeTypeNum,
}
wholeTypeList.push(items)
// wholeTypeList.push(items)
submitQueryParams.leaseApplyDetails.push(items)
})
})
this.queryParams.leaseApplyDetails = wholeTypeList
// this.queryParams.leaseApplyDetails = wholeTypeList
}
if (!canSave) {
@ -868,16 +964,43 @@ export default {
if (this.rejectTaskStatus == 100) {
this.queryParams.souceByRefuse = 1
}
const params = {
...this.queryParams,
taskId: this.taskId,
leaseApplyInfoList: this.leaseApplyInfoList,
const params = JSON.parse(JSON.stringify(this.queryParams))
params.taskId = this.taskId
params.leaseApplyInfoList = this.leaseApplyInfoList
params.leaseApplyDetails.forEach((e) => {
e.isCt = 1
})
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,
isCt: 0,
ctParentId: i.id,
setsNum: i.wholeTypeNum,
}
// wholeTypeList.push(items)
params.leaseApplyDetails.push(items)
})
})
// this.queryParams.leaseApplyDetails = wholeTypeList
}
res = await editLeaseApply(params)
} else {
// console.log(this.queryParams)
res = await submitLeaseApply(this.queryParams)
console.log('submitQueryParams', submitQueryParams)
res = await submitLeaseApply(submitQueryParams)
}
if (res.code == 200) {
this.$message({
@ -900,6 +1023,7 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
console.log('🚀 ~ handleDelete ~ row:', row)
// this.deviceType.forEach((e, index) => {
// if (e[3] === row.typeId) {
// this.deviceType.splice(index, 1)
@ -925,10 +1049,13 @@ export default {
},
///////
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,
@ -937,94 +1064,37 @@ export default {
typeModelName: deviceTypeList[0].data.label,
maTypeId: deviceTypeList[0].data.id,
}
console.log('🚀 ~ deviceTypeChange ~ this.selectParams:', this.selectParams)
this.getMaTypeDataByIdFun(val[val.length - 1])
})
// let tempList = []
// if (val.length > 0) {
// const items = val.map((e) => {
// return e[3]
// })
// const itemsMap = new Map(items.map((item) => [item, true]))
// deviceTypeList.forEach((device) => {
// console.log('🚀 ~ deviceTypeList.forEach ~ device:', device)
// if (itemsMap.has(device.data.id)) {
// const { num, companyId, id, unitName } = device.data
// tempList.push({
// createBy: this.user.name,
// typeId: id,
// num,
// companyId,
// unitCn: unitName,
// typeCn: device.pathLabels[2],
// guigeCn: device.pathLabels[3],
// // id
// maTypeId: device.path[2],
// //
// isReplaceId: device.data.isReplaceId,
// })
// }
// })
// const newDataList = [...this.leaseApplyDetails, ...tempList]
// const map = new Map()
// for (let item of newDataList) {
// if (!map.has(item.typeId)) {
// map.set(item.typeId, item)
// }
// }
// const newArray = [...map.values()]
// let newArray_array = []
// items.forEach((e) => {
// newArray.forEach((j) => {
// if (e == j.typeId) {
// newArray_array.push(j)
// }
// const items = val.map((e) => {
// return e[3]
// })
// })
// this.leaseApplyDetails = newArray_array
// // this.leaseApplyDetails.forEach(async (item) => {
// // console.log('🚀 ~ this.leaseApplyDetails.forEach ~ item:', item)
// // try {
// // if (item.isReplaceOpt) {
// // return
// // }
// // const res = await getMaTypeDataById({ id: item.maTypeId })
// // this.$set(item, 'isReplaceOpt', res.data)
// // console.log('🚀 ~ ~ item.isReplaceOpt:', item.isReplaceOpt)
// // } catch (error) {
// // console.log('🚀 ~ this.leaseApplyDetails.forEach ~ error:', error)
// // }
// // })
// 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 delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
// const promises = this.leaseApplyDetails.map(async (item, index) => {
// console.log('🚀 ~ this.leaseApplyDetails.forEach ~ item:', item)
// if (item.isReplaceOpt) {
// return item
// 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],
// })
// }
// }
// }
// }
// try {
// await delay(index * 100) // 100
// const res = await getMaTypeDataById({ id: item.maTypeId })
// this.$set(item, 'isReplaceOpt', res.data)
// console.log('🚀 ~ ~ item.isReplaceOpt:', item.isReplaceOpt)
// } catch (error) {
// console.log('🚀 ~ this.leaseApplyDetails.forEach ~ error:', error)
// }
// return item
// })
// Promise.all(promises).then((results) => {
// this.leaseApplyDetails = results
// console.log('All requests completed')
// })
// console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails)
// } else {
// this.leaseApplyDetails = []
// this.leaseApplyDetails = []
// }
},
//
@ -1132,28 +1202,35 @@ export default {
this.holdingPoleSelList = res
},
/* 抱杆成套设备change事件 */
onChangeWholeTypeName(val) {
const selLable = this.holdingPoleSelList.find((e) => e.id === val)
const wholeTypeNameData = {
id: val,
wholeName: selLable.wholeName,
wholeTypeNum: 1,
childrenList: [],
}
queryCompleteSetToolsApi(wholeTypeNameData).then((res) => {
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('当前抱杆成套设备已添加,不可重复添加!')
async onChangeWholeTypeName(val) {
val.forEach((e) => {
const selLable = this.holdingPoleSelList.find((j) => j.id === e)
const isPush = this.wholeTypeNameList.some((z) => z.id == e)
if (!isPush) {
const wholeTypeNameData = {
id: e,
wholeTypeName: selLable.wholeTypeName,
wholeTypeNum: 1,
childrenList: [],
}
queryCompleteSetToolsApi(wholeTypeNameData).then((res) => {
wholeTypeNameData.childrenList = res.data.map((e) => {
return {
...e,
initNum: e.deviceNum,
}
})
this.wholeTypeNameList.push(wholeTypeNameData)
})
}
console.log(this.wholeTypeNameList, '处理后的数据---')
})
},
this.queryParams.wholeName = ''
//
onRemoveTag(val) {
this.wholeTypeNameList = this.wholeTypeNameList.filter((e) => e.id != val)
},
/* 删除 */
@ -1165,6 +1242,34 @@ export default {
onChangeInput(val, v) {
this.wholeTypeNameList[v].childrenList.forEach((e) => (e.deviceNum = e.initNum * val))
},
//
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)
},
//
handleReplaceType(e, row) {
console.log('🚀 ~ handleReplaceType ~ e:', e)

View File

@ -294,7 +294,7 @@ import {
getUseNumByTypeId,
getTaskDetail,
submitUpdateBackApply,
getMaTypeDataById,
getFourMaTypeList,
getPreAuditNum,
} from '@/api/claimAndRefund/receive'
import { submitBackApplyApi } from '@/api/claimAndRefund/return'
@ -1079,7 +1079,7 @@ export default {
},
//
async getMaTypeDataByIdFun(val) {
const res = await getMaTypeDataById({ id: val })
const res = await getFourMaTypeList({ id: val, agreementId: this.queryParams.agreementId })
this.typeListDev = res.data
console.log('🚀 ~ getMaTypeDataByIdFun ~ res:', res)
},

View File

@ -140,12 +140,14 @@
align="center"
prop="typeName"
:show-overflow-tooltip="true"
width="200"
/>
<el-table-column
label="规格型号"
align="center"
prop="typeModelName"
:show-overflow-tooltip="true"
width="200"
/>
<el-table-column
label="单位"

View File

@ -129,7 +129,7 @@
width="50"
align="center"
/> -->
<el-table-column label="名称" align="center" key="typeName" prop="typeName" show-overflow-tooltip />
<el-table-column label="名称" align="center" key="typeName" prop="typeName" show-overflow-tooltip width="200" />
<el-table-column
label="计量单位"
align="center"