修复商品分类选择有误的问题

master
toesbieya 6 years ago
parent 3de9fc9cc2
commit c5f6f47b92
  1. 17
      vue/src/views/purchase/order/components/CategorySelector.vue

@ -40,7 +40,9 @@
computed: {
tree() {
return this.$store.state.dataCache.categoryTree
const arr = this.$store.state.dataCache.categoryTree
this.addDisabledAttr(arr)
return arr
},
selectableCategories() {
return this.$store.state.dataCache.categories.filter(i => i.type === 1)
@ -50,14 +52,17 @@
methods: {
init() {
if (this.tree.length === 0) {
getAll()
.then(data => {
data.forEach(i => i._disabled = i.type === 0)
this.$store.commit('dataCache/categories', data)
})
getAll().then(data => this.$store.commit('dataCache/categories', data))
}
},
addDisabledAttr(arr) {
arr.forEach(i => {
i._disabled = i.type !== 1
i.children && this.addDisabledAttr(i.children)
})
},
change(v) {
if (isEmpty(v) || this.selected.length <= 0) return
if (this.selected.includes(v)) {

Loading…
Cancel
Save