浏览代码

菜单编辑,编辑信息上级不为顶级时切换应用置灰

俞宝山 4 年之前
父节点
当前提交
8d24cf991c
共有 1 个文件被更改,包括 24 次插入1 次删除
  1. 24 1
      _web/src/views/system/menu/editForm.vue

+ 24 - 1
_web/src/views/system/menu/editForm.vue

@ -49,7 +49,7 @@
              label="所属应用"
              has-feedback
            >
              <a-select style="width: 100%" placeholder="请选择应用分类" v-decorator="['application', {rules: [{ required: true, message: '请选择应用分类!' }]}]" >
              <a-select style="width: 100%" :disabled="appDisabled" placeholder="请选择应用分类" v-decorator="['application', {rules: [{ required: true, message: '请选择应用分类!' }]}]" >
                <a-select-option v-for='(item,index) in appData' :key="index" :value="item.code" @click="changeApplication(item.code)">{{item.name}}</a-select-option>
              </a-select>
            </a-form-item>
@ -83,6 +83,7 @@
                  :treeData="menuTreeData"
                  placeholder="请选择父级菜单"
                  treeDefaultExpandAll
                  @change="setPid"
                >
                  <span  slot="title" slot-scope="{ id }">{{ id }}
                  </span>
@ -321,10 +322,23 @@
        linkRequired:true,
        linkDisabled:false,
        type:'',
        pid:'',
        appDisabled:false,
        form: this.$form.createForm(this),
      }
    },
    watch: {
      pid(val) {
        if(val === '0'){
           //再不能切换应用
          this.appDisabled = false
        }else{
          this.appDisabled = true
        }
      }
    },
    methods: {
      //打开页面初始化
      edit (record) {
@ -371,6 +385,7 @@
          }
        );
        this.form.getFieldDecorator('pid',{initialValue:record.pid})
        this.pid = record.pid
      },
      /**
@ -393,6 +408,13 @@
        })
      },
      /**
       * 选择父级
       */
      setPid(value){
        this.pid = value
      },
      getSysApplist() {
        return getAppList().then((res) => {
          if (res.success) {
@ -455,6 +477,7 @@
          this.componentRequired=true
          //父级初始化顶级,并将其隐藏
          this.form.getFieldDecorator('pid',{initialValue:'0'})
          this.pid = '0'
          this.pidShow=false
        }else{
          if(type=='1'){