|
|
|
@ -9,8 +9,9 @@ |
|
|
|
</el-cascader> |
|
|
|
</div> |
|
|
|
<el-table :data="tableData" border style="width: 100%" row-key="id" height="300" highlight-current-row size="small" |
|
|
|
@selection-change="handleSelectionChange" ref="tableData"> |
|
|
|
<el-table-column type="selection" /> |
|
|
|
@selection-change="handleSelectionChange" :span-method="spanMethod" ref="tableData" |
|
|
|
:row-style="{ height: '30px' }"> |
|
|
|
<el-table-column type="selection" :selectable="selectable" /> |
|
|
|
<el-table-column label="项目类别" width="120" prop="itemTypeName" /> |
|
|
|
<el-table-column label="组合项目" width="140" prop="asbitemName" /> |
|
|
|
<!-- isItemResultMerger 项目是否可以合并 --> |
|
|
|
@ -54,6 +55,7 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tableData: [], //组合项目数据 过滤后显示的数据 |
|
|
|
spanRow: [], //{ startRow: 0, endRow: 0 } 合并行 |
|
|
|
tableDataAll: [], //组合项目数据(该客户所有数据) |
|
|
|
itemTypeIds: [], //当前选中的类别及其上级类别ID |
|
|
|
options: [ |
|
|
|
@ -62,6 +64,7 @@ export default { |
|
|
|
{ label: "申请新的条码", value: "new" }, |
|
|
|
], //操作方式 |
|
|
|
selectedData: [], //选中的组合项目 |
|
|
|
finalSelected:[], //取消合并时与selectedData一致,合并时要追 其他未勾选合并的项目 |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
@ -75,70 +78,99 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
handleSelectionChange(v) { |
|
|
|
console.log('this.selectedData ,v', this.selectedData,v); |
|
|
|
selectable(row, index) { |
|
|
|
//console.log(row,index); |
|
|
|
let able = true; |
|
|
|
if (index == 0) return true; |
|
|
|
if (this.tableData[index - 1].registerCheckId == row.registerCheckId) able = false; |
|
|
|
return able; |
|
|
|
}, |
|
|
|
|
|
|
|
if (!v || v.length < 1) { |
|
|
|
this.selectedData = v; |
|
|
|
return; |
|
|
|
spanMethod({ row, column, rowIndex, columnIndex }) { |
|
|
|
//console.log(row, column, rowIndex, columnIndex); |
|
|
|
if (columnIndex == 3) { |
|
|
|
for (let i = 0; i < this.spanRow.length; i++) { |
|
|
|
if (rowIndex == this.spanRow[i].startRow) { |
|
|
|
return { |
|
|
|
rowspan: Number(this.spanRow[i].endRow - this.spanRow[i].startRow) + 1, |
|
|
|
colspan: 1 |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (columnIndex == 4) { |
|
|
|
for (let i = 0; i < this.spanRow.length; i++) { |
|
|
|
if (rowIndex == this.spanRow[i].startRow) { |
|
|
|
return { |
|
|
|
rowspan: Number(this.spanRow[i].endRow - this.spanRow[i].startRow) + 1, |
|
|
|
colspan: 1 |
|
|
|
}; |
|
|
|
} else if (this.spanRow[i].startRow < rowIndex && rowIndex <= this.spanRow[i].endRow) { |
|
|
|
return { |
|
|
|
rowspan: 0, |
|
|
|
colspan: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//分析合并的行数据 |
|
|
|
parseSpanRow() { |
|
|
|
this.spanRow = []; |
|
|
|
let preVal = '', curVal = ''; |
|
|
|
let startRow = 0; |
|
|
|
for (let i = 0; i < this.tableData.length; i++) { |
|
|
|
if (i == 0) { |
|
|
|
preVal = this.tableData[i].registerCheckId; |
|
|
|
curVal = this.tableData[i].registerCheckId; |
|
|
|
} else { |
|
|
|
curVal = this.tableData[i].registerCheckId; |
|
|
|
if (preVal !== curVal) { |
|
|
|
if (startRow !== i - 1) this.spanRow.push({ startRow, endRow: i - 1 }); |
|
|
|
startRow = i; |
|
|
|
preVal = this.tableData[i].registerCheckId; |
|
|
|
} |
|
|
|
if (i == this.tableData.length - 1 && preVal === curVal){ |
|
|
|
this.spanRow.push({ startRow, endRow: i }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
handleSelectionChange(v) { |
|
|
|
this.selectedData = v; |
|
|
|
//处理已合并的,要么全勾选,要么全不勾选 |
|
|
|
|
|
|
|
// let currSelectedIds = []; |
|
|
|
// let finalSelected = deepCopy(v); //最终勾选的数据 |
|
|
|
|
|
|
|
// v.forEach(e => { |
|
|
|
// currSelectedIds.push(e.registerAsbitemId); |
|
|
|
// }); |
|
|
|
// console.log('currSelectedIds', currSelectedIds); |
|
|
|
|
|
|
|
// //原选择的有,新选的没有,则为取消勾选 |
|
|
|
// this.selectedData.forEach(e => { |
|
|
|
// //取消勾选 |
|
|
|
// if (currSelectedIds.indexOf(e.registerAsbitemId) < 0) { |
|
|
|
// for (let i = finalSelected.length - 1; i > -1; i--) { |
|
|
|
// if(finalSelected[i].registerCheckId == e.registerCheckId){ |
|
|
|
// finalSelected.splice(i,1); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
// //判断勾选的 合并的有一个勾选,则其他项目也勾选 |
|
|
|
// let currMergeIds = []; |
|
|
|
// currSelectedIds = []; |
|
|
|
// finalSelected.forEach(e => { |
|
|
|
// currSelectedIds.push(e.registerAsbitemId); |
|
|
|
// if(currMergeIds.indexOf(e.registerCheckId) < 0){ |
|
|
|
// currMergeIds.push(e.registerCheckId); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
// this.tableData.forEach(e =>{ |
|
|
|
// if(currMergeIds.indexOf(e.registerCheckId) > - 1){ |
|
|
|
// if(currSelectedIds.indexOf(e.registerAsbitemId) < 0){ |
|
|
|
// finalSelected.push(e); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
// this.selectedData = deepCopy(finalSelected); |
|
|
|
|
|
|
|
// console.log('this.selectedData', this.selectedData); |
|
|
|
|
|
|
|
// this.$nextTick(function () { |
|
|
|
// //this.$refs['tableData'].clearSelection(); |
|
|
|
// this.selectedData.forEach(row => { |
|
|
|
// this.$refs['tableData'].toggleRowSelection(row,true) |
|
|
|
// }) |
|
|
|
// }); |
|
|
|
}, |
|
|
|
|
|
|
|
//获取合并的项目(不是同一个项目类别不可以合并) |
|
|
|
getFinalSelected(){ |
|
|
|
let currSelectedCheckIds = []; |
|
|
|
let finalSelectedIds = []; |
|
|
|
|
|
|
|
}, |
|
|
|
this.finalSelected = deepCopy(this.selectedData); //最终勾选的数据 |
|
|
|
this.selectedData.forEach(e => { |
|
|
|
if(currSelectedCheckIds.indexOf(e.registerCheckId) < 0) currSelectedCheckIds.push(e.registerCheckId); |
|
|
|
finalSelectedIds.push(e.registerAsbitemId); |
|
|
|
}); |
|
|
|
|
|
|
|
console.log('currSelectedCheckIds', currSelectedCheckIds); |
|
|
|
console.log('finalSelectedIds', finalSelectedIds); |
|
|
|
|
|
|
|
// //判断勾选的 合并的有一个勾选,则其他项目也勾选 |
|
|
|
this.tableData.forEach(e => { |
|
|
|
if(currSelectedCheckIds.indexOf(e.registerCheckId) > -1){ |
|
|
|
if(finalSelectedIds.indexOf(e.registerAsbitemId) < 0){ |
|
|
|
finalSelectedIds.push(e.registerAsbitemId); |
|
|
|
this.finalSelected.push(e); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
console.log('this.selectedData', this.selectedData); |
|
|
|
console.log('this.finalSelected', this.finalSelected); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//过滤组合项目 |
|
|
|
@ -164,11 +196,12 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
this.parseSpanRow(); |
|
|
|
}, |
|
|
|
|
|
|
|
getAsbItemList(id) { |
|
|
|
this.tableDataAll = []; |
|
|
|
this.tableData = []; |
|
|
|
this.tableDataAll = []; |
|
|
|
// /api/app/registerasbitem/getmergeregisterasbitemlist?PatientRegisterId=3fa85f64-5717-4562-b3fc-2c963f66afa6 |
|
|
|
// "registerAsbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", |
|
|
|
// "asbitemName": "string", |
|
|
|
@ -181,27 +214,43 @@ export default { |
|
|
|
getapi( |
|
|
|
`/api/app/registerasbitem/getmergeregisterasbitemlist?PatientRegisterId=${id}` |
|
|
|
).then((res) => { |
|
|
|
this.tableDataAll = res.data; |
|
|
|
this.getAsbItemByItemType(); |
|
|
|
if(res.code != -1){ |
|
|
|
//isItemResultMerger |
|
|
|
res.data.forEach(e =>{ |
|
|
|
//过滤不能合并的项目 |
|
|
|
if(e.isItemResultMerger.toUpperCase() == 'Y'){ |
|
|
|
this.tableDataAll.push(e); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.getAsbItemByItemType(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//手动合并项目 |
|
|
|
mergeSubmit() { |
|
|
|
let registerAsbitemIds = []; |
|
|
|
let itemTypes = []; |
|
|
|
|
|
|
|
this.selectedData.forEach(e =>{ |
|
|
|
this.getFinalSelected(); |
|
|
|
this.finalSelected.forEach(e => { |
|
|
|
if(itemTypes.indexOf(e.itemTypeName) < 0) itemTypes.push(e.itemTypeName); |
|
|
|
registerAsbitemIds.push(e.registerAsbitemId); |
|
|
|
}); |
|
|
|
|
|
|
|
if(registerAsbitemIds.length == 0){ |
|
|
|
this.$message.warning("请勾选要合并的项目!"); |
|
|
|
if(itemTypes.length > 1){ |
|
|
|
this.$message.warning("勾选了不同类别的项目,数据校验失败,不可执行此操作!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let body={ |
|
|
|
if (registerAsbitemIds.length < 2) { |
|
|
|
this.$message.warning("请勾选 2 个以上要合并的项目!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let body = { |
|
|
|
registerAsbitemIds, |
|
|
|
organizationUnitId:this.organizationUnitId |
|
|
|
organizationUnitId: this.organizationUnitId |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -213,29 +262,29 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//取消合并项目 |
|
|
|
unMergeSubmit() { |
|
|
|
let registerCheckIds = []; |
|
|
|
|
|
|
|
this.selectedData.forEach(e =>{ |
|
|
|
if(registerCheckIds.indexOf(e.registerCheckId) < 0){ |
|
|
|
registerCheckIds.push(e.registerCheckId); |
|
|
|
} |
|
|
|
this.selectedData.forEach(e => { |
|
|
|
if (e.isAsbitemMerger.toUpperCase() == 'Y' && registerCheckIds.indexOf(e.registerCheckId) < 0) { |
|
|
|
registerCheckIds.push(e.registerCheckId); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if(registerCheckIds.length == 0){ |
|
|
|
this.$message.warning("未选择已合并的项目,不可执行此操作!"); |
|
|
|
if (registerCheckIds.length == 0) { |
|
|
|
this.$message.warning("未选择到已合并的项目,不可执行此操作!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
console.log('registerCheckIds',registerCheckIds); |
|
|
|
//console.log('registerCheckIds', registerCheckIds); |
|
|
|
|
|
|
|
let body={ |
|
|
|
let body = { |
|
|
|
registerCheckIds, |
|
|
|
organizationUnitId:this.organizationUnitId |
|
|
|
organizationUnitId: this.organizationUnitId |
|
|
|
}; |
|
|
|
|
|
|
|
postapi("/api/app/registerasbitem/cancelmergeregisterasbitem", body).then( |
|
|
|
@ -246,10 +295,10 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//监听事件 |
|
|
|
|