|
|
@@ -53,7 +53,7 @@
|
|
53
|
53
|
<el-form-item label="区域" prop="regionalId">
|
|
54
|
54
|
<el-select v-model="queryParams.regionalId" placeholder="请选择区域" clearable filterable
|
|
55
|
55
|
style="width:150px" @change="handleRegionalChange">
|
|
56
|
|
- <el-option v-for="item in regionalOptions" :key="item.id" :label="item.positionName" :value="item.id" />
|
|
|
56
|
+ <el-option v-for="item in regionalOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
57
|
57
|
</el-select>
|
|
58
|
58
|
</el-form-item>
|
|
59
|
59
|
<el-form-item label="工作点" prop="channelId">
|
|
|
@@ -65,7 +65,7 @@
|
|
65
|
65
|
<el-form-item label="岗位" prop="postId">
|
|
66
|
66
|
<el-tree-select v-model="queryParams.postId" :data="postTreeData"
|
|
67
|
67
|
:props="{ value: 'postId', label: 'postName', children: 'children' }" clearable filterable
|
|
68
|
|
- placeholder="请选择岗位" style="width:150px" check-strictly />
|
|
|
68
|
+ placeholder="请选择岗位" check-strictly />
|
|
69
|
69
|
</el-form-item>
|
|
70
|
70
|
<el-form-item>
|
|
71
|
71
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
@@ -208,7 +208,7 @@
|
|
208
|
208
|
<el-form-item label="区域">
|
|
209
|
209
|
<el-select v-model="form.regionalId" placeholder="请选择区域" clearable filterable
|
|
210
|
210
|
style="width:100%" @change="handleFormRegionalChange">
|
|
211
|
|
- <el-option v-for="item in regionalOptions" :key="item.id" :label="item.positionName" :value="item.id" />
|
|
|
211
|
+ <el-option v-for="item in regionalOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
212
|
212
|
</el-select>
|
|
213
|
213
|
</el-form-item>
|
|
214
|
214
|
</el-col>
|
|
|
@@ -216,7 +216,7 @@
|
|
216
|
216
|
<el-form-item label="工作点">
|
|
217
|
217
|
<el-select v-model="form.channelId" placeholder="请选择工作点" clearable filterable
|
|
218
|
218
|
style="width:100%">
|
|
219
|
|
- <el-option v-for="item in formChannelOptions" :key="item.id" :label="item.positionName" :value="item.id" />
|
|
|
219
|
+ <el-option v-for="item in formChannelOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
220
|
220
|
</el-select>
|
|
221
|
221
|
</el-form-item>
|
|
222
|
222
|
</el-col>
|
|
|
@@ -349,6 +349,7 @@ const rules = computed(() => {
|
|
349
|
349
|
|
|
350
|
350
|
// 搜索表单责任人选项:未选择部门/班组/小组时使用全量人员,否则使用过滤后的人员
|
|
351
|
351
|
const searchPersonOptions = computed(() => {
|
|
|
352
|
+
|
|
352
|
353
|
if (queryParams.deptId || queryParams.teamId || queryParams.groupId) {
|
|
353
|
354
|
return queryPersonOptions.value
|
|
354
|
355
|
}
|
|
|
@@ -406,12 +407,13 @@ async function loadAllGroups() {
|
|
406
|
407
|
|
|
407
|
408
|
async function loadAllPersons() {
|
|
408
|
409
|
const r = await listUser({ pageSize: 9999 })
|
|
|
410
|
+
|
|
409
|
411
|
personOptions.value = r.rows || []
|
|
410
|
412
|
}
|
|
411
|
413
|
|
|
412
|
414
|
async function loadRegions() {
|
|
413
|
415
|
const r = await listPosition({ positionType: 'REGIONAL' })
|
|
414
|
|
- regionalOptions.value = r.rows || []
|
|
|
416
|
+ regionalOptions.value = r.data || []
|
|
415
|
417
|
}
|
|
416
|
418
|
|
|
417
|
419
|
async function handleRegionalChange(val) {
|
|
|
@@ -419,7 +421,7 @@ async function handleRegionalChange(val) {
|
|
419
|
421
|
channelOptions.value = []
|
|
420
|
422
|
if (val) {
|
|
421
|
423
|
const r = await listPosition({ parentId: val })
|
|
422
|
|
- channelOptions.value = r.rows || []
|
|
|
424
|
+ channelOptions.value = r.data || []
|
|
423
|
425
|
}
|
|
424
|
426
|
}
|
|
425
|
427
|
|
|
|
@@ -428,7 +430,7 @@ async function handleFormRegionalChange(val) {
|
|
428
|
430
|
formChannelOptions.value = []
|
|
429
|
431
|
if (val) {
|
|
430
|
432
|
const r = await listPosition({ parentId: val })
|
|
431
|
|
- formChannelOptions.value = r.rows || []
|
|
|
433
|
+ formChannelOptions.value = r.data || []
|
|
432
|
434
|
}
|
|
433
|
435
|
}
|
|
434
|
436
|
|
|
|
@@ -624,6 +626,20 @@ function onLevel4Change(val) {
|
|
624
|
626
|
}
|
|
625
|
627
|
}
|
|
626
|
628
|
|
|
|
629
|
+// 递归查找树形结构中的节点
|
|
|
630
|
+const findTreeNode = (nodes, targetId, idKey, nameKey) => {
|
|
|
631
|
+ for (const node of nodes) {
|
|
|
632
|
+ if (node[idKey] === targetId) {
|
|
|
633
|
+ return node
|
|
|
634
|
+ }
|
|
|
635
|
+ if (node.children) {
|
|
|
636
|
+ const found = findTreeNode(node.children, targetId, idKey, nameKey)
|
|
|
637
|
+ if (found) return found
|
|
|
638
|
+ }
|
|
|
639
|
+ }
|
|
|
640
|
+ return null
|
|
|
641
|
+}
|
|
|
642
|
+
|
|
627
|
643
|
async function submitForm() {
|
|
628
|
644
|
await formRef.value.validate()
|
|
629
|
645
|
let copyForm = { ...form }
|
|
|
@@ -644,6 +660,18 @@ async function submitForm() {
|
|
644
|
660
|
const g = groupOptions.value.find(g => g.id === copyForm.groupId)
|
|
645
|
661
|
if (g) copyForm.groupName = g.label
|
|
646
|
662
|
}
|
|
|
663
|
+ if (copyForm.regionalId) {
|
|
|
664
|
+ const r = regionalOptions.value.find(r => r.id === copyForm.regionalId)
|
|
|
665
|
+ if (r) copyForm.regionalName = r.name
|
|
|
666
|
+ }
|
|
|
667
|
+ if (copyForm.channelId) {
|
|
|
668
|
+ const c = formChannelOptions.value.find(c => c.id === copyForm.channelId)
|
|
|
669
|
+ if (c) copyForm.channelName = c.name || c.positionName
|
|
|
670
|
+ }
|
|
|
671
|
+ if (copyForm.postId) {
|
|
|
672
|
+ const postNode = findTreeNode(postTreeData.value, copyForm.postId, 'postId', 'postName')
|
|
|
673
|
+ if (postNode) copyForm.postName = postNode.postName
|
|
|
674
|
+ }
|
|
647
|
675
|
|
|
648
|
676
|
if (form.id) { await updateScoreEvent(copyForm); ElMessage.success('修改成功') }
|
|
649
|
677
|
else { await addScoreEvent(copyForm); ElMessage.success('新增成功') }
|
|
|
@@ -695,5 +723,26 @@ watch(() => route.query, (query) => {
|
|
695
|
723
|
isInit = false
|
|
696
|
724
|
}, { immediate: true })
|
|
697
|
725
|
|
|
698
|
|
-onMounted(() => { loadDimensions(); loadDepts(); loadQueryDepts(); loadAllPersons(); loadRegions(); listAllTree().then(res => { postTreeData.value = res.data || [] }); getList() })
|
|
|
726
|
+// 递归处理岗位树,禁用第一级
|
|
|
727
|
+const processPostTree = (nodes, isFirstLevel = true) => {
|
|
|
728
|
+ return nodes.map(node => {
|
|
|
729
|
+ const newNode = { ...node, disabled: isFirstLevel }
|
|
|
730
|
+ if (node.children) {
|
|
|
731
|
+ newNode.children = processPostTree(node.children, false)
|
|
|
732
|
+ }
|
|
|
733
|
+ return newNode
|
|
|
734
|
+ })
|
|
|
735
|
+}
|
|
|
736
|
+
|
|
|
737
|
+onMounted(() => {
|
|
|
738
|
+ loadDimensions();
|
|
|
739
|
+ loadDepts();
|
|
|
740
|
+ loadQueryDepts();
|
|
|
741
|
+ loadAllPersons();
|
|
|
742
|
+ loadRegions();
|
|
|
743
|
+ listAllTree().then(res => {
|
|
|
744
|
+ postTreeData.value = processPostTree(res.data || [])
|
|
|
745
|
+ });
|
|
|
746
|
+ getList()
|
|
|
747
|
+})
|
|
699
|
748
|
</script>
|