110 lines
2.1 KiB
JavaScript
110 lines
2.1 KiB
JavaScript
|
|
// 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 () {
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|