Merge pull request 'master' (#97) from master into prod

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/97
This commit is contained in:
wenhua
2024-04-01 06:36:54 +00:00
6 changed files with 52 additions and 39 deletions

View File

@@ -25,9 +25,9 @@ steps:
- npm -v - npm -v
- mkdir -p ./node_modules - mkdir -p ./node_modules
- export NODE_MODULES_PATH=`pwd`/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 #- set NODE_OPTIONS=--openssl-legacy-provider
- npm install # - npm install
- npm run build - npm run build
- ls /app/build/$DRONE_REPO_NAME/ - ls /app/build/$DRONE_REPO_NAME/
- echo $NODE_MODULES_PATH - echo $NODE_MODULES_PATH

View File

@@ -14,6 +14,14 @@ export const getRoleOption = () => {
method: "get" method: "get"
}); });
}; };
export const getTemRoleOption = () => {
return request({
url: '/admin/role/option/template',
method: "get"
});
};
//查询角色信息 //查询角色信息
export const getRoleDetail = (roleId) => { export const getRoleDetail = (roleId) => {
return request({ return request({

View File

@@ -15,7 +15,7 @@ const props = defineProps({
default: [] default: []
}, },
modelValue: { modelValue: {
type: [Number, String], type: [Number, String, Boolean],
default: '' default: ''
}, },
cacheKey: { cacheKey: {

View File

@@ -65,8 +65,6 @@ const filterConfig = computed(()=>{
return arr.length >= 4 && showMore.value ? arr : arr.slice(0, 3) return arr.length >= 4 && showMore.value ? arr : arr.slice(0, 3)
}) })
console.log(filterConfig.value, 'filterConfig');
// 搜索功能表单元素默认值 // 搜索功能表单元素默认值
const setDefaultFormValues = () => { const setDefaultFormValues = () => {
filterConfig.value.forEach(item=>{ filterConfig.value.forEach(item=>{

View File

@@ -2,13 +2,17 @@
<div v-loading="loading"> <div v-loading="loading">
<baseTitle title="角色信息录入"></baseTitle> <baseTitle title="角色信息录入"></baseTitle>
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm> <fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
<baseTitle title="分配菜单"></baseTitle> <div class="assign-menu-title" >
<!-- <fvCheckbox :options="localData.checkOptions" v-model="localData.checkList" @change="checkBoxChange" /> --> <baseTitle title="分配菜单"></baseTitle>
<el-checkbox-group v-model="localData.checkList" @change="checkBoxChange"> <fvSelect
<el-checkbox :label="isExpand" value="1" /> :options="localData.tempRoleOpt"
<el-checkbox :label="isAllChose" value="2" /> v-model="localData.tempRoleSelect"
<el-checkbox label="父子联动" value="3" /> style="width: 200px;"
</el-checkbox-group> placeholder="请选择模版角色"
@change="roleTempChange"
/>
</div>
<fvCheckbox :options="localData.checkOptions" v-model="localData.checkList" @change="checkBoxChange" />
<el-input v-model="localData.filterText" placeholder="请输入关键词" style="width: 400px;" /> <el-input v-model="localData.filterText" placeholder="请输入关键词" style="width: 400px;" />
<div class="menu-assign"> <div class="menu-assign">
<el-tree <el-tree
@@ -35,7 +39,7 @@ import { useAuthStore } from '@/stores/userstore.js'
import fvRadio from '@/fvcomponents/fvRadio/index.vue' import fvRadio from '@/fvcomponents/fvRadio/index.vue'
import { ElLoading, ElNotification } from 'element-plus'; import { ElLoading, ElNotification } from 'element-plus';
import { getMenuList } from '@/api/system/menuman.js' 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 tagsViewStore = useTagsView()
const authStore = useAuthStore() const authStore = useAuthStore()
@@ -70,7 +74,9 @@ const localData = reactive({
label: '父子联动', label: '父子联动',
value: '3' value: '3'
}, },
] ],
tempRoleOpt: [],
tempRoleSelect: ''
}) })
const schame = computed(()=>{ const schame = computed(()=>{
@@ -135,6 +141,8 @@ const getInstance = (e) => {
const init = async () => { const init = async () => {
form.value.setValues({state: '1', template: false}) form.value.setValues({state: '1', template: false})
const res = await getTemRoleOption()
localData.tempRoleOpt = res.data
const { data } = await getMenuList() const { data } = await getMenuList()
localData.menuData = data localData.menuData = data
} }
@@ -145,12 +153,25 @@ const getInfo = async () => {
data.menuIds.forEach(key=>{ data.menuIds.forEach(key=>{
menuTree.value.setChecked(key, true, false) 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.roleId
delete data.roleName delete data.roleName
delete data.roleKey delete data.roleKey
form.value.setValues(data)
loading.value = false
} catch (error) {
loading.value = false
} }
form.value.setValues(data)
} }
const filterMenu = (value, data) => { const filterMenu = (value, data) => {
@@ -166,12 +187,8 @@ const checkChange = (data) => {
return [...checkedKeys, ...halfCheckedKeys] return [...checkedKeys, ...halfCheckedKeys]
} }
console.log(localData.checkList, 'localData.checkList');
const checkBoxChange = (val) => { const checkBoxChange = (val) => {
console.log(val, 'val');
console.log(val.includes('3'), 'val.includes');
localData.checkStrictly = val.includes('3') localData.checkStrictly = val.includes('3')
console.log(localData.checkStrictly, 'localData.checkStrictly');
let nodes = menuTree.value.store.nodesMap let nodes = menuTree.value.store.nodesMap
if (val.includes('1')) { if (val.includes('1')) {
for (const node in nodes) { for (const node in nodes) {
@@ -231,6 +248,14 @@ onMounted( async ()=>{
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.assign-menu-title {
display: flex;
justify-content: flex-start;
align-items: center;
>div:first-child {
margin-right: 15px;
}
}
.menu-assign { .menu-assign {
width: 400px; width: 400px;
max-height: 500px; max-height: 500px;

View File

@@ -130,17 +130,9 @@ const tableConfig = reactive({
label: '操作', label: '操作',
align: 'right', align: 'right',
fixed: 'right', fixed: 'right',
showOverflowTooltip: false,
currentRender: ({row, index}) => { currentRender: ({row, index}) => {
let btn = [{label: '修改', auth: auths.edit, func: ()=>handleEdit(row) , type: 'primary'}] 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( btn.push(
{ {
label: '分配用户', 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) => { const handleAssign = (row) => {
} }