调整代码
This commit is contained in:
parent
cf1e71c04d
commit
f57e0e2b40
|
|
@ -48,7 +48,7 @@
|
|||
icon="ArrowRight"
|
||||
:props="{
|
||||
children: 'children',
|
||||
label: 'menuName'
|
||||
label: 'menuName',
|
||||
}"
|
||||
empty-text=""
|
||||
show-checkbox
|
||||
|
|
@ -65,23 +65,17 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, onMounted, Ref, ref, toRefs } from 'vue'
|
||||
import {
|
||||
apiConfigGetMenu,
|
||||
apiConfigGetAuth,
|
||||
apiRoleAdd,
|
||||
apiRoleEdit,
|
||||
apiRoleDetail
|
||||
} from '@/api/auth'
|
||||
import { ElInput, ElForm } from 'element-plus'
|
||||
import FooterBtns from '@/components/footer-btns/index.vue'
|
||||
import { useAdmin } from '@/core/hooks/app'
|
||||
import { flatten } from '@/utils/util'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { defineComponent, reactive, onMounted, Ref, ref, toRefs } from 'vue'
|
||||
import { apiConfigGetMenu, apiConfigGetAuth, apiRoleAdd, apiRoleEdit, apiRoleDetail } from '@/api/auth'
|
||||
import { ElInput, ElForm } from 'element-plus'
|
||||
import FooterBtns from '@/components/footer-btns/index.vue'
|
||||
import { useAdmin } from '@/core/hooks/app'
|
||||
import { flatten } from '@/utils/util'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
export default defineComponent({
|
||||
export default defineComponent({
|
||||
components: {
|
||||
FooterBtns
|
||||
FooterBtns,
|
||||
},
|
||||
setup() {
|
||||
const { route, router } = useAdmin()
|
||||
|
|
@ -98,13 +92,13 @@ export default defineComponent({
|
|||
menus: [], // 权限,就选中的菜单id
|
||||
isDisable: 0,
|
||||
sort: '',
|
||||
menuIds: '' // 菜单ID数组,逗号隔开
|
||||
menuIds: '', // 菜单ID数组,逗号隔开
|
||||
},
|
||||
|
||||
menu: {
|
||||
permissionsTree: [], // 菜单
|
||||
allAuthKeys: [] // 菜单全部的id
|
||||
}
|
||||
allAuthKeys: [], // 菜单全部的id
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
|
|
@ -115,17 +109,17 @@ export default defineComponent({
|
|||
required: true,
|
||||
message: '请输入角色名称',
|
||||
trigger: ['blur'],
|
||||
pattern: /(^[^\s]*$)/ // 不能输入空格
|
||||
}
|
||||
pattern: /(^[^\s]*$)/, // 不能输入空格
|
||||
},
|
||||
],
|
||||
sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入排序',
|
||||
trigger: 'blur',
|
||||
pattern: /(^[0-9]\d*$)/
|
||||
}
|
||||
]
|
||||
pattern: /(^[0-9]\d*$)/,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
// 确定提交
|
||||
|
|
@ -161,7 +155,6 @@ export default defineComponent({
|
|||
const roleAdd = () => {
|
||||
apiRoleAdd({ ...formData.value })
|
||||
.then((res: any) => {
|
||||
console.log('res', res)
|
||||
setTimeout(() => {
|
||||
router.back()
|
||||
}, 500)
|
||||
|
|
@ -180,7 +173,7 @@ export default defineComponent({
|
|||
|
||||
apiRoleEdit({
|
||||
...formData.value,
|
||||
id: id.value
|
||||
id: id.value,
|
||||
})
|
||||
.then((res: any) => {
|
||||
console.log('res', res)
|
||||
|
|
@ -197,7 +190,7 @@ export default defineComponent({
|
|||
// 角色详情
|
||||
const roleDetail = () => {
|
||||
apiRoleDetail({
|
||||
id: id.value
|
||||
id: id.value,
|
||||
})
|
||||
.then((res: any) => {
|
||||
console.log('res', res)
|
||||
|
|
@ -217,7 +210,7 @@ export default defineComponent({
|
|||
if (!data.id) {
|
||||
return
|
||||
}
|
||||
const index = formData.value.menus.findIndex(item => item == data.id)
|
||||
const index = formData.value.menus.findIndex((item) => item == data.id)
|
||||
if (checked) {
|
||||
index == -1 && (formData.value.menus as any).push(data.id)
|
||||
return
|
||||
|
|
@ -262,16 +255,16 @@ export default defineComponent({
|
|||
onSubmit,
|
||||
handlePermissionsCheckChange,
|
||||
close,
|
||||
allSelect
|
||||
allSelect,
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.role-edit {
|
||||
.role-edit {
|
||||
:deep .el-textarea {
|
||||
width: 340px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue