ソースを参照

新增超级管理员

zhangdan 3 年 前
コミット
d16002431a

+ 5 - 0
src/App.vue

@@ -33,6 +33,11 @@ export default {
     window.addEventListener('beforeunload', () => {
       sessionStorage.setItem('store', JSON.stringify(this.$store.state))
     })
+    this.$message.config({
+      top: `100px`,
+      duration: 3,
+      maxCount: 3
+    })
   }
 }
 </script>

+ 22 - 0
src/api/power-superUser.js

@@ -0,0 +1,22 @@
+import { axios } from '@/utils/request'
+
+// 经销商
+export const getStoreList = params => {
+  const url = `jsxorg/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+
+//保存
+export const saveUserOrg = params => {
+  return axios({
+    url: 'xsorgadmin/saveUserOrg',
+    data: params,
+    method: 'POST'
+  })
+}

+ 11 - 1
src/config/router.config.js

@@ -193,7 +193,7 @@ export const asyncRouterMap = [
             component: () => import(/* webpackChunkName: "auth" */ '@/views/power/user/userList.vue'),
             meta: {
               title: '用户管理',
-              icon: 'user',
+              icon: 'usergroup-add',
               permission: 'M_auth_userList'
             }
           },
@@ -206,6 +206,16 @@ export const asyncRouterMap = [
               icon: 'solution',
               permission: 'M_auth_roleList'
             }
+          },
+          {
+            path: '/auth/setUser',
+            name: 'setUserList',
+            component: () => import(/* webpackChunkName: "auth" */ '@/views/power/superUser/setUser.vue'),
+            meta: {
+              title: '超级管理员',
+              icon: 'user',
+              // permission: 'M_auth_roleList'
+            }
           }
         ]
       },

+ 70 - 0
src/views/common/storeList.vue

@@ -0,0 +1,70 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :value="dealerName"
+    placeholder="请输入名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    @search="fetchUser"
+    @change="handleChange"
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.sn" :value="item.sn">
+      {{ item.name }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import {getStoreList} from '@/api/power-superUser'
+export default {
+  name: "storeList",
+  props: {
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      dealerName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      getStoreList({ 'name': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data.list || []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value)
+    },
+    resetForm () {
+      this.dealerName = []
+    },
+    // 查询详细
+    getDetail (sn) {
+      // dealerFindUpdateInfoBySn({ sn: sn }).then(res => {
+      //   this.$emit('dealerDetail', res.data || null)
+      // })
+    }
+  }
+}
+</script>

+ 54 - 0
src/views/power/superUser/setUser.vue

@@ -0,0 +1,54 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="经销商">
+              <storeList ref="storeList" @change="custChange"></storeList>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-button type="primary" @click="handSubmit" id="roleList-handSubmit" style="margin-right: 10px;">保存</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+  </a-card>
+</template>
+
+<script>
+  import storeList from '@/views/common/storeList.vue'
+  import {saveUserOrg} from '@/api/power-superUser'
+  export default{
+    name: 'setUser',
+    components:{storeList},
+    data(){
+      return{
+        form:{
+          dealerSn:undefined
+        }
+      }
+    },
+    methods:{
+      custChange (val) {
+        console.log(val)
+        this.form.dealerSn = val.key
+      },
+      handSubmit(){
+        const _this=this
+        saveUserOrg({orgSn:this.form.dealerSn}).then(res=>{
+          if(res.status==200){
+            _this.$message.success(res.message)
+            setTimeout(()=>{
+              _this.$refs.storeList.resetForm()
+            },300)
+          }
+        })
+      }
+    }
+  }
+</script>
+
+<style>
+</style>