Commit b0bdf09f by 杨北旺

修复默认值不生效

1 parent fab00912
...@@ -454,19 +454,6 @@ export default { ...@@ -454,19 +454,6 @@ export default {
packageList: [], packageList: [],
editRulePro: {}, editRulePro: {},
editFormPro: {}, editFormPro: {},
// editFormDataPro: [
// {
// label: '',
// name: 'packageCode',
// optionList: [],
// optionId: 'packageCode',
// optionLabel: 'packageName',
// addHtml: 'packageCode',
// handleRadioChange: val => {
// this.packageAttr()
// }
// }
// ],
curSelectPro: [], curSelectPro: [],
curSelectCustomPro: [], curSelectCustomPro: [],
editProductObj: {}, editProductObj: {},
...@@ -1055,7 +1042,6 @@ export default { ...@@ -1055,7 +1042,6 @@ export default {
} else { } else {
this.tempAttributeList.push(temp) this.tempAttributeList.push(temp)
} }
// this.packageCodeList.push(pack.packageCode)
this.handleProductArrParam(this.tempAttributeList, this.packageCodeList) this.handleProductArrParam(this.tempAttributeList, this.packageCodeList)
} else { } else {
let flag = this.autoAttriButeList.findIndex(val => { let flag = this.autoAttriButeList.findIndex(val => {
...@@ -1066,7 +1052,6 @@ export default { ...@@ -1066,7 +1052,6 @@ export default {
} else { } else {
this.autoAttriButeList.push(temp) this.autoAttriButeList.push(temp)
} }
// this.autoPackageCodeList.push(pack.packageCode)
this.handleProductArrParam(this.autoAttriButeList, this.autoPackageCodeList) this.handleProductArrParam(this.autoAttriButeList, this.autoPackageCodeList)
} }
}, },
...@@ -1081,16 +1066,6 @@ export default { ...@@ -1081,16 +1066,6 @@ export default {
blackArr.push([]) blackArr.push([])
} }
const newParaArr = [] const newParaArr = []
// codeList.forEach((item, index) => {
// // 2023 7月底版本 多商品
// let attrStr = `attributes[${index}].packageCode`
// let contractNoStr = `attributes[${index}].contractNo`
// let obj = {
// [attrStr]: item,
// [contractNoStr]: this.routeInfo.contractNo && this.routeInfo.contractNo > -1 ? this.routeInfo.contractNo : ''
// }
// newArr.push(obj)
// })
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < codeList.length; j++) { for (let j = 0; j < codeList.length; j++) {
if (arr[i].packageCode == codeList[j]) { if (arr[i].packageCode == codeList[j]) {
...@@ -1291,7 +1266,7 @@ export default { ...@@ -1291,7 +1266,7 @@ export default {
}) })
}, },
getInfo(productArrData) { getInfo(productArrData) {
this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo,repeatedFlag:this.routeInfo.addOrEdit==4?1:0 }).then(res => { this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo, repeatedFlag: this.routeInfo.addOrEdit == 4 ? 1 : 0 }).then(res => {
this.editForm = { this.editForm = {
...res ...res
} }
...@@ -1382,6 +1357,10 @@ export default { ...@@ -1382,6 +1357,10 @@ export default {
packCode = [] packCode = []
detailInfo.attributes.forEach(item => { detailInfo.attributes.forEach(item => {
let targetItem = productArrData.find(k => k.packageCode == item.packageCode) let targetItem = productArrData.find(k => k.packageCode == item.packageCode)
const defalutAttr = this.handleDefaultValue(targetItem, item.attributeDTOList)
if (defalutAttr.length) {
item.attributeDTOList = [...item.attributeDTOList, ...defalutAttr]
}
if (targetItem.packageType == 1) { if (targetItem.packageType == 1) {
this.equityRadio = 2 this.equityRadio = 2
this.curSelectCustomPro.push(targetItem.packageName) this.curSelectCustomPro.push(targetItem.packageName)
...@@ -1499,47 +1478,34 @@ export default { ...@@ -1499,47 +1478,34 @@ export default {
} }
this.checkCodeList = packCode this.checkCodeList = packCode
this.handleProductArrParam(attrList, packCode) this.handleProductArrParam(attrList, packCode)
// this.editRulePro = {}
// this.editFormPro = {}
// var attrName = ''
// targetItem &&
// targetItem.groupAttributeList.forEach(item => {
// if (item.attributeList.length == 1) {
// attrName = item.attributeList[0].attributeName
// this.$set(this.editFormPro, attrName, tempObj.hasOwnProperty(attrName) ? tempObj[attrName] : '')
// if (item.attributeList[0].required == 1) {
// this.editRulePro[item.attributeList[0].attributeName] = [
// {
// required: true,
// message: '请输入' + item.attributeList[0].attributeDesc,
// trigger: 'change'
// }
// ]
// }
// } else {
// for (var i = 0; i < item.num; i++) {
// item.attributeList.forEach(k => {
// attrName = k.attributeName
// this.$set(this.editFormPro, attrName + i, tempObj.hasOwnProperty(attrName + i) ? tempObj[attrName + i] : '')
// })
// }
// }
// })
// if (recovery) {
// this.recoveryEditFormPro()
// }
}, },
recoveryEditFormPro() { // 处理默认值赋值
this.editForm.attributeList.length && handleDefaultValue(targetItem, attributeDTOList) {
this.editForm.attributeList.forEach((item, idx) => { const currentPackageValue = this.productModal[targetItem.idName]
let hashObj = {} const groupAttributeList = targetItem.groupAttributeList
this.editForm.attributeList let tempArr = [],
.map(i => i.attributeName) result = []
.forEach((i, subIdx) => { for (let key in currentPackageValue) {
Object.keys(hashObj).includes(i) ? (hashObj[i] = hashObj[i] + 1) : (hashObj[i] = 1) for (let i = 0; i < groupAttributeList.length; i++) {
}) if (key === groupAttributeList[i].attributeName) {
this.$set(this.editFormPro, hashObj[item.attributeName] != 1 ? item.attributeName + item.sort : item.attributeName, item.attributeValue) let obj = {
attributeGroup: key,
attributeName: key,
attributeValue: currentPackageValue[key],
sort: 0
}
tempArr.push(obj)
}
}
}
tempArr.forEach(el => {
attributeDTOList.forEach(item => {
if (item.attributeName !== el.attributeName) {
result.push(el)
}
}) })
})
return result
}, },
autoGenerate(arr1, arr2) { autoGenerate(arr1, arr2) {
const tempList = arr1.concat(arr2) const tempList = arr1.concat(arr2)
...@@ -1547,59 +1513,6 @@ export default { ...@@ -1547,59 +1513,6 @@ export default {
return return
} }
this.routeInfo.addOrEdit != '1' ? this.getInfo(tempList) : '' this.routeInfo.addOrEdit != '1' ? this.getInfo(tempList) : ''
// var tempList = []
// this.packageList.forEach(item => {
// tempList = []
// item.groupAttributeList.forEach((k, idx) => {
// if (k.attributeList.length == 1) {
// tempList.push({
// label: k.attributeList[0].attributeDesc,
// name: k.attributeList[0].attributeName,
// type: k.attributeList[0].attributeType,
// isDisabled: this.disabled || this.successDisable,
// maxlength: k.attributeList[0].maxLength
// })
// if (k.attributeList[0].attributeType == 'datePicker') {
// tempList[idx].dateType = 'date'
// ;(tempList[idx].valueFormat = 'yyyy-MM-dd'), (tempList[idx].pickerOptions = 'beforeRangePickerOptions')
// }
// } else {
// var tableList = []
// for (var i = 0; i < k.num; i++) {
// tableList[i] = []
// k.attributeList.forEach((j, index) => {
// tableList[i].push({
// groupName: j.groupName,
// attributeDesc: j.attributeDesc,
// attributeName: j.attributeName,
// name: j.attributeName + i,
// sort: i,
// attributeGroup: j.attributeGroup,
// maxlength: j.maxLength,
// required: j.required,
// attributeType: j.attributeType,
// isDisabled: this.disabled || this.successDisable
// })
// })
// }
// tempList.push({
// label: '',
// name: '',
// addHtml: 'table',
// attributeList: k.attributeList,
// tableList: tableList
// })
// }
// })
// this.editFormDataPro[0].optionList.push({
// packageCode: item.packageCode,
// packageName: item.packageName,
// serviceItems: item.serviceItemsList.length ? item.serviceItemsList.map(k => k.serviceName).join(',') : '',
// serviceItemsList: item.serviceItemsList,
// groupAttributeList: item.groupAttributeList,
// editFormData: this.$common.utils.deepClone(tempList)
// })
// })
}, },
getOptionsList(formName, hasAll = true, refreshSigle) { getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) { if (refreshSigle) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!