const util = require('../../utils/util.js'); const api = require('../../config/api.js'); const user = require('../../utils/user.js'); //获取应用实例 const app = getApp(); Page({ data: { actionsheetVisible: false, listStand: [], listAddtion: [], //学生信息 list:[], loadingHidden: true, flag: false, openid: '', //任务信息 xyrwList: [], rwname: '', rwstatus: '', rwempty: 0, batchno: '', //默认为0,从根节点开始 parentid: 0, //学生归属的学校id deptid: 0, //学生选择 studentxpList:[], studentxpListBackup: [], studentIndexes: '', studentcurrent: '', studentSwitch: false, //班级选择 classxpList:[], classxpListBackup: [], classIndexes: '', classcurrent: '', classSwitch: false, //学校选择 schoolxpList:[], schoolxpListBackup: [], schoolIndexes: '', schoolcurrent: '', schoolSwitch: false, //社区选择 sqxpList:[], sqxpListBackup: [], sqIndexes: '', sqcurrent: '', sqSwitch: false, //街道选择 deptxpList:[], deptxpListBackup: [], deptIndexes: '', deptcurrent: '', UserSwitch: false, //体检部门信息 jdname: '', sqname: '', schoolname: '', classname: '', studentname: '', xytjinfo: { jdid: '', jdname: '', sqid: '', sqname: '', schoolid: '', schoolname: '', classid: '', classname: '' }, // 下拉框选项组件 dropvalue: '1', droplists: [ {value:'1',text:'请选择项目名称'} ], imgUrls: ["https://fy.btlsoln.com:8443/showFile/hospitalNotice/20220507/1651912958699.jpg", "https://fy.btlsoln.com:8443/showFile/hospitalNotice/20220507/1651912958699.jpg"], indicatorDots: false, autoplay: true, interval: 3000, duration: 500, checked: true }, naviToAdd(){ let state = 0 wx.navigateTo({ url: '/pages/tjsmMgr/tjsmMgr', }) }, handleActionsheet() { this.actionsheetVisible = !this.actionsheetVisible; this.setData({ actionsheetVisible: this.actionsheetVisible }); }, naviToDet: function(event) { console.log("naviToDet"); console.log(event, "evnet"); const index = event.currentTarget.dataset.index console.log(index, 'selectindex'); console.log(index.name, 'selectItem'); const selectName = index.name const selectNationId = index.nationId const selectClassName = index.className const selectSchoolName = index.schoolName const selectPatid = index.patid wx.navigateTo({ url: '/pages/categorysm/categorysm?name=' + selectName + '&nationid=' + selectNationId + '&classname=' + selectClassName + '&schoolname=' + selectSchoolName + '&patid=' + selectPatid, }) }, naviToInfo: function(event) { console.log("naviToInfo"); console.log(event, "evnet"); const index = event.currentTarget.dataset.index console.log(index, 'selectindex'); if(index.feeflag == "1"){ this.getXyOrder(index.patid); } }, getXyOrder(patid){ let that = this; util.requestPost(api.smlistOrder, { patid: patid }) .then(function(res) { console.log(res); if (res.errCode === '0') { console.log("listOrder res:"); console.log(res); that.setData({ listStand: res.listStand, listAddtion: res.listAddtion, actionsheetVisible: true }); } else{ } }); }, //取学生列表 getPerList(batchno){ var that = this; util.request(api.smstudentByparent, { openid: app.globalData.openId, batchno: batchno }) .then(function(res) { if (res.code === 0) { console.log("list res:"); console.log(res); console.log("list resdata:"); console.log(res.data); that.setData({ list: res.data }); console.log("list length", that.data.list.length); if(that.data.list.length == 0 ){ that.setData({ loadingHidden: false, flag: false }); }else{ //有体检人,取出默认体检人 var filterNum = that.data.list.filter(function(person,index,arrs){ return person.defaultflag==0 }); console.log("fileter"); console.log(filterNum); that.setData({ loadingHidden: true, flag: true }); } that.setData({ loadingHidden: true }); } }); }, //获取下园任务列表 getXyrwList: function() { var that = this; util.request(api.smxyrwinfo, { }) .then(function(res) { if (res.code === 0) { console.log("xyrwinfo resdata:"); console.log(res.data); that.setData({ xyrwList: res.data }); if(res.data.length == 0){ that.setData({ rwempty: 0 }); app.globalData.hasXyrw = false; }else{ that.setData({ rwempty: 1, rwname: res.data[0].batchName, rwstatus: res.data[0].batchStatus }); app.globalData.hasXyrw = true; } if(res.data[0].batchStatus == '1') { that.setData({ rwstatus: '开始', batchno: res.data[0].batchno }); that.getPerList(res.data[0].batchno); } } }); }, //学生 studentList: function() { var that = this; util.request(api.smstudentinfo, { deptid: this.data.deptid }) .then(function(res) { if (res.code === 0) { console.log("studentinfo res:"); console.log(res); console.log("studentinfo resdata:"); console.log(res.data); that.setData({ studentxpList: res.data, studentxpListBackup: res.data }); } }); }, //开启控件 studentOn: function(){ this.setData({ studentSwitch: true }) }, //关闭控件 studentShutdown: function(){ let List = []; this.setData({ studentSwitch: false }) //恢复数据 for(let i = 0;i < this.data.studentxpListBackup.length;i++){ List.push(this.data.studentxpListBackup[i]); } this.setData({ studentxpList: List, studentIndexes: '' }) }, //条件输入事件 setstudentIndexes(event){ this.setData({ studentIndexes: event.detail, }); console.log("studentIndexes:" + event.detail) }, //点击确定搜索时触发事件 studentGo: function(){ wx.showToast({ title: '加载中', icon: "loading", duration: 1000 }) let row = []; if(this.data.studentIndexes){ this.data.studentxpListBackup.forEach((item) => { if (item.name.indexOf(this.data.studentIndexes) > -1) { row.push(item); } }); }else{ row = this.data.studentxpListBackup } this.setData({ studentcurrent: this.data.studentIndexes, studentxpList: row }) }, //用户选择某个选项后触发事件 studentIdentification(event){ let List = []; let Backups = this.data.studentxpListBackup; let id = event.detail.value.id; console.log("pick select value:"); console.log(event.detail.value); console.log("pick select id:" + event.detail.index); this.data.xytjinfo.studentid = event.detail.value.id; this.data.xytjinfo.studentname = event.detail.value.name; this.setData({ studentname: event.detail.value.name }); //根据选择的id,获取下一级结构 //this.setData({ parentid: event.detail.value.id}); //this.studengList(); console.log("set select studentid:" + this.data.xytjinfo.studengid); console.log("set select studentname:" + this.data.xytjinfo.studengname); for(let i = 0;i < Backups.length;i++){ List.push(Backups[i]); } this.setData({ studentxpList: List, }) console.log("pick after list:"); console.log(this.data.studentxpList); console.log("pick after list backup"); console.log(this.data.studentxpListBackup); this.studentShutdown(); }, //班级 classList: function() { var that = this; util.request(api.smdeptinfo, { parentid: this.data.parentid }) .then(function(res) { if (res.code === 0) { console.log("classinfo res:"); console.log(res); console.log("classinfo resdata:"); console.log(res.data); that.setData({ classxpList: res.data, classxpListBackup: res.data }); } }); }, //开启控件 classOn: function(){ this.setData({ classSwitch: true }) }, //关闭控件 classShutdown: function(){ let List = []; this.setData({ classSwitch: false }) //恢复数据 for(let i = 0;i < this.data.classxpListBackup.length;i++){ List.push(this.data.classxpListBackup[i]); } this.setData({ classxpList: List, classIndexes: '' }) }, //条件输入事件 setclassIndexes(event){ this.setData({ classIndexes: event.detail, }); console.log("classIndexes:" + event.detail) }, //点击确定搜索时触发事件 classGo: function(){ wx.showToast({ title: '加载中', icon: "loading", duration: 1000 }) let row = []; if(this.data.classIndexes){ this.data.classxpListBackup.forEach((item) => { if (item.name.indexOf(this.data.classIndexes) > -1) { row.push(item); } }); }else{ row = this.data.classxpListBackup } this.setData({ classcurrent: this.data.classIndexes, classxpList: row }) }, //用户选择某个选项后触发事件 classIdentification(event){ let List = []; let Backups = this.data.classxpListBackup; let id = event.detail.value.id; console.log("pick select value:"); console.log(event.detail.value); console.log("pick select id:" + event.detail.index); this.data.xytjinfo.classid = event.detail.value.id; this.data.xytjinfo.classname = event.detail.value.name; this.setData({ classname: event.detail.value.name }); //根据选择的id,获取下一级结构 this.setData({ deptid: event.detail.value.id}); this.studentList(); console.log("set select classid:" + this.data.xytjinfo.classid); console.log("set select classname:" + this.data.xytjinfo.classname); for(let i = 0;i < Backups.length;i++){ List.push(Backups[i]); } this.setData({ classxpList: List, }) console.log("pick after list:"); console.log(this.data.classxpList); console.log("pick after list backup"); console.log(this.data.classxpListBackup); this.classShutdown(); }, //学校 schoolList: function() { var that = this; util.request(api.smdeptinfo, { parentid: this.data.parentid }) .then(function(res) { if (res.code === 0) { console.log("schoolinfo res:"); console.log(res); console.log("schoolinfo resdata:"); console.log(res.data); that.setData({ schoolxpList: res.data, schoolxpListBackup: res.data }); } }); }, //开启控件 schoolOn: function(){ this.setData({ schoolSwitch: true }) }, //关闭控件 schoolShutdown: function(){ let List = []; this.setData({ schoolSwitch: false }) //恢复数据 for(let i = 0;i < this.data.schoolxpListBackup.length;i++){ List.push(this.data.schoolxpListBackup[i]); } this.setData({ schoolxpList: List, schoolIndexes: '' }) }, //条件输入事件 setschoolIndexes(event){ this.setData({ schoolIndexes: event.detail, }); console.log("schoolIndexes:" + event.detail) }, //点击确定搜索时触发事件 schoolGo: function(){ wx.showToast({ title: '加载中', icon: "loading", duration: 1000 }) let row = []; if(this.data.schoolIndexes){ this.data.schoolxpListBackup.forEach((item) => { if (item.name.indexOf(this.data.schoolIndexes) > -1) { row.push(item); } }); }else{ row = this.data.schoolxpListBackup } this.setData({ schoolcurrent: this.data.schoolIndexes, schoolxpList: row }) }, //用户选择某个选项后触发事件 schoolIdentification(event){ let List = []; let Backups = this.data.schoolxpListBackup; let id = event.detail.value.id; console.log("pick select value:"); console.log(event.detail.value); console.log("pick select id:" + event.detail.index); this.data.xytjinfo.schoolid = event.detail.value.id; this.data.xytjinfo.schoolname = event.detail.value.name; this.setData({ schoolname: event.detail.value.name }); //根据选择的id,获取下一级结构 this.setData({ parentid: event.detail.value.id}); this.classList(); console.log("set select schoolid:" + this.data.xytjinfo.schoolid); console.log("set select schoolname:" + this.data.xytjinfo.schoolname); for(let i = 0;i < Backups.length;i++){ List.push(Backups[i]); } this.setData({ schoolxpList: List, }) console.log("pick after list:"); console.log(this.data.schoolxpList); console.log("pick after list backup"); console.log(this.data.schoolxpListBackup); this.schoolShutdown(); }, //社区 sqList: function() { var that = this; util.request(api.smdeptinfo, { parentid: this.data.parentid }) .then(function(res) { if (res.code === 0) { console.log("sqinfo res:"); console.log(res); console.log("sqinfo resdata:"); console.log(res.data); that.setData({ sqxpList: res.data, sqxpListBackup: res.data }); } }); }, //开启控件 sqOn: function(){ this.setData({ sqSwitch: true }) }, //关闭控件 sqShutdown: function(){ let List = []; this.setData({ sqSwitch: false }) //恢复数据 for(let i = 0;i < this.data.sqxpListBackup.length;i++){ List.push(this.data.sqxpListBackup[i]); } this.setData({ sqxpList: List, sqIndexes: '' }) }, //条件输入事件 setsqIndexes(event){ this.setData({ sqIndexes: event.detail, }); console.log("sqIndexes:" + event.detail) }, //点击确定搜索时触发事件 sqGo: function(){ wx.showToast({ title: '加载中', icon: "loading", duration: 1000 }) let row = []; if(this.data.sqIndexes){ this.data.sqxpListBackup.forEach((item) => { if (item.name.indexOf(this.data.sqIndexes) > -1) { row.push(item); } }); }else{ row = this.data.sqxpListBackup } this.setData({ sqcurrent: this.data.sqIndexes, sqxpList: row }) }, //用户选择某个选项后触发事件 sqIdentification(event){ let List = []; let Backups = this.data.sqxpListBackup; let id = event.detail.value.id; console.log("pick select value:"); console.log(event.detail.value); console.log("pick select id:" + event.detail.index); this.data.xytjinfo.sqid = event.detail.value.id; this.data.xytjinfo.sqname = event.detail.value.name; this.setData({ sqname: event.detail.value.name }); //根据选择的id,获取下一级结构 this.setData({ parentid: event.detail.value.id}); this.schoolList(); console.log("set select sqid:" + this.data.xytjinfo.sqid); console.log("set select sqname:" + this.data.xytjinfo.sqname); for(let i = 0;i < Backups.length;i++){ List.push(Backups[i]); } this.setData({ sqxpList: List, }) console.log("pick after list:"); console.log(this.data.sqxpList); console.log("pick after list backup"); console.log(this.data.sqxpListBackup); this.sqShutdown(); }, //街道 deptList: function() { var that = this; util.request(api.smdeptinfo, { parentid: this.data.parentid }) .then(function(res) { if (res.code === 0) { console.log("deptinfo res:"); console.log(res); console.log("deptinfo resdata:"); console.log(res.data); that.setData({ deptxpList: res.data, deptxpListBackup: res.data }); } }); }, //条件输入事件 setDeptIndexes(event){ this.setData({ deptIndexes: event.detail, }); console.log("deptIndexes:" + event.detail) }, //点击确定搜索时触发事件 DeptGo: function(){ wx.showToast({ title: '加载中', icon: "loading", duration: 1000 }) let row = []; if(this.data.deptIndexes){ this.data.deptxpListBackup.forEach((item) => { if (item.name.indexOf(this.data.deptIndexes) > -1) { row.push(item); } }); }else{ row = this.data.deptxpListBackup } this.setData({ deptcurrent: this.data.deptIndexes, deptxpList: row }) }, //开启控件 UserOn: function(){ this.setData({ UserSwitch: true }) }, //关闭控件 UserShutdown: function(){ let List = []; this.setData({ UserSwitch: false }) //恢复数据 for(let i = 0;i < this.data.deptxpListBackup.length;i++){ List.push(this.data.deptxpListBackup[i]); } this.setData({ deptxpList: List, deptIndexes: '' }) }, //用户选择某个选项后触发事件 UserIdentification(event){ let List = []; let Backups = this.data.deptxpListBackup; let id = event.detail.value.id; console.log("pick select value:"); console.log(event.detail.value); console.log("pick select id:" + event.detail.index); this.data.xytjinfo.jdid = event.detail.value.id; this.data.xytjinfo.jdname = event.detail.value.name; this.setData({ jdname: event.detail.value.name }); //根据选择的id,获取下一级结构 this.setData({ parentid: event.detail.value.id}); this.sqList(); console.log("set select jdid:" + this.data.xytjinfo.jdid); console.log("set select jdname:" + this.data.xytjinfo.jdname); for(let i = 0;i < Backups.length;i++){ List.push(Backups[i]); } this.setData({ deptxpList: List, }) console.log("pick after list:"); console.log(this.data.deptxpList); console.log("pick after list backup"); console.log(this.data.deptxpListBackup); this.UserShutdown(); }, onChange({ detail }) { this.setData({ checked: detail }); }, onShareAppMessage: function() { return { title: '下园体检', desc: '下园体检', path: '/pages/index/index' } }, onPullDownRefresh() { wx.showNavigationBarLoading() //在标题栏中显示加载 wx.hideNavigationBarLoading() //完成停止加载 wx.stopPullDownRefresh() //停止下拉刷新 }, getImgList(){ wx.request({ url:'https://fy.btlsoln.com:8443/findHospitalNotice', method:"GET", data:{}, header: { 'content-type': 'application/json' }, success: (res)=> { console.log(res,'lunbotu') this.setData({ imgUrls:res.data }) } }) }, onLoad: function(options) { console.log("xytj load"); }, onReady: function() { // 页面渲染完成 }, onShow: function() { // 页面显示 console.log("xytj onshow"); this.getXyrwList(); this.deptList(); // 页面初始化 options为页面跳转所带来的参数 //this.getPerList(); this.setData({ loadingHidden: false, }) }, onHide: function() { // 页面隐藏 }, onUnload: function() { // 页面关闭 }, })