|
|
<template> <div style="display: flex;"> <div :style="'width:' + (window.pageWidth - 200 - 145) + 'px;'"> <u-table :data="tableData" width="100%" border :height="window.pageHeight < 600 ? 330 : window.pageHeight - 240" row-key="id" size="small" highlight-current-row ref="dataList" @selection-change="handleSelectionChange" @row-click="rowClick" @table-body-scroll="scrollFull" use-virtual :row-height="25" big-data-checkbox :data-changes-scroll-top="false"> <u-table-column type="selection" width="40" align="center" /> <u-table-column type="index" label="序号" width="50" align="center" /> <u-table-column prop="isRecoverGuide" label="回收" align="center" width="50" sortable> <template slot-scope="scope"> <el-checkbox :value="scope.row.isRecoverGuide == 'Y'" /> </template> </u-table-column> <u-table-column prop="completeFlag" label="体检进度" sortable> <template slot-scope="scope"> <div>{{ ldddw(dict.completeFlag, "id", scope.row.completeFlag, "displayName") }}</div> </template> </u-table-column> <u-table-column prop="isLock" label="锁住" width="50" sortable> <template slot-scope="scope"> <i class="el-icon-lock" v-if="scope.row.isLock == 'Y'" style="font-size: 20px; color: red" /> </template> </u-table-column> <u-table-column prop="customerOrgParentName" label="单位" width="180" sortable> <template slot-scope="scope"> <div>{{ scope.row.customerOrgParentName ? scope.row.customerOrgParentName : scope.row.customerOrgName }} </div> </template> </u-table-column> <u-table-column prop="customerOrgName" label="部门" width="180"> <template slot-scope="scope"> <div>{{ scope.row.customerOrgParentName == scope.row.customerOrgName ? "" : scope.row.customerOrgName }}</div> </template> </u-table-column> <u-table-column prop="patientName" label="姓名" sortable/> <u-table-column prop="sexName" label="性别" sortable> </u-table-column> <u-table-column prop="age" label="年龄" sortable/> <u-table-column prop="patientRegisterNo" label="条码号" width="150" sortable/> <u-table-column prop="patientNo" label="档案号" sortable/> <u-table-column prop="medicalTimes" label="体检次数"></u-table-column> <u-table-column label="分组/套餐" width="150"> <template slot-scope="scope"> <div v-if="scope.row.medicalPackageId !== dict.personOrgId && scope.row.customerOrgId === dict.personOrgId"> {{ scope.row.medicalPackageName }} </div> <div v-else> {{ scope.row.customerOrgGroupName }} </div> </template> </u-table-column> <u-table-column prop="nationName" label="民族" sortable> </u-table-column> <u-table-column prop="idNo" label="身份证" width="150" sortable/> <u-table-column prop="birthDate" label="出生日期" width="100" sortable> <template slot-scope="scope"> <div v-if="scope.row.birthDate"> {{ lmoment(scope.row.birthDate, "yyyy-MM-DD") }} </div> </template> </u-table-column> <u-table-column prop="email" label="邮箱" width="100" sortable/> <u-table-column prop="mobileTelephone" label="手机" width="100" sortable/> <u-table-column prop="telephone" label="电话" width="100" sortable/> <u-table-column prop="address" label="地址" width="300" sortable/> <u-table-column prop="medicalCardNo" label="体检卡号" sortable/> <u-table-column prop="jobCardNo" label="工卡号" sortable/> <u-table-column prop="maritalStatusName" label="婚姻状况" sortable> </u-table-column> <u-table-column prop="medicalTypeName" label="体检类别" sortable> </u-table-column> <u-table-column prop="personnelTypeName" label="人员类别" sortable> </u-table-column> <u-table-column prop="jobPost" label="职务" sortable/> <u-table-column prop="jobTitle" label="职称" sortable/> <u-table-column prop="salesman" label="介绍人" sortable/> <u-table-column prop="isVip" label="VIP" sortable> <template slot-scope="scope"> <el-checkbox :value="scope.row.isVip == 'Y'" /> </template> </u-table-column> <u-table-column prop="creatorName" label="登记人" sortable/> <u-table-column prop="creationTime" label="登记日期" width="100" sortable> <template slot-scope="scope"> <div>{{ lmoment(scope.row.creationTime, "yyyy-MM-DD") }}</div> </template> </u-table-column> <u-table-column prop="isUpload" label="上传" sortable> <template slot-scope="scope"> <el-checkbox :value="scope.row.isUpload == 'Y'" /> </template> </u-table-column> </u-table> <div style="display: flex; justify-content: space-between"> <div></div> <div> <span style="font-size: 12px">共:{{ loadOpts.totalCount }} 条记录,当前显示:{{ tableData.length }} 条。</span> </div> </div> </div> <div style="margin-left: 10px;"> <div class="listBtn"> <el-button type="success" class="commonbutton" @click="btnRecover('Y')">回收表单</el-button> </div> <div class="listBtn"> <el-button type="danger" class="commonbutton" @click="btnRecover('N')">取消回收</el-button> </div> <div class="listBtn"> <el-button type="primary" class="commonbutton" @click="btnScanRecover">扫码回收</el-button> </div> <!-- <div class="listBtn"> <download-excel :fields="jsonFields" :fetch="btnExport" type="xls" :name="tableName"> <el-button type="" style="width:100%">导出excel</el-button> </download-excel> </div> --> </div> <el-dialog title="扫/输入条码回收体检表(指引单)" :visible.sync="recover.dialog" width="400px" :append-to-body="true" :close-on-click-modal="false"> <div style="margin-left: 10px;"> <template> <el-radio v-model="recover.recoverType" label="0">条码号</el-radio> <el-radio v-model="recover.recoverType" label="1">档案号</el-radio> </template> <el-input style="margin: 10px 0;" ref="tmh" v-model="recover.barcode" @keyup.native.enter="signByPatientRegisterNo"></el-input> </div> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="signByPatientRegisterNo" class="commonbutton">确定</el-button> <el-button @click="recover.dialog = false" class="commonbutton">关闭</el-button> </div> </el-dialog> </div></template><script>import moment from "moment";import { mapState, mapActions } from "vuex";import { getapi, postapi, putapi, deletapi } from "@/api/api";import { dddw, objCopy, arrayReduce,arrayExistObj,deepCopy } from "@/utlis/proFunc";import { savePeoplePhoto } from "../../utlis/proApi";
import PatientRegisterEdit from "../../components/patientRegister/PatientRegisterEdit.vue";import Camera from "../../components/patientRegister/Camera.vue";import { UTable, UTableColumn } from "umy-ui";export default { components: { PatientRegisterEdit, Camera, UTable, UTableColumn, }, props: ["refQueryCondition"], data() { return { tableData: [], //列表数据
multipleSelection: [], //选中的数据列表
tableDataCurrentRow:{}, // 单行选中的行
// 体检表回收
recover: { dialog: false, recoverType: '0', //回收类型 0-条码号 1-档案号
barcode: '', // 条码号或档案号
barcodes: [], // 条码号或档案号集合
isRecoverGuide: 'Y', //状态 Y-回收,N-取消回收
},
patientRegisterNo: '', patient_register_query_idno: 'Y', // 身份证排他
patient_register_query_name: 'N', // 姓名排他
patient_register_read_idno_upPhoto: 'N', // 读身份证查询 是否更新照片
LocalConfig: { normal: { maxResultCount: 100, //分页时单页记录数
}, }, loadOpts: { totalCount: 0, skipCount: 0, maxResultCount: 100, }, loadOptsInit: {}, lazyLoading:false, dom:null, jsonFields: { 回收:"isRecoverGuide", 体检进度: "completeFlag", 锁住: "isLock", 单位: "customerOrgParentName", 部门: "customerOrgName", 姓名: "patientName", 性别: "sexName", 年龄: "age", 条码号: "patientRegisterNo", 档案号: "patientNo", 体检次数: "medicalTimes", 分组套餐: "groupPack", 民族: "nationName", 身份证: "idNo", 出生日期: "birthDate", 邮箱: "email", 手机: "mobileTelephone", 电话: "telephone", 地址: "address", 体检卡号: "medicalCardNo", 工卡号: "jobCardNo", 婚姻状况: "maritalStatusName", 体检类别: "medicalTypeName", 人员类别: "personnelTypeName", 职务: "jobPost", 职称: "jobTitle", 介绍人: "salesman", VIP: "isVip", 登记人: "creatorName", 登记日期: "creationTime", 上传: "isUpload" }, tableName:"" }; },
created() { try { let LocalConfig = JSON.parse(window.localStorage.getItem("LocalConfig") || null) if (LocalConfig?.normal?.maxResultCount){ this.LocalConfig.normal.maxResultCount = LocalConfig.normal.maxResultCount }
} catch (error) { console.log('window.localStorage.getItem("LocalConfig")', error); }
// console.log('this.LocalConfig',this.LocalConfig)
this.loadOpts.maxResultCount = Number( this.LocalConfig.normal.maxResultCount || 100 );
this.loadOptsInit = Object.assign({}, this.loadOpts); // 获取系统参数 -- 身份证排他
postapi("/api/app/SysParmValue/GetSysParmValueBySysParmId", { sysParmId: "patient_register_query_idno" } ).then((res) => { if (res.code > -1) { this.patient_register_query_idno = res.data || "Y"; } });
// 获取系统参数 -- 姓名排他
postapi("/api/app/SysParmValue/GetSysParmValueBySysParmId", { sysParmId: "patient_register_query_name" } ).then((res) => { if (res.code > -1) { this.patient_register_query_name = res.data || "N"; } });
// 获取系统参数 -- 读身份证 是否更新照片
postapi("/api/app/SysParmValue/GetSysParmValueBySysParmId", { sysParmId: "patient_register_read_idno_upPhoto" } ).then((res) => { if (res.code > -1) { this.patient_register_read_idno_upPhoto = res.data || "N"; } }); },
//挂载完成
mounted() { // this.$nextTick(() => {
// this.scrollFull()
// })
}, computed: { ...mapState(["window", "dict", "patientRegister", "customerOrg"]), }, methods: { ...mapActions(["getCustomerOrgGroup", "getPatientRegisterAbs"]),
handleSelectionChange(val) { this.multipleSelection = val; },
rowClick(row){ this.tableDataCurrentRow = row },
// 回收表提交 Y-回收,N-取消
recoverCore(body) { // postapi(`/api/app/patientregister/updaterecoverguidemany`, body)
// .then((res) => {
// if (res.code > -1) {
// this.$message.success({ showClose: true, message: "操作成功!"});
// // 刷新页面回收状态
// if(this.multipleSelection.length > 0){
// this.multipleSelection.forEach(e => {
// e.isRecoverGuide = 'Y'
// });
// }else{
// let lfind = arrayExistObj(this.tableData,'id',body[0].id)
// if(lfind > -1){
// this.tableData[lfind].isRecoverGuide = 'Y'
// }
// }
// }
// })
postapi('/api/app/PatientRegister/BatchRecoverGuide', body) .then((res) => { if (res.code > -1) { this.$message.success({ showClose: true, message: '操作成功!' }) let key = body.recoverType == '0' ? 'patientRegisterNo':'patientNo' let lfind = -1 body.barcodes.forEach(e => { lfind = arrayExistObj(this.tableData,key,e) if(lfind > -1) this.tableData[lfind].isRecoverGuide = body.isRecoverGuide }); } }); },
//选中人员记录回收
btnRecover(isRecoverGuide) { // 有勾选,则操作勾选的,无勾选则按选中的记录
let selectedRds = [] selectedRds = selectedRds.concat(this.multipleSelection) if(selectedRds.length == 0){ if(this.tableDataCurrentRow.id) selectedRds.push(this.tableDataCurrentRow) } if (selectedRds.length == 0) { this.$message.warning({ showClose: true, message: "请勾选择或选中体检人员,再进行此操作" }); return; }
let body = { recoverType:'0', isRecoverGuide, barcodes:[] } selectedRds.forEach(e => { body.barcodes.push(e.patientRegisterNo) });
this.recoverCore(body)
},
// 点击扫码回收体检表按钮
btnScanRecover() { this.recover.barcode = '' this.recover.dialog = true this.$nextTick(() => { this.$refs['tmh'].focus(); //打开光标定位到条码栏里
}); },
//按条码号查个人数据
signByPatientRegisterNo() { // let patientRegisterNos = [this.patientRegisterNo]
// let body = {
// patientRegisterNos
// }
// //console.log(`/api/app/patientregister/getpatientregisterorpatient`, body)
// postapi('/api/app/PatientRegister/BatchRecoverGuideByPatientRegisterNo', body)
// .then((res) => {
// if (res.code > -1) {
// this.$message.success({ showClose: true, message: '操作成功!' })
// //let lfind = arrayExistObj()
// this.recover.barcode = ''
// }
// });
this.recover.barcodes = [this.recover.barcode] postapi('/api/app/PatientRegister/BatchRecoverGuide', this.recover) .then((res) => { if (res.code > -1) { this.$message.success({ showClose: true, message: '操作成功!' }) let key = this.recover.recoverType == '0' ? 'patientRegisterNo':'patientNo' let lfind = arrayExistObj(this.tableData,key,this.recover.barcode) if(lfind > -1) this.tableData[lfind].isRecoverGuide = this.recover.isRecoverGuide this.recover.barcode = '' } });
},
ldddw(arrayData, key, value, display) { return dddw(arrayData, key, value, display); },
lmoment(date, forMat) { return moment(new Date(date)).format(forMat); },
//查询
async Query() { // 查询时,清掉明细数据 (滚动时不清)
this.tableDataCurrentRow = {}; // 清除选择
if ( !( this.patientRegister.query.isSeries == "Y" && this.patientRegister.query.patientRegisterNo ) ) { this.tableData = []; }
this.loadOpts = Object.assign(this.loadOpts, this.loadOptsInit); await this.getPrList(); },
//数据量多时,滚动加载
async load() { this.loadOpts.skipCount++; await this.getPrList(); this.lazyLoading = false }, // 查询获取人员列表数据
async getPrList() { if ( this.loadOpts.skipCount != 0 && this.loadOpts.skipCount * this.loadOpts.maxResultCount >= this.loadOpts.totalCount ) return; // console.log('getPrList', this.loadOpts)
let body = Object.assign({}, this.loadOpts) let queryType = this.refQueryCondition.queryType
console.log('getPrList.this.refQueryCondition', this.refQueryCondition) // 非排他查询条件 ===================== Start ==========================
if (!queryType) {
// 查询条件--日期
if (this.refQueryCondition.startDate && this.refQueryCondition.endDate) { body.dateType = this.refQueryCondition.dateType; body.startDate = this.refQueryCondition.startDate body.endDate = this.refQueryCondition.endDate if (body.startDate > body.endDate) { this.$message.warning({ showClose: true, message: "起始日期不能大于截止日期,数据校验不通过!", }); return; } }
// 查询条件--单位、次数、分组
if (this.refQueryCondition.customerOrgFlag) { if (this.refQueryCondition.customerOrgId) body.customerOrgId = this.refQueryCondition.customerOrgId // 获取单位体检次数与分组
try { if ( this.refQueryCondition.customerOrgId && this.refQueryCondition.customerOrgId != this.dict.personOrgId && this.refQueryCondition.customerOrgRegister.id ) { body.customerOrgRegisterId = this.refQueryCondition.customerOrgRegister.id; if (this.refQueryCondition.customerOrgGroupIds) body.customerOrgGroupIds = this.refQueryCondition.customerOrgGroupIds } } catch (error) { console.error(error); } }
// 电话
if (this.refQueryCondition.phone) body.phone = this.refQueryCondition.phone // 性别
if (this.refQueryCondition.sexId) body.sexId = this.refQueryCondition.sexId // 体检类别
if (this.refQueryCondition.medicalTypeIds) body.medicalTypeIds = this.refQueryCondition.medicalTypeIds // 人员状态
if (this.refQueryCondition.completeFlags) body.completeFlags = this.refQueryCondition.completeFlags // 人员类别
if (this.refQueryCondition.personnelTypeIds) body.personnelTypeIds = this.refQueryCondition.personnelTypeIds // 表格回收状态
if (this.refQueryCondition.isRecoverGuide) body.isRecoverGuide = this.refQueryCondition.isRecoverGuide
// 排他条件有值时
if (this.refQueryCondition.patientRegisterNo) { queryType = "patientRegisterNo" } else if (this.refQueryCondition.pacsNo) { queryType = "pacsNo" } else if (this.refQueryCondition.lisNo) { queryType = "lisNo" } else if (this.refQueryCondition.patientNo) { queryType = "patientNo" } else if (this.refQueryCondition.idCardNo) { queryType = "idCardNo" } else if (this.refQueryCondition.patientName) { queryType = "patientName" }
} // 非排他查询条件 ===================== End ==========================
// 排他查询条件
let photo = '' switch (queryType) { case 'patientName': // 姓名排他判断
if (this.refQueryCondition.patientName) { body.patientName = this.refQueryCondition.patientName; if (this.patient_register_query_name == 'Y') { body = { patientName: this.refQueryCondition.patientName, skipCount: this.loadOpts.skipCount, maxResultCount: this.loadOpts.maxResultCount, }; } } break; case 'idCardNo': // 身份证排他判断
if (this.refQueryCondition.idCardNo) { body.idNo = this.refQueryCondition.idCardNo; if (this.patient_register_query_idno == 'Y') { body = { idNo: this.refQueryCondition.idCardNo, skipCount: this.loadOpts.skipCount, maxResultCount: this.loadOpts.maxResultCount, }; } } if (this.refQueryCondition.photo) photo = this.refQueryCondition.photo; break; case 'patientNo': // 档案号排他判断
if (this.refQueryCondition.patientNo) body = { patientNo: this.refQueryCondition.patientNo, skipCount: this.loadOpts.skipCount, maxResultCount: this.loadOpts.maxResultCount, }; break; case 'patientRegisterNo': // 条码号排他判断
if (this.refQueryCondition.patientRegisterNo) body = { patientRegisterNo: this.refQueryCondition.patientRegisterNo, skipCount: this.loadOpts.skipCount, maxResultCount: this.loadOpts.maxResultCount, }; break; case 'pacsNo': // 检查条码排他判断
if (this.refQueryCondition.pacsNo) body = { pacsNo: this.refQueryCondition.pacsNo, skipCount: this.loadOpts.skipCount, maxResultCount: this.loadOpts.maxResultCount, }; break; case 'lisNo': // 检验条码排他判断
if (this.refQueryCondition.lisNo) body = { lisNo: this.refQueryCondition.lisNo, skipCount: this.loadOpts.skipCount, maxResultCount: this.loadOpts.maxResultCount, }; break; default: //
break; }
// 带费且合计 /api/app/PatientRegister/GetPatientRegisterWithCharge
// 不带费且合计 /api/app/patientregister/getlistinfilter
postapi( "/api/app/patientregister/getlistinfilter", body ).then(async (res) => { if (res.code > -1) { // 刷新最大记录数
this.loadOpts.totalCount = res.data.totalCount; let curLoad = res.data.items;
// let oldCount = 0
// 处理:
// 1、分组/套餐 排序混乱的问题
// 2、扫身份证查询时,无照片自动更新照片(参数控制)
curLoad.forEach((e) => { // 1、分组/套餐 排序混乱的问题
if (e.customerOrgId == this.dict.personOrgId) { e.groupPack = e.medicalPackageId; } else { e.groupPack = e.customerOrgGroupId; }
// 2、扫身份证查询时,无照片自动更新照片(参数控制)
if (this.patient_register_read_idno_upPhoto == "Y" && photo) { if (!e.photo) { savePeoplePhoto(e.id, photo); } } });
// 不是连续扫码时,需要判断是否分页查询(连续扫码不清原来的数据)
// console.log("this.refQueryCondition", this.refQueryCondition.isSeries, this.refQueryCondition.patientRegisterNo);
if (this.refQueryCondition.isSeries == "Y" && this.refQueryCondition.patientRegisterNo) { // 如果已经存在列表中,则不在添加
for (let index = curLoad.length - 1; index > -1; index--) { const e = curLoad[index]; if (arrayExistObj(this.tableData, 'id', e.id) > -1) curLoad.splice(index, 1) } } else { if (body.skipCount == 0) { //查询
this.tableData = []; } }
this.tableData = this.tableData.concat(curLoad); // else {
// // 懒加载 ,原数据集不用清空
// oldCount = this.tableData.length
// }
// curLoad.forEach((e, index) => {
// this.tableData.push(Object.assign({ index: Number(oldCount) + Number(index), choosed: false }, e))
// })
} }); },
//滚动加载数据
async scrollFull(scroll, event) { if (!scroll.judgeFlse) return;
// 正在加载时阻止重复触发
if (this.lazyLoading) return; if ( (Number(this.loadOpts.skipCount) + 1) * Number(this.loadOpts.maxResultCount) >= Number(this.loadOpts.totalCount) ) { return; }
this.lazyLoading = true; try { await this.load(); } catch (e) { console.error('scrollFull load error', e); } // this.dom = this.$refs['dataList'].bodyWrapper
// console.log('obj', this.dom)
// this.dom.addEventListener('scroll', async () => {
// // console.log('scrollTop',this.dom.scrollTop,'clientHeight',this.dom.clientHeight,'scrollHeight',this.dom.scrollHeight);
// if (this.dom.scrollTop + this.dom.clientHeight + 20 > this.dom.scrollHeight && !this.lazyLoading) {
// // 获取到的不是全部数据 当滚动到底部
// //console.log('scrollTop', obj.scrollTop, 'clientHeight', obj.clientHeight, 'scrollHeight', obj.scrollHeight);
// if (Number(this.loadOpts.skipCount) * Number(this.loadOpts.maxResultCount) >= Number(this.loadOpts.totalCount)) {
// this.lazyLoading = false
// } else {
// this.lazyLoading = true
// this.load()
// // this.dom.scrollTop = this.dom.scrollTop - 100
// }
// }
// })
},
btnExport(elId) { let tableDatas = deepCopy(this.tableData) tableDatas.forEach((e, index) => { if(e.completeFlag) e.completeFlag = this.ldddw(this.dict.completeFlag, "id", e.completeFlag, "displayName") if (e.sexId) e.sexId = dddw(this.dict.sex, "id", e.sexId, "displayName") if (e.medicalPackageId !== this.dict.personOrgId && e.customerOrgId === this.dict.personOrgId) { e.groupPack = e.medicalPackageName // dddw(this.dict.medicalPackage, "id", e.medicalPackageId, "displayName")
} else if (e.medicalPackageId !== this.dict.personOrgId && e.customerOrgId !== this.dict.personOrgId) { e.groupPack = e.customerOrgGroupName // dddw(this.dict.customerOrgGroupAll, "id", e.customerOrgGroupId, "displayName")
} if (e.idNo) e.idNo = e.idNo + '&' if (e.birthDate) e.birthDate = moment(e.birthDate).format("yyyy-MM-DD") }) this.tableName = '体检表回收' + moment(new Date()).format('yyyyMMDDHHmmss') + '.xls' return tableDatas; },
},
//监听事件
watch: { //触发查询事件
"refQueryCondition.queryConditionTimes"(newVal, oldVal) { if (newVal != oldVal) { console.log('表格回收--触发查询 refQueryCondition.queryConditionTimes', oldVal, newVal) this.Query(); } },
},};</script><style scoped>@import "../../assets/css/global_table.css";.listBtn { margin-top: 10px;}
.btnClass { width: 100px;}.query { margin-right: 10px; font-size: 14px; color: #232748; font-weight: 400; font-family: "NotoSansSC-Regular";}.spanClass { font-size: 14px; padding: 0 2px 0 0;}</style>
|