<template>
|
<div class="app-container">
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
size="small"
|
:inline="true"
|
v-show="showSearch"
|
label-width="68px"
|
>
|
<el-form-item label="体检号" prop="tjNum">
|
<el-input
|
ref="inputName"
|
v-model="queryParams.tjNum"
|
placeholder="请输入体检号"
|
clearable
|
@keyup.enter.native="handleQuery"
|
@blur="hb"
|
style="width: 170px"
|
/>
|
</el-form-item>
|
<el-form-item label="姓名" prop="name">
|
<el-input
|
v-model="queryParams.name"
|
placeholder="请输入姓名"
|
clearable
|
@keyup.enter.native="handleQuery"
|
style="width: 110px"
|
/>
|
</el-form-item>
|
<el-form-item label="申请时间" prop="applicationTime">
|
<el-date-picker
|
v-model="createTimeList"
|
@change="dateChangebirthday1"
|
:default-time="['00:00:00', '23:00:00']"
|
format="yyyy-MM-dd HH:mm:ss"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
type="daterange"
|
range-separator="-"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
:picker-options="pickerOptions"
|
></el-date-picker>
|
</el-form-item>
|
<!-- <el-form-item label="是否采样" prop="isSignFor">
|
<el-select style="width:100px" v-model="queryParams.isSignFor" placeholder="是否采样">
|
<el-option v-for="dict in dict.type.sampling_type" :key="dict.value" :label="dict.label"
|
:value="dict.value"></el-option>
|
</el-select>
|
</el-form-item> -->
|
<!-- <el-form-item label="体检时间" prop="tjTime">
|
<el-date-picker clearable v-model="queryParams.tjTime" type="date" value-format="yyyy-MM-dd"
|
placeholder="请选择体检时间" style="width: 140px;">
|
</el-date-picker>
|
</el-form-item> -->
|
<!-- <el-form-item label="项目id父项" prop="proId">
|
<el-input v-model="queryParams.proId" placeholder="请输入项目id父项" clearable @keyup.enter.native="handleQuery" />
|
</el-form-item> -->
|
<!-- <el-form-item label="项目名称" prop="proName">
|
<el-input v-model="queryParams.proName" placeholder="请输入项目名称" clearable @keyup.enter.native="handleQuery" style="width: 140px;"/>
|
</el-form-item> -->
|
<el-form-item>
|
<el-button
|
type="primary"
|
icon="el-icon-search"
|
size="mini"
|
@click="handleQuery"
|
>查询</el-button
|
>
|
<el-button
|
type="primary"
|
icon="el-icon-thumb"
|
size="mini" style="margin:0 15px;"
|
@click="Confirmreceipt"
|
>确认采样</el-button
|
>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
>重置</el-button
|
>
|
</el-form-item>
|
</el-form>
|
<el-row :gutter="10" class="mb8">
|
<el-col :span="10">
|
<el-radio-group
|
v-model="tjStatus"
|
@input="radioChange"
|
style="margin: 10px 15px"
|
>
|
<el-radio-button label="1">未采样</el-radio-button>
|
<el-radio-button label="0">已采样</el-radio-button>
|
</el-radio-group>
|
</el-col>
|
<el-col :span="12" v-if="tableList.length > 1 && tjStatus == 0">
|
<el-button type="primary" plain v-hasPermi="['hosp:detail:add']"
|
>合并样本</el-button
|
>
|
</el-col>
|
</el-row>
|
|
<div style="width: 100%; margin-left: 10px; display: flex">
|
<div style="width: 40%; margin-right: 20px">
|
<el-table
|
id="ta"
|
v-loading="loading"
|
ref="tb"
|
:data="samplingList"
|
@selection-change="handleSelectionChange"
|
border
|
height="520px"
|
:row-class-name="tableRowClassName"
|
>
|
<el-table-column type="selection" width="40" align="center" />
|
<el-table-column
|
label="体检号"
|
align="center"
|
prop="customer.tjNumber"
|
width="160px"
|
/>
|
<el-table-column
|
label="姓名"
|
align="center"
|
prop="customer.cusName"
|
width="80px"
|
/>
|
<el-table-column
|
label="性别"
|
align="center"
|
prop="customer.cusSex"
|
width="60px"
|
>
|
<!-- <template slot-scope="scope">
|
{{ scope.row.customer.cusSex === 0 ? "男" : "女" }}
|
</template> -->
|
<template slot-scope="scope">
|
<span v-if="scope.row.cusSex == '0'">男</span>
|
<span v-if="scope.row.cusSex == '1'">女</span>
|
<span v-if="scope.row.cusSex == '2'">未知</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="手机号"
|
align="center"
|
prop="customer.cusPhone"
|
width="120px"
|
/>
|
<el-table-column
|
label="申请时间"
|
align="center"
|
prop="customer.applicationTime"
|
width="210"
|
>
|
<template slot-scope="scope">
|
<span>{{ parseTime(scope.row.customer.applicationTime) }}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div style="width: 50%">
|
<el-table
|
v-loading="loading"
|
:data="tableList"
|
:span-method="objectSpanMethod"
|
@selection-change="handleChange"
|
border
|
height="520px"
|
ref="tab1"
|
:row-class-name="tableRowClassName"
|
>
|
<el-table-column type="selection" width="40" align="center" />
|
<!-- :selectable="selectEnable" -->
|
<!-- <el-table-column label="是否签收" align="center" prop="isSignFor" /> -->
|
<!-- <el-table-column label="体检时间" align="center" prop="tjTime" width="180">
|
<template slot-scope="scope">
|
<span>{{ parseTime(scope.row.tjTime, '{y}-{m}-{d}') }}</span>
|
</template>
|
</el-table-column> -->
|
<el-table-column
|
label="标本类型"
|
align="center"
|
prop="specimenType"
|
width="120"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_dict_specimen"
|
:value="scope.row.specimenType"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column label="项目名称" align="center" prop="proName" />
|
<el-table-column
|
label="性别"
|
align="center"
|
prop="proSex"
|
width="90"
|
/>
|
<el-table-column
|
label="空腹"
|
align="center"
|
prop="proCheckMethod"
|
width="90"
|
/>
|
<el-table-column
|
label="采样编号"
|
align="center"
|
prop="samplingNumber"
|
:show-overflow-tooltip="true"
|
width="120"
|
/>
|
<el-table-column
|
label="采样状态"
|
align="center"
|
prop="isSignFor"
|
width="90"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sampling_type"
|
:value="scope.row.isSignFor"
|
/>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<template slot-scope="scope">
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
v-hasPermi="['sampling:sampling:edit']">修改
|
</el-button>
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
v-hasPermi="['sampling:sampling:remove']">删除
|
</el-button>
|
</template>
|
</el-table-column> -->
|
</el-table>
|
</div>
|
</div>
|
<!--
|
<div style="margin-right: 70%;">
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
</div> -->
|
|
<div style="margin-right: 70%">
|
<!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :pager-count="5" :current-page.sync="currentPage1" :current-page="page"
|
:page-sizes="pageSize" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
</el-pagination> -->
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
:page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
</div>
|
|
<!-- 添加或修改体检采样管理对话框 -->
|
<!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form-item label="申请时间" prop="applicationTime">
|
<el-date-picker clearable v-model="form.applicationTime" type="date" value-format="yyyy-MM-dd"
|
placeholder="请选择申请时间">
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item label="项目id父项" prop="proId">
|
<el-input v-model="form.proId" placeholder="请输入项目id父项" />
|
</el-form-item>
|
<el-form-item label="项目名称" prop="proName">
|
<el-input v-model="form.proName" placeholder="请输入项目名称" />
|
</el-form-item>
|
</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>
|
import {
|
listSampling,
|
getSampling,
|
getList,
|
delSampling,
|
addSampling,
|
updateSampling,
|
confirmSampling,
|
} from "@/api/sampling/sampling";
|
import { getNewDateList } from "@/api/hosp/order";
|
import moment from "moment";
|
|
export default {
|
dicts: [
|
"sys_user_sex",
|
"sampling_type",
|
"sys_dict_specimen",
|
"dict_user_marry",
|
"dict_user_national",
|
],
|
name: "Sampling",
|
data() {
|
return {
|
list: [],
|
selectList: "",
|
createTimeList: [],
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 绑定单选按钮
|
tjStatus: "1",
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
page: 1,
|
size: 2,
|
currentPage1: 3,
|
pageSize: [2, 4, 6, 8, 10],
|
// 体检采样管理表格数据
|
samplingList: [],
|
tableList: [],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 20,
|
name: null,
|
tjNum: null,
|
applicationTime: null,
|
isSignFor: null,
|
tjTime: null,
|
specimenType: null,
|
proId: null,
|
proName: null,
|
},
|
startTime: "",
|
pickerOptions: {
|
shortcuts: [
|
{
|
text: "最近一周",
|
onClick(picker) {
|
const end = new Date();
|
const start = new Date();
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
picker.$emit("pick", [start, end]);
|
},
|
},
|
{
|
text: "最近一个月",
|
onClick(picker) {
|
const end = new Date();
|
const start = new Date();
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
picker.$emit("pick", [start, end]);
|
},
|
},
|
{
|
text: "最近三个月",
|
onClick(picker) {
|
const end = new Date();
|
const start = new Date();
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
picker.$emit("pick", [start, end]);
|
},
|
},
|
],
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {},
|
};
|
},
|
created() {
|
// this.getNowTime();
|
|
this.getdate();
|
},
|
mounted() {
|
this.$nextTick(() => {
|
this.$refs.inputName.focus();
|
});
|
},
|
methods: {
|
getdate() {
|
getNewDateList().then((res) => {
|
this.createTimeList = [
|
moment(res.data).format("YYYY-MM-DD 00:00:00"),
|
moment(res.data).format("YYYY-MM-DD 23:59:00"),
|
];
|
this.getList();
|
});
|
},
|
handleSizeChange(val) {
|
this.size = val;
|
this.page = 1;
|
this.getList();
|
},
|
handleCurrentChange(val) {
|
this.page = val;
|
this.getList();
|
},
|
// / 处理默认选中当前日期
|
getNowTime() {
|
var curDate = new Date().getTime();
|
var dayNum = 7 * 24 * 3600 * 1000;
|
var threeDays = curDate - dayNum;
|
var sDay = this.getLocalTime(threeDays);
|
var end = this.getLocalTime(curDate);
|
this.createTimeList = [sDay, end];
|
},
|
add0(m) {
|
return m < 10 ? "0" + m : m;
|
},
|
getLocalTime(nS) {
|
var time = new Date(nS);
|
var y = time.getFullYear();
|
var m = time.getMonth() + 1;
|
var d = time.getDate();
|
return y + "-" + this.add0(m) + "-" + this.add0(d);
|
},
|
dateChangebirthday1(val) {
|
this.createTimeList = val;
|
},
|
/** 查询体检采样管理列表 */
|
getList() {
|
this.loading = true;
|
this.queryParams.isSignFor = this.tjStatus;
|
if(this.createTimeList){
|
this.queryParams.beginTime = this.createTimeList[0];
|
this.queryParams.endTime = this.createTimeList[1];
|
}else if(this.createTimeList == null){
|
this.queryParams.beginTime = null;
|
this.queryParams.endTime = null;
|
}
|
|
getList(this.queryParams).then((response) => {
|
if (response.data) {
|
if (response.data.list == null) {
|
this.samplingList = [];
|
this.tableList = [];
|
this.loading = false;
|
} else {
|
this.samplingList = response.data.list;
|
this.loading = false;
|
if (this.samplingList.length != 0) {
|
this.$nextTick(() => {
|
this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
|
});
|
} else {
|
this.$refs.tb.clearSelection();
|
}
|
}
|
this.total = response.data.total;
|
this.loading = false;
|
} else {
|
this.samplingList = [];
|
this.tableList = [];
|
this.loading = false;
|
}
|
});
|
},
|
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
id: null,
|
samplingNumber: null,
|
cusId: null,
|
applicationTime: null,
|
isSignFor: null,
|
tjTime: null,
|
specimenType: null,
|
proId: null,
|
proName: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
deleted: null,
|
};
|
this.resetForm("form");
|
},
|
hb() {
|
// console.log(this.queryParams.tjNum);
|
if (this.queryParams.tjNum != null) {
|
this.handleQuery();
|
}
|
},
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.createTimeList=[]
|
this.resetForm("queryForm");
|
this.handleQuery();
|
},
|
// 单选框选中数据
|
handleSelectionChange(selection) {
|
this.selectList = selection;
|
selection.forEach((element) => {
|
this.tableList = element.list;
|
if (this.tableList.length != 0) {
|
this.$nextTick(() => {
|
this.$refs.tab1.toggleAllSelection(this.tableList, true);
|
});
|
} else {
|
this.$refs.tab1.clearSelection();
|
}
|
});
|
// this.ids = selection.map(item => item.id)
|
if (selection.length > 1) {
|
let del_row = selection.shift();
|
this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中
|
}
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
tableRowClassName({ row, rowIndex }) {
|
for (let i = 0; i < this.selectList.length; i++) {
|
if (row === this.selectList[i]) {
|
return "warning-row";
|
}
|
}
|
},
|
|
handleChange(selection) {
|
this.selectList = selection;
|
this.ids = selection.map((item) => item.id);
|
},
|
|
// 禁选
|
// selectEnable(row, rowIndex) {
|
// if(row.isSignFor === "0"){
|
// return false
|
// }else{
|
// return true
|
// }
|
// },
|
|
// 确定按钮
|
submitForm() {},
|
|
// 确认采样
|
Confirmreceipt() {
|
let data = this.ids;
|
confirmSampling(data).then((res) => {
|
this.$modal.msgSuccess("采样成功");
|
this.getList();
|
});
|
},
|
|
// 单选按钮
|
radioChange(value) {
|
this.loading = true;
|
this.queryParams.isSignFor = value;
|
getList(this.queryParams).then((response) => {
|
if (response.data) {
|
if (response.data.list == null) {
|
this.samplingList = [];
|
this.tableList = [];
|
this.loading = false;
|
} else {
|
this.samplingList = response.data.list;
|
this.loading = false;
|
if (this.samplingList.length != 0) {
|
this.$nextTick(() => {
|
this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
|
});
|
} else {
|
this.$refs.tb.clearSelection();
|
}
|
}
|
this.total = response.data.total;
|
this.loading = false;
|
} else {
|
this.samplingList = [];
|
this.tableList = [];
|
this.loading = false;
|
}
|
});
|
},
|
|
// 默认接受四个值 { 当前行的值, 当前列的值, 行的下标, 列的下标 }
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
let fields = ["specimenType"];
|
let cellValue = row[column.property];
|
if (cellValue && fields.includes(column.property)) {
|
let prevRow = this.tableList[rowIndex - 1];
|
let nextRow = this.tableList[rowIndex + 1];
|
if (prevRow && prevRow[column.property] === cellValue) {
|
return { rowspan: 0, colspan: 0 };
|
} else {
|
let countRowspan = 1;
|
while (nextRow && nextRow[column.property] === cellValue) {
|
nextRow = this.tableList[++countRowspan + rowIndex];
|
}
|
if (countRowspan > 1) {
|
return { rowspan: countRowspan, colspan: 1 };
|
}
|
}
|
}
|
},
|
|
// 导出
|
handleExport() {},
|
},
|
};
|
</script>
|
|
<style>
|
#ta .el-table__header-wrapper .el-checkbox {
|
display: none;
|
}
|
|
.el-table .warning-row {
|
background: #e5f3ff !important;
|
}
|
</style>
|