jiangping
2023-08-17 8d7cb8876ac222eca1c82d5bab250f5551531edb
platform_web/src/components/system/menu/OperaMenuH5Window.vue
@@ -6,7 +6,7 @@
    :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"/>
@@ -20,7 +20,7 @@
      <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="上传图标"
@@ -29,7 +29,7 @@
            @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>
@@ -59,10 +59,8 @@
      // 需排除选择的菜单ID
      excludeMenuId: null,
      uploadData: {
        // floader: 'company/menu'
        folder: 'company/menu'
        floader: 'company/menu'
      },
      parent: {},
      // 表单数据
      form: {
        id: null,
@@ -70,7 +68,6 @@
        name: '',
        path: '',
        icon: '',
        fullIcon: '',
        remark: '',
        type: '2'
      },
@@ -82,12 +79,6 @@
      }
    }
  },
  created () {
    this.config({
      api: '/system/menu'
    })
  },
  methods: {
    /**
     * @title: 窗口标题
@@ -95,21 +86,18 @@
     * @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
      }
@@ -119,18 +107,20 @@
        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>