|
@@ -559,6 +559,7 @@ function getDefaultSchema(designerInstance) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let dataCount = 0
|
|
let dataCount = 0
|
|
|
|
|
+let prefixFields = new Set()
|
|
|
function setDataSource(designerInstance, schemaData, dataSourceValues) {
|
|
function setDataSource(designerInstance, schemaData, dataSourceValues) {
|
|
|
dataSourceValues =
|
|
dataSourceValues =
|
|
|
!is(dataSourceValues, 'Object') && is(dataSourceValues, 'String')
|
|
!is(dataSourceValues, 'Object') && is(dataSourceValues, 'String')
|
|
@@ -571,13 +572,18 @@ function setDataSource(designerInstance, schemaData, dataSourceValues) {
|
|
|
|
|
|
|
|
const formatterSource = generateDefaultData(schemaData)
|
|
const formatterSource = generateDefaultData(schemaData)
|
|
|
const resultDataSource = deepMergeSchemaValue(formatterSource, dataSourceValues)
|
|
const resultDataSource = deepMergeSchemaValue(formatterSource, dataSourceValues)
|
|
|
|
|
+ console.log("@@@resultDataSource......", resultDataSource)
|
|
|
|
|
|
|
|
const spreadInstance = designerInstance.getWorkbook()
|
|
const spreadInstance = designerInstance.getWorkbook()
|
|
|
const {
|
|
const {
|
|
|
dataSource: continuePageProceedDataSource,
|
|
dataSource: continuePageProceedDataSource,
|
|
|
sheetToRecordRowCount,
|
|
sheetToRecordRowCount,
|
|
|
|
|
+ prefixFieldSet,
|
|
|
totalDataCount,
|
|
totalDataCount,
|
|
|
} = processContinueDataSource(spreadInstance, resultDataSource)
|
|
} = processContinueDataSource(spreadInstance, resultDataSource)
|
|
|
|
|
+
|
|
|
|
|
+ console.log("@@@@xxxxxxxxx111111....", continuePageProceedDataSource)
|
|
|
|
|
+ prefixFields = prefixFieldSet
|
|
|
dataCount = totalDataCount
|
|
dataCount = totalDataCount
|
|
|
processContinuePage(
|
|
processContinuePage(
|
|
|
spreadInstance,
|
|
spreadInstance,
|
|
@@ -585,6 +591,7 @@ function setDataSource(designerInstance, schemaData, dataSourceValues) {
|
|
|
sheetToRecordRowCount,
|
|
sheetToRecordRowCount,
|
|
|
totalDataCount,
|
|
totalDataCount,
|
|
|
)
|
|
)
|
|
|
|
|
+ console.log("@@@@@xxxxxxxx2222222....", continuePageProceedDataSource)
|
|
|
registerCellValuesChangeEventHandlerForEverySheet(spreadInstance.sheets)
|
|
registerCellValuesChangeEventHandlerForEverySheet(spreadInstance.sheets)
|
|
|
for (const sheet of spreadInstance.sheets) {
|
|
for (const sheet of spreadInstance.sheets) {
|
|
|
const tables = sheet.tables?.all() || []
|
|
const tables = sheet.tables?.all() || []
|
|
@@ -623,7 +630,7 @@ function getDataSource(designerInstance) {
|
|
|
|
|
|
|
|
function processContinueDataSource(spreadInstance, dataSource) {
|
|
function processContinueDataSource(spreadInstance, dataSource) {
|
|
|
if (!props.copyConfig?.isContinuePage) {
|
|
if (!props.copyConfig?.isContinuePage) {
|
|
|
- return dataSource
|
|
|
|
|
|
|
+ return {dataSource}
|
|
|
}
|
|
}
|
|
|
console.log('@@@@@datasource', dataSource)
|
|
console.log('@@@@@datasource', dataSource)
|
|
|
dataSource = { ...dataSource }
|
|
dataSource = { ...dataSource }
|
|
@@ -716,7 +723,7 @@ function processContinueDataSource(spreadInstance, dataSource) {
|
|
|
}
|
|
}
|
|
|
console.log('@@@flatDataSource.....', dataSource)
|
|
console.log('@@@flatDataSource.....', dataSource)
|
|
|
|
|
|
|
|
- return { dataSource, sheetToRecordRowCount, totalDataCount }
|
|
|
|
|
|
|
+ return { dataSource, prefixFieldSet, sheetToRecordRowCount, totalDataCount }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 续页生成,超出一览表(第一页),把续页(第二页)从隐藏改成显示,超出续页(第二页),拷贝续页,copyRange范围内的bindingPath做递增修改
|
|
// 续页生成,超出一览表(第一页),把续页(第二页)从隐藏改成显示,超出续页(第二页),拷贝续页,copyRange范围内的bindingPath做递增修改
|
|
@@ -1330,7 +1337,34 @@ function handleDataJson(dataJson) {
|
|
|
if (!props.copyConfig?.isContinuePage) {
|
|
if (!props.copyConfig?.isContinuePage) {
|
|
|
return dataJson
|
|
return dataJson
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const prefixFieldData = {}
|
|
|
|
|
+ for (const prefixField of prefixFields) {
|
|
|
|
|
+ if(prefixField.startsWith('yearInspectionConclusion')) {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+ const cellDataList = []
|
|
|
|
|
+ for (let i = 0; i < dataCount; i++) {
|
|
|
|
|
+ const cellData = dataJson[`${prefixField}_${i+1}`]
|
|
|
|
|
+ cellDataList.push(cellData)
|
|
|
|
|
+ }
|
|
|
|
|
+ prefixFieldData[`${prefixField}_1`] = JSON.stringify(cellDataList)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ for (const key in dataJson) {
|
|
|
|
|
+ if(key.startsWith(prefixField)) {
|
|
|
|
|
+ delete dataJson[key]
|
|
|
|
|
+ }
|
|
|
|
|
+ if(key.startsWith("yearInspectionConclusion")) {
|
|
|
|
|
+ const yc = dataJson[key]
|
|
|
|
|
+ if(yc == null || yc == "") {
|
|
|
|
|
+ delete dataJson[key]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return Object.assign(dataJson, prefixFieldData)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function saveRecord() {
|
|
function saveRecord() {
|
|
@@ -1352,7 +1386,7 @@ function saveRecord() {
|
|
|
instId: props.checkItemData.instId,
|
|
instId: props.checkItemData.instId,
|
|
|
reportUrl: props.checkItemData.reportUrl || '',
|
|
reportUrl: props.checkItemData.reportUrl || '',
|
|
|
bindingPathSchema: schemaJSON,
|
|
bindingPathSchema: schemaJSON,
|
|
|
- prepareJson: dataJSON,
|
|
|
|
|
|
|
+ prepareJson: handleDataJson(dataJSON),
|
|
|
reportName: props.checkItemData.reportName,
|
|
reportName: props.checkItemData.reportName,
|
|
|
checkItemId: props.checkItemData.checkItemId,
|
|
checkItemId: props.checkItemData.checkItemId,
|
|
|
images,
|
|
images,
|