|
@@ -79,7 +79,9 @@ import useCompareFilter from './hooks/useCompareFilter'
|
|
|
import VueECharts from 'vue-echarts'
|
|
|
import { CircleClose } from '@element-plus/icons-vue'
|
|
|
import { myColorList } from '@/utils/common'
|
|
|
-
|
|
|
+import { cloneDeep } from 'lodash-es'
|
|
|
+import useMainStore from '@/store/main'
|
|
|
+const mainStore = useMainStore()
|
|
|
const curRow = ref<any>(null)
|
|
|
const onDbClick = (row: any) => {
|
|
|
curRow.value = row
|
|
@@ -94,9 +96,25 @@ const dataTypeLabelMap = reactive<any>({
|
|
|
xyRelate: '相关系数',
|
|
|
})
|
|
|
const multLineXdatas = ref([])
|
|
|
-const { model, fetchModel, items, onOptionInit } = useCompareFilter()
|
|
|
+const { model, fetchModel, items, onOptionInit, changeModelValue, groupListWithAll } = useCompareFilter()
|
|
|
|
|
|
-const { fetch, result: allResult, loading } = useFetch('getCompareList')
|
|
|
+const { fetch, result: allResult2, loading } = useFetch('getCompareList')
|
|
|
+const allResult = computed(() => {
|
|
|
+ if (allResult2.value) {
|
|
|
+ if (mainStore.myUserInfo?.role === 'DEPUTY') {
|
|
|
+ let markingGroupNumber = mainStore.myUserInfo.markingGroupNumber
|
|
|
+ let target = allResult2.value.groups.find((item: any) => item.markingGroupNumber == markingGroupNumber)
|
|
|
+ let zeroGroup = cloneDeep(target)
|
|
|
+ zeroGroup.markingGroupNumber = 0
|
|
|
+ zeroGroup.markerCompares = []
|
|
|
+ return { columns: allResult2.value.columns, groups: [target, zeroGroup] }
|
|
|
+ } else {
|
|
|
+ return allResult2.value
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return { columns: [], groups: [] }
|
|
|
+ }
|
|
|
+})
|
|
|
const result = computed(() => {
|
|
|
let groups = (allResult.value?.groups || []).filter((item: any) => {
|
|
|
if (
|
|
@@ -106,7 +124,7 @@ const result = computed(() => {
|
|
|
) {
|
|
|
return item
|
|
|
} else {
|
|
|
- return fetchModel.value.markingGroupNumber.includes(item.markingGroupNumber)
|
|
|
+ return fetchModel.value.markingGroupNumber.includes(item.markingGroupNumber) || item.markingGroupNumber == 0
|
|
|
}
|
|
|
})
|
|
|
return { columns: allResult.value?.columns || [], groups }
|
|
@@ -134,11 +152,13 @@ const filterAverageDatas = computed(() => {
|
|
|
})
|
|
|
const allTableData = computed(() => {
|
|
|
if (result.value) {
|
|
|
+ let groups = cloneDeep(result.value.groups)
|
|
|
let arr = []
|
|
|
- for (let i = 0; i < result.value.groups.length; i++) {
|
|
|
- let g = result.value.groups[i]
|
|
|
+ for (let i = 0; i < groups.length; i++) {
|
|
|
+ let g = groups[i]
|
|
|
arr.push(...g.markerCompares)
|
|
|
}
|
|
|
+ console.log('allTableData', arr)
|
|
|
return arr
|
|
|
} else {
|
|
|
return []
|
|
@@ -303,6 +323,23 @@ const rowChartOptions = computed(() => {
|
|
|
})
|
|
|
const lineChartOptions = computed(() => {
|
|
|
let xData = allTableData.value.map((item) => item.loginName)
|
|
|
+ // console.log('xData:', xData)
|
|
|
+ // console.log('allTableData.value:', allTableData.value)
|
|
|
+ // console.log(
|
|
|
+ // 'allTableData.value.map((item) => item[dataType.value])',
|
|
|
+ // allTableData.value.map((item) => item[dataType.value])
|
|
|
+ // )
|
|
|
+ console.log(
|
|
|
+ 'yAxis',
|
|
|
+ averageDatas.value,
|
|
|
+ averageDatas.value.find((item: any) => {
|
|
|
+ return item.markingGroupNumber == 0
|
|
|
+ }),
|
|
|
+ dataType.value,
|
|
|
+ averageDatas.value.find((item: any) => {
|
|
|
+ return item.markingGroupNumber == 0
|
|
|
+ })?.[dataType.value === 'markingCount' ? 'avgMarkingCount' : dataType.value]
|
|
|
+ )
|
|
|
return {
|
|
|
grid: {
|
|
|
left: 60,
|
|
@@ -333,7 +370,10 @@ const lineChartOptions = computed(() => {
|
|
|
{
|
|
|
name: '总体' + dataTypeLabelMap[dataType.value],
|
|
|
yAxis: averageDatas.value.find((item: any) => {
|
|
|
- return item.markingGroupNumber == 0
|
|
|
+ return (
|
|
|
+ item.markingGroupNumber ==
|
|
|
+ (mainStore.myUserInfo?.role === 'DEPUTY' ? mainStore.myUserInfo.markingGroupNumber : 0)
|
|
|
+ )
|
|
|
})?.[dataType.value === 'markingCount' ? 'avgMarkingCount' : dataType.value],
|
|
|
label: {
|
|
|
show: true,
|
|
@@ -414,6 +454,13 @@ const onSearch = () => {
|
|
|
})
|
|
|
}
|
|
|
onOptionInit(onSearch)
|
|
|
+watch(groupListWithAll, () => {
|
|
|
+ if (mainStore.myUserInfo && mainStore.myUserInfo.role === 'DEPUTY') {
|
|
|
+ setTimeout(() => {
|
|
|
+ changeModelValue('group')([mainStore.myUserInfo?.markingGroupNumber])
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+})
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.personnel-compare-view {
|