代码回滚

This commit is contained in:
BianLzhaoMin 2025-03-12 10:38:01 +08:00
parent e72ab32224
commit 4327215dc1
1 changed files with 1052 additions and 1066 deletions

View File

@ -57,23 +57,18 @@
<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="请选择抱杆设备"
placeholder="请选择成套设备"
@change="onChangeWholeTypeName"
v-model="queryParams.wholeTypeName"
>
<el-option
v-for="item in holdingPoleSelList"
:key="item.id"
:label="item.wholeTypeName"
: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 label="规格型号" prop="status">
<el-form-item label="类型名称" prop="status">
<el-cascader
filterable
collapse-tags
@ -84,12 +79,23 @@
ref="deviceTypeCascader"
:options="deviceTypeTree"
@change="deviceTypeChange"
placeholder="请输入规格型号"
placeholder="请输入类型名称"
popper-class="popper-select"
:props="deviceTypeTreeProps"
:disabled="(isEdit && !isView) || isCost || wholeTypeNameList.length > 0"
></el-cascader>
</el-form-item>
<el-form-item label="规格型号" prop="typeId">
<el-select
v-model="queryParams.typeId"
filterable
clearable
style="width: 240px"
placeholder="请选择规格型号"
@change="changeType"
>
<el-option v-for="item in typeListDev" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="预计领料时间" prop="estimateLeaseTime">
<el-date-picker
v-model="queryParams.estimateLeaseTime"
@ -222,22 +228,10 @@
</el-table-column>
<el-table-column label="备注" align="center" prop="createTime">
<template slot-scope="scope">
<el-input
maxlength="100"
v-model="scope.row.remark"
placeholder="请输入备注"
clearable
style="width: 100%"
/>
<el-input maxlength="100" v-model="scope.row.remark" placeholder="请输入备注" clearable style="width: 100%" />
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
fixed="right"
class-name="small-padding fixed-width"
v-if="isView"
>
<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"-->
@ -286,6 +280,7 @@ import {
getAgreementInfoByIdApi,
getHoldingPoleSelListApi,
getLevelTwoUnitCbx,
getMaTypeDataById,
} from '@/api/claimAndRefund/receive'
import { getInfo } from '@/api/login'
export default {
@ -383,6 +378,7 @@ export default {
deptOptions: [],
//
queryParams: {
typeId: null,
types: 2,
unitId: null,
proId: null,
@ -408,6 +404,8 @@ export default {
{ id: '0', name: '工程租赁' },
{ id: '1', name: '长期领用' },
], //
typeListDev: [], //
selectParams: {},
leaseApplyDetails: [],
leaseApplyInfoList: [],
//
@ -473,7 +471,7 @@ export default {
//
deviceTypeTreeProps: {
multiple: true,
// multiple: true,
value: 'id',
},
//
@ -599,7 +597,7 @@ export default {
//
async GetDeviceTypeTree() {
const params = {
level: 4,
level: 3,
}
getDeviceTypeTree(params).then((res) => {
this.deviceTypeTree = res.data
@ -896,12 +894,12 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.deviceType.forEach((e, index) => {
if (e[3] === row.typeId) {
this.deviceType.splice(index, 1)
this.propsKey++
}
})
// this.deviceType.forEach((e, index) => {
// if (e[3] === row.typeId) {
// this.deviceType.splice(index, 1)
// this.propsKey++
// }
// })
this.leaseApplyDetails.splice(row.index, 1)
},
/** 导出按钮操作 */
@ -921,91 +919,51 @@ 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,
// 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) {
// for (let i in val) {
// console.log(val[i], '----+++')
// }
// }
let tempList = []
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
tempList.push({
createBy: this.user.name,
typeId: id,
num,
companyId,
unitCn: unitName,
typeCn: deviceTypeList[z].pathLabels[2],
guigeCn: deviceTypeList[z].pathLabels[3],
})
break
}
}
}
// 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 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)
}
})
})
this.leaseApplyDetails = newArray_array
} else {
this.leaseApplyDetails = []
}
// const templateList = deviceTypeList.map((e) => {
// let { num, companyId, id, unitName } = e.data
// return {
// const isRepeat = this.leaseApplyDetails.some((e) => e.typeId === id)
// if (!isRepeat) {
// this.leaseApplyDetails.push({
// createBy: this.user.name,
// typeId: id,
// num,
// companyId,
// typeId: id,
// unitCn: unitName,
// typeCn: e.pathLabels[2],
// guigeCn: e.pathLabels[3],
// }
// typeCn: deviceTypeList[z].pathLabels[2],
// guigeCn: deviceTypeList[z].pathLabels[3],
// })
// this.leaseApplyDetails = [...new Set(templateList)]
// console.log(templateList, '----')
// let nodes = null
// nodes =
// this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
// ? this.$refs.deviceTypeCascader.getCheckedNodes()
// : [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
// if (nodes[0].level != 4) {
// return
// }
// // console.log(this.leaseApplyDetails)
// // console.log(nodes[0].data.id)
// for (let i = 0; i < this.leaseApplyDetails.length; i++) {
// if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) {
// this.leaseApplyDetails.splice(i, 1)
// break
// }
// }
// this.leaseApplyDetails.push(this.handelTableItemData(nodes[0]))
// this.deviceType = {}
// }
// }
// console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails)
// } else {
// this.leaseApplyDetails = []
// }
},
////
handelTableItemData(node) {
@ -1091,6 +1049,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
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)
},
},
}
</script>