jinlin
2024-02-23 1772fc5e211f9e9e0ab4cdc6c29b436aac178c2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<template>
  <zt-dialog ref="dialog" :title="$t('tenant.menuRight')" @confirm="formSubmit" append-to-body>
    <el-form :model="dataForm" ref="dataForm">
      <zt-tree-selector ref="tree" v-model="dataForm.menuIdList" url="/sys/menu/systems" has-half-checked multiple/>
    </el-form>
  </zt-dialog>
</template>
 
<script>
  export default {
    data() {
      return {
        dataForm: {
          tenantId: '',
          menuIdList: []
        }
      }
    },
    methods: {
      init(tenantId) {
        this.dataForm.tenantId = tenantId // 角色id为租户id
      },
      // 获取信息
      async getInfo() {
        let res = await this.$http.get(`/sys/role/menu?roleId=${this.dataForm.tenantId}`)
        if (res.success) {
          this.dataForm.menuIdList = res.data
        }
      },
      // 表单提交
      async formSubmit() {
        let res = await this.$http.post(`/sys/tenant/menu`, this.dataForm)
        if (res.success) {
          this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('refreshDataList')
        }
      }
    }
  }
</script>