积分商城

This commit is contained in:
2024-03-28 09:43:43 +08:00
parent 8d314157fe
commit de92031284
11 changed files with 1301 additions and 156 deletions

View File

@@ -19,7 +19,7 @@
pidkey: { default: 'pid' }, // 对应父id取值
placeholder: { default: '请选择' },
emitPath: { default: false, type: Boolean }, // 是否子父级关联 是的时候返回的是逗号分隔的父子code
level: { default: 3, type: Number } // 列数 2或者3
level: { default: 2, type: Number } // 列数 2或者3
},
data() {
return {
@@ -30,21 +30,20 @@
},
methods: {
handleColumnChange(e) {
let columnindex = e.detail.value; // 拖动列索引
switch (e.detail.column) {
case 0: //拖动第1列
// 第二级
let arr1 = this.multiArray[0];
this.multiArray[1] = arr1[columnindex][this.childkey]||[];
if(this.level === 3) {
// 第三级
let arr2 = this.multiArray[1];
this.multiArray[2] = arr2[0][this.childkey]||[];
}
this.multiIndex.splice(0, 1, columnindex)
this.multiIndex.splice(1, 1, 0)
this.multiIndex.splice(2, 1, 0)
@@ -55,14 +54,14 @@
let arr3 = this.multiArray[1];
this.multiArray[2] = arr3[columnindex][this.childkey]||[];
}
this.multiIndex.splice(1, 1, columnindex)
this.multiIndex.splice(2, 1, 0)
break
}
},
//
//
pickerChange(e) {
let multiIndex = e.detail.value;
if(this.emitPath) {
@@ -75,21 +74,19 @@
}
let code = codeArr.join(',');
this.name = nameArr.join('/');
console.log('code1',code);
this.$emit('input', code)
}else {
let curArr = this.multiArray[2], code='';
if(curArr && curArr.length) {
code = curArr[multiIndex[2]][this.code];
this.name = curArr[multiIndex[2]][this.rangekey];
}else {
}else {
curArr = this.multiArray[1]
code = curArr[multiIndex[1]][this.code];
this.name = curArr[multiIndex[1]][this.rangekey];
}
console.log('code2',code);
this.$emit('input', code)
}
},
@@ -104,7 +101,7 @@
// 第三级
let arr2 = this.multiArray[1];
this.multiArray.push(arr2[this.multiIndex[1]][this.childkey]||[]);
}
},
curDataFind (data, code) {
@@ -151,16 +148,17 @@
list: {
immediate: true,
handler(val) {
console.log(val)
this.dataInit();
this.initName();
if(JSON.stringify(val) != '[]'){
this.dataInit();
this.initName();
}
}
},
value: {
// immediate: true,
handler(val) {
console.log(val)
this.initName();
this.initName();
}
},
}
@@ -168,5 +166,5 @@
</script>
<style lang="scss" scoped>
</style>
</style>