feat(模块): 添加了个很棒的功能
This commit is contained in:
parent
a96e829ac4
commit
f4d966168e
@ -93,10 +93,12 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
let options: string = ''
|
let options: string = ''
|
||||||
if (item.question.options && item.question.options.length > 0) {
|
if (item.question.options && item.question.options.length > 0) {
|
||||||
item.question.options.forEach((subItem: any, subIndex: number) => {
|
item.question.options.forEach((subItem: any, subIndex: number) => {
|
||||||
options += `${subIndex > 0 ? ',' : ''}选项${subIndex + 1}:${subItem.text}`
|
options += `${subItem.text};`
|
||||||
|
// ${subIndex > 0 ? ',' : ''} 选项${subIndex + 1}:
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
questionStr += `${index > 0 ? ',' : ''}问题${index + 1}:${item.question.title},${options}`
|
questionStr += `${index > 0 ? ',' : ''}问题:${item.question.title}。${options}`
|
||||||
|
// ${index + 1}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return questionStr || ''
|
return questionStr || ''
|
||||||
|
|||||||
@ -65,10 +65,11 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
dataIndex: "title",
|
dataIndex: "title",
|
||||||
hideInTable: detailType === 'modal',
|
hideInTable: detailType === 'modal',
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
|
let questionType: string = record?.question.type.split('_')[0]
|
||||||
let str: string = ''
|
let str: string = ''
|
||||||
if (record.choiceResponse && record?.choiceResponse.length > 0) {
|
if (record.choiceResponse && record?.choiceResponse.length > 0) {
|
||||||
record.choiceResponse.forEach((item: any, index: number) => {
|
record.choiceResponse.forEach((item: any, index: number) => {
|
||||||
str += `${index > 0 ? ',' : ''}答案${index + 1}:${item}`
|
str += `${item.text ? item.text : item};`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return str || ""
|
return str || ""
|
||||||
@ -395,7 +396,8 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
let resultStr = '';
|
let resultStr = '';
|
||||||
if (record.choiceResponse && record.choiceResponse.length > 0) {
|
if (record.choiceResponse && record.choiceResponse.length > 0) {
|
||||||
record.choiceResponse.forEach((item: any, index: number) => {
|
record.choiceResponse.forEach((item: any, index: number) => {
|
||||||
resultStr += `${index > 0 ? ',' : ''}结果${index + 1}:${item}`;
|
resultStr += `${item.text ? item.text : item}`;
|
||||||
|
// ${index > 0 ? ',' : ''}结果${index + 1}:
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
printContent += `<td style="text-align:left">${resultStr || ''}</td>`;
|
printContent += `<td style="text-align:left">${resultStr || ''}</td>`;
|
||||||
@ -672,7 +674,8 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
let file = JSON.parse(JSON.stringify(fileList))
|
let file = JSON.parse(JSON.stringify(fileList))
|
||||||
file.push({
|
file.push({
|
||||||
uid: '',
|
uid: '',
|
||||||
name: `${data.data.filename}.png`,
|
// name: `${data.data.filename}.png`,
|
||||||
|
name: `${info.file.name}.png`,
|
||||||
status: 'done',
|
status: 'done',
|
||||||
url: url,
|
url: url,
|
||||||
})
|
})
|
||||||
@ -724,6 +727,7 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
request={async () => {
|
request={async () => {
|
||||||
let res = detailType === 'modal' ? parentRow?.questionnaireTemplateQuestions
|
let res = detailType === 'modal' ? parentRow?.questionnaireTemplateQuestions
|
||||||
|| [] : parentRow?.questionResponses || []
|
|| [] : parentRow?.questionResponses || []
|
||||||
|
console.log('parentRow', parentRow);
|
||||||
console.log('res', res);
|
console.log('res', res);
|
||||||
|
|
||||||
let obj: any = {}
|
let obj: any = {}
|
||||||
@ -741,6 +745,9 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
}
|
}
|
||||||
setExamineObj(obj)
|
setExamineObj(obj)
|
||||||
|
|
||||||
|
console.log('resresres', res);
|
||||||
|
|
||||||
|
|
||||||
let tableData = await handeGetTableData(typeData, res)
|
let tableData = await handeGetTableData(typeData, res)
|
||||||
console.log('tableData', tableData);
|
console.log('tableData', tableData);
|
||||||
// 拿到整个数据之后 递归取出tableData中有 question 数据的那一层数据变为一个数组
|
// 拿到整个数据之后 递归取出tableData中有 question 数据的那一层数据变为一个数组
|
||||||
@ -749,6 +756,10 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
|
|
||||||
// 处理表格数据,为合并单元格做准备
|
// 处理表格数据,为合并单元格做准备
|
||||||
let processedData = processTableDataForMerge(tableRes);
|
let processedData = processTableDataForMerge(tableRes);
|
||||||
|
|
||||||
|
|
||||||
|
console.log('processedData', processedData);
|
||||||
|
|
||||||
setTableData(processedData)
|
setTableData(processedData)
|
||||||
|
|
||||||
if (processedData && processedData.length > 0) {
|
if (processedData && processedData.length > 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user