flat: 暂存
This commit is contained in:
@@ -32,17 +32,26 @@ export default {
|
||||
choose: false,
|
||||
chooseIndex: '',
|
||||
parentId: undefined,
|
||||
parentLabel: null,
|
||||
layer: 1,
|
||||
maxLayer: 2,
|
||||
id: '',
|
||||
label: '',
|
||||
|
||||
parentTwoId: '',
|
||||
parentTwoLabel: '',
|
||||
tradeId: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
city() {
|
||||
if (this.parentId) {
|
||||
if(!this.workTypeList.length) return;
|
||||
if(this.parentTwoId) {
|
||||
const parentItem = this.workTypeList.find(item => item.id == this.parentId);
|
||||
const parentChild = parentItem.child.find(item => item.id == this.parentTwoId);
|
||||
if (parentItem) {
|
||||
return parentChild.child
|
||||
}
|
||||
} else if (this.parentId) {
|
||||
const parentItem = this.workTypeList.find(item => item.id == this.parentId);
|
||||
if (parentItem) {
|
||||
return parentItem.child;
|
||||
@@ -55,7 +64,6 @@ export default {
|
||||
mounted() {
|
||||
getWorktypesList(2).then(res => {
|
||||
this.workTypeList = res.data.data;
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
@@ -63,9 +71,15 @@ export default {
|
||||
tradeId,
|
||||
parentId,
|
||||
layer,
|
||||
maxLayer
|
||||
maxLayer,
|
||||
parentLabel,
|
||||
parentTwoId,
|
||||
parentTwoLabel
|
||||
}) {
|
||||
this.parentLabel = parentLabel
|
||||
this.parentId = parentId
|
||||
this.parentTwoId = parentTwoId
|
||||
this.parentTwoLabel = parentTwoLabel
|
||||
this.tradeId = tradeId || 0
|
||||
this.layer = parseInt(layer || 1)
|
||||
this.maxLayer = parseInt(maxLayer || 2)
|
||||
@@ -73,18 +87,33 @@ export default {
|
||||
onShow: function () { },
|
||||
methods: {
|
||||
cityClick(item) {
|
||||
console.log('items', item, this.layer, this.maxLayer)
|
||||
if (this.layer === this.maxLayer) {
|
||||
this.selectCity(item)
|
||||
} else {
|
||||
this.goCityInfo(item)
|
||||
switch (this.layer) {
|
||||
case 1:
|
||||
this.goCityInfo(item)
|
||||
break
|
||||
case 2:
|
||||
this.goCityInfoTwo(item)
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
selectCity(item) {
|
||||
console.log(item, "item");
|
||||
this.id = item.id;
|
||||
this.label = item.name;
|
||||
|
||||
},
|
||||
goCityInfoTwo(item) {
|
||||
this.twoId = item.id;
|
||||
this.twoLabel = item.name;
|
||||
uni.navigateTo({
|
||||
url: `./skillLevel?layer=${this.layer + 1}&maxLayer=${this.maxLayer}&parentId=${this.parentId
|
||||
}&parentLabel=${this.parentLabel}&parentTwoId=${item.id}&parentTwoLabel=${item.name}`
|
||||
})
|
||||
},
|
||||
goCityInfo(item) {
|
||||
uni.navigateTo({
|
||||
url: `./skillLevel?layer=${this.layer + 1}&maxLayer=${this.maxLayer}&parentId=${item.id}&parentLabel=${item.name}`
|
||||
@@ -92,7 +121,13 @@ export default {
|
||||
},
|
||||
comfirm: function () {
|
||||
if (this.id) {
|
||||
uni.$emit('setSkill', { detail: { id: this.id, label: this.label, parentLabel: this.$route.query.parentLabel } })
|
||||
uni.$emit('setSkill', { detail: {
|
||||
id: this.id,
|
||||
label: this.label,
|
||||
parentLabel: this.$route.query.parentLabel,
|
||||
parentTwoLabel: this.$route.query.parentTwoLabel
|
||||
} ,
|
||||
})
|
||||
uni.navigateBack({
|
||||
delta: this.layer
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user