init version kelfy-mini for new gitea
This commit is contained in:
110
pages/selectDepartment/selectDepartment.js
Normal file
110
pages/selectDepartment/selectDepartment.js
Normal file
@@ -0,0 +1,110 @@
|
||||
// pages/selectDepartment/selectDepartment.js
|
||||
const util = require('../../utils/util.js')
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
keyword: '',
|
||||
originList: [], // 原始完整数据(从后台或缓存来)
|
||||
filteredList: [], // 过滤后用于渲染
|
||||
officeList: [],
|
||||
deptList: []
|
||||
},
|
||||
|
||||
// 选择科室
|
||||
naviToYs(e) {
|
||||
let deptId = e.currentTarget.dataset.id
|
||||
// let ksmc = e.currentTarget.dataset.item.ksmc
|
||||
wx.navigateTo({
|
||||
url: '/pages/departmentMsg/departmentMsg?deptId=' + deptId,
|
||||
})
|
||||
},
|
||||
// 获取科室列表
|
||||
getOfficeList(options) {
|
||||
wx.request({
|
||||
// url: 'https://fy.btlsoln.com:8443/hisViewSearch/getHisDept?deptId=' + options.deptId,
|
||||
url: 'https://fy.btlsoln.com:8443/hisViewSearch/getHisDeptAdd',
|
||||
method: "GET",
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
this.setData({
|
||||
originList: res.data.data,
|
||||
filteredList: res.data.data
|
||||
// deptList: res.data.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 实时过滤
|
||||
onSearch(e) {
|
||||
const key = e.detail.trim();
|
||||
const { originList } = this.data;
|
||||
const filtered = key
|
||||
? originList.filter(i =>
|
||||
i.name.includes(key)
|
||||
)
|
||||
: originList;
|
||||
this.setData({ keyword: key, filteredList: filtered });
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
wx.setNavigationBarTitle({
|
||||
title: '选择科室',
|
||||
})
|
||||
this.getOfficeList(options)
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
3
pages/selectDepartment/selectDepartment.json
Normal file
3
pages/selectDepartment/selectDepartment.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
23
pages/selectDepartment/selectDepartment.wxml
Normal file
23
pages/selectDepartment/selectDepartment.wxml
Normal file
@@ -0,0 +1,23 @@
|
||||
<!--pages/selectDepartment/selectDepartment.wxml-->
|
||||
<view class="main">
|
||||
<view class="container">
|
||||
<scroll-view scroll-y='true' style='height:100%'>
|
||||
<!-- 搜索框 -->
|
||||
<van-search
|
||||
value="{{ keyword }}"
|
||||
placeholder="请输入关键字"
|
||||
bind:change="onSearch"
|
||||
/>
|
||||
<van-cell-group inset wx:for="{{filteredList}}">
|
||||
<van-cell title="{{item.name}}" is-link data-id="{{item.id}}" bindtap="naviToYs" />
|
||||
</van-cell-group>
|
||||
<!-- 无结果提示 -->
|
||||
<van-empty wx:if="{{ filteredList.length===0 && keyword }}" description="无匹配记录" />
|
||||
|
||||
<!-- <view class="item" wx:for="{{officeList}}" wx:key="item" bindtap="naviToYs" data-item="{{item}}">
|
||||
<view class="name">{{item.ksmc}}</view>
|
||||
<view class="icon">></view>
|
||||
</view> -->
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
32
pages/selectDepartment/selectDepartment.wxss
Normal file
32
pages/selectDepartment/selectDepartment.wxss
Normal file
@@ -0,0 +1,32 @@
|
||||
/* pages/selectDepartment/selectDepartment.wxss */
|
||||
.main{
|
||||
margin: 30rpx 0;
|
||||
height: 100vh;
|
||||
width: 750rpx;
|
||||
}
|
||||
.container{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.item{
|
||||
height: 120rpx;
|
||||
width: 100%;
|
||||
line-height: 120rpx;
|
||||
border-bottom: 2rpx solid #e2dcdc;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.name{
|
||||
height: 120rpx;
|
||||
width: 300rpx;
|
||||
padding-left: 30rpx;
|
||||
font-size: 34rpx;
|
||||
color: #444;
|
||||
}
|
||||
.icon{
|
||||
height: 120rpx;
|
||||
width: 150rpx;
|
||||
text-align: center;
|
||||
color: #e2e2e2;
|
||||
font-size: 35rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user