Commit 3f41b47c by 张立顺

feat 功能开发

1 parent 109f8867
This diff could not be displayed because it is too large.
...@@ -225,7 +225,12 @@ export default { ...@@ -225,7 +225,12 @@ export default {
{ {
label: "员工姓名", label: "员工姓名",
prop: "staffName", prop: "staffName",
width: "100px" width: "120px"
},
{
label: "车型",
prop: "brandName"
// width: "100px"
}, },
{ {
label: "新车交付数", label: "新车交付数",
...@@ -528,7 +533,32 @@ export default { ...@@ -528,7 +533,32 @@ export default {
const arr = [] const arr = []
list.forEach((i) => { list.forEach((i) => {
i.staffList.forEach((j) => { i.staffList.forEach((j) => {
arr.push({ ...i, ...j, count: i.staffList.length }) if (j.brandList) {
j.brandList.forEach((k) => {
arr.push({
...i,
...j,
...k,
count: i.staffList.length,
brandCount: j.brandList.length
})
// arr.push({
// ...i,
// ...j,
// ...k,
// count: i.staffList.length,
// brandCount: j.brandList.length
// })
})
} else {
arr.push({ ...i, ...j, count: i.staffList.length })
}
// if (j.staffName == "合计/最终") {
// arr.push({ ...i, ...j, count: i.staffList.length })
// } else {
// arr.push({ ...i, ...j })
// }
// arr.push({ ...i, ...j, count: i.staffList.length })
}) })
}) })
this.tableData = arr this.tableData = arr
...@@ -590,45 +620,112 @@ export default { ...@@ -590,45 +620,112 @@ export default {
const { startDate, endDate } = this.getPramms() const { startDate, endDate } = this.getPramms()
this.selectDate = [startDate, endDate] this.selectDate = [startDate, endDate]
}, },
// 合并表格列
// arraySpanMethod({ row, column, rowIndex, columnIndex }) {
// if ([0, 1, 2].includes(columnIndex)) {
// if (rowIndex % row.count === 0) {
// return [row.count, 1]
// } else {
// return [0, 0]
// }
// }
// },
arraySpanMethod({ row, column, rowIndex, columnIndex }) { arraySpanMethod({ row, column, rowIndex, columnIndex }) {
// 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列) // 前3列保留原有逻辑
const mergeLength = 3 // 需要进行横纵合并的列 if (columnIndex < 3) {
if (columnIndex < mergeLength) { // 假设前3列的合并逻辑如下(根据实际情况调整)
const finArray = [1, 1] const mergeLength = 3 // 需要进行横纵合并的列
// 处理行数据 if (columnIndex < mergeLength) {
// console.log(cgname); const finArray = [1, 1]
if ( // 处理行数据
rowIndex === 0 || if (
row.merchantId !== this.tableData[rowIndex - 1].merchantId rowIndex === 0 ||
) { row.merchantId !== this.tableData[rowIndex - 1].merchantId
let rowspan = 1 ) {
// 计算需要进行合并操作的行 let rowspan = 1
for (let i = 0; i < this.tableData.length - 1; i++) { // 计算需要进行合并操作的行
// 只合并连续的 for (let i = rowIndex; i < this.tableData.length - 1; i++) {
if ( // 只合并连续的
this.tableData[i].merchantId === row.merchantId && if (
this.tableData[i + 1].merchantId === row.merchantId this.tableData[i].merchantId === row.merchantId &&
) { this.tableData[i + 1].merchantId === row.merchantId
rowspan++ ) {
rowspan++
} else {
break
}
} }
finArray[0] = rowspan
} else {
finArray[0] = 0
}
return finArray
}
}
// 第4列(员工姓名列)根据 staffUuid 进行合并
if (columnIndex === 3) {
if (rowIndex === 0 || !row.brandCount) {
return {
rowspan: 1,
colspan: 1
} }
finArray[0] = rowspan
} else { } else {
finArray[0] = 0 const prevRow = this.tableData[rowIndex - 1]
if (row.staffUuid === prevRow.staffUuid) {
return {
rowspan: 0,
colspan: 0
}
} else {
let rowspan = 1
for (let i = rowIndex + 1; i < this.tableData.length; i++) {
if (this.tableData[i].staffUuid === row.staffUuid) {
rowspan++
} else {
break
}
}
return {
rowspan: rowspan,
colspan: 1
}
}
} }
return finArray }
// 其他列保持默认
return {
rowspan: 1,
colspan: 1
} }
}, },
// arraySpanMethod({ row, column, rowIndex, columnIndex }) {
// // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
// const mergeLength = 4 // 需要进行横纵合并的列
// if (columnIndex < mergeLength) {
// const finArray = [1, 1]
// // 处理行数据
// // console.log(cgname);
// if (
// rowIndex === 0 ||
// row.merchantId !== this.tableData[rowIndex - 1].merchantId
// ) {
// let rowspan = 1
// // 计算需要进行合并操作的行
// for (let i = 0; i < this.tableData.length - 1; i++) {
// // 只合并连续的
// if (
// this.tableData[i].merchantId === row.merchantId &&
// this.tableData[i + 1].merchantId === row.merchantId
// ) {
// rowspan++
// }
// }
// finArray[0] = rowspan
// } else {
// finArray[0] = 0
// }
// return finArray
// }
// // if (columnIndex == 3) {
// // const finArray = [1, 1]
// // let rowspan = 1
// // return finArray
// // }
// },
getPramms() { getPramms() {
this.searchFormSearch = deepClone(this.searchForm) this.searchFormSearch = deepClone(this.searchForm)
if (this.searchFormSearch.deliveryDate) { if (this.searchFormSearch.deliveryDate) {
......
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!