|
@@ -40,14 +40,26 @@
|
|
|
<!-- 操作按钮 -->
|
|
<!-- 操作按钮 -->
|
|
|
<div class="operation-bar">
|
|
<div class="operation-bar">
|
|
|
<el-button
|
|
<el-button
|
|
|
|
|
+ v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'add',
|
|
|
|
|
+ }"
|
|
|
plain
|
|
plain
|
|
|
type="success"
|
|
type="success"
|
|
|
icon="el-icon-circle-plus"
|
|
icon="el-icon-circle-plus"
|
|
|
@click="handleAdd"
|
|
@click="handleAdd"
|
|
|
>
|
|
>
|
|
|
|
|
+ <!-- v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'add',
|
|
|
|
|
+ }" -->
|
|
|
添加
|
|
添加
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
|
|
+ v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'delete',
|
|
|
|
|
+ }"
|
|
|
plain
|
|
plain
|
|
|
type="danger"
|
|
type="danger"
|
|
|
icon="el-icon-delete"
|
|
icon="el-icon-delete"
|
|
@@ -65,6 +77,7 @@
|
|
|
:data="tableData"
|
|
:data="tableData"
|
|
|
border
|
|
border
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
|
|
+ :default-sort="{ prop: 'createTime', order: 'descending' }"
|
|
|
@selection-change="handleSelectionChange"
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
@@ -138,6 +151,7 @@
|
|
|
prop="createTime"
|
|
prop="createTime"
|
|
|
label="创建时间"
|
|
label="创建时间"
|
|
|
width="160"
|
|
width="160"
|
|
|
|
|
+ sortable
|
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
|
align="center"
|
|
align="center"
|
|
|
>
|
|
>
|
|
@@ -148,6 +162,7 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
|
|
+ v-if="$permission.isAdminOrProvince()"
|
|
|
label="操作"
|
|
label="操作"
|
|
|
width="240"
|
|
width="240"
|
|
|
fixed="right"
|
|
fixed="right"
|
|
@@ -156,6 +171,10 @@
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
<el-button
|
|
|
|
|
+ v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'view',
|
|
|
|
|
+ }"
|
|
|
type="text"
|
|
type="text"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
@click="handleViewDetail(scope.row)"
|
|
@click="handleViewDetail(scope.row)"
|
|
@@ -164,6 +183,11 @@
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="scope.row.status != '0'"
|
|
v-if="scope.row.status != '0'"
|
|
|
|
|
+ v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'edit',
|
|
|
|
|
+ targetData: scope.row,
|
|
|
|
|
+ }"
|
|
|
type="text"
|
|
type="text"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
@click="handleEdit(scope.row)"
|
|
@click="handleEdit(scope.row)"
|
|
@@ -171,6 +195,11 @@
|
|
|
修改
|
|
修改
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
|
|
+ v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'edit',
|
|
|
|
|
+ targetData: scope.row,
|
|
|
|
|
+ }"
|
|
|
type="text"
|
|
type="text"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
@click="handleStatusChange(scope.row)"
|
|
@click="handleStatusChange(scope.row)"
|
|
@@ -180,6 +209,11 @@
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="scope.row.status != '0'"
|
|
v-if="scope.row.status != '0'"
|
|
|
|
|
+ v-region-permission="{
|
|
|
|
|
+ category: 'costVerifyManage',
|
|
|
|
|
+ action: 'delete',
|
|
|
|
|
+ targetData: scope.row,
|
|
|
|
|
+ }"
|
|
|
type="text"
|
|
type="text"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
@click="handleDeleteRow(scope.row)"
|
|
@click="handleDeleteRow(scope.row)"
|
|
@@ -826,7 +860,7 @@
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<div class="table-actions">
|
|
<div class="table-actions">
|
|
|
<el-button
|
|
<el-button
|
|
|
- v-if="scope.row.isChild"
|
|
|
|
|
|
|
+ v-if="!scope.row.isChild"
|
|
|
type="text"
|
|
type="text"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
:disabled="dialogTitle == '查看成本核定模板'"
|
|
:disabled="dialogTitle == '查看成本核定模板'"
|
|
@@ -1027,7 +1061,7 @@
|
|
|
type: '',
|
|
type: '',
|
|
|
catalogId: '',
|
|
catalogId: '',
|
|
|
keyword: '',
|
|
keyword: '',
|
|
|
- pageNum: 1,
|
|
|
|
|
|
|
+ page: 1,
|
|
|
pageSize: 50,
|
|
pageSize: 50,
|
|
|
},
|
|
},
|
|
|
props: {
|
|
props: {
|
|
@@ -1347,9 +1381,9 @@
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
getCostFormDataStorageTables(this.searchForm).then((res) => {
|
|
getCostFormDataStorageTables(this.searchForm).then((res) => {
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
- if (res.code === 200) {
|
|
|
|
|
- this.tableData = res.value.records
|
|
|
|
|
- this.pagination.total = res.value.total
|
|
|
|
|
|
|
+ if (res.rows.length > 0) {
|
|
|
|
|
+ this.tableData = res.rows || []
|
|
|
|
|
+ this.pagination.total = res.total || 0
|
|
|
this.batchGetCatalogNames()
|
|
this.batchGetCatalogNames()
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -1360,7 +1394,7 @@
|
|
|
this.searchForm = {
|
|
this.searchForm = {
|
|
|
catalogId: '',
|
|
catalogId: '',
|
|
|
keyword: '',
|
|
keyword: '',
|
|
|
- pageNum: 1,
|
|
|
|
|
|
|
+ page: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
}
|
|
}
|
|
|
this.handleSearch()
|
|
this.handleSearch()
|
|
@@ -1519,6 +1553,10 @@
|
|
|
)
|
|
)
|
|
|
? tableHeadersRes.value
|
|
? tableHeadersRes.value
|
|
|
: []
|
|
: []
|
|
|
|
|
+ // 表头按照orderNum重新排序
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders.sort(
|
|
|
|
|
+ (a, b) => a.orderNum - b.orderNum
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
// 检查是否有fieldName为"序号"的数据
|
|
// 检查是否有fieldName为"序号"的数据
|
|
|
const hasSerialNumber =
|
|
const hasSerialNumber =
|
|
@@ -1849,31 +1887,53 @@
|
|
|
this.$set(row.fixedValues, rkey, value)
|
|
this.$set(row.fixedValues, rkey, value)
|
|
|
},
|
|
},
|
|
|
// 上升
|
|
// 上升
|
|
|
- handleMoveUp(index, tableType) {
|
|
|
|
|
|
|
+ handleMoveUp(index, tableType, row) {
|
|
|
if (tableType === '固定表') {
|
|
if (tableType === '固定表') {
|
|
|
const fixedTableData = this.contentEditForm.fixedTable.fixedTables
|
|
const fixedTableData = this.contentEditForm.fixedTable.fixedTables
|
|
|
const newFixedTableData = [...fixedTableData]
|
|
const newFixedTableData = [...fixedTableData]
|
|
|
this.swamTableArr(newFixedTableData, row, true)
|
|
this.swamTableArr(newFixedTableData, row, true)
|
|
|
this.contentEditForm.fixedTable.fixedTables = newFixedTableData
|
|
this.contentEditForm.fixedTable.fixedTables = newFixedTableData
|
|
|
} else {
|
|
} else {
|
|
|
- const tableHeaders = this.contentEditForm.tableHeaders
|
|
|
|
|
- const newTableHeaders = [...tableHeaders]
|
|
|
|
|
- this.swamTableArr(newTableHeaders, row, true, true)
|
|
|
|
|
- this.contentEditForm.tableHeaders = newTableHeaders
|
|
|
|
|
|
|
+ // const tableHeaders = this.contentEditForm.fixedTable.tableHeaders
|
|
|
|
|
+ // const newTableHeaders = [...tableHeaders]
|
|
|
|
|
+ // this.swamTableArr(newTableHeaders, row, true, true)
|
|
|
|
|
+ // this.contentEditForm.tableHeaders = newTableHeaders
|
|
|
|
|
+ if (index > 0) {
|
|
|
|
|
+ const temp = this.contentEditForm.fixedTable.tableHeaders[index]
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders.splice(index, 1)
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders.splice(
|
|
|
|
|
+ index - 1,
|
|
|
|
|
+ 0,
|
|
|
|
|
+ temp
|
|
|
|
|
+ )
|
|
|
|
|
+ // 更新表头的序号
|
|
|
|
|
+ this.updateTableHeadersOrderNumbers()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 下降
|
|
// 下降
|
|
|
- handleMoveDown(index, tableType) {
|
|
|
|
|
|
|
+ handleMoveDown(index, tableType, row) {
|
|
|
if (tableType === '固定表') {
|
|
if (tableType === '固定表') {
|
|
|
const fixedTableData = this.contentEditForm.fixedTable.fixedTables
|
|
const fixedTableData = this.contentEditForm.fixedTable.fixedTables
|
|
|
const newFixedTableData = [...fixedTableData]
|
|
const newFixedTableData = [...fixedTableData]
|
|
|
this.swamTableArr(newFixedTableData, row, false)
|
|
this.swamTableArr(newFixedTableData, row, false)
|
|
|
this.contentEditForm.fixedTable.fixedTables = newFixedTableData
|
|
this.contentEditForm.fixedTable.fixedTables = newFixedTableData
|
|
|
} else {
|
|
} else {
|
|
|
- const tableHeaders = this.contentEditForm.tableHeaders
|
|
|
|
|
- const newTableHeaders = [...tableHeaders]
|
|
|
|
|
- this.swamTableArr(newTableHeaders, row, false)
|
|
|
|
|
- this.contentEditForm.tableHeaders = newTableHeaders
|
|
|
|
|
|
|
+ // const tableHeaders = this.contentEditForm.tableHeaders
|
|
|
|
|
+ // const newTableHeaders = [...tableHeaders]
|
|
|
|
|
+ // this.swamTableArr(newTableHeaders, row, false)
|
|
|
|
|
+ // this.contentEditForm.tableHeaders = newTableHeaders
|
|
|
|
|
+ if (index < this.contentEditForm.fixedTable.tableHeaders.length - 1) {
|
|
|
|
|
+ const temp = this.contentEditForm.fixedTable.tableHeaders[index]
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders.splice(index, 1)
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders.splice(
|
|
|
|
|
+ index + 1,
|
|
|
|
|
+ 0,
|
|
|
|
|
+ temp
|
|
|
|
|
+ )
|
|
|
|
|
+ // 更新表头的序号
|
|
|
|
|
+ this.updateTableHeadersOrderNumbers()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
swamTableArr(arr, row, asc, isHeader) {
|
|
swamTableArr(arr, row, asc, isHeader) {
|
|
@@ -1942,22 +2002,21 @@
|
|
|
arr[rowIndex] = swam
|
|
arr[rowIndex] = swam
|
|
|
arr[swamIndex] = curr
|
|
arr[swamIndex] = curr
|
|
|
},
|
|
},
|
|
|
- // 更新固定表中显示的序号值
|
|
|
|
|
- updateFixedTableDisplayOrder() {
|
|
|
|
|
- this.contentEditForm.fixedTable.fixedTables.forEach((row, index) => {
|
|
|
|
|
- // 更新 orderText(显示用序号)
|
|
|
|
|
- row.orderText = index + 1
|
|
|
|
|
-
|
|
|
|
|
- // 更新 orderNum(用于后端)
|
|
|
|
|
- row.orderNum = index + 1
|
|
|
|
|
-
|
|
|
|
|
- // 如果有"序号"列,也更新该列的值
|
|
|
|
|
- if (row.fixedValues && row.fixedValues['序号'] !== undefined) {
|
|
|
|
|
- // 可以根据需求决定是否更新,这里保持原值或更新为新序号
|
|
|
|
|
- // row.fixedValues['序号'] = index + 1
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // 更新表头序号
|
|
|
|
|
+ updateTableHeadersOrderNumbers() {
|
|
|
|
|
+ // 更新固定表的表头序号
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.contentEditForm.fixedTable &&
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders.forEach(
|
|
|
|
|
+ (header, index) => {
|
|
|
|
|
+ header.orderNum = index + 1
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
// 添加子项方法
|
|
// 添加子项方法
|
|
|
handleAddChildItem(index, type, parentRow) {
|
|
handleAddChildItem(index, type, parentRow) {
|
|
|
if (!parentRow.rowid) {
|
|
if (!parentRow.rowid) {
|
|
@@ -1966,19 +2025,47 @@
|
|
|
|
|
|
|
|
switch (type) {
|
|
switch (type) {
|
|
|
case '固定表项目':
|
|
case '固定表项目':
|
|
|
|
|
+ let parentIndex1 =
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTables.findIndex(
|
|
|
|
|
+ (item) => item.rowid == parentRow.rowid
|
|
|
|
|
+ )
|
|
|
|
|
+ if (
|
|
|
|
|
+ !this.contentEditForm.fixedTable.fixedTables[parentIndex1]
|
|
|
|
|
+ .children
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTables[parentIndex1],
|
|
|
|
|
+ 'children',
|
|
|
|
|
+ []
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
let childOrderNum =
|
|
let childOrderNum =
|
|
|
- this.contentEditForm.fixedTable.fixedTables.length + 1
|
|
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTables[parentIndex1].children
|
|
|
|
|
+ .length + 1
|
|
|
|
|
+
|
|
|
|
|
+ let fixedValues = {
|
|
|
|
|
+ ...parentRow.fixedValues,
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (const key in fixedValues) {
|
|
|
|
|
+ if (key == '序号') {
|
|
|
|
|
+ fixedValues[key] = childOrderNum
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fixedValues[key] = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
const fixedNewRow = {
|
|
const fixedNewRow = {
|
|
|
- orderText: '子项序号',
|
|
|
|
|
- orderNum: childOrderNum,
|
|
|
|
|
|
|
+ orderText: this.contentEditForm.fixedTable.fixedTables.length + 1,
|
|
|
|
|
+ orderNum: this.contentEditForm.fixedTable.fixedTables.length + 1,
|
|
|
cellCode: '',
|
|
cellCode: '',
|
|
|
calculationFormula: '',
|
|
calculationFormula: '',
|
|
|
unit: '',
|
|
unit: '',
|
|
|
tabtype: this.contentEditForm.templateType,
|
|
tabtype: this.contentEditForm.templateType,
|
|
|
surveyTemplateId: this.contentEditForm.surveyTemplateId,
|
|
surveyTemplateId: this.contentEditForm.surveyTemplateId,
|
|
|
versionId: this.versionId,
|
|
versionId: this.versionId,
|
|
|
- fixedValues: { ...parentRow.fixedValues },
|
|
|
|
|
|
|
+ fixedValues: fixedValues,
|
|
|
parentid: parentRow.rowid,
|
|
parentid: parentRow.rowid,
|
|
|
isChild: true,
|
|
isChild: true,
|
|
|
isSubItem: true,
|
|
isSubItem: true,
|
|
@@ -1992,12 +2079,15 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
- this.contentEditForm.fixedTable.fixedTables.splice(
|
|
|
|
|
- index + 1,
|
|
|
|
|
- 0,
|
|
|
|
|
- fixedNewRow
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTables[
|
|
|
|
|
+ parentIndex1
|
|
|
|
|
+ ].children.push(fixedNewRow)
|
|
|
|
|
+
|
|
|
|
|
+ // this.contentEditForm.fixedTable.fixedTables.splice(
|
|
|
|
|
+ // index + 1,
|
|
|
|
|
+ // 0,
|
|
|
|
|
+ // fixedNewRow
|
|
|
|
|
+ // )
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -2296,12 +2386,16 @@
|
|
|
* @param {Object} responseData - listByCurrentTemplateId接口返回的数据
|
|
* @param {Object} responseData - listByCurrentTemplateId接口返回的数据
|
|
|
*/
|
|
*/
|
|
|
parseAndDisplayFixedTableData(responseData) {
|
|
parseAndDisplayFixedTableData(responseData) {
|
|
|
- let fixedFields = this.contentEditForm.fixedTable.tableHeaders
|
|
|
|
|
- .map((item) => item.fieldName)
|
|
|
|
|
- .join(',')
|
|
|
|
|
- this.contentEditForm.fixedTable.fixedTablesTitle = this.stringToObjects(
|
|
|
|
|
- fixedFields || ''
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ if (responseData.value.fixedFields) {
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTablesTitle =
|
|
|
|
|
+ this.stringToObjects(responseData.value.fixedFields || '')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let fixedFields = this.contentEditForm.fixedTable.tableHeaders
|
|
|
|
|
+ .map((item) => item.fieldName)
|
|
|
|
|
+ .join(',')
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTablesTitle =
|
|
|
|
|
+ this.stringToObjects(fixedFields || '')
|
|
|
|
|
+ }
|
|
|
const fixedTitles = this.contentEditForm.fixedTable.fixedTablesTitle
|
|
const fixedTitles = this.contentEditForm.fixedTable.fixedTablesTitle
|
|
|
this.contentEditForm.fixedTable.fixedTableHeaders = fixedTitles.filter(
|
|
this.contentEditForm.fixedTable.fixedTableHeaders = fixedTitles.filter(
|
|
|
(title) => title.rkey !== '序号'
|
|
(title) => title.rkey !== '序号'
|
|
@@ -2313,20 +2407,20 @@
|
|
|
) {
|
|
) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const itemList = responseData.value.itemlist
|
|
const itemList = responseData.value.itemlist
|
|
|
|
|
+ const allRows = []
|
|
|
|
|
+ const rowMap = new Map()
|
|
|
|
|
|
|
|
// 清空现有数据
|
|
// 清空现有数据
|
|
|
this.contentEditForm.fixedTable.fixedTables = []
|
|
this.contentEditForm.fixedTable.fixedTables = []
|
|
|
|
|
|
|
|
- // 使用Map来存储所有行,便于快速查找父项
|
|
|
|
|
- const rowMap = new Map()
|
|
|
|
|
- const parentItems = []
|
|
|
|
|
-
|
|
|
|
|
// 遍历itemList,为每个项目创建一行数据
|
|
// 遍历itemList,为每个项目创建一行数据
|
|
|
itemList.forEach((item, index) => {
|
|
itemList.forEach((item, index) => {
|
|
|
// 判断是否为子项(parentid不为-1且不为"-1")
|
|
// 判断是否为子项(parentid不为-1且不为"-1")
|
|
|
const isSubItem =
|
|
const isSubItem =
|
|
|
item.parentid && item.parentid !== -1 && item.parentid !== '-1'
|
|
item.parentid && item.parentid !== -1 && item.parentid !== '-1'
|
|
|
|
|
+
|
|
|
const newRow = {
|
|
const newRow = {
|
|
|
orderText: item.orderNum || '', // 显示用序号
|
|
orderText: item.orderNum || '', // 显示用序号
|
|
|
orderNum: item.orderNum || '', // 保留原始序号用于发送后端
|
|
orderNum: item.orderNum || '', // 保留原始序号用于发送后端
|
|
@@ -2350,48 +2444,45 @@
|
|
|
newRow.orderNum = parseInt(item.orderNum, 10) || 0
|
|
newRow.orderNum = parseInt(item.orderNum, 10) || 0
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 初始化fixedValues并填充实际值
|
|
|
fixedTitles.forEach((title) => {
|
|
fixedTitles.forEach((title) => {
|
|
|
newRow.fixedValues[title.rkey] = item[title.rkey] || ''
|
|
newRow.fixedValues[title.rkey] = item[title.rkey] || ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // 将行添加到Map中
|
|
|
|
|
- rowMap.set(newRow.rowid, newRow)
|
|
|
|
|
- if (newRow.itemId) {
|
|
|
|
|
- rowMap.set(newRow.itemId, newRow)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 如果是父项,添加到父项数组
|
|
|
|
|
- if (!isSubItem) {
|
|
|
|
|
- parentItems.push(newRow)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ allRows.push(newRow)
|
|
|
|
|
+ // 构建rowMap用于快速查找
|
|
|
|
|
+ if (newRow.rowid) rowMap.set(String(newRow.rowid), newRow)
|
|
|
|
|
+ if (newRow.itemId) rowMap.set(String(newRow.itemId), newRow)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // 构建父子关系
|
|
|
|
|
- rowMap.forEach((row) => {
|
|
|
|
|
- if (row.isChild && row.parentid) {
|
|
|
|
|
- const parent = rowMap.get(row.parentid)
|
|
|
|
|
|
|
+ // 构建树形结构
|
|
|
|
|
+ const treeData = []
|
|
|
|
|
+ const parentItems = allRows.filter((item) => !item.isChild)
|
|
|
|
|
+
|
|
|
|
|
+ // 父级按orderNum正序排序
|
|
|
|
|
+ parentItems.sort((a, b) => (a.orderNum || 0) - (b.orderNum || 0))
|
|
|
|
|
+
|
|
|
|
|
+ // 将子项添加到对应的父项的children中
|
|
|
|
|
+ allRows.forEach((item) => {
|
|
|
|
|
+ if (item.isChild) {
|
|
|
|
|
+ const parentId = String(item.parentid)
|
|
|
|
|
+ const parent = rowMap.get(parentId)
|
|
|
if (parent) {
|
|
if (parent) {
|
|
|
- parent.children.push(row)
|
|
|
|
|
- // 确保父项有hasChildren标记
|
|
|
|
|
- parent.hasChildren = true
|
|
|
|
|
|
|
+ parent.children.push(item)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // 对父项按orderNum排序
|
|
|
|
|
- parentItems.sort((a, b) => (a.orderNum || 0) - (b.orderNum || 0))
|
|
|
|
|
-
|
|
|
|
|
- // 对子项按orderNum排序
|
|
|
|
|
|
|
+ // 对子项进行排序
|
|
|
parentItems.forEach((parent) => {
|
|
parentItems.forEach((parent) => {
|
|
|
- if (parent.children && parent.children.length > 0) {
|
|
|
|
|
- parent.children.sort(
|
|
|
|
|
- (a, b) => (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ parent.children.sort(
|
|
|
|
|
+ (a, b) =>
|
|
|
|
|
+ (a.fixedValues['序号'] || 0) - (b.fixedValues['序号'] || 0)
|
|
|
|
|
+ )
|
|
|
|
|
+ treeData.push(parent)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // 设置最终的fixedTables数据
|
|
|
|
|
- this.contentEditForm.fixedTable.fixedTables = parentItems
|
|
|
|
|
|
|
+ this.contentEditForm.fixedTable.fixedTables = treeData
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 将固定表项目的数据根据固定列拆分成对应的数据结构
|
|
* 将固定表项目的数据根据固定列拆分成对应的数据结构
|
|
@@ -2643,7 +2734,7 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handleCurrentChange(val) {
|
|
handleCurrentChange(val) {
|
|
|
- this.searchForm.pageNum = val
|
|
|
|
|
|
|
+ this.searchForm.page = val
|
|
|
this.handleSearch()
|
|
this.handleSearch()
|
|
|
},
|
|
},
|
|
|
|
|
|