From 1442c30b0092b41aaa490af77a67a979f863c6ce Mon Sep 17 00:00:00 2001 From: pengjun <158915633@qq.com> Date: Fri, 24 Nov 2023 17:40:06 +0800 Subject: [PATCH] import --- .../customerOrg/patientRegisterImport.vue | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/views/customerOrg/patientRegisterImport.vue b/src/views/customerOrg/patientRegisterImport.vue index 6165c44..23bedf4 100644 --- a/src/views/customerOrg/patientRegisterImport.vue +++ b/src/views/customerOrg/patientRegisterImport.vue @@ -151,7 +151,7 @@
体检单位: - @@ -1054,6 +1054,7 @@ export default { e.choosed = false; e.index = index; e.id = 'excelData' + index; + }); //console.log('this.excelCols',this.excelCols) // console.log('sheet_to_json excelData',this.excelData) @@ -1144,6 +1145,7 @@ export default { }) }) + //右击显示的菜单 this.$contextmenu({ items, event, @@ -1160,6 +1162,7 @@ export default { //设置真实数据字段列 setColumn(oldColNum,newColObj){ + // console.log('oldColNum,newColObj',oldColNum,newColObj) //如果数据字段已设置过,则将之前设置的先清空 if(newColObj.dispLabel != "不设置"){ let lfind = arrayExistObj(this.excelCols,'dataLabel',newColObj.dispLabel) @@ -1168,8 +1171,18 @@ export default { this.excelCols[lfind].val = '' } } + this.excelCols[oldColNum].dataLabel = newColObj.dispLabel this.excelCols[oldColNum].val = newColObj.val + // console.log('newColObj.val',newColObj.val) + let tempDate = '' + if(newColObj.val == 'birthDate'){ + this.excelData.forEach(e =>{ + tempDate = e[this.excelCols[oldColNum].dispLabel] + // console.log('birthDate',tempDate) + e[this.excelCols[oldColNum].dispLabel] = tempDate ? moment(new Date(tempDate)).format('yyyy-MM-DD'):'' + }) + } }, // 导入后,批量分析Excel列 与 数据字段 的匹配关系 @@ -1277,9 +1290,9 @@ export default { case 'age': if(ExcelData[e.dispLabel]) body[e.val] = parseInt(ExcelData[e.dispLabel]) break; - case 'birthDate': - if(ExcelData[e.dispLabel]) body[e.val] = moment(new Date(ExcelData[e.dispLabel])).format('yyyy-MM-DD') - break; + // case 'birthDate': + // if(ExcelData[e.dispLabel]) body[e.val] = moment(new Date(ExcelData[e.dispLabel])).format('yyyy-MM-DD') + // break; default: body[e.val] = ExcelData[e.dispLabel] break;