|
|
- formDesc: {
- name: {
- type: 'input',
- label: '菜单名称'
- },
- module_name: {
- type: 'select',
- label: '模块名称',
- isOptions: true,
- options: this.initAddons()
- },
- is_show: {
- type: 'radio',
- label: '是否隐藏',
- isOptions: true,
- options: [
- {
- text: '不隐藏',
- value: 0
- },
- {
- text: '隐藏',
- value: 1
- }
- ],
- default: 0
- },
- parent: {
- label: '父级菜单',
- // 只需要在这里指定为 tree-select 即可
- type: 'tree-select',
- // 属性参考: https://vue-treeselect.js.org/
- attrs: {
- multiple: false,
- clearable: true
- },
- vif: (data) => data.module_name,
- // 这里必须制定 optionsLinkageFields 做为关联字段,当次字段值发生变化时,会重新出发请求
- optionsLinkageFields: ['module_name', 'name'],
- options: async(data) => {
- if (data.name || data.module_name) {
- const obj = {}
- this.$set(obj, 'Menu[module_name]', data.module_name)
- const res = await fetchList(obj)
- const arr = [
- {
- id: 0,
- label: '一级菜单'
- }
- ]
- return arr.concat(res.data.list)
- }
- }
- },
- level_type: {
- type: 'radio',
- label: '菜单等级类型',
- isOptions: true,
- options: this.initMenType()
- },
- route_id: {
- type: 'select',
- label: '页面路径',
- isOptions: true,
- tip: '当菜单为二级且有子菜单时,请选择/main/index',
- vif: (data) => data.module_name,
- // 这里必须制定 optionsLinkageFields 做为关联字段,当字段值发生变化时,会重新出发请求
- optionsLinkageFields: ['module_name', 'name', 'level_type'],
- options: async(data) => {
- const arr = [
- {
- text: '选择菜单地址',
- value: ''
- }
- ]
- if (data.name || data.module_name || data.level_type) {
- const list = await fetchRoute({
- module_name: data.level_type !== 3 ? data.module_name : 'system',
- route_type: [0, 1, 2]
- })
- list.data.forEach((item, index) => {
- if (item.label.indexOf('*') === -1) {
- arr.push({
- text: item.label,
- value: item.id
- })
- }
- })
- if (data.level_type === 3) {
- return arr.filter((itm) => itm.text === '/main/index.vue')
- } else {
- return arr
- }
- }
- },
- on: {
- change(val) {
- console.log(val)
- }
- },
- attrs: {
- filterable: true
- }
- },
- icon: {
- type: 'FireIcon',
- label: '菜单图标'
- },
- order: {
- type: 'input',
- label: '菜单排序'
- },
- data: {
- type: 'textarea',
- label: '菜单数据',
- attrs: {
- autosizeType: 'switch',
- autosize: false
- }
- }
- }
复制代码
|
|