Kaynağa Gözat

feat: remove user migration

Casper Dai 2 yıl önce
ebeveyn
işleme
19141245c8

+ 0 - 6
src/router/index.js

@@ -303,12 +303,6 @@ export const asyncRoutes = [
         component: () => import('@/views/realm/user/index'),
         meta: { title: '账号管理' }
       },
-      {
-        path: 'migration',
-        component: () => import('@/views/realm/user/migration/index'),
-        access: Access.MANAGE_TENANTS,
-        meta: { title: '账号迁移' }
-      },
       {
         path: 'device/manage',
         component: Solo,

+ 0 - 114
src/views/realm/user/migration/Account.vue

@@ -1,114 +0,0 @@
-<template>
-  <schema-table
-    ref="table"
-    :schema="schema"
-  >
-    <template #pagination="{ options, pagination }">
-      <div class="l-flex__none u-text--center">
-        <el-button-group
-          v-if="options.params.pageNum > 1 || options.totalCount > options.params.pageSize"
-          class="has-top-padding"
-        >
-          <el-button
-            class="o-pagination-button"
-            type="primary"
-            size="mini"
-            :disabled="options.params.pageNum === 1"
-            @click="onFirstPage(options, pagination)"
-          >
-            首页
-          </el-button>
-          <el-button
-            class="o-pagination-button"
-            type="primary"
-            size="mini"
-            icon="el-icon-arrow-left"
-            :disabled="options.params.pageNum === 1"
-            @click="onPresentPage(options, pagination)"
-          >
-            上一页
-          </el-button>
-          <el-button
-            class="o-pagination-button"
-            type="primary"
-            size="mini"
-            :disabled="options.totalCount <= options.params.pageSize"
-            @click="onNextPage(options, pagination)"
-          >
-            下一页
-            <i class="el-icon-arrow-right el-icon--right" />
-          </el-button>
-        </el-button-group>
-      </div>
-    </template>
-    <c-dialog
-      ref="dialog"
-      size="medium"
-      title="设置"
-    >
-      <template #default>
-        <settings :user="user" />
-      </template>
-    </c-dialog>
-  </schema-table>
-</template>
-
-<script>
-import { getUsersByGroup } from '@/api/user'
-import Settings from './Settings'
-
-export default {
-  name: 'Account',
-  components: {
-    Settings
-  },
-  props: {
-    group: {
-      type: Object,
-      required: true
-    }
-  },
-  data () {
-    return {
-      schema: {
-        list: this.getUsersByGroup,
-        cols: [
-          { prop: 'username', label: '账号' },
-          { type: 'invoke', render: [
-            { label: '设置', on: this.onSettings }
-          ] }
-        ]
-      }
-    }
-  },
-  watch: {
-    group () {
-      this.$refs.table.pageTo(1)
-    }
-  },
-  methods: {
-    getUsersByGroup (params) {
-      return getUsersByGroup({
-        id: this.group.id,
-        ...params
-      })
-    },
-    onFirstPage (options, pagination) {
-      options.params.pageNum = 1
-      pagination()
-    },
-    onPresentPage (options, pagination) {
-      options.params.pageNum -= 1
-      pagination()
-    },
-    onNextPage (options, pagination) {
-      options.params.pageNum += 1
-      pagination()
-    },
-    onSettings (user) {
-      this.user = user
-      this.$refs.dialog.show()
-    }
-  }
-}
-</script>

+ 0 - 192
src/views/realm/user/migration/Settings.vue

@@ -1,192 +0,0 @@
-<template>
-  <div>
-    <template v-if="ready">
-      <div class="l-flex__none">{{ group.path }} {{ group.name }}</div>
-      <div class="l-flex__auto u-overflow--auto">
-        <el-tree
-          ref="tree"
-          class="inline-flex"
-          :data="groups"
-          node-key="path"
-          :props="treeProps"
-          :expand-on-click-node="false"
-          accordion
-          highlight-current
-          @node-click="onGroupClick"
-        />
-      </div>
-      <div class="l-flex__none has-top-padding">
-        <el-button
-          type="danger"
-          size="small"
-          @click="onSaveGroup"
-        >
-          保存
-        </el-button>
-      </div>
-    </template>
-    <div
-      v-else
-      class="u-text--center"
-    >
-      <div
-        v-if="ignore"
-        class="u-bold"
-      >
-        您暂无设置该账号的权限
-      </div>
-      <warning
-        v-if="error"
-        @click="getSettings"
-      />
-    </div>
-  </div>
-</template>
-
-<script>
-import { mapGetters } from 'vuex'
-import {
-  getDepartments,
-  getUserGroups,
-  migrateUser
-} from '@/api/user'
-
-export default {
-  name: 'UserSettings',
-  props: {
-    user: {
-      type: Object,
-      required: true
-    }
-  },
-  data () {
-    return {
-      ready: false,
-      ignore: false,
-      error: false,
-      group: null,
-      treeProps: { children: 'children', label: 'name' }
-    }
-  },
-  computed: {
-    ...mapGetters(['tenant'])
-  },
-  mounted () {
-    this.getSettings()
-  },
-  methods: {
-    async getSettings () {
-      const loading = this.$showLoading()
-      this.ready = false
-      this.error = false
-      try {
-        const { data } = await getDepartments()
-        this.groups = this.groups = [{
-          path: this.tenant,
-          name: '根部门',
-          children: data
-        }]
-        const groups = await getUserGroups(this.user.id)
-        this.group = groups[groups.length - 1]
-        this.ready = true
-      } catch (e) {
-        this.error = true
-      }
-      this.$closeLoading(loading)
-    },
-    onGroupClick (group) {
-      this.$group = group
-    },
-    onSaveGroup () {
-      if (!this.$group) {
-        this.$message({
-          type: 'warning',
-          message: '请选择用户所属的分组'
-        })
-        return
-      }
-      const loading = this.$showLoading()
-      migrateUser({
-        userId: this.user.id,
-        userName: this.user.username,
-        enabled: this.user.enabled ? 1 : 0,
-        departmentId: this.$group.id,
-        path: this.$group.id && this.$group.path
-      }).then(
-        () => {
-          this.group = { ...this.$group }
-          this.$message({
-            type: 'success',
-            message: '修改成功'
-          })
-        }
-      ).finally(() => {
-        this.$closeLoading(loading)
-      })
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-.c-switch {
-  display: inline-block;
-  position: relative;
-  width: 62px;
-  border: 1px solid #bbb;
-  border-radius: 2px;
-  overflow: hidden;
-  cursor: pointer;
-
-  &.checked {
-    .c-switch__inner {
-      margin-left: 0;
-    }
-
-    .c-switch__switch {
-      right: 0;
-    }
-  }
-
-  &__inner {
-    display: block;
-    margin-left: -100%;
-    transition: margin 0.3s ease-in 0s;
-    width: 200%;
-
-    & > span {
-      float: left;
-      width: 50%;
-      height: 24px;
-      font-size: 12px;
-      font-weight: bold;
-      line-height: 24px;
-    }
-  }
-
-  &__active {
-    padding-left: 10px;
-    color: #ffffff;
-    background-image: linear-gradient(to bottom, #00a9ec 0%, #009bd3 100%);
-  }
-
-  &__inactive {
-    padding-right: 10px;
-    color: #4d5258;
-    background-image: linear-gradient(to bottom, #fefefe 0%, #e8e8e8 100%);
-  }
-
-  &__switch {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    width: 23px;
-    right: 39px;
-    margin: 0;
-    border-radius: 2px;
-    transition: all 0.3s ease-in 0s;
-    border: 1px solid #aaa;
-    background-image: linear-gradient(to bottom, #fafafa 0%, #ededed 100%);
-  }
-}
-</style>

+ 0 - 101
src/views/realm/user/migration/index.vue

@@ -1,101 +0,0 @@
-<template>
-  <wrapper
-    fill
-    margin
-    padding
-    background
-    horizontal
-  >
-    <template v-if="groups">
-      <div class="c-sibling-item c-sidebar u-width--md u-overflow--auto">
-        <el-tree
-          ref="groupTree"
-          class="inline-flex"
-          :data="groups"
-          node-key="path"
-          :current-node-key="group.path"
-          :props="treeProps"
-          :expand-on-click-node="false"
-          accordion
-          highlight-current
-          @node-click="setGroup"
-        />
-      </div>
-      <div class="l-flex__fill l-flex c-sibling-item far">
-        <account :group="group" />
-      </div>
-    </template>
-    <template v-else>
-      <div
-        v-loading="loading"
-        class="l-flex__auto l-flex--row center"
-      >
-        <template v-if="!loading">
-          <warning
-            v-if="error"
-            @click="getTree"
-          />
-          <div
-            v-else
-            class="u-bold"
-          >
-            暂无部门,请添加部门
-          </div>
-        </template>
-      </div>
-    </template>
-  </wrapper>
-</template>
-
-<script>
-import { mapGetters } from 'vuex'
-import { getTenantTree } from '@/api/user'
-import Account from './Account'
-
-export default {
-  name: 'UserMigration',
-  components: {
-    Account
-  },
-  data () {
-    return {
-      loading: true,
-      error: false,
-      groups: null,
-      group: null,
-      treeProps: { children: 'subGroups', label: 'label' }
-    }
-  },
-  computed: {
-    ...mapGetters(['tenant'])
-  },
-  created () {
-    this.getTree()
-  },
-  methods: {
-    getTree () {
-      this.loading = true
-      this.error = false
-      getTenantTree().then(
-        ({ data }) => {
-          if (data.length) {
-            this.groups = data
-            this.setGroup(this.groups[0])
-          }
-        },
-        () => {
-          this.error = true
-        }
-      ).finally(() => {
-        this.loading = false
-      })
-    },
-    setGroup (group) {
-      if (!this.group || this.group.id !== group.id) {
-        this.$emit('change', group)
-        this.group = group
-      }
-    }
-  }
-}
-</script>