|
|
@@ -103,6 +103,7 @@
|
|
|
:width="item.width"
|
|
|
:align="item.align"
|
|
|
:fixed="item.fixed"
|
|
|
+ show-overflow-tooltip
|
|
|
>
|
|
|
<!-- <template slot-scope="scope">
|
|
|
<el-input
|
|
|
@@ -667,29 +668,65 @@
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- if (this.selectedProject && this.selectedProject.auditPeriod) {
|
|
|
- // 为审计期间的三个字段添加初始值
|
|
|
- // 获取审计期间并按年份排序
|
|
|
- let auditPeriod = this.selectedProject.auditPeriod
|
|
|
- .split(',')
|
|
|
- .map((year) => parseInt(year))
|
|
|
- .sort((a, b) => a - b)
|
|
|
- .map((year) => year.toString())
|
|
|
-
|
|
|
- // 为每个年份添加三个字段的初始值
|
|
|
- auditPeriod.forEach((year) => {
|
|
|
- rowData[`${year}年BookValue账面值`] = '' // 账面值
|
|
|
- rowData[`${year}年Audit审核调整值`] = '' // 审核调整值
|
|
|
- rowData[`${year}年ApprovedValue核定值`] = '' // 核定值
|
|
|
- })
|
|
|
- }
|
|
|
+ // if (this.selectedProject && this.selectedProject.auditPeriod) {
|
|
|
+ // // 为审计期间的三个字段添加初始值
|
|
|
+ // // 获取审计期间并按年份排序
|
|
|
+ // let auditPeriod = this.selectedProject.auditPeriod
|
|
|
+ // .split(',')
|
|
|
+ // .map((year) => parseInt(year))
|
|
|
+ // .sort((a, b) => a - b)
|
|
|
+ // .map((year) => year.toString())
|
|
|
+
|
|
|
+ // // 为每个年份添加三个字段的初始值,使用与表头定义一致的属性名
|
|
|
+ // auditPeriod.forEach((year) => {
|
|
|
+ // rowData[`year${year}BookValue`] = '' // 账面值
|
|
|
+ // rowData[`year${year}Audit`] = '' // 审核调整值
|
|
|
+ // rowData[`year${year}ApprovedValue`] = '' // 核定值
|
|
|
+ // })
|
|
|
+ // }
|
|
|
|
|
|
// 添加完整的行数据到表格数据中
|
|
|
this.costAuditData.push(rowData)
|
|
|
})
|
|
|
|
|
|
- // 表格排序,子项排在父项的后面
|
|
|
- this.sortItemsByHierarchy()
|
|
|
+ // 平铺顺序:父项在前、子项紧随其后
|
|
|
+ const sortFn = (a, b) =>
|
|
|
+ Number(a.orderNum || 0) - Number(b.orderNum || 0)
|
|
|
+ const byRowId = new Map()
|
|
|
+ const parents = []
|
|
|
+ const childGroups = new Map()
|
|
|
+ this.costAuditData.forEach((row) => {
|
|
|
+ if (row && row.children) delete row.children
|
|
|
+ const key = row.rowid != null ? String(row.rowid) : ''
|
|
|
+ if (key) byRowId.set(key, row)
|
|
|
+ const pid = row.parentid
|
|
|
+ const isParent =
|
|
|
+ pid === -1 || pid === '-1' || pid === null || pid === undefined
|
|
|
+ if (isParent) {
|
|
|
+ parents.push(row)
|
|
|
+ } else {
|
|
|
+ const pKey = pid != null ? String(pid) : ''
|
|
|
+ if (!childGroups.has(pKey)) childGroups.set(pKey, [])
|
|
|
+ childGroups.get(pKey).push(row)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ parents.sort(sortFn)
|
|
|
+ const flat = []
|
|
|
+ const seen = new Set()
|
|
|
+ parents.forEach((p) => {
|
|
|
+ flat.push(p)
|
|
|
+ seen.add(p)
|
|
|
+ const group = childGroups.get(String(p.rowid)) || []
|
|
|
+ group.sort(sortFn).forEach((c) => {
|
|
|
+ flat.push(c)
|
|
|
+ seen.add(c)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 处理找不到父项的子项:放在末尾
|
|
|
+ this.costAuditData.forEach((row) => {
|
|
|
+ if (!seen.has(row)) flat.push(row)
|
|
|
+ })
|
|
|
+ this.costAuditData = flat
|
|
|
}
|
|
|
},
|
|
|
handleSaveTemplate() {
|