|
|
<template> <div style="padding: 0 2px;"> <div style="height:32px;"> <div v-show="checkPagePriv(pagePriv.privs,'新增诊断')"> <el-select v-model="diagnosis" placeholder="快速选择诊断疾病" size="small" filterable clearable remote automatic-dropdown :remote-method="remoteMethod" @change="quickChoosedDiag" default-first-option ref="diagnosises" value-key="id" style="width:196px;text-align: left;padding-right: 15px;"> <el-option v-for="item in diagnosisesCur" :key="item.id" :value="item" :label="item.displayName" /> </el-select> </div> </div> <div> <el-table :data="sumDoctorCheck.diagnosisList" :height="sumHeight" width="100%" size="small"> <!-- temporaryselection personnelUnit.nogroupselected--> <!-- "patientRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "diagnosisId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "sumSuggestionHeaderId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "displayOrder": 0, "diagnosisName": "string" --> <el-table-column type="index" align="center" width="25" /> <el-table-column label="诊断疾病" min-width="130" prop="diagnosisName" /> <el-table-column fixed="right" width="25" > <template slot-scope="scope"> <i v-show="checkPagePriv(pagePriv.privs,'删除诊断')" class="el-icon-delete" @click="deleteRow(scope.$index)" style="font-size: 20px;color: red;cursor:pointer;"></i> </template> </el-table-column> </el-table> </div> </div></template><script>import moment from "moment";import { mapState, mapMutations } from "vuex";import { getapi, postapi, putapi, deletapi } from "@/api/api";import { getPagePriv,checkPagePriv, dddw, objCopy, arrayReduce, deepCopy } from "@/utlis/proFunc";
export default { components: { }, props: ['patientRegisterId'], data() { return { pagePriv:{ routeUrlorPageName:'sumDoctorCheck', //当前页面归属路由或归属页面权限名称
privs:[] // 页面权限
}, diagnosis: "", diagnosisesCur: [], //疾病列表数据
diagnosisesAll: [], //疾病列表数据
}; },
created() { //获取用户当前页面的权限
let userPriv = window.sessionStorage.getItem('userPriv') if(userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
this.dictInit();
},
//挂载完成
mounted() { this.getDiagnosisList(this.dataTransOpts.tableS.patient_register.id); }, computed: { ...mapState(["window", "dict","dataTransOpts", "patientRegister", "customerOrg", "doctorCheck", "sumDoctorCheck", "report"]), sumHeight(){ let tempHeight = this.window.pageHeight < 600 ? 600:this.window.pageHeight return tempHeight - 352 }, }, methods: { checkPagePriv, dictInit() { postapi('/api/app/diagnosis/getlistinsuggestion', {}).then(res => { if (res.code != -1) { this.diagnosisesCur = res.data this.diagnosisesAll = res.data //过滤已选的诊断
this.filterDiagnosises()
} })
},
//快速选择组合项目时,调整可按拼间简码及简称查找
remoteMethod(keyWords) { //console.log('remoteMethod',this.dict.asbItemQuick)
if (keyWords) { this.diagnosisesCur = []; this.diagnosisesAll.forEach(item => { if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1 || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1) { this.diagnosisesCur.push(item); } }); } else { this.diagnosisesCur = deepCopy(this.diagnosisesAll) }
//过滤已选的诊断
this.filterDiagnosises()
},
//过滤已选诊断的
filterDiagnosises(){ let sumDiagnosises = deepCopy(this.sumDoctorCheck.diagnosisList) sumDiagnosises.forEach(e =>{ e.id = e.diagnosisId return e }) this.diagnosisesCur = arrayReduce(this.diagnosisesCur,sumDiagnosises,'id') },
quickChoosedDiag(v) { if (!v) return console.log(v)
this.sumDoctorCheck.diagnosisList.push({ patientRegisterId: this.patientRegisterId, diagnosisId: v.id, diagnosisName: v.displayName, })
let id = String(new Date().getTime()) let details = []
v.suggestions.forEach(e => { details.push({ sumSuggestionHeaderId: id, suggestionContent: e.suggestionContent }) })
let pojo = { id: id, patientRegisterId: this.patientRegisterId, suggestionTitle: v.suggestionName || v.displayName, diagnosisId: v.id, details }
this.sumDoctorCheck.suggestionList.push(pojo);
},
//查询
getDiagnosisList(PatientRegisterId) { this.sumDoctorCheck.diagnosisList = [] if(!PatientRegisterId) return // /api/app/sumdiagnosis/getsumdiagnosislistinpatientregisterid?PatientRegisterId=3fa85f64-5717-4562-b3fc-2c963f66afa6
getapi(`/api/app/sumdiagnosis/getsumdiagnosislistinpatientregisterid?PatientRegisterId=${PatientRegisterId}`) .then((res) => { if(res.code != - 1) this.sumDoctorCheck.diagnosisList = res.data }); },
deleteRow(index) { this.$confirm("此操作将删除该记录, 是否继续?", "提示", { confirmButtonText: "是", cancelButtonText: "否", type: "warning", }).then(() => { //删除建议
let count = this.sumDoctorCheck.suggestionList.length - 1 for (let i = count; i > 0; i--) { //console.log(this.sumDoctorCheck.suggestionList[i].diagnosisId, this.sumDoctorCheck.diagnosisList[index].diagnosisId)
if (this.sumDoctorCheck.suggestionList[i].diagnosisId == this.sumDoctorCheck.diagnosisList[index].diagnosisId) { this.sumDoctorCheck.suggestionList.splice(i, 1) } } this.sumDoctorCheck.diagnosisList.splice(index, 1) }).catch((err) => { if(err == 'cancel'){ console.log(`已取消 ${err}`) }else{ this.$message.error(`操作失败 ${err}`) } });
},
},
//监听事件
watch: { "dataTransOpts.refresh.sum_diagnosis.M": { // immediate:true,
handler(newVal, oldVal) { console.log(`watch 总检--诊断 newVal: ${newVal}, oldVal: ${oldVal} patientRegisterId: ${this.dataTransOpts.tableS.patient_register.id}`); this.getDiagnosisList(this.dataTransOpts.tableS.patient_register.id); } }, },};</script><style scoped>/* 输入框相关设置*/::v-deep .el-input__inner { padding-left: 2px; padding-right: 15px;}
::v-deep .el-input__icon { width: 15px; /* 输入框下拉箭头或清除图标 默认 25 */}
::v-deep .el-input-group__append { padding: 0 5px; /* 控件默认 0 20px;*/}
.box { display: flex;}
.query { margin-left: 5px; margin-bottom: 2px;}
.listBtn { margin-top: 10px;}</style>
|