<!-- 器官分配 -->
|
<template>
|
<div class="app-container">
|
<!-- 搜索条件 -->
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
:inline="true"
|
v-show="showSearch"
|
label-width="70px"
|
>
|
<el-row :gutter="8">
|
<el-col :span="6">
|
<el-form-item label="捐献进度" prop="recordstate">
|
<el-select
|
v-model="queryParams.workflow"
|
placeholder="请选择捐献进度"
|
clearable
|
size="small"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_donornode"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="6">
|
<el-form-item label="姓名" prop="name">
|
<el-input
|
v-model="queryParams.name"
|
placeholder="请输入姓名"
|
clearable
|
size="small"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="6">
|
<el-form-item
|
align="left"
|
label="医疗机构"
|
prop="treatmenthospitalno"
|
>
|
<org-selecter
|
ref="orgSelecter"
|
:org-type="'3'"
|
v-model="queryParams.treatmenthospitalno"
|
/>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="6">
|
<el-form-item label="捐献地市">
|
<el-select v-model="queryParams.city" placeholder="请选择地市">
|
<el-option
|
v-for="item in provinceData"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="8">
|
<el-col :span="6">
|
<el-form-item label="报告人">
|
<el-select
|
v-model="queryParams.reporterno"
|
placeholder="请选择报告人"
|
>
|
<el-option
|
v-for="item in reportlist"
|
:key="item.index"
|
:label="item.reportername"
|
:value="item.reporterno"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="12">
|
<el-form-item label="案例时间">
|
<el-date-picker
|
style="width: 100%"
|
v-model="selecttime"
|
type="monthrange"
|
range-separator="至"
|
start-placeholder="开始月份"
|
end-placeholder="结束月份"
|
value-format="yyyy-MM-dd"
|
@change="getTimeList"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="6">
|
<el-form-item>
|
<el-button
|
type="primary"
|
icon="el-icon-search"
|
size="mini"
|
@click="getBaseInfoList"
|
>搜索</el-button
|
>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
>重置</el-button
|
>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
|
<el-row :gutter="20">
|
<el-col :span="24">
|
<el-card shadow="never">
|
<!-- 捐献案例列表 -->
|
<el-table v-loading="loading" border :data="donationCaseTableData">
|
<el-table-column
|
label="案例时间"
|
align="center"
|
prop="donatetime"
|
width="150"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
parseTime(scope.row.donatetime, "{y}-{m}-{d}")
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="姓名"
|
align="center"
|
prop="name"
|
width="120"
|
/>
|
<el-table-column label="性别" align="center" prop="sex" width="100">
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_user_sex"
|
:value="parseInt(scope.row.sex)"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="年龄"
|
align="center"
|
prop="age"
|
width="100"
|
/>
|
<el-table-column
|
label="报告人"
|
align="center"
|
prop="reportername"
|
width="120"
|
/>
|
<el-table-column
|
label="案例归属"
|
align="center"
|
width="200px"
|
prop="deptname"
|
/>
|
<el-table-column
|
label="医疗机构"
|
align="center"
|
prop="treatmenthospitalname"
|
/>
|
<el-table-column
|
label="操作"
|
align="center"
|
class-name="small-padding fixed-width"
|
width="200"
|
fixed="right"
|
>
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="selectDonotor(scope.row)"
|
>捐献详情</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- hide-on-single-page -->
|
<pagination
|
v-show="total > 0"
|
small
|
layout="prev, pager, next"
|
:total="total"
|
:page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getBaseInfoList"
|
/>
|
</el-card>
|
</el-col>
|
<!-- <el-col :span="16">
|
<el-card shadow="never">
|
<el-form ref="infoForm" :model="organalForm" label-width="80px">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="捐献编号" prop="donorno">
|
<el-input v-model="curdonorno" disabled placeholder="请选择捐献案例" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="姓名" prop="donorname">
|
<el-input v-model="curdonorname" disabled placeholder="请选择捐献案例" />
|
</el-form-item> </el-col><el-col :span="6">
|
<el-form-item label="年龄" align="center" prop="age">
|
<el-input v-model="curage" disabled />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-form-item label="选择器官">
|
<el-checkbox-group v-model="organalForm.organname">
|
<el-checkbox v-for="dict in dict.type.sys_Organ" :key="dict.value" :label="dict.value"
|
@change="changeorganState(dict.value)">
|
{{ dict.label }}
|
</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
<el-form-item label="器官分配">
|
<el-table v-loading="loading" border :data="organalTableData">
|
<el-table-column label="器官名称" align="center" width="90" prop="organname" />
|
<el-table-column label="器官编号" align="center" width="80" prop="organno" />
|
<el-table-column label="分配状态" align="center" width="90" prop="organstate">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.sys_organstate" :value="scope.row.organstate" />
|
</template>
|
</el-table-column>
|
<el-table-column label="移植医院" align="center" prop="transplanthospitalname">
|
</el-table-column>
|
<el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width">
|
<template slot-scope="scope">
|
<el-button size="mini" v-if="scope.row.id == null" type="text" icon="el-icon-copy-document"
|
@click="distributionDialog(scope.row)">分配</el-button>
|
<el-button size="mini" v-else type="text" icon="el-icon-copy-document"
|
@click="distributionDialog(scope.row)">修改</el-button>
|
<el-button size="mini" v-if="scope.row.organstate != 99" type="text" icon="el-icon-copy-document"
|
@click="redistribution(scope.row)">重新分配</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-form-item>
|
</el-form>
|
</el-card>
|
</el-col> -->
|
</el-row>
|
|
<!-- 添加或修改器官分配对话框 -->
|
<el-dialog
|
:title="distributionFormTitle"
|
:visible.sync="showDistributionForm"
|
:close-on-click-modal="false"
|
width="1000px"
|
append-to-body
|
>
|
<el-form ref="form" :model="form" :rules="rules" label-width="160px">
|
<el-row>
|
<el-col :span="16">
|
<el-form-item label="捐献编号" prop="donorno">
|
<el-input
|
v-model="distributionForm.donorno"
|
placeholder="请输入捐献者编号"
|
disabled
|
/>
|
</el-form-item> </el-col
|
><el-col :span="8">
|
<el-form-item label="分配状态" prop="organstate">
|
<el-select v-model="form.organstate" placeholder="请选择器官状态">
|
<el-option
|
v-for="dict in dict.type.sys_organstate"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="8">
|
<el-form-item label="捐献姓名" prop="curdonorname">
|
<el-input
|
v-model="curdonorname"
|
placeholder="捐献者姓名"
|
disabled
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="器官名称" prop="organnumber">
|
<el-select
|
ref="organNameSelect"
|
v-model="form.organnumber"
|
placeholder="请选择器官编号"
|
clearable
|
size="small"
|
disabled
|
>
|
<el-option
|
v-for="dict in dict.type.sys_Organ"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item> </el-col
|
><el-col :span="8">
|
<el-form-item label="系统编号" prop="ageunit">
|
<el-input v-model="form.ageunit" placeholder="请输入系统编号" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row
|
><el-col :span="8">
|
<el-form-item label="接收时间" prop="applicanttime">
|
<el-date-picker
|
clearable
|
size="small"
|
style="width: 100%"
|
v-model="form.applicanttime"
|
type="datetime"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
placeholder="选择接收时间"
|
>
|
</el-date-picker>
|
</el-form-item> </el-col
|
><el-col :span="16">
|
<el-form-item label="移植医院" prop="treatmenthospitalno">
|
<org-selecter
|
ref="tranHosSelect"
|
:org-type="'4'"
|
v-model="form.transplanthospitalno"
|
style="width: 100%"
|
/>
|
</el-form-item> </el-col></el-row
|
><el-row>
|
<el-col :span="8">
|
<el-form-item label="受体姓氏" prop="name">
|
<el-input v-model="form.name" placeholder="姓氏" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="证件类型" prop="idcardtype">
|
<el-select
|
v-model="form.idcardtype"
|
placeholder="请选择移植人证件类型"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_IDType"
|
:key="dict.value"
|
:label="dict.label"
|
:value="parseInt(dict.value)"
|
></el-option>
|
</el-select>
|
</el-form-item> </el-col
|
><el-col :span="8">
|
<el-form-item label="证件号码" prop="idcardno">
|
<el-input
|
v-model="form.idcardno"
|
placeholder="请输入移植人证件号码"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="submitForm">保 存</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
//例如:import 《组件名称》 from '《组件路径》';
|
import {
|
listDonatebaseinfo
|
// exportProvincemessage,
|
} from "@/api/project/donatebaseinfo";
|
import OrgSelecter from "@/views/project/components/orgselect";
|
|
import {
|
listDonateorgan,
|
addDonateorgan,
|
delDonateorgan,
|
getDonateorgan,
|
updateDonateorgan
|
} from "@/api/project/donateorgan";
|
import {
|
listOrganallocation,
|
getOrganallocation,
|
addOrganallocation,
|
delOrganallocation,
|
updateOrganallocation
|
} from "@/api/project/organallocation";
|
import Li_area_select from "@/components/Address";
|
export default {
|
//import引入的组件需要注入到对象中才能使用
|
components: {
|
Li_area_select,
|
OrgSelecter
|
},
|
name: "Organallocation",
|
|
dicts: [
|
"sys_Organ",
|
"sys_organstate",
|
"sys_user_sex",
|
"sys_IDType",
|
"sys_AgeUnit",
|
"sys_donornode"
|
],
|
data() {
|
//这里存放数据
|
return {
|
// 遮罩层
|
loading: false,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
|
selecttime: "",
|
reportervalue: "",
|
reportlist: [],
|
provinceData: [
|
{ label: "全部", value: "" },
|
{ label: "杭州市", value: "1" },
|
{ label: "宁波市", value: "2" },
|
{ label: "温州市", value: "3" },
|
{ label: "嘉兴市", value: "4" },
|
{ label: "湖州市", value: "5" },
|
{ label: "绍兴市", value: "6" },
|
{ label: "金华市", value: "7" },
|
{ label: "衢州市", value: "8" },
|
{ label: "舟山市", value: "9" },
|
{ label: "台州市", value: "A" },
|
{ label: "丽水市", value: "B" }
|
],
|
searchAddress: {
|
sheng: "",
|
shi: "",
|
qu: "",
|
organizationname: null
|
},
|
|
//搜索参数
|
queryParams: {
|
pageNum: 1,
|
recordstate: "10",
|
donorno: "",
|
name: "",
|
pageSize: 10,
|
name: null,
|
donorno: null,
|
starttime: null,
|
endtime: null,
|
endReporttime: null,
|
reportervalue: null,
|
city: null
|
},
|
|
//当前选中捐献案例编号
|
curdonorno: "",
|
//当前捐献者id
|
curInfoid: "",
|
// 医疗结构
|
treatmenthospitalno: "",
|
//当前选中捐献案例姓名
|
curdonorname: "",
|
//当前选中捐献案例年龄
|
curage: "",
|
|
//捐献案例列表数据
|
tempRecordState: null,
|
donationCaseTableData: [],
|
//选择器官表单
|
organalForm: {
|
//器官列表
|
organname: []
|
},
|
//器官分配列表
|
organalTableData: [],
|
//
|
distributionFormTitle: "器官分配",
|
//
|
showDistributionForm: false,
|
|
defultAddress: {
|
sheng: "浙江省",
|
shi: "",
|
qu: ""
|
},
|
form: {},
|
rules: {
|
applicanttime: [
|
{ required: true, message: "请输入接收时间", trigger: "blur" }
|
]
|
},
|
// 遮罩层
|
loading: true,
|
title: "",
|
selectedRow: null
|
};
|
},
|
//监听属性 类似于data概念
|
computed: {},
|
//监控data中的数据变化
|
watch: {},
|
activated() {
|
this.selecttime = "";
|
this.reportervalue = "";
|
this.reportlist = [];
|
this.queryParams.donorno = "";
|
this.queryParams.recordstate = "";
|
this.queryParams.name = "";
|
this.queryParams.treatmenthospitalno = "";
|
if (this.$route.params.starttime != null && this.$route.params.endtime) {
|
this.selecttime = [
|
this.$moment(this.$route.params.starttime).format("YYYY-MM-DD"),
|
this.$moment(this.$route.params.endtime).format("YYYY-MM-DD")
|
];
|
}
|
if (this.$route.params.reporterno != "") {
|
this.reporterno = this.$route.params.reporterno;
|
}
|
if (this.$route.params.tempRecordState != "") {
|
this.queryParams.recordstate = this.$route.params.tempRecordState;
|
}
|
if (this.$route.params.reporterno != "") {
|
this.reportervalue = this.$route.params.reporterno;
|
}
|
if (!this.$route.params.shen != "") {
|
this.searchAddress.sheng = this.$route.params.shen;
|
if (!this.$route.params.shi != "") {
|
this.searchAddress.shi = this.$route.params.shi;
|
}
|
if (!this.$route.params.qu) {
|
this.searchAddress.qu = this.$route.params.qu;
|
}
|
}
|
if (this.$route.params.city != "") {
|
this.queryParams.city = this.$route.params.city;
|
}
|
this.getTimeList();
|
this.getBaseInfoList();
|
},
|
mounted() {
|
this.LoadReportList();
|
this.tempRecordState = this.$route.params.tempRecordState;
|
console.log("传来的值", this.tempRecordState);
|
},
|
//方法集合
|
methods: {
|
LoadReportList() {
|
listDonatebaseinfo().then(res => {
|
console.log("潜在捐献表", res);
|
let list = res.rows;
|
let reportlist = [];
|
list.forEach(element => {
|
reportlist.push({
|
reporterno: element.reporterno,
|
reportername: element.reportername
|
});
|
});
|
console.log("dwada", reportlist);
|
if (reportlist != 0) {
|
reportlist = this.resetArr(reportlist);
|
this.reportlist = reportlist;
|
}
|
});
|
},
|
resetArr(Arr) {
|
var hash = {};
|
Arr = Arr.reduce(function(arr, current) {
|
hash[current.reporterno]
|
? ""
|
: (hash[current.reporterno] = true && arr.push(current));
|
return arr;
|
}, []);
|
return Arr;
|
},
|
getTimeList(e) {
|
if (this.selecttime != 0) {
|
this.endtime = this.selecttime[1];
|
this.starttime = this.selecttime[0];
|
// if (this.endtime == this.starttime) {
|
let num = Number(this.endtime.slice(5, 7));
|
if (num < 9) {
|
let mon = Number(this.endtime.slice(6, 7));
|
this.endtime =
|
this.endtime.slice(0, 5) +
|
"0" +
|
(mon + 1) +
|
"-" +
|
"01" +
|
" " +
|
"00" +
|
":" +
|
"00" +
|
":" +
|
"00";
|
}
|
// this.endtime=this.endtime.slice(0,5)年
|
else if (num >= 10) {
|
this.endtime =
|
this.endtime.slice(0, 5) +
|
(num + 1) +
|
"-" +
|
"01" +
|
" " +
|
"00" +
|
":" +
|
"00" +
|
":" +
|
"00";
|
} else {
|
this.endtime =
|
this.endtime.slice(0, 5) +
|
"10" +
|
"-" +
|
"01" +
|
" " +
|
"00" +
|
":" +
|
"00" +
|
":" +
|
"00";
|
console.log("1212121", this.endtime);
|
}
|
this.starttime = this.starttime + " " + "00" + ":" + "00" + ":" + "00";
|
//}
|
} else {
|
this.starttime = "1998-01-01 00:00:00";
|
this.endtime = "2998-01-01 00:00:00";
|
}
|
},
|
|
//重新分配
|
redistribution(data) {
|
console.log("重新分配", data);
|
//弹窗
|
this.showDistributionForm = true;
|
this.reset();
|
|
getDonateorgan(data.id).then(res => {
|
let obj = res.data;
|
obj.organstate = 99;
|
updateDonateorgan(obj).then(res => {
|
// if(res.code === 200){
|
this.form.organstate = data.organstate;
|
this.form.organno = data.organno;
|
this.form.organnumber = data.organno;
|
|
let loactionSearcParam = {
|
organid: data.id
|
};
|
|
listOrganallocation(loactionSearcParam).then(res => {
|
if (res.rows != 0) {
|
let list = res.rows[0];
|
// this.form.ageunit = list.ageunit;
|
this.form.applicanttime = list.applicanttime;
|
// this.form.treatmenthospitalno = list.treatmenthospitalno;
|
// this.form.transplanthospitalname = list.transplanthospitalname
|
}
|
});
|
console.log("Organallocation", this.form);
|
});
|
});
|
},
|
|
/** 查询捐献基础列表 */
|
getBaseInfoList(e) {
|
this.loading = true;
|
sessionStorage.removeItem("organallocation");
|
sessionStorage.setItem(
|
"organallocation",
|
JSON.stringify(this.queryParams)
|
);
|
if (this.queryParams.recordstate == "") {
|
this.queryParams.recordstate = null;
|
}
|
if (e != null && e != undefined && !isNaN(e)) {
|
this.queryParams.recordstate = e;
|
}
|
|
this.queryParams.reportervalue = this.reportervalue;
|
console.log(JSON.stringify(this.queryParams));
|
// this.queryParams.city='001'
|
//console.log(JSON.stringify(this.queryParams));
|
if (this.starttime != "") {
|
this.queryParams.starttime = this.starttime;
|
}
|
if (this.endtime != "") {
|
this.queryParams.endtime = this.endtime;
|
}
|
|
this.$nextTick(() => {
|
// this.queryParams.residenceprovince = this.$refs.areaSelect.getSheng();
|
// this.queryParams.residencecity = this.$refs.areaSelect.getShi();
|
// this.queryParams.residencetown = this.$refs.areaSelect.getQu();
|
listDonatebaseinfo(this.queryParams).then(response => {
|
this.donationCaseTableData = response.rows;
|
console.log(this.donationCaseTableData, "Donation");
|
this.total = response.total;
|
this.loading = false;
|
});
|
});
|
},
|
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.reportervalue = "";
|
|
this.queryParams = {
|
doname: null,
|
pageNum: 1,
|
pageSize: 10,
|
name: null,
|
idcardno: null,
|
residenceprovince: null,
|
residencecity: null,
|
residencetown: null,
|
// "2"
|
recordstate: null,
|
treatmenthospitalname: null,
|
donorno: null,
|
acquisitiontissueno: null,
|
reportername: null,
|
reporttime: null,
|
city: null,
|
treatmenthospitalno: null
|
};
|
this.selecttime = [];
|
this.getTimeList();
|
this.searchAddress = {
|
sheng: "",
|
shi: "",
|
qu: "",
|
organizationname: null
|
};
|
//this.$refs.areaSelect.clean();
|
|
this.getBaseInfoList();
|
},
|
|
//监听器官多选框事件
|
changeSelectOrgan() {
|
this.organalTableData = [];
|
for (let i = 0; i < this.dict.type.sys_Organ.length; i++) {
|
for (let k = 0; k < this.organalForm.organname.length; k++) {
|
if (
|
this.organalForm.organname[k] == this.dict.type.sys_Organ[i].value
|
) {
|
this.organalTableData.push({
|
organname: this.dict.type.sys_Organ[i].label,
|
organno: this.dict.type.sys_Organ[i].value,
|
id: null
|
});
|
}
|
}
|
}
|
},
|
//修改和分配
|
distributionDialog(data) {
|
console.log("修改和分配数据", data);
|
this.reset();
|
this.form = data;
|
if (
|
this.curdonorname == "" ||
|
this.curdonorno == "" ||
|
this.infoid == ""
|
) {
|
this.$modal.msgWarning("请先选择一个捐献案例,再进行录入器官分配!");
|
return;
|
}
|
if (data.id != null) {
|
//搜索器官分配记录
|
let loactionSearcParam = {
|
organid: data.id
|
};
|
this.showDistributionForm = true;
|
listOrganallocation(loactionSearcParam).then(response => {
|
if (response.rows.length == 1) {
|
let resData = response.rows[0];
|
resData.organstate = data.organstate;
|
resData.transplanthospitalno = data.transplanthospitalno;
|
this.form = { ...resData };
|
// this.form.organnumber = data.organno;
|
|
this.showDistributionForm = true;
|
this.$forceUpdate();
|
}
|
});
|
} else {
|
this.form.organnumber = data.organno;
|
// this.distributionForm.organname = data.organname;
|
// this.distributionForm.organno = data.organno;
|
this.showDistributionForm = true;
|
}
|
},
|
// 取消按钮
|
cancel() {
|
this.showDistributionForm = false;
|
},
|
//点击捐献案例列表触发方法
|
selectDonotor(row, column, event) {
|
this.$router.push({
|
path: "/organ/donationdetails/",
|
query: {
|
id: row.id,
|
organType: "edit"
|
}
|
});
|
// this.selectedRow = row;
|
// this.curdonorno = row.donorno;
|
// this.curdonorname = row.name;
|
// this.curage = row.age;
|
// this.curInfoid = row.id;
|
// this.distributionForm.donorno = row.donorno;
|
// this.GetDonortedList();
|
},
|
//获取病人已捐献的器官列表
|
GetDonortedList() {
|
this.loading = true;
|
let oraganqueryParam = {
|
infoid: this.curInfoid
|
};
|
// donorno: this.curdonorno,
|
listDonateorgan(oraganqueryParam).then(response => {
|
this.loading = false;
|
if (response.code == 200) {
|
this.organalTableData = [];
|
this.organalForm.organname = [];
|
for (let i = 0; i < response.rows.length; i++) {
|
this.organalForm.organname.push(response.rows[i].organno);
|
this.organalTableData.push({
|
id: response.rows[i].id,
|
organno: response.rows[i].organno,
|
organname: response.rows[i].organname,
|
transplanthospitalno: response.rows[i].transplanthospitalno,
|
transplanthospitalname: response.rows[i].transplanthospitalname,
|
organstate: response.rows[i].organstate
|
});
|
}
|
} else {
|
this.$modal.msgError("获取捐献器官失败:" + response.msg);
|
}
|
});
|
},
|
//提交表单
|
|
/** 提交按钮 */
|
submitForm() {
|
this.$refs["form"].validate(valid => {
|
if (valid) {
|
if (this.form.id != null) {
|
//更新捐献器官表
|
this.form.allocationstatus = this.form.organstate;
|
updateOrganallocation(this.form).then(response => {});
|
//获取器官信息
|
getDonateorgan(this.form.organid).then(response2 => {
|
let organData = response2.data;
|
(organData.organname = this.$refs.organNameSelect.selectedLabel),
|
(organData.organstate = this.form.allocationstatus);
|
organData.transplantdoct = this.form.transplantdoct;
|
|
organData.transplanthospitalno = this.form.transplanthospitalno;
|
try {
|
organData.transplanthospitalname = this.$refs.tranHosSelect.getOptionByValue(
|
organData.transplanthospitalno
|
).organizationname;
|
} catch {
|
organData.transplanthospitalname =
|
organData.transplanthospitalno;
|
}
|
//更新捐献器官表
|
updateDonateorgan(organData).then(response3 => {
|
this.$modal.msgSuccess("修改器官信息成功");
|
this.GetDonortedList();
|
this.showDistributionForm = false;
|
});
|
});
|
} else {
|
//保存时先保存到捐献器官表
|
//新增到器官管理表
|
this.loading = false;
|
let organaManageForm = {
|
donorno: this.curdonorno,
|
donorname: this.curdonorname,
|
organname: this.$refs.organNameSelect.selectedLabel,
|
organno: this.form.organnumber,
|
infoid: this.curInfoid,
|
organstate: this.form.organstate,
|
transplanthospitalno: this.form.transplanthospitalno,
|
transplanthospitalname: null,
|
transplantdoct: this.form.transplantdoct
|
};
|
try {
|
organaManageForm.transplanthospitalname = this.$refs.tranHosSelect.getOptionByValue(
|
organaManageForm.transplanthospitalno
|
).organizationname;
|
} catch {
|
organaManageForm.transplanthospitalname =
|
organaManageForm.transplanthospitalno;
|
}
|
|
addDonateorgan(organaManageForm).then(response => {
|
this.loading = false;
|
if (response.code === 200) {
|
//查询获取新增的器官表id
|
let organSearchParam = {
|
infoid: this.curInfoid,
|
// donorno: this.curdonorno,
|
organno: this.form.organnumber
|
//donorname: this.curdonorname,
|
//organname: this.$refs.organNameSelect.label,
|
};
|
|
listDonateorgan(organSearchParam).then(response2 => {
|
if (response2.code == 200 && response2.rows.length > 0) {
|
for (let i = 0; i < response2.rows.length; i++) {
|
if (response2.rows[i].organstate == "2") {
|
this.form.organid = response2.rows[i].id;
|
// this.form.residenceprovincename = this.defultAddress.sheng;
|
// this.form.residencecityname = this.defultAddress.shi;
|
// this.form.residencetownname = this.defultAddress.qu;
|
|
addOrganallocation(this.form).then(response => {
|
this.$modal.msgSuccess("捐献器官分配信息保存成功!");
|
});
|
}
|
}
|
}
|
this.GetDonortedList();
|
this.showDistributionForm = false;
|
});
|
}
|
});
|
}
|
}
|
});
|
},
|
|
//重置表单
|
resetForm() {
|
this.distributionForm = {
|
id: null,
|
organid: null,
|
organnumber: null,
|
applicantuserid: null,
|
applicantusername: null,
|
applicanttime: null,
|
checkuserid: null,
|
checkusername: null,
|
checktime: null,
|
checksuggestion: null,
|
allocationstatus: null,
|
name: null,
|
sex: null,
|
idcardtype: null,
|
idcardno: null,
|
age: null,
|
ageunit: null,
|
birthday: null,
|
phone: null,
|
residenceaddress: null,
|
residenceprovince: null,
|
residenceprovincename: null,
|
residencecity: null,
|
residencecityname: null,
|
residencetown: null,
|
residencetownname: null,
|
residencecommunity: null,
|
residencecommunityname: null,
|
residencecountycode: null,
|
residencecountyname: null,
|
delFlag: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
//移植医院
|
transplanthospitalno: null,
|
transplanthospitalname: null
|
};
|
this.distributionForm.donorno = this.curdonorno;
|
},
|
reset() {
|
this.form = {
|
id: null,
|
organid: null,
|
organnumber: null,
|
applicantuserid: null,
|
applicantusername: null,
|
applicanttime: null,
|
checkuserid: null,
|
checkusername: null,
|
checktime: null,
|
checksuggestion: null,
|
allocationstatus: 2,
|
name: null,
|
sex: null,
|
idcardtype: null,
|
idcardno: null,
|
age: null,
|
ageunit: null,
|
birthday: null,
|
phone: null,
|
residenceaddress: null,
|
residenceprovince: null,
|
residenceprovincename: null,
|
residencecity: null,
|
residencecityname: null,
|
residencetown: null,
|
residencetownname: null,
|
residencecommunity: null,
|
residencecommunityname: null,
|
residencecountycode: null,
|
residencecountyname: null,
|
delFlag: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
transplanthospitalno: null,
|
organstate: null
|
};
|
this.resetForm("form");
|
},
|
//修改器官捐献记录
|
changeorganState(value) {
|
//organalTableData
|
let organIndex = this.organalTableData.findIndex(
|
item => item.organno == value
|
);
|
//判断当前选中值是否在数组中
|
if (organIndex == -1) {
|
//获取器官名称
|
let temporganname = "";
|
for (let i = 0; i < this.dict.type.sys_Organ.length; i++) {
|
if (value == this.dict.type.sys_Organ[i].value) {
|
temporganname = this.dict.type.sys_Organ[i].label;
|
break;
|
}
|
}
|
if (temporganname != "") {
|
this.organalTableData.push({
|
organname: temporganname,
|
organno: value,
|
id: null,
|
transplanthospitalname: null,
|
transplanthospitalno: null,
|
organstate: "2"
|
});
|
}
|
} else {
|
this.$confirm("是否确认删除器官分配记录", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
if (organIndex != -1) {
|
let tempOrgan = this.organalTableData[organIndex];
|
if (tempOrgan.organstate != 1 && tempOrgan.id > 0) {
|
this.$modal.msgWarning("只有未分配器官可进行删除!");
|
this.organalForm.organname.push(value);
|
return;
|
}
|
if (tempOrgan.id > 0) {
|
//查找器官表记录,判断器官状态
|
this.loading = true;
|
delDonateorgan(tempOrgan.id).then(delLocationRes => {
|
//调用删除器官记录api
|
// delDonateorgan(searchedOrganData.id).then(
|
// (delOrganRes) => {
|
// }
|
// );
|
this.loading = false;
|
this.$modal.msgSuccess("删除成功");
|
this.selectDonotor(this.selectedRow);
|
});
|
} else {
|
this.organalTableData.splice(deleteIndex, 1);
|
this.selectDonotor(this.selectedRow);
|
}
|
}
|
})
|
.catch(() => {
|
this.selectDonotor(this.selectedRow);
|
});
|
}
|
}
|
},
|
//生命周期 - 创建完成(可以访问当前this实例)
|
created() {
|
if (sessionStorage.getItem("organallocation")) {
|
this.queryParams = JSON.parse(sessionStorage.getItem("organallocation"));
|
console.log(this.queryParams, "queryParams");
|
}
|
this.getBaseInfoList();
|
this.resetForm();
|
}
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
// mounted() {},
|
// beforeCreate() {}, //生命周期 - 创建之前
|
// beforeMount() {}, //生命周期 - 挂载之前
|
// beforeUpdate() {}, //生命周期 - 更新之前
|
// updated() {}, //生命周期 - 更新之后
|
// beforeDestroy() {}, //生命周期 - 销毁之前
|
// destroyed() {}, //生命周期 - 销毁完成
|
// activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
};
|
</script>
|
<style lang="scss" scoped>
|
//@import url(); 引入公共css类
|
</style>
|