<template>
|
<div>
|
<el-dialog
|
title="适用疾病选择"
|
:visible.sync="dialogVisiblepatient"
|
width="70%"
|
:before-close="handleClosehz"
|
>
|
<div class="examine-jic">
|
<div style="margin: 0 10px 20px 10px">
|
<el-card class="box-card">
|
<el-tag
|
v-for="item in overallCase"
|
:key="item.icdid"
|
type="warning"
|
closable
|
@close="handleClose(item)"
|
>
|
{{ item.icdname }}
|
</el-tag>
|
<div style="margin-top: 20px; text-align: right">
|
共选择<span
|
style="font-size: 18px; color: #409eff; margin: 0 10px"
|
>{{ overallCase.length }}</span
|
>条数据
|
</div>
|
</el-card>
|
</div>
|
<div class="jic-value">
|
<el-row :gutter="20">
|
<!--用户数据-->
|
<el-form
|
:model="patientqueryParams"
|
ref="queryForm"
|
size="small"
|
:inline="true"
|
label-width="98px"
|
>
|
<el-form-item label="疾病名称" prop="name">
|
<el-input
|
v-model="patientqueryParams.icdname"
|
placeholder="请输入疾病名称"
|
@keyup.enter.native="handleAddpatient"
|
/>
|
</el-form-item>
|
|
<el-form-item>
|
<el-button
|
type="primary"
|
icon="el-icon-search"
|
size="medium"
|
@click="handleAddpatient"
|
>搜索</el-button
|
>
|
<el-button
|
icon="el-icon-refresh"
|
size="medium"
|
@click="resetQuery"
|
>重置</el-button
|
>
|
</el-form-item>
|
</el-form>
|
<!-- 选择器官列表 -->
|
<el-table
|
ref="multipleTable"
|
:data="donorchargeList"
|
tooltip-effect="dark"
|
style="width: 100%"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column class="checkall" type="selection" width="55">
|
</el-table-column>
|
<el-table-column
|
prop="icdid"
|
label="疾病编号"
|
width="100"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column label="疾病名称" show-overflow-tooltip>
|
<template slot-scope="scope">{{ scope.row.icdname }}</template>
|
</el-table-column>
|
|
<el-table-column prop="icdcode" label="疾病编码" width="150">
|
</el-table-column>
|
</el-table>
|
</el-row>
|
<pagination
|
v-show="patienttotal > 0"
|
:total="patienttotal"
|
:page.sync="patientqueryParams.pageNum"
|
:limit.sync="patientqueryParams.pageSize"
|
@pagination="handleAddpatient"
|
/>
|
</div>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="$emit('addoption')">取 消</el-button>
|
<el-button type="primary" @click="AddDispatchpatients"
|
>确定添加</el-button
|
>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { getillnesslist, deltargetillness } from "@/api/AiCentre/index";
|
export default {
|
name: "Diseasetotality",
|
data() {
|
return {
|
patienttotal: 0, //
|
// 当前页选中数据
|
multipleSelection: [],
|
// 总选中数据
|
// overallCase: [],
|
patientqueryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
},
|
donorchargeList: [],
|
donorchargeanlList: [], //案例列表
|
};
|
},
|
|
props: {
|
dialogVisiblepatient: {
|
type: Boolean,
|
default: () => {
|
return false;
|
},
|
},
|
overallCase: {
|
type: Array,
|
required: true,
|
default: () => [],
|
},
|
// 5问卷模板、3随访模板、6宣教
|
type: {
|
type: Number,
|
default: () => {
|
return 5;
|
},
|
},
|
},
|
|
created() {},
|
|
mounted() {
|
// this.handleAddpatient();
|
},
|
|
watch: {},
|
|
methods: {
|
handleClosehz() {
|
this.$emit("addoption");
|
},
|
// 选择数据标签删除事件
|
handleClose(item) {
|
console.log(item);
|
if (this.multipleSelection.indexOf(item) == -1 && !item.outid) {
|
console.log(1);
|
this.overallCase.splice(this.overallCase.indexOf(item), 1);
|
} else if (item.outid) {
|
this.$modal
|
.confirm('是否确认删除名称为"' + item.icd10name + '"的数据项?')
|
.then(() => {
|
this.multipleSelection.splice(
|
this.multipleSelection.indexOf(item),
|
1
|
);
|
deltargetillness(item.id).then((res) => {
|
if (res.code == 200) {
|
this.$modal.msgSuccess("删除成功");
|
this.overallCase.splice(this.overallCase.indexOf(item), 1);
|
}
|
});
|
// 取消挂载状态
|
this.$refs.multipleTable.toggleRowSelection(item, false);
|
})
|
.catch(() => {});
|
} else {
|
this.overallCase.splice(this.overallCase.indexOf(item), 1);
|
this.multipleSelection.splice(this.multipleSelection.indexOf(item), 1);
|
// 取消挂载状态
|
this.$refs.multipleTable.toggleRowSelection(item, false);
|
}
|
},
|
resetQuery() {
|
this.patientqueryParams.icdname = null;
|
this.handleAddpatient();
|
},
|
// 触发查询事件
|
handleAddpatient(row) {
|
this.$emit("kkoption");
|
|
getillnesslist(this.patientqueryParams).then((res) => {
|
this.donorchargeList = res.rows;
|
this.patienttotal = res.total;
|
this.Restorecheck();
|
});
|
},
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
if (this.decision) return;
|
// 判断是否有删除
|
if (this.multipleSelection.length <= selection.length) {
|
this.multipleSelection = selection;
|
} else {
|
this.multipleSelection.forEach((item) => {
|
if (selection.includes(item)) {
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.multipleSelection = [];
|
} else {
|
this.multipleSelection.splice(
|
this.multipleSelection.indexOf(item),
|
1
|
);
|
}
|
if (this.overallCase.length == 1) {
|
this.overallCase = [];
|
} else {
|
this.overallCase.splice(this.overallCase.indexOf(item), 1);
|
}
|
}
|
});
|
}
|
// 赋值给整体选中数组
|
this.multipleSelection.forEach((item) => {
|
|
if (this.overallCase.every((obj) => obj.icdname != item.icdname)) {
|
this.overallCase.push(item);
|
}
|
});
|
console.log(this.multipleSelection, "触发选择后multipleSelection");
|
},
|
// 切换页后恢复选中
|
Restorecheck() {
|
console.log(this.overallCase, "this.overallCase");
|
const allid = this.overallCase.map((item) => item.icdname);
|
const overlap = this.donorchargeList.filter((value) => {
|
return allid.includes(value.icdname);
|
});
|
// 保持ids和当前页面的同步性
|
this.multipleSelection = overlap;
|
console.log(this.multipleSelection, "进入分页multipleSelection");
|
|
this.toggleSelection(overlap);
|
},
|
// 挂载选择状态
|
toggleSelection(rows) {
|
if (rows) {
|
this.decision = true;
|
this.$nextTick(() => {
|
rows.forEach((row) => {
|
this.$refs.multipleTable.toggleRowSelection(row, true);
|
});
|
this.decision = false;
|
});
|
console.log(123);
|
} else {
|
this.$refs.multipleTable.clearSelection();
|
}
|
},
|
AddDispatchpatients() {
|
this.$emit("addoption");
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.examine-jic {
|
.headline {
|
font-size: 24px;
|
border-left: 5px solid #41a1be;
|
padding-left: 5px;
|
margin-bottom: 10px;
|
display: flex;
|
justify-content: space-between;
|
.Add-details {
|
font-size: 18px;
|
color: #02a7f0;
|
cursor: pointer;
|
}
|
}
|
.jic-value {
|
font-size: 20px;
|
border-top: 1px solid #a7abac;
|
padding: 10px;
|
margin-bottom: 10px;
|
.details-jic {
|
padding: 10px 15px;
|
border: 1px solid #dcdfe6;
|
-webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
|
0 0 6px 0 rgba(0, 0, 0, 0.04);
|
.details-title {
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 10px;
|
div:nth-child(2) {
|
color: #02a7f0;
|
cursor: pointer;
|
}
|
}
|
.details-renw {
|
background: #e4ebfc;
|
padding: 15px 5px;
|
border-radius: 5px;
|
margin-bottom: 20px;
|
}
|
}
|
}
|
}
|
::v-deep.el-table .el-table__header th:first-child .el-checkbox {
|
display: none;
|
}
|
.el-tag + .el-tag {
|
margin-left: 10px;
|
margin-bottom: 10px;
|
}
|
</style>
|