Compare commits

..

No commits in common. "60c0f62aed2a40f2f285f67db6071f12432363ff" and "60dd0a5b2183b23a7e1d4658c4c5483a6a1c91dc" have entirely different histories.

2 changed files with 60 additions and 36 deletions

View File

@ -7,7 +7,6 @@ import {deleteDataModal, submitSimpleFormModal} from "@/components/tsx/ModalPro.
import api from "@/axios";
import {message} from "ant-design-vue";
import {dictSelectNodes} from "@/config/dict.ts";
import {calculationMergeSpan} from "@/views/unitManage/police/assessmentRecord";
export const saveOrUpdateCkProject = (params: SaveOrUpdateCkProjectParams = {
name: '',
@ -63,7 +62,35 @@ export const deleteCkProjectById = (name: string, ckProjectId: string, callback:
export const ckProjectDetail = async (ckProjectId: string): Promise<CkProjectDetailRes[]> => {
const {data} = await api.get<CkProjectDetailRes[]>('/assessmentCriteria/ckProjectDetail', {ckProjectId})
calculationMergeSpan(data)
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {}
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {}
data.forEach((item, index) => {
//如果第一次没有值
if (item.ckGroupId) {
if (!groupRowSpan[item.ckGroupId]) {
groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index}
} else {
groupRowSpan[item.ckGroupId].count++;
data[index].groupRowSpan = 0
}
}
if (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index}
} else {
itemRowSpan[item.ckItemId].count++;
data[index].itemRowSpan = 0
}
}
})
Object.values(groupRowSpan).forEach(({count, firstIndex}) => data[firstIndex].groupRowSpan = count)
Object.values(itemRowSpan).forEach(({count, firstIndex}) => data[firstIndex].itemRowSpan = count)
return data
}

View File

@ -5,8 +5,37 @@ import {Modal, Table} from "ant-design-vue";
export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) => {
const {data} = await api.get<DeductedDetailRes[]>('/assessmentRecord/deductedDetail', {assessmentRecordId: assessmentRecord.snowFlakeId})
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {}
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {}
calculationMergeSpan(data)
data.forEach((item, index) => {
//如果第一次没有值
if (item.ckGroupId) {
if (!groupRowSpan[item.ckGroupId]) {
groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index}
} else {
groupRowSpan[item.ckGroupId].count++;
data[index].groupRowSpan = 0
}
}
if (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index}
} else {
itemRowSpan[item.ckItemId].count++;
data[index].itemRowSpan = 0
}
}
})
Object.values(groupRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].groupRowSpan = count;
})
Object.values(itemRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].itemRowSpan = count;
})
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
{
@ -70,37 +99,5 @@ export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo)
></Table>
</div>
})
}
/**
*
* @param data
*/
export const calculationMergeSpan = (data: Record<string, any>[]) => {
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {}
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {}
data.forEach((item, index) => {
//如果第一次没有值
if (item.ckGroupId) {
if (!groupRowSpan[item.ckGroupId]) {
groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index}
} else {
groupRowSpan[item.ckGroupId].count++;
data[index].groupRowSpan = 0
}
}
if (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index}
} else {
itemRowSpan[item.ckItemId].count++;
data[index].itemRowSpan = 0
}
}
})
Object.values(groupRowSpan).forEach(({count, firstIndex}) => data[firstIndex].groupRowSpan = count)
Object.values(itemRowSpan).forEach(({count, firstIndex}) => data[firstIndex].itemRowSpan = count)
}