Soleilw vor 1 Jahr
Ursprung
Commit
81e4817175
3 geänderte Dateien mit 153 neuen und 156 gelöschten Zeilen
  1. 120
    120
      dist/assets/index-vJ16TBVk.js
  2. 1
    1
      dist/index.html
  3. 32
    35
      src/views/permission/list/add/add.vue

dist/assets/index-vJ16TBVk.js
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 1
- 1
dist/index.html Datei anzeigen

@@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/logo_1.jpg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>后台管理系统</title>
<script type="module" crossorigin src="/assets/index-qepdfnWI.js"></script>
<script type="module" crossorigin src="/assets/index-vJ16TBVk.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-jOgss7zH.css">
</head>
<body>

+ 32
- 35
src/views/permission/list/add/add.vue Datei anzeigen

@@ -12,7 +12,7 @@
<a-form-item label="路径" name="path">
<a-input v-model:value="createForm.path" placeholder="请输入路径" />
</a-form-item>
</a-col>
<a-col span="24">
<a-form-item label="动作" name="action">
@@ -33,18 +33,18 @@
</a-form-item>
</a-col>
<a-col span="24" v-if="addOtherForm.isAddLevel">
<a-form-item label="是否是顶级菜单" name="parent_id" >
<a-radio-group v-model:value="addOtherForm.parent_id" @change="parentIdChange">
<a-form-item label="是否是顶级菜单" name="parent_id">
<a-radio-group v-model:value="addOtherForm.parent_id" @change="parentIdChange">
<a-radio :value="-1">是</a-radio>
<a-radio :value="0">否</a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<a-col span="24" v-if="!addOtherForm.isTopLevel">
<a-form-item label="上级菜单id" name="parent_id" >
<a-cascader v-model:value="cascaderParentId" @change="parentChange"
:options="listOptions" :fieldNames="listFieldNames" :changeOnSelect="true"
placeholder="请选择所属的上级菜单" style="width: 100%" />
<a-form-item label="上级菜单id" name="parent_id">
<a-cascader v-model:value="cascaderParentId" @change="parentChange" :options="listOptions"
:fieldNames="listFieldNames" :changeOnSelect="true" placeholder="请选择所属的上级菜单"
style="width: 100%" />
</a-form-item>
</a-col>
<a-col span="24">
@@ -65,7 +65,7 @@
import { filterChildPermissionsByType } from '@/utils/dataHelper.ts';
let { store, openAddModel, hideModal, message, } = useCommon();
const emit = defineEmits();
let props = defineProps(['edit_record','level_record']);
let props = defineProps(['edit_record', 'level_record']);
let title = ref<String>('新增权限/菜单');
let listOptions = ref([]);
let cascaderParentId = ref([]);
@@ -75,13 +75,13 @@
let addOtherForm = ref<companyDepartmentType.addOtherFormType>(otherDataForm)

onMounted(() => {
getPermissionListWithchilds({page:1, pagesize: 999}).then(res => {
getPermissionListWithchilds({ page: 1, pagesize: 999 }).then(res => {
listOptions.value = filterChildPermissionsByType(res.data.permissions)
})
})
const pTypeChange = (val) => {
if(val.target.value == 1) {
if (val.target.value == 1) {
addOtherForm.value.isAddLevel = false;
} else {
addOtherForm.value.isAddLevel = true;
@@ -91,44 +91,44 @@
createForm.value.parent_id = createForm.value.parent_id != 0 ? createForm.value.parent_id : 0;
cascaderParentId.value = []
}
const parentIdChange = (val) => {
cascaderParentId.value = []
createForm.value.parent_id = val.target.value;
val.target.value == 0 ? addOtherForm.value.isTopLevel = false : addOtherForm.value.isTopLevel = true
}
const parentChange = (val) => {
createForm.value.parent_id = val.length > 0 ? val[val.length - 1] : 0;
}

const sumbitForm = () => {
if (createForm.value.name && createForm.value.p_type) {
if (!createForm.value.id) {
addPermission(createForm.value).then(res => {
getPermissionListWithchilds({page:1, pagesize: 999}).then(res => {
getPermissionListWithchilds({ page: 1, pagesize: 999 }).then(res => {
listOptions.value = filterChildPermissionsByType(res.data.permissions)
})
message.success('新增菜单/权限成功');
hideModal();
resetForm();
emit('successAdd');
}).catch(err => {
})
} else {
updatePermission(createForm.value).then(res => {
getPermissionListWithchilds({page:1, pagesize: 999}).then(res => {
getPermissionListWithchilds({ page: 1, pagesize: 999 }).then(res => {
listOptions.value = filterChildPermissionsByType(res.data.permissions)
})
message.success('修改菜单/权限成功');
hideModal();
resetForm();
emit('successAdd');
}).catch(err => {
})
}
@@ -158,7 +158,7 @@
console.log(newVal)
if (newVal[0]) {
title.value = "编辑权限/菜单";
console.log(newVal)
console.log(1313,newVal)
createForm.value = {
id: newVal[0].id,
name: newVal[0].name,
@@ -169,35 +169,32 @@
parent_id: newVal[0].parent_id,
description: newVal[0].description,
}
if(newVal[0].parent_id == -1) {
cascaderParentId.value.push(newVal[0].id);
if (newVal[0].parent_id == -1) {
cascaderParentId.value.push(newVal[0].id);
addOtherForm.value.isAddLevel = true;
addOtherForm.value.isTopLevel = true;
addOtherForm.value.parent_id = -1;
} else {
} else {
cascaderParentId.value.push(newVal[0].parent_id);
cascaderParentId.value.push(newVal[0].id);
addOtherForm.value.isAddLevel = true
addOtherForm.value.isTopLevel = false
addOtherForm.value.parent_id = 0;
}
} else if(newVal[1]){
}
} else if (newVal[1]) {
title.value = "添加下级权限/菜单";
createForm.value.p_type = newVal[1].p_type
cascaderParentId.value = [];
if(newVal[1].parent_id == -1) {
if (newVal[1].parent_id == -1) {
cascaderParentId.value.push(newVal[1].id);
addOtherForm.value.isAddLevel = true;
addOtherForm.value.isTopLevel = true;
addOtherForm.value.parent_id = -1;
} else {
cascaderParentId.value.push(newVal[1].parent_id);
cascaderParentId.value.push(newVal[1].id);
addOtherForm.value.isAddLevel = true
addOtherForm.value.isTopLevel = false
addOtherForm.value.parent_id = 0;
}
addOtherForm.value.isAddLevel = true;
addOtherForm.value.isTopLevel = false;
addOtherForm.value.parent_id = 0;
createForm.value.parent_id = newVal[1].id
} else {
title.value = "编辑权限/菜单";
@@ -207,4 +204,4 @@

<style>

</style>
</style>

Laden…
Abbrechen
Speichern