|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import TreeSelect from './TreeSelect' | 
|---|
|  |  |  | // import { fetchTree, fetchTree1 } from '@/api/system/menu' | 
|---|
|  |  |  | import { fetchTree } from '@/api/system/menu' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'MenuSelect', | 
|---|
|  |  |  | 
|---|
|  |  |  | value: {}, | 
|---|
|  |  |  | inline: { | 
|---|
|  |  |  | default: true | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | type: { | 
|---|
|  |  |  | default: '0' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | placeholder: { | 
|---|
|  |  |  | default: '请选择菜单' | 
|---|
|  |  |  | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | // 获取所有菜单 | 
|---|
|  |  |  | fetchData () { | 
|---|
|  |  |  | fetchTree() | 
|---|
|  |  |  | .then(records => { | 
|---|
|  |  |  | this.data = [] | 
|---|
|  |  |  | this.__fillData(this.data, records) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | if (this.type === '1') { | 
|---|
|  |  |  | // fetchTree1() | 
|---|
|  |  |  | //   .then(records => { | 
|---|
|  |  |  | //     this.data = [] | 
|---|
|  |  |  | //     this.__fillData(this.data, records) | 
|---|
|  |  |  | //   }) | 
|---|
|  |  |  | //   .catch(e => { | 
|---|
|  |  |  | //     this.$tip.apiFailed(e) | 
|---|
|  |  |  | //   }) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | fetchTree() | 
|---|
|  |  |  | .then(records => { | 
|---|
|  |  |  | this.data = [] | 
|---|
|  |  |  | this.__fillData(this.data, records) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 填充菜单树 | 
|---|
|  |  |  | __fillData (list, pool) { | 
|---|