|
|
@@ -27,7 +27,33 @@ export default {
|
|
|
let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
|
|
|
// axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
|
|
|
// .then(response => {
|
|
|
- return { kinds: data }
|
|
|
+ if (!data || data.length === 0) {
|
|
|
+ data = []
|
|
|
+ } else {
|
|
|
+ data.push({
|
|
|
+ id: '其他',
|
|
|
+ nameCn: '其他',
|
|
|
+ children: [],
|
|
|
+ isLeaf: 1,
|
|
|
+ parentid: 0,
|
|
|
+ level: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let arr = []
|
|
|
+ let firstData = {
|
|
|
+ id: null,
|
|
|
+ nameCn: '全部分类',
|
|
|
+ children: [],
|
|
|
+ isLeaf: 0,
|
|
|
+ parentid: 0,
|
|
|
+ level: 1
|
|
|
+ }
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ firstData.children.push(data[i])
|
|
|
+ }
|
|
|
+ arr.push(firstData)
|
|
|
+ console.log(arr)
|
|
|
+ return { kinds: arr }
|
|
|
// })
|
|
|
},
|
|
|
components: {
|