Merge pull request 'role' (#96) from role into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/96
This commit is contained in:
@@ -25,9 +25,9 @@ steps:
|
||||
- npm -v
|
||||
- mkdir -p ./node_modules
|
||||
- export NODE_MODULES_PATH=`pwd`/node_modules
|
||||
- npm config set registry https://registry.npmmirror.com
|
||||
# - npm config set registry https://registry.npmmirror.com
|
||||
#- set NODE_OPTIONS=--openssl-legacy-provider
|
||||
- npm install
|
||||
# - npm install
|
||||
- npm run build
|
||||
- ls /app/build/$DRONE_REPO_NAME/
|
||||
- echo $NODE_MODULES_PATH
|
||||
|
||||
@@ -14,6 +14,14 @@ export const getRoleOption = () => {
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
export const getTemRoleOption = () => {
|
||||
return request({
|
||||
url: '/admin/role/option/template',
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
|
||||
//查询角色信息
|
||||
export const getRoleDetail = (roleId) => {
|
||||
return request({
|
||||
|
||||
@@ -15,7 +15,7 @@ const props = defineProps({
|
||||
default: []
|
||||
},
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
type: [Number, String, Boolean],
|
||||
default: ''
|
||||
},
|
||||
cacheKey: {
|
||||
|
||||
@@ -65,8 +65,6 @@ const filterConfig = computed(()=>{
|
||||
return arr.length >= 4 && showMore.value ? arr : arr.slice(0, 3)
|
||||
})
|
||||
|
||||
console.log(filterConfig.value, 'filterConfig');
|
||||
|
||||
// 搜索功能表单元素默认值
|
||||
const setDefaultFormValues = () => {
|
||||
filterConfig.value.forEach(item=>{
|
||||
|
||||
@@ -2,13 +2,17 @@
|
||||
<div v-loading="loading">
|
||||
<baseTitle title="角色信息录入"></baseTitle>
|
||||
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
|
||||
<baseTitle title="分配菜单"></baseTitle>
|
||||
<!-- <fvCheckbox :options="localData.checkOptions" v-model="localData.checkList" @change="checkBoxChange" /> -->
|
||||
<el-checkbox-group v-model="localData.checkList" @change="checkBoxChange">
|
||||
<el-checkbox :label="isExpand" value="1" />
|
||||
<el-checkbox :label="isAllChose" value="2" />
|
||||
<el-checkbox label="父子联动" value="3" />
|
||||
</el-checkbox-group>
|
||||
<div class="assign-menu-title" >
|
||||
<baseTitle title="分配菜单"></baseTitle>
|
||||
<fvSelect
|
||||
:options="localData.tempRoleOpt"
|
||||
v-model="localData.tempRoleSelect"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择模版角色"
|
||||
@change="roleTempChange"
|
||||
/>
|
||||
</div>
|
||||
<fvCheckbox :options="localData.checkOptions" v-model="localData.checkList" @change="checkBoxChange" />
|
||||
<el-input v-model="localData.filterText" placeholder="请输入关键词" style="width: 400px;" />
|
||||
<div class="menu-assign">
|
||||
<el-tree
|
||||
@@ -35,7 +39,7 @@ import { useAuthStore } from '@/stores/userstore.js'
|
||||
import fvRadio from '@/fvcomponents/fvRadio/index.vue'
|
||||
import { ElLoading, ElNotification } from 'element-plus';
|
||||
import { getMenuList } from '@/api/system/menuman.js'
|
||||
import { getRoleDetail, operate} from "@/api/role/role";
|
||||
import { getRoleDetail, operate, getTemRoleOption } from "@/api/role/role";
|
||||
|
||||
const tagsViewStore = useTagsView()
|
||||
const authStore = useAuthStore()
|
||||
@@ -70,7 +74,9 @@ const localData = reactive({
|
||||
label: '父子联动',
|
||||
value: '3'
|
||||
},
|
||||
]
|
||||
],
|
||||
tempRoleOpt: [],
|
||||
tempRoleSelect: ''
|
||||
})
|
||||
|
||||
const schame = computed(()=>{
|
||||
@@ -135,6 +141,8 @@ const getInstance = (e) => {
|
||||
|
||||
const init = async () => {
|
||||
form.value.setValues({state: '1', template: false})
|
||||
const res = await getTemRoleOption()
|
||||
localData.tempRoleOpt = res.data
|
||||
const { data } = await getMenuList()
|
||||
localData.menuData = data
|
||||
}
|
||||
@@ -145,12 +153,25 @@ const getInfo = async () => {
|
||||
data.menuIds.forEach(key=>{
|
||||
menuTree.value.setChecked(key, true, false)
|
||||
})
|
||||
if(route.query.isAdd) {
|
||||
form.value.setValues(data)
|
||||
}
|
||||
|
||||
const roleTempChange = async (val) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = await getRoleDetail(val.value)
|
||||
data.menuIds.forEach(key=>{
|
||||
menuTree.value.setChecked(key, true, false)
|
||||
})
|
||||
delete data.roleId
|
||||
delete data.roleName
|
||||
delete data.roleKey
|
||||
form.value.setValues(data)
|
||||
loading.value = false
|
||||
} catch (error) {
|
||||
loading.value = false
|
||||
}
|
||||
form.value.setValues(data)
|
||||
|
||||
}
|
||||
|
||||
const filterMenu = (value, data) => {
|
||||
@@ -166,12 +187,8 @@ const checkChange = (data) => {
|
||||
return [...checkedKeys, ...halfCheckedKeys]
|
||||
}
|
||||
|
||||
console.log(localData.checkList, 'localData.checkList');
|
||||
const checkBoxChange = (val) => {
|
||||
console.log(val, 'val');
|
||||
console.log(val.includes('3'), 'val.includes');
|
||||
localData.checkStrictly = val.includes('3')
|
||||
console.log(localData.checkStrictly, 'localData.checkStrictly');
|
||||
let nodes = menuTree.value.store.nodesMap
|
||||
if (val.includes('1')) {
|
||||
for (const node in nodes) {
|
||||
@@ -231,6 +248,14 @@ onMounted( async ()=>{
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.assign-menu-title {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
>div:first-child {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
.menu-assign {
|
||||
width: 400px;
|
||||
max-height: 500px;
|
||||
|
||||
@@ -130,17 +130,9 @@ const tableConfig = reactive({
|
||||
label: '操作',
|
||||
align: 'right',
|
||||
fixed: 'right',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
let btn = [{label: '修改', auth: auths.edit, func: ()=>handleEdit(row) , type: 'primary'}]
|
||||
row.template ?
|
||||
btn.push(
|
||||
{
|
||||
label: '使用模版',
|
||||
auth: auths.edit,
|
||||
func: ()=>handleUseTemp(row),
|
||||
type: 'primary'
|
||||
}
|
||||
) :
|
||||
btn.push(
|
||||
{
|
||||
label: '分配用户',
|
||||
@@ -222,16 +214,6 @@ const handleEdit = (row) => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleUseTemp = (row) => {
|
||||
router.push({
|
||||
path: '/system/roleadd',
|
||||
query: {
|
||||
id: row.roleId,
|
||||
isAdd: 1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleAssign = (row) => {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user