feat: 所有表单的部门/负责人改为下拉框(自动读取组织+用户数据)
- KPI详情: 负责部门+负责人 el-input→el-select filterable - KPI字典: 新建/编辑/模板实例化 三处同步修改 - 改善行动: 负责人筛选+表单 从userApi.list加载 - 预警中心: 指派人+负责人 从userApi.list加载 - api/index.ts新增orgApi封装
This commit is contained in:
@@ -43,8 +43,16 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责部门"><el-input v-model="kpi.responsible_dept" /></el-form-item>
|
||||
<el-form-item label="负责人"><el-input v-model="kpi.responsible_user" /></el-form-item>
|
||||
<el-form-item label="负责部门">
|
||||
<el-select v-model="kpi.responsible_dept" style="width:100%">
|
||||
<el-option v-for="d in orgDeptOptions" :key="d" :label="d" :value="d" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人">
|
||||
<el-select v-model="kpi.responsible_user" filterable style="width:100%">
|
||||
<el-option v-for="u in userOptions" :key="u" :label="u" :value="u" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源">
|
||||
<el-select v-model="kpi.data_source_type" style="width:100%">
|
||||
<el-option label="ERP" value="erp" />
|
||||
@@ -265,7 +273,7 @@ import { useRoute, onBeforeRouteLeave } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import VChart from 'vue-echarts'
|
||||
import 'echarts'
|
||||
import { kpiApi, mapApi, kpiCausalityApi } from '../api/index'
|
||||
import { kpiApi, mapApi, kpiCausalityApi, orgApi, userApi } from '../api/index'
|
||||
import api from '../api/index'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -287,6 +295,8 @@ const simulateCurrentValue = ref<number | null>(null)
|
||||
const simulateResult = ref<any>(null)
|
||||
const simulating = ref(false)
|
||||
const allKpis = ref<any[]>([])
|
||||
const orgNodes = ref<any[]>([])
|
||||
const userList = ref<any[]>([])
|
||||
const fullNetworkNodes = ref<any[]>([])
|
||||
const fullNetworkEdges = ref<any[]>([])
|
||||
const fullNetworkLoading = ref(false)
|
||||
@@ -381,6 +391,15 @@ const categoryOptions = computed(() => {
|
||||
.map(([value, label]) => ({ value, label }))
|
||||
})
|
||||
|
||||
const orgDeptOptions = computed(() => {
|
||||
const names = orgNodes.value.map(n => n.name).filter(Boolean)
|
||||
return [...new Set(names)]
|
||||
})
|
||||
|
||||
const userOptions = computed(() => {
|
||||
return userList.value.map(u => u.name).filter(Boolean)
|
||||
})
|
||||
|
||||
function dimLabel(d: string) { return ({ finance: '财务', customer: '客户', process: '流程', learning: '学习' } as any)[d] || d }
|
||||
function catLabel(c: string) { return CAT_MAP[c] || c }
|
||||
function dimTagType(d: string) { return ({ finance: '', customer: 'success', process: 'warning', learning: 'info' } as any)[d] || '' }
|
||||
@@ -661,6 +680,16 @@ onMounted(async () => {
|
||||
const kr: any = await kpiApi.list({ page_size: 100 })
|
||||
allKpis.value = kr.data || []
|
||||
} catch(e) {}
|
||||
// 加载部门列表
|
||||
try {
|
||||
const or: any = await orgApi.nodes()
|
||||
orgNodes.value = Array.isArray(or) ? or : or.data || []
|
||||
} catch(e) {}
|
||||
// 加载用户列表
|
||||
try {
|
||||
const ur: any = await userApi.list()
|
||||
userList.value = Array.isArray(ur) ? ur : ur.data || []
|
||||
} catch(e) {}
|
||||
})
|
||||
|
||||
async function associateMap() {
|
||||
|
||||
Reference in New Issue
Block a user