MrShi
2024-02-22 8d7bb4ac830444afde480a588e99952105ea8ede
platform/src/components/common/MenuSelect.vue
@@ -12,7 +12,7 @@
<script>
import TreeSelect from './TreeSelect'
import { fetchTree } from '@/api/system/menu'
import { fetchTree, fetchTree1 } from '@/api/system/menu'
export default {
  name: 'MenuSelect',
  components: { TreeSelect },
@@ -20,6 +20,9 @@
    value: {},
    inline: {
      default: true
    },
    type: {
      default: '0'
    },
    placeholder: {
      default: '请选择菜单'
@@ -30,10 +33,6 @@
    },
    appendToBody: {
      default: false
    },
    type: {
      type: String|Number,
      default: 0
    },
    // 需被排除的部门ID
    excludeId: {}
@@ -51,7 +50,8 @@
  methods: {
    // 获取所有菜单
    fetchData () {
      fetchTree({}, this.type)
      if (this.type === '1') {
        fetchTree1()
        .then(records => {
          this.data = []
          this.__fillData(this.data, records)
@@ -59,6 +59,16 @@
        .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) {