| | |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | > |
| | | <p class="tip" v-if="form.parentId != null && form.id == null">为 <em>{{parentName}}</em> 新建子菜单</p> |
| | | <p class="tip" v-if="form.parent != null && form.id == null">为 <em>{{parentName}}</em> 新建子菜单</p> |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="上级菜单" prop="parentId"> |
| | | <MenuSelect v-if="visible" v-model="form.parentId" placeholder="请选择上级菜单" type="2" :exclude-id="excludeMenuId" clearable :inline="false"/> |
| | |
| | | <el-form-item label="图标" prop="icon" class="form-item-icon"> |
| | | <div style="display: flex;"> |
| | | <UploadAvatarImage |
| | | :file="{ 'imgurlfull': form.fullIcon, 'imgurl': form.icon }" |
| | | :file="{ 'imgurlfull': form.icon, 'imgurl': form.icon }" |
| | | :uploadData="uploadData" |
| | | customStyle="width: 80px; height: 80px;" |
| | | tipsLabel="上传图标" |
| | |
| | | @uploadBegin="isUploading=true" |
| | | /> |
| | | <div style="display: flex; flex-direction: column-reverse;" v-if="!!form.icon"> |
| | | <el-button style="margin-left: 5px; padding: 0 5px;" type="text" @click="deletePic">删除</el-button> |
| | | <el-button style="margin-left: 5px; padding: 0 5px;" type="text" @click="form.icon=''">删除</el-button> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | |
| | | // 需排除选择的菜单ID |
| | | excludeMenuId: null, |
| | | uploadData: { |
| | | // floader: 'company/menu' |
| | | folder: 'company/menu' |
| | | floader: 'company/menu' |
| | | }, |
| | | parent: {}, |
| | | // 表单数据 |
| | | form: { |
| | | id: null, |
| | |
| | | name: '', |
| | | path: '', |
| | | icon: '', |
| | | fullIcon: '', |
| | | remark: '', |
| | | type: '2' |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | created () { |
| | | this.config({ |
| | | api: '/system/menu' |
| | | }) |
| | | }, |
| | | methods: { |
| | | /** |
| | | * @title: 窗口标题 |
| | |
| | | * @parent: 新建时的上级菜单 |
| | | * @type: 0平台 1、企业 2、h5 |
| | | */ |
| | | open (title, target, parent) { |
| | | debugger |
| | | open (title, target, parent, type) { |
| | | this.title = title |
| | | |
| | | this.visible = true |
| | | // 新建,menu为空时表示新建菜单 |
| | | if (target == null) { |
| | | this.excludeMenuId = null |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | this.parent = parent |
| | | this.form.id = null |
| | | this.form.parentId = parent == null ? null : parent.id |
| | | this.parentName = parent == null ? null : parent.name |
| | | this.form.fullIcon = '' |
| | | this.form.type = type |
| | | }) |
| | | return |
| | | } |
| | |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | } |
| | | this.form.fullIcon = !!target.icon ? (target.resourcePath + target.icon) : '' |
| | | }) |
| | | }, |
| | | uploadReverseSuccess(file) { |
| | | this.form.icon = file.imgurl; |
| | | this.form.fullIcon = file.imgurlfull; |
| | | }, |
| | | deletePic() { |
| | | this.form.fullIcon='' |
| | | this.form.icon='' |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | api: '/system/menu' |
| | | }) |
| | | }, |
| | | methods: { |
| | | uploadReverseSuccess(file) { |
| | | // this.form. = file.imgurl; |
| | | this.form.icon = file.imgurlfull; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |