From f38b51b7e6cad2ae97781f1b544ec228e22d3524 Mon Sep 17 00:00:00 2001 From: liuning <807852472@qq.com> Date: Mon, 16 Mar 2026 14:31:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E5=BA=9F=E6=94=B6=E9=9B=86=E7=BA=AF?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E4=B8=8A=E4=BC=A0=EF=BC=8C=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E8=AF=95=EF=BC=8C=E5=B9=B6=E4=B8=94=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20=E7=A7=91=E5=AE=A4=E3=80=81=E4=BA=BA=E5=91=98=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/plugin/collectionMwims.vue | 273 ++++++++++++++++++++++++++++--- 1 file changed, 252 insertions(+), 21 deletions(-) diff --git a/pages/plugin/collectionMwims.vue b/pages/plugin/collectionMwims.vue index 3b8ae81..2e32a80 100644 --- a/pages/plugin/collectionMwims.vue +++ b/pages/plugin/collectionMwims.vue @@ -19,13 +19,33 @@ 科室 - - - {{selectedDepartment}} + + + {{selectedDepartment}} 请选择科室 - + + + + + 选择科室 + + + + + 🔍 + + + + + {{item}} + + 未找到匹配的科室 + + + + @@ -67,13 +87,33 @@ 交接人员 - - - {{selectedHandover}} + + + {{selectedHandover}} 请选择交接人员 - + + + + + 选择交接人员 + + + + + 🔍 + + + + + {{item}} + + 未找到匹配的交接人员 + + + + @@ -82,7 +122,6 @@ - 📅 {{collectionDate || '选择日期'}} @@ -90,7 +129,6 @@ · - 🕐 {{collectionTime}} @@ -129,7 +167,13 @@ departmentList: [], typeList: [], collectorList: [], - handoverList: [] + handoverList: [], + // 搜索弹窗显示状态 + showDepartmentPicker: false, + showHandoverPicker: false, + // 搜索关键词 + departmentSearchKeyword: '', + handoverSearchKeyword: '' } }, mounted() { @@ -152,6 +196,26 @@ this.getCollectorOptions() this.getHandoverOptions() }, + computed: { + // 过滤后的科室列表 + filteredDepartmentList() { + if (!this.departmentSearchKeyword) { + return this.departmentList; + } + return this.departmentList.filter(dept => { + return dept && dept.includes(this.departmentSearchKeyword); + }); + }, + // 过滤后的交接人员列表 + filteredHandoverList() { + if (!this.handoverSearchKeyword) { + return this.handoverList; + } + return this.handoverList.filter(person => { + return person && person.includes(this.handoverSearchKeyword); + }); + } + }, methods: { // 生成随机医废编码 generateMedicalCode() { @@ -187,14 +251,21 @@ 'Content-type': 'application/json' }, success: function(res) { - that.departmentList = res.data.data || [] + const data = res.data.data || [] + // 将对象数组转换为字符串数组,提取 dept_name 字段 + that.departmentList = data.map(item => { + if (typeof item === 'object' && item !== null) { + return item.dept_name || item.name || item.department_name || item.text || JSON.stringify(item) + } + return item + }) }, fail: () => { console.info('获取科室选项失败') } }) }, - + // 获取类型选项(预留接口) getTypeOptions() { let that = this @@ -205,14 +276,21 @@ 'Content-type': 'application/json' }, success: function(res) { - that.typeList = res.data.data || [] + const data = res.data.data || [] + // 将对象数组转换为字符串数组,假设对象中有 name 或 type_name 字段 + that.typeList = data.map(item => { + if (typeof item === 'object' && item !== null) { + return item.name || item.type_name || item.text || JSON.stringify(item) + } + return item + }) }, fail: () => { console.info('获取类型选项失败') } }) }, - + // 获取收集人员选项(预留接口) getCollectorOptions() { let that = this @@ -223,14 +301,21 @@ 'Content-type': 'application/json' }, success: function(res) { - that.collectorList = res.data.data || [] + const data = res.data.data || [] + // 将对象数组转换为字符串数组,假设对象中有 name 字段 + that.collectorList = data.map(item => { + if (typeof item === 'object' && item !== null) { + return item.name || item.text || JSON.stringify(item) + } + return item + }) }, fail: () => { console.info('获取收集人员选项失败') } }) }, - + // 获取交接人员选项(预留接口) getHandoverOptions() { let that = this @@ -241,7 +326,14 @@ 'Content-type': 'application/json' }, success: function(res) { - that.handoverList = res.data.data || [] + const data = res.data.data || [] + // 将对象数组转换为字符串数组,假设对象中有 name 字段 + that.handoverList = data.map(item => { + if (typeof item === 'object' && item !== null) { + return item.name || item.text || JSON.stringify(item) + } + return item + }) }, fail: () => { console.info('获取交接人员选项失败') @@ -249,9 +341,18 @@ }) }, - // 科室选择变化 - onDepartmentChange(e) { - this.selectedDepartment = this.departmentList[e.detail.value] + // 选择科室 + selectDepartment(item) { + this.selectedDepartment = item; + this.showDepartmentPicker = false; + this.departmentSearchKeyword = ''; + }, + + // 选择交接人员 + selectHandover(item) { + this.selectedHandover = item; + this.showHandoverPicker = false; + this.handoverSearchKeyword = ''; }, // 类型选择变化 @@ -510,4 +611,134 @@ .cancel-btn::after, .confirm-btn::after { border: none; } + + /* 可搜索选择器 */ + .searchable-picker-wrapper { + flex: 1; + position: relative; + } + + .searchable-picker { + display: flex; + align-items: center; + justify-content: flex-end; + color: #666; + font-size: 28rpx; + } + + /* 搜索弹窗 */ + .picker-modal { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + display: flex; + align-items: flex-end; + justify-content: center; + z-index: 1000; + } + + .picker-modal-content { + width: 100%; + background: #fff; + border-radius: 30rpx 30rpx 0 0; + max-height: 80vh; + display: flex; + flex-direction: column; + } + + .modal-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30rpx; + border-bottom: 1px solid #e8e8e8; + } + + .modal-title { + font-size: 32rpx; + font-weight: 700; + color: #333; + } + + .modal-close { + font-size: 40rpx; + color: #999; + padding: 10rpx; + } + + /* 搜索输入框 */ + .search-input-wrapper { + padding: 20rpx 30rpx; + background: #f8f9fa; + display: flex; + align-items: center; + border-bottom: 1px solid #e8e8e8; + } + + .search-input { + flex: 1; + height: 60rpx; + font-size: 28rpx; + color: #333; + background: #fff; + border-radius: 30rpx; + padding: 0 50rpx 0 24rpx; + border: 1px solid #d9d9d9; + } + + .search-placeholder { + color: #ccc; + } + + .search-icon, .clear-icon { + position: absolute; + right: 50rpx; + font-size: 28rpx; + } + + .search-icon { + color: #999; + } + + .clear-icon { + color: #ccc; + padding: 10rpx; + } + + /* 列表 */ + .picker-list { + flex: 1; + max-height: 50vh; + } + + .picker-item { + padding: 28rpx 30rpx; + border-bottom: 1px solid #f0f0f0; + font-size: 30rpx; + color: #333; + transition: all 0.2s; + } + + .picker-item:active { + background: #f5f5f5; + } + + .picker-item text { + display: block; + } + + .item-active { + color: #2980b9; + font-weight: 600; + } + + .picker-empty { + padding: 80rpx 0; + text-align: center; + font-size: 28rpx; + color: #999; + }