|
|
|
@ -99,7 +99,7 @@
|
|
|
|
|
:show-all-levels="false" |
|
|
|
|
style="width: 100%" |
|
|
|
|
v-model="form.category" |
|
|
|
|
@change="categoryChange(form.category,a)" |
|
|
|
|
@change="categoryChange" |
|
|
|
|
></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
@ -316,6 +316,7 @@ export default {
|
|
|
|
|
DryWarehouseDistributionCID: '', //配送ID |
|
|
|
|
clientOptions: [], //客户集合 |
|
|
|
|
categoryData:[],//品类数据 |
|
|
|
|
categoryDataID:[],//品类数据的ID |
|
|
|
|
activeName: 'second', |
|
|
|
|
// 分页信息 |
|
|
|
|
page: { |
|
|
|
@ -361,7 +362,9 @@ export default {
|
|
|
|
|
lazy: true, |
|
|
|
|
multiple: true, |
|
|
|
|
checkStrictly: true, |
|
|
|
|
lazyLoad(node, resolve) { |
|
|
|
|
lazyLoad:(node, resolve)=> { |
|
|
|
|
console.log(this,'this'); |
|
|
|
|
let _this=this |
|
|
|
|
const { level } = node; |
|
|
|
|
setTimeout(async () => { |
|
|
|
|
// console.log("node/////////",node); |
|
|
|
@ -369,7 +372,10 @@ export default {
|
|
|
|
|
// console.log("par",parentId); |
|
|
|
|
let shuju = await getDeptLazyTree(parentId); |
|
|
|
|
console.log(shuju,'品类数据'); |
|
|
|
|
|
|
|
|
|
shuju.data.data.forEach((item=>{ |
|
|
|
|
_this.categoryData.push(item) |
|
|
|
|
})) |
|
|
|
|
console.log(_this.categoryData,'categoryData'); |
|
|
|
|
// console.log(")))))))))))",shuju); |
|
|
|
|
const nodes = Array.from(shuju.data.data).map(item => ({ |
|
|
|
|
value: item.id, |
|
|
|
@ -482,7 +488,22 @@ export default {
|
|
|
|
|
// this.form.details = this.DryWarehouseDistributionB; |
|
|
|
|
this.form.details = [].concat(...this.DryWarehouseDistributionA, ...this.DryWarehouseDistributionB, ...this.DryWarehouseDistributionC); |
|
|
|
|
console.log('提交的数据》》》', this.form); |
|
|
|
|
|
|
|
|
|
console.log(this.categoryDataID,'id'); |
|
|
|
|
console.log(this.categoryData,'名字'); |
|
|
|
|
let matchedData = this.categoryDataID.map(subArray => { |
|
|
|
|
// subArray 应该包含一个元素,即 id |
|
|
|
|
if (subArray.length === 1) { |
|
|
|
|
let idToMatch = subArray[0]; |
|
|
|
|
// 在 datas 中寻找匹配的 id |
|
|
|
|
let matched = this.categoryData.find(data => data.id === idToMatch); |
|
|
|
|
// 如果找到匹配,则返回对应的对象 |
|
|
|
|
if (matched) { |
|
|
|
|
return matched; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
}).filter(item => item !== null); // 过滤掉任何未匹配的值(null) |
|
|
|
|
console.log(matchedData,'筛选出来的值'); |
|
|
|
|
return |
|
|
|
|
add(this.form).then(() => { |
|
|
|
|
this.$store.commit('DEL_TAG_CURRENT'); //关闭当前页面 |
|
|
|
@ -734,7 +755,19 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
categoryChange(val,a){ |
|
|
|
|
console.log(val,a); |
|
|
|
|
let newArray = val.map(subArray => { |
|
|
|
|
// 如果内层数组长度大于 1,则只取最后一个元素组成新的数组 |
|
|
|
|
if (subArray.length > 1) { |
|
|
|
|
return [subArray[subArray.length - 1]]; |
|
|
|
|
} |
|
|
|
|
// 否则,直接保留这个数组 |
|
|
|
|
return subArray; |
|
|
|
|
}); |
|
|
|
|
this.categoryDataID=newArray |
|
|
|
|
console.log(this.categoryDataID,'data中的数据'); |
|
|
|
|
console.log(newArray,'重新组织的'); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleCheckedCitiesChange(value, index) { |
|
|
|
|
//费用选择 |
|
|
|
|
console.log('>>>>>>>', value, index); |
|
|
|
|