|
|
|
@ -1,34 +1,39 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-table :data="tableData" border style="width: 100%" row-key="id" height="300" highlight-current-row size="small"> |
|
|
|
<el-table-column label="组合项目" width="120" prop="asbitemName" /> |
|
|
|
<el-table-column label="操作" width="130" prop="operate"> |
|
|
|
<div style="margin-top: -20px; margin-bottom: 5px;"> |
|
|
|
<span>项目类别</span> |
|
|
|
<el-cascader :options="dict.itemTypeTree" v-model="itemTypeIds" style="margin-left: 3px;width:160px;" |
|
|
|
:props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false" |
|
|
|
clearable filterable @change="getAsbItemByItemType" size="small"> |
|
|
|
</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" /> |
|
|
|
<el-table-column label="项目类别" width="120" prop="itemTypeName" /> |
|
|
|
<el-table-column label="组合项目" width="140" prop="asbitemName" /> |
|
|
|
<!-- isItemResultMerger 项目是否可以合并 --> |
|
|
|
<el-table-column label="已合并" width="60" prop="isAsbitemMerger" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-select v-model="scope.row.operate" placeholder="请操作方式" size="small" :disabled="scope.row.disabled" |
|
|
|
@change="changeOperate(scope.row)"> |
|
|
|
<el-option v-for="(item, index) in options" :key="index" :label="item.label" :value="item.value" /> |
|
|
|
</el-select> |
|
|
|
<div>{{ scope.row.isAsbitemMerger == 'Y' ? '是' : '否' }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="条码分组" width="120" prop="sampleGroupName" /> |
|
|
|
<el-table-column label="检验申请号" width="180" prop="lisRequestNo"> |
|
|
|
<el-table-column label="合并后项目名称" width="190" prop="mergerAsbitemName"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-select v-model="scope.row.lisRequestNo" size="small" :disabled="scope.row.disabled"> |
|
|
|
<el-option v-for="(item, index) in lisRequestNos" :key="index" :label="item.lisRequestNo" |
|
|
|
:value="item.lisRequestId" /> |
|
|
|
</el-select> |
|
|
|
<div>{{ scope.row.isAsbitemMerger == 'Y' ? scope.row.mergerAsbitemName : '' }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
</div> |
|
|
|
<!-- 按钮区域 --> |
|
|
|
<div style="display: flex; margin-top: 30px; margin-left: 280px"> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<el-button type="primary" @click="submit" style="width:80px;">合并项目</el-button> |
|
|
|
<el-button type="primary" @click="mergeSubmit" style="width:80px;">合并项目</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<el-button type="info" @click="lisPrint('0002', false)" style="width:80px;">取消合并</el-button> |
|
|
|
<el-button type="info" @click="unMergeSubmit" style="width:80px;">取消合并</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<el-button type="danger" @click="patientRegister.mergeAsbitemVisble = false" style="width:80px;">关闭</el-button> |
|
|
|
@ -41,19 +46,22 @@ |
|
|
|
import { mapState } from "vuex"; |
|
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
|
import { examinationgender } from "@/request/systemapi"; |
|
|
|
import { dddw, arrayExistObj } from "../../utlis/proFunc"; |
|
|
|
import { dddw, arrayExistObj, deepCopy } from "../../utlis/proFunc"; |
|
|
|
import { getTreeAllChildIdsById } from "../../utlis/tree"; |
|
|
|
// import |
|
|
|
export default { |
|
|
|
props: ["id", "brushTimes"], |
|
|
|
props: ["id", "organizationUnitId", "brushTimes"], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tableData: [], //组合项目数据 |
|
|
|
tableData: [], //组合项目数据 过滤后显示的数据 |
|
|
|
tableDataAll: [], //组合项目数据(该客户所有数据) |
|
|
|
itemTypeIds: [], //当前选中的类别及其上级类别ID |
|
|
|
options: [ |
|
|
|
{ label: "无", value: "no" }, |
|
|
|
{ label: "追加到以前条码", value: "append" }, |
|
|
|
{ label: "申请新的条码", value: "new" }, |
|
|
|
], //操作方式 |
|
|
|
lisRequestNos: [], //可选条码 |
|
|
|
selectedData: [], //选中的组合项目 |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
@ -63,128 +71,182 @@ export default { |
|
|
|
this.getAsbItemList(this.id); |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapState(["patientRegister"]), |
|
|
|
...mapState(["dict", "customerOrg", "patientRegister"]), |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
parseData(asbItem) { |
|
|
|
// "registerAsbitemId": "3a0d2e90-db36-09fe-4210-53fadb4f7d02", |
|
|
|
// asbitemId": "3a0c5600-ae78-9ed4-e3c1-993ef41d3c51", |
|
|
|
// "asbitemName": "外科", |
|
|
|
// "isCharge": "N", |
|
|
|
// "completeFlag": "0", |
|
|
|
// "sampleGroupId": "3a0c55c2-0f26-71a1-1f1a-ebbcbd77105b", |
|
|
|
// "sampleGroupName": "测试新增1", |
|
|
|
// "lisRequestId": "3a0d2fa9-aaba-4837-0775-20d13937f357", |
|
|
|
// "lisRequestNo": "T202308220016" |
|
|
|
if (asbItem.length < 1) return; |
|
|
|
let lfind = -1; |
|
|
|
this.lisRequestNos = []; |
|
|
|
|
|
|
|
asbItem.forEach((e) => { |
|
|
|
if (e.lisRequestNo) { |
|
|
|
e["operate"] = "no"; |
|
|
|
e["disabled"] = true; |
|
|
|
|
|
|
|
lfind = arrayExistObj( |
|
|
|
this.lisRequestNos, |
|
|
|
"lisRequestNo", |
|
|
|
e.lisRequestNo |
|
|
|
); |
|
|
|
if (lfind == -1) { |
|
|
|
this.lisRequestNos.push({ |
|
|
|
sampleGroupId: e.sampleGroupId, |
|
|
|
lisRequestNo: e.lisRequestNo, |
|
|
|
lisRequestId: e.lisRequestId, |
|
|
|
}); |
|
|
|
|
|
|
|
handleSelectionChange(v) { |
|
|
|
console.log('this.selectedData ,v', this.selectedData,v); |
|
|
|
|
|
|
|
if (!v || v.length < 1) { |
|
|
|
this.selectedData = v; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
// }) |
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//过滤组合项目 |
|
|
|
getAsbItemByItemType() { |
|
|
|
let itemTypeIdsChild = [], id = ''; |
|
|
|
if (this.itemTypeIds && this.itemTypeIds.length > 0) { |
|
|
|
id = this.itemTypeIds[this.itemTypeIds.length - 1]; |
|
|
|
itemTypeIdsChild = getTreeAllChildIdsById(this.dict.itemTypeTree, "treeChildren", "id", id); |
|
|
|
if (!itemTypeIdsChild) { |
|
|
|
itemTypeIdsChild = [id]; |
|
|
|
} else { |
|
|
|
itemTypeIdsChild.push(id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!itemTypeIdsChild || itemTypeIdsChild.length < 1) { |
|
|
|
this.tableData = deepCopy(this.tableDataAll); |
|
|
|
} else { |
|
|
|
e["disabled"] = false; |
|
|
|
this.tableData = []; |
|
|
|
this.tableDataAll.forEach(e => { |
|
|
|
if (itemTypeIdsChild.indexOf(e.itemTypeId) < 0) { |
|
|
|
this.tableData.push(e); |
|
|
|
} |
|
|
|
return e; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getAsbItemList(id) { |
|
|
|
this.tableDataAll = []; |
|
|
|
this.tableData = []; |
|
|
|
postapi( |
|
|
|
`/api/app/lisrequest/getregisterasbitemlisrequest?PatientRegisterId=${id}` |
|
|
|
// /api/app/registerasbitem/getmergeregisterasbitemlist?PatientRegisterId=3fa85f64-5717-4562-b3fc-2c963f66afa6 |
|
|
|
// "registerAsbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", |
|
|
|
// "asbitemName": "string", |
|
|
|
// "isItemResultMerger": "string", |
|
|
|
// "itemTypeName": "string", |
|
|
|
// "registerCheckId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", |
|
|
|
// "isAsbitemMerger": "string", |
|
|
|
// "mergerAsbitemName": "string" |
|
|
|
|
|
|
|
getapi( |
|
|
|
`/api/app/registerasbitem/getmergeregisterasbitemlist?PatientRegisterId=${id}` |
|
|
|
).then((res) => { |
|
|
|
this.tableData = res.data; |
|
|
|
this.parseData(this.tableData); |
|
|
|
this.tableDataAll = res.data; |
|
|
|
this.getAsbItemByItemType(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//操作方式 |
|
|
|
changeOperate(row) { |
|
|
|
let lfind = -1; |
|
|
|
if (row.operate == "append") { |
|
|
|
if (row.sampleGroupId) { |
|
|
|
lfind = arrayExistObj( |
|
|
|
this.lisRequestNos, |
|
|
|
"sampleGroupId", |
|
|
|
row.sampleGroupId |
|
|
|
); |
|
|
|
if (lfind > -1) { |
|
|
|
row.lisRequestNo = this.lisRequestNos[lfind].lisRequestNo; |
|
|
|
row.lisRequestId = this.lisRequestNos[lfind].lisRequestId; |
|
|
|
//手动合并项目 |
|
|
|
mergeSubmit() { |
|
|
|
let registerAsbitemIds = []; |
|
|
|
|
|
|
|
this.selectedData.forEach(e =>{ |
|
|
|
registerAsbitemIds.push(e.registerAsbitemId); |
|
|
|
}); |
|
|
|
|
|
|
|
if(registerAsbitemIds.length == 0){ |
|
|
|
this.$message.warning("请勾选要合并的项目!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let body={ |
|
|
|
registerAsbitemIds, |
|
|
|
organizationUnitId:this.organizationUnitId |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
postapi("/api/app/registerasbitem/mergeregisterasbitem", body).then( |
|
|
|
(res) => { |
|
|
|
if (res.Code != -1) { |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
this.getAsbItemList(this.id); |
|
|
|
} |
|
|
|
} else { |
|
|
|
row.lisRequestNo = ""; |
|
|
|
row.lisRequestId = ""; |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//确定 |
|
|
|
submit() { |
|
|
|
let append = [], |
|
|
|
news = []; |
|
|
|
let validMsg = "", |
|
|
|
lfind = -1; |
|
|
|
|
|
|
|
this.tableData.forEach((item) => { |
|
|
|
if (item.operate == "append") { |
|
|
|
if (item.lisRequestId) { |
|
|
|
lfind = arrayExistObj(append, "lisRequestId", item.lisRequestId); |
|
|
|
if ((lfind = -1)) { |
|
|
|
append.push({ |
|
|
|
lisRequestId: item.lisRequestId, |
|
|
|
registerAsbitemIds: [item.registerAsbitemId], |
|
|
|
}); |
|
|
|
} else { |
|
|
|
append[lfind]["registerAsbitemIds"].push(item.registerAsbitemId); |
|
|
|
} |
|
|
|
} else { |
|
|
|
validMsg = row.asbitemName + "项目,未选择追加到哪个检验申请单号!"; |
|
|
|
} |
|
|
|
} else if (item.operate == "new") { |
|
|
|
news.push(item.registerAsbitemId); |
|
|
|
//取消合并项目 |
|
|
|
unMergeSubmit() { |
|
|
|
let registerCheckIds = []; |
|
|
|
|
|
|
|
this.selectedData.forEach(e =>{ |
|
|
|
if(registerCheckIds.indexOf(e.registerCheckId) < 0){ |
|
|
|
registerCheckIds.push(e.registerCheckId); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if (validMsg) { |
|
|
|
this.$message.warning(validMsg); |
|
|
|
if(registerCheckIds.length == 0){ |
|
|
|
this.$message.warning("未选择已合并的项目,不可执行此操作!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (append.length > 0) { |
|
|
|
postapi("/api/app/lisrequest/appendlisrequestmany", append).then( |
|
|
|
console.log('registerCheckIds',registerCheckIds); |
|
|
|
|
|
|
|
let body={ |
|
|
|
registerCheckIds, |
|
|
|
organizationUnitId:this.organizationUnitId |
|
|
|
}; |
|
|
|
|
|
|
|
postapi("/api/app/registerasbitem/cancelmergeregisterasbitem", body).then( |
|
|
|
(res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.$message.success("项目追加到检验申请单成功!"); |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
this.getAsbItemList(this.id); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
if (news.length > 0) { |
|
|
|
postapi("/api/app/lisrequest/addlisrequest", news).then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.$message.success("项目创建检验申请单成功!"); |
|
|
|
this.getAsbItemList(this.id); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|