|
@@ -1,24 +1,27 @@
|
|
|
<template>
|
|
|
- <view class="container">
|
|
|
- <evan-form ref="formData" :rules="ruleValidate" :model="formData">
|
|
|
- <evan-form-item prop="name">
|
|
|
- <u-input class="form-input" :maxlength="30" style="width: 100%;" placeholder="请填写岗位名称(最多30个字符)" v-model="formData.name" />
|
|
|
- </evan-form-item>
|
|
|
- <view class="role-box">
|
|
|
- <view>岗位权限:</view>
|
|
|
- <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>
|
|
|
- <u-button shape="circle" type="info" :custom-style="{ background: '#066cff', color: '#fff',width:'300rpx',marginLeft:'20rpx' }" @click="save('formData')">保存</u-button>
|
|
|
- </view>
|
|
|
- </evan-form>
|
|
|
+ <view class="container flex flex_column">
|
|
|
+ <view style="flex-grow: 1;">
|
|
|
+ <evan-form ref="formData" :rules="ruleValidate" :model="formData">
|
|
|
+ <evan-form-item label="岗位名称:" prop="name">
|
|
|
+ <u-input class="form-input" :maxlength="30" style="width: 100%;" placeholder="请填写岗位名称(最多30个字符)" v-model="formData.name" />
|
|
|
+ </evan-form-item>
|
|
|
+ <view class="role-box flex">
|
|
|
+ <view style="color: #666;padding-top:0.5rem;"><text style="color:red;margin-right: 0.5rem;">*</text> 岗位权限:</view>
|
|
|
+ <view style="flex-grow: 1;">
|
|
|
+ <roleAuthSet ref="roleSet"></roleAuthSet>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </evan-form>
|
|
|
+ </view>
|
|
|
+ <view class="form-footer-btn flex align_center justify_center">
|
|
|
+ <u-button shape="circle" v-if="type=='edit'" @click="delRole()" :custom-style="{width:'300rpx' }">删除</u-button>
|
|
|
+ <u-button shape="circle" type="info" :custom-style="{ background: '#066cff', color: '#fff',width:'300rpx',marginLeft:'20rpx' }" @click="save('formData')">保存</u-button>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import roleAuthSet from './roleAuthSet.vue'
|
|
|
- import { clzConfirm } from '@/libs/tools.js'
|
|
|
import {saveRoleMenu, delectRolePower} from '@/api/powerRole-md.js'
|
|
|
export default{
|
|
|
name:"formData",
|
|
@@ -80,16 +83,23 @@
|
|
|
this.loading = true
|
|
|
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
|
|
|
- })
|
|
|
+ if(!menusIds){
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请先选择权限'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -97,21 +107,20 @@
|
|
|
delRole(){
|
|
|
let _this = this
|
|
|
const item = this.formData
|
|
|
- clzConfirm({
|
|
|
- title: "提示",
|
|
|
- content: "数据删除后无法恢复, 确认删除吗?",
|
|
|
- showCancel: true,
|
|
|
- success: function(e){
|
|
|
- if(e.confirm||e.index == 0){
|
|
|
- // 删除数据
|
|
|
- delectRolePower({id: item.id}).then(res=>{
|
|
|
- if(res.status == 200){
|
|
|
- this.cancel()
|
|
|
- }
|
|
|
- uni.showToast({icon: 'none', title: res.message})
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '数据删除后无法恢复, 确认删除吗?',
|
|
|
+ success: (ret) => {
|
|
|
+ if(ret.confirm||ret.index==0){
|
|
|
+ // 删除数据
|
|
|
+ delectRolePower({id: item.id}).then(res=>{
|
|
|
+ if(res.status == 200){
|
|
|
+ this.cancel()
|
|
|
+ }
|
|
|
+ uni.showToast({icon: 'none', title: res.message})
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
// 取消
|
|
@@ -131,11 +140,17 @@
|
|
|
}
|
|
|
.container{
|
|
|
margin: 0 30rpx;
|
|
|
+ height: 100vh;
|
|
|
.form-input-placeholder{
|
|
|
text-align: right;
|
|
|
}
|
|
|
.role-box{
|
|
|
- padding: 20rpx 0;
|
|
|
+ padding: 10rpx 0 20rpx 0;
|
|
|
+ flex-grow: 1;
|
|
|
+ }
|
|
|
+ .form-footer-btn{
|
|
|
+ padding: 20rpx;
|
|
|
+ background: #FFFFFF;
|
|
|
}
|
|
|
}
|
|
|
</style>
|