瀏覽代碼

bug 修复

lilei 2 年之前
父節點
當前提交
1d29f2fbbe
共有 3 個文件被更改,包括 18 次插入29 次删除
  1. 2 2
      api/powerRole-md.js
  2. 14 15
      pages/storeManage/roleSetting/addRole.vue
  3. 2 12
      pages/storeManage/roleSetting/roleAuthSet.vue

+ 2 - 2
api/powerRole-md.js

@@ -49,7 +49,7 @@ export const getMenuList = params => {
 }
 
 // 保存权限分配
-export const addMenuPower = params => {
+export const saveRoleMenu = params => {
   const url = `mdrole/saveRoleMenu`
   return request({
     url: url,
@@ -65,4 +65,4 @@ export const getRoleList = params => {
     data: params,
     method: 'POST'
   })
-}
+}

+ 14 - 15
pages/storeManage/roleSetting/addRole.vue

@@ -6,7 +6,7 @@
 			</evan-form-item>
 			<view class="role-box">
 				<view>岗位权限:</view>
-				<roleAuthSet ref="roleSet" @addPowerOk="addPowerOk"></roleAuthSet>
+				<roleAuthSet ref="roleSet"></roleAuthSet>
 			</view>
 			<view class="form-footer-btn flex align_center justify_center">
 				<u-button shape="circle" v-if="!formData.isEnable"  @click="delRole()" :custom-style="{width:'300rpx' }">删除</u-button>
@@ -19,7 +19,7 @@
 <script>
 	import roleAuthSet from './roleAuthSet.vue'
 	import { clzConfirm } from '@/libs/tools.js'
-	import {saveRolePower, delectRolePower} from '@/api/powerRole-md.js'
+	import {saveRoleMenu, delectRolePower} from '@/api/powerRole-md.js'
 	export default{
 		name:"formData",
 		components:{
@@ -78,22 +78,21 @@
 				this.$refs[name].validate((valid) => {
 				  if (valid) {
 					  this.loading = true
-					  this.$refs.roleSet.handleSubmit()
+					  const menusIds = this.$refs.roleSet.getSelMenu()
+					  console.log(menusIds,'menus--')
+					  const params = Object.assign(this.formData,menusIds)
+					  saveRoleMenu(this.formData).then(res=>{
+					  	if(res.status == 200){
+					  		this.cancel()
+					  	}
+					  	uni.showToast({icon: 'none', title: res.message})
+					  	this.loading = false
+					  }).catch(err=>{
+					  	this.loading = false
+					  })
 				  }
 				})
 			},
-			// 保存角色
-			addPowerOk(){
-				saveRolePower(this.formData).then(res=>{
-					if(res.status == 200){
-						this.cancel()
-					}
-					uni.showToast({icon: 'none', title: res.message})
-					this.loading = false
-				}).catch(err=>{
-					this.loading = false
-				})
-			},
 			// 删除角色
 			delRole(){
 				let _this = this

+ 2 - 12
pages/storeManage/roleSetting/roleAuthSet.vue

@@ -107,7 +107,7 @@
 				this.$set(pc, 'checked', ids.length>0)
 			},
 			// 保存提交
-			handleSubmit () {
+			getSelMenu () {
 			  const _this = this
 			  // 获取已选的项
 			  this.checkedIds[0] = []
@@ -124,17 +124,7 @@
 			  checkeNodes = checkeNodes.concat(this.checkedIds[1])
 			  checkeNodes = checkeNodes.concat(this.checkedIds[2])
 			  console.log(checkeNodes, 'checkeNodes')
-			  addMenuPower({ id: this.id, menuIds: checkeNodes.join(',') }).then(res => {
-			    console.log(res, 'res--save')
-			    if (res.status + '' === '200') {
-			       this.$emit("addPowerOk")
-			    }else{
-					uni.showToast({
-						icon: 'none',
-						title: res.message
-					})
-				}
-			  })
+			  return {menuIds: checkeNodes.join(',')}
 			},
 		},
 	}