Просмотр исходного кода

会员类别管理对新增权限修改

zhuhao 2 лет назад
Родитель
Сommit
95a84e8a39
4 измененных файлов с 154 добавлено и 44 удалено
  1. 28 0
      src/api/admin.js
  2. 100 31
      src/views/client/index.vue
  3. 0 5
      src/views/memberType/components/table.vue
  4. 26 8
      src/views/memberType/index.vue

+ 28 - 0
src/api/admin.js

@@ -422,5 +422,33 @@ export default {
     addRolePersonnelBatch(params) {
         return axios.post('/permission/api/role/addRolePersonnelBatch', params)
     },
+    
+    /**
+     * 会员类别权限管理新增
+     */
+    addNewTenantVipType(params) {
+        return axios.post('/permission/api/tenantVipType/addNew', params)
+  },
+    
+    /**
+     * 会员类别权限管理查询
+     */
+    queryTenantVipType(params) {
+        return axios.post('/permission/api/tenantVipType/queryTenantVipType', params)
+  },
+    
+    /**
+     * 会员类别权限管理更新
+     */
+    updateNewTenantVipType(params) {
+        return axios.post('/permission/api/tenantVipType/update', params)
+  },
+    
+    /**
+     * 会员类别权限管理删除
+     */
+    deleteTenantVipType(params) {
+        return axios.get('/permission/api/tenantVipType/delete', {params})
+    },
 
 }

+ 100 - 31
src/views/client/index.vue

@@ -51,6 +51,7 @@
     <div class="pagination">
       <el-pagination :current-page.sync="queryParams.current" :page-size="queryParams.size" :total="total" @current-change="handleCurrentChange" layout="total, prev, pager, next, jumper" background></el-pagination>
     </div>
+    <!-- 新增、编辑租户弹框 -->
     <el-dialog :title="title" :visible.sync="visible" width="500px" :before-close="close">
       <el-form v-if="visible" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="110px" label-position="left">
 
@@ -97,7 +98,7 @@
           <el-col :span="24">
             <el-form-item label="类型" prop="type">
               <!-- <el-input v-model="ruleForm.type" placeholder="请输入类型"></el-input> -->
-              <el-select v-model="ruleForm.type" filterable placeholder="请选择类型" style="width: 100%" @change="getType">
+              <el-select v-model="ruleForm.type" :filterable="true" placeholder="请选择类型" style="width: 100%" @change="getType">
                 <el-option v-for="item in dictionaries.TENANT_TYPE" :key="item.id" :value="item.dictChildValue" :label="item.dictChildLabel"></el-option>
               </el-select>
             </el-form-item>
@@ -137,6 +138,25 @@
         </el-row>
         <el-row :gutter="24">
           <el-col :span="24">
+            <el-form-item label="会员类别" prop="tenantVipType">
+              <el-col  style="padding-left: 0px;padding-right: 0px;">
+                <el-select v-model="ruleForm.tenantVipType" placeholder="请选择会员类别" :filterable="true" style="width: 260px; margin-right: 20px;">
+                  <el-option v-for="item in memberTypes"
+                  :key="item.id"
+                  :label="item.tenantVipName"
+                  :value="item.id">
+                  </el-option>
+                </el-select>
+                <el-tooltip content="点击查看当前选择的会员类别及功能权限" placement="top">
+                  <!-- <el-link type="primary" @click="memberTypeBtn">会员类别</el-link> -->
+                  <el-button @click="memberTypeBtn">查看</el-button>
+                </el-tooltip>
+              </el-col>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <!-- <el-row :gutter="24">
+          <el-col :span="24">
             <el-form-item label="功能权限" prop="function">
            <el-cascader
               ref="FunctionCascader"
@@ -148,10 +168,9 @@
               clearable
               @change="downloadChange"
               style="width:100%"></el-cascader>
-          <!-- <el-input v-model="ruleForm.function" placeholder="请输入功能权限"></el-input> -->
         </el-form-item>
           </el-col>
-        </el-row>
+        </el-row> -->
         <el-form-item label="是否启用" prop="state">
                   <el-switch
           :active-value="1" 
@@ -213,12 +232,35 @@
         </el-form>
 
     </el-dialog>
+    <!-- 会员类别管理弹窗 -->
+    <el-dialog title="会员类别查看" :visible.sync="memberVisible" :before-close="closeMember" append-to-body width="1000px">
+        <!-- <MemberType></MemberType> -->
+        <el-table
+          v-loading="loading"
+          :data="memberTableData"
+          border
+          header-row-class-name="custom-table-header"
+          >
+            <el-table-column prop="tenantVipName" label="会员类型/名称" sortable align="center" width="200px"></el-table-column>
+            <el-table-column label="功能权限" align="center" show-overflow-tooltip min-width="300px">
+              <template slot-scope="scope">
+                <span v-for="item in scope.row.functionIdPathNameDescriptions" :key="item.functionId">{{ item.functionName  }} &nbsp; </span>
+              </template>
+            </el-table-column>
+          </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="closeMember">取 消</el-button>
+        <el-button type="primary" @click="submitMember">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+// import MemberType from "@/views/memberType/index.vue"
 export default {
   components: {
+    // MemberType,
   },
   data() {
     return {
@@ -234,6 +276,10 @@ export default {
       btnLoading: false,
       total: 0,
       tableData: [],
+      memberTypes: [],
+      memberVisible: false,
+      MemberLoading: false,
+      memberTableData: [],
       title: '',
       queryParams: {
         size: 10,
@@ -259,23 +305,22 @@ export default {
   },
   mounted() {
     this.getList()
-    this.getFunction()
+    // this.getFunction()
+    this.getListMemberType()
     // this.translate()
-    // console.log(this.select)
   },
   created(){
     // this.select = this.$store.state.admin.dictionaries
   },
     computed: {
     dictionaries() {
-      // console.log(this.$store.state.admin.dictionaries)
       return this.$store.state.admin.dictionaries
     },
    
   },
   methods: {
     getType(val){
-        this.getFunction(val)
+        // this.getFunction(val)
     },
      //根据条件查询
      getList2(){
@@ -295,11 +340,10 @@ export default {
       this.visible = true
       this.pswdshow = false
         this.authority = []
-        this.getFunction(row.type)
+        // this.getFunction(row.type)
        this.ruleForm = { ...row }
     },
     handleDetails(row) {
-      // console.log(row)
       this.title = '租户详情'
       this.showvisible = true
       this.ruleForm.apply = row
@@ -324,10 +368,36 @@ export default {
         this.loading = false
       });
     },
+    // 请求会员类别权限
+    getListMemberType() { 
+      this.$api.queryTenantVipType({}).then(res => {
+        if (res.code == 200) {
+          this.memberTypes = res.data.list
+        }
+      })
+    },
+    //会员类别按钮
+    memberTypeBtn() {
+      this.memberTypes.forEach(item => {
+        if (item.id==this.ruleForm.tenantVipType) {
+          this.memberTableData.push(item)
+        }
+      })
+      this.memberVisible=true
+      
+    },
+    // 会员类别弹窗确定
+    submitMember() {
+      this.closeMember()
+    },
+    // 会员类别弹窗取消
+    closeMember() {
+      this.memberVisible = false
+      this.memberTableData=[]
+    },
     // getCheckedNodes(){
     //  var List = this.$refs.FunctionCascader.getCheckedNodes()
     //  List.forEach(item => {
-    //   console.log(item)
     //  });
 
     // },
@@ -350,20 +420,20 @@ export default {
         this.findAllNode(item)
       })
       this.functions = [...this.saveNodeTmp]
+      
     },
 
-    getFunction(val) {
-      this.$api.getAllFunctionList({type:val}).then(response => {
-        // console.log(response.data)
-        this.authority = []
-        this.authority = response.data
-        // this.tableData = response.data
-        // this.total=response.pageColumn.total
-        // this.loading = false
-      }).catch(error => {
-        this.loading = true
-      })
-    },
+    // getFunction(val) {
+    //   this.$api.getAllFunctionList({type:val}).then(response => {
+    //     this.authority = []
+    //     this.authority = response.data
+    //     // this.tableData = response.data
+    //     // this.total=response.pageColumn.total
+    //     // this.loading = false
+    //   }).catch(error => {
+    //     this.loading = true
+    //   })
+    // },
     handleCurrentChange(val) {
       this.queryParams.current = val;
       this.getList();
@@ -371,14 +441,14 @@ export default {
     submit() {
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
-          this.ruleForm.function = this.functions
-           this.ruleForm.functions=[]
-           if(this.ruleForm.hasOwnProperty('function')){
-             for(var i =0;i<this.ruleForm.function.length;i++){
-          var a =this.ruleForm.function[i].join(',')
-          this.ruleForm.functions.push(a)
-        }
-           }
+        //   this.ruleForm.function = this.functions
+        //    this.ruleForm.functions=[]
+        //    if(this.ruleForm.hasOwnProperty('function')){
+        //      for(var i =0;i<this.ruleForm.function.length;i++){
+        //   var a =this.ruleForm.function[i].join(',')
+        //   this.ruleForm.functions.push(a)
+        // }
+        //    }
       
           this.btnLoading = true
           if (this.ruleForm.id) {
@@ -401,7 +471,6 @@ export default {
             })
           }
         } else {
-          console.log('error submit!!');
           return false;
         }
       });

+ 0 - 5
src/views/memberType/components/table.vue

@@ -84,10 +84,7 @@ export default {
   },
   watch: {
     isMemberType(val) {
-      console.log(val);
-      // if (val) {
         this.getList()
-      // }
     },
     likeNames(val) {
         this.queryParams.likeName = val
@@ -118,7 +115,6 @@ export default {
     },
     //排序
     sortMethod({ column, prop, order }) {
-      console.log(column, prop, order);
       if (order == 'ascending') {
         this.queryParams.orderType = 'asc'
         this.queryParams.orderBy = prop
@@ -156,7 +152,6 @@ export default {
       // let rows = JSON.parse(JSON.stringify(row))
       // this.ruleForm = rows
       this.$emit('tableRow', row)
-      console.log('tableRow');
     },
     // 表格分页
     handleCurrentChange(val) {

+ 26 - 8
src/views/memberType/index.vue

@@ -72,6 +72,7 @@
                               collapse-tags
                               placeholder="请选择功能权限"
                               clearable
+                              @change="downloadChange"
                               :style="{width:isAdd?385+'px':100+'%'}"></el-cascader>
                     <el-tooltip v-if="isAdd" style="margin-left: 20px;"  class="item" effect="dark" content="复制已有会员类别权限功能并粘贴到新增会员类别权限功能处" placement="top">
                       <el-button @click="btnCopy">复制</el-button>
@@ -131,6 +132,8 @@ export default {
       isAdd: true,
       loading: false,
       btnLoading: false,
+      saveNodeTmp: [],
+      functions: [],
       rules: {
         tenantVipName: [{ required: true, message: '请输入会员类型/名称', trigger: 'blur' },],
         functions: [{ required: true, message: '请选择功能权限', trigger: 'change' },],
@@ -154,7 +157,6 @@ export default {
     //查询
     get() {
       this.likeName = this.queryParams.likeName?this.queryParams.likeName:null
-      // console.log(this.likeName);
     },
       //权限功能 
     getFunction(val) {
@@ -176,7 +178,6 @@ export default {
       this.visibleCopy = false
     },
     handleCopy(val) {
-      // console.log(val);
       this.$set(this.ruleForm,'functions',val.functions)
       // this.ruleForm.functions = val.functions
       if (this.ruleForm.functions) {
@@ -188,7 +189,28 @@ export default {
     },
     
     // 新增、编辑弹窗功能权限选择
-    // downloadChange() { },
+    findAllNode(data) {
+      if (!this.saveNodeTmp.includes(data.path)) { 
+        if(data.path.length>1){
+          this.saveNodeTmp.push(data.path)
+        }   
+        
+      }
+      if (data.parent) {
+        this.findAllNode(data.parent)
+      }
+    },
+    // change时
+    downloadChange(data) {
+      let readSelectedAllNode = this.$refs.FunctionCascader.getCheckedNodes()
+      this.saveNodeTmp = []
+      readSelectedAllNode.forEach(item => {
+        this.findAllNode(item)
+      })
+      this.functions = [...this.saveNodeTmp]
+      
+    },
+
     
     // 新增、编辑弹窗关闭
     close() {
@@ -208,7 +230,6 @@ export default {
         this.isAdd=false
         this.title = '编辑会员类型功能权限'
         this.ruleForm = rows
-        // console.log(this.ruleForm);
      
     },
      // 新增类别
@@ -222,10 +243,10 @@ export default {
     },
     // 新增、编辑弹窗确定
     submit() {
-      console.log(this.ruleForm, this.userinfo);
       // this.isDialogs=true
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
+          this.ruleForm.functions = this.functions
           this.btnLoading = true
           if (this.ruleForm.hasOwnProperty('functions')) {
             var functionModifyPaths = []
@@ -237,7 +258,6 @@ export default {
             this.ruleForm.functionModifyPaths = functionModifyPaths
           }
           
-          console.log(this.ruleForm);
           if (this.ruleForm.id) {
             this.$api.updateNewTenantVipType(this.ruleForm).then(res => {
               if (res.code == 200) {
@@ -247,7 +267,6 @@ export default {
                  this.close()
               }
             }).catch(err => {
-              console.log(err);
                 this.$message.error(err.message)
                 this.btnLoading = false
             })
@@ -260,7 +279,6 @@ export default {
                 this.close()
               } 
             }).catch(err => {
-              console.log(err);
               this.$message.error(err.message)
                 this.btnLoading = false
             })