代码回滚

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