|
@@ -32,8 +32,7 @@
|
|
|
import {computed, getCurrentInstance, nextTick, reactive, ref, watch} from "vue";
|
|
|
import {useDictionaryStore, useWebStore} from "@/stores";
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
-import {rolesDoAuthorization} from "@/api/modules/manage/role";
|
|
|
-import {frontGetAllSysLabelsForQd} from "@/api/modules/web/list";
|
|
|
+import {rolesDoAuthorization, rolesFindAllByRoleId} from "@/api/modules/manage/role";
|
|
|
|
|
|
const emit = defineEmits(['update:show', 'refresh'])
|
|
|
const {proxy} = getCurrentInstance()
|
|
@@ -44,7 +43,6 @@ const props = defineProps({
|
|
|
transfer: {}
|
|
|
})
|
|
|
const state: any = reactive({
|
|
|
- form: {},
|
|
|
loading: false,
|
|
|
tree: {
|
|
|
filter: '',
|
|
@@ -64,22 +62,45 @@ watch(() => state.tree.filter, (n) => {
|
|
|
ref_tree.value?.filter(n)
|
|
|
})
|
|
|
const onSubmit = () => {
|
|
|
- console.log(ref_tree.value.getCheckedKeys(false))
|
|
|
- console.log(ref_tree.value.getCheckedKeys(true))
|
|
|
- console.log(ref_tree.value.getCheckedNodes(false, false))
|
|
|
- console.log(ref_tree.value.getCheckedNodes(false, true))
|
|
|
- console.log(ref_tree.value.getCheckedNodes(true, true))
|
|
|
- console.log(ref_tree.value.getCheckedNodes(true, false))
|
|
|
- // rolesDoAuthorization({
|
|
|
- // "roleId": props.transfer.id,
|
|
|
- // "indexIds": []
|
|
|
- // })
|
|
|
+ ElMessageBox.confirm("是否提交?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ } as any).then(() => {
|
|
|
+ state.loading = true
|
|
|
+ rolesDoAuthorization({
|
|
|
+ roleId: props.transfer.id,
|
|
|
+ sysRoleIndexs: ref_tree.value.getCheckedKeys(true).map(v => {
|
|
|
+ const ids = v.split(WebStore.treeLevelSplit)
|
|
|
+ return {
|
|
|
+ roleId: props.transfer.id,
|
|
|
+ labelId: ids[0],
|
|
|
+ typeId: ids[1],
|
|
|
+ indexId: WebStore.searchAreaIndexMap.get(ids[2]).id,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).then(rse => {
|
|
|
+ ElMessage.success('授权成功!')
|
|
|
+ emit('update:show', false)
|
|
|
+ emit('refresh')
|
|
|
+ state.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
}
|
|
|
const initTree = () => {
|
|
|
state.loading = true
|
|
|
WebStore.getSearchAreaTree().then(res => {
|
|
|
state.tree.options = JSON.parse(JSON.stringify(res))
|
|
|
- console.log(state.tree.options)
|
|
|
+ initDetail()
|
|
|
+ })
|
|
|
+}
|
|
|
+const initDetail = () => {
|
|
|
+ rolesFindAllByRoleId(props.transfer.id).then(res => {
|
|
|
+ ref_tree.value.setCheckedKeys(res.data.map(v => {
|
|
|
+ return v.labelId + WebStore.treeLevelSplit + v.typeId + WebStore.treeLevelSplit + WebStore.searchAreaIndexMap.get(v.indexId)?.treeId
|
|
|
+ }))
|
|
|
state.loading = false
|
|
|
})
|
|
|
}
|