|
@@ -22,12 +22,13 @@ import { ls } from '@/utils/index'
|
|
|
import user from '@/api/system/user'
|
|
|
import role from '@/api/system/role'
|
|
|
import department from '@/api/system/department'
|
|
|
-// import department from '@/api/system/department'
|
|
|
+import dict from '@/api/system/dict'
|
|
|
|
|
|
const token = ls.get('token')
|
|
|
const userOptList = ref([])
|
|
|
const roleOptList = ref([])
|
|
|
const departmentOptList = ref([])
|
|
|
+const dictParentList = ref([])
|
|
|
const emit = defineEmits(['listener'])
|
|
|
const props = defineProps(
|
|
|
_.merge(
|
|
@@ -172,6 +173,22 @@ const getDepartmentList = async () => {
|
|
|
departmentOptList.value = data || []
|
|
|
}
|
|
|
getDepartmentList()
|
|
|
+// 字典下拉配置
|
|
|
+const getDictParentList = async () => {
|
|
|
+ let data = await dict.dictListParentApi().then(res => {
|
|
|
+ return (res || []).map(v => {
|
|
|
+ return {
|
|
|
+ ...v,
|
|
|
+ label: v.name,
|
|
|
+ value: v.code,
|
|
|
+ // 下拉数据
|
|
|
+ options: []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ dictParentList.value = data
|
|
|
+}
|
|
|
+getDictParentList()
|
|
|
|
|
|
const setSelection = node => {
|
|
|
let result = ''
|
|
@@ -224,13 +241,18 @@ const addFieldData = (node, isCopy = false) => {
|
|
|
if (/^(radio|cascader|checkbox|select)$/.test(node.type)) {
|
|
|
if (node.type === 'select') {
|
|
|
if (node.options.renderType === 2) {
|
|
|
+ // 选择人员
|
|
|
node.options.options = userOptList.value
|
|
|
- }
|
|
|
- if (node.options.renderType === 3) {
|
|
|
+ } else if (node.options.renderType === 3) {
|
|
|
+ // 选择角色
|
|
|
node.options.options = roleOptList.value
|
|
|
+ } else if (node.options.renderType === 4) {
|
|
|
+ // dictListSelectOptionApi
|
|
|
+ // 字典父级 // 选择 todo...字典 dict
|
|
|
+ node.options.options = dictParentList.value // .xxxx todo...
|
|
|
}
|
|
|
- }
|
|
|
- if (node.type === 'cascader') {
|
|
|
+ } else if (node.type === 'cascader') {
|
|
|
+ // 部门类型
|
|
|
if (node.options.renderType === 2) {
|
|
|
node.options.options = departmentOptList.value
|
|
|
}
|
|
@@ -540,7 +562,8 @@ provide('Everright', {
|
|
|
addFieldData,
|
|
|
canvesScrollRef,
|
|
|
fireEvent,
|
|
|
- getData
|
|
|
+ getData,
|
|
|
+ dictParentList
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|